@goodandready/dsh-opencode-provider 0.5.0 → 0.5.1

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,93 +1,97 @@
1
- # Changelog
2
-
3
- ## 0.5.0
4
-
5
- - **Parity release**: TUI settings section, Models-page key card, plan-aware Go picker, request-wide image budget and tool-schema normalization.
6
- - Package identity is now scoped: `@goodandready/dsh-opencode-provider` (unscoped npm name belongs to an unrelated package).
7
- - Custom composer cost pill and custom analytics cost columns removed; cost is shown only by DSH's native display.
8
- - One-click plugin update in Settings → OpenCode: registry status, badge, exact `dsh plugin add`, restart notice, loopback/same-origin POST guard.
9
- - English, Chinese and Russian READMEs and a visual-verification asset ship in the package and GitHub tree.
10
- - **Usage analytics dashboard** in the quota panel: KPI grid, 7/30/90 window, and Models / Days / Sessions tables; success/errors show `—` because the local projection does not expose failed attempts. Cost is not duplicated: DSH's native display is the only cost surface.
11
- - **Tool limit fix**: tools are deduplicated by name and capped at OpenCode's 128-item maximum before every transport, fixing `HTTP 400: maximum number of items is 128` in tool-heavy profiles.
12
- - **Test connection** button in the key card: pick a model, run a minimal real request, see latency and the reply.
13
- - `POST /dsh-opencode/test` Host route with a 60-second budget.
14
- - Sidebar quota bars now change color at 75% (warning) and 90% (critical).
15
- - Write routes require a literal loopback `Host` (not just a loopback socket) in addition to same-origin and JSON checks, closing DNS-rebinding key exfiltration.
16
- - Analytics no longer fabricates `100%` success / `0` errors; the local projection returns `null` and the UI shows `—`.
17
- - Go plan filtering now fails open for models that exist only in the live catalog; known Console models stay hidden.
18
- - Tool truncation at the 128-item provider limit logs a one-time warning instead of failing silently.
19
- - TUI settings refresh after `/config` account changes; analytics requests have an error state and a generation guard against the 7/30/90 race.
20
- - Projection analytics reads run with bounded parallelism; `.commandcode/` is ignored; provider registration logs at boot.
21
- - Tool-result images are replaced with an offload placeholder instead of failing the whole request in every transport.
22
- - Core harness tools (`read`, `write`, `edit`, `bash`, `glob`, `grep`, …) survive the 128-tool cap even when a large MCP set is present.
23
- - `GET /dsh-opencode/health` reports provider registration, account count and model count for startup diagnostics.
24
- - The TUI settings section polls live config, so accounts/allowlist changes made from the terminal refresh without a restart.
25
- - Client colors moved to DSH theme variables; the `zh` dictionary is a real translation; draft/route/widget helpers moved to `settings-draft.ts`, `settings-widgets.tsx`, `routes-public.ts` and `routes-values.ts`; quota triggers expose real `aria-expanded` panel state.
26
- - Tests grew to 84, including TUI polling, health, core-tool preservation and tool-result image placeholders.
27
- - Rotation now also triggers on quota/usage-limit bodies (400/402/403/429), with a 10-minute or `Retry-After` cooldown for quota rejections.
28
- - The last account is marked on rejection as well; account rows expose `mark`/`coolingUntil`, show a cooldown badge, and the active marker follows the first non-cooling key.
29
- - Per-account quota reads: `/state.accounts[].usage` is fetched for each distinct key (`UsageReader` caches per key), the active account drives the sidebar and quota panel, Accounts rows show 5h/week/month chips, and the panel has an accounts table. Verified live: `default` 1/5/2 and `Go #2` 9/4/100 with `rate-limited` monthly until 22 Oct 08:21.
30
- - Request heatmap (Monday-first weekday × local hour) in the quota panel. The adapter appends `{at, provider, model, purpose?}` to `~/.dsh/storages/dsh-opencode/requests.jsonl` and `/analytics` merges the aggregate; prompts, responses and keys are never stored. Live: two `/test` calls produced `Tue 13:00 = 2`.
31
- - Heatmap accuracy: `session-title` / `compaction` calls are excluded and exact duplicate records collapse. Live after two real chat messages: analytics shows 2 OpenCode sessions (`deepseek-v4.1-flash` ≈$0.00079, `beam-free` Free), while the heatmap counts 6 main requests instead of 8 raw records.
32
- - A 24-hour aggregate strip under the heatmap sums the selected window by hour across all days; its bars use the same intensity scale and tooltips.
33
- - Per-model heatmap: `/analytics` returns a `models[]` series (provider/model, total, hours, grid), and the panel offers an **All models / model** selector when more than one model has traffic. Live: `deepseek-v4.1-flash` 2, `minimax-m3.1-flash-free` 1.
34
- - Account cooldowns persist across restarts in `~/.dsh/storages/dsh-opencode/cooldowns.json`, keyed by a SHA-256 fingerprint (raw keys are never written). Expired entries are dropped and the file is capped at 50. Live: after a restart, `Go #2` kept its `quota` mark until 22 Oct 08:21 while the restored default key was active.
35
- - Model → account rules: first matching glob (case-insensitive `*`/`?`) pins a preferred account for that model, with the other accounts kept as fallbacks. Config is normalized and exposed through `/state`; Settings has an editor. Live: `*free* → Go #2` round-tripped through `/config` and `/state`, then cleared.
36
- - Sidebar quota card redesigned to match the clinebot meter: theme-native ring, active account name, highest-window percent, and 5-hour / weekly / monthly rows with remaining quota, reset countdown and thin bars. Uses DSH CSS variables and has a narrow rail variant. The header percentage is right-aligned with the row values.
37
- - Quota panel now has its own vertical scroll (`height: 100%`, viewport max-height, `overflow-y: auto`), so content below the fold is reachable; verified in Desktop by opening the panel and scrolling to **Usage by model**.
38
- - Quota panel polish: the badge now says **Active account** (not "Pinned account" when `activeAccount` is empty), Accounts rows show persisted cooldown / provider rate-limit badges (for example `Quota cooldown · 2d`), and the 5-hour/weekly/monthly bars show date+time with a relative reset (`1% · 20.10, 17:11 (2h)`).
39
- - `/opencode` gained `accounts`, `models`, `rules` and `test [model]`; `status` now includes per-account quotas and rules.
40
- - Request log compaction at 2 MB (newest 5000 lines) and a `npm run check` / `npm run release` workflow plus GitHub Actions CI (`typecheck`, tests, build, pack).
41
- - Live-verified two-account rotation in DSH Desktop: with an invalid default key, `/test` switched to `Go #2` and returned `OK`. A later run found `Go #2` at its monthly limit (98% before the tests) and showed `quota` with the provider's reset.
42
- - `GET /dsh-opencode/analytics` and the **Usage by model** table in the quota panel (7/30/90 days). It aggregates only numeric metadata from the local session projection cache; a session is attributed to its last-used model.
43
- - Verified live in DSH Desktop 0.2.1-rc.2; install there from the packed tarball (a directory path triggers the Desktop CLI's `dsh-desktop-runtime` alias bug).
44
-
45
- ## 0.4.1
46
-
47
- - Accounts card can set each account's key from the page; unconfigured accounts are listed with a missing-key badge.
48
- - Live catalog refresh button (`POST /dsh-opencode/models/refresh`).
49
- - Quota warning banners at 80% and 95% in the settings page.
50
- - Expandable subscription-limits table: per model, Go and Go Plus monthly allowance plus 5h/week/month request estimates.
51
-
52
- ## 0.4.0
53
-
54
- - Per-model OpenCode Go subscription limits: monthly dollar allowance and estimated requests for the 5-hour, weekly and monthly windows, for Go and Go Plus.
55
- - Limits appear in the model picker description and as a badge in the settings model list; hovering shows both plans.
56
- - Added `src/subscription-limits.ts` with the official table and formatting helpers.
57
- - Tests: limits table integrity, formatting, and route-gated model descriptions.
58
-
59
- ## 0.3.1
60
-
61
- - Composer session-cost estimate (`≈`/`≥`/`Free`) from the generated price snapshot and the `tokenUsage`/`modelSelection` projections.
62
- - Model price badges in the settings page; model picker descriptions now include per-1M input/output rates.
63
- - OpenCode auth-entry autocomplete from the entries actually present in `auth.json`.
64
- - Broadened live tool-loop coverage (Grok, Muse, Qwen).
65
-
66
- ## 0.3.0
67
-
68
- - Browser settings page (`Settings → OpenCode`): key management, quota bars, accounts, model allowlist, per-model transport overrides, connection settings.
69
- - Sidebar quota card (opt-in) and the center-column quota panel.
70
- - Host HTTP routes under `/dsh-opencode/*` with same-origin enforcement.
71
- - Key import from OpenCode's `auth.json` through the credentials seam.
72
- - Client bundle built as a `window.__ModuleLoader__` module with React externalized.
73
-
74
- ## 0.2.0
75
-
76
- - Native Anthropic Messages transport (thinking blocks, signatures, tool use).
77
- - Native OpenAI Responses transport.
78
- - Native Google Generative AI transport with `thoughtSignature` replay.
79
- - Image input on every transport, through `ctx.attachments.readImageRequest`.
80
- - Multi-account pool with pre-stream 401/403/429 rotation and per-key cooldowns.
81
- - `/opencode` command with status and quota windows.
82
- - Reasoning-effort mapping and output caps.
83
- - Expanded unit tests and live smoke scripts.
84
-
85
- ## 0.1.0
86
-
87
- - Initial P1 skeleton.
88
- - Registers `opencode` and `opencode-go` routes on the dsh `llm` service.
89
- - OpenAI Chat transport over the Go unified gateway.
90
- - Stable `x-opencode-session` derived from the durable session id.
91
- - Key resolution from config, the credential seam, OpenCode `auth.json`, and the launch environment.
92
- - Live model catalog with a generated `models.dev` fallback.
93
- - Text, reasoning, streamed tool calls, usage, and classified provider errors.
1
+ # Changelog
2
+
3
+ ## 0.5.1
4
+
5
+ - Remove the non-standard inline key card from Settings → Models. Provider cards stay standard; the key is edited only through **Изменить** on the OpenCode settings page.
6
+
7
+ ## 0.5.0
8
+
9
+ - **Parity release**: TUI settings section, plan-aware Go picker, request-wide image budget and tool-schema normalization.
10
+ - Package identity is now scoped: `@goodandready/dsh-opencode-provider` (unscoped npm name belongs to an unrelated package).
11
+ - Custom composer cost pill and custom analytics cost columns removed; cost is shown only by DSH's native display.
12
+ - One-click plugin update in Settings → OpenCode: registry status, badge, exact `dsh plugin add`, restart notice, loopback/same-origin POST guard.
13
+ - English, Chinese and Russian READMEs and a visual-verification asset ship in the package and GitHub tree.
14
+ - **Usage analytics dashboard** in the quota panel: KPI grid, 7/30/90 window, and Models / Days / Sessions tables; success/errors show `—` because the local projection does not expose failed attempts. Cost is not duplicated: DSH's native display is the only cost surface.
15
+ - **Tool limit fix**: tools are deduplicated by name and capped at OpenCode's 128-item maximum before every transport, fixing `HTTP 400: maximum number of items is 128` in tool-heavy profiles.
16
+ - **Test connection** button in the key card: pick a model, run a minimal real request, see latency and the reply.
17
+ - `POST /dsh-opencode/test` Host route with a 60-second budget.
18
+ - Sidebar quota bars now change color at 75% (warning) and 90% (critical).
19
+ - Write routes require a literal loopback `Host` (not just a loopback socket) in addition to same-origin and JSON checks, closing DNS-rebinding key exfiltration.
20
+ - Analytics no longer fabricates `100%` success / `0` errors; the local projection returns `null` and the UI shows `—`.
21
+ - Go plan filtering now fails open for models that exist only in the live catalog; known Console models stay hidden.
22
+ - Tool truncation at the 128-item provider limit logs a one-time warning instead of failing silently.
23
+ - TUI settings refresh after `/config` account changes; analytics requests have an error state and a generation guard against the 7/30/90 race.
24
+ - Projection analytics reads run with bounded parallelism; `.commandcode/` is ignored; provider registration logs at boot.
25
+ - Tool-result images are replaced with an offload placeholder instead of failing the whole request in every transport.
26
+ - Core harness tools (`read`, `write`, `edit`, `bash`, `glob`, `grep`, …) survive the 128-tool cap even when a large MCP set is present.
27
+ - `GET /dsh-opencode/health` reports provider registration, account count and model count for startup diagnostics.
28
+ - The TUI settings section polls live config, so accounts/allowlist changes made from the terminal refresh without a restart.
29
+ - Client colors moved to DSH theme variables; the `zh` dictionary is a real translation; draft/route/widget helpers moved to `settings-draft.ts`, `settings-widgets.tsx`, `routes-public.ts` and `routes-values.ts`; quota triggers expose real `aria-expanded` panel state.
30
+ - Tests grew to 84, including TUI polling, health, core-tool preservation and tool-result image placeholders.
31
+ - Rotation now also triggers on quota/usage-limit bodies (400/402/403/429), with a 10-minute or `Retry-After` cooldown for quota rejections.
32
+ - The last account is marked on rejection as well; account rows expose `mark`/`coolingUntil`, show a cooldown badge, and the active marker follows the first non-cooling key.
33
+ - Per-account quota reads: `/state.accounts[].usage` is fetched for each distinct key (`UsageReader` caches per key), the active account drives the sidebar and quota panel, Accounts rows show 5h/week/month chips, and the panel has an accounts table. Verified live: `default` 1/5/2 and `Go #2` 9/4/100 with `rate-limited` monthly until 22 Oct 08:21.
34
+ - Request heatmap (Monday-first weekday × local hour) in the quota panel. The adapter appends `{at, provider, model, purpose?}` to `~/.dsh/storages/dsh-opencode/requests.jsonl` and `/analytics` merges the aggregate; prompts, responses and keys are never stored. Live: two `/test` calls produced `Tue 13:00 = 2`.
35
+ - Heatmap accuracy: `session-title` / `compaction` calls are excluded and exact duplicate records collapse. Live after two real chat messages: analytics shows 2 OpenCode sessions (`deepseek-v4.1-flash` ≈$0.00079, `beam-free` Free), while the heatmap counts 6 main requests instead of 8 raw records.
36
+ - A 24-hour aggregate strip under the heatmap sums the selected window by hour across all days; its bars use the same intensity scale and tooltips.
37
+ - Per-model heatmap: `/analytics` returns a `models[]` series (provider/model, total, hours, grid), and the panel offers an **All models / model** selector when more than one model has traffic. Live: `deepseek-v4.1-flash` 2, `minimax-m3.1-flash-free` 1.
38
+ - Account cooldowns persist across restarts in `~/.dsh/storages/dsh-opencode/cooldowns.json`, keyed by a SHA-256 fingerprint (raw keys are never written). Expired entries are dropped and the file is capped at 50. Live: after a restart, `Go #2` kept its `quota` mark until 22 Oct 08:21 while the restored default key was active.
39
+ - Model → account rules: first matching glob (case-insensitive `*`/`?`) pins a preferred account for that model, with the other accounts kept as fallbacks. Config is normalized and exposed through `/state`; Settings has an editor. Live: `*free* → Go #2` round-tripped through `/config` and `/state`, then cleared.
40
+ - Sidebar quota card redesigned to match the clinebot meter: theme-native ring, active account name, highest-window percent, and 5-hour / weekly / monthly rows with remaining quota, reset countdown and thin bars. Uses DSH CSS variables and has a narrow rail variant. The header percentage is right-aligned with the row values.
41
+ - Quota panel now has its own vertical scroll (`height: 100%`, viewport max-height, `overflow-y: auto`), so content below the fold is reachable; verified in Desktop by opening the panel and scrolling to **Usage by model**.
42
+ - Quota panel polish: the badge now says **Active account** (not "Pinned account" when `activeAccount` is empty), Accounts rows show persisted cooldown / provider rate-limit badges (for example `Quota cooldown · 2d`), and the 5-hour/weekly/monthly bars show date+time with a relative reset (`1% · 20.10, 17:11 (2h)`).
43
+ - `/opencode` gained `accounts`, `models`, `rules` and `test [model]`; `status` now includes per-account quotas and rules.
44
+ - Request log compaction at 2 MB (newest 5000 lines) and a `npm run check` / `npm run release` workflow plus GitHub Actions CI (`typecheck`, tests, build, pack).
45
+ - Live-verified two-account rotation in DSH Desktop: with an invalid default key, `/test` switched to `Go #2` and returned `OK`. A later run found `Go #2` at its monthly limit (98% before the tests) and showed `quota` with the provider's reset.
46
+ - `GET /dsh-opencode/analytics` and the **Usage by model** table in the quota panel (7/30/90 days). It aggregates only numeric metadata from the local session projection cache; a session is attributed to its last-used model.
47
+ - Verified live in DSH Desktop 0.2.1-rc.2; install there from the packed tarball (a directory path triggers the Desktop CLI's `dsh-desktop-runtime` alias bug).
48
+
49
+ ## 0.4.1
50
+
51
+ - Accounts card can set each account's key from the page; unconfigured accounts are listed with a missing-key badge.
52
+ - Live catalog refresh button (`POST /dsh-opencode/models/refresh`).
53
+ - Quota warning banners at 80% and 95% in the settings page.
54
+ - Expandable subscription-limits table: per model, Go and Go Plus monthly allowance plus 5h/week/month request estimates.
55
+
56
+ ## 0.4.0
57
+
58
+ - Per-model OpenCode Go subscription limits: monthly dollar allowance and estimated requests for the 5-hour, weekly and monthly windows, for Go and Go Plus.
59
+ - Limits appear in the model picker description and as a badge in the settings model list; hovering shows both plans.
60
+ - Added `src/subscription-limits.ts` with the official table and formatting helpers.
61
+ - Tests: limits table integrity, formatting, and route-gated model descriptions.
62
+
63
+ ## 0.3.1
64
+
65
+ - Composer session-cost estimate (`≈`/`≥`/`Free`) from the generated price snapshot and the `tokenUsage`/`modelSelection` projections.
66
+ - Model price badges in the settings page; model picker descriptions now include per-1M input/output rates.
67
+ - OpenCode auth-entry autocomplete from the entries actually present in `auth.json`.
68
+ - Broadened live tool-loop coverage (Grok, Muse, Qwen).
69
+
70
+ ## 0.3.0
71
+
72
+ - Browser settings page (`Settings → OpenCode`): key management, quota bars, accounts, model allowlist, per-model transport overrides, connection settings.
73
+ - Sidebar quota card (opt-in) and the center-column quota panel.
74
+ - Host HTTP routes under `/dsh-opencode/*` with same-origin enforcement.
75
+ - Key import from OpenCode's `auth.json` through the credentials seam.
76
+ - Client bundle built as a `window.__ModuleLoader__` module with React externalized.
77
+
78
+ ## 0.2.0
79
+
80
+ - Native Anthropic Messages transport (thinking blocks, signatures, tool use).
81
+ - Native OpenAI Responses transport.
82
+ - Native Google Generative AI transport with `thoughtSignature` replay.
83
+ - Image input on every transport, through `ctx.attachments.readImageRequest`.
84
+ - Multi-account pool with pre-stream 401/403/429 rotation and per-key cooldowns.
85
+ - `/opencode` command with status and quota windows.
86
+ - Reasoning-effort mapping and output caps.
87
+ - Expanded unit tests and live smoke scripts.
88
+
89
+ ## 0.1.0
90
+
91
+ - Initial P1 skeleton.
92
+ - Registers `opencode` and `opencode-go` routes on the dsh `llm` service.
93
+ - OpenAI Chat transport over the Go unified gateway.
94
+ - Stable `x-opencode-session` derived from the durable session id.
95
+ - Key resolution from config, the credential seam, OpenCode `auth.json`, and the launch environment.
96
+ - Live model catalog with a generated `models.dev` fallback.
97
+ - Text, reasoning, streamed tool calls, usage, and classified provider errors.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 dsh-opencode-provider contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-opencode-provider contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE CHANGED
@@ -1,15 +1,15 @@
1
- dsh-opencode-provider
2
- =====================
3
-
4
- This project is an unofficial community integration. It is not affiliated
5
- with OpenCode, Anomaly, or DeepSeek Harness.
6
-
7
- Architectural ideas and wire-contract research were informed by these MIT
8
- projects:
9
-
10
- - dsh-commandcode-provider — https://github.com/Mars-Sea/dsh-commandcode-provider
11
- - dsh-clinebot — https://github.com/GooDAnDReaDY/dsh-clinebot
12
- - opencode2dsh — https://github.com/FishBottle7/opencode2dsh (reference for the
13
- anonymous free-lane header requirements; that bypass is not implemented here)
14
-
15
- Model metadata is generated from https://models.dev.
1
+ dsh-opencode-provider
2
+ =====================
3
+
4
+ This project is an unofficial community integration. It is not affiliated
5
+ with OpenCode, Anomaly, or DeepSeek Harness.
6
+
7
+ Architectural ideas and wire-contract research were informed by these MIT
8
+ projects:
9
+
10
+ - dsh-commandcode-provider — https://github.com/Mars-Sea/dsh-commandcode-provider
11
+ - dsh-clinebot — https://github.com/GooDAnDReaDY/dsh-clinebot
12
+ - opencode2dsh — https://github.com/FishBottle7/opencode2dsh (reference for the
13
+ anonymous free-lane header requirements; that bypass is not implemented here)
14
+
15
+ Model metadata is generated from https://models.dev.
package/README.md CHANGED
@@ -1,4 +1,28 @@
1
- # @goodandready/dsh-opencode-provider
1
+ # 📦 @goodandready/dsh-opencode-provider
2
+
3
+ <div align="center">
4
+
5
+ <h3>OpenCode Console & OpenCode Go LLM Provider for DeepSeek Harness</h3>
6
+
7
+ <p>
8
+ <a href="https://goodandready.app/"><img src="https://img.shields.io/badge/🌐_DSH_Hub-goodandready.app-ff4500.svg?style=for-the-badge&labelColor=1a1a2e" alt="GoodAndReady Showcase"></a>
9
+ <a href="https://www.npmjs.com/package/@goodandready/dsh-opencode-provider"><img src="https://img.shields.io/npm/v/@goodandready/dsh-opencode-provider?style=for-the-badge&color=crimson&logo=npm" alt="npm version"></a>
10
+ <a href="https://github.com/GooDAnDReaDY/dsh-opencode-provider/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" alt="License"></a>
11
+ </p>
12
+
13
+ </div>
14
+
15
+ <table align="center">
16
+ <tr>
17
+ <td align="center">
18
+ ⭐ <strong>If you like this plugin, please star it on GitHub</strong> — it shows me that the plugin is useful to you and motivates me to keep developing it.
19
+ <br><br>
20
+ 🐛 <strong>If you find a bug or would like to request a feature</strong>, open a GitHub issue in any language — I will review your proposal and implement useful suggestions in a future plugin version.
21
+ </td>
22
+ </tr>
23
+ </table>
24
+
25
+ ---
2
26
 
3
27
  OpenCode / OpenCode Go provider plugin for [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) (dsh).
4
28
 
@@ -11,6 +35,42 @@ It registers two native LLM routes:
11
35
 
12
36
  Requests resolve the key per call, so a changed credential reaches the next request without a restart.
13
37
 
38
+ ## Architecture
39
+
40
+ ```mermaid
41
+ graph LR
42
+ subgraph DSH["DeepSeek Harness Core"]
43
+ Agent["DSH Agent / Chat"]
44
+ Creds["Credentials / auth.json"]
45
+ end
46
+
47
+ subgraph Plugin["dsh-opencode-provider"]
48
+ Router{"Route Selector"}
49
+ Pool["Multi-Account Pool<br/>(Auto-Rotation & Cooldowns)"]
50
+ Heatmap["Heatmap & Quota Telemetry<br/>(5h / Week / Month)"]
51
+
52
+ subgraph Transports["4 Wire Transports"]
53
+ T1["OpenAI Chat"]
54
+ T2["Anthropic Messages<br/>(Thinking Signatures)"]
55
+ T3["OpenAI Responses"]
56
+ T4["Google GenAI<br/>(thoughtSignature Replay)"]
57
+ end
58
+ end
59
+
60
+ subgraph OpenCode["OpenCode Gateway"]
61
+ Console["opencode (Console / Zen)"]
62
+ Go["opencode-go (Go / Go Plus)"]
63
+ end
64
+
65
+ Agent --> Router
66
+ Creds -.-> Pool
67
+ Router -->|opencode| Pool
68
+ Router -->|opencode-go| Pool
69
+ Pool --> Heatmap
70
+ Pool --> Transports
71
+ T1 & T2 & T3 & T4 --> Console & Go
72
+ ```
73
+
14
74
  ## What works
15
75
 
16
76
  - **Four wire transports**, chosen per model:
@@ -32,7 +92,6 @@ Requests resolve the key per call, so a changed credential reaches the next requ
32
92
  - **Per-model subscription limits** from the OpenCode Go pricing table: monthly dollar allowance plus estimated requests for the 5-hour, weekly and monthly windows, for both Go and Go Plus. Shown in the model picker and the settings page; estimates only — the gateway remains the authority.
33
93
  - **`/opencode` command** for status, usage, accounts, models, rules, and `test [model]`.
34
94
  - **TUI settings section** for the terminal profile (`/settings → OpenCode`) with the key, endpoints, allowlist, active account and timeouts.
35
- - **Models-page key card** in Settings → Models.
36
95
  - **One-click plugin update** in Settings → OpenCode: current/latest version, an update badge, and an **Update now** button that installs the exact npm version through the DSH CLI and asks for a restart. The host endpoint is `GET/POST /dsh-opencode/update`.
37
96
  - **Plan-aware Go picker**: hides models outside the Go table unless turned off; descriptions carry `Go`, `Console` or `FREE`.
38
97
  - **Request-wide image budget** (newest images win, oldest become an omitted placeholder) and **object-root tool-schema normalization** for MCP/third-party tools.
@@ -59,12 +118,12 @@ npm pack
59
118
  Install the **packed tarball** into a profile:
60
119
 
61
120
  ```bash
62
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.0.tgz
121
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.1.tgz
63
122
  # DSH Desktop:
64
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.0.tgz
123
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.1.tgz
65
124
 
66
125
  # Or install the published package:
67
- dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.0
126
+ dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.1
68
127
  ```
69
128
 
70
129
  Restart dsh (or DSH Desktop), then pick `OpenCode` or `OpenCode Go` in the model picker.
@@ -83,20 +142,19 @@ Tested against DSH Desktop **0.2.1-rc.2**:
83
142
  - the live catalog returned 37 models with prices and Go limits;
84
143
  - quota windows returned `rolling / weekly / monthly`;
85
144
  - `/dsh-opencode/analytics` scanned 7 local sessions (0 OpenCode sessions yet, as expected before the first OpenCode chat);
86
- - `/dsh-opencode/test` against `deepseek-v4.1-flash` returned `{"ok":true,"text":"OK"}`;
145
+ - `/dsh-opencode/test` against the default flash model returned `{"ok":true,"text":"OK"}`;
87
146
  - a second Go account was added, the default key was temporarily replaced with an invalid one, and `/test` rotated to the second account and still returned `OK`;
88
- - the second account was already at ~98% of its monthly allowance; the rotation test pushed it over, so a later run surfaced `QUOTA`, marked the default as `invalid-credential` and `Go #2` as `quota` until its reset (22 Oct 08:21), with no active account;
89
- - per-account usage returned `default` 1% / 5% / 2% and `Go #2` 9% / 4% / **100%** monthly (`rate-limited`, reset 22 Oct 08:21), so the exhausted account is visible without a failed request;
147
+ - the second account was already at ~98% of its monthly allowance; the rotation test pushed it over, so a later run surfaced `QUOTA`, marked the default as `invalid-credential` and `Go #2` as `quota` until its reset, with no active account;
148
+ - per-account usage returned `default` 1% / 5% / 2% and `Go #2` 9% / 4% / **100%** monthly (`rate-limited`), so the exhausted account is visible without a failed request;
90
149
  - two `/test` requests produced `Tue 13:00 = 2` in the heatmap and two lines in `requests.jsonl`; the 24-hour strip shows the same value at 13:00;
91
- - a third request with `minimax-m3.1-flash-free` added a second per-model series (`deepseek-v4.1-flash` 2, `minimax-m3.1-flash-free` 1), so the model selector is populated;
92
- - after restarting Desktop, `Go #2` still showed its persisted `quota` cooldown (until 22 Oct 08:21) while the restored default key was active;
150
+ - a third request with a free-tier model added a second per-model series, so the model selector is populated;
151
+ - after restarting Desktop, `Go #2` still showed its persisted `quota` cooldown while the restored default key was active;
93
152
  - setting `*free* → Go #2` through `/config` returned the normalized rule from `/state`, and clearing it returned `[]`; the account list stayed unchanged;
94
- - the redesigned sidebar card was checked in Desktop: `OpenCode Go` with a 5% ring, `5-Hour Window 99% remaining · 3h`, `Weekly Window 95% remaining · 6d`, `Monthly Window 98% remaining · 29d`; it uses the DSH theme variables and matches the clinebot meter's row/ring layout;
95
- - a real chat produced two OpenCode sessions: `deepseek-v4.1-flash` (4105 in / 243 out, ≈$0.00079) and `beam-free` (10670 in / 171 out, Free); the heatmap counted 6 main requests (the two title calls and exact duplicates are filtered);
153
+ - the redesigned sidebar card was checked in Desktop: `OpenCode Go` with a 5% ring, `5-Hour Window 99% remaining · 3h`, `Weekly Window 95% remaining · 6d`, `Monthly Window 98% remaining · 29d`; it uses the DSH theme variables and matches the meter's row/ring layout;
154
+ - a real chat produced two OpenCode sessions: one standard flash model (4105 in / 243 out, ≈$0.00079) and one free model (10670 in / 171 out, Free); the heatmap counted 6 main requests (the two title calls and exact duplicates are filtered);
96
155
  - the renderer loaded the client bundle (`settings.opencode` is present in its code cache).
97
156
 
98
- Open **Settings → OpenCode** and enable *Show the quota card in the sidebar* if you want the
99
- sidebar meter.
157
+ Open **Settings → OpenCode** and enable *Show the quota card in the sidebar* if you want the sidebar meter.
100
158
 
101
159
  ## Configure
102
160
 
@@ -111,7 +169,7 @@ sidebar meter.
111
169
  streamIdleTimeoutMs: 300000
112
170
  visibleModels: []
113
171
  modelTransports: {}
114
- # contextWindowOverrides: { deepseek-v4-pro: 65536 }
172
+ # contextWindowOverrides: { model-id: 65536 }
115
173
  # maxOutputTokens: 32768
116
174
  accounts:
117
175
  - label: Go #2
@@ -150,7 +208,7 @@ Configure them in **Settings → OpenCode → Model → account rules**, or in Y
150
208
  modelAccountRules:
151
209
  - pattern: "*free*"
152
210
  account: "free"
153
- - pattern: "deepseek-*"
211
+ - pattern: "your-provider-*"
154
212
  account: "go"
155
213
  ```
156
214
 
@@ -199,19 +257,7 @@ Captured from the exact 0.5.0 release candidate in DSH Desktop in the dark theme
199
257
  /opencode accounts # labels, source, active/cooling, 5h/wk/mo
200
258
  /opencode models # ids, FREE/Go limits
201
259
  /opencode rules # model → account rules
202
- /opencode test [model] # minimal real request (default deepseek-v4.1-flash)
203
- ```
204
-
205
- Example:
206
-
207
- ```
208
- OpenCode provider
209
- - opencode-go: 1 account(s) · auth.json:opencode-go
210
- - opencode: 1 account(s) · auth.json:opencode-go
211
- 5h : [░░░░░░░░░░] 1% · resets 2026-10-19 22:05Z
212
- weekly : [░░░░░░░░░░] 1% · resets 2026-10-26 00:00Z
213
- monthly: [░░░░░░░░░░] 0% · resets 2026-11-18 13:38Z
214
- Auth: opencode-go · OPENCODE_API_KEY
260
+ /opencode test [model] # minimal real request
215
261
  ```
216
262
 
217
263
  ## Verified API facts
@@ -219,8 +265,8 @@ Auth: opencode-go · OPENCODE_API_KEY
219
265
  - `GET /inference/go/v1/models` is public and returns the live Go roster.
220
266
  - `GET /zen/go/v1/usage` returns `rolling` (5h), `weekly`, `monthly` with `percent` and `resetsAt`. It is undocumented; the plugin treats it as fail-open.
221
267
  - The unified `POST /zen/go/v1/chat/completions` accepts OpenAI-compatible **and** Anthropic-backed models, but **not** Responses-only or Google models.
222
- - Responses-only models (GPT, Grok, Muse) and Gemini need their native endpoints, which the plugin uses.
223
- - Gemini 4 requires replaying `thoughtSignature` on historical function calls; the Google transport stores it in dsh's replay state.
268
+ - Responses-only models and Gemini need their native endpoints, which the plugin uses.
269
+ - Gemini requires replaying `thoughtSignature` on historical function calls; the Google transport stores it in dsh's replay state.
224
270
  - `x-opencode-session` is mandatory. A stable opaque value is enough for a Go key; the canonical `ses_*` shape and CLI impersonation are only needed for the anonymous free lane, which this plugin deliberately does not implement.
225
271
  - Free-tier anonymous keys are rejected with `403 FreeTierError`; free models work normally with an active Go subscription.
226
272
 
@@ -237,20 +283,6 @@ npm run sync:models # regenerate src/models.generated.ts from models.dev
237
283
 
238
284
  GitHub Actions runs `npm run check` and `npm pack` on push/PR (`.github/workflows/ci.yml`).
239
285
 
240
- Live smoke scripts (read your Go key from `auth.json`; no key is stored):
241
-
242
- ```bash
243
- node scripts/smoke.mjs # OpenAI Chat text/reasoning/usage
244
- node scripts/smoke-tools.mjs # OpenAI Chat tool call
245
- node scripts/smoke-transports.mjs # all four transports, text
246
- node scripts/smoke-transport-tools.mjs # all four transports, tool call
247
- node scripts/smoke-tool-loop.mjs # full tool loop, including Gemini replay
248
- node scripts/smoke-images.mjs # vision on all four transports
249
- node scripts/smoke-rotation.mjs # invalid key → valid key rotation
250
- node scripts/smoke-command.mjs # /opencode output
251
- node scripts/smoke-client.mjs # client bundle loader + slot registration
252
- ```
253
-
254
286
  ## Limitations
255
287
 
256
288
  - Verbatim file attachments are not forwarded yet; images are.
@@ -266,4 +298,5 @@ node scripts/smoke-client.mjs # client bundle loader + slot registratio
266
298
 
267
299
  ## License
268
300
 
269
- MIT. See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
301
+ MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY). See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
302
+