nolo-cli 0.16.0-alpha.2 → 0.16.0-alpha.21
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-GRCQXT5R.js} +51 -45
- package/{action-GUOZYYGN.js → action-LT7BRFLK.js} +10 -9
- package/{addContentAction-QDGHGUBH.js → addContentAction-PL3KKBDH.js} +9 -8
- package/{addDialogAgentAction-Z4YCYZIV.js → addDialogAgentAction-FCMSKYAF.js} +8 -7
- package/{agentDeleteCommand-365DMKHW.js → agentDeleteCommand-WNL3CNQX.js} +32 -29
- package/{agentEmailCommands-TQMXL36I.js → agentEmailCommands-MPEUMRAS.js} +63 -57
- package/{agentListCommands-6B5X4RC6.js → agentListCommands-YO4AOQMS.js} +31 -28
- package/{agentMachineCommands-LOEARB6V.js → agentMachineCommands-WYM6YRYJ.js} +30 -27
- package/{agentPullCommand-6HWUT3SW.js → agentPullCommand-ZZGU5KOY.js} +4 -4
- package/agentRecordCommands-BVWSHMIY.js +105 -0
- package/{agentRunCommand-SGMH67WT.js → agentRunCommand-E3ZI6RSF.js} +64 -55
- package/{agentRunControl-6ADXVYMR.js → agentRunControl-Y5AFH5PQ.js} +24 -1
- package/{agentRuntimeLocal-YSYZ33ER.js → agentRuntimeLocal-P4VGX6H6.js} +26 -25
- package/{agentSlice-IVE735EV.js → agentSlice-D33GU3JL.js} +9 -8
- package/{appDeleteCommands-6QYOO3JB.js → appDeleteCommands-VA4R2SWX.js} +29 -26
- package/{appDeployCommands-WTCT6XO6.js → appDeployCommands-JWMWQNG6.js} +29 -26
- package/{appDeployStatusCommands-CGWGZJKB.js → appDeployStatusCommands-KYXGLZSQ.js} +29 -26
- package/{appGetCommands-O4OCAMRW.js → appGetCommands-ELOO3JG6.js} +29 -26
- package/{appListCommands-UENFP4XY.js → appListCommands-SJUW4RLW.js} +29 -26
- package/{authCommand-YFTR3347.js → authCommand-WJZPOLSS.js} +16 -9
- package/{authCommands-YXGOXNBZ.js → authCommands-XTBV7OFZ.js} +6 -5
- package/{chunk-RKM3K52F.js → chunk-34WPV75U.js} +23 -2
- package/{chunk-VPTJB4HM.js → chunk-3ND52WIL.js} +2 -5
- package/{chunk-SOTZ6RDN.js → chunk-3Q7WHGCB.js} +1 -1
- package/{chunk-KKY4B2Q2.js → chunk-4PWB7JRR.js} +4 -1
- package/{chunk-U7LEGLEB.js → chunk-4T5F7YZQ.js} +1 -1
- package/{chunk-OQMPU2ML.js → chunk-5PGGCJGV.js} +6 -6
- package/chunk-7BUYEZ6U.js +671 -0
- package/{chunk-AS3ZQ3O2.js → chunk-7OBMZCRD.js} +1 -1
- package/{chunk-WA6KZL5V.js → chunk-AAODAAUQ.js} +23 -20
- package/{chunk-GRTFNYLR.js → chunk-AKVLLMOU.js} +3 -3
- package/{chunk-QLUFR47U.js → chunk-AL2V7U3E.js} +1 -1
- package/{chunk-MTU75CZ2.js → chunk-B5TOXZAK.js} +1 -1
- package/{chunk-QZVGMD5F.js → chunk-BE2GNT5E.js} +2 -8
- package/{chunk-JKWWVF2I.js → chunk-D3HVJJIA.js} +1 -1
- package/{chunk-B4KT7RN2.js → chunk-DKZFOK24.js} +18 -89
- package/chunk-DL6EPNIK.js +50 -0
- package/{chunk-YYIRR6QC.js → chunk-E5KQTMMJ.js} +212 -250
- package/{chunk-4QQFLN5C.js → chunk-EGPCU42M.js} +58 -8
- package/{chunk-XVP3C2KY.js → chunk-ELT65PZW.js} +2 -2
- package/{chunk-EMXI3N3Z.js → chunk-ENP2ELIL.js} +5 -5
- package/{chunk-6565R2TI.js → chunk-EXAEHRLI.js} +112 -191
- package/chunk-FQZZLA3C.js +223 -0
- package/{chunk-WPN6RMDF.js → chunk-GMZZ5EKJ.js} +3 -3
- package/{chunk-RSYUDGGZ.js → chunk-HQNPCMWL.js} +3 -3
- package/{chunk-OGGHETUE.js → chunk-HQPG2PIV.js} +62 -19
- package/{chunk-4NLUNENX.js → chunk-IQZ6TGVW.js} +10 -3
- package/{chunk-VE6XMVKG.js → chunk-J67FKTTY.js} +330 -213
- package/{chunk-G2MKOQCB.js → chunk-JFE7XW4D.js} +1 -1
- package/{setDialogExtraReferencesAction-2VLGWQKG.js → chunk-JLA4FXYC.js} +2 -17
- package/{chunk-OOIN7HSO.js → chunk-JP7REMYP.js} +19 -1
- package/chunk-KFEVY3ST.js +255 -0
- package/{chunk-I66RU7P7.js → chunk-KKWJ5VPZ.js} +1 -1
- package/{chunk-WRN5EQT7.js → chunk-L2RRMXNJ.js} +13 -4
- package/{chunk-ISYE6GZB.js → chunk-L6NVTGI7.js} +1 -1
- package/{chunk-HRQCKQA5.js → chunk-MUCU6ATG.js} +8 -257
- package/{chunk-BFRVXJJJ.js → chunk-MUIT5AAM.js} +112 -27
- package/{chunk-WNLPAOIT.js → chunk-MVQ4TBSD.js} +1 -1
- package/{chunk-O53CP2QR.js → chunk-N2HYIBLH.js} +6 -6
- package/{chunk-524BDL33.js → chunk-O6W2O2DA.js} +1 -15
- package/{chunk-YC3DJILJ.js → chunk-PUSK7HXJ.js} +64 -22
- package/{chunk-OOSFSFMA.js → chunk-R5V5G73M.js} +2 -0
- package/{chunk-4IJYA27C.js → chunk-RG2U2MTJ.js} +1 -1
- package/{chunk-Z24FGIU2.js → chunk-RIDWN7AP.js} +34 -15
- package/{chunk-IKXL2HZ3.js → chunk-RK5NYQEL.js} +1 -1
- package/{chunk-QLFCNUVQ.js → chunk-RUTSBLDM.js} +1629 -261
- package/{chunk-TTGAVETO.js → chunk-RVOUXDFU.js} +5 -5
- package/{chunk-JTINRTBT.js → chunk-SKDNBYZK.js} +2 -2
- package/{chunk-KMQPSTMJ.js → chunk-TRT4I4UD.js} +2 -2
- package/{chunk-EHLHSX7R.js → chunk-UB4RYYNQ.js} +9 -2
- package/{chunk-N5424GSW.js → chunk-UGUW3FHG.js} +4 -4
- package/{chunk-YNHQIXX5.js → chunk-UIOYWBU7.js} +395 -326
- package/chunk-V5R4NZP2.js +78 -0
- package/{chunk-MYMMNKYL.js → chunk-VNAEBGDK.js} +156 -6
- package/{chunk-J55UHASN.js → chunk-VST53WEL.js} +1 -1
- package/{chunk-6MHDWKOT.js → chunk-VVKQFITN.js} +25 -12
- package/{chunk-W4NVOSFF.js → chunk-WFHXMLHZ.js} +1 -1
- package/{chunk-H33743XH.js → chunk-WJRJDX2W.js} +1 -1
- package/chunk-X4Q4UZEY.js +26 -0
- package/{chunk-E237VE6U.js → chunk-XFYDGBXL.js} +4 -4
- package/{chunk-JS33TCQ3.js → chunk-XHG22OEX.js} +4 -4
- package/{chunk-DVRHHFEA.js → chunk-XMLRJUU5.js} +1 -1
- package/{chunk-V2J635L5.js → chunk-XOIF2TNF.js} +2 -2
- package/{chunk-SFXYKGK2.js → chunk-XRZJGPFI.js} +7 -7
- package/chunk-ZHXJ6M7T.js +27 -0
- package/chunk-ZZ2MH7LE.js +84 -0
- package/{cliExecutor-K3F7DMRO.js → cliExecutor-DNE7TCC4.js} +2 -2
- package/codingSkills-36KN5NQT.js +48 -0
- package/{createAgentAutomationAction-TS6NNZ4X.js → createAgentAutomationAction-ONKZ46XE.js} +22 -21
- package/{createDialogAction-5HVQ33EX.js → createDialogAction-7QWJEBKU.js} +24 -23
- package/{createPageAction-4F3ZGQJD.js → createPageAction-PB3KXZIA.js} +28 -27
- package/{dbSlice-OP6UPXKA.js → dbSlice-CGSRFJN3.js} +8 -7
- package/{deleteFile-WPWVZE4B.js → deleteFile-WDZ3VM7B.js} +3 -3
- package/{dialogCommands-ZL6L24BS.js → dialogCommands-YZFU4Q26.js} +30 -27
- package/{dialogSlice-FAWUQDJW.js → dialogSlice-53B5ISGQ.js} +22 -21
- package/{docCreateCommands-LYROQTFH.js → docCreateCommands-LOUC5PFB.js} +28 -25
- package/{docDeleteCommands-6TWGTZNR.js → docDeleteCommands-HHPGT4BR.js} +29 -26
- package/{docReadCommands-PRULNF26.js → docReadCommands-YPSN4HEF.js} +28 -25
- package/{docStore-2UHVWLTV.js → docStore-LJXXRB5W.js} +23 -22
- package/{docUpdateCommands-NNYYWJBI.js → docUpdateCommands-CJCZO54M.js} +28 -25
- package/{fetchMessages-KTNM7QAR.js → fetchMessages-BMGVZVSE.js} +4 -3
- package/{getPricing-UGDJHI7M.js → getPricing-RYY6OBA4.js} +4 -4
- package/handleSendMessageAction-ICGX4QCM.js +402 -0
- package/index.js +68 -68
- package/{localDialogRead-2VRI24F4.js → localDialogRead-HQZPVIE3.js} +1 -1
- package/{localRuntimeDb-LGDF6FQP.js → localRuntimeDb-THJZGAOJ.js} +1 -1
- package/{machineCommands-JQPEQFSE.js → machineCommands-YLDZXK4D.js} +64 -58
- package/{machineWsRunDispatch-FFFNWVEW.js → machineWsRunDispatch-LTQL3DRE.js} +56 -50
- package/{models-LSCRJJ6P.js → models-5K5G2CZI.js} +2 -2
- package/package.json +1 -1
- package/queryRunOverlay-O4LOMMPO.js +161 -0
- package/{read-HXHAZBKH.js → read-3FMPZPER.js} +3 -3
- package/{readDocTool-VPBDTO4G.js → readDocTool-VSYHKK3V.js} +1 -1
- package/{readlineWorkspace-QSXHSBHA.js → readlineWorkspace-OSPVWNAT.js} +699 -168
- package/{removeDialogAgentAction-HUFVN35S.js → removeDialogAgentAction-OAGA2G3U.js} +11 -10
- package/{runAgentClientLoop-A75BUU6D.js → runAgentClientLoop-76SUKKPX.js} +46 -40
- package/runOverlayPresentation-ZO4VCWEU.js +11 -0
- package/{runtimeDoctorCommands-THIHX2SY.js → runtimeDoctorCommands-E2OUORHK.js} +6 -6
- package/setDialogExtraReferencesAction-JZEXA5SL.js +27 -0
- package/{setPrimaryDialogAgentAction-VB4UV2CC.js → setPrimaryDialogAgentAction-4ZUQQKDG.js} +27 -18
- package/{settingSlice-7JYPQNAC.js → settingSlice-7MNKHZ6R.js} +9 -8
- package/{skillDiscovery-6M2BZUFN.js → skillDiscovery-KJWT7JBU.js} +3 -3
- package/{spaceCommands-4LE45GB7.js → spaceCommands-GIF7MKVD.js} +31 -28
- package/{spaceSlice-444MFUP6.js → spaceSlice-M4PVN5PO.js} +22 -21
- package/{streamAgentChatTurn-DJAE7USZ.js → streamAgentChatTurn-GCKTFSHQ.js} +96 -55
- package/{tableCommands-3P7MJ3PF.js → tableCommands-BEQAGE4I.js} +1 -1
- package/{tools-YB6LXSVN.js → tools-RJVFXOLR.js} +35 -30
- package/{tuiSummaryLlmCaller-QQL3JA5I.js → tuiSummaryLlmCaller-VUNVBRX3.js} +7 -6
- package/types-ZSTJ7MPR.js +7 -0
- package/{updateDialogTitleAction-6HGFBM64.js → updateDialogTitleAction-PSR67DLV.js} +25 -24
- package/agentRecordCommands-DCH2WBL2.js +0 -99
- package/chunk-BYXBJQAS.js +0 -0
- package/handleSendMessageAction-LJPUYNOH.js +0 -215
- package/{chunk-O4BU24WZ.js → chunk-6Y7A3OQQ.js} +3 -3
- package/{chunk-CMKUBIGW.js → chunk-X7W4TNB4.js} +3 -3
- package/{localRuntimeAuthority-TEGCOWX4.js → localRuntimeAuthority-4IXJCHZ7.js} +3 -3
|
@@ -7,23 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
patch,
|
|
9
9
|
selectById
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-O4BU24WZ.js";
|
|
12
|
-
import "./chunk-I42VC5KR.js";
|
|
13
|
-
import "./chunk-WWC7I6TA.js";
|
|
14
|
-
import "./chunk-JTINRTBT.js";
|
|
15
|
-
import "./chunk-QSJ3HFEF.js";
|
|
16
|
-
import "./chunk-VPTJB4HM.js";
|
|
17
|
-
import "./chunk-DVRHHFEA.js";
|
|
18
|
-
import "./chunk-OOSFSFMA.js";
|
|
19
|
-
import "./chunk-GBRG75BQ.js";
|
|
20
|
-
import "./chunk-3EUW3WEO.js";
|
|
21
|
-
import "./chunk-U6VC4MU4.js";
|
|
22
|
-
import "./chunk-KUG52IAP.js";
|
|
23
|
-
import "./chunk-LCBAMY2M.js";
|
|
24
|
-
import "./chunk-4SN6J65J.js";
|
|
25
|
-
import "./chunk-CF7PE763.js";
|
|
26
|
-
import "./chunk-G3SUCT4W.js";
|
|
10
|
+
} from "./chunk-XRZJGPFI.js";
|
|
27
11
|
import {
|
|
28
12
|
__toESM
|
|
29
13
|
} from "./chunk-4VNS5WPM.js";
|
|
@@ -54,6 +38,7 @@ var setDialogExtraReferencesAction = async (extraReferences, thunkApi) => {
|
|
|
54
38
|
})
|
|
55
39
|
).unwrap();
|
|
56
40
|
};
|
|
41
|
+
|
|
57
42
|
export {
|
|
58
43
|
setDialogExtraReferencesAction
|
|
59
44
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getModelAbility
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RK5NYQEL.js";
|
|
4
4
|
|
|
5
5
|
// packages/ai/agent/safeAgentSummary.ts
|
|
6
6
|
function parseTimestamp(val) {
|
|
@@ -103,8 +103,21 @@ function toSafeAgentSummary(record, options) {
|
|
|
103
103
|
const favStatus = resolveFavoriteStatus(record, options);
|
|
104
104
|
const isPublic = record?.isPublic === true || record?.isPublicFlag === true || record?.publicRecordExists === true;
|
|
105
105
|
const updatedAt = safeTimestamp(record?.updatedAt ?? record?.createdAt ?? record?.created);
|
|
106
|
+
const currentUserId = options?.userId;
|
|
107
|
+
const isOwnedByRecord = Boolean(currentUserId) && (typeof record?.userId === "string" && record.userId === currentUserId || typeof record?.ownerId === "string" && record.ownerId === currentUserId);
|
|
108
|
+
const isOwnedByDbKey = Boolean(currentUserId) && typeof record?.dbKey === "string" && record.dbKey.startsWith(`agent-${currentUserId}-`);
|
|
109
|
+
const isOwned = isOwnedByRecord || isOwnedByDbKey;
|
|
110
|
+
let agentKey;
|
|
111
|
+
if (Boolean(currentUserId) && id) {
|
|
112
|
+
if (isOwned) {
|
|
113
|
+
agentKey = `agent-${currentUserId}-${id}`;
|
|
114
|
+
} else if (publicKey) {
|
|
115
|
+
agentKey = publicKey;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
106
118
|
return {
|
|
107
119
|
id,
|
|
120
|
+
...agentKey !== void 0 ? { agentKey } : {},
|
|
108
121
|
...publicKey !== void 0 ? { publicKey } : {},
|
|
109
122
|
name,
|
|
110
123
|
handle,
|
|
@@ -120,11 +133,16 @@ function toSafeAgentSummary(record, options) {
|
|
|
120
133
|
isFavorite: favStatus.isFavorite,
|
|
121
134
|
favoritedAt: favStatus.favoritedAt,
|
|
122
135
|
isPublic,
|
|
136
|
+
isOwned,
|
|
123
137
|
updatedAt
|
|
124
138
|
};
|
|
125
139
|
}
|
|
126
140
|
function sortSafeAgentSummaries(agents) {
|
|
127
141
|
return [...agents].sort((left, right) => {
|
|
142
|
+
const leftOwned = left.isOwned === true;
|
|
143
|
+
const rightOwned = right.isOwned === true;
|
|
144
|
+
if (leftOwned && !rightOwned) return -1;
|
|
145
|
+
if (!leftOwned && rightOwned) return 1;
|
|
128
146
|
const leftFav = left.isFavorite === true;
|
|
129
147
|
const rightFav = right.isFavorite === true;
|
|
130
148
|
if (leftFav && !rightFav) return -1;
|
|
@@ -0,0 +1,255 @@
|
|
|
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
|
+
function shouldStripReasoningContentForOutbound(provider, model) {
|
|
34
|
+
const p = provider?.trim().toLowerCase();
|
|
35
|
+
const m = model?.trim().toLowerCase();
|
|
36
|
+
if (!p || !m) return false;
|
|
37
|
+
if (p === "deepseek" || p === "nolo") return m === "deepseek-v4-flash";
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// packages/integrations/openai/responsesHelpers.ts
|
|
42
|
+
var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
|
|
43
|
+
var sanitizeResponsesParameters = (parameters) => {
|
|
44
|
+
if (!isRecord(parameters)) {
|
|
45
|
+
return parameters;
|
|
46
|
+
}
|
|
47
|
+
const next = { ...parameters };
|
|
48
|
+
for (const key of RESPONSES_TOP_LEVEL_SCHEMA_KEYS) {
|
|
49
|
+
delete next[key];
|
|
50
|
+
}
|
|
51
|
+
return next;
|
|
52
|
+
};
|
|
53
|
+
var appendTextPart = (parts, text, role) => {
|
|
54
|
+
if (!text) return;
|
|
55
|
+
const last = parts.at(-1);
|
|
56
|
+
const textType = role === "assistant" ? "output_text" : "input_text";
|
|
57
|
+
if (last?.type === textType) {
|
|
58
|
+
last.text += text;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
parts.push({ type: textType, text });
|
|
62
|
+
};
|
|
63
|
+
var normalizeMessageParts = (content, role) => {
|
|
64
|
+
if (typeof content === "string") {
|
|
65
|
+
if (!content) return [];
|
|
66
|
+
return [
|
|
67
|
+
{
|
|
68
|
+
type: role === "assistant" ? "output_text" : "input_text",
|
|
69
|
+
text: content
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
const parts = [];
|
|
74
|
+
for (const part of content ?? []) {
|
|
75
|
+
const typedPart = part;
|
|
76
|
+
if (typedPart?.type === "text" && typeof typedPart.text === "string") {
|
|
77
|
+
appendTextPart(parts, typedPart.text, role);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (typedPart?.type === "image_url" && typeof typedPart.image_url?.url === "string" && typedPart.image_url.url) {
|
|
81
|
+
if (role === "assistant") continue;
|
|
82
|
+
parts.push({
|
|
83
|
+
type: "input_image",
|
|
84
|
+
image_url: typedPart.image_url.url,
|
|
85
|
+
detail: typedPart.image_url.detail
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return parts;
|
|
90
|
+
};
|
|
91
|
+
var normalizeToolOutput = (content) => {
|
|
92
|
+
if (typeof content === "string") return content;
|
|
93
|
+
return JSON.stringify(content ?? "");
|
|
94
|
+
};
|
|
95
|
+
var toResponsesTools = (tools) => {
|
|
96
|
+
if (!Array.isArray(tools) || tools.length === 0) return void 0;
|
|
97
|
+
return tools.map((tool) => {
|
|
98
|
+
const fn = tool?.function;
|
|
99
|
+
if (!fn?.name) return null;
|
|
100
|
+
return {
|
|
101
|
+
type: "function",
|
|
102
|
+
name: fn.name,
|
|
103
|
+
description: fn.description,
|
|
104
|
+
parameters: sanitizeResponsesParameters(fn.parameters),
|
|
105
|
+
strict: fn.strict
|
|
106
|
+
};
|
|
107
|
+
}).filter(Boolean);
|
|
108
|
+
};
|
|
109
|
+
var convertMessagesToResponsesInput = (messages, options) => {
|
|
110
|
+
const input = [];
|
|
111
|
+
for (const message of messages) {
|
|
112
|
+
if (!message?.role) continue;
|
|
113
|
+
if (message.role === "tool") {
|
|
114
|
+
if (!message.tool_call_id) continue;
|
|
115
|
+
input.push({
|
|
116
|
+
type: "function_call_output",
|
|
117
|
+
call_id: message.tool_call_id,
|
|
118
|
+
output: normalizeToolOutput(message.content)
|
|
119
|
+
});
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const role = message.role;
|
|
123
|
+
if (role === "assistant" && !options?.stripReasoningContent && typeof message.reasoning_content === "string" && message.reasoning_content) {
|
|
124
|
+
input.push({ type: "reasoning", content: message.reasoning_content });
|
|
125
|
+
}
|
|
126
|
+
const contentParts = normalizeMessageParts(message.content, role);
|
|
127
|
+
if (contentParts.length > 0) {
|
|
128
|
+
input.push({
|
|
129
|
+
type: "message",
|
|
130
|
+
role,
|
|
131
|
+
content: contentParts
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (role === "assistant" && Array.isArray(message.content)) {
|
|
135
|
+
const replayImages = message.content.map((part) => part).filter(
|
|
136
|
+
(part) => part?.type === "image_url" && typeof part.image_url?.url === "string" && Boolean(part.image_url.url)
|
|
137
|
+
).map((part) => ({
|
|
138
|
+
type: "input_image",
|
|
139
|
+
image_url: part.image_url.url,
|
|
140
|
+
detail: part.image_url.detail
|
|
141
|
+
}));
|
|
142
|
+
if (replayImages.length > 0) {
|
|
143
|
+
input.push({
|
|
144
|
+
type: "message",
|
|
145
|
+
role: "user",
|
|
146
|
+
content: replayImages
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (role === "assistant" && Array.isArray(message.tool_calls)) {
|
|
151
|
+
for (const toolCall of message.tool_calls) {
|
|
152
|
+
if (!toolCall?.id || !toolCall.function?.name) continue;
|
|
153
|
+
input.push({
|
|
154
|
+
type: "function_call",
|
|
155
|
+
call_id: toolCall.id,
|
|
156
|
+
name: toolCall.function.name,
|
|
157
|
+
arguments: typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments ?? {})
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return input;
|
|
163
|
+
};
|
|
164
|
+
var extractTextFromResponseOutput = (response) => {
|
|
165
|
+
const parts = [];
|
|
166
|
+
for (const item of response?.output ?? []) {
|
|
167
|
+
if (item?.type !== "message") continue;
|
|
168
|
+
for (const content of item.content ?? []) {
|
|
169
|
+
if (content?.type === "output_text" && typeof content.text === "string") {
|
|
170
|
+
parts.push(content.text);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return parts.join("");
|
|
175
|
+
};
|
|
176
|
+
var toDataUrl = (base64Data, mimeType) => {
|
|
177
|
+
const normalizedMimeType = asOptionalTrimmedString(mimeType) ?? "image/png";
|
|
178
|
+
return `data:${normalizedMimeType};base64,${base64Data}`;
|
|
179
|
+
};
|
|
180
|
+
var extractImagePartsFromResponseOutput = (response) => {
|
|
181
|
+
const images = [];
|
|
182
|
+
for (const item of response?.output ?? []) {
|
|
183
|
+
if (item?.type === "image_generation_call") {
|
|
184
|
+
const result = asOptionalTrimmedString(item.result);
|
|
185
|
+
if (result) {
|
|
186
|
+
const outputFormat = asOptionalTrimmedString(item.output_format);
|
|
187
|
+
images.push({
|
|
188
|
+
type: "image_url",
|
|
189
|
+
image_url: {
|
|
190
|
+
url: toDataUrl(
|
|
191
|
+
result,
|
|
192
|
+
outputFormat ? `image/${outputFormat}` : void 0
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (item?.type !== "message") continue;
|
|
200
|
+
for (const content of item.content ?? []) {
|
|
201
|
+
const result = asOptionalTrimmedString(content?.result);
|
|
202
|
+
if (content?.type === "output_image" && result) {
|
|
203
|
+
images.push({
|
|
204
|
+
type: "image_url",
|
|
205
|
+
image_url: {
|
|
206
|
+
url: toDataUrl(
|
|
207
|
+
result,
|
|
208
|
+
content.mime_type ?? content.mimeType ?? null
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return images;
|
|
216
|
+
};
|
|
217
|
+
var extractToolCallsFromResponseOutput = (response) => {
|
|
218
|
+
const calls = [];
|
|
219
|
+
for (const item of response?.output ?? []) {
|
|
220
|
+
if (item?.type !== "function_call") continue;
|
|
221
|
+
if (!item.call_id || !item.name) continue;
|
|
222
|
+
calls.push({
|
|
223
|
+
id: item.call_id,
|
|
224
|
+
type: "function",
|
|
225
|
+
function: {
|
|
226
|
+
name: item.name,
|
|
227
|
+
arguments: typeof item.arguments === "string" ? item.arguments : JSON.stringify(item.arguments ?? {})
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return calls;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// packages/core/chat/imageParts.ts
|
|
235
|
+
function isImageUrlPart(part) {
|
|
236
|
+
return isRecord(part) && part.type === "image_url";
|
|
237
|
+
}
|
|
238
|
+
function hasImageParts(messages) {
|
|
239
|
+
return messages.some(
|
|
240
|
+
(message) => Array.isArray(message.content) && message.content.some(isImageUrlPart)
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export {
|
|
245
|
+
isImageUrlPart,
|
|
246
|
+
hasImageParts,
|
|
247
|
+
preserveAgentStateFields,
|
|
248
|
+
toOpenAiCompatibleMessages,
|
|
249
|
+
shouldStripReasoningContentForOutbound,
|
|
250
|
+
toResponsesTools,
|
|
251
|
+
convertMessagesToResponsesInput,
|
|
252
|
+
extractTextFromResponseOutput,
|
|
253
|
+
extractImagePartsFromResponseOutput,
|
|
254
|
+
extractToolCallsFromResponseOutput
|
|
255
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
i18n_default,
|
|
3
3
|
toolRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-J67FKTTY.js";
|
|
5
5
|
import {
|
|
6
6
|
canonicalizeToolNames
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZZ2MH7LE.js";
|
|
8
8
|
import {
|
|
9
9
|
isNoloHostedProvider
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-O6W2O2DA.js";
|
|
11
11
|
import {
|
|
12
12
|
asTrimmedLowercaseString
|
|
13
13
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -146,6 +146,7 @@ var sanitizeToolForProvider = (tool, provider) => {
|
|
|
146
146
|
var translatedFunctionCache = /* @__PURE__ */ new Map();
|
|
147
147
|
var prepareToolsResultCache = /* @__PURE__ */ new Map();
|
|
148
148
|
var PREPARE_TOOLS_CACHE_LIMIT = 128;
|
|
149
|
+
var warnedUnknownToolNames = /* @__PURE__ */ new Set();
|
|
149
150
|
function getTranslation(keys, defaultVal) {
|
|
150
151
|
for (const key of keys) {
|
|
151
152
|
if (i18n_default.exists(key)) {
|
|
@@ -247,7 +248,15 @@ var prepareTools = (toolNames, options) => {
|
|
|
247
248
|
}
|
|
248
249
|
const prepared = canonicalNames.map((toolName) => {
|
|
249
250
|
const regTool = toolRegistry[toolName];
|
|
250
|
-
if (!regTool)
|
|
251
|
+
if (!regTool) {
|
|
252
|
+
if (!warnedUnknownToolNames.has(toolName)) {
|
|
253
|
+
warnedUnknownToolNames.add(toolName);
|
|
254
|
+
console.warn(
|
|
255
|
+
`[prepareTools] unknown tool name "${toolName}" ignored (not in toolRegistry); likely stale agent config from a renamed/deprecated tool.`
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
return regTool;
|
|
259
|
+
}
|
|
251
260
|
return {
|
|
252
261
|
...regTool,
|
|
253
262
|
function: translateSchemaCached(regTool.function)
|