nolo-cli 0.32.0 → 0.33.0-alpha.2

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 (170) hide show
  1. package/README.md +6 -12
  2. package/{_executeModel-LTMSIBS4.js → _executeModel-RWPVI3YV.js} +76 -67
  3. package/{action-HI3VRQLP.js → action-SMLG6OTB.js} +17 -15
  4. package/{addContentAction-NCURJ6PK.js → addContentAction-SFO244QN.js} +14 -13
  5. package/{addDialogAgentAction-RCY4ECF4.js → addDialogAgentAction-W44ZCEHB.js} +14 -13
  6. package/{agentDeleteCommand-D3MYZK6E.js → agentDeleteCommand-KU2RXQPP.js} +42 -59
  7. package/{agentEmailCommands-6BXS574I.js → agentEmailCommands-MPCMDENS.js} +89 -80
  8. package/{agentGrantCommands-E7ZZFRHK.js → agentGrantCommands-2LEZDADN.js} +2 -2
  9. package/{agentListCommands-SF3HEUTT.js → agentListCommands-EPD4N6FX.js} +73 -78
  10. package/{agentMachineCommands-YARVXRR6.js → agentMachineCommands-AF7C3YRT.js} +40 -57
  11. package/{agentPullCommand-ARSIDNVC.js → agentPullCommand-YH5GEBK4.js} +5 -5
  12. package/agentRecordCommands-EYE6MZZG.js +112 -0
  13. package/agentRunCommand-LL22SGTN.js +130 -0
  14. package/{agentRuntimeLocal-ATGJY6WC.js → agentRuntimeLocal-JX34G47Z.js} +35 -50
  15. package/{agentSlice-4XWW344Y.js → agentSlice-TNMFQQOV.js} +15 -13
  16. package/{appDeleteCommands-63JO7RXS.js → appDeleteCommands-43K5VXQB.js} +38 -55
  17. package/{appDeployCommands-Y7EWYUGM.js → appDeployCommands-FEEJSVDZ.js} +38 -55
  18. package/{appDeployStatusCommands-ZBEY3DWB.js → appDeployStatusCommands-H76CG45R.js} +38 -55
  19. package/{appGetCommands-QSSOSEYL.js → appGetCommands-MDZYFTYZ.js} +38 -55
  20. package/{appListCommands-PH3XWNDX.js → appListCommands-TUJJXPWG.js} +38 -55
  21. package/{authCommand-BBDHMSO6.js → authCommand-T7UK4CWS.js} +18 -18
  22. package/{authCommands-4UDEKRE6.js → authCommands-EAPFGNHN.js} +8 -8
  23. package/chatQueueReduxAdapter-LVQXC4ZY.js +180 -0
  24. package/chunk-2H3XIBY4.js +239 -0
  25. package/{chunk-TEYN42N3.js → chunk-2IVEXF7P.js} +11 -4
  26. package/{chunk-WTGCTVJG.js → chunk-2QTEYCR7.js} +3 -6
  27. package/{chunk-DOISARTV.js → chunk-2UECQ7RE.js} +1 -1
  28. package/{chunk-SWYMCHM7.js → chunk-37V5LNEQ.js} +69 -1
  29. package/{chunk-E3APEOIM.js → chunk-3GZXL6FM.js} +4 -19
  30. package/{chunk-O3JR45Q2.js → chunk-3VAQHAXT.js} +44 -44
  31. package/{chunk-O5OMJPPF.js → chunk-3WXRAHCG.js} +6 -5
  32. package/{chunk-LAXMH7JY.js → chunk-57QJXIB6.js} +18 -15
  33. package/chunk-5CS33IBL.js +301 -0
  34. package/{chunk-3UGKATZQ.js → chunk-5SBK2MTI.js} +8 -369
  35. package/chunk-6PO2SYCS.js +1800 -0
  36. package/{chunk-TA6EA2A3.js → chunk-6SXC35F4.js} +182 -20
  37. package/{chunk-MXFQHRSS.js → chunk-6XIE5ZGI.js} +1 -1
  38. package/{chunk-3GZT3L6F.js → chunk-73GINUCW.js} +326 -481
  39. package/{chunk-VMWR7VNI.js → chunk-7E72JMBB.js} +7 -7
  40. package/{chunk-4PNU7W7K.js → chunk-AAGCMVFT.js} +106 -124
  41. package/chunk-ADLYMQB6.js +642 -0
  42. package/{chunk-ZWJOGMKH.js → chunk-AETZ7AD6.js} +1 -1
  43. package/{chunk-UDA3ZYLW.js → chunk-AFV4FOT2.js} +70 -24
  44. package/{chunk-BGTUGS3T.js → chunk-AOXVOC6D.js} +4 -30
  45. package/{chunk-2ZRP5RUG.js → chunk-B2BSG6QQ.js} +12 -11
  46. package/{chunk-44HACRCK.js → chunk-BANYWEYY.js} +4 -4
  47. package/{chunk-TOW4E763.js → chunk-BJIRLHJR.js} +2 -0
  48. package/{chunk-ZJ2WITOO.js → chunk-BQXOGBFN.js} +2 -2
  49. package/{chunk-G5GVZAXF.js → chunk-CLP2K7U4.js} +15 -19
  50. package/{chunk-2K4NDPT5.js → chunk-DFUPZE6V.js} +20 -12
  51. package/{chunk-YHGHADBQ.js → chunk-DPMBNHOJ.js} +4 -4
  52. package/chunk-EGRJC4ZN.js +91 -0
  53. package/{chunk-K6QEHQZ3.js → chunk-EKLRRZIN.js} +1 -1
  54. package/{chunk-XFG3BAKN.js → chunk-FMEVI5TG.js} +65 -0
  55. package/{chunk-RH53LMEJ.js → chunk-FSSX3XRY.js} +2 -4
  56. package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
  57. package/{chunk-EEF23OOK.js → chunk-GMXWYXAF.js} +7 -7
  58. package/{chunk-SFWZUTCI.js → chunk-GTYM4HKV.js} +1 -1
  59. package/{chunk-MITD7CON.js → chunk-HDKRSRYU.js} +1461 -301
  60. package/chunk-HS7MLR74.js +38 -0
  61. package/{chunk-3AUWC6EM.js → chunk-HUCT7HID.js} +5 -84
  62. package/{chunk-PTHDLIRB.js → chunk-I6N2UVVY.js} +1 -1
  63. package/chunk-IDAU4UFS.js +437 -0
  64. package/{chunk-Q76I4SXI.js → chunk-IHEC7VBF.js} +1 -1
  65. package/{chunk-OWHNFZNW.js → chunk-IL545V3E.js} +4 -4
  66. package/{chunk-3LY4F7SV.js → chunk-INZZJSQF.js} +348 -331
  67. package/{chunk-CF2WZF4N.js → chunk-J6WH4PYZ.js} +0 -8
  68. package/{chunk-2HXKAPH7.js → chunk-JMPYDFHY.js} +6 -6
  69. package/{chunk-V54H24CQ.js → chunk-JTSGWTYZ.js} +3 -3
  70. package/{chunk-ATK5WJOA.js → chunk-JZ5AMMXU.js} +4 -4
  71. package/chunk-KHCLMKZZ.js +3062 -0
  72. package/{chunk-WHLVPK32.js → chunk-KMSZPTM6.js} +27 -3
  73. package/{chunk-L3GCUVOH.js → chunk-KSRFVP36.js} +1 -1
  74. package/{chunk-DLWCWUNW.js → chunk-LOD75GOS.js} +336 -32
  75. package/{chunk-UOJRKY5J.js → chunk-M2YMQOLC.js} +44 -53
  76. package/chunk-M3JEW6N6.js +193 -0
  77. package/{chunk-XDHHF73Q.js → chunk-M4NC7NF6.js} +95 -95
  78. package/{chunk-3FCNXC2J.js → chunk-MPZJVZDC.js} +3735 -1394
  79. package/{chunk-IXZX5CJK.js → chunk-MQRZ5QUH.js} +1 -1
  80. package/{chunk-3ASDTTEI.js → chunk-MRWGHF56.js} +2 -0
  81. package/{chunk-D34RI6NI.js → chunk-NNWHHCVP.js} +75 -1
  82. package/{chunk-6YABCOFU.js → chunk-NUO3QFWD.js} +1 -1
  83. package/{chunk-GAF5X6B7.js → chunk-O6GEBMIY.js} +269 -309
  84. package/{chunk-CAENRKNJ.js → chunk-OR2HNLVO.js} +126 -88
  85. package/chunk-OW765XBU.js +10 -0
  86. package/chunk-PREQU5QV.js +231 -0
  87. package/{chunk-Q3CSL43H.js → chunk-Q5ITEGIN.js} +1 -1
  88. package/{chunk-7S54ZGF6.js → chunk-RAZOLMJR.js} +256 -12
  89. package/chunk-RCFIB45Q.js +28 -0
  90. package/chunk-RY57GLGW.js +188 -0
  91. package/{chunk-KGEVMUMI.js → chunk-TFPUAELY.js} +11 -11
  92. package/{chunk-ZJH3LKEW.js → chunk-UK5JGQVU.js} +94 -15
  93. package/chunk-URMS4XY2.js +10 -0
  94. package/{chunk-RXVX5LFR.js → chunk-VH2F7ZB6.js} +1 -1
  95. package/chunk-VIDPVFP3.js +20 -0
  96. package/{chunk-W367V5CH.js → chunk-WHD6BG7M.js} +400 -115
  97. package/{chunk-5RDLGLAP.js → chunk-WJSW43QZ.js} +4 -7
  98. package/{chunk-CF7S2RYZ.js → chunk-WLH5BAKX.js} +6 -6
  99. package/{chunk-VVEH6XUE.js → chunk-X2DAEZ3X.js} +1 -1
  100. package/{chunk-2IJAKBK2.js → chunk-X664KVEV.js} +426 -246
  101. package/{chunk-43EPBPZ2.js → chunk-XCCGU6QB.js} +2 -2
  102. package/chunk-Y5GCAMGP.js +9 -0
  103. package/{chunk-V42OE5HT.js → chunk-YDTYDA5W.js} +3 -3
  104. package/chunk-YYLHWIW6.js +48 -0
  105. package/{chunk-AOS5IN2I.js → chunk-ZHYK3N56.js} +1 -1
  106. package/{chunk-ODS2MVMU.js → chunk-ZJMME4DS.js} +19 -303
  107. package/{chunk-PJ2DDQQM.js → chunk-ZURFOV5J.js} +2 -2
  108. package/chunk-ZZ2MH7LE.js +84 -0
  109. package/{cliExecutor-BBUVQU4L.js → cliExecutor-DW3PHGEL.js} +2 -2
  110. package/{clipboardy-BVE3LVEH.js → clipboardy-MMBYVRLF.js} +166 -372
  111. package/{codingSkills-V35TRR4Y.js → codingSkills-DY5MINPG.js} +5 -4
  112. package/{createAgentAutomationAction-WLRNE7C4.js → createAgentAutomationAction-INQT23LX.js} +40 -31
  113. package/createDialogAction-LDCPDI73.js +60 -0
  114. package/{createPageAction-7YROVZ3W.js → createPageAction-5YXOG2M4.js} +56 -47
  115. package/{db-6DPSJ6WT.js → db-3H3JECGY.js} +45 -5
  116. package/{dbSlice-BBL3PEVW.js → dbSlice-3SD5L5H2.js} +13 -12
  117. package/{deleteFile-RJTEPOT4.js → deleteFile-XQXPBFFB.js} +7 -6
  118. package/dialogCommands-CHJO47AX.js +81 -0
  119. package/{dialogSlice-N4HPG6HM.js → dialogSlice-DOWKOILN.js} +36 -29
  120. package/{docCreateCommands-GRA5BHSA.js → docCreateCommands-OVZARUFX.js} +40 -55
  121. package/{docDeleteCommands-ONIJM5MD.js → docDeleteCommands-E2XJ62LD.js} +42 -57
  122. package/{docReadCommands-H55VQ2US.js → docReadCommands-I7OSREPJ.js} +40 -55
  123. package/{docStore-B5AHDNW5.js → docStore-UAWSKZ2Y.js} +39 -30
  124. package/{docUpdateCommands-ZQIQVGC2.js → docUpdateCommands-X4Z26VJM.js} +43 -58
  125. package/{fetchMessages-VPPQDDZ4.js → fetchMessages-7QRCCRYK.js} +3 -3
  126. package/{getPricing-QO5TYNCK.js → getPricing-L2ENXWHV.js} +7 -6
  127. package/{handleSendMessageAction-IN5XX5U7.js → handleSendMessageAction-C3TSDWKH.js} +38 -31
  128. package/index.js +67 -67
  129. package/{lib-FYYBQIXS.js → lib-2ZTNRXR4.js} +432 -183
  130. package/{localDialogRead-3DBXVYXS.js → localDialogRead-SLMPV5SK.js} +2 -2
  131. package/{localRuntimeAuthority-NDUA2D7Y.js → localRuntimeAuthority-E3R24J4T.js} +4 -2
  132. package/{localRuntimeDb-GKYRBWLQ.js → localRuntimeDb-DDZCJFQZ.js} +1 -1
  133. package/{machineCommands-H3UMKE76.js → machineCommands-BUOIYJAD.js} +93 -84
  134. package/{machineWsRunDispatch-HONRUK3R.js → machineWsRunDispatch-7CRWAA6O.js} +83 -74
  135. package/{models-WDUTTYFS.js → models-OX2S5C6Q.js} +2 -2
  136. package/{offlineMarxistsAgentCommand-E6LUG63A.js → offlineMarxistsAgentCommand-GEH6SNNA.js} +1 -1
  137. package/package.json +1 -4
  138. package/{read-64OQDO3I.js → read-6G73BMEY.js} +8 -7
  139. package/{readDocTool-MXM3T6PE.js → readDocTool-DK4EI2GA.js} +1 -2
  140. package/{readlineWorkspace-XVJZDCSC.js → readlineWorkspace-ZDWEASJV.js} +265 -428
  141. package/{removeDialogAgentAction-NEKVAMSH.js → removeDialogAgentAction-E7H557UO.js} +19 -17
  142. package/{runAgentClientLoop-H7U53QB6.js → runAgentClientLoop-U7HYA3O5.js} +72 -64
  143. package/{runtimeDoctorCommands-WI2YZUSJ.js → runtimeDoctorCommands-KIKM6BIO.js} +5 -5
  144. package/{setDialogExtraReferencesAction-WTOHQDIV.js → setDialogExtraReferencesAction-RMMGBR5F.js} +15 -14
  145. package/{setPrimaryDialogAgentAction-LDJOYC4F.js → setPrimaryDialogAgentAction-FWBKKLVA.js} +19 -17
  146. package/{settingSlice-4M37TN7V.js → settingSlice-73PV4KG4.js} +16 -14
  147. package/{skillDiscovery-5U6RYAHN.js → skillDiscovery-KLLKXPUO.js} +4 -4
  148. package/{slateUtils-2M7MUTWX.js → slateUtils-VO2FU36K.js} +1 -1
  149. package/{spaceCommands-7VVKJBDV.js → spaceCommands-GEWZXGHM.js} +43 -240
  150. package/{spaceSlice-T6YK6D34.js → spaceSlice-B6MOVY4N.js} +38 -61
  151. package/{streamAgentChatTurn-RQ63QFQ7.js → streamAgentChatTurn-T527EQTT.js} +1261 -150
  152. package/{switchDialogAgentAction-XVWGKR2Z.js → switchDialogAgentAction-US6QNL3N.js} +14 -13
  153. package/syncMapping-RK2MANUX.js +43 -0
  154. package/{tableCommands-RJZ3V4TF.js → tableCommands-QE47K72R.js} +8 -7
  155. package/{toolApiClient-ARGFDJAG.js → toolApiClient-B2MFXMEG.js} +3 -3
  156. package/tools-XMWCVMPM.js +98 -0
  157. package/{tuiSummaryLlmCaller-SRZ4QQUP.js → tuiSummaryLlmCaller-NCAJSVSD.js} +24 -21
  158. package/{updateDialogTitleAction-BBDSWHNG.js → updateDialogTitleAction-XPJZRJEL.js} +48 -38
  159. package/agentRecordCommands-JFZRQJQ4.js +0 -103
  160. package/agentRunCommand-NOX5FLKO.js +0 -121
  161. package/chunk-AYMOSAHE.js +0 -3158
  162. package/chunk-D2BPX6DQ.js +0 -1707
  163. package/chunk-DCDL3GC4.js +0 -171
  164. package/chunk-F3MP7CP6.js +0 -73
  165. package/chunk-WZSRQNQG.js +0 -2587
  166. package/createDialogAction-Y6YV64QB.js +0 -52
  167. package/dialogCommands-XLO5CAHZ.js +0 -95
  168. package/tools-KYZX3BGO.js +0 -90
  169. package/{chunk-Z5MXSEOJ.js → chunk-RQSOAMPJ.js} +2 -2
  170. package/{chunk-JDSUTNYY.js → chunk-SAQQLJZ5.js} +3 -3
@@ -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
+ };
@@ -1,19 +1,107 @@
1
1
  import {
2
2
  i18n_default,
3
3
  toolRegistry
4
- } from "./chunk-MITD7CON.js";
4
+ } from "./chunk-HDKRSRYU.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
  };