@evandu/super-pi 0.1.282 → 0.1.283

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.
@@ -1,4 +1,4 @@
1
1
  {
2
- "hash": "2bdbb5ce7a1ad39aac7ecf0f9059b4d53c0b46a6cf5641cf7cf0cfc5aec2c023",
3
- "recordedAt": "2026-11-22T16:04:00.590Z"
2
+ "hash": "976dcf011e624d6c55b8e0968db846f9d0f84fa9920b4b7020feb59a7ecc5a9d",
3
+ "recordedAt": "2026-11-23T06:10:36.872Z"
4
4
  }
@@ -111,5 +111,5 @@
111
111
  "src/client/workbench-navigation.ts": "3b229752a8ce4a45eba7aeff040eb33001413190141f1e9b8e5f38246a1761e2",
112
112
  "src/client/workbench-search-panel.css": "6978c03db4f17411e9064242b0ff786a520ee8cf58fe8a9d0ea42872ba3737f0"
113
113
  },
114
- "recordedAt": "2026-11-23T06:03:06.315Z"
114
+ "recordedAt": "2026-11-23T09:55:30.550Z"
115
115
  }
@@ -17,11 +17,20 @@ export default function modelPolicyExtension(pi) {
17
17
  const original = ctx.modelRegistry.getProvider(current.provider);
18
18
  if (!original)
19
19
  throw new Error("无法加载当前模型供应商的请求策略。");
20
- const models = (original.getAllModels?.() ?? original.getModels()).map((model) => typeof model.contextWindow === "number" ? normalize(model) : model);
21
- ctx.modelRegistry.registerProvider(current.provider, {
22
- name: original.name, baseUrl: original.baseUrl, api: current.api, ...ctx.modelRegistry.getRegisteredProviderConfig(current.provider), models,
23
- streamSimple: (model, context, options) => withModelRequestPolicy(normalize(model), options, routed => original.streamSimple(normalize(model), context, routed)),
24
- });
20
+ const models = (items) => items.map(model => typeof model.contextWindow === "number" ? normalize(model) : model);
21
+ // Decorate the native provider, including its auth resolver and dynamic catalog.
22
+ // Re-registering a legacy config silently discards managed and ambient auth.
23
+ const simple = (model, context, options) => withModelRequestPolicy(normalize(model), options, routed => original.streamSimple(normalize(model), context, routed));
24
+ ctx.modelRegistry.registerProvider(new Proxy(original, { get(target, key) {
25
+ if (key === "getModels")
26
+ return () => models(target.getModels());
27
+ if (key === "getAllModels")
28
+ return () => models(target.getAllModels?.() ?? target.getModels());
29
+ if (key === "streamSimple")
30
+ return simple;
31
+ const value = Reflect.get(target, key, target);
32
+ return typeof value === "function" ? value.bind(target) : value;
33
+ } }));
25
34
  installed.add(current.provider);
26
35
  }
27
36
  const next = normalize(ctx.modelRegistry.find(current.provider, current.id));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "superPi": {
4
4
  "managedDirectListener": true
5
5
  },
6
- "version": "0.1.282",
6
+ "version": "0.1.283",
7
7
  "description": "Web control plane and companion for Pi",
8
8
  "license": "MIT",
9
9
  "type": "module",