utilitas 2000.3.34 → 2000.3.36

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
@@ -50,12 +50,12 @@ const _NEED = ['js-tiktoken', 'OpenAI', '@google/genai'];
50
50
 
51
51
  const [
52
52
  OPENAI, GOOGLE, OLLAMA, NOVA, DEEPSEEK_32, MD_CODE, CLOUD_OPUS_45, AUDIO,
53
- WAV, ATTACHMENTS, OPENAI_VOICE, GPT_REASONING_EFFORT, THINK, THINK_STR,
54
- THINK_END, TOOLS_STR, TOOLS_END, TOOLS, TEXT, OK, FUNC, GPT_51,
55
- GPT_51_CODEX, GPT_5_IMAGE, GEMMA_3_27B, ANTHROPIC, v8k, ais,
56
- MAX_TOOL_RECURSION, LOG, name, user, system, assistant, MODEL, JSON_OBJECT,
57
- tokenSafeRatio, CONTENT_IS_REQUIRED, OPENAI_HI_RES_SIZE, k, kT, m, minute,
58
- hour, gb, trimTailing, trimBeginning, GEMINI_30_PRO_IMAGE, IMAGE, JINA,
53
+ WAV, OPENAI_VOICE, GPT_REASONING_EFFORT, THINK, THINK_STR, THINK_END,
54
+ TOOLS_STR, TOOLS_END, TOOLS, TEXT, OK, FUNC, GPT_51, GPT_51_CODEX,
55
+ GPT_5_IMAGE, GEMMA_3_27B, ANTHROPIC, v8k, ais, MAX_TOOL_RECURSION, LOG,
56
+ name, user, system, assistant, MODEL, JSON_OBJECT, tokenSafeRatio,
57
+ PROMPT_IS_REQUIRED, OPENAI_HI_RES_SIZE, k, kT, m, minute, hour, gb,
58
+ trimTailing, trimBeginning, GEMINI_30_PRO_IMAGE, IMAGE, JINA,
59
59
  JINA_DEEPSEARCH, SILICONFLOW, SF_DEEPSEEK_32, MAX_TIRE, OPENROUTER_API,
60
60
  OPENROUTER, AUTO, TOOL, S_OPENAI, S_GOOGLE, S_ANTHROPIC, ONLINE,
61
61
  GEMINI_30_PRO, GEMINI_25_FLASH, IMAGEN_4_ULTRA, VEO_31, IMAGEN_4_UPSCALE,
@@ -63,13 +63,13 @@ const [
63
63
  GPT_4O_MIMI_TTS, GPT_4O_TRANSCRIBE, INVALID_AUDIO, OGG_EXT,
64
64
  ] = [
65
65
  'OpenAI', 'Google', 'Ollama', 'nova', 'deepseek-3.2-speciale', '```',
66
- 'claude-opus-4.5', 'audio', 'wav', '[ATTACHMENTS]', 'OPENAI_VOICE',
67
- 'medium', 'think', '<think>', '</think>', '<tools>', '</tools>',
68
- 'tools', 'text', 'OK', 'function', 'gpt-5.1', 'gpt-5.1-codex',
69
- 'gpt-5-image', 'gemma3:27b', 'Anthropic', 7680 * 4320, [], 30,
70
- { log: true }, 'Alan', 'user', { role: 'system' }, 'assistant', 'model',
71
- 'json_object', 1.1, 'Content is required.', 2048 * 2048, x => 1024 * x,
72
- x => 1000 * x, x => 1024 * 1024 * x, x => 60 * x, x => 60 * 60 * x,
66
+ 'claude-opus-4.5', 'audio', 'wav', 'OPENAI_VOICE', 'medium', 'think',
67
+ '<think>', '</think>', '<tools>', '</tools>', 'tools', 'text', 'OK',
68
+ 'function', 'gpt-5.1', 'gpt-5.1-codex', 'gpt-5-image', 'gemma3:27b',
69
+ 'Anthropic', 7680 * 4320, [], 30, { log: true }, 'Alan', 'user',
70
+ { role: 'system' }, 'assistant', 'model', 'json_object', 1.1,
71
+ 'Prompt is required.', 2048 * 2048, x => 1024 * x, x => 1000 * x,
72
+ x => 1024 * 1024 * x, x => 60 * x, x => 60 * 60 * x,
73
73
  x => 1024 * 1024 * 1024 * x, x => x.replace(/[\.\s]*$/, ''),
74
74
  x => x.replace(/^[\.\s]*/, ''), 'gemini-3-pro-image-preview', 'image',
75
75
  'Jina', 'jina-deepsearch-v1', 'SiliconFlow',
@@ -94,7 +94,7 @@ const chatConfig = { sessions: new Map(), systemPrompt: INSTRUCTIONS };
94
94
  const tokenSafe = count => Math.ceil(count * tokenSafeRatio);
95
95
  const renderText = (t, o) => _renderText(t, { extraCodeBlock: 0, ...o || {} });
96
96
  const log = (cnt, opt) => _log(cnt, import.meta.url, { time: 1, ...opt || {} });
97
- const assertContent = content => assert(content.length, CONTENT_IS_REQUIRED);
97
+ const assertPrompt = content => assert(content.length, PROMPT_IS_REQUIRED);
98
98
  const countToolCalls = r => r?.split('\n').filter(x => x === TOOLS_STR).length;
99
99
  const assertApiKey = (p, o) => assert(o?.apiKey, `${p} api key is required.`);
100
100
  const getProviderIcon = provider => PROVIDER_ICONS[provider] || '🔮';
@@ -634,7 +634,7 @@ const buildMessage = async (content, options) => {
634
634
  } : content;
635
635
  message.content || (message.content = []);
636
636
  attachments.map(x => message.content.push(x));
637
- assertContent(message.content);
637
+ assertPrompt(message.content);
638
638
  return message;
639
639
  };
640
640
 
@@ -1050,7 +1050,7 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
1050
1050
  const target_model = options?.model || model.name;
1051
1051
  const M = MODELS[target_model];
1052
1052
  prompt = ensureString(prompt, { trim: true });
1053
- assert(prompt.length, 'Prompt is required.');
1053
+ assertPrompt(prompt);
1054
1054
  M.tts && (prompt = `${options?.prompt || TTS_PROMPT}: ${prompt}`);
1055
1055
  assert(await countTokens(prompt, { fast: true })
1056
1056
  <= M.maxInputTokens,
@@ -1169,7 +1169,7 @@ const promptOpenAI = async (aiId, prompt, options = {}) => {
1169
1169
  const M = MODELS[target_model];
1170
1170
  prompt = ensureString(prompt, { trim: true });
1171
1171
  if (M?.audio) {
1172
- assert(prompt.length, 'Prompt is required.');
1172
+ assertPrompt(prompt);
1173
1173
  const ins_prompt = options?.prompt || `${TTS_PROMPT}.`;
1174
1174
  assert(await countTokens(
1175
1175
  JSON.stringify([ins_prompt, prompt]), { fast: true }
@@ -1407,7 +1407,6 @@ export default init;
1407
1407
  export {
1408
1408
  _NEED,
1409
1409
  _NO_RENDER,
1410
- ATTACHMENTS,
1411
1410
  CLOUD_OPUS_45,
1412
1411
  CODE_INTERPRETER,
1413
1412
  DEEPSEEK_32,
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.3.34",
4
+ "version": "2000.3.36",
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": "2000.3.34",
4
+ "version": "2000.3.36",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",