nolo-cli 0.28.0 → 0.29.0
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-SUMILI7E.js → _executeModel-YQ57CFSN.js} +20 -20
- package/{action-5MNAXR5B.js → action-6BM26ZYM.js} +4 -4
- package/{addContentAction-UNSYTVTB.js → addContentAction-HLTFX56O.js} +3 -3
- package/{addDialogAgentAction-LJGNP2AO.js → addDialogAgentAction-Q2TYWDO6.js} +2 -2
- package/{agentDeleteCommand-GEHAXWM6.js → agentDeleteCommand-VP4VLCMG.js} +10 -10
- package/{agentEmailCommands-PQXAKGK2.js → agentEmailCommands-PSLJLQRR.js} +23 -23
- package/{agentListCommands-V2IIWNTX.js → agentListCommands-MJJJG3OW.js} +11 -11
- package/{agentMachineCommands-Y47CABE2.js → agentMachineCommands-IP2A26V7.js} +10 -10
- package/{agentRecordCommands-UYUJUT4K.js → agentRecordCommands-3HK3AR3H.js} +23 -23
- package/{agentRunCommand-3P6CCJQK.js → agentRunCommand-2IX2ELJQ.js} +23 -23
- package/{agentRuntimeLocal-ZALQDCZ3.js → agentRuntimeLocal-VI3NHLDU.js} +7 -7
- package/{agentSlice-LH2YKWE7.js → agentSlice-RR6OT2BW.js} +3 -3
- package/{appDeleteCommands-XELAKISE.js → appDeleteCommands-SF2V6QYZ.js} +11 -11
- package/{appDeployCommands-PFHVHXJ3.js → appDeployCommands-3EPVR545.js} +11 -11
- package/{appDeployStatusCommands-RULB3DGE.js → appDeployStatusCommands-O65Y747J.js} +11 -11
- package/{appGetCommands-A3NLQ2U5.js → appGetCommands-AHDOF4SS.js} +11 -11
- package/{appListCommands-NQLJ7RHY.js → appListCommands-Y7YCXODU.js} +11 -11
- package/{chunk-7OYY7W4W.js → chunk-2IN43Q72.js} +3 -3
- package/{chunk-7IX2Z2IF.js → chunk-33K2M3AU.js} +2 -2
- package/{chunk-54VHTARN.js → chunk-3LJ4RSSF.js} +1 -1
- package/{chunk-HTLBU4ZY.js → chunk-4S7B6YC5.js} +7 -7
- package/{chunk-I6RJGORZ.js → chunk-BOPFLKHA.js} +1 -1
- package/{chunk-D36OKPFG.js → chunk-BYHN2CP5.js} +1 -1
- package/{chunk-OXLLFZNF.js → chunk-DBUNOYLF.js} +1 -1
- package/{chunk-S6KVFOUG.js → chunk-ENUJPSZN.js} +2 -2
- package/{chunk-MSXDPLDQ.js → chunk-FVY6KI5A.js} +1 -1
- package/{chunk-7ZKK4F22.js → chunk-I5TJCJQP.js} +1 -1
- package/{chunk-ROJI6DRT.js → chunk-INWBJPQC.js} +2 -2
- package/{chunk-FON47ACC.js → chunk-JYSXE6LE.js} +3 -3
- package/{chunk-PASYOZYI.js → chunk-KJJ6EWVW.js} +13 -11
- package/{chunk-ATGTWONB.js → chunk-MHHYH3JA.js} +1 -1
- package/{chunk-MY54LNPC.js → chunk-NV2VP27U.js} +2 -2
- package/{chunk-A6WDXLAG.js → chunk-P6TB7JIA.js} +158 -12
- package/{chunk-WCP5FDTF.js → chunk-PFTK5SEB.js} +21 -5
- package/{chunk-BTA2CW6H.js → chunk-PJI44RVC.js} +9 -9
- package/{chunk-JQ3LNEMS.js → chunk-PMSG3OGF.js} +51 -4
- package/{chunk-4O2L6YR5.js → chunk-POANOUUC.js} +3 -3
- package/{chunk-E4XWECLB.js → chunk-RLQXGHUQ.js} +2 -2
- package/{chunk-SFFG3HJH.js → chunk-SIZWJA7H.js} +4 -4
- package/{chunk-OMN2LILO.js → chunk-SRFEVECQ.js} +1 -1
- package/{chunk-UP7UFQOH.js → chunk-STOUEEBU.js} +1 -1
- package/{chunk-QUXMWSCQ.js → chunk-VEHCU5XV.js} +22 -66
- package/{chunk-XMAELUQW.js → chunk-VNMOLPVO.js} +20 -20
- package/{chunk-MALVZUYL.js → chunk-WPRSBZYN.js} +1 -1
- package/{chunk-RRWRVIQU.js → chunk-XISENOC2.js} +1 -1
- package/{chunk-4UYKPT74.js → chunk-YRMUYZ5H.js} +2 -2
- package/{chunk-JMSCXQUG.js → chunk-Z3LLUGD5.js} +1 -1
- package/{chunk-IVMPWUAR.js → chunk-ZXXAMM3K.js} +2 -2
- package/{chunk-D5D3XTWF.js → chunk-ZZYNGFTB.js} +58 -20
- package/{createAgentAutomationAction-FAYQK5ME.js → createAgentAutomationAction-PIKVVL2R.js} +8 -8
- package/{createDialogAction-NDBK6IQG.js → createDialogAction-DQCM7HHO.js} +9 -9
- package/{createPageAction-CQTLV7FP.js → createPageAction-W2DRG2J7.js} +8 -8
- package/{dbSlice-5BKDURDL.js → dbSlice-GOKRGQ47.js} +2 -2
- package/{dialogCommands-ZR42K2M5.js → dialogCommands-N4XKI6ZU.js} +11 -11
- package/{dialogSlice-ZLGEYKLO.js → dialogSlice-DZUQZISK.js} +8 -8
- package/{docCreateCommands-2WXA3BCQ.js → docCreateCommands-DTDKANXX.js} +10 -10
- package/{docDeleteCommands-HSL7CD32.js → docDeleteCommands-U4NB6OHK.js} +11 -11
- package/{docReadCommands-YSPUU2DP.js → docReadCommands-SDVQM3BH.js} +10 -10
- package/{docStore-LJQIY2ZU.js → docStore-NXDBQRDQ.js} +9 -9
- package/{docUpdateCommands-EFYOIVM7.js → docUpdateCommands-O2O644FV.js} +10 -10
- package/{handleSendMessageAction-JL6GGVNW.js → handleSendMessageAction-3MMYF664.js} +8 -8
- package/index.js +40 -40
- package/{machineCommands-VAANUFNC.js → machineCommands-QFDT6G2Q.js} +22 -22
- package/{machineWsRunDispatch-ABWV2WZO.js → machineWsRunDispatch-J6IBIDYG.js} +22 -22
- package/package.json +1 -1
- package/{read-F3L3T2WJ.js → read-A23NKT3O.js} +1 -1
- package/{readDocTool-FOHWVA4R.js → readDocTool-JAM5BI5Q.js} +1 -1
- package/{readlineWorkspace-GQI3XP5E.js → readlineWorkspace-FU7PWLJU.js} +26 -26
- package/{removeDialogAgentAction-QCFGIUIH.js → removeDialogAgentAction-K4HOWFHO.js} +4 -4
- package/{runAgentClientLoop-U632N2KO.js → runAgentClientLoop-P6J4YSE4.js} +17 -17
- package/{setDialogExtraReferencesAction-DK4CKERU.js → setDialogExtraReferencesAction-JD7J7JM4.js} +3 -3
- package/{setPrimaryDialogAgentAction-SJSO6N27.js → setPrimaryDialogAgentAction-YWSA5XEU.js} +4 -4
- package/{settingSlice-XNM5AFPU.js → settingSlice-22GTX6CA.js} +3 -3
- package/{spaceCommands-DE6KNJIV.js → spaceCommands-WM6W3WMQ.js} +10 -10
- package/{spaceSlice-QTMWWQHQ.js → spaceSlice-SVEWO5JX.js} +8 -8
- package/{streamAgentChatTurn-VU7BM3K3.js → streamAgentChatTurn-XJRY424B.js} +76 -32
- package/{switchDialogAgentAction-4OAC6QRN.js → switchDialogAgentAction-6JKFBJVR.js} +2 -2
- package/{tools-LSIS6NY6.js → tools-ZN6GWGYP.js} +15 -15
- package/{updateDialogTitleAction-T77A54DE.js → updateDialogTitleAction-ZJ2HF5AQ.js} +8 -8
- package/{chunk-ATWUOTJP.js → chunk-NWT2WUCY.js} +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MHHYH3JA.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-I5TJCJQP.js";
|
|
8
8
|
import {
|
|
9
9
|
toSafeAgentSummary
|
|
10
10
|
} from "./chunk-H7N2NOJF.js";
|
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
getModelContextWindow,
|
|
10
10
|
planCompression,
|
|
11
11
|
planContextUsage,
|
|
12
|
+
resolveBuiltinPlatformAgentConfig,
|
|
12
13
|
serializeMessageContent
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PMSG3OGF.js";
|
|
14
15
|
import {
|
|
15
16
|
clipCompactText
|
|
16
17
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -28,12 +29,18 @@ import {
|
|
|
28
29
|
import {
|
|
29
30
|
toErrorMessage
|
|
30
31
|
} from "./chunk-HNMXYYJR.js";
|
|
32
|
+
import {
|
|
33
|
+
PLATFORM_HOSTED_KIMI_K26_MODEL
|
|
34
|
+
} from "./chunk-YTA2QOEE.js";
|
|
31
35
|
import {
|
|
32
36
|
asRecordOrEmpty
|
|
33
37
|
} from "./chunk-KX6YBIHG.js";
|
|
34
38
|
import {
|
|
35
39
|
asTrimmedLowercaseString
|
|
36
40
|
} from "./chunk-QSJ3HFEF.js";
|
|
41
|
+
import {
|
|
42
|
+
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY
|
|
43
|
+
} from "./chunk-NWT2WUCY.js";
|
|
37
44
|
import {
|
|
38
45
|
isRecord
|
|
39
46
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -160,6 +167,118 @@ var resolveAgentImageInputSupport = (agent) => {
|
|
|
160
167
|
return true;
|
|
161
168
|
};
|
|
162
169
|
|
|
170
|
+
// packages/ai/agent/imagePreprocessing.ts
|
|
171
|
+
var DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY = PUBLIC_KIMI_K26_IMAGE_AGENT_KEY;
|
|
172
|
+
var DESCRIBE_IMAGE_PROMPT = "\u8BF7\u8BE6\u7EC6\u63CF\u8FF0\u8FD9\u5F20\u56FE\u7247\u7684\u5185\u5BB9\uFF0C\u5305\u62EC\u573A\u666F\u3001\u7269\u4F53\u3001\u6587\u5B57\u3001\u989C\u8272\u548C\u5E03\u5C40\u7B49\u5173\u952E\u4FE1\u606F\u3002";
|
|
173
|
+
function extractImageUrlsFromMessages(messages) {
|
|
174
|
+
const urls = [];
|
|
175
|
+
for (const msg of messages) {
|
|
176
|
+
if (!Array.isArray(msg.content)) continue;
|
|
177
|
+
for (const part of msg.content) {
|
|
178
|
+
if (part && typeof part === "object" && part.type === "image_url" && part.image_url && typeof part.image_url.url === "string" && part.image_url.url.trim()) {
|
|
179
|
+
urls.push(part.image_url.url);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return urls;
|
|
184
|
+
}
|
|
185
|
+
function hasImageInRuntimeMessages(messages) {
|
|
186
|
+
return extractImageUrlsFromMessages(messages).length > 0;
|
|
187
|
+
}
|
|
188
|
+
async function preprocessImagesForTextOnlyAgent(messages, describeImage) {
|
|
189
|
+
const imageUrls = extractImageUrlsFromMessages(messages);
|
|
190
|
+
if (imageUrls.length === 0) return messages;
|
|
191
|
+
const description = await describeImage(imageUrls);
|
|
192
|
+
if (description === null || !description.trim()) return messages;
|
|
193
|
+
const descriptionText = `[\u56FE\u7247\u63CF\u8FF0] ${description.trim()}`;
|
|
194
|
+
return messages.map((msg) => {
|
|
195
|
+
if (!Array.isArray(msg.content)) return msg;
|
|
196
|
+
const hasImage = msg.content.some((p) => p?.type === "image_url");
|
|
197
|
+
if (!hasImage) return msg;
|
|
198
|
+
const newContent = msg.content.map((part) => {
|
|
199
|
+
if (part && typeof part === "object" && part.type === "image_url") {
|
|
200
|
+
return { type: "text", text: descriptionText };
|
|
201
|
+
}
|
|
202
|
+
return part;
|
|
203
|
+
}).filter((p) => p !== null && p !== void 0);
|
|
204
|
+
return { ...msg, content: newContent };
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
async function describeImageWithLocalProvider(adapter, imageUrls, visionAgentConfig) {
|
|
208
|
+
if (imageUrls.length === 0) return null;
|
|
209
|
+
try {
|
|
210
|
+
const config = visionAgentConfig ?? resolveBuiltinPlatformAgentConfig(DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY);
|
|
211
|
+
if (!config) {
|
|
212
|
+
console.warn("[imagePreprocessing] vision agent config not found, skipping");
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
const visionProvider = await adapter.resolveProvider(config);
|
|
216
|
+
const contentParts = [
|
|
217
|
+
{ type: "text", text: DESCRIBE_IMAGE_PROMPT }
|
|
218
|
+
];
|
|
219
|
+
for (const url of imageUrls) {
|
|
220
|
+
contentParts.push({ type: "image_url", image_url: { url } });
|
|
221
|
+
}
|
|
222
|
+
const result = await visionProvider.complete(
|
|
223
|
+
[{ role: "user", content: contentParts }],
|
|
224
|
+
{ timeoutMs: 3e4 }
|
|
225
|
+
);
|
|
226
|
+
const text = result.content?.trim();
|
|
227
|
+
if (!text) return null;
|
|
228
|
+
return text;
|
|
229
|
+
} catch (error) {
|
|
230
|
+
console.warn("[imagePreprocessing] vision describe failed, will fallback:", error);
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async function describeImageViaServerProxy(serverUrl, authToken, imageUrls, visionAgentKey) {
|
|
235
|
+
if (imageUrls.length === 0) return null;
|
|
236
|
+
const agentKey = visionAgentKey ?? DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY;
|
|
237
|
+
const visionConfig = resolveBuiltinPlatformAgentConfig(agentKey);
|
|
238
|
+
const visionModel = visionConfig?.model ?? PLATFORM_HOSTED_KIMI_K26_MODEL;
|
|
239
|
+
const visionProvider = visionConfig?.provider ?? "nolo";
|
|
240
|
+
try {
|
|
241
|
+
const contentParts = [
|
|
242
|
+
{ type: "text", text: DESCRIBE_IMAGE_PROMPT }
|
|
243
|
+
];
|
|
244
|
+
for (const url of imageUrls) {
|
|
245
|
+
contentParts.push({ type: "image_url", image_url: { url } });
|
|
246
|
+
}
|
|
247
|
+
const payload = {
|
|
248
|
+
model: visionModel,
|
|
249
|
+
messages: [{ role: "user", content: contentParts }],
|
|
250
|
+
stream: false,
|
|
251
|
+
provider: visionProvider,
|
|
252
|
+
agentKey,
|
|
253
|
+
// server proxy 需要 url 字段,但 nolo 平台 agent 的上游由 server 端路由,
|
|
254
|
+
// 这里放一个占位 url,server 端会根据 provider/model 覆盖。
|
|
255
|
+
url: "https://api.ollama.com/v1/chat/completions"
|
|
256
|
+
};
|
|
257
|
+
const response = await fetch(`${serverUrl}/api/chat`, {
|
|
258
|
+
method: "POST",
|
|
259
|
+
headers: {
|
|
260
|
+
"Content-Type": "application/json",
|
|
261
|
+
Authorization: `Bearer ${authToken}`
|
|
262
|
+
},
|
|
263
|
+
body: JSON.stringify(payload),
|
|
264
|
+
signal: AbortSignal.timeout(3e4)
|
|
265
|
+
});
|
|
266
|
+
if (!response.ok) {
|
|
267
|
+
console.warn(`[imagePreprocessing] server proxy vision call failed: ${response.status}`);
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
const data = await response.json();
|
|
271
|
+
const text = data?.choices?.[0]?.message?.content;
|
|
272
|
+
if (typeof text === "string" && text.trim()) {
|
|
273
|
+
return text.trim();
|
|
274
|
+
}
|
|
275
|
+
return null;
|
|
276
|
+
} catch (error) {
|
|
277
|
+
console.warn("[imagePreprocessing] server proxy vision describe failed:", error);
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
163
282
|
// packages/agent-runtime/toolCallPairing.ts
|
|
164
283
|
function readToolCallId(message) {
|
|
165
284
|
if (typeof message.tool_call_id === "string" && message.tool_call_id) {
|
|
@@ -1348,17 +1467,42 @@ async function runLocalAgentTurn(input) {
|
|
|
1348
1467
|
partialContent = "";
|
|
1349
1468
|
throwIfAborted(input);
|
|
1350
1469
|
const preparedMessages = prepareMessagesForProviderCall(messages);
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1470
|
+
let baseRequestMessages;
|
|
1471
|
+
if (!supportsImages && hasImageInRuntimeMessages(preparedMessages.messages)) {
|
|
1472
|
+
const imageUrls = extractImageUrlsFromMessages(preparedMessages.messages);
|
|
1473
|
+
const preprocessed = await preprocessImagesForTextOnlyAgent(
|
|
1474
|
+
preparedMessages.messages,
|
|
1475
|
+
(urls) => describeImageWithLocalProvider(input.adapter, urls)
|
|
1476
|
+
);
|
|
1477
|
+
if (preprocessed !== preparedMessages.messages) {
|
|
1478
|
+
baseRequestMessages = preprocessed;
|
|
1479
|
+
if (!imageDowngradeNotified) {
|
|
1480
|
+
imageDowngradeNotified = true;
|
|
1481
|
+
emitLoopEvent(input, {
|
|
1482
|
+
kind: "image-preprocessed",
|
|
1483
|
+
atMs: Date.now(),
|
|
1484
|
+
imageCount: imageUrls.length
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
} else {
|
|
1488
|
+
baseRequestMessages = filterImagePartsFromMessages(
|
|
1489
|
+
preparedMessages.messages,
|
|
1490
|
+
supportsImages
|
|
1491
|
+
);
|
|
1492
|
+
if (!imageDowngradeNotified) {
|
|
1493
|
+
imageDowngradeNotified = true;
|
|
1494
|
+
emitLoopEvent(input, {
|
|
1495
|
+
kind: "image-downgraded",
|
|
1496
|
+
reason: "no-vision",
|
|
1497
|
+
atMs: Date.now()
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
} else {
|
|
1502
|
+
baseRequestMessages = filterImagePartsFromMessages(
|
|
1503
|
+
preparedMessages.messages,
|
|
1504
|
+
supportsImages
|
|
1505
|
+
);
|
|
1362
1506
|
}
|
|
1363
1507
|
const requestMessages = emptyAssistantRepairPending ? [...baseRequestMessages, { role: "user", content: EMPTY_ASSISTANT_REPAIR_PROMPT }] : baseRequestMessages;
|
|
1364
1508
|
const contextMetrics = {
|
|
@@ -1636,6 +1780,8 @@ export {
|
|
|
1636
1780
|
parseToolArgumentsJson,
|
|
1637
1781
|
summarizeToolArguments,
|
|
1638
1782
|
resolveAgentImageInputSupport,
|
|
1783
|
+
preprocessImagesForTextOnlyAgent,
|
|
1784
|
+
describeImageViaServerProxy,
|
|
1639
1785
|
resolveHistoricalToolContentCap,
|
|
1640
1786
|
projectToolMessageContent,
|
|
1641
1787
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
@@ -173,9 +173,16 @@ function buildNoloWorkspaceOpenAiTools(args) {
|
|
|
173
173
|
limit: { type: "integer", description: "Maximum dialogs to return." },
|
|
174
174
|
space: stringToolParam("Optional space id or URL.")
|
|
175
175
|
});
|
|
176
|
-
add("readDialog",
|
|
177
|
-
dialog: stringToolParam("Dialog dbKey (dialog-<userId>-<id>), dialog URL, or bare id (
|
|
178
|
-
|
|
176
|
+
add("readDialog", `Read one persisted dialog (metadata + messages) by full dbKey (dialog-<userId>-<id>) or URL. Use listDialogs first if target is unclear; a bare id resolves against the current user, pass user for someone else's dialog. Reading an agent run's dialog is fine at any time, but do not poll a still-running one through the full transcript: if controlAgentRun is available prefer it for live runs, otherwise use mode="status" for a compact snapshot, and pull the full transcript once the run is done/failed/cancelled.`, {
|
|
177
|
+
dialog: stringToolParam("Dialog dbKey (dialog-<userId>-<id>), dialog URL, or bare id (resolved against user/current account)."),
|
|
178
|
+
mode: {
|
|
179
|
+
type: "string",
|
|
180
|
+
enum: ["full", "status"],
|
|
181
|
+
description: "full (default) returns meta + messages; status returns a compact run snapshot (status/checkpoint/tools/files/error) without the transcript \u2014 prefer it when you only need to know whether an agent run is still active or how it ended."
|
|
182
|
+
},
|
|
183
|
+
limit: { type: "integer", description: "Max messages to return in mode=full, newest first. Omit for the complete transcript; a small limit can hide earlier tool calls. Ignored in mode=status." },
|
|
184
|
+
user: stringToolParam("Owner userId for a bare dialog id (e.g. a child run started by another account). Ignored when dialog is a dbKey or URL."),
|
|
185
|
+
server: stringToolParam("Optional server base URL to read from, e.g. when the dialog lives on another machine's nolo server.")
|
|
179
186
|
}, ["dialog"]);
|
|
180
187
|
add("queryDialogsBySubjectRef", "Query persisted dialog evidence by a generic dialog.subjectRefs target.", {
|
|
181
188
|
rowDbKey: stringToolParam("Optional alias for subjectKind=table-row, subjectId=<rowDbKey>, subjectRole=task."),
|
|
@@ -491,9 +498,18 @@ function buildNoloWorkspaceCommandArgs(call) {
|
|
|
491
498
|
case "readDialog": {
|
|
492
499
|
const dialog = noloStringArg(args.dialog ?? args.dialogId ?? args.id);
|
|
493
500
|
if (!dialog) throw new Error("readDialog requires dialog.");
|
|
494
|
-
const
|
|
495
|
-
|
|
501
|
+
const mode = noloStringArg(args.mode);
|
|
502
|
+
if (mode && mode !== "full" && mode !== "status") {
|
|
503
|
+
throw new Error(`readDialog mode must be "full" or "status", got "${mode}".`);
|
|
504
|
+
}
|
|
505
|
+
const statusMode = mode === "status";
|
|
506
|
+
const cliArgs = ["dialog", statusMode ? "status" : "read", dialog];
|
|
507
|
+
const limit = statusMode ? null : noloPositiveIntegerString(args.limit);
|
|
496
508
|
if (limit) cliArgs.push(limit);
|
|
509
|
+
const user = noloStringArg(args.user ?? args.userId ?? args.owner);
|
|
510
|
+
if (user) cliArgs.push("--user", user);
|
|
511
|
+
const server = noloStringArg(args.server ?? args.serverBase ?? args.serverUrl);
|
|
512
|
+
if (server) cliArgs.push("--server", server);
|
|
497
513
|
return cliArgs;
|
|
498
514
|
}
|
|
499
515
|
case "queryDialogsBySubjectRef": {
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
inlineImageUrlsForCustomProvider,
|
|
6
6
|
prepareTools,
|
|
7
7
|
shouldInlineImageUrlsForAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BYHN2CP5.js";
|
|
9
9
|
import {
|
|
10
10
|
performFetchRequest
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4S7B6YC5.js";
|
|
12
12
|
import {
|
|
13
13
|
createSSEParser,
|
|
14
14
|
createToolRunId,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
toolRunSetPending,
|
|
20
20
|
toolRunStarted,
|
|
21
21
|
toolRunSucceeded
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VNMOLPVO.js";
|
|
23
23
|
import {
|
|
24
24
|
getPublicImageAgentMode
|
|
25
25
|
} from "./chunk-VIDPVFP3.js";
|
|
@@ -29,13 +29,13 @@ import {
|
|
|
29
29
|
messageStreaming,
|
|
30
30
|
selectCurrentSpaceId,
|
|
31
31
|
updateToolMessage
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-VEHCU5XV.js";
|
|
33
33
|
import {
|
|
34
34
|
streamAgentChatTurn
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-SIZWJA7H.js";
|
|
36
36
|
import {
|
|
37
37
|
EMPTY_ASSISTANT_REPAIR_PROMPT
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-P6TB7JIA.js";
|
|
39
39
|
import {
|
|
40
40
|
accumulateToolCallDelta,
|
|
41
41
|
createThinkParserState,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
} from "./chunk-N7J63Q6C.js";
|
|
48
48
|
import {
|
|
49
49
|
getModelInfo
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-PMSG3OGF.js";
|
|
51
51
|
import {
|
|
52
52
|
getApiEndpoint
|
|
53
53
|
} from "./chunk-GT3GG2H7.js";
|
|
@@ -61,10 +61,10 @@ import {
|
|
|
61
61
|
} from "./chunk-HNMXYYJR.js";
|
|
62
62
|
import {
|
|
63
63
|
selectCurrentServer
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-ENUJPSZN.js";
|
|
65
65
|
import {
|
|
66
66
|
write
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-JYSXE6LE.js";
|
|
68
68
|
import {
|
|
69
69
|
createDialogMessageKeyAndId,
|
|
70
70
|
dialogMessageKey,
|
|
@@ -6,17 +6,21 @@ import {
|
|
|
6
6
|
} from "./chunk-L3QFIBZG.js";
|
|
7
7
|
import {
|
|
8
8
|
addContentAction
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DBUNOYLF.js";
|
|
10
10
|
import {
|
|
11
11
|
upload
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JYSXE6LE.js";
|
|
13
13
|
import {
|
|
14
14
|
PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
|
|
15
|
-
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY
|
|
16
|
-
|
|
15
|
+
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
|
|
16
|
+
builtinRuntimeFallbackEntries
|
|
17
|
+
} from "./chunk-NWT2WUCY.js";
|
|
17
18
|
import {
|
|
18
19
|
getRuntimeServerContext
|
|
19
20
|
} from "./chunk-XMLRJUU5.js";
|
|
21
|
+
import {
|
|
22
|
+
publicAgentKey
|
|
23
|
+
} from "./chunk-SLOGKB7M.js";
|
|
20
24
|
import {
|
|
21
25
|
API_ENDPOINTS
|
|
22
26
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -24,6 +28,47 @@ import {
|
|
|
24
28
|
normalizeServerOrigin
|
|
25
29
|
} from "./chunk-CF7PE763.js";
|
|
26
30
|
|
|
31
|
+
// packages/agent-runtime/builtinPlatformAgentConfigs.ts
|
|
32
|
+
function buildConfig(e) {
|
|
33
|
+
const key = publicAgentKey(e.id);
|
|
34
|
+
const rawRecord = {
|
|
35
|
+
dbKey: key,
|
|
36
|
+
isPublic: true,
|
|
37
|
+
provider: e.provider,
|
|
38
|
+
model: e.model,
|
|
39
|
+
apiSource: e.apiSource ?? "platform",
|
|
40
|
+
useServerProxy: e.useServerProxy ?? true
|
|
41
|
+
};
|
|
42
|
+
if (e.hasImageOutput) rawRecord.hasImageOutput = true;
|
|
43
|
+
if (e.imageModel) rawRecord.imageModel = e.imageModel;
|
|
44
|
+
if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
|
|
45
|
+
if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
|
|
46
|
+
return {
|
|
47
|
+
key,
|
|
48
|
+
name: e.name,
|
|
49
|
+
provider: e.provider,
|
|
50
|
+
model: e.model,
|
|
51
|
+
apiSource: e.apiSource ?? "platform",
|
|
52
|
+
useServerProxy: e.useServerProxy ?? true,
|
|
53
|
+
rawRecord
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
|
|
57
|
+
builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
|
|
58
|
+
);
|
|
59
|
+
function resolveBuiltinPlatformAgentConfig(agentRef) {
|
|
60
|
+
return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
|
|
61
|
+
}
|
|
62
|
+
function resolveBuiltinPlatformAgentRecord(agentRef) {
|
|
63
|
+
const config = resolveBuiltinPlatformAgentConfig(agentRef);
|
|
64
|
+
if (!config) return null;
|
|
65
|
+
return {
|
|
66
|
+
...config.rawRecord,
|
|
67
|
+
dbKey: agentRef,
|
|
68
|
+
...config.name ? { name: config.name } : {}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
27
72
|
// packages/ai/context/tokenUtils.ts
|
|
28
73
|
var estimateTokenCount = (text) => {
|
|
29
74
|
if (!text) return 0;
|
|
@@ -608,6 +653,8 @@ var DEFAULT_AUTO_EXECUTION_PROFILE = AUTO_EXECUTION_PROFILES[DEFAULT_AUTO_EXECUT
|
|
|
608
653
|
var resolveAutoExecutionProfile = (tier) => AUTO_EXECUTION_PROFILES[tier ?? DEFAULT_AUTO_EXECUTION_TIER] ?? DEFAULT_AUTO_EXECUTION_PROFILE;
|
|
609
654
|
|
|
610
655
|
export {
|
|
656
|
+
resolveBuiltinPlatformAgentConfig,
|
|
657
|
+
resolveBuiltinPlatformAgentRecord,
|
|
611
658
|
planContextUsage,
|
|
612
659
|
estimateTokenCount,
|
|
613
660
|
DEFAULT_CONTEXT_WINDOW,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
3
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KJJ6EWVW.js";
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VNMOLPVO.js";
|
|
8
8
|
import {
|
|
9
9
|
runLocalAgentTurn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-P6TB7JIA.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveLocalRuntimeEnvFromPolicy
|
|
13
13
|
} from "./chunk-5CS33IBL.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KJJ6EWVW.js";
|
|
4
4
|
import {
|
|
5
5
|
getReadableCliDb
|
|
6
6
|
} from "./chunk-WFHXMLHZ.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveAgentRecordFromHybridStore,
|
|
13
13
|
sanitizeAgentRecordForCliOutput,
|
|
14
14
|
writeAgentRecord
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I5TJCJQP.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveCliAgentKeyInput
|
|
18
18
|
} from "./chunk-VHBWHNVT.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
patch,
|
|
12
12
|
remove,
|
|
13
13
|
write
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JYSXE6LE.js";
|
|
15
15
|
import {
|
|
16
16
|
createAgentKey,
|
|
17
17
|
toTrimmedString
|
|
@@ -300,7 +300,7 @@ var slice = createSliceWithThunks({
|
|
|
300
300
|
const overrides = {};
|
|
301
301
|
if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
|
|
302
302
|
if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
|
|
303
|
-
const { _executeModel } = await import("./_executeModel-
|
|
303
|
+
const { _executeModel } = await import("./_executeModel-YQ57CFSN.js");
|
|
304
304
|
return _executeModel(
|
|
305
305
|
{
|
|
306
306
|
isStreaming: args.isStreaming ?? false,
|
|
@@ -321,7 +321,7 @@ var slice = createSliceWithThunks({
|
|
|
321
321
|
* - 循环直到无工具调用或触发其他运行时停止条件
|
|
322
322
|
*/
|
|
323
323
|
runAgent: create.asyncThunk(async (args, thunkApi) => {
|
|
324
|
-
const { runAgentClientLoop } = await import("./runAgentClientLoop-
|
|
324
|
+
const { runAgentClientLoop } = await import("./runAgentClientLoop-P6J4YSE4.js");
|
|
325
325
|
const { content: loopContent, toolCallCount } = await runAgentClientLoop(
|
|
326
326
|
{
|
|
327
327
|
agentKey: args.agentKey,
|
|
@@ -337,7 +337,7 @@ var slice = createSliceWithThunks({
|
|
|
337
337
|
* 聊天轮次流式 Agent 调用
|
|
338
338
|
*/
|
|
339
339
|
streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
|
|
340
|
-
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-
|
|
340
|
+
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-XJRY424B.js");
|
|
341
341
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
342
342
|
}),
|
|
343
343
|
/**
|