nolo-cli 0.27.1 → 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-M6KLIXW5.js → _executeModel-YQ57CFSN.js} +23 -23
- 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-VFHDZJG3.js → agentDeleteCommand-VP4VLCMG.js} +12 -12
- package/{agentEmailCommands-NQ3SJXZX.js → agentEmailCommands-PSLJLQRR.js} +28 -28
- package/{agentListCommands-BDDUYHLP.js → agentListCommands-MJJJG3OW.js} +13 -13
- package/{agentMachineCommands-5WU7B2UY.js → agentMachineCommands-IP2A26V7.js} +12 -12
- package/{agentRecordCommands-FFFARZTU.js → agentRecordCommands-3HK3AR3H.js} +27 -27
- package/{agentRunCommand-GZYQTIYF.js → agentRunCommand-2IX2ELJQ.js} +28 -28
- package/{agentRuntimeLocal-552R4CZA.js → agentRuntimeLocal-VI3NHLDU.js} +9 -9
- package/{agentSlice-N7E7SG25.js → agentSlice-RR6OT2BW.js} +3 -3
- package/{appDeleteCommands-IPJT6IYW.js → appDeleteCommands-SF2V6QYZ.js} +13 -13
- package/{appDeployCommands-24P4CADQ.js → appDeployCommands-3EPVR545.js} +13 -13
- package/{appDeployStatusCommands-3DRZOUAG.js → appDeployStatusCommands-O65Y747J.js} +13 -13
- package/{appGetCommands-JEOSBLUL.js → appGetCommands-AHDOF4SS.js} +13 -13
- package/{appListCommands-EIBM54WR.js → appListCommands-Y7YCXODU.js} +13 -13
- package/{authCommand-MKMYHD52.js → authCommand-XMQHBK5L.js} +470 -40
- package/chunk-2FX23RGA.js +162 -0
- package/{chunk-ESKT7YVG.js → chunk-2IN43Q72.js} +3 -3
- package/{chunk-6MBOZ4UP.js → chunk-2TYLTEAH.js} +1 -1
- package/{chunk-TTPVLL5F.js → chunk-33K2M3AU.js} +9 -9
- package/{chunk-54VHTARN.js → chunk-3LJ4RSSF.js} +1 -1
- package/{chunk-J2GZXLI7.js → chunk-4S7B6YC5.js} +9 -9
- package/{chunk-I6RJGORZ.js → chunk-BOPFLKHA.js} +1 -1
- package/{chunk-FL42U2NZ.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-O5VFD7V6.js → chunk-FVY6KI5A.js} +1 -1
- package/{chunk-ZNFZGHKL.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-C4KV25UH.js → chunk-KJJ6EWVW.js} +28 -69
- package/{chunk-KXEWHQAW.js → chunk-MHHYH3JA.js} +1 -1
- package/{chunk-NCRWA6ZB.js → chunk-NV2VP27U.js} +2 -2
- package/{chunk-YZV4676I.js → chunk-P6TB7JIA.js} +160 -14
- package/{chunk-WCP5FDTF.js → chunk-PFTK5SEB.js} +21 -5
- package/{chunk-PPAJNYFB.js → chunk-PJI44RVC.js} +9 -9
- package/{chunk-AL2V7U3E.js → chunk-PJY5AH5A.js} +25 -8
- package/{chunk-JQ3LNEMS.js → chunk-PMSG3OGF.js} +51 -4
- package/{chunk-NWDOO373.js → chunk-POANOUUC.js} +3 -3
- package/chunk-PSK2RUHV.js +529 -0
- package/{chunk-BAKXXTAC.js → chunk-RLQXGHUQ.js} +2 -2
- package/{chunk-7ORW7XI4.js → chunk-SIZWJA7H.js} +4 -4
- package/{chunk-6V6MYXPV.js → chunk-SRFEVECQ.js} +1 -1
- package/{chunk-7WMLPRXP.js → chunk-STOUEEBU.js} +1 -1
- package/{chunk-4OHJCHIL.js → chunk-VEHCU5XV.js} +35 -105
- package/{chunk-AYQYOZYH.js → chunk-VNMOLPVO.js} +23 -23
- package/{chunk-MALVZUYL.js → chunk-WPRSBZYN.js} +1 -1
- package/{chunk-VV4TYWNV.js → chunk-WX3ZOSTL.js} +376 -656
- package/{chunk-PVWFM7JP.js → chunk-XISENOC2.js} +1 -1
- package/{chunk-X43U4JUJ.js → chunk-YRMUYZ5H.js} +2 -2
- package/{chunk-JMSCXQUG.js → chunk-Z3LLUGD5.js} +1 -1
- package/{chunk-7OBMZCRD.js → chunk-ZVZMT3EA.js} +7 -5
- package/{chunk-4RXTDRTJ.js → chunk-ZXXAMM3K.js} +2 -2
- package/{chunk-MAFUFDFV.js → chunk-ZZYNGFTB.js} +81 -48
- package/{createAgentAutomationAction-GU766YRL.js → createAgentAutomationAction-PIKVVL2R.js} +8 -8
- package/{createDialogAction-ADMDJITX.js → createDialogAction-DQCM7HHO.js} +9 -9
- package/{createPageAction-N7EZJVO5.js → createPageAction-W2DRG2J7.js} +8 -8
- package/{dbSlice-5BKDURDL.js → dbSlice-GOKRGQ47.js} +2 -2
- package/{dialogCommands-O4CJJRTQ.js → dialogCommands-N4XKI6ZU.js} +13 -13
- package/{dialogSlice-JB5YIV5K.js → dialogSlice-DZUQZISK.js} +8 -8
- package/{docCreateCommands-2U5AIF3O.js → docCreateCommands-DTDKANXX.js} +12 -12
- package/{docDeleteCommands-EDCAUQEF.js → docDeleteCommands-U4NB6OHK.js} +13 -13
- package/{docReadCommands-KFMBFGPY.js → docReadCommands-SDVQM3BH.js} +12 -12
- package/{docStore-EXPYXKAO.js → docStore-NXDBQRDQ.js} +9 -9
- package/{docUpdateCommands-57M4XOT7.js → docUpdateCommands-O2O644FV.js} +12 -12
- package/{handleSendMessageAction-5E3MBI4X.js → handleSendMessageAction-3MMYF664.js} +8 -8
- package/index.js +46 -46
- package/{machineCommands-UPDXXKGX.js → machineCommands-QFDT6G2Q.js} +26 -26
- package/{machineWsRunDispatch-M43IR6SD.js → machineWsRunDispatch-J6IBIDYG.js} +26 -26
- 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-NEADCABU.js → readlineWorkspace-FU7PWLJU.js} +52 -55
- package/{removeDialogAgentAction-QCFGIUIH.js → removeDialogAgentAction-K4HOWFHO.js} +4 -4
- package/{runAgentClientLoop-NYY3IGNZ.js → runAgentClientLoop-P6J4YSE4.js} +19 -19
- 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/{skillDiscovery-KJWT7JBU.js → skillDiscovery-ITA7BI7A.js} +4 -2
- package/{spaceCommands-XK46FRYG.js → spaceCommands-WM6W3WMQ.js} +12 -12
- package/{spaceSlice-S6HBDF4N.js → spaceSlice-SVEWO5JX.js} +8 -8
- package/{streamAgentChatTurn-2NP4RW7O.js → streamAgentChatTurn-XJRY424B.js} +79 -35
- package/{switchDialogAgentAction-4OAC6QRN.js → switchDialogAgentAction-6JKFBJVR.js} +2 -2
- package/{tools-2HPUZOTG.js → tools-ZN6GWGYP.js} +15 -15
- package/{updateDialogTitleAction-27EH4CEC.js → updateDialogTitleAction-ZJ2HF5AQ.js} +8 -8
- package/chunk-UTYJ47H2.js +0 -51
- package/chunk-ZJ7WLPDP.js +0 -553
- 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";
|
|
@@ -3,14 +3,15 @@ import {
|
|
|
3
3
|
buildIdentityBlock,
|
|
4
4
|
buildRuntimeGuidanceBlocks,
|
|
5
5
|
resolveToolGuidedSections
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PSK2RUHV.js";
|
|
7
7
|
import {
|
|
8
8
|
estimateTokenCount,
|
|
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";
|
|
@@ -20,7 +21,7 @@ import {
|
|
|
20
21
|
} from "./chunk-GT3GG2H7.js";
|
|
21
22
|
import {
|
|
22
23
|
buildDialogSummaryLayer
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PJY5AH5A.js";
|
|
24
25
|
import {
|
|
25
26
|
canonicalizeToolName,
|
|
26
27
|
canonicalizeToolNames
|
|
@@ -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,
|
|
@@ -77,20 +77,26 @@ var buildSpaceContextLayer = async (args) => {
|
|
|
77
77
|
].join("\n")
|
|
78
78
|
);
|
|
79
79
|
};
|
|
80
|
-
var buildSkillDiscoveryLayer = (skills,
|
|
80
|
+
var buildSkillDiscoveryLayer = (skills, _boundFolder) => {
|
|
81
81
|
if (skills.length === 0) return null;
|
|
82
82
|
const lines = [
|
|
83
83
|
"--- \u53EF\u7528\u6280\u80FD\uFF08Skills\uFF09---",
|
|
84
|
-
`\u5DE5\u4F5C\u533A
|
|
85
|
-
"\u6A21\u578B\u53EF\u6309\u9700\u7528 loadSkill \u5DE5\u5177\u6309\u540D\u52A0\u8F7D\uFF0C\u628A SKILL.md \u5168\u6587\u62C9\u8FDB\u4E0A\u4E0B\u6587\u540E\u9075\u5FAA\u5176\u6307\u4EE4\uFF1B",
|
|
86
|
-
"\u5982 loadSkill \u4E0D\u53EF\u7528\u6216\u60F3\u76F4\u63A5\u8BFB\u53D6\u6587\u4EF6\uFF0C\u4E0B\u65B9 path \u4ECD\u53EF\u7528 readFile \u4F5C\u4E3A fallback\uFF1A",
|
|
87
|
-
"",
|
|
84
|
+
`\u5DE5\u4F5C\u533A\u4E2D\u53D1\u73B0\u4E86 ${skills.length} \u4E2A\u6280\u80FD\uFF08SKILL.md\uFF09\uFF0C\u6A21\u578B\u53EF\u6309\u9700\u7528 loadSkill \u6309\u540D\u52A0\u8F7D\u6216 readFile \u76F4\u63A5\u8BFB\u53D6\uFF1A`,
|
|
88
85
|
...skills.map(
|
|
89
|
-
(s) => `- ${s.name}: ${s.description}
|
|
90
|
-
path: ${s.relativePath}`
|
|
86
|
+
(s) => `- ${s.name}: ${s.description} (path: ${s.relativePath})`
|
|
91
87
|
)
|
|
92
88
|
];
|
|
93
|
-
return makeLayer("skill-discovery", lines.join("\n"));
|
|
89
|
+
return makeLayer("skill-discovery", lines.join("\n"), "session");
|
|
90
|
+
};
|
|
91
|
+
var buildAgentsMdLayer = (content, fileName = "AGENTS.md") => {
|
|
92
|
+
const trimmed = content.trim();
|
|
93
|
+
if (!trimmed) return null;
|
|
94
|
+
return makeLayer(
|
|
95
|
+
"agents-md",
|
|
96
|
+
`--- \u9879\u76EE\u6307\u4EE4\uFF08${fileName}\uFF09---
|
|
97
|
+
${trimmed}`,
|
|
98
|
+
"session"
|
|
99
|
+
);
|
|
94
100
|
};
|
|
95
101
|
var buildLinkedSpacesSection = async (args) => {
|
|
96
102
|
const ids = (args.linkedSpaceIds ?? []).filter(
|
|
@@ -123,6 +129,14 @@ var buildLinkedSpacesSection = async (args) => {
|
|
|
123
129
|
"\u63D0\u793A\uFF1A\u5982\u9700\u67E5\u8BE2\u8FD9\u4E9B\u7A7A\u95F4\u7684\u8BE6\u7EC6\u5185\u5BB9\uFF0C\u53EF\u4F7F\u7528 read \u5DE5\u5177\u914D\u5408\u5BF9\u5E94\u7684 dbKey\u3002"
|
|
124
130
|
].join("\n");
|
|
125
131
|
};
|
|
132
|
+
var renderTurnContextBlocksWithScope = (layers) => layers.filter((layer) => Boolean(layer?.content?.trim())).map((layer) => ({
|
|
133
|
+
content: layer.content.trim(),
|
|
134
|
+
cacheScope: layer.cacheScope
|
|
135
|
+
}));
|
|
136
|
+
var partitionScopedBlocks = (blocks) => [
|
|
137
|
+
...blocks.filter((block) => block.cacheScope === "session"),
|
|
138
|
+
...blocks.filter((block) => block.cacheScope === "turn")
|
|
139
|
+
];
|
|
126
140
|
var buildDialogSummaryLayer = (args) => {
|
|
127
141
|
const historical = wrapHistoricalSummaryWithReplayGuard(
|
|
128
142
|
asTrimmed(args.summary)
|
|
@@ -149,7 +163,10 @@ var buildMemoryUseGuidanceLayer = (args) => {
|
|
|
149
163
|
export {
|
|
150
164
|
buildSpaceContextLayer,
|
|
151
165
|
buildSkillDiscoveryLayer,
|
|
166
|
+
buildAgentsMdLayer,
|
|
152
167
|
buildLinkedSpacesSection,
|
|
168
|
+
renderTurnContextBlocksWithScope,
|
|
169
|
+
partitionScopedBlocks,
|
|
153
170
|
buildDialogSummaryLayer,
|
|
154
171
|
buildMemoryOverlayLayer,
|
|
155
172
|
buildMemoryUseGuidanceLayer
|
|
@@ -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";
|