@goodandready/dsh-opencode-provider 0.5.26 → 0.5.27
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 +6 -0
- package/README.md +3 -3
- package/README.ru.md +3 -3
- package/README.zh.md +3 -3
- package/lib/client.js +9 -0
- package/lib/index.js +31 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.27 — release 4: catalog freshness
|
|
4
|
+
|
|
5
|
+
- **#86 — new-model badge**: the live catalog now keeps `release_date` (or `created`) metadata; Settings marks models released within the last seven UTC days with a NEW badge and date tooltip. Dates are dropped safely when the gateway omits or malforms them.
|
|
6
|
+
- **#85 — output ceiling**: the default generated-output cap is 65,536 tokens (was 32,768), matching the reference plugin while still respecting each model's own `maxTokens` and explicit caller limits.
|
|
7
|
+
- 133 tests.
|
|
8
|
+
|
|
3
9
|
## 0.5.26 — release 3: quota display and switch notices
|
|
4
10
|
|
|
5
11
|
- **#75 — quota display modes**: new `usageDisplay` setting with `auto`/`always`/`off` (legacy `showSidebarQuota` maps to `always`); `auto` shows the sidebar card when a Go usage report exists. Exposed in Settings and TUI.
|
package/README.md
CHANGED
|
@@ -132,12 +132,12 @@ npm pack
|
|
|
132
132
|
Install the **packed tarball** into a profile:
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.
|
|
135
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.27.tgz
|
|
136
136
|
# DSH Desktop:
|
|
137
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.
|
|
137
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.27.tgz
|
|
138
138
|
|
|
139
139
|
# Or install the published package:
|
|
140
|
-
dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.
|
|
140
|
+
dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.27
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
Restart dsh (or DSH Desktop), then pick **OpenCode (plugin)** or **OpenCode Go (plugin)** in the model picker.
|
package/README.ru.md
CHANGED
|
@@ -131,12 +131,12 @@ npm pack
|
|
|
131
131
|
Установка из **упакованного tarball**:
|
|
132
132
|
|
|
133
133
|
```bash
|
|
134
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.
|
|
134
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.27.tgz
|
|
135
135
|
# DSH Desktop:
|
|
136
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.
|
|
136
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.27.tgz
|
|
137
137
|
|
|
138
138
|
# Либо установка опубликованного пакета из npm:
|
|
139
|
-
dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.
|
|
139
|
+
dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.27
|
|
140
140
|
```
|
|
141
141
|
|
|
142
142
|
После установки перезапустите dsh (или DSH Desktop) и выберите **OpenCode (plugin)** или **OpenCode Go (plugin)** в списке моделей.
|
package/README.zh.md
CHANGED
|
@@ -126,12 +126,12 @@ npm pack
|
|
|
126
126
|
通过**打包文件 (.tgz)**安装:
|
|
127
127
|
|
|
128
128
|
```bash
|
|
129
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.
|
|
129
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.27.tgz
|
|
130
130
|
# DSH 桌面端:
|
|
131
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.
|
|
131
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.27.tgz
|
|
132
132
|
|
|
133
133
|
# 或从 npm 安装已发布版本:
|
|
134
|
-
dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.
|
|
134
|
+
dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.27
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
安装完成后重启 dsh 或 DSH 桌面端,在模型选择器中选择 **OpenCode (plugin)** 或 **OpenCode Go (plugin)** 即可。
|
package/lib/client.js
CHANGED
|
@@ -153,6 +153,8 @@ window.__ModuleLoader__.load({
|
|
|
153
153
|
transportAuto: "Auto",
|
|
154
154
|
free: "FREE",
|
|
155
155
|
vision: "Image",
|
|
156
|
+
newModel: "NEW",
|
|
157
|
+
newModelHint: "Released within the last seven UTC days.",
|
|
156
158
|
sectionFree: "Free models",
|
|
157
159
|
sectionFreeHint: "No charge on any plan.",
|
|
158
160
|
sectionGo: "Go subscription",
|
|
@@ -379,6 +381,8 @@ window.__ModuleLoader__.load({
|
|
|
379
381
|
transportAuto: "自动",
|
|
380
382
|
free: "免费",
|
|
381
383
|
vision: "图片",
|
|
384
|
+
newModel: "NEW",
|
|
385
|
+
newModelHint: "最近七个 UTC 日内发布。",
|
|
382
386
|
sectionFree: "免费模型",
|
|
383
387
|
sectionFreeHint: "任何计划均不收费。",
|
|
384
388
|
sectionGo: "Go 订阅",
|
|
@@ -2158,6 +2162,11 @@ window.__ModuleLoader__.load({
|
|
|
2158
2162
|
title: t("legendFree"),
|
|
2159
2163
|
children: [" ", t("free")]
|
|
2160
2164
|
}) : null,
|
|
2165
|
+
model.isNew === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2166
|
+
className: "oc-badge oc-badge-ok",
|
|
2167
|
+
title: `${t("newModelHint")} ${model.releaseDate ?? ""}`,
|
|
2168
|
+
children: t("newModel")
|
|
2169
|
+
}) : null,
|
|
2161
2170
|
!model.free && hasPrice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2162
2171
|
className: "oc-badge",
|
|
2163
2172
|
title: t("legendPrice"),
|
package/lib/index.js
CHANGED
|
@@ -81,10 +81,10 @@ const DEFAULT_GO_API_BASE = "https://opencode.ai/inference/go";
|
|
|
81
81
|
const DEFAULT_GO_ZEN_BASE = "https://opencode.ai/zen/go/v1";
|
|
82
82
|
const DEFAULT_USAGE_URL = "https://opencode.ai/zen/go/v1/usage";
|
|
83
83
|
const DEFAULT_AUTH_ENTRY = "opencode-go";
|
|
84
|
-
const DEFAULT_USER_AGENT = "dsh-opencode-provider/0.5.
|
|
84
|
+
const DEFAULT_USER_AGENT = "dsh-opencode-provider/0.5.27";
|
|
85
85
|
const DEFAULT_CONTEXT_WINDOW = 262144;
|
|
86
86
|
const DEFAULT_MAX_TOKENS = 32768;
|
|
87
|
-
const DEFAULT_GENERATE_MAX_TOKENS =
|
|
87
|
+
const DEFAULT_GENERATE_MAX_TOKENS = 65536;
|
|
88
88
|
function markVolatile(schema) {
|
|
89
89
|
const mark = schema.volatile;
|
|
90
90
|
return typeof mark === "function" ? mark.call(schema) : schema;
|
|
@@ -1108,6 +1108,24 @@ function modelInGoPlan(id, config) {
|
|
|
1108
1108
|
if (GENERATED_MODELS[id] === void 0) return true;
|
|
1109
1109
|
return effectiveModel(id, config).free || limitsFor(id) !== void 0;
|
|
1110
1110
|
}
|
|
1111
|
+
function releaseDateOf(entry) {
|
|
1112
|
+
const raw = entry.release_date;
|
|
1113
|
+
if (typeof raw === "string" && raw !== "") {
|
|
1114
|
+
const parsed = Date.parse(raw.length === 10 ? `${raw}T00:00:00Z` : raw);
|
|
1115
|
+
if (Number.isFinite(parsed)) return new Date(parsed).toISOString().slice(0, 10);
|
|
1116
|
+
}
|
|
1117
|
+
if (typeof entry.created === "number" && Number.isFinite(entry.created)) return (/* @__PURE__ */ new Date(entry.created * 1e3)).toISOString().slice(0, 10);
|
|
1118
|
+
}
|
|
1119
|
+
/** Seven UTC calendar days, used by the picker's NEW badge. */
|
|
1120
|
+
function isNewRelease(date, now = Date.now()) {
|
|
1121
|
+
if (date === void 0) return false;
|
|
1122
|
+
const parsed = Date.parse(date.length === 10 ? `${date}T00:00:00Z` : date);
|
|
1123
|
+
return Number.isFinite(parsed) && parsed <= now && now - parsed < 6048e5;
|
|
1124
|
+
}
|
|
1125
|
+
/** Release date learned from the live catalog, if the gateway published it. */
|
|
1126
|
+
function catalogReleaseDate(provider, id, config) {
|
|
1127
|
+
return catalogCache.get(`${provider}|${modelsUrlFor(provider, config)}`)?.releaseDates[id];
|
|
1128
|
+
}
|
|
1111
1129
|
async function fetchLiveIds(provider, config, apiKey, fetchImpl) {
|
|
1112
1130
|
const url = modelsUrlFor(provider, config);
|
|
1113
1131
|
const cacheKey = `${provider}|${url}`;
|
|
@@ -1127,9 +1145,16 @@ async function fetchLiveIds(provider, config, apiKey, fetchImpl) {
|
|
|
1127
1145
|
const payload = await response.json();
|
|
1128
1146
|
const ids = Array.isArray(payload.data) ? payload.data.map((entry) => entry.id).filter((id) => typeof id === "string" && id !== "") : Object.keys(payload.models ?? {});
|
|
1129
1147
|
if (ids.length === 0) return void 0;
|
|
1148
|
+
const releaseDates = {};
|
|
1149
|
+
if (Array.isArray(payload.data)) for (const entry of payload.data) {
|
|
1150
|
+
if (typeof entry.id !== "string" || entry.id === "") continue;
|
|
1151
|
+
const date = releaseDateOf(entry);
|
|
1152
|
+
if (date !== void 0) releaseDates[entry.id] = date;
|
|
1153
|
+
}
|
|
1130
1154
|
catalogCache.set(cacheKey, {
|
|
1131
1155
|
at: Date.now(),
|
|
1132
|
-
ids
|
|
1156
|
+
ids,
|
|
1157
|
+
releaseDates
|
|
1133
1158
|
});
|
|
1134
1159
|
return ids;
|
|
1135
1160
|
} catch {
|
|
@@ -5030,7 +5055,9 @@ async function buildState(ctx, deps) {
|
|
|
5030
5055
|
limits: limitsFor(model.id) ?? null,
|
|
5031
5056
|
input: meta.input,
|
|
5032
5057
|
reasoning: meta.reasoning,
|
|
5033
|
-
visible: modelVisible(model.id, config)
|
|
5058
|
+
visible: modelVisible(model.id, config),
|
|
5059
|
+
...catalogReleaseDate("opencode-go-direct", model.id, config) === void 0 ? {} : { releaseDate: catalogReleaseDate(GO_PROVIDER, model.id, config) },
|
|
5060
|
+
isNew: isNewRelease(catalogReleaseDate(GO_PROVIDER, model.id, config))
|
|
5034
5061
|
};
|
|
5035
5062
|
});
|
|
5036
5063
|
} catch {
|