@dan-ai-studio/dshopencodego 0.1.5 → 0.1.6
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 +23 -7
- package/README.md +23 -7
- package/lib/client.js +6 -6
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -19,10 +19,10 @@ Prerequisites: a DSH `0.1.7` release (see "Compatibility"); Node `^22.19.0 || >=
|
|
|
19
19
|
|
|
20
20
|
> **One owner per route**: a profile can have exactly one adapter for `opencode-go`. Remove the previous plugin (`dsh plugin --profile <p> remove @dan-ai-studio/dsh-opencode-go`) or clear any `opencode-go` provider in `llm-pi-ai` first. Otherwise the plugin logs an explicit ownership diagnostic and does not register the route — everything else keeps working.
|
|
21
21
|
|
|
22
|
-
### Option 1:
|
|
22
|
+
### Option 1: npm (recommended)
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
dsh plugin --profile web add
|
|
25
|
+
dsh plugin --profile web add @dan-ai-studio/dshopencodego@<version>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
Confirm the composition picked it up:
|
|
@@ -31,12 +31,10 @@ Confirm the composition picked it up:
|
|
|
31
31
|
dsh --profile web --dump-config | grep dshopencodego
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
### Option 2:
|
|
35
|
-
|
|
36
|
-
The publish workflow exists but is inert until the npm scope and `NPM_TOKEN` exist (see "Releasing"). Once enabled:
|
|
34
|
+
### Option 2: GitHub Release
|
|
37
35
|
|
|
38
36
|
```sh
|
|
39
|
-
dsh plugin --profile web add
|
|
37
|
+
dsh plugin --profile web add https://github.com/dan-ai-studio/dshopencodego/releases/download/v<version>/dan-ai-studio-dshopencodego-<version>.tgz
|
|
40
38
|
```
|
|
41
39
|
|
|
42
40
|
### Option 3: build locally
|
|
@@ -133,6 +131,7 @@ The `engines.dsh` field is informational for readers and package managers; **DSH
|
|
|
133
131
|
| A reinstalled local tarball behaves like the old build | pnpm reuses a same-named local tarball. Rename the file and install again. |
|
|
134
132
|
| "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. |
|
|
135
133
|
| 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. |
|
|
134
|
+
| 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. |
|
|
136
135
|
|
|
137
136
|
## Development
|
|
138
137
|
|
|
@@ -149,7 +148,24 @@ npm run build # emits lib/index.js and lib/client.js
|
|
|
149
148
|
|
|
150
149
|
1. **Version**: align `package.json`'s `version` with the tag you are about to push (`v<version>`); CI checks the asset name against the tag.
|
|
151
150
|
2. **GitHub Release**: commit and push `main`, then push the tag. `release.yml` runs the tests, `npm pack`s, and uploads the tarball as the release asset.
|
|
152
|
-
3. **npm (
|
|
151
|
+
3. **npm (trusted publishing / OIDC, no token)**: `.github/workflows/publish-npm.yml` is manual-only and authenticates through GitHub Actions' OIDC — this repository **has no `NPM_TOKEN` and needs none**. Run it with:
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
gh workflow run publish-npm --repo dan-ai-studio/dshopencodego -f tag=v<version>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
It verifies tag-versus-version, refuses to overwrite a version that already exists on npm, and the publish carries an automatically generated **provenance** attestation. It relies on the package's **Trusted Publisher** connection on npm (fields are fixed once created; to change one, delete and recreate it):
|
|
158
|
+
|
|
159
|
+
| Field | Value |
|
|
160
|
+
|---|---|
|
|
161
|
+
| Publisher | `GitHub Actions` |
|
|
162
|
+
| Organization or user | `dan-ai-studio` |
|
|
163
|
+
| Repository | `dshopencodego` |
|
|
164
|
+
| Workflow filename | `publish-npm.yml` (exact, case-sensitive) |
|
|
165
|
+
| Environment name | (empty) |
|
|
166
|
+
| Allowed actions | `Allow npm publish` checked (unchecked means staged-only: a maintainer must approve each publish with 2FA) |
|
|
167
|
+
|
|
168
|
+
Additionally: OIDC publishing needs **npm CLI ≥ 11.5.1 / Node ≥ 22.14** (the workflow uses Node 24), and `package.json`'s `repository.url` must match the GitHub repository. Once OIDC works, switch the package's Settings → **Publishing access** to "Require two-factor authentication and disallow tokens" and revoke any tokens you no longer need.
|
|
153
169
|
|
|
154
170
|
## License
|
|
155
171
|
|
package/README.md
CHANGED
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
> **路由互斥**:同一个 profile 里 `opencode-go` 只能由一个适配器提供。装本插件前请先卸载旧插件(`dsh plugin --profile <p> remove @dan-ai-studio/dsh-opencode-go`),或清空 `llm-pi-ai` 配置里名为 `opencode-go` 的 provider。否则插件会记录一条明确的占用诊断,路由不会注册(其余功能照常)。
|
|
21
21
|
|
|
22
|
-
### 方式一:
|
|
22
|
+
### 方式一:npm(推荐)
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
dsh plugin --profile web add
|
|
25
|
+
dsh plugin --profile web add @dan-ai-studio/dshopencodego@<版本>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
安装后确认组合里出现该插件:
|
|
@@ -31,12 +31,10 @@ dsh plugin --profile web add https://github.com/dan-ai-studio/dshopencodego/rele
|
|
|
31
31
|
dsh --profile web --dump-config | grep dshopencodego
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
### 方式二:
|
|
35
|
-
|
|
36
|
-
发布工作流已经就绪但**尚未启用**(需要 npm scope 与 `NPM_TOKEN`,见「发布」)。启用后即可:
|
|
34
|
+
### 方式二:GitHub Release
|
|
37
35
|
|
|
38
36
|
```sh
|
|
39
|
-
dsh plugin --profile web add
|
|
37
|
+
dsh plugin --profile web add https://github.com/dan-ai-studio/dshopencodego/releases/download/v<版本>/dan-ai-studio-dshopencodego-<版本>.tgz
|
|
40
38
|
```
|
|
41
39
|
|
|
42
40
|
### 方式三:本地构建
|
|
@@ -133,6 +131,7 @@ API Key 通过 Harness 凭证库提供(引用名 `OPENCODE_GO_API_KEY`),
|
|
|
133
131
|
| 升级本地 tarball 后行为没变 | pnpm 对同名本地 tarball 会复用旧内容。改文件名再装。 |
|
|
134
132
|
| 设置页出现「设置写入被拒绝」 | 通常是与另一个窗口/进程并发写同一 profile;插件会自动重试一次,仍失败时界面已重载最新状态,再点一次即可。 |
|
|
135
133
|
| 用量按钮显示「不可用」 | 端点或凭证变化导致旧读数作废;配置正确后点「重试」。数值不会以 0 冒充。 |
|
|
134
|
+
| npm 发布报 `ENEEDAUTH` | OIDC 没匹配上:核对包设置里 Trusted Publisher 的 **workflow 文件名**(必须恰为 `publish-npm.yml`、大小写敏感)与组织/仓库字段;确认跑在 GitHub 托管 runner 上且工作流带 `id-token: write`。`package.json` 的 `repository.url` 与仓库不符也会被拒。 |
|
|
136
135
|
|
|
137
136
|
## 开发
|
|
138
137
|
|
|
@@ -149,7 +148,24 @@ npm run build # 产出 lib/index.js 与 lib/client.js
|
|
|
149
148
|
|
|
150
149
|
1. **版本**:把 `package.json` 的 `version` 与即将打出的 tag 对齐(`v<版本>`)。CI 会校验资产名与 tag。
|
|
151
150
|
2. **GitHub Release**:提交并推送 `main`,打 tag 推送。`release.yml` 会跑测试、`npm pack` 并把 tarball 作为 Release 资产上传。
|
|
152
|
-
3. **npm
|
|
151
|
+
3. **npm(Trusted Publishing / OIDC,无需令牌)**:`.github/workflows/publish-npm.yml` 仅手动触发,认证走 GitHub Actions 的 OIDC——本仓库**没有也不需要** `NPM_TOKEN`。运行方式:
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
gh workflow run publish-npm --repo dan-ai-studio/dshopencodego -f tag=v<版本>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
工作流会校验 tag 与版本一致、拒绝覆盖 npm 上已存在的版本,发布时**自动生成 provenance 声明**。它依赖 npm 包设置里的 **Trusted Publisher** 连接(字段一旦创建不可修改,要改只能删了重建):
|
|
158
|
+
|
|
159
|
+
| 字段 | 值 |
|
|
160
|
+
|---|---|
|
|
161
|
+
| Publisher | `GitHub Actions` |
|
|
162
|
+
| Organization or user | `dan-ai-studio` |
|
|
163
|
+
| Repository | `dshopencodego` |
|
|
164
|
+
| Workflow filename | `publish-npm.yml`(完全一致、大小写敏感) |
|
|
165
|
+
| Environment name | 留空 |
|
|
166
|
+
| Allowed actions | 勾选 `Allow npm publish`(不勾则只允许 staged publishing:每次发布需人工 2FA 批准后才公开) |
|
|
167
|
+
|
|
168
|
+
另外:OIDC 发布要求 **npm CLI ≥ 11.5.1 / Node ≥ 22.14**(工作流用 Node 24 满足);`package.json` 的 `repository.url` 必须与 GitHub 仓库匹配。启用 OIDC 后,建议到包设置 → **Publishing access** 选择「Require two-factor authentication and disallow tokens」,并撤销不再需要的旧令牌。
|
|
153
169
|
|
|
154
170
|
## 许可证
|
|
155
171
|
|
package/lib/client.js
CHANGED
|
@@ -431,16 +431,16 @@ function visibleModels(models, filter, visibility, locale) {
|
|
|
431
431
|
return sortRows(rows, filter.sort, visibility, locale);
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
// plugin-css
|
|
434
|
+
// plugin-css:/home/runner/work/dshopencodego/dshopencodego/src/client/section.module.css
|
|
435
435
|
var id = "@dan-ai-studio/dshopencodego/section.module.css";
|
|
436
436
|
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")) {
|
|
437
437
|
const style = document.createElement("style");
|
|
438
438
|
style.dataset.plugin = "@dan-ai-studio/dshopencodego";
|
|
439
439
|
style.dataset.pluginCss = id;
|
|
440
|
-
style.textContent = ".
|
|
440
|
+
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_segmented{border:1px solid var(--dsw-alias-border-l1);border-radius:.35rem;display:inline-flex;overflow:hidden}.d7lz0W_segment,.d7lz0W_segmentActive{background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;border:0;padding:.25rem .6rem;font-size:.8rem}.d7lz0W_segmentActive{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}.d7lz0W_tableWrap{overflow-x:auto}.d7lz0W_table{border-collapse:collapse;width:100%;min-width:62rem;font-size:.78rem}.d7lz0W_table th{color:var(--dsw-alias-label-secondary);text-align:left;white-space:nowrap;padding:.25rem .45rem;font-weight:500}.d7lz0W_table td{border-top:1px solid var(--dsw-alias-border-l1);vertical-align:middle;white-space:nowrap;padding:.28rem .45rem}.d7lz0W_toggle{width:2rem}.d7lz0W_toggle input{accent-color:var(--dsw-alias-brand-primary)}.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_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)}";
|
|
441
441
|
document.head.appendChild(style);
|
|
442
442
|
}
|
|
443
|
-
var section_default = { "
|
|
443
|
+
var section_default = { "select": "d7lz0W_select", "button": "d7lz0W_button", "list": "d7lz0W_list", "hint": "d7lz0W_hint", "row": "d7lz0W_row", "itemBody": "d7lz0W_itemBody", "name": "d7lz0W_name", "table": "d7lz0W_table", "warn": "d7lz0W_warn", "block": "d7lz0W_block", "mono": "d7lz0W_mono", "segmented": "d7lz0W_segmented", "itemMain": "d7lz0W_itemMain", "segmentActive": "d7lz0W_segmentActive", "toggle": "d7lz0W_toggle", "tableWrap": "d7lz0W_tableWrap", "itemMeta": "d7lz0W_itemMeta", "badge": "d7lz0W_badge", "root": "d7lz0W_root", "number": "d7lz0W_number", "item": "d7lz0W_item", "title": "d7lz0W_title", "input": "d7lz0W_input", "ok": "d7lz0W_ok", "segment": "d7lz0W_segment" };
|
|
444
444
|
|
|
445
445
|
// src/client/Section.tsx
|
|
446
446
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -987,16 +987,16 @@ function Section({ controller, t, getLocale }) {
|
|
|
987
987
|
// src/client/UsagePill.tsx
|
|
988
988
|
var import_react2 = require("react");
|
|
989
989
|
|
|
990
|
-
// plugin-css
|
|
990
|
+
// plugin-css:/home/runner/work/dshopencodego/dshopencodego/src/client/pill.module.css
|
|
991
991
|
var id2 = "@dan-ai-studio/dshopencodego/pill.module.css";
|
|
992
992
|
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]")) {
|
|
993
993
|
const style = document.createElement("style");
|
|
994
994
|
style.dataset.plugin = "@dan-ai-studio/dshopencodego";
|
|
995
995
|
style.dataset.pluginCss = id2;
|
|
996
|
-
style.textContent = ".
|
|
996
|
+
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}";
|
|
997
997
|
document.head.appendChild(style);
|
|
998
998
|
}
|
|
999
|
-
var pill_default = { "
|
|
999
|
+
var pill_default = { "local": "mMNkkW_local", "row": "mMNkkW_row", "root": "mMNkkW_root", "limited": "mMNkkW_limited", "window": "mMNkkW_window", "progress": "mMNkkW_progress", "panel": "mMNkkW_panel", "trigger": "mMNkkW_trigger", "warning": "mMNkkW_warning", "hint": "mMNkkW_hint", "retry": "mMNkkW_retry" };
|
|
1000
1000
|
|
|
1001
1001
|
// src/client/UsagePill.tsx
|
|
1002
1002
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
package/package.json
CHANGED