@goodandready/dsh-opencode-provider 0.5.0 → 0.5.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/CHANGELOG.md +107 -93
- package/LICENSE +21 -21
- package/NOTICE +15 -15
- package/README.md +307 -269
- package/README.ru.md +208 -87
- package/README.zh.md +184 -87
- package/cordis.patch.yml +11 -11
- package/lib/client.js +223 -99
- package/lib/index.d.ts +31 -1
- package/lib/index.js +188 -32
- package/package.json +122 -125
package/CHANGELOG.md
CHANGED
|
@@ -1,93 +1,107 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 0.5.
|
|
4
|
-
|
|
5
|
-
- **
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- **
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- TUI settings
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
## 0.
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
## 0.
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.5.2
|
|
4
|
+
|
|
5
|
+
- **Quota fallback**: choose a free model in Settings → OpenCode. A Go quota rejection retries the same request once on Console/Zen with that model; failures surface the original quota error.
|
|
6
|
+
- **Sticky account**: the last successful account is preferred for the same conversation; explicit model rules, pinned accounts, and quota fallback still win.
|
|
7
|
+
- **Routing trace**: the quota panel shows recent account/model choices (`rule`, `sticky`, `rotation`, `quota-fallback`) without prompts or keys.
|
|
8
|
+
- **Per-account heatmap**: the request log records the account label, and the heatmap can be filtered by account.
|
|
9
|
+
- **File attachments** are projected to DSH handle text instead of failing; **tool-result images** are inline on Anthropic, OpenAI Responses and Google (OpenAI Chat keeps a placeholder).
|
|
10
|
+
- **Account onboarding**: import every OpenCode `auth.json` key into its own credential ref and add matching accounts; **Check all accounts** refreshes quota and health per account.
|
|
11
|
+
- TUI exposes `quotaFallbackModel` and `stickySession`; 82 tests.
|
|
12
|
+
|
|
13
|
+
## 0.5.1
|
|
14
|
+
|
|
15
|
+
- 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.
|
|
16
|
+
|
|
17
|
+
## 0.5.0
|
|
18
|
+
|
|
19
|
+
- **Parity release**: TUI settings section, plan-aware Go picker, request-wide image budget and tool-schema normalization.
|
|
20
|
+
- Package identity is now scoped: `@goodandready/dsh-opencode-provider` (unscoped npm name belongs to an unrelated package).
|
|
21
|
+
- Custom composer cost pill and custom analytics cost columns removed; cost is shown only by DSH's native display.
|
|
22
|
+
- One-click plugin update in Settings → OpenCode: registry status, badge, exact `dsh plugin add`, restart notice, loopback/same-origin POST guard.
|
|
23
|
+
- English, Chinese and Russian READMEs and a visual-verification asset ship in the package and GitHub tree.
|
|
24
|
+
- **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.
|
|
25
|
+
- **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.
|
|
26
|
+
- **Test connection** button in the key card: pick a model, run a minimal real request, see latency and the reply.
|
|
27
|
+
- `POST /dsh-opencode/test` Host route with a 60-second budget.
|
|
28
|
+
- Sidebar quota bars now change color at 75% (warning) and 90% (critical).
|
|
29
|
+
- 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.
|
|
30
|
+
- Analytics no longer fabricates `100%` success / `0` errors; the local projection returns `null` and the UI shows `—`.
|
|
31
|
+
- Go plan filtering now fails open for models that exist only in the live catalog; known Console models stay hidden.
|
|
32
|
+
- Tool truncation at the 128-item provider limit logs a one-time warning instead of failing silently.
|
|
33
|
+
- TUI settings refresh after `/config` account changes; analytics requests have an error state and a generation guard against the 7/30/90 race.
|
|
34
|
+
- Projection analytics reads run with bounded parallelism; `.commandcode/` is ignored; provider registration logs at boot.
|
|
35
|
+
- Tool-result images are replaced with an offload placeholder instead of failing the whole request in every transport.
|
|
36
|
+
- Core harness tools (`read`, `write`, `edit`, `bash`, `glob`, `grep`, …) survive the 128-tool cap even when a large MCP set is present.
|
|
37
|
+
- `GET /dsh-opencode/health` reports provider registration, account count and model count for startup diagnostics.
|
|
38
|
+
- The TUI settings section polls live config, so accounts/allowlist changes made from the terminal refresh without a restart.
|
|
39
|
+
- 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.
|
|
40
|
+
- Tests grew to 84, including TUI polling, health, core-tool preservation and tool-result image placeholders.
|
|
41
|
+
- Rotation now also triggers on quota/usage-limit bodies (400/402/403/429), with a 10-minute or `Retry-After` cooldown for quota rejections.
|
|
42
|
+
- 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.
|
|
43
|
+
- 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.
|
|
44
|
+
- 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`.
|
|
45
|
+
- 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.
|
|
46
|
+
- 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.
|
|
47
|
+
- 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.
|
|
48
|
+
- 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.
|
|
49
|
+
- 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.
|
|
50
|
+
- 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.
|
|
51
|
+
- 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**.
|
|
52
|
+
- 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)`).
|
|
53
|
+
- `/opencode` gained `accounts`, `models`, `rules` and `test [model]`; `status` now includes per-account quotas and rules.
|
|
54
|
+
- 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).
|
|
55
|
+
- 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.
|
|
56
|
+
- `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.
|
|
57
|
+
- 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).
|
|
58
|
+
|
|
59
|
+
## 0.4.1
|
|
60
|
+
|
|
61
|
+
- Accounts card can set each account's key from the page; unconfigured accounts are listed with a missing-key badge.
|
|
62
|
+
- Live catalog refresh button (`POST /dsh-opencode/models/refresh`).
|
|
63
|
+
- Quota warning banners at 80% and 95% in the settings page.
|
|
64
|
+
- Expandable subscription-limits table: per model, Go and Go Plus monthly allowance plus 5h/week/month request estimates.
|
|
65
|
+
|
|
66
|
+
## 0.4.0
|
|
67
|
+
|
|
68
|
+
- 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.
|
|
69
|
+
- Limits appear in the model picker description and as a badge in the settings model list; hovering shows both plans.
|
|
70
|
+
- Added `src/subscription-limits.ts` with the official table and formatting helpers.
|
|
71
|
+
- Tests: limits table integrity, formatting, and route-gated model descriptions.
|
|
72
|
+
|
|
73
|
+
## 0.3.1
|
|
74
|
+
|
|
75
|
+
- Composer session-cost estimate (`≈`/`≥`/`Free`) from the generated price snapshot and the `tokenUsage`/`modelSelection` projections.
|
|
76
|
+
- Model price badges in the settings page; model picker descriptions now include per-1M input/output rates.
|
|
77
|
+
- OpenCode auth-entry autocomplete from the entries actually present in `auth.json`.
|
|
78
|
+
- Broadened live tool-loop coverage (Grok, Muse, Qwen).
|
|
79
|
+
|
|
80
|
+
## 0.3.0
|
|
81
|
+
|
|
82
|
+
- Browser settings page (`Settings → OpenCode`): key management, quota bars, accounts, model allowlist, per-model transport overrides, connection settings.
|
|
83
|
+
- Sidebar quota card (opt-in) and the center-column quota panel.
|
|
84
|
+
- Host HTTP routes under `/dsh-opencode/*` with same-origin enforcement.
|
|
85
|
+
- Key import from OpenCode's `auth.json` through the credentials seam.
|
|
86
|
+
- Client bundle built as a `window.__ModuleLoader__` module with React externalized.
|
|
87
|
+
|
|
88
|
+
## 0.2.0
|
|
89
|
+
|
|
90
|
+
- Native Anthropic Messages transport (thinking blocks, signatures, tool use).
|
|
91
|
+
- Native OpenAI Responses transport.
|
|
92
|
+
- Native Google Generative AI transport with `thoughtSignature` replay.
|
|
93
|
+
- Image input on every transport, through `ctx.attachments.readImageRequest`.
|
|
94
|
+
- Multi-account pool with pre-stream 401/403/429 rotation and per-key cooldowns.
|
|
95
|
+
- `/opencode` command with status and quota windows.
|
|
96
|
+
- Reasoning-effort mapping and output caps.
|
|
97
|
+
- Expanded unit tests and live smoke scripts.
|
|
98
|
+
|
|
99
|
+
## 0.1.0
|
|
100
|
+
|
|
101
|
+
- Initial P1 skeleton.
|
|
102
|
+
- Registers `opencode` and `opencode-go` routes on the dsh `llm` service.
|
|
103
|
+
- OpenAI Chat transport over the Go unified gateway.
|
|
104
|
+
- Stable `x-opencode-session` derived from the durable session id.
|
|
105
|
+
- Key resolution from config, the credential seam, OpenCode `auth.json`, and the launch environment.
|
|
106
|
+
- Live model catalog with a generated `models.dev` fallback.
|
|
107
|
+
- 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.
|