opencode-next 1.0.0 → 1.0.2
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/README.md +24 -4
- package/README.zh-TW.md +29 -9
- package/lib/client.js +9 -2
- package/lib/config.js +4 -4
- package/lib/ui.js +61 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./assets/banner-en.png" alt="OpenCode-Next for DSH Banner" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
[](https://github.com/kizaki-R/OpenCode-Next-for-DSH/actions/workflows/test.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/opencode-next)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://deepseek.com/harness/)
|
|
9
|
+
|
|
1
10
|
# OpenCode-Next (`opencode-next`)
|
|
2
11
|
|
|
3
12
|
English | [繁體中文](./README.zh-TW.md)
|
|
4
13
|
|
|
5
14
|
Native OpenCode OAuth & OpenCode Go Provider for DeepSeek Harness (DSH).
|
|
6
15
|
|
|
7
|
-
> Derived from [FishBottle7/opencode2dsh](https://github.com/FishBottle7/opencode2dsh). Internal package/provider identifiers (`opencode-next`, `opencode-next`, `opencode-go-subscription`) are preserved for configuration and account compatibility.
|
|
8
|
-
|
|
9
16
|
Connects directly to the official OpenCode `/inference/openai/v1` endpoint using personal OAuth tokens, eliminating 403 `FreeTierError` and harsh single-IP 429 rate limits.
|
|
10
17
|
|
|
11
18
|
## Highlights
|
|
@@ -213,17 +220,30 @@ Two other defects in the same path were fixed alongside it:
|
|
|
213
220
|
|
|
214
221
|
## Quick Start
|
|
215
222
|
|
|
223
|
+
### Install via DSH Desktop GUI (Easiest)
|
|
224
|
+
|
|
225
|
+
1. Open **DSH → Plugins → Add Plugin** (or **Settings → Built-in Plugins**).
|
|
226
|
+
2. Enter `opencode-next` (npm official registry) or `https://github.com/kizaki-R/OpenCode-Next-for-DSH` (GitHub repository URL).
|
|
227
|
+
3. Click **Install**, restart DSH, and open **Settings → OpenCode-Next** to sign in or configure your OpenCode Go API key.
|
|
228
|
+
|
|
216
229
|
### Install via DSH CLI
|
|
217
230
|
|
|
218
231
|
```bash
|
|
219
|
-
#
|
|
232
|
+
# Install from npm
|
|
220
233
|
dsh plugin --profile desktop add opencode-next
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Alternative sources:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
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.0/opencode-next-1.0.0.tgz
|
|
221
241
|
|
|
222
242
|
# Or directly from GitHub
|
|
223
243
|
dsh plugin --profile desktop add github:kizaki-R/OpenCode-Next-for-DSH
|
|
224
244
|
```
|
|
225
245
|
|
|
226
|
-
*(For Web/Headless profiles, replace `--profile desktop` with `--profile web`.)*
|
|
246
|
+
*(For Web/Headless profiles, replace `--profile desktop` with `--profile web`. Restart DSH after installing, then open **Settings → OpenCode-Next** to sign in or configure your OpenCode Go API key.)*
|
|
227
247
|
|
|
228
248
|
### Installing from a local tarball
|
|
229
249
|
|
package/README.zh-TW.md
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./assets/banner-zh-TW.png" alt="OpenCode-Next 繁體中文橫幅" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
[](https://github.com/kizaki-R/OpenCode-Next-for-DSH/actions/workflows/test.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/opencode-next)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://deepseek.com/harness/)
|
|
9
|
+
|
|
1
10
|
# OpenCode-Next(`opencode-next`)
|
|
2
11
|
|
|
3
12
|
[English](./README.md) | 繁體中文
|
|
4
13
|
|
|
5
14
|
DeepSeek Harness(DSH)的 OpenCode OAuth 與 OpenCode Go 提供者外掛。
|
|
6
15
|
|
|
7
|
-
> 衍生自 [FishBottle7/opencode2dsh](https://github.com/FishBottle7/opencode2dsh)。為維持既有設定檔、帳號與歷史紀錄相容,內部套件與 provider 識別碼(`opencode-next`、`opencode-next`、`opencode-go-subscription`)維持不變。
|
|
8
|
-
|
|
9
16
|
直連 OpenCode 官方推論端點(`/inference/openai/v1` 與 `/inference/go/v1`),避免舊版 `/zen` 匿名通道的 403 `FreeTierError` 與單一 IP 429 限流。
|
|
10
17
|
|
|
11
18
|
---
|
|
@@ -115,19 +122,32 @@ DeepSeek Harness(DSH)的 OpenCode OAuth 與 OpenCode Go 提供者外掛。
|
|
|
115
122
|
|
|
116
123
|
## 安裝至 DSH Profile
|
|
117
124
|
|
|
118
|
-
### 方式 1:透過 DSH
|
|
125
|
+
### 方式 1:透過 DSH 桌面版介面直接安裝(最簡單)
|
|
126
|
+
|
|
127
|
+
1. 在 DSH 左側點開 **「插件」→「添加插件」**。
|
|
128
|
+
2. 輸入套件名稱 **`opencode-next`**(安裝源選 npm 官方源),或直接貼上 GitHub 倉庫網址 **`https://github.com/kizaki-R/OpenCode-Next-for-DSH`**(亦支援本地資料夾路徑)。
|
|
129
|
+
3. 點擊 **「安裝」** 並重啟 DSH,即可在 **「設定 → OpenCode-Next」** 登入免費帳號或設定 OpenCode Go API Key。
|
|
130
|
+
|
|
131
|
+
### 方式 2:透過 DSH CLI 安裝
|
|
119
132
|
|
|
120
133
|
```bash
|
|
121
|
-
# 從 npm
|
|
134
|
+
# 從 npm 安裝
|
|
122
135
|
dsh plugin --profile desktop add opencode-next
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
其他安裝來源:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# 從 GitHub Release 下載安裝
|
|
142
|
+
dsh plugin --profile desktop add https://github.com/kizaki-R/OpenCode-Next-for-DSH/releases/download/v1.0.0/opencode-next-1.0.0.tgz
|
|
123
143
|
|
|
124
|
-
# 或直接從 GitHub
|
|
144
|
+
# 或直接從 GitHub 倉庫安裝
|
|
125
145
|
dsh plugin --profile desktop add github:kizaki-R/OpenCode-Next-for-DSH
|
|
126
146
|
```
|
|
127
147
|
|
|
128
|
-
*(若為 Web 或 Headless 模式,將 `--profile desktop` 改為 `--profile web
|
|
148
|
+
*(若為 Web 或 Headless 模式,將 `--profile desktop` 改為 `--profile web`。安裝後重啟 DSH,即可在「設定 → OpenCode-Next」登入免費帳號或設定 OpenCode Go API Key。)*
|
|
129
149
|
|
|
130
|
-
### 方式
|
|
150
|
+
### 方式 3:本地目錄軟連結(開發者用)
|
|
131
151
|
|
|
132
152
|
在 `%USERPROFILE%\.dsh\profiles\desktop\package.json` 的 `dependencies` 中加入:
|
|
133
153
|
```json
|
|
@@ -145,7 +165,7 @@ dsh plugin --profile desktop add github:kizaki-R/OpenCode-Next-for-DSH
|
|
|
145
165
|
}
|
|
146
166
|
```
|
|
147
167
|
|
|
148
|
-
### 方式
|
|
168
|
+
### 方式 4:使用打包後的 tgz 安裝(離線分發)
|
|
149
169
|
|
|
150
170
|
```bash
|
|
151
171
|
dsh plugin --profile desktop add ./opencode-next-1.0.0.tgz
|
|
@@ -365,4 +385,4 @@ OpenCode 免費模型的 `Free usage limit reached` 主要依**網路出口 IP**
|
|
|
365
385
|
- **正式選單門檻與依目錄自動圖片支援**:僅結構合格且狀態有效之 Go 對話模型會進入正式選單。圖片輸入(透過 DSH `attachments` 服務轉成 `image_url` data URI)會依上游 Go 目錄宣告自動開放給 `modalities.input` 含 `image`/`image/*` 的入選模型(含未來上架的新視覺模型,實際可否辨識以上游端點為準);未宣告圖片輸入或模態未知之模型維持純文字,於附圖送出前直接拒絕(絕不靜默丟圖繼續送純文字,也不退回免費 OAuth),且不開放影片、音訊或 PDF 等其他檔案附件。
|
|
366
386
|
|
|
367
387
|
## 授權條款與來源聲明
|
|
368
|
-
MIT License © 2026(見 [LICENSE](./LICENSE))。本專案衍生自原作者 [FishBottle7/opencode2dsh](https://github.com/FishBottle7/opencode2dsh)(`Copyright (c) 2026 FishBottle7
|
|
388
|
+
MIT License © 2026(見 [LICENSE](./LICENSE))。本專案衍生自原作者 [FishBottle7/opencode2dsh](https://github.com/FishBottle7/opencode2dsh)(`Copyright (c) 2026 FishBottle7`)。
|
package/lib/client.js
CHANGED
|
@@ -22,8 +22,15 @@ export function canonicalSessionId(signal = '') {
|
|
|
22
22
|
if (typeof signal === 'string' && CANONICAL_SESSION_PATTERN.test(signal)) {
|
|
23
23
|
return signal;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const hasSignal = signal !== undefined && signal !== null && String(signal) !== '';
|
|
26
|
+
const seed = hasSignal ? String(signal) : `${Date.now()}:${Math.random()}`;
|
|
27
|
+
const sum = crypto.createHash("sha256").update("ses\0" + seed).digest();
|
|
28
|
+
// Deterministic epoch-bounded timestamp when a session signal is given, so the same session
|
|
29
|
+
// never drifts across 1ms clock boundaries between turns or tests.
|
|
30
|
+
const tsMs = hasSignal
|
|
31
|
+
? 1700000000000 + (sum.readUInt32BE(0) % 100000000000)
|
|
32
|
+
: Date.now();
|
|
33
|
+
return `ses_${invertedTimestampHex(tsMs)}${base62Fixed(BigInt("0x" + sum.subarray(6, 16).toString("hex")), 14)}`;
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
export function randomId(prefix = 'req', length = 16) {
|
package/lib/config.js
CHANGED
|
@@ -144,18 +144,18 @@ export const Config = Schema.object({
|
|
|
144
144
|
.description('Send inference without your account credential, using the public anonymous lane. Off by default. Unofficial usage the upstream does not promise to keep working.'),
|
|
145
145
|
|
|
146
146
|
goSubscription: Schema.object({
|
|
147
|
-
enabled: Schema.boolean().default(
|
|
147
|
+
enabled: Schema.boolean().default(true),
|
|
148
148
|
providerId: Schema.string().default(GO_PROVIDER),
|
|
149
149
|
providerName: Schema.string().default(GO_PROVIDER_NAME),
|
|
150
150
|
credentialRef: Schema.string().default(GO_CREDENTIAL_ENV_VAR),
|
|
151
151
|
cachePath: Schema.string().default('')
|
|
152
152
|
}).default({
|
|
153
|
-
enabled:
|
|
153
|
+
enabled: true,
|
|
154
154
|
providerId: GO_PROVIDER,
|
|
155
155
|
providerName: GO_PROVIDER_NAME,
|
|
156
156
|
credentialRef: GO_CREDENTIAL_ENV_VAR,
|
|
157
157
|
cachePath: ''
|
|
158
|
-
}).description('
|
|
158
|
+
}).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
159
|
});
|
|
160
160
|
|
|
161
161
|
export function resolveConfig(raw = {}) {
|
|
@@ -190,7 +190,7 @@ export function resolveConfig(raw = {}) {
|
|
|
190
190
|
enabled: raw.anonymousChannel?.enabled === true
|
|
191
191
|
},
|
|
192
192
|
goSubscription: {
|
|
193
|
-
enabled: raw.goSubscription?.enabled
|
|
193
|
+
enabled: raw.goSubscription?.enabled !== false,
|
|
194
194
|
providerId: raw.goSubscription?.providerId || GO_PROVIDER,
|
|
195
195
|
providerName: raw.goSubscription?.providerName || GO_PROVIDER_NAME,
|
|
196
196
|
credentialRef: raw.goSubscription?.credentialRef || GO_CREDENTIAL_ENV_VAR,
|
package/lib/ui.js
CHANGED
|
@@ -230,7 +230,7 @@ window.__ModuleLoader__.load({
|
|
|
230
230
|
goWindowUnavailable: '–',
|
|
231
231
|
goExtraUsageWarn: '⚠ If Extra Usage is enabled in Console, overage may bill your workspace balance.',
|
|
232
232
|
goPreviewHint: 'Verified Go chat/tool models are published to the DSH picker (image input is enabled only for Go endpoint-verified image models; unverified catalog vision, video, reasoning, and non-chat capabilities are not advertised).',
|
|
233
|
-
goDisabledHint: '
|
|
233
|
+
goDisabledHint: 'OpenCode Go is disabled in plugin config (goSubscription.enabled: false). Re-enable it and provide an OpenCode Console Personal API Key via DSH credentials or OPENCODE_GO_API_KEY.',
|
|
234
234
|
goRefresh: 'Re-verify',
|
|
235
235
|
goRefreshing: 'Verifying…',
|
|
236
236
|
goClear: 'Clear cache',
|
|
@@ -559,7 +559,7 @@ window.__ModuleLoader__.load({
|
|
|
559
559
|
goWindowUnavailable: '–',
|
|
560
560
|
goExtraUsageWarn: '⚠ 若 Console 开启了 Extra Usage,超出订阅额度后可能会扣款工作区余额。',
|
|
561
561
|
goPreviewHint: '已验证的 Go 对话/工具模型会发布到 DSH 选单(仅已实测通过 Go 端点的模型开放图片输入;未验证的图片、影片、推理与非对话协议能力不予开放)。',
|
|
562
|
-
goDisabledHint: '
|
|
562
|
+
goDisabledHint: '已在插件设置中关闭(goSubscription.enabled: false)。如需启用,请重新开启并通过 DSH 凭证服务或 OPENCODE_GO_API_KEY 提供 OpenCode Console Personal API Key。',
|
|
563
563
|
goRefresh: '重新验证',
|
|
564
564
|
goRefreshing: '验证中…',
|
|
565
565
|
goClear: '清除缓存',
|
|
@@ -888,7 +888,7 @@ window.__ModuleLoader__.load({
|
|
|
888
888
|
goWindowUnavailable: '–',
|
|
889
889
|
goExtraUsageWarn: '⚠ 若 Console 開啟 Extra Usage,超出訂閱額度後可能會扣款工作區餘額。',
|
|
890
890
|
goPreviewHint: '已驗證的 Go 對話/工具模型會發佈到 DSH 選單(僅已實測通過 Go 端點的模型開放圖片輸入;未驗證的圖片、影片、推理與非對話協定能力不予開放)。',
|
|
891
|
-
goDisabledHint: '
|
|
891
|
+
goDisabledHint: '已在外掛設定中停用(goSubscription.enabled: false)。如需啟用,請重新開啟並透過 DSH 憑證服務或 OPENCODE_GO_API_KEY 提供 OpenCode Console Personal API Key。',
|
|
892
892
|
goRefresh: '重新驗證',
|
|
893
893
|
goRefreshing: '驗證中…',
|
|
894
894
|
goClear: '清除快取',
|
|
@@ -4567,6 +4567,64 @@ window.__ModuleLoader__.load({
|
|
|
4567
4567
|
這樣無論宿主語言是什麼,那一行都是可預期的。 */
|
|
4568
4568
|
const navLabel = 'OpenCode-Next';
|
|
4569
4569
|
|
|
4570
|
+
// 設定左側導覽列圖示裝飾器:把 DSH 預設的齒輪圖示換成 OpenCode-Next 專屬標誌。
|
|
4571
|
+
const NAV_ICON_SVG =
|
|
4572
|
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="76 76 360 360" width="16" height="16" fill="none" data-ocn-nav="1" style="flex:none;vertical-align:middle;">' +
|
|
4573
|
+
'<defs>' +
|
|
4574
|
+
'<linearGradient id="ocn-nav-gRing" gradientUnits="userSpaceOnUse" x1="0" y1="158" x2="0" y2="354">' +
|
|
4575
|
+
'<stop offset="0" stop-color="#A8B5C8"/>' +
|
|
4576
|
+
'<stop offset="1" stop-color="#5B6B82"/>' +
|
|
4577
|
+
'</linearGradient>' +
|
|
4578
|
+
'<linearGradient id="ocn-nav-gChev" x1="0" y1="0" x2="1" y2="1">' +
|
|
4579
|
+
'<stop offset="0" stop-color="#06B6D4"/>' +
|
|
4580
|
+
'<stop offset="1" stop-color="#2563EB"/>' +
|
|
4581
|
+
'</linearGradient>' +
|
|
4582
|
+
'<mask id="ocn-nav-cut" maskUnits="userSpaceOnUse" x="0" y="0" width="512" height="512">' +
|
|
4583
|
+
'<rect width="512" height="512" fill="#fff"/>' +
|
|
4584
|
+
'<path d="M377.15 200.85 A78 78 0 1 0 377.15 311.15" fill="none" stroke="#000" stroke-width="64" stroke-linecap="round"/>' +
|
|
4585
|
+
'</mask>' +
|
|
4586
|
+
'</defs>' +
|
|
4587
|
+
'<g transform="translate(256 256) scale(1.12) translate(-256 -256)">' +
|
|
4588
|
+
'<g transform="translate(11 0)">' +
|
|
4589
|
+
'<circle cx="190" cy="256" r="78" fill="none" stroke="url(#ocn-nav-gRing)" stroke-width="40" mask="url(#ocn-nav-cut)"/>' +
|
|
4590
|
+
'<path d="M377.15 200.85 A78 78 0 1 0 377.15 311.15" fill="none" stroke="url(#ocn-nav-gRing)" stroke-width="40" stroke-linecap="round"/>' +
|
|
4591
|
+
'<path d="M334 234 L356 256 L334 278" fill="none" stroke="url(#ocn-nav-gChev)" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>' +
|
|
4592
|
+
'</g>' +
|
|
4593
|
+
'</g>' +
|
|
4594
|
+
'</svg>';
|
|
4595
|
+
|
|
4596
|
+
function patchNavIcon() {
|
|
4597
|
+
if (typeof document === 'undefined' || typeof document.querySelector !== 'function') return;
|
|
4598
|
+
if (!document.querySelector('[role="dialog"]')) return;
|
|
4599
|
+
for (const span of document.querySelectorAll('span')) {
|
|
4600
|
+
if (span.textContent && span.textContent.trim() === navLabel) {
|
|
4601
|
+
const btn = span.closest('button');
|
|
4602
|
+
if (btn) {
|
|
4603
|
+
const svg = btn.querySelector('svg');
|
|
4604
|
+
if (svg && svg.dataset.ocnNav !== '1') {
|
|
4605
|
+
svg.outerHTML = NAV_ICON_SVG;
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4612
|
+
if (typeof window !== 'undefined' && typeof window.setInterval === 'function') {
|
|
4613
|
+
const timer = window.setInterval(patchNavIcon, 400);
|
|
4614
|
+
const onClick = () => queueMicrotask(patchNavIcon);
|
|
4615
|
+
if (typeof document !== 'undefined' && typeof document.addEventListener === 'function') {
|
|
4616
|
+
document.addEventListener('click', onClick, true);
|
|
4617
|
+
}
|
|
4618
|
+
if (typeof ctx.effect === 'function') {
|
|
4619
|
+
ctx.effect(() => () => {
|
|
4620
|
+
window.clearInterval?.(timer);
|
|
4621
|
+
if (typeof document !== 'undefined' && typeof document.removeEventListener === 'function') {
|
|
4622
|
+
document.removeEventListener('click', onClick, true);
|
|
4623
|
+
}
|
|
4624
|
+
}, 'opencode-next: nav icon timer');
|
|
4625
|
+
}
|
|
4626
|
+
}
|
|
4627
|
+
|
|
4570
4628
|
ctx.slots.inject('settings.section', () =>
|
|
4571
4629
|
ctx.slots.register(
|
|
4572
4630
|
{
|