utilitas 2000.1.2 → 2000.2.4

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
@@ -51,9 +51,10 @@ const [
51
51
  GPT_51_CODEX, GPT_5_IMAGE, GEMMA_3_27B, ANTHROPIC, v8k, ais,
52
52
  MAX_TOOL_RECURSION, LOG, name, user, system, assistant, MODEL, JSON_OBJECT,
53
53
  tokenSafeRatio, CONTENT_IS_REQUIRED, OPENAI_HI_RES_SIZE, k, kT, m, minute,
54
- hour, gb, trimTailing, GEMINI_25_FLASH_IMAGE, IMAGE, JINA, JINA_DEEPSEARCH,
54
+ hour, gb, trimTailing, GEMINI_30_PRO_IMAGE, IMAGE, JINA, JINA_DEEPSEARCH,
55
55
  SILICONFLOW, SF_DEEPSEEK_R1, MAX_TIRE, OPENROUTER_API, OPENROUTER, AUTO,
56
- TOOL, S_OPENAI, S_GOOGLE, S_ANTHROPIC, ONLINE,
56
+ TOOL, S_OPENAI, S_GOOGLE, S_ANTHROPIC, ONLINE, GEMINI_30_PRO,
57
+ GEMINI_25_FLASH,
57
58
  ] = [
58
59
  'OpenAI', 'Gemini', 'Ollama', 'nova', 'deepseek-r1', '```',
59
60
  'claude-sonnet-4.5', 'audio', 'wav', '[ATTACHMENTS]', 'OPENAI_VOICE',
@@ -64,14 +65,13 @@ const [
64
65
  'json_object', 1.1, 'Content is required.', 2048 * 2048, x => 1024 * x,
65
66
  x => 1000 * x, x => 1024 * 1024 * x, x => 60 * x, x => 60 * 60 * x,
66
67
  x => 1024 * 1024 * 1024 * x, x => x.replace(/[\.\s]*$/, ''),
67
- 'gemini-2.5-flash-image', 'image', 'Jina', 'jina-deepsearch-v1',
68
+ 'gemini-3-pro-image-preview', 'image', 'Jina', 'jina-deepsearch-v1',
68
69
  'SiliconFlow', 'Pro/deepseek-ai/DeepSeek-R1', 768 * 768,
69
70
  'https://openrouter.ai/api/v1', 'OpenRouter', 'openrouter/auto', 'tool',
70
- 'openai', 'google', 'anthropic', ':online',
71
+ 'openai', 'google', 'anthropic', ':online', 'gemini-3-pro-preview',
72
+ 'gemini-2.5-flash-preview-09-2025',
71
73
  ];
72
74
 
73
- const [GEMINI_25_FLASH, GEMINI_30_PRO]
74
- = [`gemini-2.5-flash${ONLINE}`, `gemini-3-pro-preview${ONLINE}`];
75
75
  const [tool, messages, text]
76
76
  = [type => ({ type }), messages => ({ messages }), text => ({ text })];
77
77
  const [CODE_INTERPRETER, RETRIEVAL, FUNCTION]
@@ -143,7 +143,7 @@ const MODELS = {
143
143
  reasoning: true, tools: true,
144
144
  },
145
145
  // models with unique capabilities
146
- [GEMINI_25_FLASH_IMAGE]: {
146
+ [GEMINI_30_PRO_IMAGE]: {
147
147
  ...GEMINI_RULES, icon: '🍌', label: 'Nano Banana',
148
148
  contextWindow: k(64), maxOutputTokens: k(32),
149
149
  fast: true, image: true,
@@ -613,6 +613,9 @@ const packResp = async (resp, options) => {
613
613
  input: BUFFER, expected: BUFFER, suffix: 'pcm.wav', ...options
614
614
  }), mime: audioMimeType,
615
615
  }));
616
+ // bug fix: Google Gemini returns duplicate first image: {
617
+ images && images.length > 1 && images.shift();
618
+ // }
616
619
  images = await Promise.all(
617
620
  images.map(async x => ({
618
621
  data: await convert(x.buffer, {
@@ -814,7 +817,7 @@ const promptOpenAI = async (aiId, content, options = {}) => {
814
817
  } else if (!modalities && model.image) {
815
818
  modalities = [TEXT, IMAGE];
816
819
  }
817
- const googleImageMode = source === S_GOOGLE && modalities?.has?.(IMAGE);
820
+ const googleImageMode = source === S_GOOGLE && modalities?.includes?.(IMAGE);
818
821
  // pricy: https://openrouter.ai/docs/features/web-search
819
822
  const ext = ''; // options.jsonMode ? '' : ONLINE;
820
823
  const targetModel = `${isOpenrouter(provider, model) ? `${source}/` : ''}${options.model}${ext}`;
@@ -828,10 +831,14 @@ const promptOpenAI = async (aiId, content, options = {}) => {
828
831
  modalities, audio: options.audio || (
829
832
  modalities?.find?.(x => x === AUDIO)
830
833
  && { voice: DEFAULT_MODELS[OPENAI_VOICE], format: 'pcm16' }
831
- ), ...model?.tools && !googleImageMode ? {
834
+ ), ...model?.tools ? {
832
835
  tools: options.tools ?? packedTools, tool_choice: 'auto',
833
- } : {}, store: true, stream: true,
834
- reasoning: { effort: options.reasoning_effort },
836
+ } : {}, store: true, stream: true, ...googleImageMode ? {
837
+ // bug: image_size not working
838
+ // https://openrouter.ai/docs/features/multimodal/image-generation
839
+ // https://openrouter.ai/google/gemini-3-pro-image-preview/api
840
+ image_config: { aspect_ratio: '16:9', image_size: '4K' },
841
+ } : {}, reasoning: { effort: options.reasoning_effort },
835
842
  });
836
843
  for await (event of resp) {
837
844
  // print(JSON.stringify(event, null, 2));
@@ -1124,7 +1131,7 @@ export {
1124
1131
  FEATURE_ICONS,
1125
1132
  FUNCTION,
1126
1133
  GEMINI_25_FLASH,
1127
- GEMINI_25_FLASH_IMAGE,
1134
+ GEMINI_30_PRO_IMAGE,
1128
1135
  GPT_51,
1129
1136
  INSTRUCTIONS,
1130
1137
  MODELS,
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": "2000.1.2",
4
+ "version": "2000.2.4",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
@@ -19,7 +19,7 @@ const manifest = {
19
19
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz"
20
20
  },
21
21
  "dependencies": {
22
- "file-type": "^21.1.0",
22
+ "file-type": "^21.1.1",
23
23
  "mathjs": "^15.1.0",
24
24
  "uuid": "^13.0.0"
25
25
  },
@@ -29,16 +29,16 @@ const manifest = {
29
29
  "@google-cloud/speech": "^7.2.1",
30
30
  "@google-cloud/storage": "^7.17.3",
31
31
  "@google-cloud/vision": "^5.3.4",
32
- "@google/genai": "^1.29.0",
32
+ "@google/genai": "^1.30.0",
33
33
  "@mozilla/readability": "github:mozilla/readability",
34
- "@sentry/node": "^10.25.0",
35
- "@sentry/profiling-node": "^10.25.0",
34
+ "@sentry/node": "^10.26.0",
35
+ "@sentry/profiling-node": "^10.26.0",
36
36
  "acme-client": "^5.4.0",
37
37
  "browserify-fs": "^1.0.0",
38
38
  "buffer": "^6.0.3",
39
39
  "fast-geoip": "^1.1.88",
40
40
  "fluent-ffmpeg": "^2.1.3",
41
- "form-data": "^4.0.4",
41
+ "form-data": "^4.0.5",
42
42
  "ioredis": "^5.8.2",
43
43
  "js-tiktoken": "^1.0.21",
44
44
  "jsdom": "^27.2.0",
@@ -50,22 +50,22 @@ const manifest = {
50
50
  "node-mailjet": "^6.0.11",
51
51
  "node-polyfill-webpack-plugin": "^4.1.0",
52
52
  "office-text-extractor": "^3.0.3",
53
- "openai": "^6.8.1",
53
+ "openai": "^6.9.1",
54
54
  "pdfjs-dist": "^5.4.394",
55
55
  "pg": "^8.16.3",
56
56
  "pgvector": "^0.2.1",
57
57
  "ping": "^1.0.0",
58
58
  "process": "^0.11.10",
59
- "puppeteer": "^24.29.1",
59
+ "puppeteer": "^24.30.0",
60
60
  "say": "^0.16.0",
61
61
  "telegraf": "^4.16.3",
62
62
  "telesignsdk": "^3.0.4",
63
63
  "tesseract.js": "^6.0.1",
64
- "twilio": "^5.10.5",
64
+ "twilio": "^5.10.6",
65
65
  "url": "github:Leask/node-url",
66
66
  "webpack-cli": "^6.0.1",
67
67
  "whisper-node": "^1.1.1",
68
- "wrangler": "^4.47.0",
68
+ "wrangler": "^4.49.0",
69
69
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz",
70
70
  "youtube-transcript": "^1.2.1"
71
71
  }
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": "2000.1.2",
4
+ "version": "2000.2.4",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
@@ -30,7 +30,7 @@
30
30
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz"
31
31
  },
32
32
  "dependencies": {
33
- "file-type": "^21.1.0",
33
+ "file-type": "^21.1.1",
34
34
  "mathjs": "^15.1.0",
35
35
  "uuid": "^13.0.0"
36
36
  },
@@ -40,16 +40,16 @@
40
40
  "@google-cloud/speech": "^7.2.1",
41
41
  "@google-cloud/storage": "^7.17.3",
42
42
  "@google-cloud/vision": "^5.3.4",
43
- "@google/genai": "^1.29.0",
43
+ "@google/genai": "^1.30.0",
44
44
  "@mozilla/readability": "github:mozilla/readability",
45
- "@sentry/node": "^10.25.0",
46
- "@sentry/profiling-node": "^10.25.0",
45
+ "@sentry/node": "^10.26.0",
46
+ "@sentry/profiling-node": "^10.26.0",
47
47
  "acme-client": "^5.4.0",
48
48
  "browserify-fs": "^1.0.0",
49
49
  "buffer": "^6.0.3",
50
50
  "fast-geoip": "^1.1.88",
51
51
  "fluent-ffmpeg": "^2.1.3",
52
- "form-data": "^4.0.4",
52
+ "form-data": "^4.0.5",
53
53
  "ioredis": "^5.8.2",
54
54
  "js-tiktoken": "^1.0.21",
55
55
  "jsdom": "^27.2.0",
@@ -61,22 +61,22 @@
61
61
  "node-mailjet": "^6.0.11",
62
62
  "node-polyfill-webpack-plugin": "^4.1.0",
63
63
  "office-text-extractor": "^3.0.3",
64
- "openai": "^6.8.1",
64
+ "openai": "^6.9.1",
65
65
  "pdfjs-dist": "^5.4.394",
66
66
  "pg": "^8.16.3",
67
67
  "pgvector": "^0.2.1",
68
68
  "ping": "^1.0.0",
69
69
  "process": "^0.11.10",
70
- "puppeteer": "^24.29.1",
70
+ "puppeteer": "^24.30.0",
71
71
  "say": "^0.16.0",
72
72
  "telegraf": "^4.16.3",
73
73
  "telesignsdk": "^3.0.4",
74
74
  "tesseract.js": "^6.0.1",
75
- "twilio": "^5.10.5",
75
+ "twilio": "^5.10.6",
76
76
  "url": "github:Leask/node-url",
77
77
  "webpack-cli": "^6.0.1",
78
78
  "whisper-node": "^1.1.1",
79
- "wrangler": "^4.47.0",
79
+ "wrangler": "^4.49.0",
80
80
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz",
81
81
  "youtube-transcript": "^1.2.1"
82
82
  }