nolo-cli 0.107.0-alpha.4 → 0.107.1

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 (211) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-UDCSOTD2.js → _executeModel-M573MKVE.js} +78 -70
  3. package/action-GVA5ARSJ.js +20 -0
  4. package/{addContentAction-MB2HHMDZ.js → addContentAction-M2WOWZCL.js} +13 -12
  5. package/{addDialogAgentAction-MCEABSBA.js → addDialogAgentAction-QMAQ5Z6N.js} +19 -20
  6. package/{agentDeleteCommand-OWYHN6D6.js → agentDeleteCommand-ZFHYRHBS.js} +118 -43
  7. package/{agentEmailCommands-AU5I4M4W.js → agentEmailCommands-X6AVPIVQ.js} +100 -90
  8. package/agentListCommands-PAD2CI2I.js +741 -0
  9. package/{agentMachineCommands-YMNME2L6.js → agentMachineCommands-UPH6RJCC.js} +50 -46
  10. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-CMVTBY5X.js} +97 -2
  11. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
  12. package/agentRecordCommands-UMACPRAF.js +138 -0
  13. package/agentRunCommand-H6KKHHMU.js +167 -0
  14. package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
  15. package/{agentRuntimeLocal-KCMC2TBD.js → agentRuntimeLocal-N4YGKL7M.js} +44 -40
  16. package/{agentSlice-R7PR6KYM.js → agentSlice-2LPP43XH.js} +15 -14
  17. package/{appDeleteCommands-JEPA3EWE.js → appDeleteCommands-7DAF33AM.js} +46 -42
  18. package/{appDeployCommands-UTB76XFM.js → appDeployCommands-ZPZSMFGZ.js} +46 -42
  19. package/{appDeployStatusCommands-LGHF2SBD.js → appDeployStatusCommands-FWBDSSS5.js} +46 -42
  20. package/{appGetCommands-PX2BFHOB.js → appGetCommands-SZZOHGEP.js} +46 -42
  21. package/{appListCommands-BSMPTWKC.js → appListCommands-FPMUBDPM.js} +46 -42
  22. package/{authCommand-YW42YZA4.js → authCommand-VL3G26NQ.js} +119 -25
  23. package/{authCommands-RGOGCPP6.js → authCommands-5RTUDYZW.js} +7 -5
  24. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-ZK4K67Y5.js} +11 -9
  25. package/{chromeCommands-FZYAU75D.js → chromeCommands-AU5ZJXBG.js} +289 -37
  26. package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-ZYTCMNHG.js} +156 -22
  27. package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
  28. package/{chunk-HVURBGF3.js → chunk-2U3NHADM.js} +6 -6
  29. package/{chunk-QTGQ2LTL.js → chunk-3DQY5IFB.js} +6 -10
  30. package/{chunk-XT35TTFG.js → chunk-3IXAHOJS.js} +19 -21
  31. package/{chunk-UVA7OYO3.js → chunk-3W67RV75.js} +29 -9
  32. package/chunk-4LCOCOR5.js +50 -0
  33. package/{chunk-JPGCXHNM.js → chunk-4LKMZ3RR.js} +1 -1
  34. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  35. package/{chunk-6D6VBVEW.js → chunk-4W24JM32.js} +80 -14
  36. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  37. package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
  38. package/{chunk-C3M4465B.js → chunk-5HYJ3DSZ.js} +404 -659
  39. package/chunk-5MMAK75Q.js +15 -0
  40. package/{chunk-7S4YWN7P.js → chunk-5UUIGN6I.js} +4 -4
  41. package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
  42. package/{chunk-4MK3I7Y4.js → chunk-6MAW4XOF.js} +5 -5
  43. package/{chunk-3UZPUAES.js → chunk-74PPKIY2.js} +1 -1
  44. package/chunk-76HO2DP6.js +15 -0
  45. package/{chunk-ASIFZ2WY.js → chunk-7BBP7ZX3.js} +66 -54
  46. package/{chunk-VLTIYV3X.js → chunk-7I25CBT5.js} +34 -8
  47. package/{chunk-IBOZNTG2.js → chunk-7X5XZ34C.js} +23 -28
  48. package/chunk-AGIM7IMJ.js +147 -0
  49. package/{chunk-5UTFL4QJ.js → chunk-APO5TOXO.js} +1 -1
  50. package/{chunk-EEGDMATE.js → chunk-AZOVPTL6.js} +91 -81
  51. package/{chunk-6OZ36FXI.js → chunk-BIPGGSJS.js} +22 -4
  52. package/{chunk-EYAQT56M.js → chunk-BNQMNUKZ.js} +9 -6
  53. package/{chunk-62CATUYY.js → chunk-CBUMFIFE.js} +834 -962
  54. package/{chunk-OIVSQH2O.js → chunk-CDEEFJXN.js} +308 -11
  55. package/chunk-CHOZJMJS.js +78 -0
  56. package/{chunk-ETI2NYVF.js → chunk-CIP3AAMT.js} +4 -4
  57. package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
  58. package/{chunk-W7HLWAQ7.js → chunk-DE45KZNH.js} +118 -90
  59. package/{chunk-Q554LLSI.js → chunk-DMXLXZKL.js} +1 -1
  60. package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
  61. package/{chunk-HKNXJGEC.js → chunk-ECFHBYUW.js} +85 -50
  62. package/{chunk-ACTMNVHM.js → chunk-EHSYSKXV.js} +1 -1
  63. package/{chunk-WV42OMV7.js → chunk-ELUDRSRD.js} +8 -8
  64. package/{chunk-ABQYVJBJ.js → chunk-EV235ILT.js} +5 -5
  65. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  66. package/{chunk-BFDFRLLQ.js → chunk-EZ4VZHAG.js} +5 -5
  67. package/{chunk-GO3Z72MT.js → chunk-FHLMQIU7.js} +65 -95
  68. package/{chunk-2F7RJC6L.js → chunk-FOXQ7BAB.js} +1 -1
  69. package/{chunk-SH43IESU.js → chunk-GGC55Q32.js} +199 -29
  70. package/chunk-GMZLP5DV.js +82 -0
  71. package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
  72. package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
  73. package/{chunk-QOKAKDPE.js → chunk-HIM3FCLF.js} +0 -1
  74. package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
  75. package/{chunk-BNGW5ASC.js → chunk-I2RGRVQ7.js} +22 -2
  76. package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
  77. package/{chunk-QDSINZM3.js → chunk-IXH3HKY2.js} +1 -22
  78. package/{chunk-GQBOR3G6.js → chunk-JBKHQOYK.js} +8 -4
  79. package/{chunk-XD2MJFUG.js → chunk-JEFXP73H.js} +1 -1
  80. package/{chunk-PBA4UJBK.js → chunk-JIXGJTBU.js} +4 -4
  81. package/{chunk-AEOE4Z6Q.js → chunk-K6L5PNXK.js} +39 -15
  82. package/{chunk-Z77CRGTW.js → chunk-KA5O5KQL.js} +1 -1
  83. package/{chunk-GPCZ7UXG.js → chunk-KD6D6BLA.js} +1 -1
  84. package/{chunk-4CR5I7BD.js → chunk-KFWDYYSS.js} +47 -67
  85. package/{chunk-UZGQNTVW.js → chunk-KHKTDMYG.js} +8 -6
  86. package/{chunk-JDPFV2JV.js → chunk-KWUKOQM2.js} +20 -11
  87. package/{chunk-MRIHM22T.js → chunk-LBFL6RZG.js} +58 -9
  88. package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
  89. package/{chunk-DHDMC6FO.js → chunk-LUBFABMJ.js} +15 -14
  90. package/{chunk-NA35QHCF.js → chunk-LVBFKW65.js} +1 -1
  91. package/chunk-LWLNLZC5.js +265 -0
  92. package/chunk-N4NGJDT6.js +929 -0
  93. package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
  94. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  95. package/chunk-NWENLDMM.js +42 -0
  96. package/chunk-O7SVKKLY.js +875 -0
  97. package/chunk-OCZKATRC.js +129 -0
  98. package/{chunk-6Z7MY3V7.js → chunk-OEJLGVBL.js} +5 -5
  99. package/{chunk-VMFTFOWF.js → chunk-OKGVNZTL.js} +35 -8
  100. package/{chunk-GEPUP7OO.js → chunk-OR2UWD6X.js} +3 -3
  101. package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
  102. package/{chunk-J4MOO56S.js → chunk-PNXHPLRU.js} +10 -2
  103. package/{chunk-3BMYXEUW.js → chunk-R5AJODNI.js} +1 -1
  104. package/{chunk-P5EVSOPA.js → chunk-R6EBQEQE.js} +22 -29
  105. package/chunk-RQ6CTX2E.js +164 -0
  106. package/{chunk-MS7TSPZR.js → chunk-RU36ZYSG.js} +19 -17
  107. package/{chunk-ALXHV7NK.js → chunk-RWXLPUKI.js} +40 -4
  108. package/{chunk-KQ4ONNQD.js → chunk-RXA3HAVW.js} +190 -8
  109. package/{chunk-IIVGDG4I.js → chunk-SJKULPGX.js} +13 -7
  110. package/{chunk-Q67DOFOO.js → chunk-SZC4REES.js} +212 -105
  111. package/{chunk-JRQFUXY7.js → chunk-TBAXFWOS.js} +99 -22
  112. package/{chunk-PQFHGD77.js → chunk-TBM2RS3U.js} +161 -14
  113. package/{chunk-NOF3HDSN.js → chunk-TFOIJFCM.js} +11 -9
  114. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  115. package/chunk-TY3TIUJK.js +89 -0
  116. package/{chunk-I3TQJXQ7.js → chunk-U3C3IA32.js} +9 -2
  117. package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
  118. package/chunk-UM7TA3K4.js +1008 -0
  119. package/{chunk-6YTOJY35.js → chunk-VBG7GWWR.js} +253 -8
  120. package/{chunk-GL3EHUR4.js → chunk-VHGYUYQ3.js} +69 -47
  121. package/chunk-VIWDGTDA.js +8 -0
  122. package/chunk-VJVNU77E.js +83 -0
  123. package/chunk-VM6IE2GN.js +8004 -0
  124. package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
  125. package/chunk-VZLO4XJD.js +17 -0
  126. package/chunk-W32HPLTL.js +13692 -0
  127. package/{chunk-AHAHBQMU.js → chunk-WDLSZMTA.js} +2 -2
  128. package/{chunk-53HEEOTT.js → chunk-WF5X57VW.js} +83 -16
  129. package/{chunk-VRTTFDBM.js → chunk-WPHY3VPF.js} +35 -22
  130. package/{chunk-3L2WKC3W.js → chunk-XPWGOTBQ.js} +8 -1
  131. package/chunk-YV25TM3R.js +780 -0
  132. package/chunk-ZRAU6T47.js +56 -0
  133. package/{chunk-IBOOZVVD.js → chunk-ZTKZZY2A.js} +851 -279
  134. package/commandRegistry-ASW6IVZ3.js +833 -0
  135. package/{contentThunks-IV2T3EJC.js → contentThunks-4XNVOIR7.js} +39 -36
  136. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
  137. package/{createAgentAutomationAction-JCOIEYY4.js → createAgentAutomationAction-NHHTCJMC.js} +40 -37
  138. package/createDialogAction-XEBTHDB3.js +70 -0
  139. package/{createPageAction-D2VOOLP3.js → createPageAction-VR3WW2AQ.js} +47 -43
  140. package/{chunk-FG3HKPQP.js → cursorProvider-YGGNMVWX.js} +2751 -10185
  141. package/{dbSlice-A6C6H32X.js → dbSlice-TG4MZ5EB.js} +12 -11
  142. package/{deleteFile-YG6QMJLU.js → deleteFile-KESP65GC.js} +7 -6
  143. package/{dialogCommands-H7FPUYUQ.js → dialogCommands-FJWQG3MX.js} +50 -47
  144. package/{dialogSlice-6JZOOTDS.js → dialogSlice-GVRDGCRG.js} +57 -37
  145. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  146. package/{docCreateCommands-WRG2JLGM.js → docCreateCommands-AZSK4NAG.js} +48 -44
  147. package/{docDeleteCommands-SHWJIBJS.js → docDeleteCommands-DDJMSMFZ.js} +49 -45
  148. package/{docReadCommands-WJN3WT6O.js → docReadCommands-5F5Q6EBZ.js} +47 -43
  149. package/{docStore-HUPQ2FSS.js → docStore-SUZUUWDI.js} +17 -13
  150. package/{docUpdateCommands-IE32IL6O.js → docUpdateCommands-XPNPVZOC.js} +48 -44
  151. package/{fetchMessages-EIU7UFFK.js → fetchMessages-3PXAHKCR.js} +5 -5
  152. package/{getPricing-LUSEABA6.js → getPricing-DOBBZLOK.js} +4 -4
  153. package/{handleSendMessageAction-DFPMQ7YM.js → handleSendMessageAction-VC6VTFKS.js} +109 -42
  154. package/index.js +87 -884
  155. package/{lib-FRRS27KN.js → lib-PU2G2MSO.js} +523 -191
  156. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-UYCKO7YZ.js} +2 -2
  157. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-TU6OBC76.js} +9 -6
  158. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-VKWVOPPI.js} +1 -1
  159. package/{machineCommands-M2T2I5NF.js → machineCommands-M634V2L3.js} +98 -89
  160. package/machineWsRunDispatch-Z3HUSTFI.js +154 -0
  161. package/{memberThunks-P2ECUJ56.js → memberThunks-5S5D3N4U.js} +20 -18
  162. package/{models-T3SG6MJ5.js → models-PQU25T6Q.js} +2 -2
  163. package/oauthTokenStore-ITEB663N.js +23 -0
  164. package/package.json +1 -1
  165. package/processSpawn-SOAV3FEV.js +11 -0
  166. package/profileConfig-ZGOFORWV.js +43 -0
  167. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-HAQWVAQX.js} +7 -7
  168. package/{providerRegistry-757OWH3O.js → providerRegistry-5FGWB3X5.js} +11 -7
  169. package/{read-COE3ZYR6.js → read-LSYFLSIM.js} +8 -7
  170. package/{readDocTool-5USN4A6V.js → readDocTool-XWRXV3DR.js} +5 -3
  171. package/{readlineWorkspace-XQRDGWRZ.js → readlineWorkspace-J3YD3DNW.js} +2596 -2032
  172. package/{removeDialogAgentAction-J6X5QMTA.js → removeDialogAgentAction-4TEFC3VL.js} +22 -26
  173. package/{runAgentClientLoop-5ZA62FBA.js → runAgentClientLoop-APSMCLAF.js} +79 -72
  174. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
  175. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  176. package/{setDialogExtraReferencesAction-WX5VTY6O.js → setDialogExtraReferencesAction-LSEN44OY.js} +16 -14
  177. package/{setPrimaryDialogAgentAction-FN22THHT.js → setPrimaryDialogAgentAction-SR366X5A.js} +23 -27
  178. package/{chunk-GP5LKBUZ.js → settingThunks-CTVPPGIN.js} +226 -940
  179. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
  180. package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
  181. package/{spaceCommands-5GLCWZPO.js → spaceCommands-3UK63WPE.js} +51 -47
  182. package/{streamAgentChatTurn-6UZJMYRB.js → streamAgentChatTurn-DNY2PSRW.js} +215 -115
  183. package/{switchDialogAgentAction-LVTEV3FR.js → switchDialogAgentAction-M6NAFOOU.js} +19 -20
  184. package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
  185. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-AD7CXTA4.js} +4 -3
  186. package/tools-X5UWATZK.js +117 -0
  187. package/{tuiSummaryLlmCaller-OHHFTHMG.js → tuiSummaryLlmCaller-DEH7ZEM6.js} +25 -23
  188. package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
  189. package/{updateDialogTitleAction-QTKNIURB.js → updateDialogTitleAction-YSY5BF5A.js} +84 -45
  190. package/action-P4TNFGAD.js +0 -31
  191. package/agentListCommands-B2V4YAC4.js +0 -410
  192. package/agentRecordCommands-G4KK4R7H.js +0 -128
  193. package/agentRunCommand-UTZJA23G.js +0 -156
  194. package/browser-image-compression-MFDTD7K6.js +0 -1763
  195. package/chatQueueReduxAdapter-2P6NFX64.js +0 -186
  196. package/chunk-CQ3WA2NE.js +0 -299
  197. package/chunk-M76ECQRD.js +0 -13658
  198. package/chunk-MEYIRKDN.js +0 -8967
  199. package/chunk-PUOC4YRO.js +0 -394
  200. package/chunk-Q5FJJ6XI.js +0 -103
  201. package/chunk-S7Z2HMCN.js +0 -25
  202. package/chunk-T75QD6AB.js +0 -20923
  203. package/chunk-Y5GCAMGP.js +0 -9
  204. package/chunk-YPREESF4.js +0 -225
  205. package/createDialogAction-NGG7YVNU.js +0 -65
  206. package/machineWsRunDispatch-ISBKOOD7.js +0 -144
  207. package/settingSlice-P4ZW7K5X.js +0 -204
  208. package/syncMapping-N6RGXGBW.js +0 -437
  209. package/tools-KMGFWO43.js +0 -110
  210. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  211. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
@@ -0,0 +1,15 @@
1
+ import {
2
+ compactWhitespace
3
+ } from "./chunk-DWLEOOGR.js";
4
+
5
+ // packages/core/clipCompactText.ts
6
+ function clipCompactText(value, max, ellipsis = "...") {
7
+ const compact = compactWhitespace(value);
8
+ if (compact.length <= max) return compact;
9
+ if (max <= ellipsis.length) return compact.slice(0, max);
10
+ return `${compact.slice(0, max - ellipsis.length)}${ellipsis}`;
11
+ }
12
+
13
+ export {
14
+ clipCompactText
15
+ };
@@ -1,12 +1,12 @@
1
- import {
2
- dialogMessageRange
3
- } from "./chunk-VMFTFOWF.js";
4
1
  import {
5
2
  isTombstoneRecord
6
- } from "./chunk-GBRG75BQ.js";
3
+ } from "./chunk-D2MDMY2M.js";
7
4
  import {
8
5
  isRecord
9
6
  } from "./chunk-KUG52IAP.js";
7
+ import {
8
+ dialogMessageRange
9
+ } from "./chunk-OKGVNZTL.js";
10
10
 
11
11
  // packages/chat/messages/fetchMessages.ts
12
12
  function isUnboundedMessageLimit(limit) {
@@ -1,8 +1,9 @@
1
1
  import {
2
- mergeAvailabilityDeadline
3
- } from "./chunk-FDTR4QJ6.js";
2
+ mergeAvailabilityDeadline,
3
+ resolveCredentialKeyWithFallback
4
+ } from "./chunk-H6A6X4EK.js";
4
5
 
5
- // packages/cli/credentialAvailability.ts
6
+ // packages/agent-runtime/credentialAvailability.ts
6
7
  import { homedir } from "node:os";
7
8
  import { join } from "node:path";
8
9
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
@@ -13,36 +14,6 @@ function resolveNoloHome(env = process.env) {
13
14
  function resolveCredentialAvailabilityPath(env = process.env) {
14
15
  return join(resolveNoloHome(env), FILE_NAME);
15
16
  }
16
- function resolveCredentialKey(agent) {
17
- if (!agent || typeof agent !== "object") return void 0;
18
- for (const field of ["apiKeyRef", "credentialRef"]) {
19
- const value = agent[field];
20
- if (typeof value === "string") {
21
- const trimmed = value.trim();
22
- if (trimmed) return trimmed;
23
- }
24
- }
25
- return void 0;
26
- }
27
- function resolveCredentialKeyWithFallback(agent) {
28
- const byRef = resolveCredentialKey(agent);
29
- if (byRef) return byRef;
30
- if (!agent || typeof agent !== "object") return void 0;
31
- const endpoint = agent.customProviderUrl;
32
- if (typeof endpoint === "string") {
33
- const trimmed = endpoint.trim();
34
- if (trimmed) {
35
- try {
36
- const origin = new URL(trimmed).origin;
37
- if (origin && origin !== "null") return `custom-endpoint:${origin}`;
38
- } catch {
39
- }
40
- }
41
- }
42
- const key = agent.key;
43
- if (typeof key === "string" && key.trim()) return `custom-agent:${key.trim()}`;
44
- return void 0;
45
- }
46
17
  function parseFile(raw) {
47
18
  const parsed = JSON.parse(raw);
48
19
  if (!parsed || typeof parsed !== "object") return { entries: {} };
@@ -155,7 +126,6 @@ function applyCredentialAvailability(agents, credentialAvailability) {
155
126
  }
156
127
 
157
128
  export {
158
- resolveCredentialKeyWithFallback,
159
129
  readCredentialAvailability,
160
130
  readCredentialEntry,
161
131
  markCredentialUnavailable,
@@ -3,20 +3,20 @@ import {
3
3
  } from "./chunk-5ZUL4CUO.js";
4
4
  import {
5
5
  getModelContextWindow
6
- } from "./chunk-HKNXJGEC.js";
6
+ } from "./chunk-ECFHBYUW.js";
7
7
  import {
8
8
  findModelConfig,
9
9
  getProviderByModelName
10
- } from "./chunk-OIVSQH2O.js";
11
- import {
12
- asOptionalFiniteNumber
13
- } from "./chunk-WWC7I6TA.js";
10
+ } from "./chunk-CDEEFJXN.js";
14
11
  import {
15
12
  asTrimmedLowercaseString
16
13
  } from "./chunk-QSJ3HFEF.js";
17
14
  import {
18
15
  isRecord
19
16
  } from "./chunk-KUG52IAP.js";
17
+ import {
18
+ asOptionalFiniteNumber
19
+ } from "./chunk-WWC7I6TA.js";
20
20
  import {
21
21
  asTrimmedString
22
22
  } from "./chunk-3EUW3WEO.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-GL3EHUR4.js";
4
+ } from "./chunk-VHGYUYQ3.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -0,0 +1,15 @@
1
+ import {
2
+ BUILTIN_NOLO_AGENT_KEY
3
+ } from "./chunk-I2RGRVQ7.js";
4
+
5
+ // packages/core/init.ts
6
+ var nolotusId = "0e95801d90";
7
+ var ADMIN_IDS = /* @__PURE__ */ new Set([nolotusId]);
8
+ var isSystemAdmin = (userId) => userId != null && ADMIN_IDS.has(userId);
9
+ var noloAgentId = BUILTIN_NOLO_AGENT_KEY;
10
+
11
+ export {
12
+ nolotusId,
13
+ isSystemAdmin,
14
+ noloAgentId
15
+ };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-C3M4465B.js";
3
+ } from "./chunk-5HYJ3DSZ.js";
4
4
  import {
5
- i18n_default
6
- } from "./chunk-T75QD6AB.js";
5
+ runtime_default
6
+ } from "./chunk-W32HPLTL.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
- } from "./chunk-O6OSWFZQ.js";
9
+ } from "./chunk-IHPDK6UD.js";
10
10
  import {
11
11
  isNoloHostedProvider
12
- } from "./chunk-Q67DOFOO.js";
12
+ } from "./chunk-SZC4REES.js";
13
13
  import {
14
14
  asTrimmedLowercaseString
15
15
  } from "./chunk-QSJ3HFEF.js";
@@ -18,6 +18,8 @@ import {
18
18
  } from "./chunk-KUG52IAP.js";
19
19
 
20
20
  // packages/ai/chat/inlineImageUrlsForCustomProvider.ts
21
+ var INLINE_IMAGE_MAX_BYTES = 5 * 1024 * 1024;
22
+ var INLINE_IMAGE_TOTAL_MAX_BYTES = 20 * 1024 * 1024;
21
23
  var FILE_CONTENT_PATH = "/api/v1/db/file/content/";
22
24
  var shouldInlineImageUrlsForAgent = (agentConfig) => {
23
25
  const apiSource = agentConfig?.apiSource?.toLowerCase();
@@ -29,14 +31,14 @@ var shouldInlineImageUrlsForAgent = (agentConfig) => {
29
31
  };
30
32
  var isInlineCandidate = (url) => /^https?:\/\//i.test(url) && url.includes(FILE_CONTENT_PATH);
31
33
  var bytesToBase64 = (bytes) => {
32
- let binary = "";
33
- for (const byte of bytes) {
34
- binary += String.fromCharCode(byte);
34
+ const chunks = [];
35
+ for (let offset = 0; offset < bytes.length; offset += 32768) {
36
+ chunks.push(String.fromCharCode.apply(null, Array.from(bytes.subarray(offset, offset + 32768))));
35
37
  }
36
- return btoa(binary);
38
+ return btoa(chunks.join(""));
37
39
  };
38
- var defaultFetchImage = async (url) => {
39
- const response = await fetch(url);
40
+ var defaultFetchImage = async (url, signal, _maxBytes) => {
41
+ const response = await fetch(url, { signal });
40
42
  if (!response.ok) {
41
43
  return {
42
44
  ok: false,
@@ -50,59 +52,69 @@ var defaultFetchImage = async (url) => {
50
52
  bytes
51
53
  };
52
54
  };
53
- var cloneImagePartWithDataUrl = async (part, fetchImage, isAllowedImageUrl) => {
55
+ var cloneImagePartWithDataUrl = async (part, fetchImage, options, usedBytes) => {
54
56
  const url = part?.image_url?.url;
55
- if (typeof url !== "string" || !isInlineCandidate(url) || isAllowedImageUrl && !isAllowedImageUrl(url)) {
57
+ if (typeof url !== "string" || !isInlineCandidate(url) || options.isAllowedImageUrl && !options.isAllowedImageUrl(url)) return part;
58
+ if (options.signal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
59
+ const remaining = options.maxTotalBytes === void 0 ? void 0 : options.maxTotalBytes - usedBytes.value;
60
+ const fetchLimit = options.maxBytes === void 0 ? remaining : remaining === void 0 ? options.maxBytes : Math.min(options.maxBytes, remaining);
61
+ const result = await fetchImage(url, options.signal, fetchLimit);
62
+ if (options.signal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
63
+ if (result.skippedSize !== void 0) {
64
+ const reason = options.maxBytes !== void 0 && result.skippedSize > options.maxBytes ? "per-image" : "total-budget";
65
+ options.onSkipTooLarge?.(url, result.skippedSize, reason);
56
66
  return part;
57
67
  }
58
- const result = await fetchImage(url);
59
68
  if (!result.ok || !result.bytes) return part;
60
- const mimeType = result.mimeType || "application/octet-stream";
61
- return {
62
- ...part,
63
- image_url: {
64
- ...part.image_url,
65
- url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}`
66
- }
67
- };
69
+ if (options.maxBytes !== void 0 && result.bytes.byteLength > options.maxBytes) {
70
+ options.onSkipTooLarge?.(url, result.bytes.byteLength, "per-image");
71
+ return part;
72
+ }
73
+ if (options.maxTotalBytes !== void 0 && usedBytes.value + result.bytes.byteLength > options.maxTotalBytes) {
74
+ options.onSkipTooLarge?.(url, result.bytes.byteLength, "total-budget");
75
+ return part;
76
+ }
77
+ usedBytes.value += result.bytes.byteLength;
78
+ const mimeType = (result.mimeType || "application/octet-stream").split(";")[0].trim() || "application/octet-stream";
79
+ return { ...part, image_url: { ...part.image_url, url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}` } };
68
80
  };
69
81
  var inlineImageUrlsForCustomProvider = async (bodyData, options) => {
70
82
  if (!options.shouldInline) return bodyData;
71
83
  const body = bodyData;
72
84
  if (!Array.isArray(body?.messages)) return bodyData;
73
85
  const fetchImage = options.fetchImage ?? defaultFetchImage;
74
- let changed = false;
75
- const messages = [];
76
- for (const message of body.messages) {
77
- if (!Array.isArray(message?.content)) {
78
- messages.push(message);
79
- continue;
86
+ const fetched = /* @__PURE__ */ new Map();
87
+ const fetchOnce = (url, signal, maxBytes) => {
88
+ let result = fetched.get(url);
89
+ if (!result) {
90
+ result = fetchImage(url, signal, maxBytes);
91
+ fetched.set(url, result);
80
92
  }
81
- const content = await Promise.all(
82
- message.content.map(async (part) => {
83
- if (part?.type !== "image_url") return part;
84
- return cloneImagePartWithDataUrl(
85
- part,
86
- fetchImage,
87
- options.isAllowedImageUrl
88
- );
89
- })
90
- );
91
- let messageChanged = false;
92
- for (let i = 0; i < content.length; i++) {
93
- if (content[i] !== message.content[i]) {
93
+ return result;
94
+ };
95
+ const usedBytes = { value: 0 };
96
+ let changed = false;
97
+ const messages = [...body.messages];
98
+ for (let mi = messages.length - 1; mi >= 0; mi--) {
99
+ const message = messages[mi];
100
+ if (!Array.isArray(message?.content)) continue;
101
+ const content = [...message.content];
102
+ for (let pi = content.length - 1; pi >= 0; pi--) {
103
+ const part = content[pi];
104
+ if (part?.type !== "image_url") continue;
105
+ if (options.maxTotalBytes !== void 0 && usedBytes.value >= options.maxTotalBytes) {
106
+ if (typeof part?.image_url?.url === "string" && isInlineCandidate(part.image_url.url)) options.onSkipTooLarge?.(part.image_url.url, void 0, "total-budget");
107
+ continue;
108
+ }
109
+ const cloned = await cloneImagePartWithDataUrl(part, fetchOnce, options, usedBytes);
110
+ if (cloned !== part) {
111
+ content[pi] = cloned;
94
112
  changed = true;
95
- messageChanged = true;
96
- break;
97
113
  }
98
114
  }
99
- messages.push(messageChanged ? { ...message, content } : message);
115
+ if (content.some((part, index) => part !== message.content[index])) messages[mi] = { ...message, content };
100
116
  }
101
- if (!changed) return bodyData;
102
- return {
103
- ...body,
104
- messages
105
- };
117
+ return changed ? { ...body, messages } : bodyData;
106
118
  };
107
119
 
108
120
  // packages/ai/tools/toolSchemaCompatibility.ts
@@ -151,12 +163,12 @@ var PREPARE_TOOLS_CACHE_LIMIT = 128;
151
163
  var warnedUnknownToolNames = /* @__PURE__ */ new Set();
152
164
  function getTranslation(keys, defaultVal) {
153
165
  for (const key of keys) {
154
- if (i18n_default.exists(key)) {
155
- return i18n_default.t(key);
166
+ if (runtime_default.exists(key)) {
167
+ return runtime_default.t(key);
156
168
  }
157
169
  const aiKey = key.startsWith("ai:") ? key : `ai:${key}`;
158
- if (i18n_default.exists(aiKey)) {
159
- return i18n_default.t(aiKey);
170
+ if (runtime_default.exists(aiKey)) {
171
+ return runtime_default.t(aiKey);
160
172
  }
161
173
  }
162
174
  return defaultVal;
@@ -203,7 +215,7 @@ function translateSchema(schema) {
203
215
  return nextSchema;
204
216
  }
205
217
  function currentI18nLanguage() {
206
- return typeof i18n_default.language === "string" ? i18n_default.language : "";
218
+ return typeof runtime_default.language === "string" ? runtime_default.language : "";
207
219
  }
208
220
  function translateSchemaCached(schema) {
209
221
  if (!schema || typeof schema !== "object") return schema;
@@ -1,6 +1,9 @@
1
+ import {
2
+ normalizeMediaConfirmExecutionRevision
3
+ } from "./chunk-VZLO4XJD.js";
1
4
  import {
2
5
  getActiveDialogKey
3
- } from "./chunk-6YTOJY35.js";
6
+ } from "./chunk-VBG7GWWR.js";
4
7
  import {
5
8
  compactWhitespace
6
9
  } from "./chunk-DWLEOOGR.js";
@@ -10,12 +13,12 @@ import {
10
13
  import {
11
14
  extractCustomId
12
15
  } from "./chunk-M2EJHDJP.js";
13
- import {
14
- selectIdentityToken
15
- } from "./chunk-SEJ5OS6F.js";
16
16
  import {
17
17
  isRecord
18
18
  } from "./chunk-KUG52IAP.js";
19
+ import {
20
+ selectIdentityToken
21
+ } from "./chunk-SEJ5OS6F.js";
19
22
 
20
23
  // packages/ai/tools/toolApiClient.ts
21
24
  var MAIN_SERVER = "https://nolo.chat";
@@ -115,18 +118,31 @@ var ToolApiError = class extends Error {
115
118
  status;
116
119
  code;
117
120
  details;
121
+ upperCredits;
122
+ /**
123
+ * 服务端在本次 409 里下发的执行代次(扁平 error.executionRevision,旧形状兼容
124
+ * error.details.executionRevision)。只转述服务端本次的值,绝不另行 GET 补齐。
125
+ * 真值判据复用 normalizeMediaConfirmExecutionRevision(缺失/非法一律缺席,不造值)。
126
+ */
127
+ executionRevision;
118
128
  constructor(message, options) {
119
129
  super(message);
120
130
  this.name = "ToolApiError";
121
131
  this.status = options?.status;
122
132
  this.code = options?.code;
123
133
  this.details = options?.details;
134
+ this.upperCredits = options?.upperCredits;
135
+ this.executionRevision = normalizeMediaConfirmExecutionRevision(
136
+ options?.executionRevision
137
+ );
124
138
  }
125
139
  };
126
140
  var buildToolRequestHeaders = (thunkApi, options = {}) => {
127
141
  const { withAuth = false, agentKey } = options;
128
142
  const { token } = getRequestConfig(thunkApi);
129
- const headers = { "Content-Type": "application/json" };
143
+ const headers = {
144
+ "Content-Type": "application/json"
145
+ };
130
146
  if (withAuth && token) {
131
147
  headers["Authorization"] = `Bearer ${token}`;
132
148
  }
@@ -150,10 +166,12 @@ async function callToolApi(thunkApi, path, body, options = {}) {
150
166
  if (!baseUrl) throw new Error("\u65E0\u6CD5\u83B7\u53D6\u5DE5\u5177\u670D\u52A1\u5668\u5730\u5740\u3002");
151
167
  const url = `${baseUrl}${path}`;
152
168
  const headers = buildToolRequestHeaders(thunkApi, options);
169
+ const method = options.method ?? "POST";
153
170
  const response = await fetch(url, {
154
- method: "POST",
171
+ method,
155
172
  headers,
156
- body: JSON.stringify(maybeAttachDialogId(thunkApi, body))
173
+ ...options.signal ? { signal: options.signal } : {},
174
+ ...method === "GET" ? {} : { body: JSON.stringify(maybeAttachDialogId(thunkApi, body)) }
157
175
  });
158
176
  const contentType = response.headers.get("content-type");
159
177
  const responseText = await response.text();
@@ -161,6 +179,8 @@ async function callToolApi(thunkApi, path, body, options = {}) {
161
179
  let errorMessage = `API \u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801: ${response.status}`;
162
180
  let errorCode;
163
181
  let errorDetails;
182
+ let upperCredits;
183
+ let errorExecutionRevision;
164
184
  try {
165
185
  const errorData = JSON.parse(responseText);
166
186
  const err = errorData?.error;
@@ -168,6 +188,10 @@ async function callToolApi(thunkApi, path, body, options = {}) {
168
188
  errorMessage += `: ${err.message ?? JSON.stringify(err)}`;
169
189
  errorCode = typeof err.code === "string" ? err.code : void 0;
170
190
  errorDetails = err.details;
191
+ if (typeof err.upperCredits === "number") {
192
+ upperCredits = err.upperCredits;
193
+ }
194
+ errorExecutionRevision = err.executionRevision ?? err.details?.executionRevision;
171
195
  }
172
196
  } catch {
173
197
  errorCode = looksLikeHtmlResponse(responseText, contentType) ? "HTML_ERROR_RESPONSE" : "NON_JSON_ERROR_RESPONSE";
@@ -182,7 +206,9 @@ async function callToolApi(thunkApi, path, body, options = {}) {
182
206
  throw new ToolApiError(errorMessage, {
183
207
  status: response.status,
184
208
  code: errorCode,
185
- details: errorDetails
209
+ details: errorDetails,
210
+ upperCredits,
211
+ executionRevision: errorExecutionRevision
186
212
  });
187
213
  }
188
214
  try {
@@ -1,28 +1,35 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-4CR5I7BD.js";
3
+ } from "./chunk-KFWDYYSS.js";
4
4
  import {
5
+ format,
5
6
  prepareAndPersistMessage,
6
7
  uiAskChoiceFunc,
7
8
  uiAskChoiceFunctionSchema
8
- } from "./chunk-T75QD6AB.js";
9
+ } from "./chunk-W32HPLTL.js";
9
10
  import {
10
- require_date_fns
11
- } from "./chunk-M76ECQRD.js";
11
+ formatISO
12
+ } from "./chunk-ZRAU6T47.js";
12
13
  import {
13
14
  buildBuiltinObjectSkillReference
14
- } from "./chunk-DHDMC6FO.js";
15
- import {
16
- PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
17
- PLATFORM_HOSTED_KIMI_PROVIDER
18
- } from "./chunk-Q67DOFOO.js";
15
+ } from "./chunk-LUBFABMJ.js";
19
16
  import {
20
17
  read,
21
18
  readAndWait,
22
19
  removeCachedEntity,
23
20
  upsertSSREntity,
24
21
  write
25
- } from "./chunk-VRTTFDBM.js";
22
+ } from "./chunk-WPHY3VPF.js";
23
+ import {
24
+ PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
25
+ PLATFORM_HOSTED_KIMI_PROVIDER
26
+ } from "./chunk-SZC4REES.js";
27
+ import {
28
+ extractCustomId
29
+ } from "./chunk-M2EJHDJP.js";
30
+ import {
31
+ isRecord
32
+ } from "./chunk-KUG52IAP.js";
26
33
  import {
27
34
  createAgentKey,
28
35
  createDialogKey,
@@ -30,34 +37,22 @@ import {
30
37
  dialogMessageRange,
31
38
  memoryOwnerRange,
32
39
  memorySubjectKindRange
33
- } from "./chunk-VMFTFOWF.js";
34
- import {
35
- extractCustomId
36
- } from "./chunk-M2EJHDJP.js";
40
+ } from "./chunk-OKGVNZTL.js";
37
41
  import {
38
42
  isDevelopment
39
- } from "./chunk-QOKAKDPE.js";
43
+ } from "./chunk-HIM3FCLF.js";
40
44
  import {
41
45
  selectIdentityUserId
42
46
  } from "./chunk-SEJ5OS6F.js";
43
47
  import {
44
- isRecord
45
- } from "./chunk-KUG52IAP.js";
48
+ asOptionalPositiveFiniteNumber
49
+ } from "./chunk-U6VC4MU4.js";
46
50
  import {
47
51
  asTrimmedString
48
52
  } from "./chunk-3EUW3WEO.js";
49
- import {
50
- asOptionalPositiveFiniteNumber
51
- } from "./chunk-U6VC4MU4.js";
52
53
  import {
53
54
  asOptionalTrimmedString
54
55
  } from "./chunk-G3SUCT4W.js";
55
- import {
56
- __toESM
57
- } from "./chunk-4VNS5WPM.js";
58
-
59
- // packages/chat/dialog/actions/createDialogAction.ts
60
- var import_date_fns = __toESM(require_date_fns());
61
56
 
62
57
  // packages/chat/dialog/objectAssistantRegistry.ts
63
58
  var OBJECT_ASSISTANT_TO_SKILL = {
@@ -811,7 +806,7 @@ var createDialogAction = async (args, thunkApi) => {
811
806
  preview: recentRelationshipRecapResolution.recap ?? null
812
807
  });
813
808
  }
814
- const time = (0, import_date_fns.format)(/* @__PURE__ */ new Date(), "MM-dd HH:mm");
809
+ const time = format(/* @__PURE__ */ new Date(), "MM-dd HH:mm");
815
810
  const title = titleOverride || (agentMode === "auto" ? "\u65B0\u5BF9\u8BDD" : agentConfig?.name || "Agent") + " " + time;
816
811
  const spaceId = explicitSpaceId;
817
812
  const dialogPath = createDialogKey(userId);
@@ -853,7 +848,7 @@ var createDialogAction = async (args, thunkApi) => {
853
848
  ...agentMode === "auto" && autoRoute ? { autoRoute } : {},
854
849
  title,
855
850
  type: "dialog" /* DIALOG */,
856
- createdAt: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date()),
851
+ createdAt: formatISO(/* @__PURE__ */ new Date()),
857
852
  ...spaceId && { spaceId },
858
853
  category,
859
854
  referenceKeys,
@@ -0,0 +1,147 @@
1
+ // packages/create/editor/utils/slateUtils.ts
2
+ var slateNodeToString = (node) => {
3
+ if (typeof node?.text === "string") return node.text;
4
+ const children = Array.isArray(node?.children) ? node.children : [];
5
+ return children.map(slateNodeToString).join("");
6
+ };
7
+ var createEmptyParagraph = () => ({
8
+ type: "paragraph",
9
+ children: [{ text: "" }]
10
+ });
11
+ var ensureEditorContent = (slateData) => Array.isArray(slateData) && slateData.length > 0 ? slateData : [createEmptyParagraph()];
12
+ var deepEqual = (a, b) => {
13
+ if (a === b) return true;
14
+ if (a == null || b == null) return false;
15
+ if (typeof a !== "object" || typeof b !== "object") return false;
16
+ const isArrayA = Array.isArray(a);
17
+ const isArrayB = Array.isArray(b);
18
+ if (isArrayA || isArrayB) {
19
+ if (!isArrayA || !isArrayB) return false;
20
+ if (a.length !== b.length) return false;
21
+ for (let i = 0; i < a.length; i++) {
22
+ if (!deepEqual(a[i], b[i])) return false;
23
+ }
24
+ return true;
25
+ }
26
+ const keysA = Object.keys(a);
27
+ const keysB = Object.keys(b);
28
+ if (keysA.length !== keysB.length) return false;
29
+ for (const key of keysA) {
30
+ if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
31
+ if (!deepEqual(a[key], b[key])) return false;
32
+ }
33
+ return true;
34
+ };
35
+ var compareSlateContent = (newContent, oldContent) => {
36
+ if (newContent === oldContent) return false;
37
+ if (!newContent || !oldContent) return true;
38
+ if (newContent.length !== oldContent.length) return true;
39
+ return !deepEqual(newContent, oldContent);
40
+ };
41
+ var extractTitleFromSlate = (slateData) => {
42
+ if (!Array.isArray(slateData) || slateData.length === 0) return "\u65B0\u9875\u9762";
43
+ const titleNode = slateData.find((node) => node.type === "heading-one");
44
+ if (titleNode) {
45
+ const text = slateNodeToString(titleNode).trim();
46
+ if (text) {
47
+ return text;
48
+ }
49
+ }
50
+ for (const node of slateData) {
51
+ const text = slateNodeToString(node).trim();
52
+ if (text) {
53
+ return text.length > 30 ? `${text.substring(0, 30)}...` : text;
54
+ }
55
+ }
56
+ return "\u65B0\u9875\u9762";
57
+ };
58
+ var splitSlateTitleAndBody = (slateData, explicitTitle) => {
59
+ const content = ensureEditorContent(slateData);
60
+ const firstNode = content[0];
61
+ const hasExplicitTitle = explicitTitle !== void 0 && explicitTitle !== null;
62
+ const normalizedExplicitTitle = hasExplicitTitle ? explicitTitle.trim() : null;
63
+ const firstNonEmptyText = content.map((node) => slateNodeToString(node).trim()).find(Boolean);
64
+ if (firstNode?.type === "heading-one") {
65
+ const firstText = slateNodeToString(firstNode).trim();
66
+ const shouldTreatAsTitle = !!firstText && (normalizedExplicitTitle == null || normalizedExplicitTitle === firstText);
67
+ if (shouldTreatAsTitle) {
68
+ const body = content.slice(1);
69
+ return {
70
+ title: firstText,
71
+ body: ensureEditorContent(body)
72
+ };
73
+ }
74
+ }
75
+ return {
76
+ title: normalizedExplicitTitle ?? (firstNonEmptyText || ""),
77
+ body: content
78
+ };
79
+ };
80
+ var extractMentionsFromSlate = (slateData) => {
81
+ const tools = /* @__PURE__ */ new Set();
82
+ const traverse = (nodes) => {
83
+ for (const node of nodes) {
84
+ if (node.type === "mention" && node.resourceId) {
85
+ if (node.resourceType === "tool") {
86
+ tools.add(node.resourceId);
87
+ }
88
+ }
89
+ if (node.children && Array.isArray(node.children)) {
90
+ traverse(node.children);
91
+ }
92
+ }
93
+ };
94
+ if (Array.isArray(slateData)) {
95
+ traverse(slateData);
96
+ }
97
+ return Array.from(tools);
98
+ };
99
+ var extractCategorizedMentions = (slateData) => {
100
+ const result = {
101
+ tools: [],
102
+ pages: [],
103
+ agents: [],
104
+ spaces: []
105
+ };
106
+ const traverse = (nodes) => {
107
+ for (const node of nodes) {
108
+ if (node.type === "mention" && node.resourceId && node.resourceType) {
109
+ switch (node.resourceType) {
110
+ case "tool":
111
+ result.tools.push(node.resourceId);
112
+ break;
113
+ case "page":
114
+ result.pages.push(node.resourceId);
115
+ break;
116
+ case "agent":
117
+ result.agents.push(node.resourceId);
118
+ break;
119
+ case "space":
120
+ result.spaces.push(node.resourceId);
121
+ break;
122
+ }
123
+ }
124
+ if (node.children && Array.isArray(node.children)) {
125
+ traverse(node.children);
126
+ }
127
+ }
128
+ };
129
+ if (Array.isArray(slateData)) {
130
+ traverse(slateData);
131
+ }
132
+ result.tools = [...new Set(result.tools)];
133
+ result.pages = [...new Set(result.pages)];
134
+ result.agents = [...new Set(result.agents)];
135
+ result.spaces = [...new Set(result.spaces)];
136
+ return result;
137
+ };
138
+
139
+ export {
140
+ createEmptyParagraph,
141
+ ensureEditorContent,
142
+ compareSlateContent,
143
+ extractTitleFromSlate,
144
+ splitSlateTitleAndBody,
145
+ extractMentionsFromSlate,
146
+ extractCategorizedMentions
147
+ };