dsh-github-copilot 0.4.0-alpha.117 → 0.4.0-alpha.119
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 +14 -0
- package/README.md +12 -6
- package/README.zh.md +12 -6
- package/deployment-baseline.json +9 -1
- package/docs/copilot-accounts.md +21 -0
- package/lib/client.js +146 -34
- package/lib/client.js.map +1 -1
- package/lib/index.js +29 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0-alpha.119 (prepared)
|
|
4
|
+
|
|
5
|
+
- Show Models global account metadata before background identity-name hydration, keeping Switch available when metadata and route/activity evidence allow it (#342). Hydration never authorizes a switch and late results cannot undo a confirmed change.
|
|
6
|
+
- Capture the latest parent callback without rebuilding the account card lifetime, avoiding duplicate identity ensures and lost switch responses.
|
|
7
|
+
- Overlap fresh switch identity/model validation under one bounded mutation fence. Both must succeed before CAS; failures cancel and drain sibling work before releasing the fence. Preserve credential identity, membership, route/activity, revision and post-commit checks.
|
|
8
|
+
- Keep Session account/Follows global default ownership, real running turns, native directory transport and account-bound discovery unchanged. No live latency claim, automatic write retry, Core changes, installation or restart.
|
|
9
|
+
|
|
10
|
+
## 0.4.0-alpha.118 (prepared)
|
|
11
|
+
|
|
12
|
+
- Reuse confirmed model-preference CAS readback instead of describing all settings a third time for successful Exclude/Restore/High cost saves (#339).
|
|
13
|
+
- 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.
|
|
14
|
+
- 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.
|
|
15
|
+
- 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.
|
|
16
|
+
|
|
3
17
|
## 0.4.0-alpha.117 (prepared)
|
|
4
18
|
|
|
5
19
|
- Separate confirmed Session account selection from quota loading (#337). Preserve correctly attributed quota for follow-mode-only changes without duplicate account or quota reads.
|
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.119` (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.119/dsh-github-copilot-0.4.0-alpha.119.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.119` 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
|
|
|
@@ -99,12 +99,18 @@ Completed managed turns show **Account** beside native Usage. It records the req
|
|
|
99
99
|
|
|
100
100
|
Account eligibility reads official rc.2 SettingsForms values, without requiring the retired settings `get()` API. Missing or malformed configuration remains incomplete evidence; upgrading does not bypass native-route or activity restrictions.
|
|
101
101
|
|
|
102
|
+
**Global switch waiting:** Models shows metadata first and hydrates identity names independently; background name checks do not lock Switch when route/activity evidence permits it. Fresh identity and model validation overlap, but both must succeed before CAS and strict readback. Failures cancel/drain outstanding preflight without retry; identity-cache display never authorizes switching. The confirmed account result is not discarded when parent callbacks change, and late name reads cannot roll it back. This is separate from Session **Follow global default**, and does not remove necessary network checks or establish live millisecond savings.
|
|
103
|
+
|
|
102
104
|
`COPILOT_ACCOUNTS_BUSY` is reevaluated from current activity, not retained after work ends. The authorization-in-progress state is presented as progress rather than a terminal busy error; unrelated unknown blockers remain unknown. Use **Refresh account information** to update the open card after relevant work settles. If only the active account is listed, first **Add GitHub account**; **Switch** appears beside another saved account.
|
|
103
105
|
|
|
104
106
|
**Desktop lifecycle:** disable/remove/upgrade can require a full cold restart for Web service recomposition. If the plugin is Off and the native manager reports only `pending (waiting for service: web)`, do not repeatedly toggle or reinstall. Obtain restart approval and follow [rc.2 lifecycle guidance](./docs/web-lifecycle-rc2.md).
|
|
105
107
|
|
|
106
108
|
## Auto and model preferences
|
|
107
109
|
|
|
110
|
+
**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.
|
|
111
|
+
|
|
112
|
+
**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.
|
|
113
|
+
|
|
108
114
|
All three Auto preferences use the same account-verified, non-excluded eligible pool. Hard input/image capability checks run before soft task preferences.
|
|
109
115
|
|
|
110
116
|
| Task demand | Efficiency | Balance | Intelligence |
|
|
@@ -239,14 +245,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
|
|
|
239
245
|
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.
|
|
240
246
|
|
|
241
247
|
```sh
|
|
242
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
243
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
248
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.119/dsh-github-copilot-0.4.0-alpha.119.tgz
|
|
249
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.119/SHA256SUMS
|
|
244
250
|
sha256sum --check SHA256SUMS
|
|
245
251
|
```
|
|
246
252
|
|
|
247
253
|
```powershell
|
|
248
254
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
249
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
255
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.119.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
250
256
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
251
257
|
```
|
|
252
258
|
|
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.119`(尚未发布)。支持宿主:官方 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.119/dsh-github-copilot-0.4.0-alpha.119.tgz
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.
|
|
79
|
+
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.119`。官方 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
|
|
|
@@ -92,12 +92,18 @@ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/release
|
|
|
92
92
|
|
|
93
93
|
切换资格通过官方 rc.2 SettingsForms 的配置值读取,不再依赖已退役的 Settings `get()` API。缺失或无效配置仍视为证据不完整;升级不会绕过原生路由或运行中工作的限制。
|
|
94
94
|
|
|
95
|
+
**全局切换等待:**Models 先显示账号元数据,再独立补齐身份名称;后台名称查询不再锁住满足路由/活动证据条件的 Switch。真正切换仍需新鲜身份和模型校验,两项并行但必须都成功,之后才能 CAS 保存并严格读回。失败会取消并收尾另一项,不自动重试;身份展示缓存不授权切换。父组件更换回调不再丢弃已确认结果,旧名称响应也不能覆盖新账号。这与 Session **Follow global default** 是不同路径,不意味着省略必要网络校验或已测得真实毫秒级提速。
|
|
96
|
+
|
|
95
97
|
`COPILOT_ACCOUNTS_BUSY` 根据当前活动重新判断,不会在工作结束后保留旧拒绝。授权进行中会显示为进度状态,而不是终止性 busy 错误;其它未知阻塞因素仍明确保持未知。相关工作结束后,点击 **Refresh account information** 更新已打开的卡片。如果只列出活动账号,需先 **Add GitHub account**;另一个已保存账号旁才会出现 **Switch**。
|
|
96
98
|
|
|
97
99
|
**Desktop 生命周期:**停用、移除、升级后的 Web 服务重组可能需要完整冷重启。若插件已 Off,而原生 manager 仅提示 `pending (waiting for service: web)`,不要反复切换或重装。先取得重启许可,遵循[rc.2 生命周期说明](./docs/web-lifecycle-rc2.md)。
|
|
98
100
|
|
|
99
101
|
## Auto 与模型偏好
|
|
100
102
|
|
|
103
|
+
**保存偏好:**Exclude/Restore 和 High cost 复用严格确认的单模型保存结果,不重读账号状态/模型,也不重复执行最后一次完整设置遍历。内容相同的父组件快照不会清掉待保存操作或已确认结果。其它模型行仍可操作:最多 32 个不同行的意图显示 **Waiting…**,同时只发出一个 **Saving…** 请求。原生 CAS 读回确认前不会显示保存成功。结果无法确认或偏好作用域变化时取消尚未发送的操作;**Retry** 只重读已保存设置,不重放写入或发现模型。队列仅在当前组件内,卸载后不保留。
|
|
104
|
+
|
|
105
|
+
**模型目录加载失败:**原生 Models 的 `llm/listProviders failed: Failed to fetch` 属于 Client 到 Host/网关的请求传输失败,不能证明 Copilot 强制刷新。连接恢复后使用原生页面的 **Retry**。插件不拦截 Core 拥有的请求、不用过期/空目录伪装成功,也不声称本次保存优化已修复连接可用性。合成验证证明减少工作与响应式串行操作,不证明真实环境毫秒级提速。
|
|
106
|
+
|
|
101
107
|
三档 Auto 共用账号验证、未排除的合格模型池。输入/图片能力等硬门槛先于任务偏好。
|
|
102
108
|
|
|
103
109
|
| 任务需求 | Efficiency | Balance | Intelligence |
|
|
@@ -232,14 +238,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
|
|
|
232
238
|
GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
|
|
233
239
|
|
|
234
240
|
```sh
|
|
235
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
236
|
-
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.119/dsh-github-copilot-0.4.0-alpha.119.tgz
|
|
242
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.119/SHA256SUMS
|
|
237
243
|
sha256sum --check SHA256SUMS
|
|
238
244
|
```
|
|
239
245
|
|
|
240
246
|
```powershell
|
|
241
247
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
242
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
248
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.119.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
243
249
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
244
250
|
```
|
|
245
251
|
|
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.119"
|
|
12
12
|
},
|
|
13
13
|
"evidence": {
|
|
14
14
|
"kind": "source-and-synthetic-test-inventory",
|
|
@@ -333,6 +333,11 @@
|
|
|
333
333
|
{"file": "tests/copilot-usage-card.spec.ts", "name": "retains confirmed following when consent is cancelled and disables it during confirmation"},
|
|
334
334
|
{"file": "tests/copilot-usage-card.spec.ts", "name": "disables following when the Session selection cannot be read instead of treating it as a fixed account"},
|
|
335
335
|
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "never writes a captured A refresh into B after an external selection change"},
|
|
336
|
+
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "runs fresh switch identity and model preflight concurrently but commits only after both settle"},
|
|
337
|
+
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "cancels and drains sibling switch preflight before releasing its mutation fence"},
|
|
338
|
+
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "rejects a changed credential identity during overlapping switch checks without saving"},
|
|
339
|
+
{"file": "tests/copilot-accounts-card.spec.ts", "name": "renders metadata and permits a confirmed switch while unrelated identity names remain pending"},
|
|
340
|
+
{"file": "tests/copilot-accounts-card.spec.ts", "name": "uses the latest parent callback without resetting a pending switch or repeating initial reads"},
|
|
336
341
|
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "preserves uncertain commit ahead of missing-slot recovery"},
|
|
337
342
|
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "rechecks externally started canonical authorization before selector CAS"},
|
|
338
343
|
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "retains canonical admission through polling and cancellation settlement"},
|
|
@@ -675,6 +680,9 @@
|
|
|
675
680
|
{"file": "tests/preview-route.spec.ts", "name": "uses unmodified stock LlmRuntime preparation and leaves canonical model registration alone"},
|
|
676
681
|
{"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
682
|
{"file": "tests/authorization-controller.spec.ts", "name": "answers a narrow single-model save without reading credentials or enumerating sessions"},
|
|
683
|
+
{"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"},
|
|
684
|
+
{"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"},
|
|
685
|
+
{"file": "tests/model-preferences-card.spec.ts", "name": "cancels unsent row intents explicitly on a changed preference scope and ignores the late save"},
|
|
678
686
|
{"file": "tests/preview-route.spec.ts", "name": "replays opaque reasoning and tool-call identities through the native adapter on a second turn"},
|
|
679
687
|
{"file": "tests/preview-route.spec.ts", "name": "enriches only a verified 408 while preserving native failure classification and retry ownership"},
|
|
680
688
|
{"file": "tests/preview-provider.spec.ts", "name": "observes verified %s timeout without changing bytes, Response, native retries or credential ownership"},
|
package/docs/copilot-accounts.md
CHANGED
|
@@ -10,6 +10,27 @@ publication, installation and loaded runtime state are separate evidence.
|
|
|
10
10
|
|
|
11
11
|
## Requirements
|
|
12
12
|
|
|
13
|
+
### Global switch responsiveness (#342)
|
|
14
|
+
|
|
15
|
+
Models first reads metadata-only `get()` and separately hydrates display names
|
|
16
|
+
with nonforcing `ensureIdentity()`. Slow inactive-name queries do not hold the
|
|
17
|
+
Switch control. Unknown names remain unknown; route/activity/membership evidence
|
|
18
|
+
still gates controls and the Host independently verifies any requested switch.
|
|
19
|
+
An identity hydration result captured before a mutation or actual Remote/
|
|
20
|
+
authorization/credential lifecycle replacement cannot overwrite newer state.
|
|
21
|
+
Parent callback identity changes alone do not recreate the account lifetime.
|
|
22
|
+
|
|
23
|
+
The Host overlaps fresh identity and available-model preflight under one
|
|
24
|
+
60-second operation signal. It never replaces fresh verification with the
|
|
25
|
+
ten-minute display cache. Both must finish successfully before selector CAS;
|
|
26
|
+
identity key, membership, route/activity, canonical authorization and revision
|
|
27
|
+
checks remain, including post-commit confirmation. A failed branch aborts the
|
|
28
|
+
other and drains both before releasing the mutation fence, without automatic
|
|
29
|
+
retry or another account fallback. The strict save result updates the account
|
|
30
|
+
card; parent status refresh remains separate. This reduces a serial preflight
|
|
31
|
+
critical path to overlapping work, not zero network latency or proven live
|
|
32
|
+
timing. Synthetic deferred tests establish ordering, not production speed.
|
|
33
|
+
|
|
13
34
|
- Keep multiple independently authorized GitHub Copilot accounts in one DSH
|
|
14
35
|
profile. Models retains the global default. Sessions without an override
|
|
15
36
|
inherit that default at each new turn; explicit Session choices take priority.
|
package/lib/client.js
CHANGED
|
@@ -9104,6 +9104,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9104
9104
|
const managementRemote = props.addOnly ? void 0 : props.remote;
|
|
9105
9105
|
const [view, setView] = (0, react.useState)();
|
|
9106
9106
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
9107
|
+
const [identityChecking, setIdentityChecking] = (0, react.useState)(false);
|
|
9107
9108
|
const [failed, setFailed] = (0, react.useState)(false);
|
|
9108
9109
|
const [copyState, setCopyState] = (0, react.useState)("idle");
|
|
9109
9110
|
const [cancelRequested, setCancelRequested] = (0, react.useState)(false);
|
|
@@ -9116,6 +9117,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9116
9117
|
busy: false,
|
|
9117
9118
|
copyGeneration: 0
|
|
9118
9119
|
});
|
|
9120
|
+
const changedCallback = (0, react.useRef)(props.onChanged);
|
|
9121
|
+
changedCallback.current = props.onChanged;
|
|
9122
|
+
const identityRead = (0, react.useRef)();
|
|
9119
9123
|
const refreshed = (0, react.useRef)(props.refreshKey);
|
|
9120
9124
|
const text = props.locale?.toLowerCase().startsWith("zh") ? accountCopy.zh : accountCopy.en;
|
|
9121
9125
|
(0, react.useEffect)(() => {
|
|
@@ -9143,7 +9147,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9143
9147
|
setAuthorizationIntent(void 0);
|
|
9144
9148
|
setCancelRequested(false);
|
|
9145
9149
|
}
|
|
9146
|
-
if (next !== void 0 && changed && next.operation === void 0)
|
|
9150
|
+
if (next !== void 0 && changed && next.operation === void 0) changedCallback.current?.();
|
|
9151
|
+
return next;
|
|
9147
9152
|
} catch {
|
|
9148
9153
|
if (current()) {
|
|
9149
9154
|
setView(void 0);
|
|
@@ -9158,7 +9163,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9158
9163
|
}
|
|
9159
9164
|
finishChange?.();
|
|
9160
9165
|
}
|
|
9161
|
-
}, [
|
|
9166
|
+
}, []);
|
|
9167
|
+
const hydrateIdentity = (0, react.useCallback)(() => {
|
|
9168
|
+
const owner = lifetime.current;
|
|
9169
|
+
if (!owner.active || owner.busy || managementRemote === void 0 || identityRead.current !== void 0) return;
|
|
9170
|
+
const generation = owner.generation;
|
|
9171
|
+
const current = () => owner.active && owner.generation === generation;
|
|
9172
|
+
setIdentityChecking(true);
|
|
9173
|
+
const reading = Promise.resolve().then(async () => {
|
|
9174
|
+
try {
|
|
9175
|
+
if (!current()) return;
|
|
9176
|
+
const result = await managementRemote.ensureIdentity();
|
|
9177
|
+
if (!current()) return;
|
|
9178
|
+
const next = result.ok ? accountsViewFrom(result.value) : void 0;
|
|
9179
|
+
if (next === void 0) {
|
|
9180
|
+
setFailed(true);
|
|
9181
|
+
return;
|
|
9182
|
+
}
|
|
9183
|
+
setView(next);
|
|
9184
|
+
setFailed(false);
|
|
9185
|
+
} catch {
|
|
9186
|
+
if (current()) setFailed(true);
|
|
9187
|
+
}
|
|
9188
|
+
}).finally(() => {
|
|
9189
|
+
if (identityRead.current === reading) {
|
|
9190
|
+
identityRead.current = void 0;
|
|
9191
|
+
setIdentityChecking(false);
|
|
9192
|
+
}
|
|
9193
|
+
});
|
|
9194
|
+
identityRead.current = reading;
|
|
9195
|
+
}, [managementRemote]);
|
|
9162
9196
|
(0, react.useEffect)(() => {
|
|
9163
9197
|
const owner = lifetime.current;
|
|
9164
9198
|
owner.active = true;
|
|
@@ -9169,19 +9203,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9169
9203
|
setCopyState("idle");
|
|
9170
9204
|
setCancelRequested(false);
|
|
9171
9205
|
setAuthorizationIntent(void 0);
|
|
9206
|
+
identityRead.current = void 0;
|
|
9207
|
+
setIdentityChecking(false);
|
|
9172
9208
|
if (props.remote !== void 0 && !props.authorizationBusy) {
|
|
9173
9209
|
const remote = props.remote;
|
|
9174
|
-
|
|
9210
|
+
const generation = owner.generation + 1;
|
|
9211
|
+
run(() => remote.get()).then((next) => {
|
|
9212
|
+
if (owner.active && owner.generation === generation && next !== void 0 && next.operation === void 0) hydrateIdentity();
|
|
9213
|
+
});
|
|
9175
9214
|
}
|
|
9176
9215
|
return () => {
|
|
9177
9216
|
owner.active = false;
|
|
9178
9217
|
owner.generation++;
|
|
9179
9218
|
owner.busy = false;
|
|
9219
|
+
identityRead.current = void 0;
|
|
9180
9220
|
};
|
|
9181
9221
|
}, [
|
|
9182
9222
|
props.remote,
|
|
9183
9223
|
managementRemote,
|
|
9184
9224
|
run,
|
|
9225
|
+
hydrateIdentity,
|
|
9185
9226
|
props.authorizationBusy,
|
|
9186
9227
|
props.configured
|
|
9187
9228
|
]);
|
|
@@ -9200,7 +9241,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9200
9241
|
(0, react.useEffect)(() => {
|
|
9201
9242
|
if (managementRemote === void 0 || props.authorizationBusy || view?.operation !== void 0) return;
|
|
9202
9243
|
const ensure = () => {
|
|
9203
|
-
if (document.visibilityState !== "hidden")
|
|
9244
|
+
if (document.visibilityState !== "hidden") hydrateIdentity();
|
|
9204
9245
|
};
|
|
9205
9246
|
const timer = window.setInterval(ensure, 6e4);
|
|
9206
9247
|
document.addEventListener("visibilitychange", ensure);
|
|
@@ -9212,7 +9253,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9212
9253
|
managementRemote,
|
|
9213
9254
|
props.authorizationBusy,
|
|
9214
9255
|
view?.operation,
|
|
9215
|
-
|
|
9256
|
+
hydrateIdentity
|
|
9216
9257
|
]);
|
|
9217
9258
|
(0, react.useEffect)(() => {
|
|
9218
9259
|
if (view?.operation !== "authorizing" && view?.operation !== "verifying" || props.remote === void 0) return;
|
|
@@ -9324,7 +9365,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9324
9365
|
role: "status",
|
|
9325
9366
|
"aria-live": "polite",
|
|
9326
9367
|
"data-copilot-current-account": ""
|
|
9327
|
-
}, identity ?? (busy ? text.identityChecking : text.identityUnavailable)) : null, !props.expanded ? null : (0, react.createElement)("section", {
|
|
9368
|
+
}, identity ?? (busy || identityChecking ? text.identityChecking : text.identityUnavailable)) : null, !props.expanded ? null : (0, react.createElement)("section", {
|
|
9328
9369
|
"data-copilot-account-management": props.addOnly ? void 0 : true,
|
|
9329
9370
|
"data-copilot-account-add": props.addOnly ? true : void 0,
|
|
9330
9371
|
"aria-label": props.addOnly ? text.add : text.accounts,
|
|
@@ -9336,13 +9377,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9336
9377
|
}, props.addOnly ? null : (0, react.createElement)("h3", { style: {
|
|
9337
9378
|
margin: 0,
|
|
9338
9379
|
fontSize: 16
|
|
9339
|
-
} }, text.accounts), props.addOnly ? null : (0, react.createElement)("p", { style: muted$1 }, text.scope), props.
|
|
9380
|
+
} }, text.accounts), props.addOnly ? null : (0, react.createElement)("p", { style: muted$1 }, text.scope), props.addOnly || !identityChecking ? null : (0, react.createElement)("p", {
|
|
9381
|
+
role: "status",
|
|
9382
|
+
"aria-live": "polite",
|
|
9383
|
+
"data-copilot-identity-checking": true,
|
|
9384
|
+
style: muted$1
|
|
9385
|
+
}, text.identityChecking), props.remote === void 0 ? (0, react.createElement)("p", {
|
|
9340
9386
|
role: "status",
|
|
9341
9387
|
style: muted$1
|
|
9342
9388
|
}, text.remoteUnavailable) : null, failed ? (0, react.createElement)("p", {
|
|
9343
9389
|
role: "alert",
|
|
9344
9390
|
style: muted$1
|
|
9345
|
-
}, text.readFailed) : null, view?.state === "error" && view.operation === void 0 && view.diagnostic !== void 0 ? (0, react.createElement)("p", {
|
|
9391
|
+
}, view === void 0 ? text.readFailed : text.identityFailed) : null, view?.state === "error" && view.operation === void 0 && view.diagnostic !== void 0 ? (0, react.createElement)("p", {
|
|
9346
9392
|
role: "alert",
|
|
9347
9393
|
style: muted$1
|
|
9348
9394
|
}, accountProblemMessage(view.diagnostic, text)) : null, switchBlocker === void 0 ? null : (0, react.createElement)("p", {
|
|
@@ -11143,6 +11189,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11143
11189
|
padding: "7px 12px",
|
|
11144
11190
|
minHeight: "36px"
|
|
11145
11191
|
};
|
|
11192
|
+
const MAX_QUEUED_EDITS = 32;
|
|
11146
11193
|
function preferenceMessage(code) {
|
|
11147
11194
|
switch (code) {
|
|
11148
11195
|
case "COPILOT_MODEL_SETTINGS_UNAVAILABLE": return "Cannot read model preference settings. Models are read-only. Retry to read settings again.";
|
|
@@ -11151,6 +11198,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11151
11198
|
case "COPILOT_MODEL_EXCLUSION_SELECTED": return "This model is selected by a session or the default. Select another fixed model there before excluding it.";
|
|
11152
11199
|
case "COPILOT_MODEL_EXCLUSION_CONFLICT": return "Settings changed elsewhere. Review the current list before trying again.";
|
|
11153
11200
|
case "COPILOT_MODEL_EXCLUSION_SAVE_FAILED": return "Could not confirm the change. Retry to read the saved settings before trying again.";
|
|
11201
|
+
case "COPILOT_MODEL_PREFERENCE_QUEUE_FULL": return "Too many edits are waiting. Let the current saves finish before changing another model.";
|
|
11202
|
+
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.";
|
|
11154
11203
|
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.";
|
|
11155
11204
|
}
|
|
11156
11205
|
}
|
|
@@ -11160,30 +11209,42 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11160
11209
|
const [preferences, setPreferences] = (0, react.useState)(props.preferences);
|
|
11161
11210
|
const [models, setModels] = (0, react.useState)(props.models);
|
|
11162
11211
|
const [busyModel, setBusyModel] = (0, react.useState)();
|
|
11212
|
+
const [queuedModels, setQueuedModels] = (0, react.useState)([]);
|
|
11163
11213
|
const [error, setError] = (0, react.useState)();
|
|
11164
11214
|
const [errorModel, setErrorModel] = (0, react.useState)();
|
|
11165
11215
|
const request = (0, react.useRef)({
|
|
11166
11216
|
generation: 0,
|
|
11167
|
-
pending: false
|
|
11168
|
-
|
|
11217
|
+
pending: false,
|
|
11218
|
+
failed: false,
|
|
11219
|
+
cancelled: false,
|
|
11220
|
+
queue: [],
|
|
11221
|
+
active: ""
|
|
11222
|
+
});
|
|
11223
|
+
const metadata = (0, react.useRef)(props.models);
|
|
11224
|
+
metadata.current = props.models;
|
|
11225
|
+
const preferenceKey = JSON.stringify(props.preferences);
|
|
11169
11226
|
(0, react.useEffect)(() => {
|
|
11170
11227
|
const scope = request.current;
|
|
11171
11228
|
scope.generation++;
|
|
11172
11229
|
scope.pending = false;
|
|
11230
|
+
scope.failed = scope.cancelled;
|
|
11231
|
+
scope.active = "";
|
|
11173
11232
|
setPreferences(props.preferences);
|
|
11174
|
-
|
|
11175
|
-
|
|
11233
|
+
setError(scope.cancelled ? "COPILOT_MODEL_PREFERENCE_EDITS_CANCELLED" : void 0);
|
|
11234
|
+
scope.cancelled = false;
|
|
11176
11235
|
setErrorModel(void 0);
|
|
11177
11236
|
setBusyModel(void 0);
|
|
11237
|
+
setQueuedModels([]);
|
|
11178
11238
|
return () => {
|
|
11239
|
+
scope.cancelled = scope.pending && scope.queue.length > 0;
|
|
11179
11240
|
scope.generation++;
|
|
11180
11241
|
scope.pending = false;
|
|
11242
|
+
for (const edit of scope.queue.splice(0)) edit.resolve();
|
|
11181
11243
|
};
|
|
11182
|
-
}, [
|
|
11183
|
-
|
|
11184
|
-
props.models
|
|
11185
|
-
|
|
11186
|
-
]);
|
|
11244
|
+
}, [preferenceKey, props.remote]);
|
|
11245
|
+
(0, react.useEffect)(() => {
|
|
11246
|
+
setModels(props.models);
|
|
11247
|
+
}, [props.models]);
|
|
11187
11248
|
const available = models?.models ?? [];
|
|
11188
11249
|
const availabilityKnown = models?.state === "ready";
|
|
11189
11250
|
const settingsKnown = preferences !== void 0 && preferences.revision !== void 0;
|
|
@@ -11209,11 +11270,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11209
11270
|
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)));
|
|
11210
11271
|
const visibleCount = available.filter((model) => !excluded.has(model.id)).length;
|
|
11211
11272
|
const unavailableCount = rows.filter((model) => !model.available).length;
|
|
11212
|
-
const
|
|
11273
|
+
const save = async (modelId, restore = false, marking) => {
|
|
11213
11274
|
const scope = request.current;
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
const generation = ++scope.generation;
|
|
11275
|
+
const generation = scope.generation;
|
|
11276
|
+
const capturedMetadata = metadata.current;
|
|
11217
11277
|
const current = () => scope.generation === generation;
|
|
11218
11278
|
setBusyModel(modelId ?? "");
|
|
11219
11279
|
setError(void 0);
|
|
@@ -11221,48 +11281,100 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11221
11281
|
try {
|
|
11222
11282
|
if (modelId !== void 0) {
|
|
11223
11283
|
const result = marking === void 0 ? await props.remote.setModelExcluded(modelId, !restore) : await props.remote.setModelHighCost(modelId, marking);
|
|
11224
|
-
if (!current()) return;
|
|
11284
|
+
if (!current()) return false;
|
|
11225
11285
|
if (!result.ok) {
|
|
11226
11286
|
setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
|
|
11227
|
-
return;
|
|
11287
|
+
return false;
|
|
11228
11288
|
}
|
|
11229
11289
|
const parsed = GitHubCopilotModelPreferencesViewSchema.safeParse(result.value);
|
|
11230
11290
|
if (!parsed.success) {
|
|
11231
11291
|
setError("COPILOT_MODEL_PREFERENCES_UNAVAILABLE");
|
|
11232
|
-
return;
|
|
11292
|
+
return false;
|
|
11233
11293
|
}
|
|
11234
11294
|
setPreferences(parsed.data);
|
|
11235
|
-
|
|
11236
|
-
|
|
11295
|
+
const confirmed = parsed.data.state === "ready" && parsed.data.error === void 0 && parsed.data.writable && parsed.data.revision !== void 0;
|
|
11296
|
+
setError(parsed.data.error ?? (confirmed ? void 0 : "COPILOT_MODEL_PREFERENCES_UNAVAILABLE"));
|
|
11297
|
+
return confirmed;
|
|
11237
11298
|
}
|
|
11238
11299
|
const result = await props.remote.status();
|
|
11239
|
-
if (!current()) return;
|
|
11300
|
+
if (!current()) return false;
|
|
11240
11301
|
if (!result.ok) {
|
|
11241
11302
|
setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
|
|
11242
|
-
return;
|
|
11303
|
+
return false;
|
|
11243
11304
|
}
|
|
11244
11305
|
const parsed = GitHubCopilotAuthorizationViewSchema.safeParse(result.value);
|
|
11245
11306
|
if (!parsed.success) {
|
|
11246
11307
|
setError("COPILOT_MODEL_PREFERENCES_UNAVAILABLE");
|
|
11247
|
-
return;
|
|
11308
|
+
return false;
|
|
11248
11309
|
}
|
|
11249
11310
|
if (!parsed.data.configured || parsed.data.inFlight) {
|
|
11250
11311
|
setPreferences(void 0);
|
|
11251
11312
|
setModels(void 0);
|
|
11252
11313
|
setError("COPILOT_MODEL_PREFERENCES_UNAVAILABLE");
|
|
11253
|
-
return;
|
|
11314
|
+
return false;
|
|
11254
11315
|
}
|
|
11255
11316
|
setPreferences(parsed.data.modelPreferences);
|
|
11256
|
-
setModels(parsed.data.accountModels);
|
|
11317
|
+
if (metadata.current === capturedMetadata) setModels(parsed.data.accountModels);
|
|
11257
11318
|
setError(parsed.data.modelPreferences?.error);
|
|
11319
|
+
return parsed.data.modelPreferences?.writable === true && parsed.data.modelPreferences.revision !== void 0;
|
|
11258
11320
|
} catch {
|
|
11259
11321
|
if (current()) setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
|
|
11322
|
+
return false;
|
|
11260
11323
|
} finally {
|
|
11324
|
+
if (current()) setBusyModel(void 0);
|
|
11325
|
+
}
|
|
11326
|
+
};
|
|
11327
|
+
const update = async (modelId, restore = false, marking) => {
|
|
11328
|
+
const scope = request.current;
|
|
11329
|
+
const generation = scope.generation;
|
|
11330
|
+
const current = () => scope.generation === generation;
|
|
11331
|
+
if (modelId === void 0) {
|
|
11332
|
+
if (scope.pending) return;
|
|
11333
|
+
scope.pending = true;
|
|
11334
|
+
const succeeded = await save();
|
|
11261
11335
|
if (current()) {
|
|
11262
11336
|
scope.pending = false;
|
|
11263
|
-
|
|
11337
|
+
scope.failed = !succeeded;
|
|
11264
11338
|
}
|
|
11339
|
+
return;
|
|
11340
|
+
}
|
|
11341
|
+
if (!writable || scope.failed || scope.pending && scope.active === "" && scope.queue.length === 0 || scope.active === modelId || scope.queue.some((edit) => edit.modelId === modelId)) return;
|
|
11342
|
+
if (scope.queue.length >= MAX_QUEUED_EDITS) {
|
|
11343
|
+
setError("COPILOT_MODEL_PREFERENCE_QUEUE_FULL");
|
|
11344
|
+
setErrorModel(modelId);
|
|
11345
|
+
return;
|
|
11346
|
+
}
|
|
11347
|
+
const completed = new Promise((resolve) => {
|
|
11348
|
+
scope.queue.push({
|
|
11349
|
+
modelId,
|
|
11350
|
+
restore,
|
|
11351
|
+
marking,
|
|
11352
|
+
resolve
|
|
11353
|
+
});
|
|
11354
|
+
});
|
|
11355
|
+
setQueuedModels(scope.queue.map((edit) => edit.modelId));
|
|
11356
|
+
if (!scope.pending) {
|
|
11357
|
+
scope.pending = true;
|
|
11358
|
+
(async () => {
|
|
11359
|
+
while (current() && scope.queue.length > 0) {
|
|
11360
|
+
const edit = scope.queue.shift();
|
|
11361
|
+
scope.active = edit.modelId;
|
|
11362
|
+
setQueuedModels(scope.queue.map((waiting) => waiting.modelId));
|
|
11363
|
+
const succeeded = await save(edit.modelId, edit.restore, edit.marking);
|
|
11364
|
+
edit.resolve();
|
|
11365
|
+
if (!current()) return;
|
|
11366
|
+
scope.active = "";
|
|
11367
|
+
if (!succeeded) {
|
|
11368
|
+
scope.failed = true;
|
|
11369
|
+
for (const waiting of scope.queue.splice(0)) waiting.resolve();
|
|
11370
|
+
setQueuedModels([]);
|
|
11371
|
+
break;
|
|
11372
|
+
}
|
|
11373
|
+
}
|
|
11374
|
+
if (current()) scope.pending = false;
|
|
11375
|
+
})();
|
|
11265
11376
|
}
|
|
11377
|
+
await completed;
|
|
11266
11378
|
};
|
|
11267
11379
|
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: {
|
|
11268
11380
|
fontSize: "14px",
|
|
@@ -11337,7 +11449,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11337
11449
|
}
|
|
11338
11450
|
}, filtered.map((model) => {
|
|
11339
11451
|
const isExcluded = excluded.has(model.id);
|
|
11340
|
-
const disabled = !writable || busyModel
|
|
11452
|
+
const disabled = !writable || request.current.failed || busyModel === "" || busyModel === model.id || queuedModels.includes(model.id);
|
|
11341
11453
|
return (0, react.createElement)("li", {
|
|
11342
11454
|
key: model.id,
|
|
11343
11455
|
style: {
|
|
@@ -11386,7 +11498,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11386
11498
|
onClick: () => update(model.id, isExcluded),
|
|
11387
11499
|
"data-dsh-github-copilot-model-action": isExcluded ? "restore" : "exclude",
|
|
11388
11500
|
"data-model-id": model.id
|
|
11389
|
-
}, busyModel === model.id ? "Saving…" : isExcluded ? "Restore" : "Exclude"));
|
|
11501
|
+
}, busyModel === model.id ? "Saving…" : queuedModels.includes(model.id) ? "Waiting…" : isExcluded ? "Restore" : "Exclude"));
|
|
11390
11502
|
})));
|
|
11391
11503
|
}
|
|
11392
11504
|
//#endregion
|