opencode-magpie-plugin 0.4.0 → 0.4.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.
package/README.md CHANGED
@@ -223,6 +223,10 @@ 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.1
227
+
228
+ - 生图 skill 增加回退规则:某模型不可用(额度、积分、不支持的尺寸等)时不重试原模型,改用 `image_list` 中其他模型(优先换 provider),最多尝试三个模型。
229
+
226
230
  ### 0.4.0
227
231
 
228
232
  - 新增生图能力:插件注册 `magpie.image_list`(列出 Magpie 可用的生图模型)和 `magpie.image_gen`(经 Magpie `/v1/images/generations` 出图,结果以 `![image](路径)` 返回),以及 skill `magpie-image-generate`。生图前由 Agent 加载该 skill。
package/dist/index.mjs CHANGED
@@ -827,10 +827,11 @@ const SKILL = [
827
827
  " Some models take only an exact `WIDTHxHEIGHT` such as `1024x1024`: after a size error, retry with that.",
828
828
  " Done when the prompt is non-empty.",
829
829
  "3. Call `image_gen` once. It waits until the image is saved, which can take minutes, and returns a Markdown image `![image](<path>)`.",
830
- " Done when you have that line.",
831
- "4. Put the returned Markdown image in your reply body as it is. Copy the file into the project with the shell when the user wants it there. A failure message (quota, credits, a reset time) goes to the user as written.",
830
+ " 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.",
831
+ " Done when you have a Markdown image line, or every tried model has failed.",
832
+ "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
833
  "",
833
- "Each image spends the user’s credits: generate once per request."
834
+ "Each image spends the user’s credits: after a success, generate again only if the user asks."
834
835
  ].join("\n");
835
836
  const registerImageSkill = (editor, path) => {
836
837
  editor.add({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magpie-plugin",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Discover Magpie providers and models in OpenCode V2 with built-in pricing and automatic local gateway startup",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",