opencode-magpie-plugin 0.2.2 → 0.2.3

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
@@ -71,7 +71,7 @@ opencode service restart
71
71
 
72
72
  ### Provider 名称与模型 ID
73
73
 
74
- 显示名与 Magpie 保持一致,内部 ID 则使用命名空间,避免覆盖另一个 Cursor / WorkBuddy 插件:
74
+ 显示名与 Magpie 保持一致,只去掉上下文窗口前的空格(`Claude Opus 5.5 @ 1m` 显示为 `Claude Opus 5.5 @1m`)。模型 ID 不变。内部 ID 使用命名空间,避免覆盖另一个 Cursor / WorkBuddy 插件:
75
75
 
76
76
  | OpenCode 中的显示名 | 内部 provider ID | 示例模型引用 | 发给 Magpie 的 model |
77
77
  | --- | --- | --- | --- |
package/dist/index.mjs CHANGED
@@ -313,6 +313,8 @@ const providerName = (model) => {
313
313
  workbuddy: "WorkBuddy"
314
314
  }[model.owned_by] ?? model.owned_by;
315
315
  };
316
+ /** Magpie writes context windows as `Claude Opus 5.5 @ 1m`. The picker shows `@1m`. */
317
+ const displayName = (name) => name.replace(/@\s+(\d+(?:k|m))/gi, "@$1");
316
318
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
317
319
  const invalidOptions = (path, reason) => /* @__PURE__ */ new Error(`Magpie 插件的 options 无效(opencode.jsonc → plugins → ${path}):${reason}。`);
318
320
  const requiredString = (value, path) => {
@@ -402,7 +404,7 @@ const buildInventory = (rows, baseURL, options = {}) => {
402
404
  const { cost } = modelCost(row, group, options.catalog);
403
405
  const model = toClassicModelInfo(providerID, modelID, {
404
406
  id: row.id,
405
- name: row.display_name ?? modelID,
407
+ name: displayName(row.display_name ?? modelID),
406
408
  cost,
407
409
  limit: {
408
410
  context: row.context_window || 128e3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magpie-plugin",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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",