dsh-github-copilot 0.4.0-alpha.117 → 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 CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## 0.4.0-alpha.117 (prepared)
4
11
 
5
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.
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.117` (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.
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.117/dsh-github-copilot-0.4.0-alpha.117.tgz
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.117` 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.
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 |
@@ -239,14 +243,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
239
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.
240
244
 
241
245
  ```sh
242
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.117/dsh-github-copilot-0.4.0-alpha.117.tgz
243
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.117/SHA256SUMS
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
244
248
  sha256sum --check SHA256SUMS
245
249
  ```
246
250
 
247
251
  ```powershell
248
252
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
249
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.117.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
253
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.118.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
250
254
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
251
255
  ```
252
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.117`(尚未发布)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。下方带版本的命令适用于候选版本发布后,不代表对应资产已经存在。
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.117/dsh-github-copilot-0.4.0-alpha.117.tgz
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.117`。官方 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 或删除配置。
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 |
@@ -232,14 +236,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
232
236
  GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
233
237
 
234
238
  ```sh
235
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.117/dsh-github-copilot-0.4.0-alpha.117.tgz
236
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.117/SHA256SUMS
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
237
241
  sha256sum --check SHA256SUMS
238
242
  ```
239
243
 
240
244
  ```powershell
241
245
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
242
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.117.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
246
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.118.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
243
247
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
244
248
  ```
245
249
 
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "package": {
10
10
  "name": "dsh-github-copilot",
11
- "version": "0.4.0-alpha.117"
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
@@ -11143,6 +11143,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11143
11143
  padding: "7px 12px",
11144
11144
  minHeight: "36px"
11145
11145
  };
11146
+ const MAX_QUEUED_EDITS = 32;
11146
11147
  function preferenceMessage(code) {
11147
11148
  switch (code) {
11148
11149
  case "COPILOT_MODEL_SETTINGS_UNAVAILABLE": return "Cannot read model preference settings. Models are read-only. Retry to read settings again.";
@@ -11151,6 +11152,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11151
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.";
11152
11153
  case "COPILOT_MODEL_EXCLUSION_CONFLICT": return "Settings changed elsewhere. Review the current list before trying again.";
11153
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.";
11154
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.";
11155
11158
  }
11156
11159
  }
@@ -11160,30 +11163,42 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11160
11163
  const [preferences, setPreferences] = (0, react.useState)(props.preferences);
11161
11164
  const [models, setModels] = (0, react.useState)(props.models);
11162
11165
  const [busyModel, setBusyModel] = (0, react.useState)();
11166
+ const [queuedModels, setQueuedModels] = (0, react.useState)([]);
11163
11167
  const [error, setError] = (0, react.useState)();
11164
11168
  const [errorModel, setErrorModel] = (0, react.useState)();
11165
11169
  const request = (0, react.useRef)({
11166
11170
  generation: 0,
11167
- pending: false
11168
- });
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);
11169
11180
  (0, react.useEffect)(() => {
11170
11181
  const scope = request.current;
11171
11182
  scope.generation++;
11172
11183
  scope.pending = false;
11184
+ scope.failed = scope.cancelled;
11185
+ scope.active = "";
11173
11186
  setPreferences(props.preferences);
11174
- setModels(props.models);
11175
- setError(void 0);
11187
+ setError(scope.cancelled ? "COPILOT_MODEL_PREFERENCE_EDITS_CANCELLED" : void 0);
11188
+ scope.cancelled = false;
11176
11189
  setErrorModel(void 0);
11177
11190
  setBusyModel(void 0);
11191
+ setQueuedModels([]);
11178
11192
  return () => {
11193
+ scope.cancelled = scope.pending && scope.queue.length > 0;
11179
11194
  scope.generation++;
11180
11195
  scope.pending = false;
11196
+ for (const edit of scope.queue.splice(0)) edit.resolve();
11181
11197
  };
11182
- }, [
11183
- props.preferences,
11184
- props.models,
11185
- props.remote
11186
- ]);
11198
+ }, [preferenceKey, props.remote]);
11199
+ (0, react.useEffect)(() => {
11200
+ setModels(props.models);
11201
+ }, [props.models]);
11187
11202
  const available = models?.models ?? [];
11188
11203
  const availabilityKnown = models?.state === "ready";
11189
11204
  const settingsKnown = preferences !== void 0 && preferences.revision !== void 0;
@@ -11209,11 +11224,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11209
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)));
11210
11225
  const visibleCount = available.filter((model) => !excluded.has(model.id)).length;
11211
11226
  const unavailableCount = rows.filter((model) => !model.available).length;
11212
- const update = async (modelId, restore = false, marking) => {
11227
+ const save = async (modelId, restore = false, marking) => {
11213
11228
  const scope = request.current;
11214
- if (scope.pending || modelId !== void 0 && !writable) return;
11215
- scope.pending = true;
11216
- const generation = ++scope.generation;
11229
+ const generation = scope.generation;
11230
+ const capturedMetadata = metadata.current;
11217
11231
  const current = () => scope.generation === generation;
11218
11232
  setBusyModel(modelId ?? "");
11219
11233
  setError(void 0);
@@ -11221,48 +11235,100 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11221
11235
  try {
11222
11236
  if (modelId !== void 0) {
11223
11237
  const result = marking === void 0 ? await props.remote.setModelExcluded(modelId, !restore) : await props.remote.setModelHighCost(modelId, marking);
11224
- if (!current()) return;
11238
+ if (!current()) return false;
11225
11239
  if (!result.ok) {
11226
11240
  setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
11227
- return;
11241
+ return false;
11228
11242
  }
11229
11243
  const parsed = GitHubCopilotModelPreferencesViewSchema.safeParse(result.value);
11230
11244
  if (!parsed.success) {
11231
11245
  setError("COPILOT_MODEL_PREFERENCES_UNAVAILABLE");
11232
- return;
11246
+ return false;
11233
11247
  }
11234
11248
  setPreferences(parsed.data);
11235
- setError(parsed.data.error);
11236
- return;
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;
11237
11252
  }
11238
11253
  const result = await props.remote.status();
11239
- if (!current()) return;
11254
+ if (!current()) return false;
11240
11255
  if (!result.ok) {
11241
11256
  setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
11242
- return;
11257
+ return false;
11243
11258
  }
11244
11259
  const parsed = GitHubCopilotAuthorizationViewSchema.safeParse(result.value);
11245
11260
  if (!parsed.success) {
11246
11261
  setError("COPILOT_MODEL_PREFERENCES_UNAVAILABLE");
11247
- return;
11262
+ return false;
11248
11263
  }
11249
11264
  if (!parsed.data.configured || parsed.data.inFlight) {
11250
11265
  setPreferences(void 0);
11251
11266
  setModels(void 0);
11252
11267
  setError("COPILOT_MODEL_PREFERENCES_UNAVAILABLE");
11253
- return;
11268
+ return false;
11254
11269
  }
11255
11270
  setPreferences(parsed.data.modelPreferences);
11256
- setModels(parsed.data.accountModels);
11271
+ if (metadata.current === capturedMetadata) setModels(parsed.data.accountModels);
11257
11272
  setError(parsed.data.modelPreferences?.error);
11273
+ return parsed.data.modelPreferences?.writable === true && parsed.data.modelPreferences.revision !== void 0;
11258
11274
  } catch {
11259
11275
  if (current()) setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
11276
+ return false;
11260
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();
11261
11289
  if (current()) {
11262
11290
  scope.pending = false;
11263
- setBusyModel(void 0);
11291
+ scope.failed = !succeeded;
11264
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
+ })();
11265
11330
  }
11331
+ await completed;
11266
11332
  };
11267
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: {
11268
11334
  fontSize: "14px",
@@ -11337,7 +11403,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11337
11403
  }
11338
11404
  }, filtered.map((model) => {
11339
11405
  const isExcluded = excluded.has(model.id);
11340
- const disabled = !writable || busyModel !== void 0;
11406
+ const disabled = !writable || request.current.failed || busyModel === "" || busyModel === model.id || queuedModels.includes(model.id);
11341
11407
  return (0, react.createElement)("li", {
11342
11408
  key: model.id,
11343
11409
  style: {
@@ -11386,7 +11452,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11386
11452
  onClick: () => update(model.id, isExcluded),
11387
11453
  "data-dsh-github-copilot-model-action": isExcluded ? "restore" : "exclude",
11388
11454
  "data-model-id": model.id
11389
- }, busyModel === model.id ? "Saving…" : isExcluded ? "Restore" : "Exclude"));
11455
+ }, busyModel === model.id ? "Saving…" : queuedModels.includes(model.id) ? "Waiting…" : isExcluded ? "Restore" : "Exclude"));
11390
11456
  })));
11391
11457
  }
11392
11458
  //#endregion