dsh-github-copilot 0.4.0-alpha.116 → 0.4.0-alpha.118
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 +13 -0
- package/README.md +12 -6
- package/README.zh.md +12 -6
- package/deployment-baseline.json +4 -1
- package/lib/client.js +120 -40
- package/lib/client.js.map +1 -1
- package/lib/index.js +10 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0-alpha.118 (prepared)
|
|
4
|
+
|
|
5
|
+
- Reuse confirmed model-preference CAS readback instead of describing all settings a third time for successful Exclude/Restore/High cost saves (#339).
|
|
6
|
+
- Keep pending and confirmed preference edits across equivalent parent snapshots. Account metadata can update independently without discarding a shared-preference save or restoring an old availability snapshot.
|
|
7
|
+
- Allow distinct model rows to wait in a bounded, mounted-only queue, while issuing only one narrow write at a time. Show Saving/Waiting explicitly; cancel unsent edits after unconfirmed outcomes or scope replacement and require saved-settings Retry, never automatic write replay.
|
|
8
|
+
- Native Models `llm/listProviders failed: Failed to fetch` remains a separate Host/gateway transport limitation, not evidence of forced account discovery. No Core changes, transport workaround, live latency claim, installation or restart.
|
|
9
|
+
|
|
10
|
+
## 0.4.0-alpha.117 (prepared)
|
|
11
|
+
|
|
12
|
+
- Separate confirmed Session account selection from quota loading (#337). Preserve correctly attributed quota for follow-mode-only changes without duplicate account or quota reads.
|
|
13
|
+
- Reuse the strict save response, immediately restore account controls and focus, and load a different account's quota independently. Slow or failed quota cannot undo a confirmed save; newer selections and invalidations revoke late responses.
|
|
14
|
+
- Keep continuation consent, post-consent revision reread, native CAS, account isolation and running-turn ownership unchanged. No forced model refresh, Core changes, live calls, installation or restart.
|
|
15
|
+
|
|
3
16
|
## 0.4.0-alpha.116 (prepared)
|
|
4
17
|
|
|
5
18
|
- Add immediate, cross-account High cost marking to existing model-preference rows through strict narrow Remotes and public SettingsForms CAS/readback (#333).
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Visible Models and Credits resolve missing names for saved accounts without acti
|
|
|
23
23
|
|
|
24
24
|
Adding an account now keeps the device-authorization link, selectable URL, one-time code, Copy code action and Cancel together while authorization is pending. After GitHub authorizes, identity and model verification are shown as a separate phase. Adding never changes the global default; use the existing explicit **Switch** action when ready. Technical diagnostics are secondary, and account/turn identity fallbacks never expose opaque account IDs or infer historical identity from today's settings.
|
|
25
25
|
|
|
26
|
-
**Source candidate: `0.4.0-alpha.
|
|
26
|
+
**Source candidate: `0.4.0-alpha.118` (unreleased). Supported host: official DSH / Windows Desktop `0.2.0-rc.2`.** Earlier DSH pins are historical evidence, not supported installation targets. Publication, profile installation and the version loaded by a running Host are separate states. The versioned commands below are for this candidate after publication, not evidence that its assets exist.
|
|
27
27
|
|
|
28
28
|
## What you can do
|
|
29
29
|
|
|
@@ -80,10 +80,10 @@ Supply any launcher patches with repeated `--patch /absolute/file`. Require `sup
|
|
|
80
80
|
For a **standalone named profile**:
|
|
81
81
|
|
|
82
82
|
```sh
|
|
83
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
83
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.118/dsh-github-copilot-0.4.0-alpha.118.tgz
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.
|
|
86
|
+
For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.118` after publication. Official rc.2's **Desktop-bundled CLI** also supports reserved-profile plugin management; a global/generic `dsh` shim is not equivalent. Qualify the installed entry before use. See [Desktop CLI qualification](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2) and the distinct [standalone offline procedure](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles). Neither path authorizes registry-policy bypass, peer patches or configuration deletion.
|
|
87
87
|
|
|
88
88
|
After an approved reload/restart:
|
|
89
89
|
|
|
@@ -105,6 +105,10 @@ Account eligibility reads official rc.2 SettingsForms values, without requiring
|
|
|
105
105
|
|
|
106
106
|
## Auto and model preferences
|
|
107
107
|
|
|
108
|
+
**Saving preferences:** Exclude/Restore and High cost reuse their confirmed narrow save result without a status/model refresh or redundant final settings traversal. Equivalent parent snapshots preserve pending and locally confirmed edits. Other rows remain usable: up to 32 distinct-row edits can wait, marked **Waiting…**, while exactly one is **Saving…**. No change is shown as saved before native CAS readback. An unconfirmed outcome or changed preference scope cancels unsent edits; **Retry** reads saved settings without replaying writes or discovering models. The queue is not persistent and does not survive unmount.
|
|
109
|
+
|
|
110
|
+
**Provider-directory load failures:** native Models `llm/listProviders failed: Failed to fetch` is a Client-to-Host/gateway transport failure, not proof of forced Copilot model discovery. Use the native page's **Retry** after the connection recovers. The plugin does not intercept that Core-owned request, replace it with stale/empty success, or claim this save optimization repairs transport availability. Synthetic checks prove reduced work and responsive sequencing, not measured live latency.
|
|
111
|
+
|
|
108
112
|
All three Auto preferences use the same account-verified, non-excluded eligible pool. Hard input/image capability checks run before soft task preferences.
|
|
109
113
|
|
|
110
114
|
| Task demand | Efficiency | Balance | Intelligence |
|
|
@@ -193,6 +197,8 @@ Configuration is under `github-copilot`. Credentials, endpoint definitions and a
|
|
|
193
197
|
| 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. |
|
|
194
198
|
| Hosted search unavailable | Check account/protocol/probe diagnostics; a legacy override stays authoritative until explicitly reset |
|
|
195
199
|
|
|
200
|
+
Confirmed account saves restore controls immediately, independently of quota loading. Changing only follow mode for the same account retains its attributed quota without another read. Switching accounts clears the old quota and loads the new snapshot without blocking further account edits; quota errors do not undo a confirmed selection.
|
|
201
|
+
|
|
196
202
|
The Credits account panel shows the current account and **Switch**. Its dropdown lists only configured accounts, marks the effective account and scrolls long lists internally. **Follow global default** is a separate checkbox: enabling it clears the Session override; disabling it fixes the current account. Choosing any account also fixes it, even if it is today's default. Both actions retain continuation confirmation and revision-checked saving. Account addition belongs only in Models, where one **Manage** disclosure contains account management and shared model preferences. Models retains Add in its dropdown footer without selecting the new account, plus guarded local removal and reauthorization. Neither surface has account search. Exact-ID exclusions are shared across accounts; availability is account-specific. See the [approved experience and interactive mock](./docs/account-management-experience.md).
|
|
197
203
|
|
|
198
204
|
[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.
|
|
@@ -237,14 +243,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
|
|
|
237
243
|
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.
|
|
238
244
|
|
|
239
245
|
```sh
|
|
240
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
241
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
246
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.118/dsh-github-copilot-0.4.0-alpha.118.tgz
|
|
247
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.118/SHA256SUMS
|
|
242
248
|
sha256sum --check SHA256SUMS
|
|
243
249
|
```
|
|
244
250
|
|
|
245
251
|
```powershell
|
|
246
252
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
247
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
253
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.118.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
248
254
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
249
255
|
```
|
|
250
256
|
|
package/README.zh.md
CHANGED
|
@@ -21,7 +21,7 @@ Models 和 Chat 共用不透明、随主题适配的账号下拉层;原生菜
|
|
|
21
21
|
|
|
22
22
|
添加账号时,设备授权链接、可选择的网址、一次性授权码、复制授权码和取消操作会同时显示。GitHub 授权完成后,会单独显示身份与可用模型验证阶段。添加账号不会更改全局默认;准备好后仍需显式执行现有的**切换**操作。技术诊断收在次级折叠区;账号/历史 turn 缺少身份时不会暴露不透明账号 ID,也不会根据当前设置推断历史身份。
|
|
23
23
|
|
|
24
|
-
**源码候选版本:`0.4.0-alpha.
|
|
24
|
+
**源码候选版本:`0.4.0-alpha.118`(尚未发布)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。下方带版本的命令适用于候选版本发布后,不代表对应资产已经存在。
|
|
25
25
|
|
|
26
26
|
## 你可以做什么
|
|
27
27
|
|
|
@@ -73,10 +73,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
|
|
|
73
73
|
**独立具名 profile**:
|
|
74
74
|
|
|
75
75
|
```sh
|
|
76
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
76
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.118/dsh-github-copilot-0.4.0-alpha.118.tgz
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.
|
|
79
|
+
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.118`。官方 rc.2 **Desktop 随附的专属 CLI**也支持管理保留 profile;全局/普通 `dsh` shim 不等价。使用前核验实际安装入口,参见[Desktop CLI 核验](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2)及独立的[具名 profile 离线流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)。两种路径都不授权绕过包源政策、修改 peer 或删除配置。
|
|
80
80
|
|
|
81
81
|
经批准 reload/restart 后:
|
|
82
82
|
|
|
@@ -98,6 +98,10 @@ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/release
|
|
|
98
98
|
|
|
99
99
|
## Auto 与模型偏好
|
|
100
100
|
|
|
101
|
+
**保存偏好:**Exclude/Restore 和 High cost 复用严格确认的单模型保存结果,不重读账号状态/模型,也不重复执行最后一次完整设置遍历。内容相同的父组件快照不会清掉待保存操作或已确认结果。其它模型行仍可操作:最多 32 个不同行的意图显示 **Waiting…**,同时只发出一个 **Saving…** 请求。原生 CAS 读回确认前不会显示保存成功。结果无法确认或偏好作用域变化时取消尚未发送的操作;**Retry** 只重读已保存设置,不重放写入或发现模型。队列仅在当前组件内,卸载后不保留。
|
|
102
|
+
|
|
103
|
+
**模型目录加载失败:**原生 Models 的 `llm/listProviders failed: Failed to fetch` 属于 Client 到 Host/网关的请求传输失败,不能证明 Copilot 强制刷新。连接恢复后使用原生页面的 **Retry**。插件不拦截 Core 拥有的请求、不用过期/空目录伪装成功,也不声称本次保存优化已修复连接可用性。合成验证证明减少工作与响应式串行操作,不证明真实环境毫秒级提速。
|
|
104
|
+
|
|
101
105
|
三档 Auto 共用账号验证、未排除的合格模型池。输入/图片能力等硬门槛先于任务偏好。
|
|
102
106
|
|
|
103
107
|
| 任务需求 | Efficiency | Balance | Intelligence |
|
|
@@ -186,6 +190,8 @@ HTTP/SSE liveness 默认区分 5 分钟字节 idle 和有界的 10 分钟助手
|
|
|
186
190
|
| 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。 |
|
|
187
191
|
| Hosted search 不可用 | 检查账号/协议/probe 诊断;旧 override 保留至显式 reset |
|
|
188
192
|
|
|
193
|
+
账号保存确认后立即恢复控件,不等待额度读取。同账号仅改变跟随方式时保留已确认归属的额度,不重复读取;真正换账号时清除旧额度,独立加载新快照,不阻塞后续账号编辑。额度读取失败不会撤销已经确认的账号选择。
|
|
194
|
+
|
|
189
195
|
Credits 账号面板显示当前账号和 **切换**,下拉菜单只列已有账号,为当前实际账号打勾,长列表内部滚动。**跟随全局默认**是独立复选框:开启时清除本会话指定,关闭时固定当前账号;手动选择账号也会固定,即使所选恰好是当前全局默认。两种操作均保持续聊确认和 revision 校验保存。添加账号只留在 Models,其 **管理** 展开账号管理与共享模型偏好,菜单底部添加账号但不自动选中,并保留重新授权与受保护的本地账号移除。两处都没有账号搜索框。按精确模型 ID 共享排除偏好,可用性仍按账号验证。参见[已确认体验与交互 mock](./docs/account-management-experience.md)。
|
|
190
196
|
|
|
191
197
|
[可见历史续聊模式](./docs/session-continuation.md)放在账号切换旁,不再常驻输入框上方。功能首次成功激活后创建的非继承 Session 默认开启;已有 Session、继承历史仍需明确授权。全局默认只影响新 Session,Session 开关跨账号及重启保留,直到关闭。关闭时切换到不同账号,提供持续开启、保持关闭或取消,不再提供仅下一轮模式。启用后的每个新 turn 省略旧加密推理及其内嵌摘要,同账号也适用;当前轮新推理、可见消息、工具记录和磁盘历史不变。授权不自动发送或重试,不解决额度或上下文超限。精确回放失败使用同一个持久策略,用户另行点击原生重试。当前 Core 没有公开 Models 直达 API,Chat 不展示不可用的管理入口;完整管理仍在设置 → 模型 → GitHub Copilot → 管理。
|
|
@@ -230,14 +236,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
|
|
|
230
236
|
GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
|
|
231
237
|
|
|
232
238
|
```sh
|
|
233
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
234
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
239
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.118/dsh-github-copilot-0.4.0-alpha.118.tgz
|
|
240
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.118/SHA256SUMS
|
|
235
241
|
sha256sum --check SHA256SUMS
|
|
236
242
|
```
|
|
237
243
|
|
|
238
244
|
```powershell
|
|
239
245
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
240
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
246
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.118.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
241
247
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
242
248
|
```
|
|
243
249
|
|
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.118"
|
|
12
12
|
},
|
|
13
13
|
"evidence": {
|
|
14
14
|
"kind": "source-and-synthetic-test-inventory",
|
|
@@ -675,6 +675,9 @@
|
|
|
675
675
|
{"file": "tests/preview-route.spec.ts", "name": "uses unmodified stock LlmRuntime preparation and leaves canonical model registration alone"},
|
|
676
676
|
{"file": "tests/fixtures/model-exclusions-core.fixture.ts", "name": "keeps native tool steps in an admitted turn after exclusion and enforces exclusion on the next turn (%s)"},
|
|
677
677
|
{"file": "tests/authorization-controller.spec.ts", "name": "answers a narrow single-model save without reading credentials or enumerating sessions"},
|
|
678
|
+
{"file": "tests/model-preferences-card.spec.ts", "name": "keeps a real mounted row saving across equivalent parent snapshots and applies the strict result without rereading"},
|
|
679
|
+
{"file": "tests/model-preferences-card.spec.ts", "name": "sends one CAS intent at a time and never sends a queued intent after an unconfirmed response"},
|
|
680
|
+
{"file": "tests/model-preferences-card.spec.ts", "name": "cancels unsent row intents explicitly on a changed preference scope and ignores the late save"},
|
|
678
681
|
{"file": "tests/preview-route.spec.ts", "name": "replays opaque reasoning and tool-call identities through the native adapter on a second turn"},
|
|
679
682
|
{"file": "tests/preview-route.spec.ts", "name": "enriches only a verified 408 while preserving native failure classification and retry ownership"},
|
|
680
683
|
{"file": "tests/preview-provider.spec.ts", "name": "observes verified %s timeout without changing bytes, Response, native retries or credential ownership"},
|
package/lib/client.js
CHANGED
|
@@ -9691,7 +9691,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9691
9691
|
setChoosingAccount(false);
|
|
9692
9692
|
switchButton.current?.focus();
|
|
9693
9693
|
};
|
|
9694
|
-
const load = (0, react.useCallback)(async (force) => {
|
|
9694
|
+
const load = (0, react.useCallback)(async (force, confirmed) => {
|
|
9695
9695
|
const owner = lifecycle.current;
|
|
9696
9696
|
if (!owner.active || owner.busy || owner.save !== void 0 || accountPresentationChanges.pending() || props.remote === void 0 || document.visibilityState === "hidden") return;
|
|
9697
9697
|
owner.busy = true;
|
|
@@ -9703,8 +9703,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9703
9703
|
const identityOperation = props.accountsRemote === void 0 ? void 0 : (force ? props.accountsRemote.refreshIdentity() : props.accountsRemote.ensureIdentity()).catch(() => void 0);
|
|
9704
9704
|
const [result, identityResult, sessionResult] = await Promise.all([
|
|
9705
9705
|
force ? props.remote.refresh() : props.remote.get(),
|
|
9706
|
-
props.accountsRemote?.get().catch(() => void 0)
|
|
9707
|
-
|
|
9706
|
+
confirmed === void 0 ? props.accountsRemote?.get().catch(() => void 0) : {
|
|
9707
|
+
ok: true,
|
|
9708
|
+
value: confirmed.accounts
|
|
9709
|
+
},
|
|
9710
|
+
confirmed === void 0 ? props.sessionAccount?.get() : {
|
|
9711
|
+
ok: true,
|
|
9712
|
+
value: confirmed
|
|
9713
|
+
}
|
|
9708
9714
|
]);
|
|
9709
9715
|
if (!current()) return;
|
|
9710
9716
|
const sessionView = sessionResult?.ok ? SessionAccountViewSchema.safeParse(sessionResult.value) : void 0;
|
|
@@ -9733,9 +9739,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9733
9739
|
} catch {
|
|
9734
9740
|
if (current()) {
|
|
9735
9741
|
setView(void 0);
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9742
|
+
if (confirmed === void 0) {
|
|
9743
|
+
setAccounts(void 0);
|
|
9744
|
+
setSessionAccount(void 0);
|
|
9745
|
+
setAccountFailed(props.sessionAccount !== void 0);
|
|
9746
|
+
}
|
|
9739
9747
|
setFailed(true);
|
|
9740
9748
|
}
|
|
9741
9749
|
} finally {
|
|
@@ -9804,6 +9812,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9804
9812
|
const chooseAccount = async (accountId, focus = "switch") => {
|
|
9805
9813
|
const owner = lifecycle.current;
|
|
9806
9814
|
let revision = sessionAccount?.accounts.revision;
|
|
9815
|
+
let quota = view;
|
|
9807
9816
|
if (!owner.active || owner.save !== void 0 || props.sessionAccount === void 0 || revision === void 0) return;
|
|
9808
9817
|
const save = Symbol();
|
|
9809
9818
|
const controller = new AbortController();
|
|
@@ -9834,7 +9843,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9834
9843
|
revision = selection.data.accounts.revision;
|
|
9835
9844
|
setSessionAccount(selection.data);
|
|
9836
9845
|
setAccounts(selection.data.accounts);
|
|
9837
|
-
|
|
9846
|
+
if (quota?.accountId !== selection.data.accountId) {
|
|
9847
|
+
quota = void 0;
|
|
9848
|
+
setView(void 0);
|
|
9849
|
+
}
|
|
9838
9850
|
owner.confirmation = void 0;
|
|
9839
9851
|
setConfirmingAccount(false);
|
|
9840
9852
|
}
|
|
@@ -9850,12 +9862,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9850
9862
|
}
|
|
9851
9863
|
setSessionAccount(parsed.data);
|
|
9852
9864
|
setAccounts(parsed.data.accounts);
|
|
9853
|
-
|
|
9865
|
+
setAccountFailed(false);
|
|
9866
|
+
setFailed(false);
|
|
9867
|
+
const retainedQuota = quota !== void 0 && quota.accountId === parsed.data.accountId && sessionAccount?.accountId === parsed.data.accountId;
|
|
9868
|
+
if (!retainedQuota) setView(void 0);
|
|
9854
9869
|
setChoosingAccount(false);
|
|
9855
9870
|
owner.save = void 0;
|
|
9856
9871
|
setSavingAccount(false);
|
|
9857
|
-
|
|
9858
|
-
if (
|
|
9872
|
+
setRestoreAccountFocus(focus);
|
|
9873
|
+
if (!retainedQuota) load(false, parsed.data);
|
|
9859
9874
|
} catch {
|
|
9860
9875
|
if (owner.active && owner.generation === generation) {
|
|
9861
9876
|
setAccountSaveFailed(true);
|
|
@@ -9874,13 +9889,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9874
9889
|
}
|
|
9875
9890
|
};
|
|
9876
9891
|
(0, react.useLayoutEffect)(() => {
|
|
9877
|
-
if (!open ||
|
|
9892
|
+
if (!open || savingAccount || restoreAccountFocus === void 0) return;
|
|
9878
9893
|
if (restoreAccountFocus === "follow") followCheckbox.current?.focus();
|
|
9879
9894
|
else switchButton.current?.focus();
|
|
9880
9895
|
setRestoreAccountFocus(void 0);
|
|
9881
9896
|
}, [
|
|
9882
9897
|
open,
|
|
9883
|
-
busy,
|
|
9884
9898
|
savingAccount,
|
|
9885
9899
|
restoreAccountFocus
|
|
9886
9900
|
]);
|
|
@@ -10062,7 +10076,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10062
10076
|
open: choosingAccount,
|
|
10063
10077
|
busy: savingAccount,
|
|
10064
10078
|
maxHeight: 220,
|
|
10065
|
-
disabled: sessionAccount === void 0 || sessionAccount.accounts.revision === void 0 ||
|
|
10079
|
+
disabled: sessionAccount === void 0 || sessionAccount.accounts.revision === void 0 || savingAccount,
|
|
10066
10080
|
onOpenChange: (next) => {
|
|
10067
10081
|
if (!next) collapseAccounts();
|
|
10068
10082
|
else setChoosingAccount(true);
|
|
@@ -10081,7 +10095,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10081
10095
|
type: "checkbox",
|
|
10082
10096
|
"data-copilot-follow-global": "",
|
|
10083
10097
|
checked: sessionAccount?.source === "global",
|
|
10084
|
-
disabled: sessionAccount === void 0 || sessionAccount.accounts.revision === void 0 ||
|
|
10098
|
+
disabled: sessionAccount === void 0 || sessionAccount.accounts.revision === void 0 || savingAccount,
|
|
10085
10099
|
"aria-describedby": `${id}-follow-hint`,
|
|
10086
10100
|
onChange: (event) => {
|
|
10087
10101
|
const accountId = event.currentTarget.checked ? null : sessionAccount?.accountId;
|
|
@@ -11129,6 +11143,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11129
11143
|
padding: "7px 12px",
|
|
11130
11144
|
minHeight: "36px"
|
|
11131
11145
|
};
|
|
11146
|
+
const MAX_QUEUED_EDITS = 32;
|
|
11132
11147
|
function preferenceMessage(code) {
|
|
11133
11148
|
switch (code) {
|
|
11134
11149
|
case "COPILOT_MODEL_SETTINGS_UNAVAILABLE": return "Cannot read model preference settings. Models are read-only. Retry to read settings again.";
|
|
@@ -11137,6 +11152,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11137
11152
|
case "COPILOT_MODEL_EXCLUSION_SELECTED": return "This model is selected by a session or the default. Select another fixed model there before excluding it.";
|
|
11138
11153
|
case "COPILOT_MODEL_EXCLUSION_CONFLICT": return "Settings changed elsewhere. Review the current list before trying again.";
|
|
11139
11154
|
case "COPILOT_MODEL_EXCLUSION_SAVE_FAILED": return "Could not confirm the change. Retry to read the saved settings before trying again.";
|
|
11155
|
+
case "COPILOT_MODEL_PREFERENCE_QUEUE_FULL": return "Too many edits are waiting. Let the current saves finish before changing another model.";
|
|
11156
|
+
case "COPILOT_MODEL_PREFERENCE_EDITS_CANCELLED": return "Settings or the connection changed. Waiting edits were not sent. Retry to read saved settings before editing again.";
|
|
11140
11157
|
default: return "The Host did not provide model preferences. Models are read-only. Retry; if this persists, check that Host and Client are running the same plugin version.";
|
|
11141
11158
|
}
|
|
11142
11159
|
}
|
|
@@ -11146,30 +11163,42 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11146
11163
|
const [preferences, setPreferences] = (0, react.useState)(props.preferences);
|
|
11147
11164
|
const [models, setModels] = (0, react.useState)(props.models);
|
|
11148
11165
|
const [busyModel, setBusyModel] = (0, react.useState)();
|
|
11166
|
+
const [queuedModels, setQueuedModels] = (0, react.useState)([]);
|
|
11149
11167
|
const [error, setError] = (0, react.useState)();
|
|
11150
11168
|
const [errorModel, setErrorModel] = (0, react.useState)();
|
|
11151
11169
|
const request = (0, react.useRef)({
|
|
11152
11170
|
generation: 0,
|
|
11153
|
-
pending: false
|
|
11154
|
-
|
|
11171
|
+
pending: false,
|
|
11172
|
+
failed: false,
|
|
11173
|
+
cancelled: false,
|
|
11174
|
+
queue: [],
|
|
11175
|
+
active: ""
|
|
11176
|
+
});
|
|
11177
|
+
const metadata = (0, react.useRef)(props.models);
|
|
11178
|
+
metadata.current = props.models;
|
|
11179
|
+
const preferenceKey = JSON.stringify(props.preferences);
|
|
11155
11180
|
(0, react.useEffect)(() => {
|
|
11156
11181
|
const scope = request.current;
|
|
11157
11182
|
scope.generation++;
|
|
11158
11183
|
scope.pending = false;
|
|
11184
|
+
scope.failed = scope.cancelled;
|
|
11185
|
+
scope.active = "";
|
|
11159
11186
|
setPreferences(props.preferences);
|
|
11160
|
-
|
|
11161
|
-
|
|
11187
|
+
setError(scope.cancelled ? "COPILOT_MODEL_PREFERENCE_EDITS_CANCELLED" : void 0);
|
|
11188
|
+
scope.cancelled = false;
|
|
11162
11189
|
setErrorModel(void 0);
|
|
11163
11190
|
setBusyModel(void 0);
|
|
11191
|
+
setQueuedModels([]);
|
|
11164
11192
|
return () => {
|
|
11193
|
+
scope.cancelled = scope.pending && scope.queue.length > 0;
|
|
11165
11194
|
scope.generation++;
|
|
11166
11195
|
scope.pending = false;
|
|
11196
|
+
for (const edit of scope.queue.splice(0)) edit.resolve();
|
|
11167
11197
|
};
|
|
11168
|
-
}, [
|
|
11169
|
-
|
|
11170
|
-
props.models
|
|
11171
|
-
|
|
11172
|
-
]);
|
|
11198
|
+
}, [preferenceKey, props.remote]);
|
|
11199
|
+
(0, react.useEffect)(() => {
|
|
11200
|
+
setModels(props.models);
|
|
11201
|
+
}, [props.models]);
|
|
11173
11202
|
const available = models?.models ?? [];
|
|
11174
11203
|
const availabilityKnown = models?.state === "ready";
|
|
11175
11204
|
const settingsKnown = preferences !== void 0 && preferences.revision !== void 0;
|
|
@@ -11195,11 +11224,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11195
11224
|
const filtered = rows.filter((model) => (filter === "all" || filter === "enabled" && settingsKnown && !excluded.has(model.id) || filter === "excluded" && settingsKnown && excluded.has(model.id) || filter === "available" && availabilityKnown && model.available || filter === "unavailable" && availabilityKnown && !model.available) && (needle.length === 0 || model.id.toLocaleLowerCase().includes(needle) || model.name.toLocaleLowerCase().includes(needle)));
|
|
11196
11225
|
const visibleCount = available.filter((model) => !excluded.has(model.id)).length;
|
|
11197
11226
|
const unavailableCount = rows.filter((model) => !model.available).length;
|
|
11198
|
-
const
|
|
11227
|
+
const save = async (modelId, restore = false, marking) => {
|
|
11199
11228
|
const scope = request.current;
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
const generation = ++scope.generation;
|
|
11229
|
+
const generation = scope.generation;
|
|
11230
|
+
const capturedMetadata = metadata.current;
|
|
11203
11231
|
const current = () => scope.generation === generation;
|
|
11204
11232
|
setBusyModel(modelId ?? "");
|
|
11205
11233
|
setError(void 0);
|
|
@@ -11207,48 +11235,100 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11207
11235
|
try {
|
|
11208
11236
|
if (modelId !== void 0) {
|
|
11209
11237
|
const result = marking === void 0 ? await props.remote.setModelExcluded(modelId, !restore) : await props.remote.setModelHighCost(modelId, marking);
|
|
11210
|
-
if (!current()) return;
|
|
11238
|
+
if (!current()) return false;
|
|
11211
11239
|
if (!result.ok) {
|
|
11212
11240
|
setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
|
|
11213
|
-
return;
|
|
11241
|
+
return false;
|
|
11214
11242
|
}
|
|
11215
11243
|
const parsed = GitHubCopilotModelPreferencesViewSchema.safeParse(result.value);
|
|
11216
11244
|
if (!parsed.success) {
|
|
11217
11245
|
setError("COPILOT_MODEL_PREFERENCES_UNAVAILABLE");
|
|
11218
|
-
return;
|
|
11246
|
+
return false;
|
|
11219
11247
|
}
|
|
11220
11248
|
setPreferences(parsed.data);
|
|
11221
|
-
|
|
11222
|
-
|
|
11249
|
+
const confirmed = parsed.data.state === "ready" && parsed.data.error === void 0 && parsed.data.writable && parsed.data.revision !== void 0;
|
|
11250
|
+
setError(parsed.data.error ?? (confirmed ? void 0 : "COPILOT_MODEL_PREFERENCES_UNAVAILABLE"));
|
|
11251
|
+
return confirmed;
|
|
11223
11252
|
}
|
|
11224
11253
|
const result = await props.remote.status();
|
|
11225
|
-
if (!current()) return;
|
|
11254
|
+
if (!current()) return false;
|
|
11226
11255
|
if (!result.ok) {
|
|
11227
11256
|
setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
|
|
11228
|
-
return;
|
|
11257
|
+
return false;
|
|
11229
11258
|
}
|
|
11230
11259
|
const parsed = GitHubCopilotAuthorizationViewSchema.safeParse(result.value);
|
|
11231
11260
|
if (!parsed.success) {
|
|
11232
11261
|
setError("COPILOT_MODEL_PREFERENCES_UNAVAILABLE");
|
|
11233
|
-
return;
|
|
11262
|
+
return false;
|
|
11234
11263
|
}
|
|
11235
11264
|
if (!parsed.data.configured || parsed.data.inFlight) {
|
|
11236
11265
|
setPreferences(void 0);
|
|
11237
11266
|
setModels(void 0);
|
|
11238
11267
|
setError("COPILOT_MODEL_PREFERENCES_UNAVAILABLE");
|
|
11239
|
-
return;
|
|
11268
|
+
return false;
|
|
11240
11269
|
}
|
|
11241
11270
|
setPreferences(parsed.data.modelPreferences);
|
|
11242
|
-
setModels(parsed.data.accountModels);
|
|
11271
|
+
if (metadata.current === capturedMetadata) setModels(parsed.data.accountModels);
|
|
11243
11272
|
setError(parsed.data.modelPreferences?.error);
|
|
11273
|
+
return parsed.data.modelPreferences?.writable === true && parsed.data.modelPreferences.revision !== void 0;
|
|
11244
11274
|
} catch {
|
|
11245
11275
|
if (current()) setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
|
|
11276
|
+
return false;
|
|
11246
11277
|
} finally {
|
|
11278
|
+
if (current()) setBusyModel(void 0);
|
|
11279
|
+
}
|
|
11280
|
+
};
|
|
11281
|
+
const update = async (modelId, restore = false, marking) => {
|
|
11282
|
+
const scope = request.current;
|
|
11283
|
+
const generation = scope.generation;
|
|
11284
|
+
const current = () => scope.generation === generation;
|
|
11285
|
+
if (modelId === void 0) {
|
|
11286
|
+
if (scope.pending) return;
|
|
11287
|
+
scope.pending = true;
|
|
11288
|
+
const succeeded = await save();
|
|
11247
11289
|
if (current()) {
|
|
11248
11290
|
scope.pending = false;
|
|
11249
|
-
|
|
11291
|
+
scope.failed = !succeeded;
|
|
11250
11292
|
}
|
|
11293
|
+
return;
|
|
11294
|
+
}
|
|
11295
|
+
if (!writable || scope.failed || scope.pending && scope.active === "" && scope.queue.length === 0 || scope.active === modelId || scope.queue.some((edit) => edit.modelId === modelId)) return;
|
|
11296
|
+
if (scope.queue.length >= MAX_QUEUED_EDITS) {
|
|
11297
|
+
setError("COPILOT_MODEL_PREFERENCE_QUEUE_FULL");
|
|
11298
|
+
setErrorModel(modelId);
|
|
11299
|
+
return;
|
|
11300
|
+
}
|
|
11301
|
+
const completed = new Promise((resolve) => {
|
|
11302
|
+
scope.queue.push({
|
|
11303
|
+
modelId,
|
|
11304
|
+
restore,
|
|
11305
|
+
marking,
|
|
11306
|
+
resolve
|
|
11307
|
+
});
|
|
11308
|
+
});
|
|
11309
|
+
setQueuedModels(scope.queue.map((edit) => edit.modelId));
|
|
11310
|
+
if (!scope.pending) {
|
|
11311
|
+
scope.pending = true;
|
|
11312
|
+
(async () => {
|
|
11313
|
+
while (current() && scope.queue.length > 0) {
|
|
11314
|
+
const edit = scope.queue.shift();
|
|
11315
|
+
scope.active = edit.modelId;
|
|
11316
|
+
setQueuedModels(scope.queue.map((waiting) => waiting.modelId));
|
|
11317
|
+
const succeeded = await save(edit.modelId, edit.restore, edit.marking);
|
|
11318
|
+
edit.resolve();
|
|
11319
|
+
if (!current()) return;
|
|
11320
|
+
scope.active = "";
|
|
11321
|
+
if (!succeeded) {
|
|
11322
|
+
scope.failed = true;
|
|
11323
|
+
for (const waiting of scope.queue.splice(0)) waiting.resolve();
|
|
11324
|
+
setQueuedModels([]);
|
|
11325
|
+
break;
|
|
11326
|
+
}
|
|
11327
|
+
}
|
|
11328
|
+
if (current()) scope.pending = false;
|
|
11329
|
+
})();
|
|
11251
11330
|
}
|
|
11331
|
+
await completed;
|
|
11252
11332
|
};
|
|
11253
11333
|
return (0, react.createElement)("details", { "data-dsh-github-copilot-model-preferences": true }, (0, react.createElement)("summary", null, settingsKnown ? `Model preferences · ${visibleCount} enabled · ${excluded.size} excluded` : "Model preferences · Read-only"), (0, react.createElement)("p", { style: {
|
|
11254
11334
|
fontSize: "14px",
|
|
@@ -11323,7 +11403,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11323
11403
|
}
|
|
11324
11404
|
}, filtered.map((model) => {
|
|
11325
11405
|
const isExcluded = excluded.has(model.id);
|
|
11326
|
-
const disabled = !writable || busyModel
|
|
11406
|
+
const disabled = !writable || request.current.failed || busyModel === "" || busyModel === model.id || queuedModels.includes(model.id);
|
|
11327
11407
|
return (0, react.createElement)("li", {
|
|
11328
11408
|
key: model.id,
|
|
11329
11409
|
style: {
|
|
@@ -11372,7 +11452,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11372
11452
|
onClick: () => update(model.id, isExcluded),
|
|
11373
11453
|
"data-dsh-github-copilot-model-action": isExcluded ? "restore" : "exclude",
|
|
11374
11454
|
"data-model-id": model.id
|
|
11375
|
-
}, busyModel === model.id ? "Saving…" : isExcluded ? "Restore" : "Exclude"));
|
|
11455
|
+
}, busyModel === model.id ? "Saving…" : queuedModels.includes(model.id) ? "Waiting…" : isExcluded ? "Restore" : "Exclude"));
|
|
11376
11456
|
})));
|
|
11377
11457
|
}
|
|
11378
11458
|
//#endregion
|