dsh-opencode-go 0.1.20 → 0.1.22
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.en.md +133 -127
- package/README.md +131 -127
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/docs/development.md +60 -8
- package/docs/fork-review-2026-09-25.md +191 -0
- package/docs/independent-package.md +2 -2
- package/docs/verification.md +241 -0
- package/lib/build-info.json +8 -1
- package/lib/client.js +1576 -234
- package/lib/index.js +7001 -338
- package/lib/types/account-manager.d.ts +23 -0
- package/lib/types/account-operations.d.ts +31 -0
- package/lib/types/account-policy.d.ts +16 -0
- package/lib/types/account-recovery.d.ts +2 -0
- package/lib/types/account-selection.d.ts +30 -0
- package/lib/types/account-service.d.ts +12 -0
- package/lib/types/accounts-contract.d.ts +38 -0
- package/lib/types/accounts.d.ts +31 -0
- package/lib/types/adapter.d.ts +43 -9
- package/lib/types/call-trace.d.ts +54 -0
- package/lib/types/catalog-manager.d.ts +20 -0
- package/lib/types/catalog.d.ts +6 -3
- package/lib/types/client/AccountsCard.d.ts +19 -0
- package/lib/types/client/Section.d.ts +3 -6
- package/lib/types/client/UsagePill.d.ts +4 -2
- package/lib/types/client/accounts-controller.d.ts +69 -0
- package/lib/types/client/host-compat.d.ts +7 -0
- package/lib/types/client/locales.d.ts +55 -1
- package/lib/types/client/section-controller.d.ts +17 -41
- package/lib/types/client/staged-form.d.ts +1 -3
- package/lib/types/client/usage.d.ts +1 -1
- package/lib/types/config-contract.d.ts +69 -0
- package/lib/types/config.d.ts +12 -47
- package/lib/types/conversion/context.d.ts +5 -1
- package/lib/types/conversion/image-pool.d.ts +24 -0
- package/lib/types/conversion/replay.d.ts +1 -1
- package/lib/types/conversion/stream.d.ts +1 -1
- package/lib/types/gateway-diagnostics.d.ts +22 -0
- package/lib/types/gateway-error.d.ts +2 -0
- package/lib/types/host-settings.d.ts +11 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/json-response.d.ts +1 -1
- package/lib/types/model-metadata.d.ts +3 -1
- package/lib/types/models-contract.d.ts +7 -0
- package/lib/types/protocol-contract.d.ts +5 -0
- package/lib/types/protocol-policy.d.ts +4 -0
- package/lib/types/proxy-url.d.ts +2 -0
- package/lib/types/proxy.d.ts +11 -0
- package/lib/types/reasoning.d.ts +36 -6
- package/lib/types/request-control.d.ts +2 -0
- package/lib/types/sdk-types.d.ts +1568 -0
- package/lib/types/settings-bridge.d.ts +22 -0
- package/lib/types/usage-contract.d.ts +5 -0
- package/lib/types/usage.d.ts +14 -2
- package/lib/vendor-licenses.txt +103 -0
- package/package.json +8 -2
package/README.en.md
CHANGED
|
@@ -1,211 +1,217 @@
|
|
|
1
1
|
# dsh-opencode-go
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
[简体中文](README.md)
|
|
4
4
|
|
|
5
|
-
Use OpenCode Go subscription models in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), with streaming
|
|
5
|
+
Use OpenCode Go subscription models in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), with streaming, reasoning, tool calls, and image input. The plugin synchronizes model listings and limits, and provides multiple accounts, subscription usage, and proxy settings.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Requires DSH `0.1.5-rc.1` or later.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Installed compatibility is checked on ten host versions from `0.1.5-rc.1` through `0.2.1-alpha.1`; see the [compatibility matrix](docs/development.md#installed-package-matrix). Later hosts need verification. Developer messages, dynamic tool additions/removals, and deferred tool loading are explicitly rejected.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
- **Streaming and history**: Supports streaming output, tool calls, and history replay through pi-ai.
|
|
13
|
-
- **Image input**: Supports models that advertise image capability in the catalog.
|
|
14
|
-
- **Model capacity overrides**: Override the context window and maximum output per model, with blank values inheriting the online catalog.
|
|
15
|
-
- **Per-model switches**: Control which models appear in conversations, with changes applied immediately. Ordinary models default to on and deprecated models default to off; any model can be enabled individually.
|
|
16
|
-
- **Prompt and caching**: The plugin does not add hidden system prompts; the session ID is used for gateway routing.
|
|
11
|
+
## Install
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
### From DSH
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Verified versions: `0.1.5-rc.1`, `0.1.5-rc.2`, `0.1.6-alpha.1`, `0.1.6-alpha.2`, `0.1.7-alpha.1`, `0.1.7-alpha.2`, `0.1.7-rc.1`, `0.1.7-rc.2`, and `0.2.0-rc.2`.
|
|
23
|
-
|
|
24
|
-
### Install from DSH (recommended)
|
|
25
|
-
|
|
26
|
-
1. Open the **Plugins** page in DSH and click **Add plugin** in the top-right corner.
|
|
15
|
+
1. Open **Plugins → Add plugin**.
|
|
27
16
|
2. Enter `dsh-opencode-go` and click **Install**.
|
|
28
|
-
3.
|
|
29
|
-
|
|
30
|
-

|
|
17
|
+
3. Click **Enable now** after installation.
|
|
31
18
|
|
|
32
|
-
|
|
19
|
+

|
|
33
20
|
|
|
34
|
-
|
|
21
|
+
You can also enter the Git repository URL when adding the plugin:
|
|
35
22
|
|
|
36
23
|
```text
|
|
37
24
|
https://github.com/Duskriver/dsh-opencode-go
|
|
38
25
|
```
|
|
39
26
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
If your DSH version does not have an **Add plugin** entry, use the command-line method below.
|
|
43
|
-
|
|
44
|
-
### Command-line installation (alternative)
|
|
27
|
+
### From the command line
|
|
45
28
|
|
|
46
29
|
```sh
|
|
47
30
|
dsh plugin --profile web add dsh-opencode-go
|
|
48
31
|
```
|
|
49
32
|
|
|
50
|
-
Start or restart `dsh web
|
|
33
|
+
Start or restart `dsh web` after installation. Web and Headless use separate profiles; install and update each profile individually.
|
|
51
34
|
|
|
52
|
-
|
|
53
|
-
2. Enter and save your OpenCode Go API key.
|
|
54
|
-
3. Select an OpenCode Go model from the conversation model picker.
|
|
35
|
+
## Get started
|
|
55
36
|
|
|
56
|
-
|
|
37
|
+
1. Open **Settings → OpenCode Go**, enter your API key and save, or add an account in **Accounts**.
|
|
38
|
+
2. Select a model under **DSH OpenCode Go** in the conversation model picker.
|
|
39
|
+
3. Start chatting. Choose a reasoning level when offered, or attach images to a model that supports them.
|
|
57
40
|
|
|
58
|
-
|
|
41
|
+
Refresh the model list in Settings to synchronize the catalog. The switch beside each model controls its visibility in the picker and takes effect immediately. Context windows and output limits use catalog values by default; edit and save individual model limits as needed.
|
|
59
42
|
|
|
60
|
-
|
|
61
|
-
dsh plugin --profile headless add dsh-opencode-go
|
|
62
|
-
```
|
|
43
|
+
**Default** leaves reasoning to the service; **Off** explicitly disables it. Models with a switch show **On / Off**, models with adjustable effort show their supported levels, and budget-based models show token values.
|
|
63
44
|
|
|
64
|
-
|
|
45
|
+
Budget-based models offer common presets such as 1,024 / 2,048 / 8,192 / 16,384 tokens. Select a model in Settings, expand **Thinking budgets**, enter a value, click **Add**, then save to make that budget available in conversations. Allowed ranges vary by model; the SDK may reduce the actual budget to leave room for the answer.
|
|
65
46
|
|
|
66
|
-
|
|
67
|
-
- id: agent-default-model
|
|
68
|
-
config:
|
|
69
|
-
provider: dsh-opencode-go
|
|
70
|
-
model: deepseek-v4.1-flash
|
|
71
|
-
```
|
|
47
|
+
The plugin follows DSH's interface language and supports English and Chinese.
|
|
72
48
|
|
|
73
|
-
|
|
49
|
+
### View subscription usage
|
|
74
50
|
|
|
75
|
-
|
|
76
|
-
read -s OPENCODE_API_KEY
|
|
77
|
-
export OPENCODE_API_KEY
|
|
78
|
-
dsh --profile headless --patch ./headless.patch.yml "Hello"
|
|
79
|
-
```
|
|
51
|
+
Click the usage pill beside the conversation input to see the current account's five-hour, weekly, and monthly usage and reset times. Usage refreshes every minute and can also be refreshed manually.
|
|
80
52
|
|
|
81
|
-
|
|
53
|
+
Under **Advanced settings → Usage display**, choose:
|
|
82
54
|
|
|
83
|
-
|
|
55
|
+
- **Auto**: show usage while using this plugin's models; the default.
|
|
56
|
+
- **Always**: also show usage while using other models.
|
|
57
|
+
- **Off**: hide usage and stop polling.
|
|
84
58
|
|
|
85
|
-
|
|
86
|
-
npm ci
|
|
87
|
-
npm run compile
|
|
88
|
-
npm pack
|
|
89
|
-
dsh plugin --profile web add ./dsh-opencode-go-0.1.20.tgz
|
|
90
|
-
```
|
|
59
|
+

|
|
91
60
|
|
|
92
|
-
|
|
61
|
+
### Manage multiple accounts
|
|
93
62
|
|
|
94
|
-
|
|
63
|
+
Use **Accounts** to add accounts, rename them, or replace keys. Expand an account row for detailed usage. Drag its handle to reorder accounts; the first account becomes the current one.
|
|
95
64
|
|
|
96
|
-
|
|
97
|
-
npm run compile # Regenerate lib/ and commit it with source changes
|
|
98
|
-
npm test # Core tests, rebuilding the plugin first
|
|
99
|
-
npm run check:dist # Verify shipped artifacts match the source
|
|
100
|
-
npm run test:compat # One tarball tested in 9 independent DSH environments
|
|
101
|
-
npm run test:install # npm / pnpm Git installs without plugin build approval
|
|
102
|
-
npm run verify # All of the above
|
|
103
|
-
```
|
|
65
|
+
Enable **Auto switch** to try other accounts in list order when the current account runs out of quota or its key is unavailable, before output begins. To choose the account for subsequent requests directly, click **Switch** in the usage pill.
|
|
104
66
|
|
|
105
|
-
|
|
67
|
+
If adding or removing an account is interrupted by closing the page or losing the connection, the host resumes recovery at startup or after settings and credential updates. An addition whose key was never stored stays visible so you can replace its key or remove it. Recovery preserves a current-account choice made in the meantime.
|
|
106
68
|
|
|
107
|
-
##
|
|
69
|
+
## Advanced usage
|
|
108
70
|
|
|
109
|
-
|
|
71
|
+
### Headless mode
|
|
72
|
+
|
|
73
|
+
Install the plugin:
|
|
110
74
|
|
|
111
75
|
```sh
|
|
112
|
-
dsh plugin --profile
|
|
76
|
+
dsh plugin --profile headless add dsh-opencode-go
|
|
113
77
|
```
|
|
114
78
|
|
|
115
|
-
|
|
79
|
+
Save this as `headless.patch.yml`:
|
|
116
80
|
|
|
117
|
-
|
|
81
|
+
```yaml
|
|
82
|
+
- id: agent-default-model
|
|
83
|
+
config:
|
|
84
|
+
provider: dsh-opencode-go
|
|
85
|
+
model: deepseek-v4.1-flash
|
|
86
|
+
```
|
|
118
87
|
|
|
119
|
-
|
|
88
|
+
Enter your key in Bash or Zsh, then run a task:
|
|
120
89
|
|
|
121
|
-
|
|
90
|
+
```sh
|
|
91
|
+
read -s OPENCODE_API_KEY
|
|
92
|
+
export OPENCODE_API_KEY
|
|
93
|
+
dsh --profile headless --patch ./headless.patch.yml "Hello"
|
|
94
|
+
```
|
|
122
95
|
|
|
123
|
-
|
|
96
|
+
Replace `model` with an available model ID from Settings. See [examples/headless.patch.yml](examples/headless.patch.yml).
|
|
124
97
|
|
|
125
|
-
|
|
98
|
+
### Network proxy
|
|
126
99
|
|
|
127
|
-
|
|
100
|
+
Open **Settings → OpenCode Go → Advanced settings → Proxy address**, enter a URL, and save. Examples:
|
|
128
101
|
|
|
129
|
-
|
|
102
|
+
```text
|
|
103
|
+
http://127.0.0.1:7890
|
|
104
|
+
socks5://127.0.0.1:1080
|
|
105
|
+
```
|
|
130
106
|
|
|
131
|
-
|
|
107
|
+
HTTP, HTTPS, SOCKS5, and URLs containing a username and password are supported. Subsequent conversations, catalog updates, and usage queries use the saved proxy. Connections originate from the machine running DSH; on a remote deployment, `127.0.0.1` refers to that server.
|
|
132
108
|
|
|
133
|
-
|
|
109
|
+
### Experimental Responses protocol
|
|
134
110
|
|
|
135
|
-
|
|
111
|
+
Open **Settings → OpenCode Go → Advanced settings → DeepSeek V4.1 Flash protocol** to select Responses (experimental). Automatic remains the default and follows the gateway's declared protocol. This setting applies only to `deepseek-v4.1-flash` and to new requests. Existing conversation history can continue with either selection; a failed request does not automatically retry through another protocol.
|
|
136
112
|
|
|
137
|
-
|
|
113
|
+
To configure the experiment manually:
|
|
138
114
|
|
|
139
115
|
```yaml
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
116
|
+
- id: opencode-go
|
|
117
|
+
config:
|
|
118
|
+
protocolOverrides:
|
|
119
|
+
deepseek-v4.1-flash: openai-responses
|
|
143
120
|
```
|
|
144
121
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
The older `showDeprecatedModels` and `visibleModelIds` fields no longer control visibility. Use the individual switches or `modelVisibility`; retaining old fields does not prevent the plugin from loading.
|
|
148
|
-
|
|
149
|
-
## Image count cap
|
|
122
|
+
Select Automatic to revert. A null value for this model also clears an inherited override. Gateway routing and performance may change; Responses does not guarantee a particular provider or faster responses.
|
|
150
123
|
|
|
151
|
-
|
|
124
|
+
### Manual configuration
|
|
152
125
|
|
|
153
|
-
|
|
126
|
+
Add an `opencode-go` configuration block to a patch file. It can be combined with the default-model configuration above:
|
|
154
127
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
128
|
+
```yaml
|
|
129
|
+
- id: opencode-go
|
|
130
|
+
config:
|
|
131
|
+
apiKeyEnv: OPENCODE_API_KEY
|
|
132
|
+
accounts:
|
|
133
|
+
- id: primary
|
|
134
|
+
name: Primary
|
|
135
|
+
apiKeyEnv: OPENCODE_API_KEY
|
|
136
|
+
- id: backup
|
|
137
|
+
name: Backup
|
|
138
|
+
apiKeyEnv: OPENCODE_GO_BACKUP_KEY
|
|
139
|
+
autoSwitch: true
|
|
140
|
+
proxyURL: http://127.0.0.1:7890
|
|
141
|
+
refreshMinutes: 60
|
|
142
|
+
modelVisibility:
|
|
143
|
+
deepseek-v4-pro: false
|
|
144
|
+
modelLimits:
|
|
145
|
+
deepseek-v4.1-flash:
|
|
146
|
+
maxTokens: 8192
|
|
147
|
+
qwen3.7-plus:
|
|
148
|
+
thinkingBudgets: [4096, 6000]
|
|
149
|
+
maxImages: 30
|
|
150
|
+
```
|
|
164
151
|
|
|
165
|
-
|
|
152
|
+
Keep the options you need and supply the corresponding keys through DSH credentials or environment variables. `apiKeyEnv` selects the current account; the order of `accounts` determines automatic fallback order.
|
|
166
153
|
|
|
167
|
-
|
|
154
|
+
| Option | Purpose |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| `baseURL` | OpenCode Go gateway URL; defaults to `https://opencode.ai/zen/go/v1` |
|
|
157
|
+
| `usageDisplay` | Usage display mode: `auto`, `always`, or `off` |
|
|
158
|
+
| `proxyURL` | Network proxy; an empty string uses the default network settings |
|
|
159
|
+
| `refreshMinutes` | Model catalog cache lifetime; defaults to 60 minutes, with manual refresh available in Settings |
|
|
160
|
+
| `modelVisibility` | Control model picker visibility by model ID |
|
|
161
|
+
| `protocolOverrides` | Experimental `deepseek-v4.1-flash: openai-responses`; unset or null follows the gateway |
|
|
162
|
+
| `modelLimits` | Per-model `contextWindow` and `maxTokens` overrides, plus additional `thinkingBudgets` options; null uses defaults |
|
|
163
|
+
| `maxImages` | Maximum images in one request's history; unset by default, with oldest images offloaded when exceeded |
|
|
164
|
+
| `streamIdleTimeoutMs` | Maximum wait for the next stream event; defaults to 300000 milliseconds |
|
|
165
|
+
| `requestPreparationTimeoutMs` | Deadline for discovery and each attempt's credential/image preparation; defaults to 60000 milliseconds |
|
|
166
|
+
| `requestTimeoutMs` | Whole dispatch deadline, including discovery, account fallback and streaming; defaults to 1800000 milliseconds. Prepared calls start this timer at dispatch |
|
|
168
167
|
|
|
169
|
-
|
|
168
|
+
Image offloading keeps the original attachment and replaces the old image in the request with a text placeholder. Raising the limit does not automatically restore previously offloaded images.
|
|
170
169
|
|
|
171
|
-
|
|
170
|
+
Image count overflow is detected before attachment reads. Preparation shares four execution slots and at most 32 queued tasks within the plugin module, and stops scheduling images when known encoded bytes exceed the payload cap. Active image attempts share a 128 MiB budget for prepared raw data plus base64 payloads; this is not a process memory limit. Queue or shared-budget overflow returns `IMAGE_RESOURCE_BUSY`; retry after another request completes. Count and byte limits may require successive host offload retries.
|
|
172
171
|
|
|
173
|
-
A
|
|
172
|
+
A cold catalog outage reports `DISCOVERY_FAILED`; a warm catalog retains previously verified models. Only an explicit empty gateway listing clears membership. A partially malformed listing keeps its valid models and reports the ignored row count in settings and logs. Ordinary advanced form settings commit in one revision-checked batch. Credentials use a separate service; failed credential drafts remain, and retry submits only uncommitted parts.
|
|
174
173
|
|
|
175
|
-
|
|
174
|
+
### Export error diagnostics
|
|
176
175
|
|
|
177
|
-
|
|
176
|
+
To investigate a failed request, set a diagnostics directory before starting DSH:
|
|
178
177
|
|
|
179
|
-
|
|
178
|
+
```sh
|
|
179
|
+
export DSH_OPENCODE_GO_DEBUG_DIR=/tmp/dsh-opencode-go-debug
|
|
180
|
+
dsh web
|
|
181
|
+
```
|
|
180
182
|
|
|
181
|
-
|
|
183
|
+
Windows PowerShell:
|
|
182
184
|
|
|
183
|
-
|
|
185
|
+
```powershell
|
|
186
|
+
$env:DSH_OPENCODE_GO_DEBUG_DIR = "$env:TEMP\dsh-opencode-go-debug"
|
|
187
|
+
dsh web
|
|
188
|
+
```
|
|
184
189
|
|
|
185
|
-
|
|
190
|
+
Reproduce the failure to get a JSON file path in the error message. The record contains the model, request parameter summaries, HTTP status, upstream log and route IDs, and the error response, for use in an [issue report](https://github.com/Duskriver/dsh-opencode-go/issues). Review the returned error content before sharing. Clear the environment variable and restart DSH to disable diagnostics.
|
|
186
191
|
|
|
187
|
-
|
|
192
|
+
DSH debug logs contain a call ID and each attempt's stage timings, HTTP status, upstream request ID, time to first output and error code, including stream failures after HTTP 200. Image attempts also report aggregate queue waiting and peak resource occupancy. Error files carry the same call ID and attempt number for correlation. These summaries exclude prompts, keys, proxy addresses and raw session IDs.
|
|
188
193
|
|
|
189
|
-
|
|
194
|
+
## Update and uninstall
|
|
190
195
|
|
|
191
|
-
|
|
196
|
+
Update to the latest npm release:
|
|
192
197
|
|
|
193
|
-
|
|
198
|
+
```sh
|
|
199
|
+
dsh plugin --profile web update dsh-opencode-go --latest
|
|
200
|
+
```
|
|
194
201
|
|
|
195
|
-
|
|
202
|
+
Restart `dsh web` and reload the page afterward. For desktop DSH, quit and reopen the application. Headless users should replace `web` with `headless`.
|
|
196
203
|
|
|
197
|
-
|
|
204
|
+
Uninstall:
|
|
198
205
|
|
|
199
206
|
```sh
|
|
200
207
|
dsh plugin --profile web remove dsh-opencode-go
|
|
201
|
-
# or
|
|
202
|
-
dsh plugin --profile headless remove dsh-opencode-go
|
|
203
208
|
```
|
|
204
209
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
Please open an issue for bugs or feature requests.
|
|
210
|
+
When upgrading from `0.1.16` or earlier, select **DSH OpenCode Go** again in existing conversations or Agent presets. Manual configurations use `provider: dsh-opencode-go`.
|
|
208
211
|
|
|
209
|
-
##
|
|
212
|
+
## More
|
|
210
213
|
|
|
211
|
-
[
|
|
214
|
+
- [Development and testing](docs/development.md)
|
|
215
|
+
- [Verification notes](docs/verification.md)
|
|
216
|
+
- [Issues and suggestions](https://github.com/Duskriver/dsh-opencode-go/issues)
|
|
217
|
+
- [MIT license](LICENSE)
|