dsh-opencode-go 0.1.24 → 0.2.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.
Files changed (102) hide show
  1. package/README.en.md +66 -12
  2. package/README.md +172 -79
  3. package/THIRD_PARTY_NOTICES.md +6 -2
  4. package/assets/icon.png +0 -0
  5. package/docs/advanced.en.md +32 -35
  6. package/docs/advanced.md +33 -35
  7. package/docs/assets/logo-dark.png +0 -0
  8. package/docs/assets/logo-light.png +0 -0
  9. package/docs/assets/usage-history-desktop.jpg +0 -0
  10. package/docs/assets/usage-history-mobile.jpg +0 -0
  11. package/docs/assets/usage-history-models.jpg +0 -0
  12. package/docs/development.md +61 -119
  13. package/docs/independent-package.md +4 -2
  14. package/docs/usage-analytics.en.md +57 -0
  15. package/docs/usage-analytics.md +57 -0
  16. package/docs/verification.md +51 -917
  17. package/lib/build-info.json +1 -1
  18. package/lib/client.js +3429 -2618
  19. package/lib/free-http-worker.js +32 -0
  20. package/lib/index.js +5135 -3746
  21. package/lib/types/accounts.d.ts +96 -31
  22. package/lib/types/adapter.d.ts +63 -51
  23. package/lib/types/analytics.d.ts +35 -0
  24. package/lib/types/catalog.d.ts +109 -44
  25. package/lib/types/client/AnalyticsDialog.d.ts +18 -0
  26. package/lib/types/client/Section.d.ts +41 -7
  27. package/lib/types/client/UsagePill.d.ts +15 -6
  28. package/lib/types/client/controller.d.ts +178 -0
  29. package/lib/types/client/dashboard-copy.d.ts +58 -0
  30. package/lib/types/client/index.d.ts +18 -12
  31. package/lib/types/client/{locales.d.ts → presentation.d.ts} +97 -9
  32. package/lib/types/config.d.ts +14 -15
  33. package/lib/types/contracts.d.ts +338 -0
  34. package/lib/types/conversion.d.ts +155 -0
  35. package/lib/types/free-channel.d.ts +21 -0
  36. package/lib/types/free-http-worker.d.ts +1 -0
  37. package/lib/types/free-policy.d.ts +4 -0
  38. package/lib/types/free-protocol.d.ts +16 -0
  39. package/lib/types/free-runtime.d.ts +2 -0
  40. package/lib/types/free-socks-tunnel.d.ts +4 -0
  41. package/lib/types/free-transport.d.ts +19 -0
  42. package/lib/types/index.d.ts +8 -40
  43. package/lib/types/pricing.d.ts +29 -0
  44. package/lib/types/sdk-types.d.ts +1540 -2902
  45. package/lib/types/transport.d.ts +71 -0
  46. package/lib/vendor-licenses.txt +55 -31
  47. package/package.json +77 -78
  48. package/docs/assets/usage-panel.png +0 -0
  49. package/docs/fork-review-2026-09-25.md +0 -191
  50. package/docs/native-call-comparison-v020-rc2.md +0 -116
  51. package/lib/types/account-manager.d.ts +0 -25
  52. package/lib/types/account-operations.d.ts +0 -31
  53. package/lib/types/account-policy.d.ts +0 -16
  54. package/lib/types/account-recovery.d.ts +0 -2
  55. package/lib/types/account-selection.d.ts +0 -30
  56. package/lib/types/account-service.d.ts +0 -12
  57. package/lib/types/accounts-contract.d.ts +0 -38
  58. package/lib/types/call-trace.d.ts +0 -54
  59. package/lib/types/catalog-manager.d.ts +0 -20
  60. package/lib/types/client/AccountsCard.d.ts +0 -19
  61. package/lib/types/client/ModelEditor.d.ts +0 -20
  62. package/lib/types/client/accounts-controller.d.ts +0 -71
  63. package/lib/types/client/hint-mark.d.ts +0 -17
  64. package/lib/types/client/host-compat.d.ts +0 -7
  65. package/lib/types/client/host-primitives.d.ts +0 -11
  66. package/lib/types/client/section-controller.d.ts +0 -202
  67. package/lib/types/client/settings.d.ts +0 -18
  68. package/lib/types/client/staged-form.d.ts +0 -201
  69. package/lib/types/client/usage.d.ts +0 -4
  70. package/lib/types/config-contract.d.ts +0 -70
  71. package/lib/types/conversion/config.d.ts +0 -4
  72. package/lib/types/conversion/context.d.ts +0 -56
  73. package/lib/types/conversion/image-offload.d.ts +0 -13
  74. package/lib/types/conversion/image-pool.d.ts +0 -24
  75. package/lib/types/conversion/index.d.ts +0 -5
  76. package/lib/types/conversion/replay.d.ts +0 -66
  77. package/lib/types/conversion/stream.d.ts +0 -44
  78. package/lib/types/gateway-diagnostics.d.ts +0 -23
  79. package/lib/types/gateway-error.d.ts +0 -2
  80. package/lib/types/gateway-url.d.ts +0 -6
  81. package/lib/types/google-fetch.d.ts +0 -6
  82. package/lib/types/host-settings.d.ts +0 -11
  83. package/lib/types/json-response.d.ts +0 -14
  84. package/lib/types/metadata-cache.d.ts +0 -12
  85. package/lib/types/model-metadata.d.ts +0 -21
  86. package/lib/types/models-contract.d.ts +0 -66
  87. package/lib/types/models.d.ts +0 -13
  88. package/lib/types/protocol-contract.d.ts +0 -5
  89. package/lib/types/protocol-policy.d.ts +0 -4
  90. package/lib/types/provider-identity.d.ts +0 -4
  91. package/lib/types/proxy-url.d.ts +0 -2
  92. package/lib/types/proxy.d.ts +0 -11
  93. package/lib/types/reasoning.d.ts +0 -40
  94. package/lib/types/remote-contract.d.ts +0 -3
  95. package/lib/types/remotes.d.ts +0 -3
  96. package/lib/types/request-budget.d.ts +0 -12
  97. package/lib/types/request-control.d.ts +0 -2
  98. package/lib/types/settings-bridge.d.ts +0 -22
  99. package/lib/types/usage-contract.d.ts +0 -35
  100. package/lib/types/usage-display.d.ts +0 -4
  101. package/lib/types/usage.d.ts +0 -27
  102. /package/lib/types/{google-generative-ai.d.ts → google.d.ts} +0 -0
package/README.en.md CHANGED
@@ -1,11 +1,22 @@
1
- # dsh-opencode-go
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/logo-dark.png">
4
+ <img src="docs/assets/logo-light.png" alt="DSH-OCGO" width="480">
5
+ </picture>
6
+ </p>
2
7
 
3
- [简体中文](README.md)
8
+ <h1 align="center">dsh-opencode-go</h1>
9
+
10
+ <p align="center">
11
+ <a href="README.md">简体中文</a>
12
+ </p>
4
13
 
5
14
  **OpenCode Go subscription usage and multiple-account management** for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), with convenient access to quotas, reset times, and account switching.
6
15
 
7
16
  DSH already supports OpenCode Go natively. This plugin focuses on usage inside conversations, managing multiple accounts, and dedicated model and settings controls.
8
17
 
18
+ - **Independent Go and Free routes**: dynamically discover each gateway’s chat models, keep overlapping IDs, and edit them in separate settings tabs. Free shares saved keys and uses public access when none is usable.
19
+ - **Free rate-limit protection**: honors upstream `Retry-After` and pauses new requests during cooldown. Shared Free quota/IP limits do not rotate Go accounts.
9
20
  - **Usage at a glance**: see usage beside the conversation input, then open the panel for five-hour, weekly, and monthly percentages and reset times.
10
21
  - **Accounts in one place**: inspect each account's quota and key status, drag to reorder, switch inside a conversation, or enable automatic fallback.
11
22
  - **Clearer model and settings controls**: search and filter models, adjust visibility, limits, and thinking budgets; advanced settings are grouped by purpose, with hints and a reset action.
@@ -16,8 +27,6 @@ Supports Chinese and English, following DSH's interface language. The screenshot
16
27
 
17
28
  Click the usage pill beside the conversation input to open the current account's subscription usage. Bars show the **percentage used**, turn amber near the limit, and red when exhausted. Each quota window shows its reset time.
18
29
 
19
- ![Subscription usage: current account, three quota windows, and reset times](docs/assets/usage-panel.png)
20
-
21
30
  While visible, usage refreshes every minute. Periodic queries pause while the page is hidden and resume with a refresh when it becomes visible. Temporary failures show a warning; retained readings are marked as previous data. Click **Retry now** after a failure, or **Refresh accounts** in the Settings account card.
22
31
 
23
32
  Under **Settings → OpenCode Go → Advanced settings → Usage display**, choose:
@@ -28,6 +37,22 @@ Under **Settings → OpenCode Go → Advanced settings → Usage display**, choo
28
37
  | Always | Also show configured OpenCode Go account usage while using other models |
29
38
  | Off | Hide the conversation pill and stop its polling |
30
39
 
40
+ ## Usage analytics
41
+
42
+ Open the dashboard from the conversation input's expanded usage pill or the sidebar dashboard button.
43
+
44
+ ![Official workspace history dashboard with sample data](docs/assets/usage-history-desktop.jpg)
45
+
46
+ [Narrow-screen light preview](docs/assets/usage-history-mobile.jpg) · [Model rankings and detail](docs/assets/usage-history-models.jpg), both using sample data.
47
+
48
+ - **One official source**: totals, daily charts and model detail use the same official daily CSV, covering requests, input/output/cache tokens and the official usage amount. Models are grouped by provider + model. Ranges are today, 7, 30 and 90 days; all dates use UTC.
49
+ - **Independent viewing account**: defaults to the current inference account and shows only the workspace belonging to the selected key, including calls from other clients. Changing the viewing account does not change the conversation account. All three dashboard quota windows follow the selection. Anonymous Free coverage is not guaranteed.
50
+ - **Official usage amount**: sums `cost_micro_cents` directly (`1 USD = 100,000,000` units); it does not mean an additional Go charge. Official daily aggregates may be delayed.
51
+ - **One visual language**: settings, the usage pill, sidebar and dashboard share warm paper / charcoal surfaces and terracotta accents, following the Host's light/dark mode. Locally installed Anthropic Serif / Sans / Mono fonts are preferred, with system and CJK serif fallbacks. The dashboard becomes full-screen on narrow screens and retains daily token/request bars, model rankings and details.
52
+ - **On-demand queries**: history loads when opening, changing account or range, or refreshing manually. The Host uses a 30-second cache; forced refresh bypasses it. History is not polled in the background. Only official model gateway configurations support it; errors remain explicit without falling back to local scans.
53
+
54
+ Keys stay on the Host. Normal reports send the browser only aggregate numbers and provider / model / day; an official CSV explicitly downloaded by the user may contain member fields. See [usage analytics notes](docs/usage-analytics.en.md) for accounting and privacy details.
55
+
31
56
  ## Manage multiple accounts
32
57
 
33
58
  Open **Settings → OpenCode Go → Accounts** to manage accounts:
@@ -39,13 +64,15 @@ Open **Settings → OpenCode Go → Accounts** to manage accounts:
39
64
  - Drag a row's handle to reorder accounts. The first row becomes current, and the order determines automatic fallback priority.
40
65
  - Click **Switch** in the conversation usage panel to move the selected account first for subsequent requests in this profile. The other accounts keep their relative order.
41
66
 
42
- With **Automatic fallback** enabled, an exhausted quota or unusable key causes the plugin to try other accounts in order before output begins. A fallback account that starts producing output moves first and becomes current, and the usage panel shows a switch notice. Requests that have already produced output, recorded token usage, or been canceled are not automatically resent through another account.
67
+ With **Automatic fallback** enabled, HTTP 401/403/429 or exhausted quota causes the plugin to try other accounts in order before output begins. A fallback account that starts producing output moves first and becomes current, and the usage panel shows a switch notice. Requests that have already produced output, recorded token usage, or been canceled are not automatically resent through another account.
68
+
69
+ Gateway-rejected keys cool down in memory for five minutes. Account commands write credentials and settings through one serial host queue.
43
70
 
44
71
  Keys are saved through DSH's credential service. Settings never displays an already saved key.
45
72
 
46
73
  ## Install and get started
47
74
 
48
- Requires DSH `0.1.5-rc.1` or later. See the [compatibility matrix](docs/development.md#installed-package-matrix) for verified host versions.
75
+ Requires DSH `0.2.1-rc.5` or later. See [development](docs/development.md) for the current validation workflow.
49
76
 
50
77
  ### Install from DSH
51
78
 
@@ -71,7 +98,7 @@ Start or restart `dsh web` after command-line installation. Web and Headless use
71
98
 
72
99
  ### Get started
73
100
 
74
- 1. Open **Settings → OpenCode Go**, enter your OpenCode Go subscription API key and save, or add an account in **Accounts**.
101
+ 1. Open **Settings → OpenCode Go → Accounts**, click **Add account**, enter a name and your OpenCode Go subscription API key, and confirm.
75
102
  2. Select a model under **DSH OpenCode Go** in the conversation model picker.
76
103
  3. Start chatting and check usage beside the input. With multiple accounts, open the panel to switch.
77
104
 
@@ -89,19 +116,19 @@ Search **Available models** by name or ID, or filter by **New in 7 days**, **Cus
89
116
  - Select a model to inspect its catalog context window, maximum output, and input modalities. Save limit overrides to apply them; empty values use defaults.
90
117
  - Reasoning models offer the applicable switch, effort, or token budget options. Budget-based models also accept custom budgets that become available after saving.
91
118
 
92
- Requests to `deepseek-v4.1-flash` default to a **64k (65,536-token)** output allowance, bounded by the model's output capacity. The same default is reported to DSH for compaction budgeting. This rule applies only to that model; other models retain their SDK output defaults. Set a model's **Max output** override when a longer answer is needed.
119
+ Any model with an output capacity above **65,536 tokens** defaults to that allowance when neither the caller nor settings specifies one. Smaller models retain their SDK defaults. DSH receives the same allowance for compaction budgeting. Set a model’s **Max output** override when a longer answer is needed.
93
120
 
94
121
  Streaming, reasoning, tool calls, and image input depend on model capabilities. Input modalities shown in Settings come from online model metadata; this plugin currently converts and forwards only image attachments.
95
122
 
96
123
  ### Grouped advanced settings
97
124
 
98
- Advanced settings are grouped into **Usage and protocol**, **Connection**, **Cache and timeouts**, and **Image handling**. Hover over a question mark for help. **Reset all to defaults** clears the card's custom overrides; save to apply the reset. The current account selection is preserved.
125
+ Advanced settings are grouped into **Usage settings**, **Connection**, **Cache and timeouts**, and **Image handling**. Hover over a question mark for help. **Reset all to defaults** clears the card's custom overrides; save to apply the reset. The current account selection is preserved.
99
126
 
100
127
  ![Advanced settings: grouped controls, hints, and a shared reset action](docs/assets/advanced-settings.png)
101
128
 
102
129
  HTTP, HTTPS, and SOCKS5 proxies are supported. After saving, subsequent conversations, catalog updates, and usage queries use the proxy. Connections originate from the machine running DSH; on a remote deployment, `127.0.0.1` refers to that server.
103
130
 
104
- The DeepSeek V4.1 Flash Responses option is experimental, applies only to new requests, and does not promise lower latency. See the [advanced guide](docs/advanced.en.md) for full configuration and usage instructions.
131
+ Set `baseURL` and `freeBaseURL` independently under Connection. Protocol selection follows the gateway model declaration. See the [advanced guide](docs/advanced.en.md) for account, model-key and disk-cache details.
105
132
 
106
133
  Screenshots illustrate the interface. Actual models, quotas, and timestamps depend on your account and the current online catalog.
107
134
 
@@ -117,13 +144,13 @@ Restart `dsh web` and reload the page afterward. For desktop DSH, quit and reope
117
144
 
118
145
  **Why is usage hidden?** Auto mode shows it only for **DSH OpenCode Go** models. Check that the plugin is enabled, a key is configured, and the display mode is appropriate. Choose Always to show usage with other providers.
119
146
 
120
- **What if usage queries or account additions fail?** Retry in the usage panel or refresh usage in the account card. An added account whose key was not saved can be repaired with a key or removed. See [account operations and saving](docs/advanced.en.md#account-operations-and-saving) for recovery behavior.
147
+ **What if usage queries or account additions fail?** Retry in the usage panel or refresh usage in the account card. Account actions run in a serial host queue; unsuccessful operations can be retried. See [account operations and saving](docs/advanced.en.md#account-operations-and-saving).
121
148
 
122
149
  **What if a long conversation keeps returning 400?** Check the output allowance and context window in the error, then run `/compact` or lower that model's **Max output** before retrying. Explicit context overflow is passed to DSH's recovery mechanism; an unexplained 400 keeps its classification and includes troubleshooting guidance. Failed attempts without measured tokens omit zero usage so they do not report an empty context.
123
150
 
124
151
  **Why does an old conversation need its model selected again?** 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`.
125
152
 
126
- **Which hosts are verified?** Installed compatibility covers ten host versions from `0.1.5-rc.1` through `0.2.1-alpha.1`. Later versions need verification. Developer messages, dynamic tool additions/removals, and deferred tool loading are explicitly rejected; see [development and compatibility](docs/development.md).
153
+ **Which host is targeted?** The development baseline is DSH `0.2.1-rc.5`. Developer messages, dynamic tool additions/removals, and deferred tool loading are explicitly rejected; see [development and testing](docs/development.md).
127
154
 
128
155
  Uninstall:
129
156
 
@@ -131,9 +158,36 @@ Uninstall:
131
158
  dsh plugin --profile web remove dsh-opencode-go
132
159
  ```
133
160
 
161
+ ## Architecture and verification
162
+
163
+ The source is organized by domain:
164
+
165
+ | Domain | Modules |
166
+ | --- | --- |
167
+ | Plugin composition, settings and contracts | `index.ts`, `config.ts`, `contracts.ts` |
168
+ | Requests, model catalog and protocol conversion | `adapter.ts`, `catalog.ts`, `conversion.ts`, `google.ts`, `sdk-types.ts` |
169
+ | Accounts, official quota, official CSV history and transport | `accounts.ts`, `analytics.ts`, `transport.ts` |
170
+ | Browser registration and typed state | `client/index.ts`, `client/controller.ts` |
171
+ | Host settings, account/model controls, usage and copy | `client/Section.tsx`, `client/UsagePill.tsx`, `client/AnalyticsDialog.tsx`, `client/presentation.ts` |
172
+
173
+ The browser uses DSH's `configForms`; capacities remain typed objects while editing. Images use per-request count and encoded-byte budgets, with at most four preparations per request. The package keeps its `.` and `./client` exports. Development dependencies pin DSH `0.2.1-rc.5` and Cordis `4.0.5`; runtime Cordis requires `~4.0.5`.
174
+
175
+ Use Node.js `^22.19.0 || >=24.0.0`:
176
+
177
+ ```sh
178
+ npm ci
179
+ npm test
180
+ npm run typecheck
181
+ npm run check:dist
182
+ npm run verify
183
+ ```
184
+
185
+ Tests cover host services, accounts, catalog, protocols, analytics, transport, Free backoff, and browser interactions. After changing source, run `npm run compile` to rebuild `lib/`. `verify` runs type checks, artifact comparison, the full test suite and the package-loading smoke. See [development](docs/development.md) for separate installed-consumer and Headless checks.
186
+
134
187
  ## More documentation
135
188
 
136
189
  - [Advanced guide: Headless, proxies, manual configuration, and error diagnostics](docs/advanced.en.md)
190
+ - [Usage analytics: official source, accounting, and privacy](docs/usage-analytics.en.md)
137
191
  - [Development and testing](docs/development.md)
138
192
  - [Verification notes](docs/verification.md)
139
193
  - [Issues and suggestions](https://github.com/Duskriver/dsh-opencode-go/issues)
package/README.md CHANGED
@@ -1,140 +1,233 @@
1
- # dsh-opencode-go
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/logo-dark.png">
4
+ <img src="docs/assets/logo-light.png" alt="DSH-OCGO" width="480">
5
+ </picture>
6
+ </p>
2
7
 
3
- [English](README.en.md)
8
+ <h1 align="center">dsh-opencode-go</h1>
4
9
 
5
- 为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 提供 **OpenCode Go 订阅用量查看与多账号管理**,让额度、重置时间和账号切换更方便。
10
+ <p align="center">
11
+ <a href="README.en.md">English</a> · <a href="#常见问题-faq">常见问题</a> · <a href="docs/advanced.md">高级指南</a> · <a href="docs/development.md">开发与测试</a>
12
+ </p>
6
13
 
7
- DSH 已支持原生接入 OpenCode Go。本插件重点提供会话内用量查看、多账号管理,以及独立的模型与设置界面。
14
+ 为 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 量身打造的 **OpenCode Go 专属接入与多账号管理插件**。
8
15
 
9
- - **用量随手可查**:在会话输入区查看用量,展开查看 5 小时、每周、每月已用百分比与重置时间。
10
- - **多个账号集中管理**:查看各账号额度和 Key 状态,拖动排序,在会话中手动切换,也可开启自动使用备用账号。
11
- - **模型与设置更直观**:搜索和筛选模型,调整显示、容量与思考预算;高级设置按用途分组,提供提示与恢复默认操作。
16
+ DSH 原生支持接入 OpenCode Go,但原生模式无法满足复杂的生产与日常开发需求(如多账号无感容灾、会话级 Prompt 缓存绑定、会话内实时额度透视等)。本插件基于 Cordis 微内核架构,在提供完整模型协议转换的同时,带来了流畅的客户端 UI 与企业级容灾体验。
12
17
 
13
- 支持中文和英文,跟随 DSH 的界面语言。
18
+ ---
14
19
 
15
- ## 查看订阅用量
20
+ ## ✨ 核心特性
16
21
 
17
- 点击会话输入区旁的用量胶囊,展开当前账号的订阅用量。进度条显示**已用百分比**,接近上限时变为黄色,耗尽时变为红色;每个额度窗口都显示重置时间。
22
+ - 🆓 **双路由动态模型目录**:Go 与平台免费模型分别从各自网关的 `/models` 发现,保留同名模型;Free 无 Key 时可使用公共访问,两套模型开关与容量设置独立。
23
+ - 🛑 **免费通道限流保护**:遵循上游 `Retry-After`,冷却期间暂停新请求;共享免费额度或 IP 限制不会触发 Go 换号。
24
+ - 🛡️ **多账号无感容灾**:支持最多 20 个账号集中管理与拖拽排序。当主账号额度耗尽或 Key 失效时,**在输出前自动尝试备用账号**,成功后自动扶正,告别“聊到一半额度没了”的打断感。
25
+ - ⚡ **会话级 Prompt 缓存绑定**:严格遵循网关协议注入专有 `x-opencode-session` 路由头,稳定复用网关上下文缓存,显著降低响应首字延迟。
26
+ - 📊 **会话内额度实时透视**:在聊天输入框旁常驻“用量胶囊”,直观展示 5 小时滚动、每周、每月的额度百分比及重置时间倒计时;支持休眠节能与静默刷新。
27
+ - 💰 **官方历史用量看板**:按所选 Key 的工作区汇总官方每日 CSV,查看请求、Token、官方用量金额与模型明细,包含其他客户端的调用。
28
+ - 🎛️ **模型与热配置**:无需重启 DSH!随时在线调整模型上下文窗口、最大输出上限、思考预算(Thinking Budget),并支持 HTTP/HTTPS/SOCKS5 代理。
18
29
 
19
- ![订阅用量面板:当前账号、三个额度窗口及重置时间](docs/assets/usage-panel.png)
30
+ ---
20
31
 
21
- 显示用量时每分钟自动刷新;页面进入后台时暂停周期查询,回到前台后刷新。暂时查询失败时,面板会提示失败,并在可保留上次数据时标明“上次数据”,可点击“立即重试”。也可以在设置页的账号卡片中点击 **刷新额度**。
32
+ ## 🚀 快速开始
22
33
 
23
- 在 **设置 → OpenCode Go → 高级设置 → 额度显示** 中选择:
34
+ 适用于 DSH `0.2.1-rc.5` 及以上版本;开发与验证方式见[开发说明](docs/development.md)。
24
35
 
25
- | 模式 | 行为 |
26
- | --- | --- |
27
- | 自动(默认) | 选中 **DSH OpenCode Go** 模型时显示 |
28
- | 常驻 | 使用其他模型时也显示已配置的 OpenCode Go 账号用量 |
29
- | 关闭 | 隐藏会话用量胶囊并停止其轮询 |
36
+ ### 1. 安装插件
30
37
 
31
- ## 管理多个账号
38
+ #### 方式 A:在 DSH 界面中一键安装(推荐)
39
+ 1. 打开 DSH,进入 **插件 → 添加插件**。
40
+ 2. 输入 `dsh-opencode-go`(或填入仓库地址 `https://github.com/Duskriver/dsh-opencode-go`),点击 **安装**。
41
+ 3. 安装完成后点击 **立即启用**。
42
+
43
+ ![在 DSH 中安装插件](docs/assets/install-via-dsh.gif)
44
+
45
+ #### 方式 B:命令行安装
46
+ ```sh
47
+ dsh plugin --profile web add dsh-opencode-go
48
+ ```
49
+ *命令行安装后请重启 `dsh web`。Headless 用户请使用 `--profile headless`。*
50
+
51
+ ### 2. 配置与使用
52
+ 1. 打开 **设置 → OpenCode Go → 账号**,点击添加,填写账号名称与 OpenCode Go API Key 后确认。
53
+ 2. 在任意会话的模型选择器中,选择 **DSH OpenCode Go** 目录下的模型。
54
+ 3. 开始对话,输入区右下角即可看到实时的用量胶囊。
55
+
56
+ ---
57
+
58
+ ## 💡 深度功能与运行机制
32
59
 
33
- 在 **设置 → OpenCode Go → 账号** 中集中管理账号:
60
+ ### 1. 多账号管理与无感容灾(Auto-failover)
61
+
62
+ 在 **设置 → OpenCode Go → 账号** 中集中管理你的所有账号:
34
63
 
35
64
  ![账号管理:账号排序、额度详情、Key 操作和自动使用备用账号](docs/assets/accounts.png)
36
65
 
37
- - 添加账号、重命名、替换 Key 或删除账号;最多支持 20 个账号。
38
- - 每行查看 Key 状态、5 小时已用百分比和重置倒计时,展开查看完整用量与账号操作。
39
- - 拖动行首手柄调整顺序,第一行成为当前账号;顺序也决定自动尝试备用账号的次序。
40
- - 在会话用量面板中点击 **切换**,将所选账号移至首位,供本 profile 后续请求使用;其他账号的相对顺序保持不变。
66
+ - **拖拽排序即优先级**:列表第一项为当前主账号;鼠标拖拽左侧手柄调整顺序,这个顺序也是自动尝试备用账号的优先次序。
67
+ - **出词前无感切换**:开启“自动使用备用账号”后,若当前账号在发出请求后遇到了 **401/403 鉴权失败、429 限流或 Quota 额度耗尽**:
68
+ - 插件会在**开始向你输出文字前**,静默挑出下一个备用账号重新发送请求。
69
+ - 成功出词的备用账号会自动移至首位成为新主账号,并在会话面板给出切换提示。
70
+ - *防御机制*:若模型已经开始吐字或已产生计费,插件不会切换,避免拼接乱码或重复扣费。
71
+ - **防雪崩冷却黑名单**:被网关拒绝的 Key 会进入 5 分钟的内存冷却名单,避免短时间内反复向已失效的账号发起无意义的重试。
72
+ - **凭据安全隔离**:Key 直接存储至 DSH 底层凭据系统,前端界面永远不会回显明文密钥。
41
73
 
42
- 开启 **自动使用备用账号** 后,当前账号额度耗尽或 Key 不可用时,插件会在开始输出前按顺序尝试其他账号。开始正常输出的备用账号会移至首位并成为当前账号,用量面板会显示切换提示。请求已经输出、产生 token 用量或被取消后,不会自动切换账号重发。
74
+ ### 2. 会话内订阅额度透视(UsagePill)
43
75
 
44
- Key 通过 DSH 凭据服务保存,设置页不会回显已保存的密钥。
76
+ 在聊天输入区旁,常驻有直观的“用量胶囊”。点击即可展开完整的用量卡片:
45
77
 
46
- ## 安装与快速开始
78
+ - **三窗口精准监控**:
79
+ - 🟢 **5 小时滚动配额**:短周期高频使用的健康度。
80
+ - 🟡 **每周配额**:本周累计使用进度。
81
+ - 🔴 **每月配额**:月度套餐消耗百分比。
82
+ 每个窗口均显示精确的重置倒计时;进度条会随着接近上限变黄,耗尽时变红。
83
+ - **节能与防抖机制**:默认每分钟静默刷新;当页面切入后台或浏览器最小化时**自动暂停轮询**,切换回前台时即时刷新。
84
+ - **账号全名与快速切换**:多账号时直接显示当前账号全名(名字过长以省略号截断),展开面板点击“切换”即可直接提拔目标账号为主账号。
85
+ - **显示模式**(在 **高级设置 → 额度显示** 中配置):
86
+ - **自动(默认)**:仅在使用 DSH OpenCode Go 模型时显示。
87
+ - **常驻**:切换到其他厂商模型时,仍然保持胶囊显示。
88
+ - **关闭**:隐藏胶囊并停止后台用量轮询。
47
89
 
48
- 适用于 DSH `0.1.5-rc.1` 及以上版本。已验证的宿主版本见[兼容矩阵](docs/development.md#installed-package-matrix)。
90
+ ### 3. 官方历史用量看板(Analytics)
49
91
 
50
- ### 在 DSH 中安装
92
+ 从对话输入框的用量胶囊展开面板,或侧栏的看板按钮打开:
51
93
 
52
- 1. 打开 **插件 → 添加插件**。
53
- 2. 输入 `dsh-opencode-go`,点击 **安装**。
54
- 3. 安装完成后点击 **立即启用**。
94
+ ![新版官方历史用量看板,示例数据](docs/assets/usage-history-desktop.jpg)
55
95
 
56
- ![在 DSH 中安装插件](docs/assets/install-via-dsh.gif)
96
+ [窄屏浅色预览](docs/assets/usage-history-mobile.jpg) · [模型排行与明细预览](docs/assets/usage-history-models.jpg)(均为示例数据)
97
+
98
+ - **官方 CSV 单一来源**:请求、输入 / 输出 / 缓存 Token、官方用量金额、每日图表与模型明细来自同一份官方每日 CSV;provider + model 区分同名模型。支持今日、7 / 30 / 90 天,日期统一使用 UTC。
99
+ - **独立查看账号**:默认当前调用账号,只查看所选 Key 所属工作区,包含其他客户端;切换查看账号不改变对话账号。看板的三个额度窗口跟随所选账号。匿名 Free 覆盖不作保证。
100
+ - **官方用量金额**:直接汇总 `cost_micro_cents`(1 美元 = 1 亿单位),不等同于 Go 额外扣款。官方日汇总可能延迟。
101
+ - **统一界面**:设置页、用量胶囊、侧栏与看板统一采用暖纸色 / 炭灰色和陶土色强调,跟随宿主明暗。优先使用本地 Anthropic Serif / Sans / Mono 字体,中文标题配衬线回退;宽屏弹窗、窄屏全屏,保留 Token 堆叠或请求日柱图、模型排行与明细。
102
+ - **按需查询**:打开、切账号、切区间或手动刷新时查询,Host 短缓存 30 秒,强制刷新绕过缓存,不后台轮询历史。仅官方模型网关支持历史查询;错误明确显示,不回退本地扫描。
103
+
104
+ Key 留在 Host;常规报告只向浏览器传递聚合数字与 provider / model / day。用户主动下载的官方 CSV 可包含成员字段。完整口径见[用量统计说明](docs/usage-analytics.md)。
57
105
 
58
- 也可以在添加插件时输入仓库地址:
106
+ ---
107
+
108
+ ## 🛠️ 架构设计与工作原理
109
+
110
+ 源码按领域组织,宿主与浏览器通过 DSH Typert RPC 通讯:
59
111
 
60
112
  ```text
61
- https://github.com/Duskriver/dsh-opencode-go
113
+ src/
114
+ ├── index.ts + config.ts 插件挂载、configure 设置与热更新
115
+ ├── contracts.ts 浏览器可用的配置、模型与 RPC 契约
116
+ ├── adapter.ts 请求执行、会话头、容灾与冷却
117
+ ├── catalog.ts 模型目录与公共元数据缓存
118
+ ├── conversion.ts 上下文、单次请求图片预算、回放与流转换
119
+ ├── google.ts + sdk-types.ts Google SDK 接入与公开类型
120
+ ├── accounts.ts 串行账号命令、凭据写入与官方配额
121
+ ├── analytics.ts 官方每日 CSV、历史聚合与短缓存
122
+ ├── transport.ts HTTP/HTTPS/SOCKS5、超时与脱敏错误
123
+ └── client/
124
+ ├── index.ts + controller.ts configForms 接入、类型化草稿与账号操作
125
+ ├── Section.tsx 宿主设置页、账号卡片与模型编辑器
126
+ ├── UsagePill.tsx 会话额度胶囊
127
+ ├── AnalyticsDialog.tsx 官方历史用量看板
128
+ └── presentation.ts 多语言、明暗配色与显示格式
62
129
  ```
63
130
 
64
- 命令行安装:
131
+ 账号操作在内存串行队列中直接更新凭据与设置。模型容量草稿始终保留为对象;图片按单次请求限制数量、编码字节及最多四路并行准备。宿主仅使用 DSH `0.2.1-rc.5` 起提供的设置与图片卸载接口。包的 `.` 与 `./client` 导出路径保持不变。
65
132
 
66
- ```sh
67
- dsh plugin --profile web add dsh-opencode-go
68
- ```
133
+ ### 为什么必须要携带 `x-opencode-session`?
134
+ OpenCode Go 网关具有会话粘性路由与上下文缓存共享能力。插件会自动将你的 DSH 对话 ID 经过单向哈希(保留可读字符并在需要时转为安全散列),以稳定的形式放入 `x-opencode-session` 请求头中。这样不仅能让多轮对话始终落在同一推理节点上,还能最大化命中网关的 Prompt Cache,显著节省思考与生成时间。
69
135
 
70
- 命令行安装后启动或重启 `dsh web`。Web 和 Headless 使用各自的 profile,分别安装和更新。
136
+ ---
71
137
 
72
- ### 开始使用
138
+ ## ⚙️ 模型自定义与高级配置
73
139
 
74
- 1. 打开 **设置 → OpenCode Go**,填入 OpenCode Go 订阅的 API Key 并保存,或在 **账号** 中添加账号。
75
- 2. 在会话模型选择器中选择 **DSH OpenCode Go** 下的模型。
76
- 3. 开始对话,在输入区旁查看用量;有多个账号时可展开面板切换。
140
+ ### 模型参数覆盖
141
+ 进入 **设置 → OpenCode Go → 可用模型**:
77
142
 
78
- 插件使用独立的模型提供方 **DSH OpenCode Go**。选择 DSH 原生提供的模型不会自动使用本插件的账号切换功能;“常驻”模式仍可展示本插件已配置账号的用量。
143
+ ![模型设置:搜索、分类筛选、显示开关和参数编辑](docs/assets/model-settings.png)
79
144
 
80
- ## 模型与设置
145
+ - **显示开关**:自由隐藏不常用的模型,净化聊天选择器。
146
+ - **容量与上下文覆盖**:可手动指定上下文窗口(Context Window)与单次最大输出 Token。
147
+ - **思考预算(Thinking Budget)**:对支持深度思考的模型,可自定义思考强度等级或 Token 预算。
148
+ - **默认输出预算**:任意模型声明的输出上限超过 65,536 且调用方与设置均未显式指定时,默认封顶 **65,536 tokens**;较小模型保留 SDK 默认值。该预算同时报告给 DSH,用于上下文压缩。
81
149
 
82
- ### 选择模型与调整参数
150
+ ### 分组高级设置
151
+ 支持在 **设置 → OpenCode Go → 高级设置** 中按需微调:
83
152
 
84
- 在 **可用模型** 中按名称或 ID 搜索,也可以筛选 **近 7 天发布**、**已自定义** 或 **过时模型**。点击 **刷新** 核对最新模型目录。
153
+ ![高级设置:分组配置、提示入口和统一恢复默认](docs/assets/advanced-settings.png)
85
154
 
86
- ![模型设置:搜索、分类筛选、显示开关和参数编辑](docs/assets/model-settings.png)
155
+ - **网络代理**:支持填入 HTTP、HTTPS 或 SOCKS5 代理地址(如 `socks5://127.0.0.1:1080`),保存后即时应用于对话、用量查询与模型刷新。
156
+ - **超时控制**:分别支持配置请求准备超时(`requestPreparationTimeoutMs`)、整轮请求超时(`requestTimeoutMs`)以及流空闲看门狗阈值(`streamIdleTimeoutMs`)。
157
+ - **一键恢复默认**:点击每张卡片的“全部恢复默认”可一键清空自定义覆盖,不影响已保存的账号 Key。
87
158
 
88
- - 模型开关控制它是否出现在会话选择器中,修改立即生效。
89
- - 选中模型可查看目录提供的上下文窗口、最大输出和输入模态,容量覆盖保存后生效,留空使用默认值。
90
- - 支持思考的模型提供相应开关、强度或 token 预算选项;预算式模型还可添加自定义预算并保存。
159
+ ---
91
160
 
92
- `deepseek-v4.1-flash` 每次请求默认使用 **64k(65,536 tokens)** 的输出预算,模型输出上限更小时取较小值,并将该默认值告知 DSH 用于计算压缩时机。该规则只应用于此模型;其他模型沿用 SDK 的默认输出行为。需要更长回答时,可在模型容量覆盖中设置「最大输出」。
161
+ ## ❓ 常见问题 (FAQ)
93
162
 
94
- 流式回复、思考、工具调用和图片输入取决于模型能力。界面中的输入模态来自在线模型配置;本插件目前仅转换并转发图像附件。
163
+ <details>
164
+ <summary><strong>Q: 为什么聊天输入区没有出现用量胶囊?</strong></summary>
95
165
 
96
- ### 分组高级设置
166
+ 1. 检查当前会话选中的模型是否为 **DSH OpenCode Go** 分组下的模型。默认“自动”模式仅在选择本插件模型时展示;若希望在使用其他模型时也看到配额,可在 **高级设置 → 额度显示** 中切为“常驻”。
167
+ 2. 检查是否已在设置中填入有效 API Key 且插件已处于启用状态。
168
+ </details>
97
169
 
98
- 高级设置按 **用量与协议**、**连接**、**缓存与超时**、**图片处理** 分组。悬停问号查看说明,可通过 **全部恢复默认** 清除该卡片的自定义覆盖,再保存修改;当前账号选择保持不变。
170
+ <details>
171
+ <summary><strong>Q: 为什么长会话中偶尔会报 400 错误?</strong></summary>
99
172
 
100
- ![高级设置:分组配置、提示入口和统一恢复默认](docs/assets/advanced-settings.png)
173
+ 通常是因为单次上下文加输出预算超过了模型允许的 Context Window。建议:
174
+ 1. 在会话中执行 `/compact` 指令压缩历史消息。
175
+ 2. 或在 **可用模型** 设置中,适度调低该模型的“最大输出”上限。
176
+ 明确的上下文超限错误会被插件捕获并交由 DSH 原生恢复机制处理。
177
+ </details>
178
+
179
+ <details>
180
+ <summary><strong>Q: 升级插件后,旧会话找不到模型怎么办?</strong></summary>
181
+
182
+ 从 `0.1.16` 及更早版本升级时,底层 Provider ID 进行了规范化统一。只需在旧会话或 Agent 配置的模型下拉框中,重新选择一次 **DSH OpenCode Go** 下的模型即可。
183
+ </details>
101
184
 
102
- 支持 HTTP、HTTPS 和 SOCKS5 代理,保存后用于后续对话、模型目录更新与用量查询。代理运行在 DSH 所在的机器上;远程部署中的 `127.0.0.1` 指服务器自身。
185
+ <details>
186
+ <summary><strong>Q: 插件在执行过程中会自动将我的数据上传到第三方吗?</strong></summary>
103
187
 
104
- DeepSeek V4.1 Flash 的 Responses 协议选项为实验性,仅影响新请求,不承诺更低延迟。完整配置与使用说明见[高级使用指南](docs/advanced.md)。
188
+ 正常对话会把请求内容发送到你配置的模型网关(默认为 OpenCode Go 官方网关),额度查询也会访问该网关。插件从 Go 与平台网关各自的 `/models` 下载公开的模型能力与价格;默认地址分别为 `https://opencode.ai/inference/go/v1` 与 `https://opencode.ai/inference/v1`。
105
189
 
106
- 截图用于展示界面,具体模型、额度和时间以当前账号与在线目录为准。
190
+ 历史看板由 Host 使用所选 Key 请求官方 Console 的每日 CSV,仅支持官方模型网关配置,沿用代理设置。浏览器常规报告只收到聚合数字与 provider / model / day,不含 Key、会话正文或成员字段;主动下载的官方 CSV 可包含成员字段。模型发现请求不携带会话正文、账号密钥或逐条统计记录。
191
+ </details>
107
192
 
108
- ## 更新与常见问题
193
+ ---
109
194
 
110
- 更新到 npm 最新发布版本:
195
+ ## 📦 更新与卸载
111
196
 
197
+ ### 更新插件
112
198
  ```sh
113
199
  dsh plugin --profile web update dsh-opencode-go --latest
114
200
  ```
201
+ 更新后重启 `dsh web` 并刷新浏览器页面(桌面客户端请完全退出后重新打开)。
115
202
 
116
- 更新后重启 `dsh web` 并刷新页面;桌面版完全退出后重新打开。Headless 用户将 `web` 换成 `headless`。仓库默认分支可能包含尚未发布到 npm 的修改。
117
-
118
- **为什么没有显示用量?** 默认“自动”模式仅在选择 **DSH OpenCode Go** 模型时显示。请检查插件是否启用、Key 是否配置,以及额度显示模式;使用其他提供方时可选择“常驻”。
119
-
120
- **查询失败或添加账号中断怎么办?** 用量查询可在面板中重试,或在账号卡片中刷新额度。未成功保存 Key 的新增账号可补填 Key 或删除;账号操作的恢复机制见[高级使用指南](docs/advanced.md#账号操作与保存)。
121
-
122
- **长会话持续报 400 怎么办?** 检查错误中的输出预算与上下文窗口,可执行 `/compact` 或调低该模型的「最大输出」后重试。明确的上下文超限会交给 DSH 的恢复机制;原因不明的 400 会保留原分类并给出排查建议。失败且未取得 token 用量时,插件不发送全零用量,避免将上下文占用误报为 0%。
203
+ ### 卸载插件
204
+ ```sh
205
+ dsh plugin --profile web remove dsh-opencode-go
206
+ ```
123
207
 
124
- **升级后旧会话找不到模型?** 从 `0.1.16` 及更早版本升级时,在旧会话或 Agent 预设中重新选择 **DSH OpenCode Go**;手动配置使用 `provider: dsh-opencode-go`。
208
+ ---
125
209
 
126
- **兼容性范围是什么?** 安装兼容性覆盖十个宿主版本,从 `0.1.5-rc.1` 到 `0.2.1-alpha.1`,后续版本仍需验证。目前明确拒绝 developer 消息、动态工具增删和延迟工具加载,详见[开发与兼容性说明](docs/development.md)。
210
+ ## 🧪 开发与验证
127
211
 
128
- 卸载:
212
+ 使用 Node.js `^22.19.0 || >=24.0.0`,开发依赖锁定 DSH `0.2.1-rc.5`、Cordis `4.0.5`;宿主 Cordis 要求 `~4.0.5`。
129
213
 
130
214
  ```sh
131
- dsh plugin --profile web remove dsh-opencode-go
215
+ npm ci
216
+ npm test
217
+ npm run typecheck
218
+ npm run check:dist
219
+ npm run verify
132
220
  ```
133
221
 
134
- ## 更多文档
222
+ 测试按领域覆盖宿主、协议转换、账号、统计、传输、免费通道退避、前端。修改源码后先运行 `npm run compile` 更新 `lib/`;`verify` 包含类型检查、产物一致性、全量测试与包加载冒烟。独立安装和 Headless 验证见[开发说明](docs/development.md)。
223
+
224
+ ---
225
+
226
+ ## 📚 更多文档与链接
135
227
 
136
- - [高级使用指南:Headless、代理、手动配置与错误诊断](docs/advanced.md)
137
- - [开发与测试](docs/development.md)
138
- - [验证记录](docs/verification.md)
139
- - [问题与建议](https://github.com/Duskriver/dsh-opencode-go/issues)
140
- - [MIT 许可证](LICENSE)
228
+ - 📖 [高级使用指南(Headless 部署、代理策略与错误排查)](docs/advanced.md)
229
+ - 📊 [用量看板统计说明(官方来源、口径与隐私)](docs/usage-analytics.md)
230
+ - 🛠️ [开发与贡献指南](docs/development.md)
231
+ - 🧪 [验收范围与验证记录](docs/verification.md)
232
+ - 🐛 [提交 Issue 与建议](https://github.com/Duskriver/dsh-opencode-go/issues)
233
+ - 📄 [MIT 开源许可证](LICENSE)
@@ -1,11 +1,15 @@
1
1
  # Third-party notices
2
2
 
3
- The initial adapter, settings UI, and `src/conversion/{context,stream,replay}.ts` were derived from DeepSeek Harness, copyright (c) 2026 DeepSeek, under the MIT license included in LICENSE. The original DeepSeek copyright notice is retained for these derived portions. The conversion modules are maintained in this package because the published DSH pi-ai package does not export its conversion helpers.
3
+ The initial adapter, settings UI, and `src/conversion.ts` were derived from DeepSeek Harness, copyright (c) 2026 DeepSeek, under the MIT license included in LICENSE. The original DeepSeek copyright notice is retained for these derived portions. The conversion code is maintained in this package because the published DSH pi-ai package does not export its conversion helpers.
4
4
 
5
5
  Original additions and subsequent modifications made in this project are copyright (c) 2026 dsh-opencode-go contributors and are also licensed under MIT. LICENSE records both the upstream attribution and this project's contributor attribution.
6
6
 
7
- The host bundle includes the required portions of `@earendil-works/pi-ai@1.2.0`, `@google/genai@2.21.0` and their bundled dependencies; SDK declarations include pi-ai, pi-telemetry and TypeBox types. Their original licenses are reproduced in `lib/vendor-licenses.txt`, including the Google SDK's Apache-2.0 license and data-uri-to-buffer's MIT license from its published README. The pi packages' license comes from the [upstream v1.2.0 license](https://github.com/earendil-works/pi/blob/v1.2.0/LICENSE), which their npm distributions omit. OpenAI and Anthropic transport SDKs remain separate runtime dependencies.
7
+ The host bundle includes the required portions of `@earendil-works/pi-ai@1.5.0`, `@google/genai@2.21.0` and their bundled dependencies; SDK declarations include pi-ai, pi-telemetry and pi-schema types. Their original licenses are reproduced in `lib/vendor-licenses.txt`, including the Google SDK's Apache-2.0 license and data-uri-to-buffer's MIT license from its published README. The pi packages' license comes from the [upstream v1.5.0 license](https://github.com/earendil-works/pi/blob/v1.5.0/LICENSE), which their npm distributions omit, and is retained in `scripts/licenses/pi-1.5.0-LICENSE`. OpenAI and Anthropic transport SDKs remain separate runtime dependencies.
8
+
9
+ pi-ai 1.5.0 replaces its TypeBox dependency with `@earendil-works/pi-schema@1.5.0`. pi-schema includes format checks and value conversion rules adapted from TypeBox 1.3.27, copyright (c) 2017-2026 Haydn Paterson, under MIT. Its bundled `LICENSES/typebox-LICENSE` is also reproduced in `lib/vendor-licenses.txt`. pi-ai pins both pi-schema and pi-telemetry to 1.5.0, so this package no longer needs a dependency override.
8
10
 
9
11
  The bundled Google SDK's HTTP fetch call is modified at build time to use the plugin's request-scoped fetch binding. Its message serialization and stream parser remain upstream implementations.
10
12
 
11
13
  The GitHub icon in the settings footer comes from Simple Icons, distributed under CC0 1.0 Universal.
14
+
15
+ Free HTTP transport uses the official `bun@1.4.4` optional dependency and its platform packages. Bun is maintained by Oven and contributors and distributed under its upstream license and third-party notices; the runtime remains a separate npm dependency rather than part of this package's JavaScript bundle. See [Bun's license](https://github.com/oven-sh/bun/blob/bun-v1.4.4/LICENSE.md). The HTTP worker and Node bridge in this project are original code.
Binary file