nolo-cli 0.32.0 → 0.33.0-alpha.10

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 (179) hide show
  1. package/README.md +6 -12
  2. package/{_executeModel-LTMSIBS4.js → _executeModel-YXWAXPWQ.js} +77 -67
  3. package/{action-HI3VRQLP.js → action-OQWPNKAH.js} +17 -15
  4. package/{addContentAction-NCURJ6PK.js → addContentAction-YVINZQTF.js} +14 -13
  5. package/{addDialogAgentAction-RCY4ECF4.js → addDialogAgentAction-6IOCIEPI.js} +14 -13
  6. package/{agentDeleteCommand-D3MYZK6E.js → agentDeleteCommand-VGHWJN5T.js} +44 -60
  7. package/{agentEmailCommands-6BXS574I.js → agentEmailCommands-ZLRF35I3.js} +91 -81
  8. package/{agentGrantCommands-E7ZZFRHK.js → agentGrantCommands-2LEZDADN.js} +2 -2
  9. package/{agentListCommands-SF3HEUTT.js → agentListCommands-OHZJ7AFP.js} +75 -79
  10. package/{agentMachineCommands-YARVXRR6.js → agentMachineCommands-62PHPGTK.js} +43 -59
  11. package/{agentPullCommand-ARSIDNVC.js → agentPullCommand-TSWAJPS2.js} +5 -5
  12. package/agentRecordCommands-CW2JWERD.js +113 -0
  13. package/agentRunCommand-O4HV7YWA.js +131 -0
  14. package/{agentRuntimeLocal-ATGJY6WC.js → agentRuntimeLocal-4PSBNUOE.js} +37 -51
  15. package/{agentSlice-4XWW344Y.js → agentSlice-OUTQ5O72.js} +16 -14
  16. package/{appDeleteCommands-63JO7RXS.js → appDeleteCommands-VTDBVHYR.js} +40 -56
  17. package/{appDeployCommands-Y7EWYUGM.js → appDeployCommands-WOUP7MDA.js} +40 -56
  18. package/{appDeployStatusCommands-ZBEY3DWB.js → appDeployStatusCommands-N2NWZKEN.js} +40 -56
  19. package/{appGetCommands-QSSOSEYL.js → appGetCommands-GYKLWWCA.js} +40 -56
  20. package/{appListCommands-PH3XWNDX.js → appListCommands-RUWBSEJK.js} +40 -56
  21. package/{authCommand-BBDHMSO6.js → authCommand-YVXVH25I.js} +21 -20
  22. package/{authCommands-4UDEKRE6.js → authCommands-WTW6MEYS.js} +10 -10
  23. package/chatQueueReduxAdapter-2QJAD4KQ.js +181 -0
  24. package/{chunk-EEF23OOK.js → chunk-266VUBLK.js} +7 -7
  25. package/{chunk-TEYN42N3.js → chunk-2IVEXF7P.js} +11 -4
  26. package/{chunk-2HXKAPH7.js → chunk-2QLAVHVK.js} +6 -6
  27. package/{chunk-WTGCTVJG.js → chunk-2QTEYCR7.js} +3 -6
  28. package/{chunk-DOISARTV.js → chunk-2UECQ7RE.js} +1 -1
  29. package/{chunk-E3APEOIM.js → chunk-3GZXL6FM.js} +4 -19
  30. package/{chunk-KGEVMUMI.js → chunk-3RUW3ONU.js} +11 -11
  31. package/{chunk-RXVX5LFR.js → chunk-3UG2IIZ3.js} +1 -1
  32. package/{chunk-O5OMJPPF.js → chunk-3WXRAHCG.js} +6 -5
  33. package/{chunk-V54H24CQ.js → chunk-4F5M2MW5.js} +3 -3
  34. package/{chunk-2ZRP5RUG.js → chunk-4OV7DXFJ.js} +12 -11
  35. package/{chunk-W367V5CH.js → chunk-54BAYVCY.js} +404 -117
  36. package/{chunk-GAF5X6B7.js → chunk-5QW3O3ET.js} +284 -310
  37. package/{chunk-DLWCWUNW.js → chunk-64OVNZXE.js} +1197 -757
  38. package/{chunk-ODS2MVMU.js → chunk-66CWPJK2.js} +19 -303
  39. package/{chunk-PTHDLIRB.js → chunk-6KOS7ZBZ.js} +1 -1
  40. package/{chunk-MXFQHRSS.js → chunk-6XIE5ZGI.js} +1 -1
  41. package/{chunk-ATK5WJOA.js → chunk-6YXDOOSH.js} +4 -4
  42. package/{chunk-SWYMCHM7.js → chunk-75U775RZ.js} +69 -1
  43. package/{chunk-UDA3ZYLW.js → chunk-7YYHKBJP.js} +31 -72
  44. package/chunk-ADLYMQB6.js +642 -0
  45. package/{chunk-ZWJOGMKH.js → chunk-AETZ7AD6.js} +1 -1
  46. package/{chunk-43EPBPZ2.js → chunk-ASDXPOJH.js} +2 -2
  47. package/{chunk-44HACRCK.js → chunk-BANYWEYY.js} +4 -4
  48. package/chunk-BFPSVRCQ.js +1799 -0
  49. package/{chunk-TOW4E763.js → chunk-BJIRLHJR.js} +2 -0
  50. package/{chunk-ZJ2WITOO.js → chunk-BQXOGBFN.js} +2 -2
  51. package/{chunk-4PNU7W7K.js → chunk-C7H5GMXT.js} +107 -125
  52. package/chunk-CPYYM4RJ.js +98 -0
  53. package/{chunk-3GZT3L6F.js → chunk-DDVIBKIB.js} +326 -481
  54. package/{chunk-2K4NDPT5.js → chunk-DFUPZE6V.js} +20 -12
  55. package/{chunk-BGTUGS3T.js → chunk-DKMOY3QI.js} +4 -30
  56. package/chunk-EGRJC4ZN.js +91 -0
  57. package/{chunk-K6QEHQZ3.js → chunk-EKLRRZIN.js} +1 -1
  58. package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
  59. package/{chunk-XFG3BAKN.js → chunk-FMEVI5TG.js} +65 -0
  60. package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
  61. package/chunk-GJXRIOLS.js +241 -0
  62. package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
  63. package/chunk-HS7MLR74.js +38 -0
  64. package/{chunk-3AUWC6EM.js → chunk-HUCT7HID.js} +5 -84
  65. package/chunk-IDAU4UFS.js +437 -0
  66. package/{chunk-Q76I4SXI.js → chunk-IHEC7VBF.js} +1 -1
  67. package/{chunk-OWHNFZNW.js → chunk-IKWTTKWG.js} +4 -4
  68. package/{chunk-3LY4F7SV.js → chunk-INZZJSQF.js} +348 -331
  69. package/{chunk-ZJH3LKEW.js → chunk-IR6W62Q6.js} +102 -15
  70. package/{chunk-RH53LMEJ.js → chunk-J44TVX2O.js} +2 -4
  71. package/{chunk-CF2WZF4N.js → chunk-J6WH4PYZ.js} +0 -8
  72. package/chunk-KHCLMKZZ.js +3062 -0
  73. package/{chunk-WHLVPK32.js → chunk-KMSZPTM6.js} +27 -3
  74. package/{chunk-L3GCUVOH.js → chunk-KSRFVP36.js} +1 -1
  75. package/{chunk-XDHHF73Q.js → chunk-LUIHOUZC.js} +95 -95
  76. package/{chunk-UOJRKY5J.js → chunk-M2YMQOLC.js} +44 -53
  77. package/chunk-M3JEW6N6.js +193 -0
  78. package/{chunk-MITD7CON.js → chunk-MDIAECHA.js} +1461 -301
  79. package/{chunk-IXZX5CJK.js → chunk-MQRZ5QUH.js} +1 -1
  80. package/{chunk-3ASDTTEI.js → chunk-MRWGHF56.js} +2 -0
  81. package/{chunk-Q3CSL43H.js → chunk-N4XRDM26.js} +1 -1
  82. package/{chunk-D34RI6NI.js → chunk-NNWHHCVP.js} +75 -1
  83. package/{chunk-CAENRKNJ.js → chunk-OR2HNLVO.js} +126 -88
  84. package/chunk-OW765XBU.js +10 -0
  85. package/{chunk-VMWR7VNI.js → chunk-PRMMCFIN.js} +13 -9
  86. package/{chunk-JZPBVBIY.js → chunk-QTZD6HBK.js} +18 -8
  87. package/chunk-RCFIB45Q.js +28 -0
  88. package/{chunk-7S54ZGF6.js → chunk-RJKIB55Y.js} +256 -12
  89. package/chunk-RPRRIFXV.js +231 -0
  90. package/chunk-RQFO3CAF.js +300 -0
  91. package/chunk-RY57GLGW.js +188 -0
  92. package/{chunk-YHGHADBQ.js → chunk-SCUETSRP.js} +4 -4
  93. package/{chunk-TA6EA2A3.js → chunk-TFK3HUNQ.js} +182 -20
  94. package/{chunk-LAXMH7JY.js → chunk-UM4H3URE.js} +18 -15
  95. package/{chunk-6YABCOFU.js → chunk-UNHKVD2N.js} +1 -1
  96. package/{chunk-G5GVZAXF.js → chunk-UNOTBWZZ.js} +15 -19
  97. package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
  98. package/chunk-URMS4XY2.js +10 -0
  99. package/{chunk-SFWZUTCI.js → chunk-VBUQYOX7.js} +2 -2
  100. package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
  101. package/chunk-VIDPVFP3.js +20 -0
  102. package/{chunk-5RDLGLAP.js → chunk-WJSW43QZ.js} +4 -7
  103. package/{chunk-CF7S2RYZ.js → chunk-WLH5BAKX.js} +6 -6
  104. package/{chunk-VVEH6XUE.js → chunk-X2DAEZ3X.js} +1 -1
  105. package/{chunk-2IJAKBK2.js → chunk-X664KVEV.js} +426 -246
  106. package/{chunk-3FCNXC2J.js → chunk-XRO5VGQ6.js} +3735 -1394
  107. package/chunk-Y5GCAMGP.js +9 -0
  108. package/{chunk-O3JR45Q2.js → chunk-YBMI5JAH.js} +44 -44
  109. package/{chunk-V42OE5HT.js → chunk-YDTYDA5W.js} +3 -3
  110. package/chunk-YYLHWIW6.js +48 -0
  111. package/{chunk-AOS5IN2I.js → chunk-ZHYK3N56.js} +1 -1
  112. package/{chunk-PJ2DDQQM.js → chunk-ZURFOV5J.js} +2 -2
  113. package/{chunk-3UGKATZQ.js → chunk-ZWS6DUHX.js} +26 -435
  114. package/chunk-ZZ2MH7LE.js +84 -0
  115. package/{cliExecutor-BBUVQU4L.js → cliExecutor-DW3PHGEL.js} +2 -2
  116. package/{clipboardy-BVE3LVEH.js → clipboardy-MMBYVRLF.js} +166 -372
  117. package/{codingSkills-V35TRR4Y.js → codingSkills-DY5MINPG.js} +5 -4
  118. package/{createAgentAutomationAction-WLRNE7C4.js → createAgentAutomationAction-H6ZRPXBR.js} +41 -31
  119. package/createDialogAction-UJ6LFJYM.js +61 -0
  120. package/{createPageAction-7YROVZ3W.js → createPageAction-KVPT3IRK.js} +57 -47
  121. package/{db-6DPSJ6WT.js → db-3H3JECGY.js} +45 -5
  122. package/{dbSlice-BBL3PEVW.js → dbSlice-UI2VCBLG.js} +13 -12
  123. package/{deleteFile-RJTEPOT4.js → deleteFile-XQXPBFFB.js} +7 -6
  124. package/dialogCommands-6ASXJP3H.js +82 -0
  125. package/{dialogSlice-N4HPG6HM.js → dialogSlice-B7KCGHMY.js} +37 -29
  126. package/{docCreateCommands-GRA5BHSA.js → docCreateCommands-S4E4MKVC.js} +42 -56
  127. package/{docDeleteCommands-ONIJM5MD.js → docDeleteCommands-M7XLKWRM.js} +44 -58
  128. package/{docReadCommands-H55VQ2US.js → docReadCommands-LSCMW2FR.js} +42 -56
  129. package/{docStore-B5AHDNW5.js → docStore-ZYWZWIRB.js} +40 -30
  130. package/{docUpdateCommands-ZQIQVGC2.js → docUpdateCommands-OMRBAFOB.js} +45 -59
  131. package/{fetchMessages-VPPQDDZ4.js → fetchMessages-7QRCCRYK.js} +3 -3
  132. package/{getPricing-QO5TYNCK.js → getPricing-L2ENXWHV.js} +7 -6
  133. package/{handleSendMessageAction-IN5XX5U7.js → handleSendMessageAction-Y2XKODRT.js} +39 -31
  134. package/index.js +74 -74
  135. package/{lib-FYYBQIXS.js → lib-2ZTNRXR4.js} +432 -183
  136. package/{localDialogRead-3DBXVYXS.js → localDialogRead-SLMPV5SK.js} +2 -2
  137. package/{localRuntimeAuthority-NDUA2D7Y.js → localRuntimeAuthority-S77B5QVB.js} +10 -4
  138. package/{localRuntimeDb-GKYRBWLQ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
  139. package/{machineCommands-H3UMKE76.js → machineCommands-62RUZVSW.js} +95 -85
  140. package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
  141. package/machineWsRunDispatch-L3HD3FSF.js +129 -0
  142. package/{models-WDUTTYFS.js → models-OX2S5C6Q.js} +2 -2
  143. package/{offlineMarxistsAgentCommand-E6LUG63A.js → offlineMarxistsAgentCommand-GEH6SNNA.js} +1 -1
  144. package/package.json +1 -4
  145. package/{read-64OQDO3I.js → read-2VHEHCAN.js} +8 -7
  146. package/{readDocTool-MXM3T6PE.js → readDocTool-CSWD6NPC.js} +1 -2
  147. package/{readlineWorkspace-XVJZDCSC.js → readlineWorkspace-3MOJWFM7.js} +3358 -3409
  148. package/{removeDialogAgentAction-NEKVAMSH.js → removeDialogAgentAction-2T7BPM3T.js} +19 -17
  149. package/{runAgentClientLoop-H7U53QB6.js → runAgentClientLoop-Y5UW544I.js} +73 -64
  150. package/{runtimeDoctorCommands-WI2YZUSJ.js → runtimeDoctorCommands-KHGQKT3B.js} +6 -6
  151. package/{setDialogExtraReferencesAction-WTOHQDIV.js → setDialogExtraReferencesAction-GPT37HTW.js} +15 -14
  152. package/{setPrimaryDialogAgentAction-LDJOYC4F.js → setPrimaryDialogAgentAction-3746P7IW.js} +19 -17
  153. package/{settingSlice-4M37TN7V.js → settingSlice-FIFOQ6OR.js} +16 -14
  154. package/{skillDiscovery-5U6RYAHN.js → skillDiscovery-KLLKXPUO.js} +4 -4
  155. package/{slateUtils-2M7MUTWX.js → slateUtils-VO2FU36K.js} +1 -1
  156. package/{spaceCommands-7VVKJBDV.js → spaceCommands-NKSBD5G3.js} +45 -241
  157. package/{spaceSlice-T6YK6D34.js → spaceSlice-L44CI2QR.js} +39 -61
  158. package/{streamAgentChatTurn-RQ63QFQ7.js → streamAgentChatTurn-7DU4Z2VJ.js} +1262 -150
  159. package/{switchDialogAgentAction-XVWGKR2Z.js → switchDialogAgentAction-MQTUTQHL.js} +14 -13
  160. package/syncMapping-RK2MANUX.js +43 -0
  161. package/{tableCommands-RJZ3V4TF.js → tableCommands-64FZBAI3.js} +9 -8
  162. package/{toolApiClient-ARGFDJAG.js → toolApiClient-B2MFXMEG.js} +3 -3
  163. package/tools-2JI52WJP.js +99 -0
  164. package/{tuiSummaryLlmCaller-SRZ4QQUP.js → tuiSummaryLlmCaller-EAWQ3IZX.js} +25 -21
  165. package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
  166. package/{updateDialogTitleAction-BBDSWHNG.js → updateDialogTitleAction-HW33OIJI.js} +49 -38
  167. package/agentRecordCommands-JFZRQJQ4.js +0 -103
  168. package/agentRunCommand-NOX5FLKO.js +0 -121
  169. package/chunk-AYMOSAHE.js +0 -3158
  170. package/chunk-D2BPX6DQ.js +0 -1707
  171. package/chunk-DCDL3GC4.js +0 -171
  172. package/chunk-F3MP7CP6.js +0 -73
  173. package/chunk-WZSRQNQG.js +0 -2587
  174. package/createDialogAction-Y6YV64QB.js +0 -52
  175. package/dialogCommands-XLO5CAHZ.js +0 -95
  176. package/machineWsRunDispatch-HONRUK3R.js +0 -119
  177. package/tools-KYZX3BGO.js +0 -90
  178. package/{chunk-Z5MXSEOJ.js → chunk-RQSOAMPJ.js} +2 -2
  179. package/{chunk-JDSUTNYY.js → chunk-SAQQLJZ5.js} +3 -3
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  asOptionalFiniteNumber
3
3
  } from "./chunk-WWC7I6TA.js";
4
- import {
5
- asTrimmedString
6
- } from "./chunk-3EUW3WEO.js";
7
4
  import {
8
5
  asNonEmptyStringArray
9
6
  } from "./chunk-I42VC5KR.js";
7
+ import {
8
+ asTrimmedString
9
+ } from "./chunk-3EUW3WEO.js";
10
10
  import {
11
11
  asOptionalTrimmedString
12
12
  } from "./chunk-G3SUCT4W.js";
@@ -2393,6 +2393,29 @@ var require_rambda = __commonJS({
2393
2393
  }
2394
2394
  });
2395
2395
 
2396
+ // packages/create/types.ts
2397
+ var DataType = /* @__PURE__ */ ((DataType2) => {
2398
+ DataType2["AGENT"] = "agent";
2399
+ DataType2["DOC"] = "page";
2400
+ DataType2["DIALOG"] = "dialog";
2401
+ DataType2["NOTIFICATION"] = "notification";
2402
+ DataType2["MSG"] = "msg";
2403
+ DataType2["TOKEN"] = "token";
2404
+ DataType2["SPACE"] = "space";
2405
+ DataType2["TRANSACTION"] = "transaction";
2406
+ DataType2["SETTING"] = "setting";
2407
+ DataType2["TASK"] = "task";
2408
+ DataType2["AGENT_AUTOMATION"] = "agent-automation";
2409
+ DataType2["TABLE"] = "table";
2410
+ DataType2["TABLE_ROW"] = "table_row";
2411
+ DataType2["FILE"] = "file";
2412
+ DataType2["IMAGE"] = "image";
2413
+ DataType2["APP"] = "app";
2414
+ DataType2["EMAIL"] = "email";
2415
+ DataType2["Category"] = "category";
2416
+ return DataType2;
2417
+ })(DataType || {});
2418
+
2396
2419
  // packages/core/toTrimmedString.ts
2397
2420
  function toTrimmedString(value) {
2398
2421
  return typeof value === "string" ? value.trim() : value == null ? "" : String(value).trim();
@@ -3167,6 +3190,7 @@ var sanitizeShareData = (data) => {
3167
3190
  };
3168
3191
 
3169
3192
  export {
3193
+ DataType,
3170
3194
  ulid,
3171
3195
  toTrimmedString,
3172
3196
  toNonEmptyString,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dialogMessageRange
3
- } from "./chunk-WHLVPK32.js";
3
+ } from "./chunk-KMSZPTM6.js";
4
4
  import {
5
5
  isTombstoneRecord
6
6
  } from "./chunk-GBRG75BQ.js";
@@ -1,19 +1,107 @@
1
1
  import {
2
2
  i18n_default,
3
3
  toolRegistry
4
- } from "./chunk-MITD7CON.js";
4
+ } from "./chunk-MDIAECHA.js";
5
+ import {
6
+ canonicalizeToolNames
7
+ } from "./chunk-ZZ2MH7LE.js";
5
8
  import {
6
9
  isNoloHostedProvider
7
- } from "./chunk-CAENRKNJ.js";
10
+ } from "./chunk-OR2HNLVO.js";
8
11
  import {
9
12
  asTrimmedLowercaseString
10
13
  } from "./chunk-QSJ3HFEF.js";
11
14
  import {
12
15
  isRecord
13
16
  } from "./chunk-KUG52IAP.js";
14
- import {
15
- canonicalizeToolNames
16
- } from "./chunk-3AUWC6EM.js";
17
+
18
+ // packages/ai/chat/inlineImageUrlsForCustomProvider.ts
19
+ var FILE_CONTENT_PATH = "/api/v1/db/file/content/";
20
+ var shouldInlineImageUrlsForAgent = (agentConfig) => {
21
+ const apiSource = agentConfig?.apiSource?.toLowerCase();
22
+ const provider = agentConfig?.provider?.toLowerCase();
23
+ const model = agentConfig?.model?.toLowerCase();
24
+ if (apiSource === "custom" || provider === "custom") return true;
25
+ if (isNoloHostedProvider(provider)) return true;
26
+ return provider === "openrouter" && model === "minimax/minimax-m3";
27
+ };
28
+ var isInlineCandidate = (url) => /^https?:\/\//i.test(url) && url.includes(FILE_CONTENT_PATH);
29
+ var bytesToBase64 = (bytes) => {
30
+ let binary = "";
31
+ for (const byte of bytes) {
32
+ binary += String.fromCharCode(byte);
33
+ }
34
+ return btoa(binary);
35
+ };
36
+ var defaultFetchImage = async (url) => {
37
+ const response = await fetch(url);
38
+ if (!response.ok) {
39
+ return {
40
+ ok: false,
41
+ error: `HTTP ${response.status}`
42
+ };
43
+ }
44
+ const bytes = new Uint8Array(await response.arrayBuffer());
45
+ return {
46
+ ok: true,
47
+ mimeType: response.headers.get("content-type") ?? "application/octet-stream",
48
+ bytes
49
+ };
50
+ };
51
+ var cloneImagePartWithDataUrl = async (part, fetchImage, isAllowedImageUrl) => {
52
+ const url = part?.image_url?.url;
53
+ if (typeof url !== "string" || !isInlineCandidate(url) || isAllowedImageUrl && !isAllowedImageUrl(url)) {
54
+ return part;
55
+ }
56
+ const result = await fetchImage(url);
57
+ if (!result.ok || !result.bytes) return part;
58
+ const mimeType = result.mimeType || "application/octet-stream";
59
+ return {
60
+ ...part,
61
+ image_url: {
62
+ ...part.image_url,
63
+ url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}`
64
+ }
65
+ };
66
+ };
67
+ var inlineImageUrlsForCustomProvider = async (bodyData, options) => {
68
+ if (!options.shouldInline) return bodyData;
69
+ const body = bodyData;
70
+ if (!Array.isArray(body?.messages)) return bodyData;
71
+ const fetchImage = options.fetchImage ?? defaultFetchImage;
72
+ let changed = false;
73
+ const messages = [];
74
+ for (const message of body.messages) {
75
+ if (!Array.isArray(message?.content)) {
76
+ messages.push(message);
77
+ continue;
78
+ }
79
+ const content = await Promise.all(
80
+ message.content.map(async (part) => {
81
+ if (part?.type !== "image_url") return part;
82
+ return cloneImagePartWithDataUrl(
83
+ part,
84
+ fetchImage,
85
+ options.isAllowedImageUrl
86
+ );
87
+ })
88
+ );
89
+ let messageChanged = false;
90
+ for (let i = 0; i < content.length; i++) {
91
+ if (content[i] !== message.content[i]) {
92
+ changed = true;
93
+ messageChanged = true;
94
+ break;
95
+ }
96
+ }
97
+ messages.push(messageChanged ? { ...message, content } : message);
98
+ }
99
+ if (!changed) return bodyData;
100
+ return {
101
+ ...body,
102
+ messages
103
+ };
104
+ };
17
105
 
18
106
  // packages/ai/tools/toolSchemaCompatibility.ts
19
107
  var COMPOSITION_KEYS = ["anyOf", "oneOf", "allOf"];
@@ -178,96 +266,8 @@ var prepareTools = (toolNames, options) => {
178
266
  return prepared.slice();
179
267
  };
180
268
 
181
- // packages/ai/chat/inlineImageUrlsForCustomProvider.ts
182
- var FILE_CONTENT_PATH = "/api/v1/db/file/content/";
183
- var shouldInlineImageUrlsForAgent = (agentConfig) => {
184
- const apiSource = agentConfig?.apiSource?.toLowerCase();
185
- const provider = agentConfig?.provider?.toLowerCase();
186
- const model = agentConfig?.model?.toLowerCase();
187
- if (apiSource === "custom" || provider === "custom") return true;
188
- if (isNoloHostedProvider(provider)) return true;
189
- return provider === "openrouter" && model === "minimax/minimax-m3";
190
- };
191
- var isInlineCandidate = (url) => /^https?:\/\//i.test(url) && url.includes(FILE_CONTENT_PATH);
192
- var bytesToBase64 = (bytes) => {
193
- let binary = "";
194
- for (const byte of bytes) {
195
- binary += String.fromCharCode(byte);
196
- }
197
- return btoa(binary);
198
- };
199
- var defaultFetchImage = async (url) => {
200
- const response = await fetch(url);
201
- if (!response.ok) {
202
- return {
203
- ok: false,
204
- error: `HTTP ${response.status}`
205
- };
206
- }
207
- const bytes = new Uint8Array(await response.arrayBuffer());
208
- return {
209
- ok: true,
210
- mimeType: response.headers.get("content-type") ?? "application/octet-stream",
211
- bytes
212
- };
213
- };
214
- var cloneImagePartWithDataUrl = async (part, fetchImage, isAllowedImageUrl) => {
215
- const url = part?.image_url?.url;
216
- if (typeof url !== "string" || !isInlineCandidate(url) || isAllowedImageUrl && !isAllowedImageUrl(url)) {
217
- return part;
218
- }
219
- const result = await fetchImage(url);
220
- if (!result.ok || !result.bytes) return part;
221
- const mimeType = result.mimeType || "application/octet-stream";
222
- return {
223
- ...part,
224
- image_url: {
225
- ...part.image_url,
226
- url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}`
227
- }
228
- };
229
- };
230
- var inlineImageUrlsForCustomProvider = async (bodyData, options) => {
231
- if (!options.shouldInline) return bodyData;
232
- const body = bodyData;
233
- if (!Array.isArray(body?.messages)) return bodyData;
234
- const fetchImage = options.fetchImage ?? defaultFetchImage;
235
- let changed = false;
236
- const messages = [];
237
- for (const message of body.messages) {
238
- if (!Array.isArray(message?.content)) {
239
- messages.push(message);
240
- continue;
241
- }
242
- const content = await Promise.all(
243
- message.content.map(async (part) => {
244
- if (part?.type !== "image_url") return part;
245
- return cloneImagePartWithDataUrl(
246
- part,
247
- fetchImage,
248
- options.isAllowedImageUrl
249
- );
250
- })
251
- );
252
- let messageChanged = false;
253
- for (let i = 0; i < content.length; i++) {
254
- if (content[i] !== message.content[i]) {
255
- changed = true;
256
- messageChanged = true;
257
- break;
258
- }
259
- }
260
- messages.push(messageChanged ? { ...message, content } : message);
261
- }
262
- if (!changed) return bodyData;
263
- return {
264
- ...body,
265
- messages
266
- };
267
- };
268
-
269
269
  export {
270
- prepareTools,
271
270
  shouldInlineImageUrlsForAgent,
272
- inlineImageUrlsForCustomProvider
271
+ inlineImageUrlsForCustomProvider,
272
+ prepareTools
273
273
  };
@@ -7,11 +7,14 @@ import {
7
7
  listUserRecordsFromServers,
8
8
  readDbRecordFromServers,
9
9
  readLiveDbRecordAfterTombstoneMerge
10
- } from "./chunk-Q76I4SXI.js";
10
+ } from "./chunk-IHEC7VBF.js";
11
11
  import {
12
12
  buildDialogAttachmentPlan,
13
13
  extractFileContentIds
14
- } from "./chunk-3GZT3L6F.js";
14
+ } from "./chunk-EGRJC4ZN.js";
15
+ import {
16
+ isLevelLockError
17
+ } from "./chunk-URMS4XY2.js";
15
18
  import {
16
19
  toErrorMessage
17
20
  } from "./chunk-HNMXYYJR.js";
@@ -25,20 +28,23 @@ import {
25
28
  } from "./chunk-A7GB5UGH.js";
26
29
  import {
27
30
  parsePositiveFiniteNumberOrFallback
28
- } from "./chunk-G5GVZAXF.js";
31
+ } from "./chunk-Y5GCAMGP.js";
29
32
  import {
30
33
  asRecordOrEmpty
31
34
  } from "./chunk-KX6YBIHG.js";
35
+ import {
36
+ asNonEmptyStringArray,
37
+ asTrimmedNonEmptyStringArray
38
+ } from "./chunk-I42VC5KR.js";
39
+ import {
40
+ isLevelNotFoundError
41
+ } from "./chunk-OW765XBU.js";
32
42
  import {
33
43
  asTrimmedString
34
44
  } from "./chunk-3EUW3WEO.js";
35
45
  import {
36
46
  isRecord
37
47
  } from "./chunk-KUG52IAP.js";
38
- import {
39
- asNonEmptyStringArray,
40
- asTrimmedNonEmptyStringArray
41
- } from "./chunk-I42VC5KR.js";
42
48
  import {
43
49
  asOptionalTrimmedString
44
50
  } from "./chunk-G3SUCT4W.js";
@@ -534,14 +540,6 @@ function deriveToolErrors(toolMessages) {
534
540
  }
535
541
  return uniq(errors);
536
542
  }
537
- function isLocalBaseUrl(base) {
538
- try {
539
- const url = new URL(base);
540
- return url.hostname === "127.0.0.1" || url.hostname === "localhost";
541
- } catch {
542
- return false;
543
- }
544
- }
545
543
  async function readDialogOverHttp(args) {
546
544
  const authHeaders = {
547
545
  Authorization: `Bearer ${args.authToken}`,
@@ -625,7 +623,7 @@ async function tryHttpDialogCandidates(args) {
625
623
  throw Object.assign(new Error("All HTTP dialog reads failed"), { attempts });
626
624
  }
627
625
  async function readDialogFromLocalDb(dialogKey, dialogId, limit, readLocalDialog) {
628
- const reader = readLocalDialog ?? (await import("./localDialogRead-3DBXVYXS.js")).readDialogFromLocalDb;
626
+ const reader = readLocalDialog ?? (await import("./localDialogRead-SLMPV5SK.js")).readDialogFromLocalDb;
629
627
  const result = await reader({ dialogKey, dialogId, limit });
630
628
  return {
631
629
  ...result,
@@ -634,46 +632,39 @@ async function readDialogFromLocalDb(dialogKey, dialogId, limit, readLocalDialog
634
632
  }
635
633
  async function readDialogSnapshot(args) {
636
634
  const candidateBases = resolveServerCandidates({ NOLO_SERVER: args.base }, args.base);
637
- let attempts = [];
638
635
  try {
639
- const result = await tryHttpDialogCandidates({
640
- bases: candidateBases,
641
- dialogKey: args.dialogKey,
642
- dialogId: args.dialogId,
643
- limit: args.limit,
644
- authToken: args.authToken,
645
- fetchImpl: args.fetchImpl
646
- });
647
- return { ...result, candidateBases };
648
- } catch (error) {
649
- attempts = typeof error === "object" && error !== null && "attempts" in error ? error.attempts : attempts;
650
- const statuses = attempts.map((attempt) => attempt.status).filter((status) => typeof status === "number");
651
- const all404 = attempts.length > 0 && statuses.length === attempts.length && statuses.every((status) => status === 404);
652
- const localhostCandidate = candidateBases.find(isLocalBaseUrl);
653
- const remoteError = Object.assign(new Error(
654
- all404 ? `dialog not found on tried servers: ${candidateBases.join(", ")}` : `read dialog failed across candidates: ${attempts.map((attempt) => `${attempt.base} -> ${attempt.status ?? attempt.message}`).join("; ")}`
655
- ), { attempts });
656
- if (all404 || localhostCandidate) {
657
- try {
658
- const fallback = await readDialogFromLocalDb(
659
- args.dialogKey,
660
- args.dialogId,
661
- args.limit,
662
- args.readLocalDialog
663
- );
664
- return {
665
- ...fallback,
666
- // Keep the configured base stable for callers that render it; the
667
- // source field identifies that the payload came from local storage.
668
- resolvedBase: localhostCandidate ?? args.base,
669
- attempts,
670
- candidateBases
671
- };
672
- } catch {
673
- }
636
+ const local = await readDialogFromLocalDb(
637
+ args.dialogKey,
638
+ args.dialogId,
639
+ args.limit,
640
+ args.readLocalDialog
641
+ );
642
+ const localMeta = local.meta;
643
+ const localKey = localMeta && typeof localMeta === "object" ? String(localMeta.dbKey ?? localMeta.contentKey ?? "") : "";
644
+ if (!localMeta || localKey && localKey !== args.dialogKey) {
645
+ const miss = new Error("local dialog not found");
646
+ miss.code = "LEVEL_NOT_FOUND";
647
+ throw miss;
674
648
  }
675
- throw remoteError;
649
+ return {
650
+ ...local,
651
+ resolvedBase: args.base,
652
+ attempts: [],
653
+ candidateBases
654
+ };
655
+ } catch (error) {
656
+ const localDbUnavailable = isLevelLockError(error) || typeof error === "object" && error.code === "LEVEL_DATABASE_NOT_OPEN";
657
+ if (!isLevelNotFoundError(error) && !localDbUnavailable) throw error;
676
658
  }
659
+ const result = await tryHttpDialogCandidates({
660
+ bases: candidateBases,
661
+ dialogKey: args.dialogKey,
662
+ dialogId: args.dialogId,
663
+ limit: args.limit,
664
+ authToken: args.authToken,
665
+ fetchImpl: args.fetchImpl
666
+ });
667
+ return { ...result, candidateBases };
677
668
  }
678
669
  function compact(value, max = 180) {
679
670
  const text = asTrimmedString(value);
@@ -0,0 +1,193 @@
1
+ import {
2
+ API_VERSION
3
+ } from "./chunk-LCBAMY2M.js";
4
+
5
+ // packages/core/authRoutes.ts
6
+ var authRoutes = {
7
+ login: {
8
+ path: `${API_VERSION}/users/login`,
9
+ method: "POST",
10
+ createPath: () => `${API_VERSION}/users/login`
11
+ },
12
+ signup: {
13
+ path: `${API_VERSION}/users/signup`,
14
+ method: "POST",
15
+ createPath: () => `${API_VERSION}/users/signup`
16
+ },
17
+ users: {
18
+ cliLoginStart: {
19
+ path: `${API_VERSION}/users/cli-login/start`,
20
+ method: "POST",
21
+ createPath: () => `${API_VERSION}/users/cli-login/start`
22
+ },
23
+ cliLoginAuthorize: {
24
+ path: `${API_VERSION}/users/cli-login/authorize`,
25
+ method: "POST",
26
+ createPath: () => `${API_VERSION}/users/cli-login/authorize`
27
+ },
28
+ cliLoginPoll: {
29
+ path: `${API_VERSION}/users/cli-login/poll`,
30
+ method: "POST",
31
+ createPath: () => `${API_VERSION}/users/cli-login/poll`
32
+ },
33
+ list: {
34
+ path: `${API_VERSION}/users`,
35
+ method: "GET",
36
+ createPath: () => `${API_VERSION}/users`
37
+ },
38
+ usageReport: {
39
+ path: `${API_VERSION}/users/usage-report`,
40
+ method: "GET",
41
+ createPath: () => `${API_VERSION}/users/usage-report`
42
+ },
43
+ failureReport: {
44
+ path: `${API_VERSION}/users/failure-report`,
45
+ method: "GET",
46
+ createPath: () => `${API_VERSION}/users/failure-report`
47
+ },
48
+ growthReport: {
49
+ path: `${API_VERSION}/users/growth-report`,
50
+ method: "GET",
51
+ createPath: () => `${API_VERSION}/users/growth-report`
52
+ },
53
+ providerBillingHealth: {
54
+ path: `${API_VERSION}/users/provider-billing-health`,
55
+ method: "GET",
56
+ createPath: () => `${API_VERSION}/users/provider-billing-health`
57
+ },
58
+ providerBillingDrilldown: {
59
+ path: `${API_VERSION}/users/provider-billing-drilldown`,
60
+ method: "GET",
61
+ createPath: () => `${API_VERSION}/users/provider-billing-drilldown`
62
+ },
63
+ providerCredentials: {
64
+ path: `${API_VERSION}/users/provider-credentials`,
65
+ method: "GET",
66
+ createPath: () => `${API_VERSION}/users/provider-credentials`
67
+ },
68
+ providerCredentialLifecycle: {
69
+ path: `${API_VERSION}/users/provider-credentials/lifecycle`,
70
+ method: "POST",
71
+ createPath: () => `${API_VERSION}/users/provider-credentials/lifecycle`
72
+ },
73
+ billingAnomalyLifecycle: {
74
+ path: `${API_VERSION}/users/billing-anomalies/lifecycle`,
75
+ method: "POST",
76
+ createPath: () => `${API_VERSION}/users/billing-anomalies/lifecycle`
77
+ },
78
+ billingAnomalyDrilldown: {
79
+ path: `${API_VERSION}/users/billing-anomalies/drilldown`,
80
+ method: "GET",
81
+ createPath: () => `${API_VERSION}/users/billing-anomalies/drilldown`
82
+ },
83
+ billingAnomalyAudit: {
84
+ path: `${API_VERSION}/users/billing-anomalies/audit`,
85
+ method: "POST",
86
+ createPath: () => `${API_VERSION}/users/billing-anomalies/audit`
87
+ },
88
+ detail: {
89
+ path: `${API_VERSION}/users/:userId`,
90
+ method: "GET",
91
+ createPath: (params) => `${API_VERSION}/users/${params.userId}`
92
+ },
93
+ sessionRevoke: {
94
+ path: `${API_VERSION}/users/session-revoke`,
95
+ method: "POST",
96
+ createPath: () => `${API_VERSION}/users/session-revoke`
97
+ },
98
+ transfer: {
99
+ path: `${API_VERSION}/users/:userId/transfer`,
100
+ method: "POST",
101
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/transfer`
102
+ },
103
+ delete: {
104
+ path: `${API_VERSION}/users/:userId`,
105
+ method: "DELETE",
106
+ createPath: (params) => `${API_VERSION}/users/${params.userId}`
107
+ },
108
+ disable: {
109
+ path: `${API_VERSION}/users/:userId/disable`,
110
+ method: "POST",
111
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/disable`
112
+ },
113
+ enable: {
114
+ path: `${API_VERSION}/users/:userId/enable`,
115
+ method: "POST",
116
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/enable`
117
+ },
118
+ adminPermissions: {
119
+ path: `${API_VERSION}/users/:userId/admin-permissions`,
120
+ method: "POST",
121
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/admin-permissions`
122
+ },
123
+ sendEmail: {
124
+ path: `${API_VERSION}/users/send-email`,
125
+ method: "POST",
126
+ createPath: () => `${API_VERSION}/users/send-email`
127
+ },
128
+ spaceInvite: {
129
+ path: `${API_VERSION}/users/space-invite`,
130
+ method: "POST",
131
+ createPath: () => `${API_VERSION}/users/space-invite`
132
+ },
133
+ spaceInviteStatus: {
134
+ path: `${API_VERSION}/users/space-invite/status`,
135
+ method: "GET",
136
+ createPath: () => `${API_VERSION}/users/space-invite/status`
137
+ },
138
+ spaceInviteAccept: {
139
+ path: `${API_VERSION}/users/space-invite/accept`,
140
+ method: "POST",
141
+ createPath: () => `${API_VERSION}/users/space-invite/accept`
142
+ },
143
+ emailPreferencesGet: {
144
+ path: `${API_VERSION}/users/email-preferences`,
145
+ method: "GET",
146
+ createPath: () => `${API_VERSION}/users/email-preferences`
147
+ },
148
+ emailPreferencesUpdate: {
149
+ path: `${API_VERSION}/users/email-preferences`,
150
+ method: "POST",
151
+ createPath: () => `${API_VERSION}/users/email-preferences`
152
+ },
153
+ emailReport: {
154
+ path: `${API_VERSION}/users/email-report`,
155
+ method: "GET",
156
+ createPath: () => `${API_VERSION}/users/email-report`
157
+ },
158
+ emailRetryRun: {
159
+ path: `${API_VERSION}/users/email-retry/run`,
160
+ method: "POST",
161
+ createPath: () => `${API_VERSION}/users/email-retry/run`
162
+ },
163
+ emailReplayFailures: {
164
+ path: `${API_VERSION}/users/email-replay-failures`,
165
+ method: "POST",
166
+ createPath: () => `${API_VERSION}/users/email-replay-failures`
167
+ },
168
+ emailConfigGet: {
169
+ path: `${API_VERSION}/users/email-config`,
170
+ method: "GET",
171
+ createPath: () => `${API_VERSION}/users/email-config`
172
+ },
173
+ emailConfigUpdate: {
174
+ path: `${API_VERSION}/users/email-config`,
175
+ method: "POST",
176
+ createPath: () => `${API_VERSION}/users/email-config`
177
+ },
178
+ emailUnsubscribe: {
179
+ path: `${API_VERSION}/users/email-unsubscribe`,
180
+ method: "GET",
181
+ createPath: () => `${API_VERSION}/users/email-unsubscribe`
182
+ },
183
+ rechargeHistory: {
184
+ path: `${API_VERSION}/users/:userId/recharge-history`,
185
+ method: "POST",
186
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/recharge-history`
187
+ }
188
+ }
189
+ };
190
+
191
+ export {
192
+ authRoutes
193
+ };