nolo-cli 0.16.0 → 0.18.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.
Files changed (134) hide show
  1. package/{_executeModel-AVCA2NAV.js → _executeModel-X5PCIZN6.js} +50 -44
  2. package/{action-F5JACQBG.js → action-LT7BRFLK.js} +10 -9
  3. package/{addContentAction-AQXEYRBE.js → addContentAction-PL3KKBDH.js} +9 -8
  4. package/{addDialogAgentAction-EJHHJZWW.js → addDialogAgentAction-FCMSKYAF.js} +8 -7
  5. package/{agentDeleteCommand-QW5PUMDQ.js → agentDeleteCommand-2BZDQV36.js} +32 -29
  6. package/{agentEmailCommands-4ORVLGVQ.js → agentEmailCommands-2QJDGRMB.js} +62 -56
  7. package/{agentListCommands-YWBYRTYC.js → agentListCommands-6VEPTKBI.js} +31 -28
  8. package/{agentMachineCommands-JSQW4FOA.js → agentMachineCommands-NVVHNWYI.js} +30 -27
  9. package/{agentPullCommand-6HWUT3SW.js → agentPullCommand-ZZGU5KOY.js} +4 -4
  10. package/{agentRecordCommands-AASIWOBT.js → agentRecordCommands-4GGRDMD4.js} +57 -51
  11. package/{agentRunCommand-TB5BHXUH.js → agentRunCommand-XOLQNKBZ.js} +63 -54
  12. package/{agentRunControl-6ADXVYMR.js → agentRunControl-Y5AFH5PQ.js} +24 -1
  13. package/{agentRuntimeLocal-QNPNJRVH.js → agentRuntimeLocal-7WYWCGL4.js} +25 -22
  14. package/{agentSlice-RUNXC62Y.js → agentSlice-EAXPGEYV.js} +9 -8
  15. package/appDeleteCommands-77KR2RJ4.js +127 -0
  16. package/appDeployCommands-K7CAHGBI.js +166 -0
  17. package/appDeployStatusCommands-4OEKLTBT.js +147 -0
  18. package/appGetCommands-VM2WDLAZ.js +122 -0
  19. package/appListCommands-GX6BBA6U.js +125 -0
  20. package/{authCommand-YFTR3347.js → authCommand-DY6UUL6O.js} +16 -9
  21. package/{authCommands-YXGOXNBZ.js → authCommands-XTBV7OFZ.js} +6 -5
  22. package/{chunk-DPAB4FQ7.js → chunk-23FZYPLC.js} +1608 -212
  23. package/{chunk-LPEUV5RE.js → chunk-34WPV75U.js} +23 -2
  24. package/{chunk-XPC5C7BK.js → chunk-3ND52WIL.js} +2 -2
  25. package/{chunk-SOTZ6RDN.js → chunk-3Q7WHGCB.js} +1 -1
  26. package/{chunk-3OIRVWXA.js → chunk-3ZX7PERL.js} +10 -1
  27. package/{chunk-KKY4B2Q2.js → chunk-4PWB7JRR.js} +4 -1
  28. package/{chunk-6N4KODMN.js → chunk-4T5F7YZQ.js} +1 -1
  29. package/chunk-7BUYEZ6U.js +671 -0
  30. package/{chunk-AS3ZQ3O2.js → chunk-7OBMZCRD.js} +1 -1
  31. package/{chunk-IGXREZW2.js → chunk-AHCY2S2I.js} +1 -1
  32. package/{chunk-QLUFR47U.js → chunk-AL2V7U3E.js} +1 -1
  33. package/{chunk-MTU75CZ2.js → chunk-B5TOXZAK.js} +1 -1
  34. package/{chunk-AUURUT6L.js → chunk-BV4VEE3W.js} +264 -424
  35. package/{chunk-FRV6A633.js → chunk-CZ6NYQTV.js} +13 -4
  36. package/{chunk-PCTUYVUM.js → chunk-DFCFMCY6.js} +10 -3
  37. package/{chunk-JTMNCCWF.js → chunk-DKZFOK24.js} +16 -87
  38. package/chunk-DL6EPNIK.js +50 -0
  39. package/{chunk-ZQBL7LIC.js → chunk-EDV7EBOI.js} +317 -216
  40. package/{chunk-IWLUTMYX.js → chunk-ELT65PZW.js} +2 -2
  41. package/chunk-FQZZLA3C.js +223 -0
  42. package/{chunk-55NSNCFM.js → chunk-FXUSIQC2.js} +1 -1
  43. package/{chunk-MR6ISAGB.js → chunk-G5U6LDLG.js} +6 -6
  44. package/chunk-GFUIQ4RY.js +136 -0
  45. package/{chunk-NVEWUJVX.js → chunk-HEGV7BH3.js} +1 -1
  46. package/{chunk-BEBNFWDU.js → chunk-HWW2M4SN.js} +3 -3
  47. package/{chunk-4L2OJPCU.js → chunk-I2ZJKTG5.js} +58 -8
  48. package/{chunk-Z5JQNBNY.js → chunk-IYEXFJPC.js} +34 -15
  49. package/{setDialogExtraReferencesAction-LR6MSIXO.js → chunk-JLA4FXYC.js} +2 -17
  50. package/chunk-KFEVY3ST.js +255 -0
  51. package/{chunk-4FX6NVDW.js → chunk-L4F3I4SR.js} +3 -136
  52. package/{chunk-XBS2WYJ2.js → chunk-LLWKHDG4.js} +1 -1
  53. package/{chunk-3WGLLTK4.js → chunk-LSFAWXKC.js} +100 -3
  54. package/{chunk-6EVITP2G.js → chunk-MHSGJW4Z.js} +2 -251
  55. package/{chunk-O6W2O2DA.js → chunk-MKA6QE5E.js} +6 -2
  56. package/{chunk-DGEYDWEZ.js → chunk-MPVYDS7I.js} +3 -3
  57. package/{chunk-KFHN5NGJ.js → chunk-MVQ4TBSD.js} +1 -1
  58. package/{chunk-AVVZUXXC.js → chunk-N54HIJVJ.js} +34 -13
  59. package/{chunk-EHLHSX7R.js → chunk-OK6YSWLH.js} +9 -2
  60. package/{chunk-33BJUVK4.js → chunk-PIZYJVHQ.js} +5 -5
  61. package/{chunk-RLCXU7A5.js → chunk-PJSV3IZ5.js} +1 -1
  62. package/{chunk-7UKFVQ5W.js → chunk-R35XMF6F.js} +126 -41
  63. package/{chunk-OOSFSFMA.js → chunk-R5V5G73M.js} +2 -0
  64. package/{chunk-S2LXHNHG.js → chunk-REA4JLBH.js} +6 -6
  65. package/chunk-RQN4SEKL.js +107 -0
  66. package/{chunk-EABWT43X.js → chunk-RVOUXDFU.js} +5 -5
  67. package/{chunk-NSCHQQPU.js → chunk-SCTYAHYK.js} +470 -325
  68. package/{chunk-JTINRTBT.js → chunk-SKDNBYZK.js} +2 -2
  69. package/{chunk-M43KDE25.js → chunk-SWDPIPOY.js} +2 -8
  70. package/{chunk-KMQPSTMJ.js → chunk-TRT4I4UD.js} +2 -2
  71. package/{chunk-66X4VSRC.js → chunk-UAIVG4J6.js} +42 -2
  72. package/{chunk-3663CXZN.js → chunk-UBHAWFQ6.js} +143 -31
  73. package/{chunk-YJKXGHJ6.js → chunk-UGUW3FHG.js} +4 -4
  74. package/{chunk-P3RIAYGG.js → chunk-V3ED5AWK.js} +3 -3
  75. package/chunk-V5R4NZP2.js +78 -0
  76. package/{chunk-4IJYA27C.js → chunk-VDXCXCXH.js} +1 -1
  77. package/{chunk-MYMMNKYL.js → chunk-VNAEBGDK.js} +156 -6
  78. package/{chunk-FY233ZFU.js → chunk-VYHDJEQD.js} +110 -192
  79. package/{chunk-W4NVOSFF.js → chunk-WFHXMLHZ.js} +1 -1
  80. package/{chunk-H33743XH.js → chunk-WJRJDX2W.js} +1 -1
  81. package/chunk-X4Q4UZEY.js +26 -0
  82. package/{chunk-RPDGJO4D.js → chunk-XHG22OEX.js} +4 -4
  83. package/{chunk-DVRHHFEA.js → chunk-XMLRJUU5.js} +1 -1
  84. package/{chunk-3S2VOMIF.js → chunk-XRZJGPFI.js} +7 -7
  85. package/{chunk-GSINCD4P.js → chunk-YGW4G5W5.js} +25 -12
  86. package/chunk-ZZ2MH7LE.js +84 -0
  87. package/{cliExecutor-K3F7DMRO.js → cliExecutor-DNE7TCC4.js} +2 -2
  88. package/codingSkills-36KN5NQT.js +48 -0
  89. package/{createAgentAutomationAction-FNHPSKKO.js → createAgentAutomationAction-GNFF524X.js} +20 -19
  90. package/{createDialogAction-TZCVQ3NU.js → createDialogAction-RB55KCLO.js} +22 -21
  91. package/{createPageAction-EIGZ3BKT.js → createPageAction-Y7343GLU.js} +26 -25
  92. package/{db-HCJ5PRB5.js → db-W3O47YGF.js} +38 -12
  93. package/{dbSlice-7KQH6GOU.js → dbSlice-CGSRFJN3.js} +8 -7
  94. package/{deleteFile-WPWVZE4B.js → deleteFile-WDZ3VM7B.js} +3 -3
  95. package/{dialogCommands-FO77J5DQ.js → dialogCommands-IAZK6YHQ.js} +30 -27
  96. package/{dialogSlice-MM5U4KE2.js → dialogSlice-UQAXF23P.js} +20 -19
  97. package/{docCreateCommands-I3BS3AZI.js → docCreateCommands-I2EWZGCI.js} +33 -28
  98. package/{docDeleteCommands-Q2OPV52P.js → docDeleteCommands-IZ45UZKG.js} +32 -27
  99. package/{docReadCommands-YOOFACYZ.js → docReadCommands-R6Z4QJYU.js} +31 -26
  100. package/{docStore-NGYQ2JTR.js → docStore-5HOJ4D7D.js} +21 -20
  101. package/{docUpdateCommands-2B32ITHN.js → docUpdateCommands-2LRBKQPY.js} +32 -27
  102. package/{fetchMessages-KTNM7QAR.js → fetchMessages-BMGVZVSE.js} +4 -3
  103. package/{getPricing-P4XRJRZB.js → getPricing-G7DLAST6.js} +3 -3
  104. package/{handleSendMessageAction-JRZWWBKP.js → handleSendMessageAction-Q4HY35WX.js} +21 -20
  105. package/index.js +95 -64
  106. package/{localDialogRead-2VRI24F4.js → localDialogRead-4H3QJFLW.js} +2 -2
  107. package/{localRuntimeDb-LGDF6FQP.js → localRuntimeDb-THJZGAOJ.js} +1 -1
  108. package/{machineCommands-WRWF2ICZ.js → machineCommands-PKBPQKTY.js} +63 -57
  109. package/{machineWsRunDispatch-ZX7Q3TWZ.js → machineWsRunDispatch-UZAW4OXJ.js} +55 -49
  110. package/{models-WQ5N4OJM.js → models-DJFSJ7SW.js} +2 -2
  111. package/package.json +1 -1
  112. package/queryRunOverlay-O4LOMMPO.js +161 -0
  113. package/{read-CN3TNXIP.js → read-3FMPZPER.js} +3 -3
  114. package/{readDocTool-WF3675ED.js → readDocTool-VSYHKK3V.js} +1 -1
  115. package/{readlineWorkspace-ZTGRGW46.js → readlineWorkspace-Y2RDOFZG.js} +762 -218
  116. package/{removeDialogAgentAction-YDHBFEGI.js → removeDialogAgentAction-OAGA2G3U.js} +10 -9
  117. package/{runAgentClientLoop-JZCOP7LG.js → runAgentClientLoop-NBPIKJ6J.js} +44 -38
  118. package/runOverlayPresentation-ZO4VCWEU.js +11 -0
  119. package/{runtimeDoctorCommands-THIHX2SY.js → runtimeDoctorCommands-E2OUORHK.js} +6 -6
  120. package/setDialogExtraReferencesAction-JZEXA5SL.js +27 -0
  121. package/{setPrimaryDialogAgentAction-IIVDCY5C.js → setPrimaryDialogAgentAction-4ZUQQKDG.js} +26 -17
  122. package/{settingSlice-O23YDK2O.js → settingSlice-7MNKHZ6R.js} +9 -8
  123. package/{skillDiscovery-6M2BZUFN.js → skillDiscovery-KJWT7JBU.js} +3 -3
  124. package/{spaceCommands-VV4GTPQK.js → spaceCommands-DHCZ7J5I.js} +31 -28
  125. package/{spaceSlice-DRWWZJP7.js → spaceSlice-ZXLLG3CR.js} +20 -19
  126. package/{streamAgentChatTurn-Y6WGATQR.js → streamAgentChatTurn-L3YW6LSB.js} +98 -57
  127. package/{tableCommands-3P7MJ3PF.js → tableCommands-BEQAGE4I.js} +1 -1
  128. package/{tools-PUNBY3AH.js → tools-ECGXR5QF.js} +33 -28
  129. package/{tuiSummaryLlmCaller-F64WLSAF.js → tuiSummaryLlmCaller-OMSCNHXA.js} +6 -5
  130. package/types-ZSTJ7MPR.js +7 -0
  131. package/{updateDialogTitleAction-YSR4TCMB.js → updateDialogTitleAction-HQ2EUDFT.js} +23 -22
  132. package/{chunk-O4BU24WZ.js → chunk-6Y7A3OQQ.js} +3 -3
  133. package/{chunk-CMKUBIGW.js → chunk-X7W4TNB4.js} +3 -3
  134. 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-3S2VOMIF.js";
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-XPC5C7BK.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
  };
@@ -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,22 +1,19 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-PCTUYVUM.js";
4
+ } from "./chunk-DFCFMCY6.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
8
8
  import {
9
- buildSkillDocMarkdown
10
- } from "./chunk-VC6OZXO5.js";
9
+ createSpaceKey
10
+ } from "./chunk-ELT65PZW.js";
11
11
  import {
12
12
  parseUserIdFromAuthToken,
13
13
  readOption,
14
14
  resolveAuthToken,
15
15
  resolveServerUrl
16
16
  } from "./chunk-A7GB5UGH.js";
17
- import {
18
- createSpaceKey
19
- } from "./chunk-IWLUTMYX.js";
20
17
  import {
21
18
  asTrimmedLowercaseString
22
19
  } from "./chunk-QSJ3HFEF.js";
@@ -30,128 +27,6 @@ import {
30
27
  normalizeServerOrigin
31
28
  } from "./chunk-CF7PE763.js";
32
29
 
33
- // packages/cli/docPageHelpers.ts
34
- import { readFileSync } from "node:fs";
35
- import { ulid } from "ulid";
36
- function getCliArg(args, flag) {
37
- const idx = args.indexOf(flag);
38
- return idx !== -1 ? args[idx + 1] : void 0;
39
- }
40
- function readBodyArg(args, fallback = "") {
41
- const bodyFile = getCliArg(args, "--body-file");
42
- if (bodyFile !== void 0) {
43
- return readFileSync(bodyFile, "utf8");
44
- }
45
- return getCliArg(args, "--body") ?? fallback;
46
- }
47
- function textToSlate(text) {
48
- return text.split("\n").map((line) => ({
49
- type: "paragraph",
50
- children: [{ text: line }]
51
- }));
52
- }
53
- function createPageId() {
54
- return ulid();
55
- }
56
- function buildPageKey(userId, pageId) {
57
- return `page-${userId}-${pageId}`;
58
- }
59
- function buildPageRecord(args) {
60
- const { dbKey, pageId, title, spaceId, content, existing, meta, slateData } = args;
61
- const now = Date.now();
62
- const createdAt = typeof existing?.createdAt === "number" ? existing.createdAt : now;
63
- const created = typeof existing?.created === "string" ? existing.created : new Date(createdAt).toISOString();
64
- const nextRecord = {
65
- ...existing ?? {},
66
- id: existing?.id ?? pageId,
67
- dbKey,
68
- type: "page",
69
- title,
70
- spaceId,
71
- content,
72
- updatedAt: now,
73
- createdAt,
74
- created
75
- };
76
- if (meta !== void 0) {
77
- if (meta === null) {
78
- delete nextRecord.meta;
79
- } else {
80
- nextRecord.meta = meta;
81
- }
82
- }
83
- if (slateData !== void 0) {
84
- if (slateData === null) {
85
- delete nextRecord.slateData;
86
- } else {
87
- nextRecord.slateData = slateData;
88
- }
89
- } else if (!existing?.slateData) {
90
- nextRecord.slateData = textToSlate(content);
91
- }
92
- return nextRecord;
93
- }
94
-
95
- // packages/cli/docSkillHelpers.ts
96
- function normalizeSkillSeed(input) {
97
- return input.trim().toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, "-").replace(/^-+|-+$/g, "");
98
- }
99
- function deterministicId(prefix, seed) {
100
- let h = 2166136261;
101
- for (let i = 0; i < seed.length; i++) {
102
- h ^= seed.charCodeAt(i);
103
- h = h * 16777619 >>> 0;
104
- }
105
- const suffix = h.toString(36).toUpperCase().padStart(14, "0");
106
- return (prefix + suffix).slice(0, 26);
107
- }
108
- function buildSkillDocId(input) {
109
- return deterministicId("01SK", normalizeSkillSeed(input) || input);
110
- }
111
- function buildSkillPageKey(userId, skillId) {
112
- return buildPageKey(userId, skillId);
113
- }
114
- function buildSkillPageRecord(args) {
115
- const {
116
- dbKey,
117
- skillId,
118
- title,
119
- spaceId,
120
- body,
121
- skillConfig,
122
- evalConfig,
123
- workflowConfig,
124
- existing
125
- } = args;
126
- return {
127
- ...buildPageRecord({
128
- dbKey,
129
- pageId: skillId,
130
- title,
131
- spaceId,
132
- content: buildSkillDocMarkdown({
133
- body,
134
- skillConfig,
135
- evalConfig,
136
- workflowConfig
137
- }),
138
- existing,
139
- meta: {
140
- ...existing?.meta ?? {},
141
- kind: "skill",
142
- skillConfig,
143
- ...evalConfig ? { evalConfig } : {},
144
- ...workflowConfig ? { workflowConfig } : {}
145
- },
146
- slateData: null
147
- })
148
- };
149
- }
150
- function parseJsonArg(raw, fallback) {
151
- if (raw === void 0) return fallback;
152
- return JSON.parse(raw);
153
- }
154
-
155
30
  // packages/cli/docSpaceHelpers.ts
156
31
  async function ensurePageAttachedToSpace(params) {
157
32
  const { baseUrl, userId, authToken, spaceId, contentKey, title, skillSummary } = params;
@@ -333,14 +208,6 @@ function buildSkillSummaryForRecord(record) {
333
208
  }
334
209
 
335
210
  export {
336
- readBodyArg,
337
- createPageId,
338
- buildPageKey,
339
- buildPageRecord,
340
- buildSkillDocId,
341
- buildSkillPageKey,
342
- buildSkillPageRecord,
343
- parseJsonArg,
344
211
  removePageFromSpace,
345
212
  hasHelpArg,
346
213
  hasFlag,
@@ -10,7 +10,7 @@ import {
10
10
  platformHostedModels,
11
11
  xaiModels,
12
12
  zaiModels
13
- } from "./chunk-O6W2O2DA.js";
13
+ } from "./chunk-MKA6QE5E.js";
14
14
 
15
15
  // packages/ai/llm/modelAbility.ts
16
16
  var MODEL_ABILITY_TABLE = {
@@ -1,6 +1,4 @@
1
- // packages/agent-runtime/thinkTagParser.ts
2
- var OPEN_TAG = "<think>";
3
- var CLOSE_TAG = "</think>";
1
+ // packages/agent-runtime/tagPrefixMatch.ts
4
2
  function longestTagPrefixLength(buffer, tag) {
5
3
  const max = Math.min(buffer.length, tag.length - 1);
6
4
  for (let len = max; len > 0; len--) {
@@ -10,6 +8,10 @@ function longestTagPrefixLength(buffer, tag) {
10
8
  }
11
9
  return 0;
12
10
  }
11
+
12
+ // packages/agent-runtime/thinkTagParser.ts
13
+ var OPEN_TAG = "<think>";
14
+ var CLOSE_TAG = "</think>";
13
15
  function extractThinkContent(content) {
14
16
  const regex = new RegExp(`${OPEN_TAG}([\\s\\S]*?)${CLOSE_TAG}`, "g");
15
17
  const matches = [...content.matchAll(regex)];
@@ -81,6 +83,98 @@ function flushThinkParser(state) {
81
83
  };
82
84
  }
83
85
 
86
+ // packages/agent-runtime/toolCallTextParser.ts
87
+ var OPEN_TAG2 = "<tool_call>";
88
+ var CLOSE_TAG2 = "</tool_call>";
89
+ function createToolCallTextParserState() {
90
+ return { mode: "content", buffer: "" };
91
+ }
92
+ function processToolCallTextChunk(chunk, state) {
93
+ let visible = "";
94
+ let toolCallTexts = [];
95
+ let { mode, buffer } = state;
96
+ buffer += chunk;
97
+ while (true) {
98
+ if (mode === "content") {
99
+ const idx = buffer.indexOf(OPEN_TAG2);
100
+ if (idx === -1) {
101
+ const keep = longestTagPrefixLength(buffer, OPEN_TAG2);
102
+ visible += buffer.slice(0, buffer.length - keep);
103
+ buffer = buffer.slice(buffer.length - keep);
104
+ break;
105
+ }
106
+ visible += buffer.slice(0, idx);
107
+ buffer = buffer.slice(idx + OPEN_TAG2.length);
108
+ mode = "toolcall";
109
+ } else {
110
+ const idx = buffer.indexOf(CLOSE_TAG2);
111
+ if (idx === -1) {
112
+ break;
113
+ }
114
+ toolCallTexts.push(buffer.slice(0, idx));
115
+ buffer = buffer.slice(idx + CLOSE_TAG2.length);
116
+ mode = "content";
117
+ }
118
+ }
119
+ return {
120
+ content: visible,
121
+ toolCallTexts,
122
+ state: { mode, buffer }
123
+ };
124
+ }
125
+ function flushToolCallTextParser(state) {
126
+ const { mode, buffer } = state;
127
+ if (mode === "toolcall") {
128
+ const keep = longestTagPrefixLength(buffer, CLOSE_TAG2);
129
+ const text = buffer.slice(0, buffer.length - keep);
130
+ return {
131
+ content: "",
132
+ toolCallTexts: text ? [text] : [],
133
+ state: { mode: "content", buffer: "" }
134
+ };
135
+ }
136
+ return {
137
+ content: buffer,
138
+ toolCallTexts: [],
139
+ state: { mode: "content", buffer: "" }
140
+ };
141
+ }
142
+ function tryParseToolCallText(text) {
143
+ const trimmed = text.trim();
144
+ if (!trimmed) return null;
145
+ try {
146
+ const parsed = JSON.parse(trimmed);
147
+ if (typeof parsed === "object" && parsed !== null && typeof parsed.name === "string") {
148
+ return {
149
+ name: parsed.name,
150
+ arguments: typeof parsed.arguments === "string" ? parsed.arguments : JSON.stringify(parsed.arguments ?? {})
151
+ };
152
+ }
153
+ } catch {
154
+ }
155
+ return null;
156
+ }
157
+ function processContentChunkWithToolCallStripping(chunk, state, onToolCall) {
158
+ const stripped = processToolCallTextChunk(chunk, state);
159
+ for (const text of stripped.toolCallTexts) {
160
+ const parsedTc = tryParseToolCallText(text);
161
+ if (parsedTc) {
162
+ onToolCall(parsedTc.name, parsedTc.arguments);
163
+ }
164
+ }
165
+ return { cleanedContent: stripped.content, state: stripped.state };
166
+ }
167
+ function flushToolCallTextParserIntoCallback(state, onToolCall) {
168
+ const flushed = flushToolCallTextParser(state);
169
+ for (const text of flushed.toolCallTexts) {
170
+ const parsedTc = tryParseToolCallText(text);
171
+ if (parsedTc) {
172
+ onToolCall(parsedTc.name, parsedTc.arguments);
173
+ }
174
+ }
175
+ return { residualContent: flushed.content, state: flushed.state };
176
+ }
177
+
84
178
  // packages/agent-runtime/toolCallAccumulator.ts
85
179
  function createToolCallAccumulator() {
86
180
  return { slots: [] };
@@ -141,6 +235,9 @@ export {
141
235
  createThinkParserState,
142
236
  processThinkChunk,
143
237
  flushThinkParser,
238
+ createToolCallTextParserState,
239
+ processContentChunkWithToolCallStripping,
240
+ flushToolCallTextParserIntoCallback,
144
241
  createToolCallAccumulator,
145
242
  accumulateToolCallDelta,
146
243
  finalizeAccumulatedToolCalls