noosphere 0.3.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.
Files changed (71) hide show
  1. package/README.md +34 -14
  2. package/assets/logos/png/ai21.png +0 -0
  3. package/assets/logos/png/amazon.png +0 -0
  4. package/assets/logos/png/anthropic.png +0 -0
  5. package/assets/logos/png/baidu.png +0 -0
  6. package/assets/logos/png/bytedance.png +0 -0
  7. package/assets/logos/png/cerebras.png +0 -0
  8. package/assets/logos/png/cohere.png +0 -0
  9. package/assets/logos/png/comfyui.png +0 -0
  10. package/assets/logos/png/deepseek.png +0 -0
  11. package/assets/logos/png/fal.png +0 -0
  12. package/assets/logos/png/fireworks-ai.png +0 -0
  13. package/assets/logos/png/google.png +0 -0
  14. package/assets/logos/png/groq.png +0 -0
  15. package/assets/logos/png/huggingface.png +0 -0
  16. package/assets/logos/png/ibm.png +0 -0
  17. package/assets/logos/png/inflection.png +0 -0
  18. package/assets/logos/png/kokoro.png +0 -0
  19. package/assets/logos/png/meta.png +0 -0
  20. package/assets/logos/png/microsoft.png +0 -0
  21. package/assets/logos/png/minimax.png +0 -0
  22. package/assets/logos/png/mistral.png +0 -0
  23. package/assets/logos/png/nebius.png +0 -0
  24. package/assets/logos/png/novita.png +0 -0
  25. package/assets/logos/png/nvidia.png +0 -0
  26. package/assets/logos/png/ollama.png +0 -0
  27. package/assets/logos/png/openai.png +0 -0
  28. package/assets/logos/png/openrouter.png +0 -0
  29. package/assets/logos/png/perplexity.png +0 -0
  30. package/assets/logos/png/pi-ai.png +0 -0
  31. package/assets/logos/png/piper.png +0 -0
  32. package/assets/logos/png/qwen.png +0 -0
  33. package/assets/logos/png/replicate.png +0 -0
  34. package/assets/logos/png/sambanova.png +0 -0
  35. package/assets/logos/png/tencent.png +0 -0
  36. package/assets/logos/png/together.png +0 -0
  37. package/assets/logos/png/upstage.png +0 -0
  38. package/assets/logos/png/xai.png +0 -0
  39. package/assets/logos/png/xiaomi.png +0 -0
  40. package/assets/logos/png/zai.png +0 -0
  41. package/assets/logos/svg/amazon.svg +1 -0
  42. package/assets/logos/svg/anthropic.svg +1 -0
  43. package/assets/logos/svg/baidu.svg +1 -0
  44. package/assets/logos/svg/cerebras.svg +1 -0
  45. package/assets/logos/svg/cohere.svg +1 -0
  46. package/assets/logos/svg/deepseek.svg +1 -0
  47. package/assets/logos/svg/fireworks-ai.svg +9 -0
  48. package/assets/logos/svg/google.svg +1 -0
  49. package/assets/logos/svg/groq.svg +1 -0
  50. package/assets/logos/svg/huggingface.svg +67 -0
  51. package/assets/logos/svg/meta.svg +1 -0
  52. package/assets/logos/svg/microsoft.svg +1 -0
  53. package/assets/logos/svg/mistral.svg +1 -0
  54. package/assets/logos/svg/nebius.svg +4 -0
  55. package/assets/logos/svg/novita.svg +11 -0
  56. package/assets/logos/svg/nvidia.svg +1 -0
  57. package/assets/logos/svg/ollama.svg +7 -0
  58. package/assets/logos/svg/openai.svg +1 -0
  59. package/assets/logos/svg/openrouter.svg +21 -0
  60. package/assets/logos/svg/perplexity.svg +24 -0
  61. package/assets/logos/svg/qwen.svg +1 -0
  62. package/assets/logos/svg/replicate.svg +12 -0
  63. package/assets/logos/svg/together.svg +1 -0
  64. package/assets/logos/svg/xai.svg +1 -0
  65. package/dist/index.cjs +139 -122
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.d.cts +10 -6
  68. package/dist/index.d.ts +10 -6
  69. package/dist/index.js +136 -122
  70. package/dist/index.js.map +1 -1
  71. package/package.json +2 -1
package/dist/index.cjs CHANGED
@@ -22,7 +22,9 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  Noosphere: () => Noosphere,
24
24
  NoosphereError: () => NoosphereError,
25
+ PROVIDER_IDS: () => PROVIDER_IDS,
25
26
  PROVIDER_LOGOS: () => PROVIDER_LOGOS,
27
+ getAllProviderLogos: () => getAllProviderLogos,
26
28
  getProviderLogo: () => getProviderLogo
27
29
  });
28
30
  module.exports = __toCommonJS(index_exports);
@@ -131,130 +133,130 @@ function resolveConfig(input) {
131
133
  }
132
134
 
133
135
  // src/logos.ts
134
- var PROVIDER_LOGOS = {
135
- // --- Cloud LLM Providers ---
136
- openai: {
137
- svg: "https://cdn.simpleicons.org/openai",
138
- png: "https://cdn.brandfetch.io/idR3duQxYl/w/512/h/512/theme/dark/icon.png"
139
- },
140
- anthropic: {
141
- svg: "https://cdn.simpleicons.org/anthropic",
142
- png: "https://cdn.brandfetch.io/id2S-kXbuM/w/512/h/512/theme/dark/icon.png"
143
- },
144
- google: {
145
- svg: "https://cdn.simpleicons.org/google",
146
- png: "https://cdn.brandfetch.io/id6O2oGzv-/w/512/h/512/theme/dark/icon.png"
147
- },
148
- groq: {
149
- svg: "https://cdn.simpleicons.org/groq",
150
- png: "https://cdn.brandfetch.io/idTEBPz5KO/w/512/h/512/theme/dark/icon.png"
151
- },
152
- mistral: {
153
- svg: "https://cdn.simpleicons.org/mistral",
154
- png: "https://cdn.brandfetch.io/idnBOFq5eF/w/512/h/512/theme/dark/icon.png"
155
- },
156
- xai: {
157
- svg: "https://cdn.simpleicons.org/x",
158
- png: "https://cdn.brandfetch.io/idS5WhqBbM/w/512/h/512/theme/dark/icon.png"
159
- },
160
- openrouter: {
161
- svg: "https://openrouter.ai/favicon.svg",
162
- png: "https://openrouter.ai/favicon.png"
163
- },
164
- cerebras: {
165
- svg: "https://cdn.simpleicons.org/cerebras",
166
- png: "https://cdn.brandfetch.io/idGa4PRFP0/w/512/h/512/theme/dark/icon.png"
167
- },
168
- // --- Media Providers ---
169
- fal: {
170
- svg: "https://fal.ai/favicon.svg",
171
- png: "https://fal.ai/favicon.png"
172
- },
173
- huggingface: {
174
- svg: "https://cdn.simpleicons.org/huggingface",
175
- png: "https://cdn.brandfetch.io/idnrPPHe87/w/512/h/512/theme/dark/icon.png"
176
- },
177
- // --- Local Providers ---
178
- comfyui: {
179
- svg: "https://raw.githubusercontent.com/comfyanonymous/ComfyUI/master/web/assets/icon.svg",
180
- png: "https://raw.githubusercontent.com/comfyanonymous/ComfyUI/master/web/assets/icon.png"
181
- },
182
- piper: {
183
- png: "https://raw.githubusercontent.com/rhasspy/piper/master/logo.png"
184
- },
185
- kokoro: {
186
- png: "https://raw.githubusercontent.com/hexgrad/kokoro/main/assets/icon.png"
187
- },
188
- ollama: {
189
- svg: "https://cdn.simpleicons.org/ollama",
190
- png: "https://cdn.brandfetch.io/idtesMoSFj/w/512/h/512/theme/dark/icon.png"
191
- },
192
- // --- Model Org Providers (from OpenRouter model prefixes) ---
193
- meta: {
194
- svg: "https://cdn.simpleicons.org/meta",
195
- png: "https://cdn.brandfetch.io/idmKk_rq7Y/w/512/h/512/theme/dark/icon.png"
196
- },
197
- deepseek: {
198
- png: "https://cdn.brandfetch.io/id1BWKUVWI/w/512/h/512/theme/dark/icon.png"
199
- },
200
- microsoft: {
201
- svg: "https://cdn.simpleicons.org/microsoft",
202
- png: "https://cdn.brandfetch.io/idchmboHEZ/w/512/h/512/theme/dark/icon.png"
203
- },
204
- nvidia: {
205
- svg: "https://cdn.simpleicons.org/nvidia",
206
- png: "https://cdn.brandfetch.io/id1JcGHuZN/w/512/h/512/theme/dark/icon.png"
207
- },
208
- qwen: {
209
- png: "https://img.alicdn.com/imgextra/i1/O1CN01BUp2gU1sRZigvazUo_!!6000000005764-2-tps-228-228.png"
210
- },
211
- cohere: {
212
- svg: "https://cdn.simpleicons.org/cohere",
213
- png: "https://cdn.brandfetch.io/idiDnz1fvB/w/512/h/512/theme/dark/icon.png"
214
- },
215
- perplexity: {
216
- svg: "https://cdn.simpleicons.org/perplexity",
217
- png: "https://cdn.brandfetch.io/idwWX3Neii/w/512/h/512/theme/dark/icon.png"
218
- },
219
- amazon: {
220
- svg: "https://cdn.simpleicons.org/amazonaws",
221
- png: "https://cdn.brandfetch.io/idawORoPJZ/w/512/h/512/theme/dark/icon.png"
222
- },
223
- // --- HuggingFace Inference Providers ---
224
- "hf-inference": {
225
- svg: "https://cdn.simpleicons.org/huggingface",
226
- png: "https://cdn.brandfetch.io/idnrPPHe87/w/512/h/512/theme/dark/icon.png"
227
- },
228
- "sambanova": {
229
- png: "https://cdn.brandfetch.io/id__2e5yMY/w/512/h/512/theme/dark/icon.png"
230
- },
231
- "together": {
232
- svg: "https://cdn.simpleicons.org/togetherai",
233
- png: "https://cdn.brandfetch.io/idH5EoFVaH/w/512/h/512/theme/dark/icon.png"
234
- },
235
- "fireworks-ai": {
236
- png: "https://cdn.brandfetch.io/idj1VQ2O4C/w/512/h/512/theme/dark/icon.png"
237
- },
238
- "replicate": {
239
- svg: "https://cdn.simpleicons.org/replicate",
240
- png: "https://cdn.brandfetch.io/idWKE4rRaH/w/512/h/512/theme/dark/icon.png"
241
- },
242
- "nebius": {
243
- png: "https://cdn.brandfetch.io/idiUqSQ52b/w/512/h/512/theme/dark/icon.png"
244
- },
245
- "novita": {
246
- png: "https://novita.ai/favicon.png"
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");
247
148
  }
248
- };
149
+ return _assetsDir;
150
+ }
151
+ var PROVIDER_IDS = [
152
+ // Cloud LLM
153
+ "openai",
154
+ "anthropic",
155
+ "google",
156
+ "groq",
157
+ "mistral",
158
+ "xai",
159
+ "openrouter",
160
+ "cerebras",
161
+ "pi-ai",
162
+ // Media
163
+ "fal",
164
+ "huggingface",
165
+ // Local
166
+ "comfyui",
167
+ "piper",
168
+ "kokoro",
169
+ "ollama",
170
+ // Model orgs (from OpenRouter prefixes)
171
+ "meta",
172
+ "deepseek",
173
+ "microsoft",
174
+ "nvidia",
175
+ "qwen",
176
+ "cohere",
177
+ "perplexity",
178
+ "amazon",
179
+ // Additional model orgs
180
+ "zai",
181
+ "minimax",
182
+ "baidu",
183
+ "bytedance",
184
+ "tencent",
185
+ "xiaomi",
186
+ "ibm",
187
+ "ai21",
188
+ "inflection",
189
+ "upstage",
190
+ // HuggingFace inference providers
191
+ "sambanova",
192
+ "together",
193
+ "fireworks-ai",
194
+ "replicate",
195
+ "nebius",
196
+ "novita"
197
+ ];
198
+ var _cache = /* @__PURE__ */ new Map();
249
199
  function getProviderLogo(providerId) {
250
200
  if (!providerId) return void 0;
251
- if (PROVIDER_LOGOS[providerId]) return PROVIDER_LOGOS[providerId];
201
+ const cached = _cache.get(providerId);
202
+ if (cached) return cached;
252
203
  const normalized = providerId.toLowerCase().replace(/[-_\s]/g, "");
253
- for (const [key, logo] of Object.entries(PROVIDER_LOGOS)) {
254
- if (key.replace(/[-_\s]/g, "") === normalized) return logo;
204
+ let matchedId = null;
205
+ for (const id of PROVIDER_IDS) {
206
+ if (id === providerId) {
207
+ matchedId = id;
208
+ break;
209
+ }
255
210
  }
256
- return void 0;
211
+ if (!matchedId) {
212
+ for (const id of PROVIDER_IDS) {
213
+ if (id.replace(/[-_\s]/g, "") === normalized) {
214
+ matchedId = id;
215
+ break;
216
+ }
217
+ }
218
+ }
219
+ 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;
227
+ _cache.set(providerId, logo);
228
+ return logo;
257
229
  }
230
+ function getAllProviderLogos() {
231
+ const result = {};
232
+ for (const id of PROVIDER_IDS) {
233
+ const logo = getProviderLogo(id);
234
+ if (logo) result[id] = logo;
235
+ }
236
+ return result;
237
+ }
238
+ var _allLogos = null;
239
+ var PROVIDER_LOGOS = new Proxy({}, {
240
+ get(_, prop) {
241
+ if (!_allLogos) _allLogos = getAllProviderLogos();
242
+ return _allLogos[prop];
243
+ },
244
+ ownKeys() {
245
+ if (!_allLogos) _allLogos = getAllProviderLogos();
246
+ return Object.keys(_allLogos);
247
+ },
248
+ getOwnPropertyDescriptor(_, prop) {
249
+ if (!_allLogos) _allLogos = getAllProviderLogos();
250
+ if (prop in _allLogos) {
251
+ return { configurable: true, enumerable: true, value: _allLogos[prop] };
252
+ }
253
+ return void 0;
254
+ },
255
+ has(_, prop) {
256
+ if (!_allLogos) _allLogos = getAllProviderLogos();
257
+ return prop in _allLogos;
258
+ }
259
+ });
258
260
 
259
261
  // src/registry.ts
260
262
  var Registry = class {
@@ -624,8 +626,8 @@ var PiAiProvider = class {
624
626
  let aborted = false;
625
627
  let resolveResult = null;
626
628
  let rejectResult = null;
627
- const resultPromise = new Promise((resolve, reject) => {
628
- resolveResult = resolve;
629
+ const resultPromise = new Promise((resolve2, reject) => {
630
+ resolveResult = resolve2;
629
631
  rejectResult = reject;
630
632
  });
631
633
  const ensureModel = async () => {
@@ -792,7 +794,20 @@ var PiAiProvider = class {
792
794
  "qwen/": "qwen",
793
795
  "cohere/": "cohere",
794
796
  "perplexity/": "perplexity",
795
- "amazon/": "amazon"
797
+ "amazon/": "amazon",
798
+ "z-ai/": "zai",
799
+ "minimax/": "minimax",
800
+ "baidu/": "baidu",
801
+ "bytedance/": "bytedance",
802
+ "bytedance-seed/": "bytedance",
803
+ "tencent/": "tencent",
804
+ "xiaomi/": "xiaomi",
805
+ "ibm-granite/": "ibm",
806
+ "ibm/": "ibm",
807
+ "ai21/": "ai21",
808
+ "inflection/": "inflection",
809
+ "upstage/": "upstage",
810
+ "alibaba/": "qwen"
796
811
  };
797
812
  const lower = modelId.toLowerCase();
798
813
  for (const [prefix, provider] of Object.entries(MODEL_PREFIX_TO_PROVIDER)) {
@@ -1701,7 +1716,7 @@ var Noosphere = class {
1701
1716
  break;
1702
1717
  }
1703
1718
  const delay = backoffMs * Math.pow(2, attempt);
1704
- await new Promise((resolve) => setTimeout(resolve, delay));
1719
+ await new Promise((resolve2) => setTimeout(resolve2, delay));
1705
1720
  }
1706
1721
  }
1707
1722
  throw lastError ?? new NoosphereError("Generation failed", {
@@ -1745,7 +1760,9 @@ var Noosphere = class {
1745
1760
  0 && (module.exports = {
1746
1761
  Noosphere,
1747
1762
  NoosphereError,
1763
+ PROVIDER_IDS,
1748
1764
  PROVIDER_LOGOS,
1765
+ getAllProviderLogos,
1749
1766
  getProviderLogo
1750
1767
  });
1751
1768
  //# sourceMappingURL=index.cjs.map