opencode-next 1.0.2 → 1.0.4
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 +45 -0
- package/README.md +13 -13
- package/README.zh-TW.md +13 -13
- package/lib/config.js +7 -3
- package/lib/constants.js +1 -0
- package/lib/go/adapter.js +2 -2
- package/lib/index.js +1 -0
- package/lib/ui.js +454 -90
- package/package.json +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `opencode-next` (`OpenCode-Next-for-DSH`) are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.4] - 2026-11-26
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Fixed DSH dark mode contrast across inset surfaces, fact labels, and device sign-in links (`--ocoa-sunk`, `--ocoa-sunk2`, `.ocoa-fact-label`, `.ocoa-link`) by deriving tints via `color-mix` from active surface and foreground tokens ([#1](https://github.com/kizaki-R/OpenCode-Next-for-DSH/pull/1)).
|
|
9
|
+
- Fixed native `<select>` / `<option>` popups in dark mode by explicitly inheriting theme surface/foreground colors and `color-scheme`, and fixed undefined CSS variables in `.ocoa-go-row` and `.ocoa-go-pill`.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Replaced the header language `<select>` dropdown with three segmented buttons (`繁` / `简` / `EN`) matching the compact per-page switcher design while keeping system-locale fallback intact.
|
|
13
|
+
- Added a dynamic sun/moon light/dark theme toggle button to the left of the language switcher that tracks DSH's host `data-ds-dark-theme` attribute by default and allows independent per-page overrides.
|
|
14
|
+
- Added a footer bar showing the maintainer link (`@kizaki-R`), GitHub repository, issue tracker, and dynamic `npm v<version>` link.
|
|
15
|
+
- Changed the Free Models tab's **One-click probe** button to probe only checked models (`m.shown === true`) in default and **Available** views, disabling the button when no models are checked while preserving filtered probing under failure-reason filters or search.
|
|
16
|
+
|
|
17
|
+
## [1.0.3] - 2026-11-25
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- Raised OpenCode Go default first-event timeout from 30 s to 180 s (`GO_DEFAULT_FIRST_EVENT_MS = 180000`) so large-context prefill and thinking turns do not abort prematurely at 30 s.
|
|
21
|
+
- Exposed `goSubscription.firstEventTimeoutMs` in `lib/config.js` and wired it through `lib/index.js` to `OpenCodeGoAdapter`.
|
|
22
|
+
- Kept `GO_NO_RETRY_POLICY` unchanged so billed Go requests are never re-sent automatically.
|
|
23
|
+
|
|
24
|
+
## [1.0.2] - 2026-11-25
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- Made `canonicalSessionId()` in `lib/client.js` deterministic across 1 ms clock ticks so multi-turn conversations keep one `x-opencode-session` ID.
|
|
28
|
+
- Guarded `document.addEventListener` / `querySelector` and added click-listener teardown in `lib/ui.js` nav-icon patching.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- Added DSH UI screenshots and `screenshots.json`.
|
|
32
|
+
- Fixed CI matrix across Ubuntu/Windows and Node 20/22 with isolated auth fixtures, `setup-bun`, and cross-platform Bun path resolution.
|
|
33
|
+
|
|
34
|
+
## [1.0.1] - 2026-11-24
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
- Enabled `goSubscription.enabled` by default in `lib/config.js` so OpenCode Go works after saving a Personal API Key without editing `cordis.patch.yml` (set `goSubscription.enabled: false` to disable).
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- Updated `goDisabledHint` messages in `lib/ui.js` (`en`, `zh`, `zh-Hant`) and added brand icons and EN/zh-TW README banners in `assets/`.
|
|
41
|
+
|
|
42
|
+
## [1.0.0] - 2026-11-23
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
- Initial release of `OpenCode-Next` (`opencode-next`) for DeepSeek Harness (DSH): dual-track OAuth free models, Bun transport, model probing and picker curation, and OpenCode Go subscription support with 5h/7D/1M usage gauges.
|
package/README.md
CHANGED
|
@@ -144,16 +144,16 @@ accepted set differs per model (for example `beam-free` accepts `low` through
|
|
|
144
144
|
`high`, and `max`). The catalog spells "no reasoning" as `none`; DSH spells it
|
|
145
145
|
`off`, and the adapter maps it back on the wire.
|
|
146
146
|
|
|
147
|
-
## Settings Page (DSH Settings → OpenCode
|
|
147
|
+
## Settings Page (DSH Settings → OpenCode-Next)
|
|
148
148
|
|
|
149
|
-
DSH Settings gains an
|
|
149
|
+
DSH Settings gains an **OpenCode-Next** tab (order 14) with a compact top toolbar (a dynamic sun/moon light/dark theme toggle for the page and three segmented language buttons `繁` / `简` / `EN`), four main sections, and a footer showing the maintainer, repository links, and live `npm v<version>`:
|
|
150
150
|
|
|
151
151
|
| Block | Contents |
|
|
152
152
|
| --- | --- |
|
|
153
|
-
| Header | Health badge (ready / expiring / unprobed / signed out / expired / no model responding)
|
|
153
|
+
| Header | Health badge (ready / expiring / unprobed / signed out / expired / no model responding), per-page theme toggle, and `繁` / `简` / `EN` language buttons |
|
|
154
154
|
| Authorization | Credential source, expiry, whether it auto-refreshes; buttons for re-verify, sign in (or sign in again), and sign out |
|
|
155
|
-
| Models | Available vs. total, last probe time, search,
|
|
156
|
-
| Diagnostics | Provider id, plugin version, probe
|
|
155
|
+
| Models | Available vs. total, last probe time, search, segmented category filter, per-model picker toggle, status / latency / explanation, and a context-window setting for each model |
|
|
156
|
+
| Diagnostics & Go | Provider id, plugin version, Bun runtime status, probe/poll intervals, fallback chain, and OpenCode Go subscription management |
|
|
157
157
|
|
|
158
158
|
Expand a model's **Context window** setting to follow the OpenCode catalog value or enter a manual override. **Restore default** removes that model's override; it does not send a probe request. A manual value changes the capacity and budget DSH receives, but does not raise OpenCode's actual limit or change DSH's compaction policy. Only model IDs and numeric values are stored in `~/.dsh/opencode-next.context.json` (or under `DSH_HOME` when set).
|
|
159
159
|
|
|
@@ -237,7 +237,7 @@ Alternative sources:
|
|
|
237
237
|
|
|
238
238
|
```bash
|
|
239
239
|
# Install from GitHub Release tarball
|
|
240
|
-
dsh plugin --profile desktop add https://github.com/kizaki-R/OpenCode-Next-for-DSH/releases/download/v1.0.
|
|
240
|
+
dsh plugin --profile desktop add https://github.com/kizaki-R/OpenCode-Next-for-DSH/releases/download/v1.0.4/opencode-next-1.0.4.tgz
|
|
241
241
|
|
|
242
242
|
# Or directly from GitHub
|
|
243
243
|
dsh plugin --profile desktop add github:kizaki-R/OpenCode-Next-for-DSH
|
|
@@ -249,7 +249,7 @@ dsh plugin --profile desktop add github:kizaki-R/OpenCode-Next-for-DSH
|
|
|
249
249
|
|
|
250
250
|
```bash
|
|
251
251
|
npm pack
|
|
252
|
-
dsh plugin --profile desktop add ./opencode-next-1.0.
|
|
252
|
+
dsh plugin --profile desktop add ./opencode-next-1.0.4.tgz
|
|
253
253
|
```
|
|
254
254
|
|
|
255
255
|
> **Re-pack after changing the source.** `npm pack` only includes files matched
|
|
@@ -323,13 +323,13 @@ Detection only accepts an absolute path found on `PATH`, so a same-named binary
|
|
|
323
323
|
|
|
324
324
|
## Scoped probes
|
|
325
325
|
|
|
326
|
-
The probe button follows the current filter:
|
|
326
|
+
The probe button follows the current filter and checked selection:
|
|
327
327
|
|
|
328
328
|
| View | Button | What is probed |
|
|
329
329
|
| --- | --- | --- |
|
|
330
|
-
| All, no search |
|
|
331
|
-
| Available | Probe available (n) | Only
|
|
332
|
-
|
|
|
330
|
+
| All, no search | One-click probe (n) | Only checked models (`m.shown === true`); disabled when `n = 0` |
|
|
331
|
+
| Available | Probe available (n) | Only checked available models |
|
|
332
|
+
| Failure filter or search | Probe list (n) | Filtered/matched models via `modelIds` |
|
|
333
333
|
|
|
334
334
|
Results merge. Models not in this run keep their latency, availability, and history in `~/.dsh/opencode-next.models.json`. Switching accounts or restarting DSH does not delete that cache. The filter (for example staying on Available) is remembered in this browser's `localStorage`.
|
|
335
335
|
|
|
@@ -347,7 +347,7 @@ The Advanced switch is off by default. When on, inference is sent without the pe
|
|
|
347
347
|
|
|
348
348
|
## OpenCode Go (Subscription Verification, Model Preview & Text/Tool Inference)
|
|
349
349
|
|
|
350
|
-
An independent
|
|
350
|
+
An independent `opencode-go-subscription` provider is included alongside `opencode-next` (`goSubscription.enabled` defaults to `true` since `v1.0.1` so saving a Personal API Key works out of the box; set `goSubscription.enabled: false` in `cordis.patch.yml` to disable, and `goSubscription.firstEventTimeoutMs` defaults to `180000` ms):
|
|
351
351
|
|
|
352
352
|
- **Isolated credential resolution & UI management**: Uses an OpenCode Console Personal API Key via DSH's `credentials` service first (`goSubscription.credentialRef`, default `OPENCODE_GO_API_KEY`), falling back to the environment variable. In Settings → OpenCode Go, you can save or clear the key directly via `ctx.credentials.set` / `ctx.credentials.unset` without exposing or prefilling plaintext keys (if `credentials.set` is unavailable in the current DSH process, the button stays disabled and the key is never written into plugin config or JSON files). It never reuses OAuth tokens (`st_*`), `org_id`, or credentials from other plugins, and never stores plaintext keys in plugin config, status APIs, errors, or logs.
|
|
353
353
|
- **Read-only official endpoints**: Queries `GET https://opencode.ai/inference/go/v1/usage` to verify Go subscription entitlement, followed by `GET https://opencode.ai/inference/go/v1/models` for workspace model metadata (`redirect: 'manual'`, fixed `https://opencode.ai` origin). Key changes or disabling clears the isolated cache (`~/.dsh/opencode-go.cache.json`) and blocks stale in-flight writes.
|
|
@@ -357,4 +357,4 @@ An independent, opt-in `opencode-go-subscription` provider is included alongside
|
|
|
357
357
|
|
|
358
358
|
## License & Attribution
|
|
359
359
|
|
|
360
|
-
MIT License — see [LICENSE](./LICENSE). Derived from [FishBottle7/opencode2dsh](https://github.com/FishBottle7/opencode2dsh) (`Copyright (c) 2026 FishBottle7`).
|
|
360
|
+
MIT License — see [LICENSE](./LICENSE) and [CHANGELOG.md](./CHANGELOG.md). Derived from [FishBottle7/opencode2dsh](https://github.com/FishBottle7/opencode2dsh) (`Copyright (c) 2026 FishBottle7`).
|
package/README.zh-TW.md
CHANGED
|
@@ -139,7 +139,7 @@ dsh plugin --profile desktop add opencode-next
|
|
|
139
139
|
|
|
140
140
|
```bash
|
|
141
141
|
# 從 GitHub Release 下載安裝
|
|
142
|
-
dsh plugin --profile desktop add https://github.com/kizaki-R/OpenCode-Next-for-DSH/releases/download/v1.0.
|
|
142
|
+
dsh plugin --profile desktop add https://github.com/kizaki-R/OpenCode-Next-for-DSH/releases/download/v1.0.4/opencode-next-1.0.4.tgz
|
|
143
143
|
|
|
144
144
|
# 或直接從 GitHub 倉庫安裝
|
|
145
145
|
dsh plugin --profile desktop add github:kizaki-R/OpenCode-Next-for-DSH
|
|
@@ -168,7 +168,7 @@ dsh plugin --profile desktop add github:kizaki-R/OpenCode-Next-for-DSH
|
|
|
168
168
|
### 方式 4:使用打包後的 tgz 安裝(離線分發)
|
|
169
169
|
|
|
170
170
|
```bash
|
|
171
|
-
dsh plugin --profile desktop add ./opencode-next-1.0.
|
|
171
|
+
dsh plugin --profile desktop add ./opencode-next-1.0.4.tgz
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
> **改完程式碼要重新打包。** `npm pack` 只會裝進 `package.json` 的 `files` 白名單
|
|
@@ -234,16 +234,16 @@ DSH 有帳號清單時會優先讀它。若 CLI 只寫舊檔,這次登入不
|
|
|
234
234
|
|
|
235
235
|
---
|
|
236
236
|
|
|
237
|
-
## 🖥️ 設定頁(DSH 設定 → OpenCode
|
|
237
|
+
## 🖥️ 設定頁(DSH 設定 → OpenCode-Next)
|
|
238
238
|
|
|
239
|
-
開啟 DSH 設定頁,左側會多一個「OpenCode
|
|
239
|
+
開啟 DSH 設定頁,左側會多一個「OpenCode-Next」分頁(排序 14),頂部提供動態太陽/月亮深淺主題切換鈕與 `繁` / `简` / `EN` 三語言按鈕,內容分為四個頁籤,頁尾並顯示維護者、GitHub 專案、問題回報與即時 npm 版本連結:
|
|
240
240
|
|
|
241
241
|
| 區塊 | 內容 |
|
|
242
242
|
| --- | --- |
|
|
243
|
-
| 標題列 |
|
|
243
|
+
| 標題列 | 健康狀態徽章(正常/即將過期/尚未探測/尚未登入/已過期/沒有模型回應)、本頁深淺主題切換鈕與 `繁` / `简` / `EN` 語言按鈕 |
|
|
244
244
|
| 授權狀態 | 憑證來源、到期時間、是否可自動更新;按鈕:重新驗證憑證/登入(或重新登入)/登出 |
|
|
245
|
-
| 模型 |
|
|
246
|
-
|
|
|
245
|
+
| 模型 | 可用數/總數、探測時間、搜尋框、分段篩選列、逐模型勾選框/狀態/延遲/說明,以及每個模型的上下文容量設定 |
|
|
246
|
+
| 診斷與 Go | provider 識別碼、外掛版本、Bun 執行環境狀態、探測間隔、備援設定與 OpenCode Go 訂閱管理 |
|
|
247
247
|
|
|
248
248
|
在模型列展開「上下文大小」,可選擇跟隨 OpenCode 目錄值或手動覆寫;「恢復預設值」會移除該模型的覆寫,不會發送探測請求。手動值會影響 DSH 收到的模型容量與預算,但不會提高上游實際上限,也不會更改 DSH 的壓縮策略。設定只保存模型 ID 與數字,位置為 `~/.dsh/opencode-next.context.json`(若設定 `DSH_HOME`,則存於該目錄)。
|
|
249
249
|
|
|
@@ -354,13 +354,13 @@ OpenCode 免費模型的 `Free usage limit reached` 主要依**網路出口 IP**
|
|
|
354
354
|
|
|
355
355
|
## 範圍探測
|
|
356
356
|
|
|
357
|
-
|
|
357
|
+
模型表的探測按鈕會跟著目前篩選與勾選狀態變化:
|
|
358
358
|
|
|
359
359
|
| 畫面 | 按鈕 | 行為 |
|
|
360
360
|
| --- | --- | --- |
|
|
361
|
-
| 全部、沒有搜尋 |
|
|
362
|
-
| 「可用」 | 探測可用 (n) |
|
|
363
|
-
|
|
|
361
|
+
| 全部、沒有搜尋 | 一鍵探測 (n) | 只探測有勾選的模型(`m.shown === true`);無勾選時停用 |
|
|
362
|
+
| 「可用」 | 探測可用 (n) | 只探測已勾選且可用的模型 |
|
|
363
|
+
| 其他失敗分類或搜尋 | 探測清單 (n) | 只送出目前篩選結果的 `modelIds` |
|
|
364
364
|
|
|
365
365
|
結果是增量合併。這次沒探測到的模型,其延遲、可用狀態與歷史紀錄會留在 `~/.dsh/opencode-next.models.json`。切換帳號或重啟 DSH 不會清掉這份快取。篩選(例如停在「可用」)記在這個瀏覽器的 `localStorage`。
|
|
366
366
|
|
|
@@ -376,7 +376,7 @@ OpenCode 免費模型的 `Free usage limit reached` 主要依**網路出口 IP**
|
|
|
376
376
|
|
|
377
377
|
## OpenCode Go(訂閱資格驗證、模型目錄與文字/工具推論)
|
|
378
378
|
|
|
379
|
-
|
|
379
|
+
本外掛內建獨立的 `opencode-go-subscription` provider 接點(自 `v1.0.1` 起 `goSubscription.enabled` 預設為 `true`,儲存 API Key 後即可直接使用;如需停用可設為 `false`,且自 `v1.0.3` 起首事件預設逾時 `goSubscription.firstEventTimeoutMs` 為 `180000` 毫秒),不會影響既有免費 `opencode-next` 的模型清單、登入、設定、快取或通道行為:
|
|
380
380
|
|
|
381
381
|
- **獨立憑證解析與設定頁管理**:使用 OpenCode Console Personal API Key,優先透過 DSH 安全憑證服務(`goSubscription.credentialRef`,預設 `OPENCODE_GO_API_KEY`)解析,不可用時退回環境變數。可在「設定頁 → OpenCode Go」透過密碼欄位直接呼叫 `ctx.credentials.set`/`ctx.credentials.unset` 儲存或清除金鑰(不預填明文、只顯示已儲存或未設定;若目前 DSH 行程不支援 `credentials.set`,按鈕會保持停用,絕不改寫進外掛設定或 JSON 檔案)。不沿用 OAuth token(`st_*`)或 `org_id`,不自動匯入其他外掛憑證,且不將明文 key 寫入一般設定、狀態 API、錯誤或日誌。
|
|
382
382
|
- **官方唯讀端點**:以 Bearer key 依序查詢 `GET https://opencode.ai/inference/go/v1/usage` 驗證訂閱資格與 `GET https://opencode.ai/inference/go/v1/models` 取得工作區模型目錄,固定 `https://opencode.ai` 目的地且不跟隨重新導向。換 key 或停用時會清除獨立快取(`~/.dsh/opencode-go.cache.json`)並阻擋舊請求回寫。
|
|
@@ -385,4 +385,4 @@ OpenCode 免費模型的 `Free usage limit reached` 主要依**網路出口 IP**
|
|
|
385
385
|
- **正式選單門檻與依目錄自動圖片支援**:僅結構合格且狀態有效之 Go 對話模型會進入正式選單。圖片輸入(透過 DSH `attachments` 服務轉成 `image_url` data URI)會依上游 Go 目錄宣告自動開放給 `modalities.input` 含 `image`/`image/*` 的入選模型(含未來上架的新視覺模型,實際可否辨識以上游端點為準);未宣告圖片輸入或模態未知之模型維持純文字,於附圖送出前直接拒絕(絕不靜默丟圖繼續送純文字,也不退回免費 OAuth),且不開放影片、音訊或 PDF 等其他檔案附件。
|
|
386
386
|
|
|
387
387
|
## 授權條款與來源聲明
|
|
388
|
-
MIT License © 2026(見 [LICENSE](./LICENSE))。本專案衍生自原作者 [FishBottle7/opencode2dsh](https://github.com/FishBottle7/opencode2dsh)(`Copyright (c) 2026 FishBottle7`)。
|
|
388
|
+
MIT License © 2026(見 [LICENSE](./LICENSE) 與 [CHANGELOG.md](./CHANGELOG.md))。本專案衍生自原作者 [FishBottle7/opencode2dsh](https://github.com/FishBottle7/opencode2dsh)(`Copyright (c) 2026 FishBottle7`)。
|
package/lib/config.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
GO_CREDENTIAL_ENV_VAR,
|
|
7
7
|
OPENCODE_INFERENCE_URL,
|
|
8
8
|
DEFAULT_STREAM_IDLE_MS,
|
|
9
|
+
GO_DEFAULT_FIRST_EVENT_MS,
|
|
9
10
|
DEFAULT_PROBE_INTERVAL_MS,
|
|
10
11
|
DEFAULT_CATALOG_POLL_MS,
|
|
11
12
|
DEFAULT_IMAGE_PIXEL_BUDGET,
|
|
@@ -148,13 +149,15 @@ export const Config = Schema.object({
|
|
|
148
149
|
providerId: Schema.string().default(GO_PROVIDER),
|
|
149
150
|
providerName: Schema.string().default(GO_PROVIDER_NAME),
|
|
150
151
|
credentialRef: Schema.string().default(GO_CREDENTIAL_ENV_VAR),
|
|
151
|
-
cachePath: Schema.string().default('')
|
|
152
|
+
cachePath: Schema.string().default(''),
|
|
153
|
+
firstEventTimeoutMs: Schema.number().min(1000).default(GO_DEFAULT_FIRST_EVENT_MS)
|
|
152
154
|
}).default({
|
|
153
155
|
enabled: true,
|
|
154
156
|
providerId: GO_PROVIDER,
|
|
155
157
|
providerName: GO_PROVIDER_NAME,
|
|
156
158
|
credentialRef: GO_CREDENTIAL_ENV_VAR,
|
|
157
|
-
cachePath: ''
|
|
159
|
+
cachePath: '',
|
|
160
|
+
firstEventTimeoutMs: GO_DEFAULT_FIRST_EVENT_MS
|
|
158
161
|
}).description('Independent OpenCode Go subscription provider (enabled by default; set enabled: false to disable). Resolves the Console Personal API Key via DSH credential service or environment variable; never stores raw API keys.')
|
|
159
162
|
});
|
|
160
163
|
|
|
@@ -194,7 +197,8 @@ export function resolveConfig(raw = {}) {
|
|
|
194
197
|
providerId: raw.goSubscription?.providerId || GO_PROVIDER,
|
|
195
198
|
providerName: raw.goSubscription?.providerName || GO_PROVIDER_NAME,
|
|
196
199
|
credentialRef: raw.goSubscription?.credentialRef || GO_CREDENTIAL_ENV_VAR,
|
|
197
|
-
cachePath: raw.goSubscription?.cachePath || ''
|
|
200
|
+
cachePath: raw.goSubscription?.cachePath || '',
|
|
201
|
+
firstEventTimeoutMs: Number(raw.goSubscription?.firstEventTimeoutMs) || GO_DEFAULT_FIRST_EVENT_MS
|
|
198
202
|
}
|
|
199
203
|
};
|
|
200
204
|
}
|
package/lib/constants.js
CHANGED
package/lib/go/adapter.js
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
|
-
DEFAULT_FIRST_EVENT_MS,
|
|
16
15
|
DEFAULT_IMAGE_MAX_BYTES,
|
|
17
16
|
DEFAULT_IMAGE_PIXEL_BUDGET,
|
|
18
17
|
DEFAULT_STREAM_IDLE_MS,
|
|
18
|
+
GO_DEFAULT_FIRST_EVENT_MS,
|
|
19
19
|
GO_PROVIDER,
|
|
20
20
|
GO_PROVIDER_NAME
|
|
21
21
|
} from '../constants.js';
|
|
@@ -414,7 +414,7 @@ export class OpenCodeGoAdapter {
|
|
|
414
414
|
#firstEventMs() {
|
|
415
415
|
const configured = Number(this.#config.firstEventTimeoutMs);
|
|
416
416
|
if (Number.isFinite(configured) && configured > 0) return configured;
|
|
417
|
-
return Math.
|
|
417
|
+
return Math.max(GO_DEFAULT_FIRST_EVENT_MS, this.#idleMs());
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
#pixelBudget() {
|
package/lib/index.js
CHANGED
|
@@ -128,6 +128,7 @@ export function apply(ctx, config) {
|
|
|
128
128
|
providerId: goProviderId,
|
|
129
129
|
providerName: goConfig.providerName || GO_PROVIDER_NAME,
|
|
130
130
|
streamIdleTimeoutMs: resolved.streamIdleTimeoutMs,
|
|
131
|
+
firstEventTimeoutMs: goConfig.firstEventTimeoutMs,
|
|
131
132
|
resolveAttachments,
|
|
132
133
|
imagePixelBudget: resolved.imagePixelBudget,
|
|
133
134
|
imageMaxBytes: resolved.imageMaxBytes
|
package/lib/ui.js
CHANGED
|
@@ -50,8 +50,10 @@ window.__ModuleLoader__.load({
|
|
|
50
50
|
importLocalAlready: 'This OpenCode Desktop sign-in is already imported.',
|
|
51
51
|
logout: 'Sign out',
|
|
52
52
|
reprobe: 'One-click probe',
|
|
53
|
+
reprobeChecked: 'One-click probe ({n})',
|
|
53
54
|
reprobeAvailable: 'Probe available ({n})',
|
|
54
55
|
reprobeFiltered: 'Probe list ({n})',
|
|
56
|
+
reprobeEmptyHint: 'Select at least one model to probe',
|
|
55
57
|
probing: 'Probing…',
|
|
56
58
|
verify: 'Re-verify credential',
|
|
57
59
|
|
|
@@ -361,6 +363,11 @@ window.__ModuleLoader__.load({
|
|
|
361
363
|
languageOf_en: 'English',
|
|
362
364
|
languageOf_zh: '简体中文',
|
|
363
365
|
'languageOf_zh-Hant': '繁體中文',
|
|
366
|
+
themeToggleToDark: 'Switch to dark mode',
|
|
367
|
+
themeToggleToLight: 'Switch to light mode',
|
|
368
|
+
maintainer: 'Maintainer:',
|
|
369
|
+
repoSite: 'GitHub Repository',
|
|
370
|
+
reportIssue: 'Report Issue',
|
|
364
371
|
},
|
|
365
372
|
|
|
366
373
|
zh: {
|
|
@@ -379,8 +386,10 @@ window.__ModuleLoader__.load({
|
|
|
379
386
|
importLocalAlready: '这组 OpenCode Desktop 登录已经导入过。',
|
|
380
387
|
logout: '退出登录',
|
|
381
388
|
reprobe: '一键探测',
|
|
389
|
+
reprobeChecked: '一键探测 ({n})',
|
|
382
390
|
reprobeAvailable: '探测可用 ({n})',
|
|
383
391
|
reprobeFiltered: '探测清单 ({n})',
|
|
392
|
+
reprobeEmptyHint: '请先勾选至少一个模型',
|
|
384
393
|
probing: '探测中…',
|
|
385
394
|
verify: '重新验证凭证',
|
|
386
395
|
|
|
@@ -690,6 +699,11 @@ window.__ModuleLoader__.load({
|
|
|
690
699
|
languageOf_en: 'English',
|
|
691
700
|
languageOf_zh: '简体中文',
|
|
692
701
|
'languageOf_zh-Hant': '繁體中文',
|
|
702
|
+
themeToggleToDark: '切换为深色模式',
|
|
703
|
+
themeToggleToLight: '切换为浅色模式',
|
|
704
|
+
maintainer: '维护者:',
|
|
705
|
+
repoSite: 'GitHub 仓库',
|
|
706
|
+
reportIssue: '问题反馈',
|
|
693
707
|
},
|
|
694
708
|
|
|
695
709
|
'zh-Hant': {
|
|
@@ -708,8 +722,10 @@ window.__ModuleLoader__.load({
|
|
|
708
722
|
importLocalAlready: '這組 OpenCode Desktop 登入已經匯入過。',
|
|
709
723
|
logout: '登出',
|
|
710
724
|
reprobe: '一鍵探測',
|
|
725
|
+
reprobeChecked: '一鍵探測 ({n})',
|
|
711
726
|
reprobeAvailable: '探測可用 ({n})',
|
|
712
727
|
reprobeFiltered: '探測清單 ({n})',
|
|
728
|
+
reprobeEmptyHint: '請先勾選至少一個模型',
|
|
713
729
|
probing: '探測中…',
|
|
714
730
|
verify: '重新驗證憑證',
|
|
715
731
|
|
|
@@ -1019,6 +1035,11 @@ window.__ModuleLoader__.load({
|
|
|
1019
1035
|
languageOf_en: 'English',
|
|
1020
1036
|
languageOf_zh: '简体中文',
|
|
1021
1037
|
'languageOf_zh-Hant': '繁體中文',
|
|
1038
|
+
themeToggleToDark: '切換為深色模式',
|
|
1039
|
+
themeToggleToLight: '切換為淺色模式',
|
|
1040
|
+
maintainer: '維護者:',
|
|
1041
|
+
repoSite: 'GitHub 專案',
|
|
1042
|
+
reportIssue: '問題回報',
|
|
1022
1043
|
}
|
|
1023
1044
|
};
|
|
1024
1045
|
|
|
@@ -1048,8 +1069,55 @@ window.__ModuleLoader__.load({
|
|
|
1048
1069
|
{ id: 'zh-Hant', label: 'languageZhHant' }
|
|
1049
1070
|
];
|
|
1050
1071
|
|
|
1072
|
+
/** 頂部直接切換的三顆語言按鈕,比照 AGY-Next 樣式。 */
|
|
1073
|
+
const LANGUAGE_BUTTONS = [
|
|
1074
|
+
{ id: 'zh-Hant', short: '繁', label: 'languageZhHant' },
|
|
1075
|
+
{ id: 'zh', short: '简', label: 'languageZh' },
|
|
1076
|
+
{ id: 'en', short: 'EN', label: 'languageEn' }
|
|
1077
|
+
];
|
|
1078
|
+
|
|
1051
1079
|
const SUPPORTED_LOCALES = ['en', 'zh', 'zh-Hant'];
|
|
1052
1080
|
|
|
1081
|
+
/** 主題偏好的儲存鍵;未儲存時自動跟隨 DSH 宿主主題。 */
|
|
1082
|
+
const THEME_STORAGE_KEY = 'opencode-next.theme';
|
|
1083
|
+
|
|
1084
|
+
function readStoredTheme() {
|
|
1085
|
+
try {
|
|
1086
|
+
const raw = window.localStorage.getItem(THEME_STORAGE_KEY);
|
|
1087
|
+
return raw === 'light' || raw === 'dark' ? raw : null;
|
|
1088
|
+
} catch {
|
|
1089
|
+
return null;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
function writeStoredTheme(value) {
|
|
1094
|
+
try {
|
|
1095
|
+
if (value === 'light' || value === 'dark') {
|
|
1096
|
+
window.localStorage.setItem(THEME_STORAGE_KEY, value);
|
|
1097
|
+
} else {
|
|
1098
|
+
window.localStorage.removeItem(THEME_STORAGE_KEY);
|
|
1099
|
+
}
|
|
1100
|
+
return true;
|
|
1101
|
+
} catch {
|
|
1102
|
+
return false;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
function detectHostDark() {
|
|
1107
|
+
try {
|
|
1108
|
+
if (typeof document !== 'undefined' && document.body) {
|
|
1109
|
+
if (document.documentElement?.style?.colorScheme) {
|
|
1110
|
+
return document.body.hasAttribute?.('data-ds-dark-theme') ?? false;
|
|
1111
|
+
}
|
|
1112
|
+
if (document.body.hasAttribute?.('data-ds-dark-theme')) return true;
|
|
1113
|
+
}
|
|
1114
|
+
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
|
|
1115
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
1116
|
+
}
|
|
1117
|
+
} catch {}
|
|
1118
|
+
return false;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1053
1121
|
/**
|
|
1054
1122
|
* 把一個 BCP 47 標籤(例如 `zh-TW`、`zh-Hant-HK`、`en-US`)對應到支援的語言。
|
|
1055
1123
|
*
|
|
@@ -1363,9 +1431,6 @@ window.__ModuleLoader__.load({
|
|
|
1363
1431
|
if (document.getElementById(STYLE_ID)) return;
|
|
1364
1432
|
const style = document.createElement('style');
|
|
1365
1433
|
style.id = STYLE_ID;
|
|
1366
|
-
// 只使用宿主的主題別名變數(label-*、bg-layer-*、border-l*、state-*),
|
|
1367
|
-
// 這樣淺色/深色會自動跟著切換,而不是把顏色寫死。三個 state token 後面
|
|
1368
|
-
// 的字面值只是狀態色的保險絲:別名不存在時至少還看得出紅/黃/綠。
|
|
1369
1434
|
style.textContent = `
|
|
1370
1435
|
.ocoa-page {
|
|
1371
1436
|
/* 顏色全部取自宿主實際存在的別名變數(已對 app.asar 逐項核對)。
|
|
@@ -1375,11 +1440,10 @@ window.__ModuleLoader__.load({
|
|
|
1375
1440
|
--ocoa-fg: var(--dsw-alias-label-primary, #0f1115);
|
|
1376
1441
|
--ocoa-fg2: var(--dsw-alias-label-secondary, #61666b);
|
|
1377
1442
|
--ocoa-fg3: var(--dsw-alias-label-tertiary, #81858c);
|
|
1378
|
-
/* 宿主把 bg-layer-1/2/3 都設成同一個白色,直接拿來堆疊會完全沒有層次。
|
|
1379
|
-
所以表面色用純白,內凹/表頭改用淺藍灰(bluish-100/200)。 */
|
|
1380
1443
|
--ocoa-surface: var(--dsw-alias-bg-layer-1, #fff);
|
|
1381
|
-
|
|
1382
|
-
--ocoa-
|
|
1444
|
+
/* 淺色主題的背景分層是同一色。混入主題文字色,讓兩種主題都保有層次。 */
|
|
1445
|
+
--ocoa-sunk: color-mix(in srgb, var(--ocoa-surface), var(--ocoa-fg) 8%);
|
|
1446
|
+
--ocoa-sunk2: color-mix(in srgb, var(--ocoa-surface), var(--ocoa-fg) 14%);
|
|
1383
1447
|
--ocoa-line: var(--dsw-alias-border-l1, #0000000a);
|
|
1384
1448
|
--ocoa-line2: var(--dsw-alias-border-l2, #0000001a);
|
|
1385
1449
|
--ocoa-line3: var(--dsw-alias-border-l3, #0000001f);
|
|
@@ -1415,6 +1479,45 @@ window.__ModuleLoader__.load({
|
|
|
1415
1479
|
border-radius: 12px;
|
|
1416
1480
|
line-height: 1.4;
|
|
1417
1481
|
-webkit-font-smoothing: antialiased;
|
|
1482
|
+
color-scheme: light dark;
|
|
1483
|
+
}
|
|
1484
|
+
.ocoa-page[data-theme="light"] {
|
|
1485
|
+
color-scheme: light;
|
|
1486
|
+
--ocoa-fg: #0f1115;
|
|
1487
|
+
--ocoa-fg2: #61666b;
|
|
1488
|
+
--ocoa-fg3: #81858c;
|
|
1489
|
+
--ocoa-surface: #ffffff;
|
|
1490
|
+
--ocoa-line: #0000000a;
|
|
1491
|
+
--ocoa-line2: #0000001a;
|
|
1492
|
+
--ocoa-line3: #0000001f;
|
|
1493
|
+
--ocoa-accent: #4176e6;
|
|
1494
|
+
--ocoa-on-accent: #ffffff;
|
|
1495
|
+
--ocoa-hover: #f3f4f6;
|
|
1496
|
+
--ocoa-ok: #16a34a;
|
|
1497
|
+
--ocoa-off: #dc2626;
|
|
1498
|
+
--ocoa-warn: #d97706;
|
|
1499
|
+
}
|
|
1500
|
+
.ocoa-page[data-theme="dark"] {
|
|
1501
|
+
color-scheme: dark;
|
|
1502
|
+
--ocoa-fg: #f1f3f5;
|
|
1503
|
+
--ocoa-fg2: #a9b1bc;
|
|
1504
|
+
--ocoa-fg3: #7f8894;
|
|
1505
|
+
--ocoa-surface: #1f2126;
|
|
1506
|
+
--ocoa-line: #ffffff10;
|
|
1507
|
+
--ocoa-line2: #ffffff1f;
|
|
1508
|
+
--ocoa-line3: #ffffff29;
|
|
1509
|
+
--ocoa-accent: #4f83f0;
|
|
1510
|
+
--ocoa-on-accent: #ffffff;
|
|
1511
|
+
--ocoa-hover: #ffffff14;
|
|
1512
|
+
--ocoa-ok: #22c55e;
|
|
1513
|
+
--ocoa-off: #f87171;
|
|
1514
|
+
--ocoa-warn: #f59e0b;
|
|
1515
|
+
}
|
|
1516
|
+
/* 讓頁面內原生 select 的彈出清單在深淺色主題皆清晰可讀,避免白底白字。 */
|
|
1517
|
+
.ocoa-page select,
|
|
1518
|
+
.ocoa-page select option {
|
|
1519
|
+
background-color: var(--ocoa-surface);
|
|
1520
|
+
color: var(--ocoa-fg);
|
|
1418
1521
|
}
|
|
1419
1522
|
/* 所有子元素都吃 border-box:卡片內距 + 邊框若用 content-box 計算,
|
|
1420
1523
|
在固定寬度的面板裡會把右緣推出邊界(實測截圖就是這樣)。 */
|
|
@@ -1615,7 +1718,7 @@ window.__ModuleLoader__.load({
|
|
|
1615
1718
|
}
|
|
1616
1719
|
.ocoa-fact:first-child { border-left: 0; }
|
|
1617
1720
|
.ocoa-fact-label {
|
|
1618
|
-
font-size: 11.5px; color: var(--ocoa-
|
|
1721
|
+
font-size: 11.5px; color: var(--ocoa-fg2);
|
|
1619
1722
|
margin: 0 0 var(--ocoa-s1); line-height: 1.4;
|
|
1620
1723
|
}
|
|
1621
1724
|
.ocoa-fact-value {
|
|
@@ -1710,7 +1813,7 @@ window.__ModuleLoader__.load({
|
|
|
1710
1813
|
letter-spacing: .16em;
|
|
1711
1814
|
}
|
|
1712
1815
|
.ocoa-url { font-family: var(--ocoa-mono); font-size: 12px; overflow-wrap: anywhere; color: var(--ocoa-fg2); }
|
|
1713
|
-
.ocoa-link { color: var(--ocoa-accent); text-decoration: none; }
|
|
1816
|
+
.ocoa-link { color: color-mix(in srgb, var(--ocoa-accent), var(--ocoa-fg) 28%); text-decoration: none; }
|
|
1714
1817
|
.ocoa-link:hover { text-decoration: underline; }
|
|
1715
1818
|
|
|
1716
1819
|
.ocoa-toolbar { display: flex; align-items: center; gap: var(--ocoa-s3); flex-wrap: wrap; min-width: 0; }
|
|
@@ -1890,33 +1993,117 @@ window.__ModuleLoader__.load({
|
|
|
1890
1993
|
.ocoa-btn { transition: none; }
|
|
1891
1994
|
}
|
|
1892
1995
|
|
|
1893
|
-
/*
|
|
1894
|
-
.ocoa-
|
|
1895
|
-
margin-left: auto;
|
|
1996
|
+
/* 主題與語言切換區:置於標題列最右側,顏色走語意變數,淺/深色皆正常顯示。 */
|
|
1997
|
+
.ocoa-head-actions {
|
|
1998
|
+
margin-left: auto;
|
|
1896
1999
|
display: inline-flex;
|
|
1897
2000
|
align-items: center;
|
|
1898
2001
|
gap: 6px;
|
|
1899
|
-
|
|
1900
|
-
color: var(--dsw-alias-label-tertiary);
|
|
2002
|
+
flex: 0 0 auto;
|
|
1901
2003
|
}
|
|
1902
|
-
.ocoa-
|
|
1903
|
-
|
|
1904
|
-
|
|
2004
|
+
.ocoa-theme-btn {
|
|
2005
|
+
appearance: none;
|
|
2006
|
+
display: inline-grid;
|
|
2007
|
+
place-items: center;
|
|
2008
|
+
flex: 0 0 auto;
|
|
2009
|
+
width: 32px;
|
|
2010
|
+
height: 32px;
|
|
2011
|
+
padding: 0;
|
|
2012
|
+
border: 1px solid var(--ocoa-line2);
|
|
2013
|
+
border-radius: 8px;
|
|
2014
|
+
background: transparent;
|
|
2015
|
+
color: var(--ocoa-fg2);
|
|
2016
|
+
cursor: pointer;
|
|
2017
|
+
transition: background-color .15s ease, color .15s ease, border-color .15s ease;
|
|
2018
|
+
}
|
|
2019
|
+
.ocoa-theme-btn:hover {
|
|
2020
|
+
background: var(--ocoa-hover);
|
|
2021
|
+
color: var(--ocoa-fg);
|
|
2022
|
+
}
|
|
2023
|
+
.ocoa-theme-btn:focus-visible {
|
|
2024
|
+
outline: 2px solid var(--ocoa-accent);
|
|
2025
|
+
outline-offset: 1px;
|
|
2026
|
+
}
|
|
2027
|
+
.ocoa-theme-btn svg {
|
|
2028
|
+
display: block;
|
|
2029
|
+
transition: transform .22s ease;
|
|
2030
|
+
}
|
|
2031
|
+
.ocoa-theme-btn:hover svg {
|
|
2032
|
+
transform: rotate(15deg);
|
|
2033
|
+
}
|
|
2034
|
+
.ocoa-lang {
|
|
2035
|
+
display: inline-flex;
|
|
2036
|
+
align-items: center;
|
|
2037
|
+
flex: 0 0 auto;
|
|
2038
|
+
padding: 2px;
|
|
2039
|
+
border-radius: 9px;
|
|
2040
|
+
background: var(--ocoa-sunk);
|
|
2041
|
+
}
|
|
2042
|
+
.ocoa-lang-btn {
|
|
2043
|
+
appearance: none;
|
|
2044
|
+
min-width: 30px;
|
|
2045
|
+
height: 28px;
|
|
2046
|
+
padding: 0 8px;
|
|
2047
|
+
border: 0;
|
|
2048
|
+
border-radius: 7px;
|
|
2049
|
+
background: transparent;
|
|
2050
|
+
color: var(--ocoa-fg2);
|
|
1905
2051
|
font: inherit;
|
|
1906
2052
|
font-size: 12px;
|
|
1907
|
-
|
|
1908
|
-
background: var(--dsw-alias-bg-layer-2);
|
|
1909
|
-
border: 1px solid var(--dsw-alias-border-l1);
|
|
1910
|
-
border-radius: 6px;
|
|
1911
|
-
padding: 3px 6px;
|
|
2053
|
+
font-weight: 600;
|
|
1912
2054
|
cursor: pointer;
|
|
1913
|
-
|
|
2055
|
+
transition: background-color .15s ease, color .15s ease;
|
|
1914
2056
|
}
|
|
1915
|
-
.ocoa-lang-
|
|
1916
|
-
.ocoa-lang-
|
|
2057
|
+
.ocoa-lang-btn:hover { color: var(--ocoa-fg); }
|
|
2058
|
+
.ocoa-lang-btn.is-active,
|
|
2059
|
+
.ocoa-lang-btn.is-active:hover {
|
|
2060
|
+
background: var(--ocoa-surface);
|
|
2061
|
+
color: var(--ocoa-fg);
|
|
2062
|
+
box-shadow: 0 0 0 1px var(--ocoa-line2);
|
|
2063
|
+
}
|
|
2064
|
+
.ocoa-lang-btn:focus-visible {
|
|
1917
2065
|
outline: 2px solid var(--ocoa-accent);
|
|
1918
2066
|
outline-offset: 1px;
|
|
1919
2067
|
}
|
|
2068
|
+
/* 頁尾版本與專案連結資訊,比照 AGY-Next。 */
|
|
2069
|
+
.ocoa-footer {
|
|
2070
|
+
display: flex;
|
|
2071
|
+
flex-wrap: wrap;
|
|
2072
|
+
align-items: center;
|
|
2073
|
+
justify-content: space-between;
|
|
2074
|
+
gap: 8px 16px;
|
|
2075
|
+
margin-top: 8px;
|
|
2076
|
+
padding-top: 14px;
|
|
2077
|
+
border-top: 1px solid var(--ocoa-line2);
|
|
2078
|
+
font-size: 12px;
|
|
2079
|
+
color: var(--ocoa-fg2);
|
|
2080
|
+
}
|
|
2081
|
+
.ocoa-footer-left,
|
|
2082
|
+
.ocoa-footer-right {
|
|
2083
|
+
display: flex;
|
|
2084
|
+
align-items: center;
|
|
2085
|
+
gap: 6px;
|
|
2086
|
+
flex-wrap: wrap;
|
|
2087
|
+
}
|
|
2088
|
+
.ocoa-footer-link {
|
|
2089
|
+
display: inline-flex;
|
|
2090
|
+
align-items: center;
|
|
2091
|
+
gap: 4px;
|
|
2092
|
+
color: var(--ocoa-fg2);
|
|
2093
|
+
text-decoration: none;
|
|
2094
|
+
transition: color .15s ease;
|
|
2095
|
+
}
|
|
2096
|
+
.ocoa-footer-link:hover {
|
|
2097
|
+
color: var(--ocoa-accent);
|
|
2098
|
+
text-decoration: underline;
|
|
2099
|
+
}
|
|
2100
|
+
.ocoa-footer-author {
|
|
2101
|
+
font-weight: 600;
|
|
2102
|
+
color: var(--ocoa-fg);
|
|
2103
|
+
}
|
|
2104
|
+
.ocoa-footer-dot {
|
|
2105
|
+
color: var(--ocoa-fg3);
|
|
2106
|
+
}
|
|
1920
2107
|
.ocoa-go-list {
|
|
1921
2108
|
display: flex;
|
|
1922
2109
|
flex-direction: column;
|
|
@@ -1926,8 +2113,8 @@ window.__ModuleLoader__.load({
|
|
|
1926
2113
|
.ocoa-go-row {
|
|
1927
2114
|
padding: 8px 10px;
|
|
1928
2115
|
border-radius: 7px;
|
|
1929
|
-
border: 1px solid var(--ocoa-
|
|
1930
|
-
background: var(--ocoa-
|
|
2116
|
+
border: 1px solid var(--ocoa-line2);
|
|
2117
|
+
background: var(--ocoa-sunk);
|
|
1931
2118
|
display: flex;
|
|
1932
2119
|
flex-direction: column;
|
|
1933
2120
|
gap: 4px;
|
|
@@ -1954,8 +2141,8 @@ window.__ModuleLoader__.load({
|
|
|
1954
2141
|
.ocoa-go-pill {
|
|
1955
2142
|
padding: 1px 6px;
|
|
1956
2143
|
border-radius: 4px;
|
|
1957
|
-
border: 1px solid var(--ocoa-
|
|
1958
|
-
background: var(--
|
|
2144
|
+
border: 1px solid var(--ocoa-line2);
|
|
2145
|
+
background: var(--ocoa-surface);
|
|
1959
2146
|
color: var(--ocoa-fg2);
|
|
1960
2147
|
}
|
|
1961
2148
|
.ocoa-go-cred-box {
|
|
@@ -2165,37 +2352,168 @@ window.__ModuleLoader__.load({
|
|
|
2165
2352
|
}
|
|
2166
2353
|
|
|
2167
2354
|
/**
|
|
2168
|
-
*
|
|
2355
|
+
* 語言切換鍵(繁 / 简 / EN 三按鈕)。
|
|
2169
2356
|
*
|
|
2170
2357
|
* 只改本分頁的語言,不會呼叫宿主的 `setLocale()`——那會把選擇寫進 DSH 的
|
|
2171
2358
|
* 使用者設定,連帶換掉整個介面的語言。這裡的選擇存在外掛自己的鍵上。
|
|
2172
|
-
*
|
|
2173
|
-
* 選 `auto`(跟隨系統)時,標題會顯示實際解析出來的語言,讓使用者看得出
|
|
2174
|
-
* 「跟隨系統」目前代表什麼,而不是只有一個抽象的選項名稱。
|
|
2175
2359
|
*/
|
|
2176
|
-
function LanguageSwitcher({
|
|
2177
|
-
|
|
2178
|
-
|
|
2360
|
+
function LanguageSwitcher({ localeId, t, onChange }) {
|
|
2361
|
+
return h(
|
|
2362
|
+
'div',
|
|
2363
|
+
{ className: 'ocoa-lang', role: 'group', 'aria-label': t('languageLabel') },
|
|
2364
|
+
...LANGUAGE_BUTTONS.map((lang) =>
|
|
2365
|
+
h(
|
|
2366
|
+
'button',
|
|
2367
|
+
{
|
|
2368
|
+
key: lang.id,
|
|
2369
|
+
type: 'button',
|
|
2370
|
+
className: `ocoa-lang-btn${lang.id === localeId ? ' is-active' : ''}`,
|
|
2371
|
+
'data-lang': lang.id,
|
|
2372
|
+
title: t(lang.label),
|
|
2373
|
+
'aria-label': t(lang.label),
|
|
2374
|
+
'aria-pressed': lang.id === localeId,
|
|
2375
|
+
onClick: () => onChange(lang.id)
|
|
2376
|
+
},
|
|
2377
|
+
lang.short
|
|
2378
|
+
)
|
|
2379
|
+
)
|
|
2380
|
+
);
|
|
2381
|
+
}
|
|
2179
2382
|
|
|
2383
|
+
/**
|
|
2384
|
+
* 深色/淺色模式切換鈕(太陽/月亮動態 SVG)。
|
|
2385
|
+
* 預設跟隨宿主 DSH 主題;點擊後僅切換本設定頁的配色並記於本機儲存。
|
|
2386
|
+
*/
|
|
2387
|
+
function ThemeToggle({ isDark, t, onToggle }) {
|
|
2388
|
+
const label = isDark ? t('themeToggleToLight') : t('themeToggleToDark');
|
|
2389
|
+
const paths = isDark
|
|
2390
|
+
? ['M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z']
|
|
2391
|
+
: [
|
|
2392
|
+
'M12 7a5 5 0 1 0 0 10a5 5 0 0 0 0-10z',
|
|
2393
|
+
'M12 1.5v2',
|
|
2394
|
+
'M12 20.5v2',
|
|
2395
|
+
'M4.22 4.22l1.42 1.42',
|
|
2396
|
+
'M18.36 18.36l1.42 1.42',
|
|
2397
|
+
'M1.5 12h2',
|
|
2398
|
+
'M20.5 12h2',
|
|
2399
|
+
'M4.22 19.78l1.42-1.42',
|
|
2400
|
+
'M18.36 5.64l1.42-1.42'
|
|
2401
|
+
];
|
|
2180
2402
|
return h(
|
|
2181
|
-
'
|
|
2182
|
-
{
|
|
2183
|
-
|
|
2184
|
-
|
|
2403
|
+
'button',
|
|
2404
|
+
{
|
|
2405
|
+
type: 'button',
|
|
2406
|
+
className: 'ocoa-theme-btn',
|
|
2407
|
+
'data-theme-mode': isDark ? 'dark' : 'light',
|
|
2408
|
+
title: label,
|
|
2409
|
+
'aria-label': label,
|
|
2410
|
+
'aria-pressed': isDark,
|
|
2411
|
+
onClick: onToggle
|
|
2412
|
+
},
|
|
2185
2413
|
h(
|
|
2186
|
-
'
|
|
2414
|
+
'svg',
|
|
2187
2415
|
{
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2416
|
+
width: 16,
|
|
2417
|
+
height: 16,
|
|
2418
|
+
viewBox: '0 0 24 24',
|
|
2419
|
+
fill: 'none',
|
|
2420
|
+
stroke: 'currentColor',
|
|
2421
|
+
strokeWidth: 1.9,
|
|
2422
|
+
strokeLinecap: 'round',
|
|
2423
|
+
strokeLinejoin: 'round',
|
|
2424
|
+
'aria-hidden': true
|
|
2192
2425
|
},
|
|
2193
|
-
...
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2426
|
+
...paths.map((d) => h('path', { key: d, d }))
|
|
2427
|
+
)
|
|
2428
|
+
);
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
const FOOTER_ICONS = {
|
|
2432
|
+
user: [
|
|
2433
|
+
'M12 12a4 4 0 1 0 0-8a4 4 0 0 0 0 8z',
|
|
2434
|
+
'M4.5 20c1.4-3.3 4.2-5 7.5-5s6.1 1.7 7.5 5'
|
|
2435
|
+
],
|
|
2436
|
+
github: [
|
|
2437
|
+
'M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22'
|
|
2438
|
+
]
|
|
2439
|
+
};
|
|
2440
|
+
|
|
2441
|
+
function FooterIcon({ name }) {
|
|
2442
|
+
const paths = FOOTER_ICONS[name] ?? [];
|
|
2443
|
+
return h(
|
|
2444
|
+
'svg',
|
|
2445
|
+
{
|
|
2446
|
+
width: 13,
|
|
2447
|
+
height: 13,
|
|
2448
|
+
viewBox: '0 0 24 24',
|
|
2449
|
+
fill: 'none',
|
|
2450
|
+
stroke: 'currentColor',
|
|
2451
|
+
strokeWidth: 1.9,
|
|
2452
|
+
strokeLinecap: 'round',
|
|
2453
|
+
strokeLinejoin: 'round',
|
|
2454
|
+
'aria-hidden': true
|
|
2455
|
+
},
|
|
2456
|
+
...paths.map((d) => h('path', { key: d, d }))
|
|
2457
|
+
);
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
function PageFooter({ version, t }) {
|
|
2461
|
+
const pluginVersion = typeof version === 'string' && version ? version : null;
|
|
2462
|
+
return h(
|
|
2463
|
+
'footer',
|
|
2464
|
+
{ className: 'ocoa-footer' },
|
|
2465
|
+
h(
|
|
2466
|
+
'div',
|
|
2467
|
+
{ className: 'ocoa-footer-left' },
|
|
2468
|
+
t('maintainer'),
|
|
2469
|
+
' ',
|
|
2470
|
+
h(
|
|
2471
|
+
'a',
|
|
2472
|
+
{
|
|
2473
|
+
href: 'https://github.com/kizaki-R',
|
|
2474
|
+
target: '_blank',
|
|
2475
|
+
rel: 'noopener noreferrer',
|
|
2476
|
+
className: 'ocoa-footer-link ocoa-footer-author'
|
|
2477
|
+
},
|
|
2478
|
+
h(FooterIcon, { name: 'user' }),
|
|
2479
|
+
'@kizaki-R'
|
|
2480
|
+
)
|
|
2481
|
+
),
|
|
2482
|
+
h(
|
|
2483
|
+
'div',
|
|
2484
|
+
{ className: 'ocoa-footer-right' },
|
|
2485
|
+
h(
|
|
2486
|
+
'a',
|
|
2487
|
+
{
|
|
2488
|
+
href: 'https://github.com/kizaki-R/OpenCode-Next-for-DSH',
|
|
2489
|
+
target: '_blank',
|
|
2490
|
+
rel: 'noopener noreferrer',
|
|
2491
|
+
className: 'ocoa-footer-link'
|
|
2492
|
+
},
|
|
2493
|
+
h(FooterIcon, { name: 'github' }),
|
|
2494
|
+
t('repoSite')
|
|
2495
|
+
),
|
|
2496
|
+
h('span', { className: 'ocoa-footer-dot' }, '·'),
|
|
2497
|
+
h(
|
|
2498
|
+
'a',
|
|
2499
|
+
{
|
|
2500
|
+
href: 'https://github.com/kizaki-R/OpenCode-Next-for-DSH/issues',
|
|
2501
|
+
target: '_blank',
|
|
2502
|
+
rel: 'noopener noreferrer',
|
|
2503
|
+
className: 'ocoa-footer-link'
|
|
2504
|
+
},
|
|
2505
|
+
t('reportIssue')
|
|
2506
|
+
),
|
|
2507
|
+
h('span', { className: 'ocoa-footer-dot' }, '·'),
|
|
2508
|
+
h(
|
|
2509
|
+
'a',
|
|
2510
|
+
{
|
|
2511
|
+
href: 'https://www.npmjs.com/package/opencode-next',
|
|
2512
|
+
target: '_blank',
|
|
2513
|
+
rel: 'noopener noreferrer',
|
|
2514
|
+
className: 'ocoa-footer-link'
|
|
2515
|
+
},
|
|
2516
|
+
pluginVersion ? `npm v${pluginVersion}` : 'npm'
|
|
2199
2517
|
)
|
|
2200
2518
|
)
|
|
2201
2519
|
);
|
|
@@ -2274,6 +2592,27 @@ window.__ModuleLoader__.load({
|
|
|
2274
2592
|
const [goSearch, setGoSearch] = React.useState('');
|
|
2275
2593
|
const [goShowAll, setGoShowAll] = React.useState(false);
|
|
2276
2594
|
const [goExpandedModel, setGoExpandedModel] = React.useState(null);
|
|
2595
|
+
// 主題狀態刻意排在最後,維持既有測試中 useState 呼叫順序的索引相容。
|
|
2596
|
+
const [themeChoice, setThemeChoice] = React.useState(() => readStoredTheme());
|
|
2597
|
+
const [hostDark, setHostDark] = React.useState(() => detectHostDark());
|
|
2598
|
+
|
|
2599
|
+
React.useEffect(() => {
|
|
2600
|
+
if (typeof document === 'undefined' || !document.body || typeof MutationObserver !== 'function') {
|
|
2601
|
+
return undefined;
|
|
2602
|
+
}
|
|
2603
|
+
const sync = () => setHostDark(detectHostDark());
|
|
2604
|
+
sync();
|
|
2605
|
+
const observer = new MutationObserver(sync);
|
|
2606
|
+
observer.observe(document.body, { attributes: true, attributeFilter: ['data-ds-dark-theme'] });
|
|
2607
|
+
return () => observer.disconnect();
|
|
2608
|
+
}, []);
|
|
2609
|
+
|
|
2610
|
+
const effectiveDark = themeChoice ? themeChoice === 'dark' : Boolean(hostDark);
|
|
2611
|
+
const toggleTheme = () => {
|
|
2612
|
+
const next = effectiveDark ? 'light' : 'dark';
|
|
2613
|
+
setThemeChoice(next);
|
|
2614
|
+
writeStoredTheme(next);
|
|
2615
|
+
};
|
|
2277
2616
|
|
|
2278
2617
|
const numberLabel = (value) => Number.isFinite(Number(value))
|
|
2279
2618
|
? Number(value).toLocaleString(localeId)
|
|
@@ -2400,7 +2739,7 @@ window.__ModuleLoader__.load({
|
|
|
2400
2739
|
// 也就沒辦法在使用者想要語言的那一刻換語言——而那正是他最需要它的時候。
|
|
2401
2740
|
return h(
|
|
2402
2741
|
'div',
|
|
2403
|
-
{ className: 'ocoa-page' },
|
|
2742
|
+
{ className: 'ocoa-page', 'data-theme': themeChoice || undefined },
|
|
2404
2743
|
h(
|
|
2405
2744
|
'div',
|
|
2406
2745
|
{ className: 'ocoa-head' },
|
|
@@ -2408,15 +2747,19 @@ window.__ModuleLoader__.load({
|
|
|
2408
2747
|
'div',
|
|
2409
2748
|
{ className: 'ocoa-title-row' },
|
|
2410
2749
|
h('span', { className: 'ocoa-title' }, t('title')),
|
|
2411
|
-
h(
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
t,
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2750
|
+
h(
|
|
2751
|
+
'div',
|
|
2752
|
+
{ className: 'ocoa-head-actions' },
|
|
2753
|
+
h(ThemeToggle, { isDark: effectiveDark, t, onToggle: toggleTheme }),
|
|
2754
|
+
h(LanguageSwitcher, {
|
|
2755
|
+
localeId,
|
|
2756
|
+
t,
|
|
2757
|
+
onChange: (value) => {
|
|
2758
|
+
setLanguageChoice(value);
|
|
2759
|
+
writeStoredLanguage(value);
|
|
2760
|
+
}
|
|
2761
|
+
})
|
|
2762
|
+
)
|
|
2420
2763
|
)
|
|
2421
2764
|
),
|
|
2422
2765
|
h(
|
|
@@ -2985,16 +3328,20 @@ window.__ModuleLoader__.load({
|
|
|
2985
3328
|
{ className: 'ocoa-title-row' },
|
|
2986
3329
|
h('span', { className: 'ocoa-title' }, t('title')),
|
|
2987
3330
|
h(Chip, { tone: chip.tone, text: t(chip.key) }),
|
|
2988
|
-
//
|
|
2989
|
-
h(
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
t,
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
3331
|
+
// 主題與語言切換鍵推到最右側。只影響本分頁,不動 DSH 全域設定。
|
|
3332
|
+
h(
|
|
3333
|
+
'div',
|
|
3334
|
+
{ className: 'ocoa-head-actions' },
|
|
3335
|
+
h(ThemeToggle, { isDark: effectiveDark, t, onToggle: toggleTheme }),
|
|
3336
|
+
h(LanguageSwitcher, {
|
|
3337
|
+
localeId,
|
|
3338
|
+
t,
|
|
3339
|
+
onChange: (value) => {
|
|
3340
|
+
setLanguageChoice(value);
|
|
3341
|
+
writeStoredLanguage(value);
|
|
3342
|
+
}
|
|
3343
|
+
})
|
|
3344
|
+
)
|
|
2998
3345
|
)
|
|
2999
3346
|
);
|
|
3000
3347
|
|
|
@@ -3288,25 +3635,41 @@ window.__ModuleLoader__.load({
|
|
|
3288
3635
|
busy === 'picker-reset' ? t('pickerResetBusy') : t('pickerReset')
|
|
3289
3636
|
)
|
|
3290
3637
|
: null,
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3638
|
+
(() => {
|
|
3639
|
+
// 「一鍵探測」預設與「可用」檢視皆僅針對有勾選(m.shown === true)的模型;
|
|
3640
|
+
// 僅在切換到失敗原因分類或輸入搜尋條件時,才針對篩選清單進行補測。
|
|
3641
|
+
const checkedModels = models.filter((m) => m.shown === true);
|
|
3642
|
+
const checkedMatched = matched.filter((m) => m.shown === true);
|
|
3643
|
+
const useFilteredScope = (activeFilter !== 'all' && activeFilter !== 'available') || query.length > 0;
|
|
3644
|
+
const probeTargets = activeFilter === 'available'
|
|
3645
|
+
? checkedMatched
|
|
3646
|
+
: useFilteredScope
|
|
3647
|
+
? matched
|
|
3648
|
+
: checkedModels;
|
|
3649
|
+
const probeTargetIds = probeTargets.map((m) => m.id);
|
|
3650
|
+
const label = busy === 'probe'
|
|
3303
3651
|
? t('probing')
|
|
3304
|
-
: activeFilter === 'available'
|
|
3305
|
-
? t('reprobeAvailable', { n:
|
|
3306
|
-
:
|
|
3307
|
-
? t('reprobeFiltered', { n:
|
|
3308
|
-
: t('
|
|
3309
|
-
|
|
3652
|
+
: activeFilter === 'available'
|
|
3653
|
+
? t('reprobeAvailable', { n: probeTargetIds.length })
|
|
3654
|
+
: useFilteredScope
|
|
3655
|
+
? t('reprobeFiltered', { n: probeTargetIds.length })
|
|
3656
|
+
: t('reprobeChecked', { n: probeTargetIds.length });
|
|
3657
|
+
return h(
|
|
3658
|
+
'button',
|
|
3659
|
+
{
|
|
3660
|
+
className: 'ocoa-btn',
|
|
3661
|
+
'data-probe-btn': 'true',
|
|
3662
|
+
'data-probe-count': probeTargetIds.length,
|
|
3663
|
+
title: probeTargetIds.length === 0 ? t('reprobeEmptyHint') : undefined,
|
|
3664
|
+
onClick: () => {
|
|
3665
|
+
if (probeTargetIds.length === 0) return;
|
|
3666
|
+
act('probe', 'probe', { modelIds: probeTargetIds });
|
|
3667
|
+
},
|
|
3668
|
+
disabled: busy !== '' || probeTargetIds.length === 0
|
|
3669
|
+
},
|
|
3670
|
+
label
|
|
3671
|
+
);
|
|
3672
|
+
})()
|
|
3310
3673
|
)
|
|
3311
3674
|
),
|
|
3312
3675
|
|
|
@@ -4486,7 +4849,7 @@ window.__ModuleLoader__.load({
|
|
|
4486
4849
|
|
|
4487
4850
|
return h(
|
|
4488
4851
|
'div',
|
|
4489
|
-
{ className: 'ocoa-page' },
|
|
4852
|
+
{ className: 'ocoa-page', 'data-theme': themeChoice || undefined },
|
|
4490
4853
|
head,
|
|
4491
4854
|
h(
|
|
4492
4855
|
'div',
|
|
@@ -4510,6 +4873,7 @@ window.__ModuleLoader__.load({
|
|
|
4510
4873
|
))
|
|
4511
4874
|
),
|
|
4512
4875
|
h('div', { className: 'ocoa-pane', role: 'tabpanel' }, currentPane),
|
|
4876
|
+
h(PageFooter, { version: status.version, t }),
|
|
4513
4877
|
contextModal,
|
|
4514
4878
|
removeModal
|
|
4515
4879
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-next",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "OpenCode-Next: Native OpenCode OAuth & OpenCode Go provider for DeepSeek Harness (DSH)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"lib",
|
|
23
23
|
"bin",
|
|
24
24
|
"cordis.patch.yml",
|
|
25
|
+
"CHANGELOG.md",
|
|
25
26
|
"README.zh-TW.md"
|
|
26
27
|
],
|
|
27
28
|
"bin": {
|