noosphere 0.4.1 → 0.5.0

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.
Files changed (71) hide show
  1. package/README.md +11 -19
  2. package/dist/index.cjs +44 -25
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +1 -2
  5. package/dist/index.d.ts +1 -2
  6. package/dist/index.js +44 -24
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -2
  9. package/assets/logos/png/ai21.png +0 -0
  10. package/assets/logos/png/amazon.png +0 -0
  11. package/assets/logos/png/anthropic.png +0 -0
  12. package/assets/logos/png/baidu.png +0 -0
  13. package/assets/logos/png/bytedance.png +0 -0
  14. package/assets/logos/png/cerebras.png +0 -0
  15. package/assets/logos/png/cohere.png +0 -0
  16. package/assets/logos/png/comfyui.png +0 -0
  17. package/assets/logos/png/deepseek.png +0 -0
  18. package/assets/logos/png/fal.png +0 -0
  19. package/assets/logos/png/fireworks-ai.png +0 -0
  20. package/assets/logos/png/google.png +0 -0
  21. package/assets/logos/png/groq.png +0 -0
  22. package/assets/logos/png/huggingface.png +0 -0
  23. package/assets/logos/png/ibm.png +0 -0
  24. package/assets/logos/png/inflection.png +0 -0
  25. package/assets/logos/png/kokoro.png +0 -0
  26. package/assets/logos/png/meta.png +0 -0
  27. package/assets/logos/png/microsoft.png +0 -0
  28. package/assets/logos/png/minimax.png +0 -0
  29. package/assets/logos/png/mistral.png +0 -0
  30. package/assets/logos/png/nebius.png +0 -0
  31. package/assets/logos/png/novita.png +0 -0
  32. package/assets/logos/png/nvidia.png +0 -0
  33. package/assets/logos/png/ollama.png +0 -0
  34. package/assets/logos/png/openai.png +0 -0
  35. package/assets/logos/png/openrouter.png +0 -0
  36. package/assets/logos/png/perplexity.png +0 -0
  37. package/assets/logos/png/pi-ai.png +0 -0
  38. package/assets/logos/png/piper.png +0 -0
  39. package/assets/logos/png/qwen.png +0 -0
  40. package/assets/logos/png/replicate.png +0 -0
  41. package/assets/logos/png/sambanova.png +0 -0
  42. package/assets/logos/png/tencent.png +0 -0
  43. package/assets/logos/png/together.png +0 -0
  44. package/assets/logos/png/upstage.png +0 -0
  45. package/assets/logos/png/xai.png +0 -0
  46. package/assets/logos/png/xiaomi.png +0 -0
  47. package/assets/logos/png/zai.png +0 -0
  48. package/assets/logos/svg/amazon.svg +0 -1
  49. package/assets/logos/svg/anthropic.svg +0 -1
  50. package/assets/logos/svg/baidu.svg +0 -1
  51. package/assets/logos/svg/cerebras.svg +0 -1
  52. package/assets/logos/svg/cohere.svg +0 -1
  53. package/assets/logos/svg/deepseek.svg +0 -1
  54. package/assets/logos/svg/fireworks-ai.svg +0 -9
  55. package/assets/logos/svg/google.svg +0 -1
  56. package/assets/logos/svg/groq.svg +0 -1
  57. package/assets/logos/svg/huggingface.svg +0 -67
  58. package/assets/logos/svg/meta.svg +0 -1
  59. package/assets/logos/svg/microsoft.svg +0 -1
  60. package/assets/logos/svg/mistral.svg +0 -1
  61. package/assets/logos/svg/nebius.svg +0 -4
  62. package/assets/logos/svg/novita.svg +0 -11
  63. package/assets/logos/svg/nvidia.svg +0 -1
  64. package/assets/logos/svg/ollama.svg +0 -7
  65. package/assets/logos/svg/openai.svg +0 -1
  66. package/assets/logos/svg/openrouter.svg +0 -21
  67. package/assets/logos/svg/perplexity.svg +0 -24
  68. package/assets/logos/svg/qwen.svg +0 -1
  69. package/assets/logos/svg/replicate.svg +0 -12
  70. package/assets/logos/svg/together.svg +0 -1
  71. package/assets/logos/svg/xai.svg +0 -1
package/README.md CHANGED
@@ -65,29 +65,21 @@ Noosphere **automatically discovers the latest models from EVERY provider's API
65
65
 
66
66
  ### Provider Logos — SVG & PNG for Every Model
67
67
 
68
- Every model returned by the auto-fetch includes a `logo` field with **absolute file paths** to the provider's official logo bundled in the package — SVG (vector) and PNG (512×512). No CDN dependencies, no external requests. For aggregator providers (OpenRouter, HuggingFace), logos are resolved to the **real upstream provider** — so an `x-ai/grok-4` model gets the xAI logo, not OpenRouter's.
68
+ Every model returned by the auto-fetch includes a `logo` field with **CDN URLs** to the provider's official logo — SVG (vector) and PNG (512×512), hosted on DigitalOcean Spaces. For aggregator providers (OpenRouter, HuggingFace), logos are resolved to the **real upstream provider** — so an `x-ai/grok-4` model gets the xAI logo, not OpenRouter's.
69
69
 
70
70
  ```typescript
71
- import { readFileSync } from 'fs';
72
-
73
71
  const models = await ai.getModels('llm');
74
72
 
75
73
  for (const model of models) {
76
74
  console.log(model.id, model.logo);
77
- // "gpt-5" { svg: "/path/to/node_modules/noosphere/assets/logos/svg/openai.svg",
78
- // png: "/path/to/node_modules/noosphere/assets/logos/png/openai.png" }
79
- // "claude-opus-4-6" { svg: "/.../anthropic.svg", png: "/.../anthropic.png" }
80
- // "gemini-2.5-pro" { svg: "/.../google.svg", png: "/.../google.png" }
81
-
82
- // Read the file directly:
83
- const svgContent = readFileSync(model.logo.svg, 'utf-8');
84
- const pngBuffer = readFileSync(model.logo.png);
85
-
86
- // Serve in Express:
87
- // app.get('/logo/:provider.svg', (req, res) => res.sendFile(model.logo.svg));
75
+ // "gpt-5" { svg: "https://...cdn.../openai.svg", png: "https://...cdn.../openai.png" }
76
+ // "claude-opus-4-6" { svg: "https://...cdn.../anthropic.svg", png: "https://...cdn.../anthropic.png" }
77
+ // "gemini-2.5-pro" { svg: "https://...cdn.../google.svg", png: "https://...cdn.../google.png" }
78
+ }
88
79
 
89
- // Use in React (copy to public/):
90
- // <img src={`/logos/${model.provider}.svg`} alt={model.provider} />
80
+ // Use directly in your UI:
81
+ // <img src={model.logo.svg} alt={model.provider} />
82
+ // <img src={model.logo.png} width={48} height={48} />;
91
83
  }
92
84
 
93
85
  // Providers also have logos:
@@ -112,7 +104,7 @@ You can also import the logo registry directly:
112
104
  import { getProviderLogo, PROVIDER_LOGOS, getAllProviderLogos } from 'noosphere';
113
105
 
114
106
  const logo = getProviderLogo('anthropic');
115
- // { svg: "/abs/path/to/anthropic.svg", png: "/abs/path/to/anthropic.png" }
107
+ // { svg: "https://...cdn.../anthropic.svg", png: "https://...cdn.../anthropic.png" }
116
108
 
117
109
  // Get all logos as a map:
118
110
  const allLogos = getAllProviderLogos();
@@ -128,8 +120,8 @@ const qwen = hfModels.find(m => m.id === 'Qwen/Qwen2.5-72B-Instruct');
128
120
 
129
121
  console.log(qwen.capabilities.inferenceProviderLogos);
130
122
  // {
131
- // "together": { svg: "/.../together.svg", png: "/.../together.png" },
132
- // "fireworks-ai": { png: "/.../fireworks-ai.png" },
123
+ // "together": { svg: "https://...cdn.../together.svg", png: "https://...cdn.../together.png" },
124
+ // "fireworks-ai": { svg: "https://...cdn.../fireworks-ai.svg", png: "https://...cdn.../fireworks-ai.png" },
133
125
  // }
134
126
  ```
135
127
 
package/dist/index.cjs CHANGED
@@ -133,21 +133,7 @@ function resolveConfig(input) {
133
133
  }
134
134
 
135
135
  // src/logos.ts
136
- var import_url = require("url");
137
- var import_path = require("path");
138
- var import_fs = require("fs");
139
- var import_meta = {};
140
- var _assetsDir = null;
141
- function assetsDir() {
142
- if (_assetsDir) return _assetsDir;
143
- try {
144
- const __filename = (0, import_url.fileURLToPath)(import_meta.url);
145
- _assetsDir = (0, import_path.resolve)((0, import_path.dirname)(__filename), "..", "assets", "logos");
146
- } catch {
147
- _assetsDir = (0, import_path.resolve)(__dirname, "..", "assets", "logos");
148
- }
149
- return _assetsDir;
150
- }
136
+ var CDN_BASE = "https://blockchainstarter.nyc3.digitaloceanspaces.com/noosphere/logos";
151
137
  var PROVIDER_IDS = [
152
138
  // Cloud LLM
153
139
  "openai",
@@ -195,6 +181,40 @@ var PROVIDER_IDS = [
195
181
  "nebius",
196
182
  "novita"
197
183
  ];
184
+ var HAS_SVG = /* @__PURE__ */ new Set([
185
+ "openai",
186
+ "anthropic",
187
+ "google",
188
+ "groq",
189
+ "mistral",
190
+ "xai",
191
+ "openrouter",
192
+ "cerebras",
193
+ "huggingface",
194
+ "ollama",
195
+ "meta",
196
+ "deepseek",
197
+ "microsoft",
198
+ "nvidia",
199
+ "qwen",
200
+ "cohere",
201
+ "perplexity",
202
+ "amazon",
203
+ "baidu",
204
+ "together",
205
+ "fireworks-ai",
206
+ "replicate",
207
+ "nebius",
208
+ "novita",
209
+ "comfyui",
210
+ "fal",
211
+ "kokoro",
212
+ "piper",
213
+ "sambanova",
214
+ "pi-ai",
215
+ "zai"
216
+ // NO SVG: bytedance, tencent, xiaomi, ibm, ai21, inflection, upstage, minimax
217
+ ]);
198
218
  var _cache = /* @__PURE__ */ new Map();
199
219
  function getProviderLogo(providerId) {
200
220
  if (!providerId) return void 0;
@@ -217,13 +237,12 @@ function getProviderLogo(providerId) {
217
237
  }
218
238
  }
219
239
  if (!matchedId) return void 0;
220
- const dir = assetsDir();
221
- const svgPath = (0, import_path.join)(dir, "svg", `${matchedId}.svg`);
222
- const pngPath = (0, import_path.join)(dir, "png", `${matchedId}.png`);
223
- const logo = {};
224
- if ((0, import_fs.existsSync)(svgPath)) logo.svg = svgPath;
225
- if ((0, import_fs.existsSync)(pngPath)) logo.png = pngPath;
226
- if (!logo.svg && !logo.png) return void 0;
240
+ const logo = {
241
+ png: `${CDN_BASE}/png/${matchedId}.png`
242
+ };
243
+ if (HAS_SVG.has(matchedId)) {
244
+ logo.svg = `${CDN_BASE}/svg/${matchedId}.svg`;
245
+ }
227
246
  _cache.set(providerId, logo);
228
247
  return logo;
229
248
  }
@@ -626,8 +645,8 @@ var PiAiProvider = class {
626
645
  let aborted = false;
627
646
  let resolveResult = null;
628
647
  let rejectResult = null;
629
- const resultPromise = new Promise((resolve2, reject) => {
630
- resolveResult = resolve2;
648
+ const resultPromise = new Promise((resolve, reject) => {
649
+ resolveResult = resolve;
631
650
  rejectResult = reject;
632
651
  });
633
652
  const ensureModel = async () => {
@@ -1716,7 +1735,7 @@ var Noosphere = class {
1716
1735
  break;
1717
1736
  }
1718
1737
  const delay = backoffMs * Math.pow(2, attempt);
1719
- await new Promise((resolve2) => setTimeout(resolve2, delay));
1738
+ await new Promise((resolve) => setTimeout(resolve, delay));
1720
1739
  }
1721
1740
  }
1722
1741
  throw lastError ?? new NoosphereError("Generation failed", {