opencode-magpie-plugin 0.4.0 → 0.4.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/README.md +8 -0
- package/dist/index.mjs +12 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -223,6 +223,14 @@ MAGPIE_ADDR=127.0.0.1:3426 opencode --standalone
|
|
|
223
223
|
|
|
224
224
|
models.dev 缓存写入 `$XDG_CACHE_HOME/opencode-magpie-plugin/models.json`(默认 `~/.cache/opencode-magpie-plugin/models.json`)。首次可只读复用 Magpie、OpenCode 的 `models.json`;下载只写插件自己的目录。每次模型刷新检查缓存,超过 24 小时后台更新,缺价时可提前到 6 小时;同进程下载去重且失败后至少间隔 6 小时重试。首次下载和更新不阻塞模型发现,成功后下一次 30 秒刷新采用新目录;离线保留旧缓存。下载源为 `https://models.dev/api.json`,仍然零运行时依赖,基础价和 context 阶梯价一并传给 OpenCode。
|
|
225
225
|
|
|
226
|
+
### 0.4.2
|
|
227
|
+
|
|
228
|
+
- 修正远端网关下路由组(`auto` / `group`)的 provider 显示名:不再显示为 "routing group",改为 "Magpie"。
|
|
229
|
+
|
|
230
|
+
### 0.4.1
|
|
231
|
+
|
|
232
|
+
- 生图 skill 增加回退规则:某模型不可用(额度、积分、不支持的尺寸等)时不重试原模型,改用 `image_list` 中其他模型(优先换 provider),最多尝试三个模型。
|
|
233
|
+
|
|
226
234
|
### 0.4.0
|
|
227
235
|
|
|
228
236
|
- 新增生图能力:插件注册 `magpie.image_list`(列出 Magpie 可用的生图模型)和 `magpie.image_gen`(经 Magpie `/v1/images/generations` 出图,结果以 `` 返回),以及 skill `magpie-image-generate`。生图前由 Agent 加载该 skill。
|
package/dist/index.mjs
CHANGED
|
@@ -321,14 +321,20 @@ const nestedProvider = (row) => {
|
|
|
321
321
|
const slash = remainder.indexOf("/");
|
|
322
322
|
if (slash <= 0 || slash === remainder.length - 1) return;
|
|
323
323
|
const source = remainder.slice(0, slash);
|
|
324
|
+
const routing = source === "auto" || source === "group";
|
|
325
|
+
const parts = row.magpie_label?.split(" · ") ?? [];
|
|
326
|
+
if (routing) return {
|
|
327
|
+
id: `${row.owned_by}/${source}`,
|
|
328
|
+
name: parts.length === 3 ? `Magpie · ${parts[2]}` : `Magpie · ${providerName(row)}`
|
|
329
|
+
};
|
|
324
330
|
const label = providerName(row);
|
|
325
|
-
const sourceName =
|
|
331
|
+
const sourceName = providerName({
|
|
326
332
|
id: source,
|
|
327
333
|
owned_by: source
|
|
328
334
|
});
|
|
329
335
|
return {
|
|
330
336
|
id: `${row.owned_by}/${source}`,
|
|
331
|
-
name:
|
|
337
|
+
name: parts.length === 3 ? label : `${sourceName} · ${label}`
|
|
332
338
|
};
|
|
333
339
|
};
|
|
334
340
|
/** Magpie writes context windows as `Claude Opus 5.5 @ 1m`. The picker shows `@1m`. */
|
|
@@ -827,10 +833,11 @@ const SKILL = [
|
|
|
827
833
|
" Some models take only an exact `WIDTHxHEIGHT` such as `1024x1024`: after a size error, retry with that.",
|
|
828
834
|
" Done when the prompt is non-empty.",
|
|
829
835
|
"3. Call `image_gen` once. It waits until the image is saved, which can take minutes, and returns a Markdown image ``.",
|
|
830
|
-
"
|
|
831
|
-
"
|
|
836
|
+
" If it fails because that model is unavailable (quota, credits, a reset time, not served, unsupported size), do not retry it: call `image_list`, pick another model, preferably from another provider, and call `image_gen` again. Try at most three models.",
|
|
837
|
+
" Done when you have a Markdown image line, or every tried model has failed.",
|
|
838
|
+
"4. Put the Markdown image in your reply body as it is, and name the model that drew it. Copy the file into the project with the shell when the user wants it there. If every model failed, tell the user each failure as written, including any reset time.",
|
|
832
839
|
"",
|
|
833
|
-
"Each image spends the user’s credits: generate
|
|
840
|
+
"Each image spends the user’s credits: after a success, generate again only if the user asks."
|
|
834
841
|
].join("\n");
|
|
835
842
|
const registerImageSkill = (editor, path) => {
|
|
836
843
|
editor.add({
|
package/package.json
CHANGED