utilitas 2001.1.87 โ 2001.1.88
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/README.md +1 -1
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +67 -8
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -54,7 +54,8 @@ const [
|
|
|
54
54
|
GEMINI_30_PRO, GEMINI_30_FLASH, IMAGEN_4_ULTRA, VEO_31, IMAGEN_4_UPSCALE,
|
|
55
55
|
ERROR_GENERATING, GEMINI_25_FLASH_TTS, GEMINI_25_PRO_TTS, wav, PNG_EXT,
|
|
56
56
|
GPT_4O_MIMI_TTS, GPT_4O_TRANSCRIBE, INVALID_AUDIO, OGG_EXT, ELLIPSIS,
|
|
57
|
-
TOP_LIMIT, ATTACHMENT, PROCESSING, CURSOR, LN1, LN2, TOP, DEEPSEEK
|
|
57
|
+
TOP_LIMIT, ATTACHMENT, PROCESSING, CURSOR, LN1, LN2, TOP, DEEPSEEK,
|
|
58
|
+
DEEP_RESEARCH_PRO,
|
|
58
59
|
] = [
|
|
59
60
|
'OpenAI', 'Google', 'Ollama', 'nova', 'deepseek-3.2-speciale', '```',
|
|
60
61
|
'claude-opus-4.5', 'audio', 'wav', 'OPENAI_VOICE', 'medium', 'think',
|
|
@@ -73,7 +74,7 @@ const [
|
|
|
73
74
|
'gemini-2.5-flash-preview-tts', 'gemini-2.5-pro-preview-tts', 'wav',
|
|
74
75
|
'png', 'gpt-4o-mini-tts', 'gpt-4o-transcribe', 'Invalid audio data.',
|
|
75
76
|
'ogg', '...', 3, 'ATTACHMENT', { processing: true }, ' โ', '\n\n',
|
|
76
|
-
'\n\n\n', 'top', 'DeepSeek',
|
|
77
|
+
'\n\n\n', 'top', 'DeepSeek', 'deep-research-pro-preview-12-2025',
|
|
77
78
|
];
|
|
78
79
|
|
|
79
80
|
const [joinL1, joinL2]
|
|
@@ -102,7 +103,7 @@ const MODEL_ICONS = {
|
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
const FEATURE_ICONS = {
|
|
105
|
-
audio: '๐',
|
|
106
|
+
audio: '๐', 'deep-research': '๐', fast: 'โก๏ธ', hearing: '๐', hidden: '๐',
|
|
106
107
|
image: '๐จ', reasoning: '๐ง ', structured: '๐', tools: '๐งฐ', video: '๐ฌ',
|
|
107
108
|
vision: '๐๏ธ', // finetune: '๐ง',
|
|
108
109
|
};
|
|
@@ -191,10 +192,14 @@ const MODELS = {
|
|
|
191
192
|
source: OPENAI, maxInputTokens: 0,
|
|
192
193
|
hearing: true, fast: true, hidden: true, defaultProvider: OPENAI,
|
|
193
194
|
},
|
|
194
|
-
//
|
|
195
|
+
// agents with deep-research capabilities
|
|
196
|
+
[DEEP_RESEARCH_PRO]: {
|
|
197
|
+
source: GOOGLE, contextWindow: m(1.05), maxOutputTokens: k(65.5),
|
|
198
|
+
'deep-research': true, reasoning: true, defaultProvider: GOOGLE,
|
|
199
|
+
},
|
|
195
200
|
[JINA_DEEPSEARCH]: { // @todo: parse more details from results, eg: "reed urls".
|
|
196
201
|
maxInputTokens: Infinity, attachmentTokenCost: 0,
|
|
197
|
-
|
|
202
|
+
'deep-research': true, reasoning: true,
|
|
198
203
|
supportedMimeTypes: [MIME_PNG, MIME_JPEG, MIME_TEXT, MIME_WEBP, MIME_PDF],
|
|
199
204
|
defaultProvider: JINA,
|
|
200
205
|
},
|
|
@@ -252,7 +257,7 @@ for (const n in MODELS) {
|
|
|
252
257
|
// }
|
|
253
258
|
// // for other features, if any model supports it, then AUTO supports it
|
|
254
259
|
// for (const key of [
|
|
255
|
-
// 'structured', 'reasoning', 'tools', 'vision', 'fast', '
|
|
260
|
+
// 'structured', 'reasoning', 'tools', 'vision', 'fast', 'deep-research', 'image',
|
|
256
261
|
// ]) {
|
|
257
262
|
// MODELS[AUTO][key] = MODELS[AUTO][key] || MODELS[n][key];
|
|
258
263
|
// }
|
|
@@ -687,7 +692,7 @@ const packResp = async (resp, options) => {
|
|
|
687
692
|
// "title": "ๅจ็ทๆ้- ็ฎๅๆ้- ็ทไธๆ้- ๆ้็ทไธ - ้ฌง้",
|
|
688
693
|
// "url": "https://naozhong.tw/shijian/",
|
|
689
694
|
// "content": "- [้ฌง้](https://naozhong.tw/)\n- [่จๆๅจ](https://naozhong.tw/jishiqi/)\n- [็ขผ้ถ](https://naozhong.tw/miaobiao/)\n- [ๆ้](https://naozhong.tw/shijian/)\n\n# ็พๅจๆ้\n\nๅ ๅ
ฅ\n\n- [็ทจ่ผฏ](javascript:;)\n- [็งป่ณ้ ็ซฏ](javascript:;)\n- [ไธ็งป](javascript:;)\n- [ไธ็งป](javascript:;)\n- [ๅช้ค](javascript:;)\n\n# ๆๅธธ็จ\n\n| | |\n| --- | --- |\n| [ๅฐๅ](https://naozhong.tw/shijian/%E5%8F%B0%E5%8C%97/) | 10:09:14 |\n| [ๅไบฌ๏ผไธญๅ](https://naozhong.tw/shijian/%E5%8C%97%E4%BA%AC-%E4%B8%AD%E5%9C%8B/) | 10:09:14 |\n| [ไธๆตท๏ผไธญๅ](https://naozhong.tw/shijian/%E4%B8%8A%E6%B5%B7-%E4%B8%AD%E5%9C%8B/) | 10:09:14 |\n| [็้ญฏๆจ้ฝ๏ผไธญๅ](https://naozhong.tw/shijian/%E7%83%8F%E9%AD%AF%",
|
|
690
|
-
// "dateTime": "2025-03-13 06:48:01" // jina
|
|
695
|
+
// "dateTime": "2025-03-13 06:48:01" // jina deep-research only
|
|
691
696
|
// }
|
|
692
697
|
// },
|
|
693
698
|
// ];
|
|
@@ -732,7 +737,7 @@ const packResp = async (resp, options) => {
|
|
|
732
737
|
...audio ? { audio } : {}, ...images?.length ? { images } : {},
|
|
733
738
|
processing: !!options?.processing,
|
|
734
739
|
model: packModelId([
|
|
735
|
-
options
|
|
740
|
+
options?.provider, options?.router?.provider,
|
|
736
741
|
options?.router?.model || options?.model,
|
|
737
742
|
]),
|
|
738
743
|
};
|
|
@@ -1117,6 +1122,60 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
|
|
|
1117
1122
|
}, model: packModelId([provider, M.source, M.name]),
|
|
1118
1123
|
};
|
|
1119
1124
|
}
|
|
1125
|
+
} else if (M?.['deep-research']) {
|
|
1126
|
+
const pkgOptions = { ...options || {}, provider, model: M.name };
|
|
1127
|
+
let interactionId, last_event_id, isComplete = false;
|
|
1128
|
+
let [thought, text, result] = ['', '', ''];
|
|
1129
|
+
var resp;
|
|
1130
|
+
// Helper to handle the event logic
|
|
1131
|
+
const handleStream = async (stream) => {
|
|
1132
|
+
for await (const chunk of stream) {
|
|
1133
|
+
chunk.event_type === 'interaction.start'
|
|
1134
|
+
&& (interactionId = chunk.interaction.id);
|
|
1135
|
+
chunk.event_id && (last_event_id = chunk.event_id);
|
|
1136
|
+
let deltaThought = '', deltaText = '', delta = '';
|
|
1137
|
+
if (chunk.event_type === 'content.delta') {
|
|
1138
|
+
if (chunk.delta.type === 'text') {
|
|
1139
|
+
thought && (deltaThought = `${THINK_END}\n\n`);
|
|
1140
|
+
text += (deltaText = chunk.delta.text);
|
|
1141
|
+
} else if (chunk.delta.type === 'thought_summary') {
|
|
1142
|
+
deltaThought = chunk.delta.content.text;
|
|
1143
|
+
thought || (deltaThought = `${THINK_STR}\n${deltaThought}`);
|
|
1144
|
+
thought += deltaThought;
|
|
1145
|
+
}
|
|
1146
|
+
result += (delta = deltaThought + deltaText);
|
|
1147
|
+
await streamResp({
|
|
1148
|
+
text: options.delta ? delta : result,
|
|
1149
|
+
}, pkgOptions);
|
|
1150
|
+
} else if (chunk.event_type === 'interaction.complete') {
|
|
1151
|
+
isComplete = true;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
// 1. Start the task with streaming
|
|
1156
|
+
resp = await client.interactions.create({
|
|
1157
|
+
input: prompt, agent: M.name, background: true, store: true,
|
|
1158
|
+
stream: true, // tools: [],
|
|
1159
|
+
agent_config: { type: 'deep-research', thinking_summaries: 'auto' },
|
|
1160
|
+
previous_interaction_id: options?.previous_interaction_id,
|
|
1161
|
+
});
|
|
1162
|
+
await handleStream(resp);
|
|
1163
|
+
// 2. Reconnect Loop
|
|
1164
|
+
while (!isComplete && interactionId) {
|
|
1165
|
+
log(`[DRS] Reconnecting to interaction ${interactionId} from event ${last_event_id}...`);
|
|
1166
|
+
try {
|
|
1167
|
+
resp = await client.interactions.get(interactionId, {
|
|
1168
|
+
stream: true, last_event_id,
|
|
1169
|
+
});
|
|
1170
|
+
await handleStream(resp);
|
|
1171
|
+
} catch (e) {
|
|
1172
|
+
log('[DRS] Reconnection failed, retrying in 2s...');
|
|
1173
|
+
await timeout(2000);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
// 3. Return response
|
|
1177
|
+
options?.raw || (resp = await packResp({ text: result }, pkgOptions));
|
|
1178
|
+
return resp;
|
|
1120
1179
|
} else {
|
|
1121
1180
|
throwError('Unsupported model.');
|
|
1122
1181
|
}
|
package/lib/manifest.mjs
CHANGED