nolo-cli 0.16.0-alpha.2 → 0.16.0-alpha.3
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-QAUS6B7J.js → _executeModel-TZUDMB24.js} +14 -13
- package/{agentDeleteCommand-365DMKHW.js → agentDeleteCommand-EMXLYNAH.js} +9 -8
- package/{agentEmailCommands-TQMXL36I.js → agentEmailCommands-H3VL4WUZ.js} +19 -18
- package/{agentListCommands-6B5X4RC6.js → agentListCommands-HQZNTYEG.js} +10 -9
- package/{agentMachineCommands-LOEARB6V.js → agentMachineCommands-QJPXHLIG.js} +9 -8
- package/{agentRecordCommands-DCH2WBL2.js → agentRecordCommands-VABNJQU5.js} +18 -17
- package/{agentRunCommand-SGMH67WT.js → agentRunCommand-37H22M3U.js} +18 -17
- package/{agentRuntimeLocal-YSYZ33ER.js → agentRuntimeLocal-WGVEZMXW.js} +6 -5
- package/{agentSlice-IVE735EV.js → agentSlice-ILWKFTS5.js} +1 -1
- package/{appDeleteCommands-6QYOO3JB.js → appDeleteCommands-N5AHOOHG.js} +10 -9
- package/{appDeployCommands-WTCT6XO6.js → appDeployCommands-GDD4CHRI.js} +10 -9
- package/{appDeployStatusCommands-CGWGZJKB.js → appDeployStatusCommands-3ZQH2E2A.js} +10 -9
- package/{appGetCommands-O4OCAMRW.js → appGetCommands-U4BGN2SW.js} +10 -9
- package/{appListCommands-UENFP4XY.js → appListCommands-S5BF2T4A.js} +10 -9
- package/{authCommand-YFTR3347.js → authCommand-WKMPIXR6.js} +8 -2
- package/{chunk-HRQCKQA5.js → chunk-27DJM3CW.js} +1 -242
- package/{chunk-RKM3K52F.js → chunk-2L6OCZ6Z.js} +1 -1
- package/{chunk-Z24FGIU2.js → chunk-36GPBUJ2.js} +1 -1
- package/{chunk-J55UHASN.js → chunk-3GSNWWY3.js} +1 -1
- package/{chunk-6565R2TI.js → chunk-3SCCWSA3.js} +10 -8
- package/{chunk-YNHQIXX5.js → chunk-463YM7CS.js} +8 -8
- package/chunk-4MSDMVUW.js +247 -0
- package/{chunk-QLFCNUVQ.js → chunk-64E4G62G.js} +11 -11
- package/{chunk-YC3DJILJ.js → chunk-7LFS3UL6.js} +8 -6
- package/{chunk-GRTFNYLR.js → chunk-AO2YB7PG.js} +2 -2
- package/{chunk-VE6XMVKG.js → chunk-CT3XKUX4.js} +8 -8
- package/{chunk-4IJYA27C.js → chunk-I4NUTIXT.js} +1 -1
- package/{chunk-RSYUDGGZ.js → chunk-LTZL7WC3.js} +1 -1
- package/{chunk-WRN5EQT7.js → chunk-MEZVPVXM.js} +1 -1
- package/{chunk-6MHDWKOT.js → chunk-MRDODOWX.js} +1 -1
- package/{chunk-I66RU7P7.js → chunk-NY6KTTLA.js} +1 -1
- package/{chunk-QZVGMD5F.js → chunk-ONELX7AM.js} +1 -1
- package/{chunk-EMXI3N3Z.js → chunk-R2PO4VB4.js} +2 -2
- package/{chunk-WPN6RMDF.js → chunk-TKNX6GFV.js} +3 -3
- package/{chunk-O53CP2QR.js → chunk-TY27RYCD.js} +2 -2
- package/{chunk-BFRVXJJJ.js → chunk-VD24AND2.js} +6 -6
- package/{chunk-OQMPU2ML.js → chunk-VOVNQ4YU.js} +3 -3
- package/{chunk-ISYE6GZB.js → chunk-W3574B3G.js} +1 -1
- package/{chunk-E237VE6U.js → chunk-WFFFQD6S.js} +1 -1
- package/{chunk-G2MKOQCB.js → chunk-WIZX3ACC.js} +1 -1
- package/{chunk-4NLUNENX.js → chunk-WNUSEMPU.js} +1 -1
- package/{chunk-EHLHSX7R.js → chunk-XXUNUXCS.js} +9 -2
- package/{chunk-YYIRR6QC.js → chunk-Y6G5CIAW.js} +11 -11
- package/{chunk-WA6KZL5V.js → chunk-ZODEA6YR.js} +9 -7
- package/{createAgentAutomationAction-TS6NNZ4X.js → createAgentAutomationAction-QHGTCNTZ.js} +2 -2
- package/{createDialogAction-5HVQ33EX.js → createDialogAction-BEO3QLUA.js} +3 -3
- package/{createPageAction-4F3ZGQJD.js → createPageAction-35EGISA5.js} +2 -2
- package/{dialogCommands-ZL6L24BS.js → dialogCommands-V7UHKTXT.js} +10 -9
- package/{dialogSlice-FAWUQDJW.js → dialogSlice-PWTRW5CX.js} +2 -2
- package/{docCreateCommands-LYROQTFH.js → docCreateCommands-TNC5RGE6.js} +9 -8
- package/{docDeleteCommands-6TWGTZNR.js → docDeleteCommands-PDMKS5KK.js} +10 -9
- package/{docReadCommands-PRULNF26.js → docReadCommands-GGAFPAUO.js} +9 -8
- package/{docStore-2UHVWLTV.js → docStore-BIJALNX5.js} +3 -3
- package/{docUpdateCommands-NNYYWJBI.js → docUpdateCommands-NCZK5UPH.js} +9 -8
- package/{handleSendMessageAction-LJPUYNOH.js → handleSendMessageAction-EN7ZJLBM.js} +190 -4
- package/index.js +47 -47
- package/{machineCommands-JQPEQFSE.js → machineCommands-3XWBAXZL.js} +17 -16
- package/{machineWsRunDispatch-FFFNWVEW.js → machineWsRunDispatch-OZMHQJ43.js} +17 -16
- package/package.json +1 -1
- package/{readlineWorkspace-QSXHSBHA.js → readlineWorkspace-3FRNDMQP.js} +21 -20
- package/{runAgentClientLoop-A75BUU6D.js → runAgentClientLoop-ZAZSFAAO.js} +11 -10
- package/{spaceCommands-4LE45GB7.js → spaceCommands-IASX6FPL.js} +9 -8
- package/{spaceSlice-444MFUP6.js → spaceSlice-HGDO7QJK.js} +2 -2
- package/{streamAgentChatTurn-DJAE7USZ.js → streamAgentChatTurn-KTDBTZUL.js} +13 -12
- package/{tools-YB6LXSVN.js → tools-IUKU5H6C.js} +5 -5
- package/{tuiSummaryLlmCaller-QQL3JA5I.js → tuiSummaryLlmCaller-RV6ZXCLV.js} +3 -2
- package/{updateDialogTitleAction-6HGFBM64.js → updateDialogTitleAction-6R62F4XS.js} +2 -2
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
parseFlagWithOptionalValue,
|
|
7
7
|
runCloudflareOAuthLogin,
|
|
8
8
|
upsertEnvVariable
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-I4NUTIXT.js";
|
|
10
10
|
import "./chunk-6HYVJV7B.js";
|
|
11
11
|
import {
|
|
12
12
|
generatePkcePair,
|
|
@@ -17,10 +17,14 @@ import {
|
|
|
17
17
|
runXaiOAuthDeviceCode,
|
|
18
18
|
runXaiOAuthLogin,
|
|
19
19
|
startCallbackServer
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-XXUNUXCS.js";
|
|
21
|
+
import "./chunk-W3574B3G.js";
|
|
22
|
+
import "./chunk-27DJM3CW.js";
|
|
23
|
+
import "./chunk-OGGHETUE.js";
|
|
21
24
|
import {
|
|
22
25
|
createOAuthTokenStore
|
|
23
26
|
} from "./chunk-JZPBVBIY.js";
|
|
27
|
+
import "./chunk-BYXBJQAS.js";
|
|
24
28
|
import "./chunk-JBTJAPUF.js";
|
|
25
29
|
import {
|
|
26
30
|
toErrorMessage
|
|
@@ -33,9 +37,11 @@ import {
|
|
|
33
37
|
} from "./chunk-ROWQEJRP.js";
|
|
34
38
|
import "./chunk-A7GB5UGH.js";
|
|
35
39
|
import "./chunk-OLZBQWZU.js";
|
|
40
|
+
import "./chunk-524BDL33.js";
|
|
36
41
|
import "./chunk-O4BU24WZ.js";
|
|
37
42
|
import "./chunk-I42VC5KR.js";
|
|
38
43
|
import "./chunk-WWC7I6TA.js";
|
|
44
|
+
import "./chunk-QSJ3HFEF.js";
|
|
39
45
|
import "./chunk-3EUW3WEO.js";
|
|
40
46
|
import "./chunk-U6VC4MU4.js";
|
|
41
47
|
import "./chunk-KUG52IAP.js";
|
|
@@ -7,9 +7,6 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
asTrimmedString
|
|
9
9
|
} from "./chunk-3EUW3WEO.js";
|
|
10
|
-
import {
|
|
11
|
-
isRecord
|
|
12
|
-
} from "./chunk-KUG52IAP.js";
|
|
13
10
|
import {
|
|
14
11
|
normalizeServerOrigin
|
|
15
12
|
} from "./chunk-CF7PE763.js";
|
|
@@ -344,235 +341,6 @@ async function buildProviderExecutionPlan(args) {
|
|
|
344
341
|
};
|
|
345
342
|
}
|
|
346
343
|
|
|
347
|
-
// packages/agent-runtime/openAiCompatibleMessages.ts
|
|
348
|
-
function preserveAgentStateFields(source, target, options) {
|
|
349
|
-
const mutableTarget = target;
|
|
350
|
-
if (source.role === "assistant") {
|
|
351
|
-
if (!options?.stripReasoningContent && typeof source.reasoning_content === "string") {
|
|
352
|
-
mutableTarget.reasoning_content = source.reasoning_content;
|
|
353
|
-
}
|
|
354
|
-
if (Array.isArray(source.tool_calls)) {
|
|
355
|
-
mutableTarget.tool_calls = source.tool_calls;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (source.role === "tool") {
|
|
359
|
-
const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
|
|
360
|
-
if (toolCallId) mutableTarget.tool_call_id = toolCallId;
|
|
361
|
-
}
|
|
362
|
-
return target;
|
|
363
|
-
}
|
|
364
|
-
function toOpenAiCompatibleMessages(messages, options) {
|
|
365
|
-
return messages.map(
|
|
366
|
-
(message) => preserveAgentStateFields(message, {
|
|
367
|
-
role: message.role,
|
|
368
|
-
content: message.content ?? ""
|
|
369
|
-
}, options)
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// packages/integrations/openai/responsesHelpers.ts
|
|
374
|
-
var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
|
|
375
|
-
var sanitizeResponsesParameters = (parameters) => {
|
|
376
|
-
if (!isRecord(parameters)) {
|
|
377
|
-
return parameters;
|
|
378
|
-
}
|
|
379
|
-
const next = { ...parameters };
|
|
380
|
-
for (const key of RESPONSES_TOP_LEVEL_SCHEMA_KEYS) {
|
|
381
|
-
delete next[key];
|
|
382
|
-
}
|
|
383
|
-
return next;
|
|
384
|
-
};
|
|
385
|
-
var appendTextPart = (parts, text, role) => {
|
|
386
|
-
if (!text) return;
|
|
387
|
-
const last = parts.at(-1);
|
|
388
|
-
const textType = role === "assistant" ? "output_text" : "input_text";
|
|
389
|
-
if (last?.type === textType) {
|
|
390
|
-
last.text += text;
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
parts.push({ type: textType, text });
|
|
394
|
-
};
|
|
395
|
-
var normalizeMessageParts = (content, role) => {
|
|
396
|
-
if (typeof content === "string") {
|
|
397
|
-
if (!content) return [];
|
|
398
|
-
return [
|
|
399
|
-
{
|
|
400
|
-
type: role === "assistant" ? "output_text" : "input_text",
|
|
401
|
-
text: content
|
|
402
|
-
}
|
|
403
|
-
];
|
|
404
|
-
}
|
|
405
|
-
const parts = [];
|
|
406
|
-
for (const part of content ?? []) {
|
|
407
|
-
const typedPart = part;
|
|
408
|
-
if (typedPart?.type === "text" && typeof typedPart.text === "string") {
|
|
409
|
-
appendTextPart(parts, typedPart.text, role);
|
|
410
|
-
continue;
|
|
411
|
-
}
|
|
412
|
-
if (typedPart?.type === "image_url" && typeof typedPart.image_url?.url === "string" && typedPart.image_url.url) {
|
|
413
|
-
if (role === "assistant") continue;
|
|
414
|
-
parts.push({
|
|
415
|
-
type: "input_image",
|
|
416
|
-
image_url: typedPart.image_url.url,
|
|
417
|
-
detail: typedPart.image_url.detail
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
return parts;
|
|
422
|
-
};
|
|
423
|
-
var normalizeToolOutput = (content) => {
|
|
424
|
-
if (typeof content === "string") return content;
|
|
425
|
-
return JSON.stringify(content ?? "");
|
|
426
|
-
};
|
|
427
|
-
var toResponsesTools = (tools) => {
|
|
428
|
-
if (!Array.isArray(tools) || tools.length === 0) return void 0;
|
|
429
|
-
return tools.map((tool) => {
|
|
430
|
-
const fn = tool?.function;
|
|
431
|
-
if (!fn?.name) return null;
|
|
432
|
-
return {
|
|
433
|
-
type: "function",
|
|
434
|
-
name: fn.name,
|
|
435
|
-
description: fn.description,
|
|
436
|
-
parameters: sanitizeResponsesParameters(fn.parameters),
|
|
437
|
-
strict: fn.strict
|
|
438
|
-
};
|
|
439
|
-
}).filter(Boolean);
|
|
440
|
-
};
|
|
441
|
-
var convertMessagesToResponsesInput = (messages) => {
|
|
442
|
-
const input = [];
|
|
443
|
-
for (const message of messages) {
|
|
444
|
-
if (!message?.role) continue;
|
|
445
|
-
if (message.role === "tool") {
|
|
446
|
-
if (!message.tool_call_id) continue;
|
|
447
|
-
input.push({
|
|
448
|
-
type: "function_call_output",
|
|
449
|
-
call_id: message.tool_call_id,
|
|
450
|
-
output: normalizeToolOutput(message.content)
|
|
451
|
-
});
|
|
452
|
-
continue;
|
|
453
|
-
}
|
|
454
|
-
const role = message.role;
|
|
455
|
-
if (role === "assistant" && typeof message.reasoning_content === "string" && message.reasoning_content) {
|
|
456
|
-
input.push({ type: "reasoning", content: message.reasoning_content });
|
|
457
|
-
}
|
|
458
|
-
const contentParts = normalizeMessageParts(message.content, role);
|
|
459
|
-
if (contentParts.length > 0) {
|
|
460
|
-
input.push({
|
|
461
|
-
type: "message",
|
|
462
|
-
role,
|
|
463
|
-
content: contentParts
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
if (role === "assistant" && Array.isArray(message.content)) {
|
|
467
|
-
const replayImages = message.content.map((part) => part).filter(
|
|
468
|
-
(part) => part?.type === "image_url" && typeof part.image_url?.url === "string" && Boolean(part.image_url.url)
|
|
469
|
-
).map((part) => ({
|
|
470
|
-
type: "input_image",
|
|
471
|
-
image_url: part.image_url.url,
|
|
472
|
-
detail: part.image_url.detail
|
|
473
|
-
}));
|
|
474
|
-
if (replayImages.length > 0) {
|
|
475
|
-
input.push({
|
|
476
|
-
type: "message",
|
|
477
|
-
role: "user",
|
|
478
|
-
content: replayImages
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
if (role === "assistant" && Array.isArray(message.tool_calls)) {
|
|
483
|
-
for (const toolCall of message.tool_calls) {
|
|
484
|
-
if (!toolCall?.id || !toolCall.function?.name) continue;
|
|
485
|
-
input.push({
|
|
486
|
-
type: "function_call",
|
|
487
|
-
call_id: toolCall.id,
|
|
488
|
-
name: toolCall.function.name,
|
|
489
|
-
arguments: typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments ?? {})
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
return input;
|
|
495
|
-
};
|
|
496
|
-
var extractTextFromResponseOutput = (response) => {
|
|
497
|
-
const parts = [];
|
|
498
|
-
for (const item of response?.output ?? []) {
|
|
499
|
-
if (item?.type !== "message") continue;
|
|
500
|
-
for (const content of item.content ?? []) {
|
|
501
|
-
if (content?.type === "output_text" && typeof content.text === "string") {
|
|
502
|
-
parts.push(content.text);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return parts.join("");
|
|
507
|
-
};
|
|
508
|
-
var toDataUrl = (base64Data, mimeType) => {
|
|
509
|
-
const normalizedMimeType = asOptionalTrimmedString(mimeType) ?? "image/png";
|
|
510
|
-
return `data:${normalizedMimeType};base64,${base64Data}`;
|
|
511
|
-
};
|
|
512
|
-
var extractImagePartsFromResponseOutput = (response) => {
|
|
513
|
-
const images = [];
|
|
514
|
-
for (const item of response?.output ?? []) {
|
|
515
|
-
if (item?.type === "image_generation_call") {
|
|
516
|
-
const result = asOptionalTrimmedString(item.result);
|
|
517
|
-
if (result) {
|
|
518
|
-
const outputFormat = asOptionalTrimmedString(item.output_format);
|
|
519
|
-
images.push({
|
|
520
|
-
type: "image_url",
|
|
521
|
-
image_url: {
|
|
522
|
-
url: toDataUrl(
|
|
523
|
-
result,
|
|
524
|
-
outputFormat ? `image/${outputFormat}` : void 0
|
|
525
|
-
)
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
continue;
|
|
530
|
-
}
|
|
531
|
-
if (item?.type !== "message") continue;
|
|
532
|
-
for (const content of item.content ?? []) {
|
|
533
|
-
const result = asOptionalTrimmedString(content?.result);
|
|
534
|
-
if (content?.type === "output_image" && result) {
|
|
535
|
-
images.push({
|
|
536
|
-
type: "image_url",
|
|
537
|
-
image_url: {
|
|
538
|
-
url: toDataUrl(
|
|
539
|
-
result,
|
|
540
|
-
content.mime_type ?? content.mimeType ?? null
|
|
541
|
-
)
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
return images;
|
|
548
|
-
};
|
|
549
|
-
var extractToolCallsFromResponseOutput = (response) => {
|
|
550
|
-
const calls = [];
|
|
551
|
-
for (const item of response?.output ?? []) {
|
|
552
|
-
if (item?.type !== "function_call") continue;
|
|
553
|
-
if (!item.call_id || !item.name) continue;
|
|
554
|
-
calls.push({
|
|
555
|
-
id: item.call_id,
|
|
556
|
-
type: "function",
|
|
557
|
-
function: {
|
|
558
|
-
name: item.name,
|
|
559
|
-
arguments: typeof item.arguments === "string" ? item.arguments : JSON.stringify(item.arguments ?? {})
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
return calls;
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
// packages/core/chat/imageParts.ts
|
|
567
|
-
function isImageUrlPart(part) {
|
|
568
|
-
return isRecord(part) && part.type === "image_url";
|
|
569
|
-
}
|
|
570
|
-
function hasImageParts(messages) {
|
|
571
|
-
return messages.some(
|
|
572
|
-
(message) => Array.isArray(message.content) && message.content.some(isImageUrlPart)
|
|
573
|
-
);
|
|
574
|
-
}
|
|
575
|
-
|
|
576
344
|
export {
|
|
577
345
|
pickAgentRuntimeInferenceOptions,
|
|
578
346
|
isOpenAiResponsesModel,
|
|
@@ -586,14 +354,5 @@ export {
|
|
|
586
354
|
resolveAgentRuntimeLocation,
|
|
587
355
|
resolveProviderTransportDecision,
|
|
588
356
|
buildProviderAuthHeaders,
|
|
589
|
-
buildProviderExecutionPlan
|
|
590
|
-
isImageUrlPart,
|
|
591
|
-
hasImageParts,
|
|
592
|
-
preserveAgentStateFields,
|
|
593
|
-
toOpenAiCompatibleMessages,
|
|
594
|
-
toResponsesTools,
|
|
595
|
-
convertMessagesToResponsesInput,
|
|
596
|
-
extractTextFromResponseOutput,
|
|
597
|
-
extractImagePartsFromResponseOutput,
|
|
598
|
-
extractToolCallsFromResponseOutput
|
|
357
|
+
buildProviderExecutionPlan
|
|
599
358
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ANTIGRAVITY_CLOUD_CODE_BASE_URL,
|
|
3
3
|
isAntigravityOAuthAgent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-W3574B3G.js";
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText,
|
|
7
7
|
fetchAndSerializeTable,
|
|
8
8
|
waitForAbortableDelay
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CT3XKUX4.js";
|
|
10
10
|
import {
|
|
11
11
|
createDrainExhaustedResponse,
|
|
12
12
|
isCoreDrainingBody,
|
|
@@ -26,25 +26,27 @@ import {
|
|
|
26
26
|
import {
|
|
27
27
|
fetchAndCacheMessages,
|
|
28
28
|
shouldUseServerProxy
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-463YM7CS.js";
|
|
30
30
|
import {
|
|
31
31
|
fetchServerSyncedCredential
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-VOVNQ4YU.js";
|
|
33
33
|
import {
|
|
34
34
|
buildCurrentTimeBlock,
|
|
35
35
|
buildIdentityBlock,
|
|
36
36
|
buildRuntimeGuidanceBlocks,
|
|
37
37
|
requiresBareImageUrl,
|
|
38
38
|
toBareImageUrlMessages
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-2L6OCZ6Z.js";
|
|
40
40
|
import {
|
|
41
|
-
buildProviderAuthHeaders,
|
|
42
41
|
convertMessagesToResponsesInput,
|
|
42
|
+
preserveAgentStateFields
|
|
43
|
+
} from "./chunk-4MSDMVUW.js";
|
|
44
|
+
import {
|
|
45
|
+
buildProviderAuthHeaders,
|
|
43
46
|
isOpenAiResponsesModel,
|
|
44
|
-
preserveAgentStateFields,
|
|
45
47
|
resolvePlatformChatCompletionsEndpoint,
|
|
46
48
|
resolvePlatformResponsesEndpoint
|
|
47
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-27DJM3CW.js";
|
|
48
50
|
import {
|
|
49
51
|
canonicalizeToolNames
|
|
50
52
|
} from "./chunk-B4KT7RN2.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
deleteServerSyncedCredential,
|
|
17
17
|
runLlm
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VOVNQ4YU.js";
|
|
19
19
|
import {
|
|
20
20
|
cleanupCliSessionForDialog
|
|
21
21
|
} from "./chunk-JS33TCQ3.js";
|
|
@@ -5529,7 +5529,7 @@ var messageSlice = createSliceWithThunks({
|
|
|
5529
5529
|
runtimeOptions: args.runtimeOptions
|
|
5530
5530
|
});
|
|
5531
5531
|
if (agentKeyToUse) {
|
|
5532
|
-
const { streamAgentChatTurn } = await import("./agentSlice-
|
|
5532
|
+
const { streamAgentChatTurn } = await import("./agentSlice-ILWKFTS5.js");
|
|
5533
5533
|
await dispatch(
|
|
5534
5534
|
streamAgentChatTurn({
|
|
5535
5535
|
agentKey: agentKeyToUse,
|
|
@@ -8249,7 +8249,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
8249
8249
|
}
|
|
8250
8250
|
if (isCurrentDialog) {
|
|
8251
8251
|
await thunkApi.dispatch(resetMsgs());
|
|
8252
|
-
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-
|
|
8252
|
+
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-PWTRW5CX.js");
|
|
8253
8253
|
dispatch(clearPendingAttachments2());
|
|
8254
8254
|
clearWorkflow();
|
|
8255
8255
|
}
|
|
@@ -8258,15 +8258,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
8258
8258
|
|
|
8259
8259
|
// packages/chat/dialog/dialogSlice.ts
|
|
8260
8260
|
var runCreateDialogAction = async (args, thunkApi) => {
|
|
8261
|
-
const { createDialogAction } = await import("./createDialogAction-
|
|
8261
|
+
const { createDialogAction } = await import("./createDialogAction-BEO3QLUA.js");
|
|
8262
8262
|
return createDialogAction(args, thunkApi);
|
|
8263
8263
|
};
|
|
8264
8264
|
var runCreateAgentAutomationAction = async (args, thunkApi) => {
|
|
8265
|
-
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-
|
|
8265
|
+
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-QHGTCNTZ.js");
|
|
8266
8266
|
return createAgentAutomationAction(args, thunkApi);
|
|
8267
8267
|
};
|
|
8268
8268
|
var runUpdateDialogTitleAction = async (args, thunkApi) => {
|
|
8269
|
-
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-
|
|
8269
|
+
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-6R62F4XS.js");
|
|
8270
8270
|
return updateDialogTitleAction(args, thunkApi);
|
|
8271
8271
|
};
|
|
8272
8272
|
var runAddDialogAgentAction = async (args, thunkApi) => {
|
|
@@ -8286,7 +8286,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
|
|
|
8286
8286
|
return setDialogExtraReferencesAction(args, thunkApi);
|
|
8287
8287
|
};
|
|
8288
8288
|
var runHandleSendMessageAction = async (args, thunkApi) => {
|
|
8289
|
-
const { handleSendMessageAction } = await import("./handleSendMessageAction-
|
|
8289
|
+
const { handleSendMessageAction } = await import("./handleSendMessageAction-EN7ZJLBM.js");
|
|
8290
8290
|
return handleSendMessageAction(args, thunkApi);
|
|
8291
8291
|
};
|
|
8292
8292
|
function clearDialogState() {
|
|
@@ -8299,7 +8299,7 @@ var createPageAndAddReference = createAsyncThunk(
|
|
|
8299
8299
|
async (payload, { dispatch, getState, rejectWithValue }) => {
|
|
8300
8300
|
const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
|
|
8301
8301
|
try {
|
|
8302
|
-
const { createDocState } = await import("./docStore-
|
|
8302
|
+
const { createDocState } = await import("./docStore-BIJALNX5.js");
|
|
8303
8303
|
const pageKey = await createDocState(
|
|
8304
8304
|
{ slateData, title },
|
|
8305
8305
|
{ dispatch, getState }
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isRecord
|
|
3
|
+
} from "./chunk-KUG52IAP.js";
|
|
4
|
+
import {
|
|
5
|
+
asOptionalTrimmedString
|
|
6
|
+
} from "./chunk-G3SUCT4W.js";
|
|
7
|
+
|
|
8
|
+
// packages/agent-runtime/openAiCompatibleMessages.ts
|
|
9
|
+
function preserveAgentStateFields(source, target, options) {
|
|
10
|
+
const mutableTarget = target;
|
|
11
|
+
if (source.role === "assistant") {
|
|
12
|
+
if (!options?.stripReasoningContent && typeof source.reasoning_content === "string") {
|
|
13
|
+
mutableTarget.reasoning_content = source.reasoning_content;
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(source.tool_calls)) {
|
|
16
|
+
mutableTarget.tool_calls = source.tool_calls;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (source.role === "tool") {
|
|
20
|
+
const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
|
|
21
|
+
if (toolCallId) mutableTarget.tool_call_id = toolCallId;
|
|
22
|
+
}
|
|
23
|
+
return target;
|
|
24
|
+
}
|
|
25
|
+
function toOpenAiCompatibleMessages(messages, options) {
|
|
26
|
+
return messages.map(
|
|
27
|
+
(message) => preserveAgentStateFields(message, {
|
|
28
|
+
role: message.role,
|
|
29
|
+
content: message.content ?? ""
|
|
30
|
+
}, options)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// packages/integrations/openai/responsesHelpers.ts
|
|
35
|
+
var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
|
|
36
|
+
var sanitizeResponsesParameters = (parameters) => {
|
|
37
|
+
if (!isRecord(parameters)) {
|
|
38
|
+
return parameters;
|
|
39
|
+
}
|
|
40
|
+
const next = { ...parameters };
|
|
41
|
+
for (const key of RESPONSES_TOP_LEVEL_SCHEMA_KEYS) {
|
|
42
|
+
delete next[key];
|
|
43
|
+
}
|
|
44
|
+
return next;
|
|
45
|
+
};
|
|
46
|
+
var appendTextPart = (parts, text, role) => {
|
|
47
|
+
if (!text) return;
|
|
48
|
+
const last = parts.at(-1);
|
|
49
|
+
const textType = role === "assistant" ? "output_text" : "input_text";
|
|
50
|
+
if (last?.type === textType) {
|
|
51
|
+
last.text += text;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
parts.push({ type: textType, text });
|
|
55
|
+
};
|
|
56
|
+
var normalizeMessageParts = (content, role) => {
|
|
57
|
+
if (typeof content === "string") {
|
|
58
|
+
if (!content) return [];
|
|
59
|
+
return [
|
|
60
|
+
{
|
|
61
|
+
type: role === "assistant" ? "output_text" : "input_text",
|
|
62
|
+
text: content
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
const parts = [];
|
|
67
|
+
for (const part of content ?? []) {
|
|
68
|
+
const typedPart = part;
|
|
69
|
+
if (typedPart?.type === "text" && typeof typedPart.text === "string") {
|
|
70
|
+
appendTextPart(parts, typedPart.text, role);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (typedPart?.type === "image_url" && typeof typedPart.image_url?.url === "string" && typedPart.image_url.url) {
|
|
74
|
+
if (role === "assistant") continue;
|
|
75
|
+
parts.push({
|
|
76
|
+
type: "input_image",
|
|
77
|
+
image_url: typedPart.image_url.url,
|
|
78
|
+
detail: typedPart.image_url.detail
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return parts;
|
|
83
|
+
};
|
|
84
|
+
var normalizeToolOutput = (content) => {
|
|
85
|
+
if (typeof content === "string") return content;
|
|
86
|
+
return JSON.stringify(content ?? "");
|
|
87
|
+
};
|
|
88
|
+
var toResponsesTools = (tools) => {
|
|
89
|
+
if (!Array.isArray(tools) || tools.length === 0) return void 0;
|
|
90
|
+
return tools.map((tool) => {
|
|
91
|
+
const fn = tool?.function;
|
|
92
|
+
if (!fn?.name) return null;
|
|
93
|
+
return {
|
|
94
|
+
type: "function",
|
|
95
|
+
name: fn.name,
|
|
96
|
+
description: fn.description,
|
|
97
|
+
parameters: sanitizeResponsesParameters(fn.parameters),
|
|
98
|
+
strict: fn.strict
|
|
99
|
+
};
|
|
100
|
+
}).filter(Boolean);
|
|
101
|
+
};
|
|
102
|
+
var convertMessagesToResponsesInput = (messages) => {
|
|
103
|
+
const input = [];
|
|
104
|
+
for (const message of messages) {
|
|
105
|
+
if (!message?.role) continue;
|
|
106
|
+
if (message.role === "tool") {
|
|
107
|
+
if (!message.tool_call_id) continue;
|
|
108
|
+
input.push({
|
|
109
|
+
type: "function_call_output",
|
|
110
|
+
call_id: message.tool_call_id,
|
|
111
|
+
output: normalizeToolOutput(message.content)
|
|
112
|
+
});
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const role = message.role;
|
|
116
|
+
if (role === "assistant" && typeof message.reasoning_content === "string" && message.reasoning_content) {
|
|
117
|
+
input.push({ type: "reasoning", content: message.reasoning_content });
|
|
118
|
+
}
|
|
119
|
+
const contentParts = normalizeMessageParts(message.content, role);
|
|
120
|
+
if (contentParts.length > 0) {
|
|
121
|
+
input.push({
|
|
122
|
+
type: "message",
|
|
123
|
+
role,
|
|
124
|
+
content: contentParts
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (role === "assistant" && Array.isArray(message.content)) {
|
|
128
|
+
const replayImages = message.content.map((part) => part).filter(
|
|
129
|
+
(part) => part?.type === "image_url" && typeof part.image_url?.url === "string" && Boolean(part.image_url.url)
|
|
130
|
+
).map((part) => ({
|
|
131
|
+
type: "input_image",
|
|
132
|
+
image_url: part.image_url.url,
|
|
133
|
+
detail: part.image_url.detail
|
|
134
|
+
}));
|
|
135
|
+
if (replayImages.length > 0) {
|
|
136
|
+
input.push({
|
|
137
|
+
type: "message",
|
|
138
|
+
role: "user",
|
|
139
|
+
content: replayImages
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (role === "assistant" && Array.isArray(message.tool_calls)) {
|
|
144
|
+
for (const toolCall of message.tool_calls) {
|
|
145
|
+
if (!toolCall?.id || !toolCall.function?.name) continue;
|
|
146
|
+
input.push({
|
|
147
|
+
type: "function_call",
|
|
148
|
+
call_id: toolCall.id,
|
|
149
|
+
name: toolCall.function.name,
|
|
150
|
+
arguments: typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments ?? {})
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return input;
|
|
156
|
+
};
|
|
157
|
+
var extractTextFromResponseOutput = (response) => {
|
|
158
|
+
const parts = [];
|
|
159
|
+
for (const item of response?.output ?? []) {
|
|
160
|
+
if (item?.type !== "message") continue;
|
|
161
|
+
for (const content of item.content ?? []) {
|
|
162
|
+
if (content?.type === "output_text" && typeof content.text === "string") {
|
|
163
|
+
parts.push(content.text);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return parts.join("");
|
|
168
|
+
};
|
|
169
|
+
var toDataUrl = (base64Data, mimeType) => {
|
|
170
|
+
const normalizedMimeType = asOptionalTrimmedString(mimeType) ?? "image/png";
|
|
171
|
+
return `data:${normalizedMimeType};base64,${base64Data}`;
|
|
172
|
+
};
|
|
173
|
+
var extractImagePartsFromResponseOutput = (response) => {
|
|
174
|
+
const images = [];
|
|
175
|
+
for (const item of response?.output ?? []) {
|
|
176
|
+
if (item?.type === "image_generation_call") {
|
|
177
|
+
const result = asOptionalTrimmedString(item.result);
|
|
178
|
+
if (result) {
|
|
179
|
+
const outputFormat = asOptionalTrimmedString(item.output_format);
|
|
180
|
+
images.push({
|
|
181
|
+
type: "image_url",
|
|
182
|
+
image_url: {
|
|
183
|
+
url: toDataUrl(
|
|
184
|
+
result,
|
|
185
|
+
outputFormat ? `image/${outputFormat}` : void 0
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (item?.type !== "message") continue;
|
|
193
|
+
for (const content of item.content ?? []) {
|
|
194
|
+
const result = asOptionalTrimmedString(content?.result);
|
|
195
|
+
if (content?.type === "output_image" && result) {
|
|
196
|
+
images.push({
|
|
197
|
+
type: "image_url",
|
|
198
|
+
image_url: {
|
|
199
|
+
url: toDataUrl(
|
|
200
|
+
result,
|
|
201
|
+
content.mime_type ?? content.mimeType ?? null
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return images;
|
|
209
|
+
};
|
|
210
|
+
var extractToolCallsFromResponseOutput = (response) => {
|
|
211
|
+
const calls = [];
|
|
212
|
+
for (const item of response?.output ?? []) {
|
|
213
|
+
if (item?.type !== "function_call") continue;
|
|
214
|
+
if (!item.call_id || !item.name) continue;
|
|
215
|
+
calls.push({
|
|
216
|
+
id: item.call_id,
|
|
217
|
+
type: "function",
|
|
218
|
+
function: {
|
|
219
|
+
name: item.name,
|
|
220
|
+
arguments: typeof item.arguments === "string" ? item.arguments : JSON.stringify(item.arguments ?? {})
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return calls;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// packages/core/chat/imageParts.ts
|
|
228
|
+
function isImageUrlPart(part) {
|
|
229
|
+
return isRecord(part) && part.type === "image_url";
|
|
230
|
+
}
|
|
231
|
+
function hasImageParts(messages) {
|
|
232
|
+
return messages.some(
|
|
233
|
+
(message) => Array.isArray(message.content) && message.content.some(isImageUrlPart)
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export {
|
|
238
|
+
isImageUrlPart,
|
|
239
|
+
hasImageParts,
|
|
240
|
+
preserveAgentStateFields,
|
|
241
|
+
toOpenAiCompatibleMessages,
|
|
242
|
+
toResponsesTools,
|
|
243
|
+
convertMessagesToResponsesInput,
|
|
244
|
+
extractTextFromResponseOutput,
|
|
245
|
+
extractImagePartsFromResponseOutput,
|
|
246
|
+
extractToolCallsFromResponseOutput
|
|
247
|
+
};
|