utilitas 2001.1.71 → 2001.1.72

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/lib/alan.mjs CHANGED
@@ -54,7 +54,7 @@ const [
54
54
  GEMINI_30_PRO, GEMINI_25_FLASH, IMAGEN_4_ULTRA, VEO_31, IMAGEN_4_UPSCALE,
55
55
  ERROR_GENERATING, GEMINI_25_FLASH_TTS, GEMINI_25_PRO_TTS, wav,
56
56
  GPT_4O_MIMI_TTS, GPT_4O_TRANSCRIBE, INVALID_AUDIO, OGG_EXT, ELLIPSIS,
57
- TOP_LIMIT, ATTACHMENT, PROCESSING, CURSOR, LN1, LN2, TOP
57
+ TOP_LIMIT, ATTACHMENT, PROCESSING, CURSOR, LN1, LN2, TOP, DEEPSEEK
58
58
  ] = [
59
59
  'OpenAI', 'Google', 'Ollama', 'nova', 'deepseek-3.2-speciale', '```',
60
60
  'claude-opus-4.5', 'audio', 'wav', 'OPENAI_VOICE', 'medium', 'think',
@@ -73,7 +73,7 @@ const [
73
73
  'gemini-2.5-flash-preview-tts', 'gemini-2.5-pro-tts', 'wav',
74
74
  'gpt-4o-mini-tts', 'gpt-4o-transcribe', 'Invalid audio data.', 'ogg',
75
75
  '...', 3, 'ATTACHMENT', { processing: true }, ' █', '\n\n', '\n\n\n',
76
- 'top',
76
+ 'top', 'DeepSeek',
77
77
  ];
78
78
 
79
79
  const [joinL1, joinL2]
@@ -91,14 +91,24 @@ const log = (cnt, opt) => _log(cnt, import.meta.url, { time: 1, ...opt || {} });
91
91
  const assertPrompt = content => assert(content.length, PROMPT_IS_REQUIRED);
92
92
  const countToolCalls = r => r?.split('\n').filter(x => x === TOOLS_STR).length;
93
93
  const assertApiKey = (p, o) => assert(o?.apiKey, `${p} api key is required.`);
94
- const getProviderIcon = provider => PROVIDER_ICONS[provider] || '🔮';
95
94
  const libOpenAi = async opts => await need('openai', { ...opts, raw: true });
96
95
  const caption = (item, i, model) => ({ ...item, caption: `${i} by ${model}` });
97
96
  const m = x => k(k(x));
98
97
  const [MAX_TOKENS, ATTACHMENT_TOKEN_COST] = [m(1), k(10)];
99
98
 
99
+ const MODEL_ICONS = {
100
+ [OPENROUTER]: '🔀', [OPENAI]: '⚛️', [JINA]: '✴️', [GOOGLE]: '♊️',
101
+ [OLLAMA]: '🦙', [ANTHROPIC]: '✳️', [SILICONFLOW]: '🧬', [DEEPSEEK]: '🐬',
102
+ };
103
+
104
+ const FEATURE_ICONS = {
105
+ audio: '🔊', deepsearch: '🔍', fast: '⚡️', finetune: '🔧', hearing: '👂',
106
+ hidden: '🙈', image: '🎨', json: '📊', reasoning: '🧠', tools: '🧰',
107
+ video: '🎬', vision: '👁️',
108
+ };
109
+
100
110
  const GEMINI_RULES = {
101
- source: GOOGLE, icon: '♊️', contextWindow: m(1), maxOutputTokens: k(64),
111
+ source: GOOGLE, contextWindow: m(1), maxOutputTokens: k(64),
102
112
  hearing: true, json: true, reasoning: true, tools: true, vision: true,
103
113
  supportedMimeTypes: [
104
114
  MIME_PNG, MIME_JPEG, MIME_MOV, MIME_MPEG, MIME_MP4, MIME_MPG, MIME_AVI,
@@ -109,7 +119,7 @@ const GEMINI_RULES = {
109
119
  };
110
120
 
111
121
  const OPENAI_RULES = {
112
- source: OPENAI, icon: '⚛️', contextWindow: k(400), maxOutputTokens: k(128),
122
+ source: OPENAI, contextWindow: k(400), maxOutputTokens: k(128),
113
123
  hearing: true, json: true, reasoning: true, tools: true, vision: true,
114
124
  supportedMimeTypes: [
115
125
  MIME_PNG, MIME_JPEG, MIME_GIF, MIME_WEBP, MIME_PDF, MIME_WAV
@@ -117,7 +127,7 @@ const OPENAI_RULES = {
117
127
  };
118
128
 
119
129
  const DEEPSEEK_32_RULES = {
120
- icon: '🐬', contextWindow: k(163.8), maxOutputTokens: k(65.5),
130
+ source: DEEPSEEK, contextWindow: k(163.8), maxOutputTokens: k(65.5),
121
131
  json: true, tools: true, reasoning: true,
122
132
  };
123
133
 
@@ -148,13 +158,12 @@ const MODELS = {
148
158
  supportedMimeTypes: [MIME_PNG, MIME_JPEG], defaultProvider: GOOGLE,
149
159
  },
150
160
  [GPT_5_IMAGE]: {
151
- ...OPENAI_RULES, icon: '🎨', label: 'gpt-image-1', image: true,
161
+ ...OPENAI_RULES, label: 'gpt-image-1', image: true,
152
162
  },
153
163
  // models with code capabilities
154
164
  [GPT_51_CODEX]: { ...OPENAI_RULES },
155
165
  [CLOUD_OPUS_45]: {
156
- source: ANTHROPIC, icon: '✳️',
157
- contextWindow: k(200), maxOutputTokens: k(64),
166
+ source: ANTHROPIC, contextWindow: k(200), maxOutputTokens: k(64),
158
167
  json: true, reasoning: true, tools: true, vision: true,
159
168
  supportedMimeTypes: [
160
169
  MIME_TEXT, MIME_PNG, MIME_JPEG, MIME_GIF, MIME_WEBP, MIME_PDF,
@@ -179,7 +188,7 @@ const MODELS = {
179
188
  },
180
189
  // models with deepsearch capabilities
181
190
  [JINA_DEEPSEARCH]: { // @todo: parse more details from results, eg: "reed urls".
182
- icon: '✴️', maxInputTokens: Infinity, attachmentTokenCost: 0,
191
+ maxInputTokens: Infinity, attachmentTokenCost: 0,
183
192
  deepsearch: true, json: true, reasoning: true, vision: true,
184
193
  supportedMimeTypes: [MIME_PNG, MIME_JPEG, MIME_TEXT, MIME_WEBP, MIME_PDF],
185
194
  defaultProvider: JINA,
@@ -189,7 +198,7 @@ const MODELS = {
189
198
  [SF_DEEPSEEK_32]: { ...DEEPSEEK_32_RULES, defaultProvider: SILICONFLOW },
190
199
  // best local model
191
200
  [GEMMA_3_27B]: {
192
- icon: '❇️', contextWindow: k(128), maxOutputTokens: k(8),
201
+ source: GOOGLE, contextWindow: k(128), maxOutputTokens: k(8),
193
202
  fast: true, json: true, vision: true,
194
203
  supportedMimeTypes: [MIME_PNG, MIME_JPEG, MIME_GIF],
195
204
  defaultProvider: OLLAMA,
@@ -257,18 +266,6 @@ const DEFAULT_MODELS = {
257
266
  [OPENAI_VOICE]: NOVA,
258
267
  };
259
268
 
260
- const PROVIDER_ICONS = {
261
- [OPENROUTER]: '🔀', [OPENAI]: '⚛️', [JINA]: '✴️', [GOOGLE]: '♊️',
262
- [OLLAMA]: '🦙', [ANTHROPIC]: '✳️', [SILICONFLOW]: '🧬',
263
- };
264
-
265
- const FEATURE_ICONS = {
266
- audio: '📣', deepsearch: '🔍', fast: '⚡️', finetune: '🔧', hearing: '👂',
267
- hidden: '🙈', image: '🎨', json: '📊', reasoning: '🧠', tools: '🧰',
268
- video: '🎬', vision: '👁️',
269
- };
270
-
271
-
272
269
  let _tools;
273
270
 
274
271
  const unifyProvider = provider => {
@@ -367,6 +364,9 @@ const buildAiName = (provider, model) => packModelId([
367
364
  model.label || model.name
368
365
  ]);
369
366
 
367
+ const getIcon = ai => ai.model?.icon
368
+ || MODEL_ICONS[ai.model.source || ai.provider] || '🔮';
369
+
370
370
  const buildAiFeatures = model => Object.entries(FEATURE_ICONS).map(
371
371
  x => model[x[0]] ? x[1] : ''
372
372
  ).join('');
@@ -378,7 +378,7 @@ const setupAi = ai => {
378
378
  }
379
379
  assert(id, `Failed to generate a unique AI ID for ${ai.provider}:${ai.model.name}.`);
380
380
  const name = buildAiName(ai.provider, ai.model);
381
- const icon = ai.model?.icon || getProviderIcon(ai.provider);
381
+ const icon = getIcon(ai);
382
382
  const features = buildAiFeatures(ai.model);
383
383
  ais.push({
384
384
  id, icon, name, features, label: `${icon} ${name} (${features})`,
@@ -1276,9 +1276,9 @@ const talk = async (request, options = {}) => {
1276
1276
  spoken: renderText(Object.values(msgs)[0]?.text || '', {
1277
1277
  noCode: true, noLink: true,
1278
1278
  }).replace(/\[\^\d\^\]/ig, ''),
1279
- audios: Object.values(msgs).map(x => x.audio && caption(x.audio, SOUND_ICON, x.model)).filter(x => x),
1280
- images: Object.values(msgs).map(x => (x.images || []).map(y => caption(y, '🎨', x.model))).flat(),
1281
- videos: Object.values(msgs).map(x => (x.videos || []).map(y => caption(y, '🎬', x.model))).flat(),
1279
+ audios: Object.values(msgs).map(x => x.audio && caption(x.audio, FEATURE_ICONS.audio, x.model)).filter(x => x),
1280
+ images: Object.values(msgs).map(x => (x.images || []).map(y => caption(y, FEATURE_ICONS.image, x.model))).flat(),
1281
+ videos: Object.values(msgs).map(x => (x.videos || []).map(y => caption(y, FEATURE_ICONS.video, x.model))).flat(),
1282
1282
  annotations: Object.values(msgs).map(x => x.annotations || []).flat(),
1283
1283
  models: Object.values(msgs).map(n => n.model),
1284
1284
  });
@@ -1322,7 +1322,7 @@ const talk = async (request, options = {}) => {
1322
1322
  const ttsAi = await getAi(null, { select: { audio: true, fast: true } });
1323
1323
  await multiStream(ttsAi.id, {
1324
1324
  ...await tts(response, { aiId: ttsAi.id, raw: true }),
1325
- text: SOUND_ICON, hidden: true,
1325
+ text: FEATURE_ICONS.audio, hidden: true,
1326
1326
  }, { processing: true });
1327
1327
  }, LOG);
1328
1328
  }
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "2001.1.71",
4
+ "version": "2001.1.72",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "2001.1.71",
4
+ "version": "2001.1.72",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",