@dan-ai-studio/dshopencodego 0.1.37 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +14 -4
- package/README.md +14 -4
- package/lib/client.js +2 -2
- package/lib/index.js +43528 -144
- package/lib/types/adapter.js +4 -1
- package/lib/types/catalog/go-doc.d.ts +0 -2
- package/lib/types/catalog/go-doc.js +1 -1
- package/lib/types/catalog/index.d.ts +1 -1
- package/lib/types/catalog/index.js +11 -3
- package/lib/types/catalog/metadata.d.ts +2 -1
- package/lib/types/catalog/protocol.d.ts +2 -1
- package/lib/types/catalog/service.d.ts +2 -1
- package/lib/types/config.d.ts +2 -9
- package/lib/types/config.js +4 -4
- package/lib/types/conversion/stream.js +1 -1
- package/lib/types/index.js +0 -5
- package/lib/types/models.d.ts +0 -2
- package/lib/types/models.js +1 -1
- package/lib/types/update/check.d.ts +1 -1
- package/lib/types/usage/windows.d.ts +2 -1
- package/package.json +4 -6
- package/lib/types/circular-warning.d.ts +0 -49
- package/lib/types/circular-warning.js +0 -79
package/README.en.md
CHANGED
|
@@ -128,13 +128,23 @@ A model that does not accept image input is rejected before the request is sent
|
|
|
128
128
|
|
|
129
129
|
Four evidence levels decide how a model is called, first hit wins:
|
|
130
130
|
|
|
131
|
-
1. **The
|
|
131
|
+
1. **The pi-ai catalog entry** — protocol plus wire quirks (DeepSeek's `thinkingFormat`, for example). This catalog is **compiled into the bundle**, so it only moves when the plugin is released.
|
|
132
132
|
2. **models.dev's per-model `provider.npm`** — `@ai-sdk/openai` → Responses, `@ai-sdk/anthropic` → Messages, absent → Chat Completions.
|
|
133
133
|
3. **Family rule** — `grok*`/`gpt*`/`muse-*` → Responses, everything else → Chat Completions.
|
|
134
134
|
4. **`modelProtocols` override** — always wins.
|
|
135
135
|
|
|
136
136
|
The gateway's `/v1/models` answers only *which* models exist, never *how* to call them. Inferred decisions are labelled in the settings page; override them with `modelProtocols`.
|
|
137
137
|
|
|
138
|
+
## A common question: does the provider adding or retiring a model need a plugin release?
|
|
139
|
+
|
|
140
|
+
**No — the model list is live.** The gateway's `/v1/models` is the only source of membership, and every catalog refresh (a 60-minute cache by default, or the Recheck button) takes it as the truth:
|
|
141
|
+
|
|
142
|
+
- a model the provider **adds** appears on the next refresh; if no metadata source describes it, it is labelled as inferred and can be pinned with `modelProtocols`;
|
|
143
|
+
- a model the provider **retires** disappears on the next refresh;
|
|
144
|
+
- the bundled catalog is **frozen at the plugin's version** and affects only the quality of the "how to call it" decision, never *which* models exist.
|
|
145
|
+
|
|
146
|
+
The only thing that waits on a plugin release is a missing wire quirk in the pi-ai catalog (DeepSeek's `thinkingFormat`, say) — the model itself is already usable.
|
|
147
|
+
|
|
138
148
|
## The model list in the settings page
|
|
139
149
|
|
|
140
150
|
The "OpenCode Go" section shows the live gateway catalog (the count follows the gateway) with, per model:
|
|
@@ -175,8 +185,8 @@ The `engines.dsh` field is informational for readers and package managers; **DSH
|
|
|
175
185
|
| `@deepseek-ai/cordis` | `4.0.4 \|\| 4.0.5-alpha.1 \|\| 4.0.5-alpha.2` | the same gate |
|
|
176
186
|
| `engines.dsh` | `>=0.2.0-rc.1 <0.3.0` | informational only; DSH never reads it |
|
|
177
187
|
| `engines.node` | `^22.19.0 \|\| >=24.0.0` | the package manager |
|
|
178
|
-
| bundled `@earendil-works/pi-ai` |
|
|
179
|
-
| bundled `@deepseek-ai/schemastery` | `~3.18.5-alpha.2
|
|
188
|
+
| bundled `@earendil-works/pi-ai` | `~1.3.0` (within 1.3.x), **compiled into `lib/`** (devDependency) | an independent coupling: a change in pi-ai's request construction changes this plugin's wire behaviour, and its opencode-go builtin catalog is this plugin's fallback data. Bundling leaves the plugin with **no runtime dependencies** for an installer to resolve |
|
|
189
|
+
| bundled `@deepseek-ai/schemastery` | `~3.18.5-alpha.2`, **compiled into `lib/`** (devDependency) | a build-time dependency |
|
|
180
190
|
|
|
181
191
|
Things to keep in mind when maintaining this:
|
|
182
192
|
|
|
@@ -198,7 +208,7 @@ Things to keep in mind when maintaining this:
|
|
|
198
208
|
| "The settings write was rejected" | Usually a concurrent writer (another window or process) holding the same profile. The plugin retries once automatically; if it still fails the view has reloaded — click again. |
|
|
199
209
|
| The usage button shows "unavailable" | An endpoint or credential change invalidated the previous reading. Fix the configuration and press Retry. It never shows `0` in place of a missing reading. |
|
|
200
210
|
| npm publish fails with `ENEEDAUTH` | OIDC did not match: check the Trusted Publisher's **workflow filename** (must be exactly `publish-npm.yml`, case-sensitive) and the organization/repository fields; run on GitHub-hosted runners with `id-token: write`. A `repository.url` that does not match the GitHub repository is rejected as well. |
|
|
201
|
-
| A flood of `Accessing non-existent property 'Allow' of module exports inside circular dependency` | Caused by `pi-ai`'s **named import** of `partial-json`: resolving a named export from CommonJS enumerates the module's exports, and that package's `index.js`/`options.js` require each other, so reading `Allow` before its module initialises prints once per read — **a plugin reload turns it into a flood** (a restart usually clears it). **
|
|
211
|
+
| A flood of `Accessing non-existent property 'Allow' of module exports inside circular dependency` | Caused by `pi-ai`'s **named import** of `partial-json`: resolving a named export from CommonJS enumerates the module's exports, and that package's `index.js`/`options.js` require each other, so reading `Allow` before its module initialises prints once per read — **a plugin reload turns it into a flood** (a restart usually clears it). **Removed at the mechanism since v0.1.38**: `pi-ai` and `partial-json` are now **compiled into the bundle**, so Node's ESM→CJS interop is not involved and there is no enumeration of an uninitialised export to begin with. That is a fix, not a filter. |
|
|
202
212
|
| The whole DSH process stalls during ultra-long tool calls (multi-MB arguments) | Observed on pi-ai `0.87.1`: per-delta re-parsing of the accumulated arguments (issue #9265 / PR #9461). This plugin does not port DSH's consumer-side patch (ADR-0005); the bundled dependency is now `~1.3.0`, so a recurrence would be upstream behaviour and would be fixed by an upstream release. |
|
|
203
213
|
|
|
204
214
|
## Development
|
package/README.md
CHANGED
|
@@ -128,13 +128,23 @@ API Key 通过 Harness 凭证库提供(引用名 `OPENCODE_GO_API_KEY`),
|
|
|
128
128
|
|
|
129
129
|
一个模型"怎么调"由四级证据决定,先命中先赢:
|
|
130
130
|
|
|
131
|
-
1.
|
|
131
|
+
1. **pi-ai 内置目录的精确条目**——给出协议与线怪癖(如 DeepSeek 的 `thinkingFormat`)。该目录**编译进插件产物**,版本随插件发版更新,不会在运行时自行变化。
|
|
132
132
|
2. **models.dev 的每模型 `provider.npm`**——`@ai-sdk/openai` → Responses,`@ai-sdk/anthropic` → Messages,缺省 → Chat Completions。
|
|
133
133
|
3. **家族规则**——`grok*`/`gpt*`/`muse-*` → Responses,其余 → Chat Completions。
|
|
134
134
|
4. **`modelProtocols` 覆盖**——永远最高优先。
|
|
135
135
|
|
|
136
136
|
网关的 `/v1/models` 只回答"有哪些模型",不回答"怎么调"。被推断出来的模型会在设置页标注,判错时用 `modelProtocols` 覆盖即可。
|
|
137
137
|
|
|
138
|
+
## 一个常见疑问:官方增删模型后,需要等插件发版吗?
|
|
139
|
+
|
|
140
|
+
**不需要——模型列表是实时的。** 网关 `/v1/models` 是成员资格的唯一来源,每次刷新目录(默认 60 分钟缓存,或点「重新检查」)都会以它为准:
|
|
141
|
+
|
|
142
|
+
- 官方**新增**模型 → 下次刷新即出现,协议/容量若不在内置目录中则标为"推断"并可被 `modelProtocols` 覆盖;
|
|
143
|
+
- 官方**下线**模型 → 下次刷新即消失;
|
|
144
|
+
- 内置目录**冻结**在插件版本里,仅影响"怎么调"的推断质量,不影响"有哪些"。
|
|
145
|
+
|
|
146
|
+
只有当 pi-ai 内置目录**缺了某个模型的线怪癖**(如 DeepSeek 的 `thinkingFormat`)时,才需要等插件同步 pi-ai 的新版本——而模型本身早已可用。
|
|
147
|
+
|
|
138
148
|
## 设置页里的模型列表
|
|
139
149
|
|
|
140
150
|
设置页的「OpenCode Go」分区展示网关实时目录(数量随网关发布变化),并对每个模型给出:
|
|
@@ -175,8 +185,8 @@ API Key 通过 Harness 凭证库提供(引用名 `OPENCODE_GO_API_KEY`),
|
|
|
175
185
|
| `@deepseek-ai/cordis` | `4.0.4 \|\| 4.0.5-alpha.1 \|\| 4.0.5-alpha.2` | 同一门禁 |
|
|
176
186
|
| `engines.dsh` | `>=0.2.0-rc.1 <0.3.0` | 仅信息字段,DSH 不读 |
|
|
177
187
|
| `engines.node` | `^22.19.0 \|\| >=24.0.0` | 包管理器 |
|
|
178
|
-
|
|
|
179
|
-
|
|
|
188
|
+
| 已打包依赖 `@earendil-works/pi-ai` | `~1.3.0`(1.3.x 内),**打进产物**(devDependency) | 独立耦合:pi-ai 改请求构造即影响本插件的线上行为;其 opencode-go 内置目录同时是本插件的打底数据。打包后本插件**没有任何运行时依赖**,安装者不必再解析它 |
|
|
189
|
+
| 已打包依赖 `@deepseek-ai/schemastery` | `~3.18.5-alpha.2`,**打进产物**(devDependency) | 构建期依赖 |
|
|
180
190
|
|
|
181
191
|
维护时需要注意:
|
|
182
192
|
|
|
@@ -198,7 +208,7 @@ API Key 通过 Harness 凭证库提供(引用名 `OPENCODE_GO_API_KEY`),
|
|
|
198
208
|
| 设置页出现「设置写入被拒绝」 | 通常是与另一个窗口/进程并发写同一 profile;插件会自动重试一次,仍失败时界面已重载最新状态,再点一次即可。 |
|
|
199
209
|
| 用量按钮显示「不可用」 | 端点或凭证变化导致旧读数作废;配置正确后点「重试」。数值不会以 0 冒充。 |
|
|
200
210
|
| npm 发布报 `ENEEDAUTH` | OIDC 没匹配上:核对包设置里 Trusted Publisher 的 **workflow 文件名**(必须恰为 `publish-npm.yml`、大小写敏感)与组织/仓库字段;确认跑在 GitHub 托管 runner 上且工作流带 `id-token: write`。`package.json` 的 `repository.url` 与仓库不符也会被拒。 |
|
|
201
|
-
| 日志成片出现 `Accessing non-existent property 'Allow' of module exports inside circular dependency` | 成因是 `pi-ai` 对 `partial-json`
|
|
211
|
+
| 日志成片出现 `Accessing non-existent property 'Allow' of module exports inside circular dependency` | 成因是 `pi-ai` 对 `partial-json` 的**具名导入**:Node 解析 CJS 的具名导出时会枚举其 exports,而该包内部 `index.js`/`options.js` 互相 require,读到尚未初始化的 `Allow` 就打印一次——**插件重载会让它成片出现**(重启后往往消失)。**自 v0.1.38 起从机制上消除**:`pi-ai` 与 `partial-json` 已**打包进产物**,Node 的 ESM→CJS 互操作不再参与,因此不存在"枚举读到未初始化属性"这一步(不是过滤,是让该路径不存在)。 |
|
|
202
212
|
| 超长工具调用(多 MB 参数)期间整个 DSH 进程卡顿 | 曾在 pi-ai `0.87.1` 上观测到逐 delta 重解析的固有开销(issue #9265 / PR #9461)。本插件不移植 DSH 的消费者侧补丁(ADR-0005);当前自带依赖已是 `~1.3.0`,若仍复现则属上游行为,随其发版解决。 |
|
|
203
213
|
|
|
204
214
|
## 开发
|
package/lib/client.js
CHANGED
|
@@ -562,7 +562,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")
|
|
|
562
562
|
style.textContent = ".d7lz0W_root{color:var(--dsw-alias-label-primary);flex-direction:column;gap:1.25rem;display:flex}.d7lz0W_title{margin:0;font-size:1.05rem}.d7lz0W_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.8rem}.d7lz0W_warn{color:var(--dsw-alias-state-warn-primary);margin:0;font-size:.8rem}.d7lz0W_ok{color:var(--dsw-alias-state-success-primary);font-size:.8rem}.d7lz0W_block{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:.6rem;flex-direction:column;gap:.5rem;padding:.85rem;display:flex}.d7lz0W_row{flex-wrap:wrap;align-items:center;gap:.5rem;display:flex}.d7lz0W_row>strong{margin-right:auto}.d7lz0W_input{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);min-width:10rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;flex:14rem;padding:.35rem .5rem;font-size:.85rem}.d7lz0W_button{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;padding:.35rem .7rem;font-size:.8rem}.d7lz0W_button:disabled{color:var(--dsw-alias-state-idle-primary);cursor:default}.d7lz0W_number{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:5rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_select{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:auto;max-width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_list{flex-direction:column;display:flex}.d7lz0W_item{border-top:1px solid var(--dsw-alias-border-l1);align-items:flex-start;gap:.5rem;padding:.45rem .15rem;display:flex}.d7lz0W_item input[type=checkbox]{accent-color:var(--dsw-alias-brand-primary);margin-top:.15rem}.d7lz0W_itemBody{flex-direction:column;gap:.15rem;min-width:0;display:flex}.d7lz0W_itemMain{flex-wrap:wrap;align-items:baseline;gap:.6rem;display:flex}.d7lz0W_itemMeta{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:.75rem;font-size:.75rem;display:flex}.d7lz0W_itemModalities{color:var(--dsw-alias-label-secondary);font-size:.75rem}.d7lz0W_name{color:var(--dsw-alias-label-primary)}.d7lz0W_mono{color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.d7lz0W_badge{color:var(--dsw-alias-brand-primary)}";
|
|
563
563
|
document.head.appendChild(style);
|
|
564
564
|
}
|
|
565
|
-
var section_default = { "
|
|
565
|
+
var section_default = { "item": "d7lz0W_item", "name": "d7lz0W_name", "input": "d7lz0W_input", "block": "d7lz0W_block", "number": "d7lz0W_number", "itemMeta": "d7lz0W_itemMeta", "itemModalities": "d7lz0W_itemModalities", "badge": "d7lz0W_badge", "ok": "d7lz0W_ok", "select": "d7lz0W_select", "row": "d7lz0W_row", "itemMain": "d7lz0W_itemMain", "list": "d7lz0W_list", "mono": "d7lz0W_mono", "itemBody": "d7lz0W_itemBody", "title": "d7lz0W_title", "warn": "d7lz0W_warn", "button": "d7lz0W_button", "root": "d7lz0W_root", "hint": "d7lz0W_hint" };
|
|
566
566
|
|
|
567
567
|
// src/client/Section.tsx
|
|
568
568
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -1335,7 +1335,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]"
|
|
|
1335
1335
|
style.textContent = ".mMNkkW_root{align-items:center;display:inline-flex;position:relative}.mMNkkW_trigger{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;white-space:nowrap;border-radius:999px;padding:.35rem .6rem;font-size:.8rem;line-height:1}.mMNkkW_trigger:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}.mMNkkW_panel{z-index:20;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-overlay);width:18rem;color:var(--dsw-alias-label-primary);border-radius:.6rem;flex-direction:column;gap:.6rem;padding:.75rem .85rem;display:flex;position:absolute;bottom:calc(100% + .5rem);right:0;box-shadow:0 8px 24px #0000002e}.mMNkkW_window{flex-direction:column;gap:.25rem;display:flex}.mMNkkW_row{justify-content:space-between;gap:.5rem;font-size:.85rem;display:flex}.mMNkkW_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.75rem}.mMNkkW_progress{width:100%;height:.35rem;accent-color:var(--dsw-alias-brand-primary)}.mMNkkW_limited{color:var(--dsw-alias-state-warn-primary);font-size:.75rem}.mMNkkW_warning{border:1px solid var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-primary);border-radius:.4rem;padding:.4rem .5rem;font-size:.75rem}.mMNkkW_retry{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;align-self:flex-start;padding:.25rem .5rem;font-size:.75rem}.mMNkkW_local{border-top:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:.2rem;padding-top:.5rem;display:flex}";
|
|
1336
1336
|
document.head.appendChild(style);
|
|
1337
1337
|
}
|
|
1338
|
-
var pill_default = { "hint": "mMNkkW_hint", "
|
|
1338
|
+
var pill_default = { "hint": "mMNkkW_hint", "progress": "mMNkkW_progress", "root": "mMNkkW_root", "row": "mMNkkW_row", "trigger": "mMNkkW_trigger", "warning": "mMNkkW_warning", "limited": "mMNkkW_limited", "retry": "mMNkkW_retry", "panel": "mMNkkW_panel", "local": "mMNkkW_local", "window": "mMNkkW_window" };
|
|
1339
1339
|
|
|
1340
1340
|
// src/client/UsagePill.tsx
|
|
1341
1341
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|