nolo-cli 0.33.0-alpha.13 → 0.33.0-alpha.14
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/{_executeModel-S346WSM5.js → _executeModel-7JTMK4RG.js} +28 -28
- package/{action-OQWPNKAH.js → action-Q4KO7DDW.js} +4 -4
- package/{addContentAction-YVINZQTF.js → addContentAction-FRXDZKSI.js} +3 -3
- package/{addDialogAgentAction-6IOCIEPI.js → addDialogAgentAction-XL5G3LPR.js} +2 -2
- package/{agentDeleteCommand-6TTPXGS3.js → agentDeleteCommand-2TZHJ3RQ.js} +13 -13
- package/{agentEmailCommands-JIXFG6AM.js → agentEmailCommands-DPSDC3HD.js} +32 -32
- package/{agentListCommands-ZTT3KU35.js → agentListCommands-DTAXH3J6.js} +15 -15
- package/{agentMachineCommands-25DROOMX.js → agentMachineCommands-AZQTRWSO.js} +14 -14
- package/{agentRecordCommands-N4L55KRX.js → agentRecordCommands-MJM6ZF2G.js} +31 -31
- package/{agentRunCommand-4CKVVQ4P.js → agentRunCommand-PTOU5ADW.js} +31 -31
- package/{agentRuntimeLocal-O4IDDLPA.js → agentRuntimeLocal-Q7UJUPCH.js} +13 -13
- package/{agentSlice-47VUR2ZD.js → agentSlice-UU62MB3X.js} +3 -3
- package/{appDeleteCommands-SWXRVOE4.js → appDeleteCommands-GK2VPNKO.js} +15 -15
- package/{appDeployCommands-WQ3ZXXQH.js → appDeployCommands-VQLBLXQ4.js} +15 -15
- package/{appDeployStatusCommands-BM5CVBFC.js → appDeployStatusCommands-QBCR22M6.js} +15 -15
- package/{appGetCommands-SHI5HG4U.js → appGetCommands-XKKIUK2X.js} +15 -15
- package/{appListCommands-5IKTBNWH.js → appListCommands-H4H6BAIG.js} +15 -15
- package/{authCommand-VIHTCZDN.js → authCommand-EX5G5PF4.js} +7 -7
- package/{chatQueueReduxAdapter-GBGNFB7U.js → chatQueueReduxAdapter-HU54G64R.js} +13 -13
- package/{chunk-GJXRIOLS.js → chunk-2CNX3CJE.js} +4 -84
- package/{chunk-DF22DYA4.js → chunk-33TKEKZL.js} +3 -3
- package/{chunk-SHOLLFRN.js → chunk-3F66RTMA.js} +12 -12
- package/{chunk-SNFD447J.js → chunk-4GRUSXSX.js} +24 -24
- package/{chunk-PIDDBIHR.js → chunk-6BNXAFZD.js} +14 -215
- package/{chunk-3WXRAHCG.js → chunk-6MSSX7FI.js} +1 -1
- package/{chunk-UM4H3URE.js → chunk-6YH4UR3E.js} +3 -3
- package/{chunk-OR2HNLVO.js → chunk-7EPNNOL4.js} +6 -6
- package/{chunk-RPRRIFXV.js → chunk-7OGIWPNK.js} +1 -1
- package/{chunk-DFUPZE6V.js → chunk-7SLMYTSF.js} +1 -1
- package/{chunk-3GZXL6FM.js → chunk-AOWETAXX.js} +1 -1
- package/{chunk-2IVEXF7P.js → chunk-BHILFABL.js} +1 -1
- package/{chunk-3RUW3ONU.js → chunk-DDET6246.js} +1 -1
- package/{chunk-RJKIB55Y.js → chunk-EQ6HOWEJ.js} +2 -2
- package/{chunk-6YXDOOSH.js → chunk-FH7VUJN5.js} +2 -2
- package/{chunk-IXTC74NZ.js → chunk-FLUK32AS.js} +4 -4
- package/{chunk-AVO73UMB.js → chunk-FS5HQTXA.js} +102 -23
- package/{chunk-6KOS7ZBZ.js → chunk-FV63ICZC.js} +1 -1
- package/{chunk-4EKYN24Q.js → chunk-G3IZYZYL.js} +1 -1
- package/{chunk-MIRUCHZP.js → chunk-GHDWBVDC.js} +11 -17
- package/{chunk-3UG2IIZ3.js → chunk-GTEHJWXU.js} +1 -1
- package/{chunk-DKMOY3QI.js → chunk-HCOIKLSH.js} +2 -2
- package/{chunk-TIX6O4IC.js → chunk-HLDRWLQT.js} +11 -11
- package/{chunk-VBUQYOX7.js → chunk-IEHZHWN7.js} +1 -1
- package/{chunk-CSNOI72O.js → chunk-IPVRJ7YP.js} +4 -4
- package/{chunk-2QTEYCR7.js → chunk-JFUW3UTO.js} +1 -1
- package/{chunk-75U775RZ.js → chunk-KIL7V27H.js} +1 -1
- package/{chunk-7XSIRXOO.js → chunk-KJRULCTO.js} +8 -8
- package/{chunk-4F5M2MW5.js → chunk-KMMQFY5O.js} +1 -1
- package/{chunk-ZZV52MOO.js → chunk-KT4XMX76.js} +1 -1
- package/{chunk-IR6W62Q6.js → chunk-KZB5SNYH.js} +1 -14
- package/{chunk-ASDXPOJH.js → chunk-L5XKDBSH.js} +1 -1
- package/{chunk-SCUETSRP.js → chunk-LAZTMWIU.js} +1 -1
- package/{chunk-PQQXQV6V.js → chunk-MNG4T5EG.js} +3 -3
- package/{chunk-7YYHKBJP.js → chunk-OQVRTSZ5.js} +1 -1
- package/{chunk-PWI34D3P.js → chunk-PXNTCR3F.js} +3 -3
- package/{chunk-UNOTBWZZ.js → chunk-QKCMP3LU.js} +2 -2
- package/{chunk-IKWTTKWG.js → chunk-V4MT7AEN.js} +1 -1
- package/{chunk-CPYYM4RJ.js → chunk-VIRTYWWE.js} +4 -5
- package/{chunk-5WEQKEFO.js → chunk-WO42AOGQ.js} +2 -2
- package/{chunk-GUC65EFO.js → chunk-XSFNKLAP.js} +16 -18
- package/{createAgentAutomationAction-7DWATWIT.js → createAgentAutomationAction-UUB7I2IZ.js} +14 -14
- package/{createDialogAction-3CPIR267.js → createDialogAction-6L4UPVOM.js} +15 -15
- package/{createPageAction-5GUFQTAW.js → createPageAction-YHKPY27S.js} +14 -14
- package/{dbSlice-UI2VCBLG.js → dbSlice-2YD2PZER.js} +2 -2
- package/{dialogCommands-XKC5TIAA.js → dialogCommands-4CM7WLJU.js} +13 -13
- package/{dialogSlice-YFWNV3JJ.js → dialogSlice-IGMZSFYT.js} +13 -13
- package/{docCreateCommands-MRH4H6DW.js → docCreateCommands-J73A5E4E.js} +14 -14
- package/{docDeleteCommands-KJJU6NLM.js → docDeleteCommands-OQARRE6H.js} +14 -14
- package/{docReadCommands-JXOSUS5I.js → docReadCommands-EOF3SUF3.js} +14 -14
- package/{docStore-SGQ6EE5P.js → docStore-XAICS4VA.js} +15 -15
- package/{docUpdateCommands-AGUFF52W.js → docUpdateCommands-3NBWWIX3.js} +14 -14
- package/{getPricing-L2ENXWHV.js → getPricing-J4VXWR5B.js} +3 -3
- package/{handleSendMessageAction-RGCSLENY.js → handleSendMessageAction-ET2RT4YC.js} +13 -13
- package/index.js +47 -47
- package/{machineCommands-P5DVPETV.js → machineCommands-SJTKJRAK.js} +31 -31
- package/{machineWsRunDispatch-66ZCBLIC.js → machineWsRunDispatch-RDRIH27N.js} +31 -31
- package/{models-OX2S5C6Q.js → models-SQFOI4FI.js} +2 -2
- package/package.json +1 -1
- package/{read-2VHEHCAN.js → read-526GJR3R.js} +1 -1
- package/{readDocTool-CSWD6NPC.js → readDocTool-JNEZUOSM.js} +1 -1
- package/{readlineWorkspace-U2LVP43X.js → readlineWorkspace-T2MLNAVK.js} +32 -32
- package/{removeDialogAgentAction-2T7BPM3T.js → removeDialogAgentAction-NPMEFEJW.js} +4 -4
- package/{runAgentClientLoop-WVL2KOS5.js → runAgentClientLoop-H7HEYRIW.js} +25 -25
- package/{setDialogExtraReferencesAction-GPT37HTW.js → setDialogExtraReferencesAction-ZZ6QWAG2.js} +3 -3
- package/{setPrimaryDialogAgentAction-3746P7IW.js → setPrimaryDialogAgentAction-BG72QA6S.js} +4 -4
- package/{settingSlice-FIFOQ6OR.js → settingSlice-JCCLCXZB.js} +3 -3
- package/{spaceCommands-O33WUJEV.js → spaceCommands-EWIIKS7T.js} +13 -13
- package/{spaceSlice-R5X62SG3.js → spaceSlice-IEUHVARG.js} +14 -14
- package/{streamAgentChatTurn-CLC5VQYO.js → streamAgentChatTurn-DXKMGZTX.js} +36 -46
- package/{switchDialogAgentAction-MQTUTQHL.js → switchDialogAgentAction-YPGPM2LL.js} +2 -2
- package/{tools-4QHXZBRQ.js → tools-36F2CQ4F.js} +21 -21
- package/{tuiSummaryLlmCaller-EAWQ3IZX.js → tuiSummaryLlmCaller-WUVAOIYU.js} +9 -9
- package/{updateDialogTitleAction-IOSJSJ5S.js → updateDialogTitleAction-N7UF3L3R.js} +14 -14
|
@@ -5,9 +5,8 @@ import {
|
|
|
5
5
|
resolveToolGuidedSections
|
|
6
6
|
} from "./chunk-ZKUATCEY.js";
|
|
7
7
|
import {
|
|
8
|
-
getModelContextWindow
|
|
9
|
-
|
|
10
|
-
} from "./chunk-GJXRIOLS.js";
|
|
8
|
+
getModelContextWindow
|
|
9
|
+
} from "./chunk-2CNX3CJE.js";
|
|
11
10
|
import {
|
|
12
11
|
COMPACTION_SUMMARY_SYSTEM_PROMPT,
|
|
13
12
|
buildCompactionMetricsFromPlan,
|
|
@@ -19,11 +18,11 @@ import {
|
|
|
19
18
|
formatMessagesForSummaryWithTruncation,
|
|
20
19
|
planCompression,
|
|
21
20
|
planContextUsage
|
|
22
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-HCOIKLSH.js";
|
|
23
22
|
import {
|
|
24
23
|
findModelConfig,
|
|
25
24
|
getProviderByModelName
|
|
26
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-7SLMYTSF.js";
|
|
27
26
|
import {
|
|
28
27
|
buildDialogSummaryLayer
|
|
29
28
|
} from "./chunk-3AOLVADY.js";
|
|
@@ -37,18 +36,12 @@ import {
|
|
|
37
36
|
import {
|
|
38
37
|
toErrorMessage
|
|
39
38
|
} from "./chunk-HNMXYYJR.js";
|
|
40
|
-
import {
|
|
41
|
-
PLATFORM_HOSTED_QWEN_37_FLASH_MODEL
|
|
42
|
-
} from "./chunk-OR2HNLVO.js";
|
|
43
39
|
import {
|
|
44
40
|
asRecordOrEmpty
|
|
45
41
|
} from "./chunk-KX6YBIHG.js";
|
|
46
42
|
import {
|
|
47
43
|
asTrimmedLowercaseString
|
|
48
44
|
} from "./chunk-QSJ3HFEF.js";
|
|
49
|
-
import {
|
|
50
|
-
PUBLIC_QWEN_37_FLASH_AGENT_KEY
|
|
51
|
-
} from "./chunk-IR6W62Q6.js";
|
|
52
45
|
import {
|
|
53
46
|
isRecord
|
|
54
47
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -166,36 +159,6 @@ var resolveAgentImageInputSupport = (agent) => {
|
|
|
166
159
|
};
|
|
167
160
|
|
|
168
161
|
// packages/ai/agent/imagePreprocessing.ts
|
|
169
|
-
var DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY = PUBLIC_QWEN_37_FLASH_AGENT_KEY;
|
|
170
|
-
var DESCRIBE_IMAGE_PROMPT = `\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684\u56FE\u7247\u63CF\u8FF0\u52A9\u624B\u3002\u8BF7\u6781\u5176\u8BE6\u7EC6\u5730\u63CF\u8FF0\u8FD9\u5F20\u56FE\u7247\uFF0C\u76EE\u6807\u662F\u8BA9\u4E00\u4E2A\u770B\u4E0D\u5230\u56FE\u7247\u7684 AI \u52A9\u624B\u80FD\u5B8C\u5168\u7406\u89E3\u56FE\u7247\u5185\u5BB9\u3002
|
|
171
|
-
|
|
172
|
-
\u8BF7\u6309\u4EE5\u4E0B\u7ED3\u6784\u63CF\u8FF0\uFF1A
|
|
173
|
-
|
|
174
|
-
1. **\u56FE\u7247\u7C7B\u578B**\uFF1A\u8FD9\u662F\u754C\u9762\u622A\u56FE\u3001\u7167\u7247\u3001\u56FE\u8868\u3001\u6587\u6863\u3001\u8FD8\u662F\u5176\u4ED6\u7C7B\u578B\uFF1F
|
|
175
|
-
|
|
176
|
-
2. **\u5982\u679C\u662F\u754C\u9762\u622A\u56FE**\uFF1A
|
|
177
|
-
- \u5217\u51FA\u6240\u6709\u53EF\u89C1\u7684 UI \u5143\u7D20\uFF1A\u6807\u9898\u680F\u3001\u5BFC\u822A\u83DC\u5355\u3001\u6309\u94AE\u3001\u8F93\u5165\u6846\u3001\u5217\u8868\u9879\u7B49
|
|
178
|
-
- \u9010\u4E2A\u63CF\u8FF0\u6BCF\u4E2A\u5143\u7D20\u7684\u6587\u5B57\u5185\u5BB9\u548C\u4F4D\u7F6E\uFF08\u5982"\u5DE6\u4E0A\u89D2"\u3001"\u53F3\u4FA7\u680F"\uFF09
|
|
179
|
-
- \u63CF\u8FF0\u989C\u8272\u4E3B\u9898\u3001\u5E03\u5C40\u7ED3\u6784\u3001\u5F53\u524D\u72B6\u6001\uFF08\u5982\u9009\u4E2D\u3001hover\u3001loading\uFF09
|
|
180
|
-
- \u5982\u679C\u6709\u5F39\u7A97/\u5BF9\u8BDD\u6846/\u901A\u77E5\uFF0C\u5B8C\u6574\u8BB0\u5F55\u5176\u6587\u5B57\u5185\u5BB9
|
|
181
|
-
|
|
182
|
-
3. **\u5982\u679C\u662F\u751F\u6D3B\u7167\u7247**\uFF1A
|
|
183
|
-
- \u573A\u666F/\u73AF\u5883\uFF1A\u5BA4\u5185/\u5BA4\u5916\u3001\u5730\u70B9\u7C7B\u578B\u3001\u65F6\u95F4\u611F\uFF08\u767D\u5929/\u591C\u665A\uFF09
|
|
184
|
-
- \u4EBA\u7269\uFF1A\u4EBA\u6570\u3001\u59FF\u52BF\u3001\u8868\u60C5\u3001\u7A7F\u7740\u3001\u52A8\u4F5C
|
|
185
|
-
- \u7269\u4F53\uFF1A\u524D\u666F/\u80CC\u666F\u4E2D\u7684\u6240\u6709\u663E\u8457\u7269\u4F53
|
|
186
|
-
- \u5149\u7EBF\u3001\u5929\u6C14\u3001\u6C1B\u56F4
|
|
187
|
-
|
|
188
|
-
4. **\u5982\u679C\u662F\u56FE\u8868/\u6570\u636E\u56FE**\uFF1A
|
|
189
|
-
- \u56FE\u8868\u7C7B\u578B\uFF08\u67F1\u72B6\u56FE/\u6298\u7EBF\u56FE/\u997C\u56FE\u7B49\uFF09
|
|
190
|
-
- \u5750\u6807\u8F74\u6807\u7B7E\u3001\u6570\u503C\u8303\u56F4\u3001\u5355\u4F4D
|
|
191
|
-
- \u5173\u952E\u6570\u636E\u70B9\u548C\u8D8B\u52BF
|
|
192
|
-
- \u56FE\u4F8B\u3001\u6807\u9898
|
|
193
|
-
|
|
194
|
-
5. **\u6240\u6709\u53EF\u89C1\u6587\u5B57**\uFF1A\u9010\u5B57\u8BB0\u5F55\u56FE\u7247\u4E2D\u51FA\u73B0\u7684\u6240\u6709\u6587\u5B57\uFF08UI \u6587\u5B57\u3001\u8DEF\u724C\u3001\u6807\u7B7E\u3001\u6C34\u5370\u7B49\uFF09\uFF0C\u4FDD\u7559\u539F\u6587\u3002
|
|
195
|
-
|
|
196
|
-
6. **\u989C\u8272\u548C\u5E03\u5C40**\uFF1A\u4E3B\u8272\u8C03\u3001\u5E03\u5C40\u7ED3\u6784\u3001\u7A7A\u95F4\u5173\u7CFB\u3002
|
|
197
|
-
|
|
198
|
-
\u8BF7\u5C3D\u53EF\u80FD\u8BE6\u7EC6\uFF0C\u4E0D\u8981\u9057\u6F0F\u4EFB\u4F55\u53EF\u89C1\u4FE1\u606F\u3002`;
|
|
199
162
|
function extractImageUrlsFromMessages(messages) {
|
|
200
163
|
const urls = [];
|
|
201
164
|
for (const msg of messages) {
|
|
@@ -211,111 +174,6 @@ function extractImageUrlsFromMessages(messages) {
|
|
|
211
174
|
function hasImageInRuntimeMessages(messages) {
|
|
212
175
|
return extractImageUrlsFromMessages(messages).length > 0;
|
|
213
176
|
}
|
|
214
|
-
var IMAGE_DESCRIPTION_CACHE = /* @__PURE__ */ new Map();
|
|
215
|
-
function cacheKeyForUrls(urls) {
|
|
216
|
-
return urls.slice().sort().join("||");
|
|
217
|
-
}
|
|
218
|
-
async function preprocessImagesForTextOnlyAgent(messages, describeImage) {
|
|
219
|
-
const imageUrls = extractImageUrlsFromMessages(messages);
|
|
220
|
-
if (imageUrls.length === 0) return messages;
|
|
221
|
-
const key = cacheKeyForUrls(imageUrls);
|
|
222
|
-
let description = IMAGE_DESCRIPTION_CACHE.get(key);
|
|
223
|
-
if (!description) {
|
|
224
|
-
const rawDesc = await describeImage(imageUrls);
|
|
225
|
-
if (rawDesc === null || !rawDesc.trim()) return messages;
|
|
226
|
-
description = rawDesc.trim();
|
|
227
|
-
IMAGE_DESCRIPTION_CACHE.set(key, description);
|
|
228
|
-
}
|
|
229
|
-
const descriptionText = `[\u56FE\u7247\u63CF\u8FF0] ${description}`;
|
|
230
|
-
return messages.map((msg) => {
|
|
231
|
-
if (!Array.isArray(msg.content)) return msg;
|
|
232
|
-
const hasImage = msg.content.some((p) => p?.type === "image_url");
|
|
233
|
-
if (!hasImage) return msg;
|
|
234
|
-
const newContent = msg.content.map((part) => {
|
|
235
|
-
if (part && typeof part === "object" && part.type === "image_url") {
|
|
236
|
-
return { type: "text", text: descriptionText };
|
|
237
|
-
}
|
|
238
|
-
return part;
|
|
239
|
-
}).filter((p) => p !== null && p !== void 0);
|
|
240
|
-
return { ...msg, content: newContent };
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
async function describeImageWithLocalProvider(adapter, imageUrls, visionAgentConfig) {
|
|
244
|
-
if (imageUrls.length === 0) return null;
|
|
245
|
-
try {
|
|
246
|
-
const config = visionAgentConfig ?? resolveBuiltinPlatformAgentConfig(DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY);
|
|
247
|
-
if (!config) {
|
|
248
|
-
console.warn("[imagePreprocessing] vision agent config not found, skipping");
|
|
249
|
-
return null;
|
|
250
|
-
}
|
|
251
|
-
const visionProvider = await adapter.resolveProvider(config);
|
|
252
|
-
const result = await visionProvider.complete(
|
|
253
|
-
[{ role: "user", content: buildDescribeContentParts(imageUrls) }],
|
|
254
|
-
{ timeoutMs: 3e4 }
|
|
255
|
-
);
|
|
256
|
-
const text = result.content?.trim();
|
|
257
|
-
if (!text) return null;
|
|
258
|
-
return text;
|
|
259
|
-
} catch (error) {
|
|
260
|
-
console.warn("[imagePreprocessing] vision describe failed, will fallback:", error);
|
|
261
|
-
return null;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
async function describeImageViaServerProxy(serverUrl, authToken, imageUrls, visionAgentKey) {
|
|
265
|
-
if (imageUrls.length === 0) return null;
|
|
266
|
-
const agentKey = visionAgentKey ?? DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY;
|
|
267
|
-
const { model: visionModel, provider: visionProvider } = resolveDefaultVisionModelConfig(agentKey);
|
|
268
|
-
try {
|
|
269
|
-
const payload = {
|
|
270
|
-
model: visionModel,
|
|
271
|
-
messages: [{ role: "user", content: buildDescribeContentParts(imageUrls) }],
|
|
272
|
-
stream: false,
|
|
273
|
-
provider: visionProvider,
|
|
274
|
-
agentKey,
|
|
275
|
-
// server proxy 需要 url 字段,但 nolo 平台 agent 的上游由 server 端路由,
|
|
276
|
-
// 这里放一个占位 url,server 端会根据 provider/model 覆盖。
|
|
277
|
-
url: "https://api.ollama.com/v1/chat/completions"
|
|
278
|
-
};
|
|
279
|
-
const response = await fetch(`${serverUrl}/api/chat`, {
|
|
280
|
-
method: "POST",
|
|
281
|
-
headers: {
|
|
282
|
-
"Content-Type": "application/json",
|
|
283
|
-
Authorization: `Bearer ${authToken}`
|
|
284
|
-
},
|
|
285
|
-
body: JSON.stringify(payload),
|
|
286
|
-
signal: AbortSignal.timeout(3e4)
|
|
287
|
-
});
|
|
288
|
-
if (!response.ok) {
|
|
289
|
-
console.warn(`[imagePreprocessing] server proxy vision call failed: ${response.status}`);
|
|
290
|
-
return null;
|
|
291
|
-
}
|
|
292
|
-
const data = await response.json();
|
|
293
|
-
const text = data?.choices?.[0]?.message?.content;
|
|
294
|
-
if (typeof text === "string" && text.trim()) {
|
|
295
|
-
return text.trim();
|
|
296
|
-
}
|
|
297
|
-
return null;
|
|
298
|
-
} catch (error) {
|
|
299
|
-
console.warn("[imagePreprocessing] server proxy vision describe failed:", error);
|
|
300
|
-
return null;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
function buildDescribeContentParts(imageUrls) {
|
|
304
|
-
const parts = [{ type: "text", text: DESCRIBE_IMAGE_PROMPT }];
|
|
305
|
-
for (const url of imageUrls) {
|
|
306
|
-
parts.push({ type: "image_url", image_url: { url } });
|
|
307
|
-
}
|
|
308
|
-
return parts;
|
|
309
|
-
}
|
|
310
|
-
function resolveDefaultVisionModelConfig(agentKey) {
|
|
311
|
-
const key = agentKey ?? DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY;
|
|
312
|
-
const config = resolveBuiltinPlatformAgentConfig(key);
|
|
313
|
-
return {
|
|
314
|
-
model: config?.model ?? PLATFORM_HOSTED_QWEN_37_FLASH_MODEL,
|
|
315
|
-
provider: config?.provider ?? "nolo",
|
|
316
|
-
config
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
177
|
var IMAGE_OMITTED_PLACEHOLDER = "[Image content omitted: model does not support image input]";
|
|
320
178
|
function stripImagePartsFromContent(content) {
|
|
321
179
|
if (!Array.isArray(content)) return content;
|
|
@@ -329,45 +187,10 @@ function stripImagePartsFromMessages(messages) {
|
|
|
329
187
|
content: stripImagePartsFromContent(msg.content)
|
|
330
188
|
}));
|
|
331
189
|
}
|
|
332
|
-
async function
|
|
190
|
+
async function stripImagePartsForTextOnlyAgent(messages, agentConfig) {
|
|
333
191
|
const supportsVision = resolveAgentImageInputSupport(agentConfig);
|
|
334
192
|
const hasImages = hasImageInRuntimeMessages(messages);
|
|
335
|
-
|
|
336
|
-
if (!needsPreprocessing) {
|
|
337
|
-
const firstDynamicIdx = messages.findIndex((m) => m.id && !initialHistoryIds.has(m.id));
|
|
338
|
-
const splitIdx2 = firstDynamicIdx === -1 ? messages.length : firstDynamicIdx;
|
|
339
|
-
return {
|
|
340
|
-
kind: "ok",
|
|
341
|
-
messages,
|
|
342
|
-
stableMessages: messages.slice(0, splitIdx2),
|
|
343
|
-
dynamicMessages: messages.slice(splitIdx2)
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
let finalMessages = messages;
|
|
347
|
-
if (serverUrl && authToken) {
|
|
348
|
-
try {
|
|
349
|
-
const preprocessed = await preprocessImagesForTextOnlyAgent(
|
|
350
|
-
messages,
|
|
351
|
-
(urls) => describeImageViaServerProxy(serverUrl, authToken, urls)
|
|
352
|
-
);
|
|
353
|
-
if (preprocessed !== messages) {
|
|
354
|
-
finalMessages = preprocessed;
|
|
355
|
-
}
|
|
356
|
-
} catch (e) {
|
|
357
|
-
console.warn("[imagePreprocessing] web vision describe error:", e);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
if (finalMessages === messages) {
|
|
361
|
-
finalMessages = stripImagePartsFromMessages(messages);
|
|
362
|
-
}
|
|
363
|
-
const newFirstDynamicIdx = finalMessages.findIndex((m) => m.id && !initialHistoryIds.has(m.id));
|
|
364
|
-
const splitIdx = newFirstDynamicIdx === -1 ? finalMessages.length : newFirstDynamicIdx;
|
|
365
|
-
return {
|
|
366
|
-
kind: "ok",
|
|
367
|
-
messages: finalMessages,
|
|
368
|
-
stableMessages: finalMessages.slice(0, splitIdx),
|
|
369
|
-
dynamicMessages: finalMessages.slice(splitIdx)
|
|
370
|
-
};
|
|
193
|
+
return { messages: !supportsVision && hasImages ? stripImagePartsFromMessages(messages) : messages };
|
|
371
194
|
}
|
|
372
195
|
|
|
373
196
|
// packages/agent-runtime/toolCallPairing.ts
|
|
@@ -1213,19 +1036,9 @@ function prepareHistoryForNextTurn(history, contextReferenceResolver) {
|
|
|
1213
1036
|
};
|
|
1214
1037
|
});
|
|
1215
1038
|
}
|
|
1216
|
-
var IMAGE_OMITTED_PLACEHOLDER2 = "[Image content omitted: model does not support image input]";
|
|
1217
|
-
function stripImagePartsFromContent2(content) {
|
|
1218
|
-
if (!Array.isArray(content)) return content;
|
|
1219
|
-
const filtered = content.filter((part) => part?.type !== "image_url");
|
|
1220
|
-
if (filtered.length === 0) return IMAGE_OMITTED_PLACEHOLDER2;
|
|
1221
|
-
return filtered;
|
|
1222
|
-
}
|
|
1223
1039
|
function filterImagePartsFromMessages(messages, supportsImages) {
|
|
1224
1040
|
if (supportsImages) return messages;
|
|
1225
|
-
return messages
|
|
1226
|
-
...msg,
|
|
1227
|
-
content: stripImagePartsFromContent2(msg.content)
|
|
1228
|
-
}));
|
|
1041
|
+
return stripImagePartsFromMessages(messages);
|
|
1229
1042
|
}
|
|
1230
1043
|
function buildMessages(args) {
|
|
1231
1044
|
if (args.contextBlockScopes?.length) {
|
|
@@ -1468,26 +1281,12 @@ async function runLocalAgentTurn(input) {
|
|
|
1468
1281
|
hasVision: agentConfig.hasVision
|
|
1469
1282
|
});
|
|
1470
1283
|
if (!supportsImages && hasImageInRuntimeMessages(messages)) {
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
messages = preprocessed;
|
|
1478
|
-
emitLoopEvent(input, {
|
|
1479
|
-
kind: "image-preprocessed",
|
|
1480
|
-
atMs: Date.now(),
|
|
1481
|
-
imageCount: imageUrls.length
|
|
1482
|
-
});
|
|
1483
|
-
} else {
|
|
1484
|
-
messages = filterImagePartsFromMessages(messages, false);
|
|
1485
|
-
emitLoopEvent(input, {
|
|
1486
|
-
kind: "image-downgraded",
|
|
1487
|
-
reason: "no-vision",
|
|
1488
|
-
atMs: Date.now()
|
|
1489
|
-
});
|
|
1490
|
-
}
|
|
1284
|
+
messages = filterImagePartsFromMessages(messages, false);
|
|
1285
|
+
emitLoopEvent(input, {
|
|
1286
|
+
kind: "image-downgraded",
|
|
1287
|
+
reason: "no-vision",
|
|
1288
|
+
atMs: Date.now()
|
|
1289
|
+
});
|
|
1491
1290
|
}
|
|
1492
1291
|
const userInputText = extractUserInputText(input.input);
|
|
1493
1292
|
let toolCallCount = 0;
|
|
@@ -1789,7 +1588,7 @@ export {
|
|
|
1789
1588
|
readCommandActionGatePayload,
|
|
1790
1589
|
readActionGate,
|
|
1791
1590
|
summarizeToolArguments,
|
|
1792
|
-
|
|
1591
|
+
stripImagePartsForTextOnlyAgent,
|
|
1793
1592
|
resolveHistoricalToolContentCap,
|
|
1794
1593
|
projectToolMessageContent,
|
|
1795
1594
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
readAction,
|
|
14
14
|
readRequestManager,
|
|
15
15
|
resolveAgentReadServers
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-KZB5SNYH.js";
|
|
17
17
|
import {
|
|
18
18
|
asyncThunkCreator,
|
|
19
19
|
buildCreateSlice,
|
|
@@ -707,7 +707,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
707
707
|
// 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
|
|
708
708
|
read: create.asyncThunk(
|
|
709
709
|
async (payload, thunkApi) => {
|
|
710
|
-
const { readAction: readAction2 } = await import("./read-
|
|
710
|
+
const { readAction: readAction2 } = await import("./read-526GJR3R.js");
|
|
711
711
|
return readAction2(payload, thunkApi);
|
|
712
712
|
},
|
|
713
713
|
{
|
|
@@ -781,7 +781,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
781
781
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
782
782
|
share: create.asyncThunk(
|
|
783
783
|
async (config, thunkApi) => {
|
|
784
|
-
const { shareResourceAction } = await import("./action-
|
|
784
|
+
const { shareResourceAction } = await import("./action-Q4KO7DDW.js");
|
|
785
785
|
return shareResourceAction(config, thunkApi);
|
|
786
786
|
}
|
|
787
787
|
),
|
|
@@ -567,8 +567,6 @@ var PLATFORM_HOSTED_GEMINI_37_FLASH_PRICE = {
|
|
|
567
567
|
// 0.6 credits
|
|
568
568
|
};
|
|
569
569
|
var isPlatformHostedGeminiModel = (model) => asTrimmedLowercaseString(model) === PLATFORM_HOSTED_GEMINI_37_FLASH_MODEL;
|
|
570
|
-
var PLATFORM_HOSTED_QWEN_37_FLASH_MODEL = "qwen3.7-flash";
|
|
571
|
-
var isPlatformHostedQwen37FlashModel = (model) => asTrimmedLowercaseString(model) === PLATFORM_HOSTED_QWEN_37_FLASH_MODEL;
|
|
572
570
|
var PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL = "deepseek-v4-flash";
|
|
573
571
|
var PLATFORM_HOSTED_DEEPSEEK_FLASH_VISION_EXP_MODEL = "deepseek-v4-flash-vision-exp";
|
|
574
572
|
var PLATFORM_HOSTED_DEEPSEEK_PRO_MODEL = "deepseek-v4-pro";
|
|
@@ -593,8 +591,12 @@ var PLATFORM_HOSTED_DEEPSEEK_PRO_OFF_PEAK_PRICE = {
|
|
|
593
591
|
output: 13.5
|
|
594
592
|
};
|
|
595
593
|
var isDeepSeekOffPeakBeijingTime = (nowMs = Date.now()) => {
|
|
596
|
-
const
|
|
597
|
-
|
|
594
|
+
const beijing = new Date(nowMs + 8 * 60 * 60 * 1e3);
|
|
595
|
+
const beijingDay = beijing.getUTCDay();
|
|
596
|
+
const beijingHour = beijing.getUTCHours();
|
|
597
|
+
if (beijingDay === 0 || beijingDay === 6) return true;
|
|
598
|
+
const isPeakWindow = beijingHour >= 9 && beijingHour < 12 || beijingHour >= 14 && beijingHour < 18;
|
|
599
|
+
return !isPeakWindow;
|
|
598
600
|
};
|
|
599
601
|
var getPlatformHostedDeepSeekV4Price = (model, nowMs = Date.now()) => {
|
|
600
602
|
const isOffPeak = isDeepSeekOffPeakBeijingTime(nowMs);
|
|
@@ -755,8 +757,6 @@ export {
|
|
|
755
757
|
isPlatformHostedKimiK26Model,
|
|
756
758
|
isPlatformHostedGlmModel,
|
|
757
759
|
isPlatformHostedGeminiModel,
|
|
758
|
-
PLATFORM_HOSTED_QWEN_37_FLASH_MODEL,
|
|
759
|
-
isPlatformHostedQwen37FlashModel,
|
|
760
760
|
PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
|
|
761
761
|
PLATFORM_HOSTED_DEEPSEEK_FLASH_VISION_EXP_MODEL,
|
|
762
762
|
PLATFORM_HOSTED_DEEPSEEK_FLASH_PEAK_PRICE,
|
|
@@ -32,10 +32,10 @@ import {
|
|
|
32
32
|
resolvePlatformAuthToken,
|
|
33
33
|
resolvePlatformServerUrl,
|
|
34
34
|
resolveProviderTransportDecision
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-OQVRTSZ5.js";
|
|
36
36
|
import {
|
|
37
37
|
clipCompactText
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-HCOIKLSH.js";
|
|
39
39
|
import {
|
|
40
40
|
isRecord
|
|
41
41
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
patch,
|
|
12
12
|
remove,
|
|
13
13
|
write
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6YH4UR3E.js";
|
|
15
15
|
import {
|
|
16
16
|
createAgentKey,
|
|
17
17
|
toTrimmedString
|
|
@@ -304,7 +304,7 @@ var slice = createSliceWithThunks({
|
|
|
304
304
|
const overrides = {};
|
|
305
305
|
if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
|
|
306
306
|
if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
|
|
307
|
-
const { _executeModel } = await import("./_executeModel-
|
|
307
|
+
const { _executeModel } = await import("./_executeModel-7JTMK4RG.js");
|
|
308
308
|
return _executeModel(
|
|
309
309
|
{
|
|
310
310
|
isStreaming: args.isStreaming ?? false,
|
|
@@ -325,7 +325,7 @@ var slice = createSliceWithThunks({
|
|
|
325
325
|
* - 循环直到无工具调用或触发其他运行时停止条件
|
|
326
326
|
*/
|
|
327
327
|
runAgent: create.asyncThunk(async (args, thunkApi) => {
|
|
328
|
-
const { runAgentClientLoop } = await import("./runAgentClientLoop-
|
|
328
|
+
const { runAgentClientLoop } = await import("./runAgentClientLoop-H7HEYRIW.js");
|
|
329
329
|
const { content: loopContent, toolCallCount } = await runAgentClientLoop(
|
|
330
330
|
{
|
|
331
331
|
agentKey: args.agentKey,
|
|
@@ -341,7 +341,7 @@ var slice = createSliceWithThunks({
|
|
|
341
341
|
* 聊天轮次流式 Agent 调用
|
|
342
342
|
*/
|
|
343
343
|
streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
|
|
344
|
-
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-
|
|
344
|
+
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-DXKMGZTX.js");
|
|
345
345
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
346
346
|
}),
|
|
347
347
|
/**
|