nolo-cli 0.259.0-alpha.1 → 0.260.0-alpha.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 (316) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-MTM4BJK3.js → _executeModel-EO6JFCOF.js} +97 -83
  3. package/accountResolver-NGICIMEE.js +1 -1
  4. package/{action-C6IQAKN4.js → action-WIA56QT4.js} +12 -10
  5. package/{addContentAction-53364YDW.js → addContentAction-OCMWZLYG.js} +14 -13
  6. package/{addDialogAgentAction-U5DD5EN5.js → addDialogAgentAction-ER2NZ7BC.js} +20 -24
  7. package/{agentDeleteCommand-53NN3VSK.js → agentDeleteCommand-KSXSNPAU.js} +184 -146
  8. package/{agentEmailCommands-KOGGIT6I.js → agentEmailCommands-NXRWS7NS.js} +142 -126
  9. package/{agentGrantCommands-L6O2HVJI.js → agentGrantCommands-D2S7LCTU.js} +8 -5
  10. package/{agentListCommands-62UYUQDI.js → agentListCommands-PFXGZZ3Y.js} +87 -68
  11. package/{agentMachineCommands-W6TNJXEA.js → agentMachineCommands-2Q55CSL4.js} +68 -59
  12. package/{agentProviderCommands-QLTABYR7.js → agentProviderCommands-EUNS7Y2Z.js} +10 -7
  13. package/{agentPullCommand-2EYJ5ENC.js → agentPullCommand-S2VMPSWL.js} +9 -6
  14. package/agentRecordCommands-FUFI526H.js +210 -0
  15. package/agentRun-ZNMUPDHF.js +250 -0
  16. package/agentRunCommand-ISVQ2UYC.js +248 -0
  17. package/{agentRunControl-LXMADX3N.js → agentRunControl-NEK44LDM.js} +19 -12
  18. package/{agentRuntimeLocal-YGNJMQW3.js → agentRuntimeLocal-SST4EPLT.js} +62 -49
  19. package/{agentSlice-3HHYUQLM.js → agentSlice-4ZJJJN4M.js} +15 -18
  20. package/appConfigCommands-MPHS6FHD.js +417 -0
  21. package/{appDeleteCommands-5COJ6CSG.js → appDeleteCommands-W26WGENW.js} +68 -58
  22. package/{appDeployCommands-3JPAT3XO.js → appDeployCommands-ER7IOF5E.js} +74 -59
  23. package/{appDeployStatusCommands-RHZKF3G4.js → appDeployStatusCommands-VKLL3A77.js} +68 -58
  24. package/{appGetCommands-73DXOAQW.js → appGetCommands-P6GXJNUD.js} +74 -58
  25. package/{appListCommands-HD5LOQ3G.js → appListCommands-ACA2IZZM.js} +74 -58
  26. package/appMigrateCommands-OGF4E2W6.js +230 -0
  27. package/appSourceCommands-GAHVBRUM.js +279 -0
  28. package/{authCommand-V6EOMZX6.js → authCommand-PXE7NZTQ.js} +26 -40
  29. package/{authCommands-T5FODCEG.js → authCommands-AZPYXTUB.js} +20 -17
  30. package/{builtinSkillRegistry-EDHD2UHU.js → builtinSkillRegistry-6XUWMAV5.js} +8 -6
  31. package/{chromeOpsCommands-3SSTDFRF.js → chromeOpsCommands-7UKKUOBU.js} +68 -18
  32. package/{chunk-KLMBM6P6.js → chunk-2CKFROQS.js} +2454 -1115
  33. package/{chunk-MJBLXJMP.js → chunk-2I4R6ZRV.js} +12 -9
  34. package/{chunk-FXEPZKNJ.js → chunk-2MIZHEND.js} +506 -64
  35. package/{chunk-TLE77UJ5.js → chunk-2OROOEOQ.js} +0 -1
  36. package/{chunk-6RSNVJGO.js → chunk-2ZBPWX7N.js} +4 -4
  37. package/chunk-35JIFLIG.js +30 -0
  38. package/{chunk-ZYPXOQS2.js → chunk-3EPED3UO.js} +1 -1
  39. package/{chunk-DNNPARJK.js → chunk-3QMN3T6L.js} +50 -37
  40. package/{chunk-DMPZMYH4.js → chunk-3R4AYHJR.js} +13 -1
  41. package/{chunk-HPDLPEUG.js → chunk-42JZNSAY.js} +267 -234
  42. package/{chunk-223KZUJ6.js → chunk-4HZCBA4Q.js} +18 -15
  43. package/{chunk-C5A54QS7.js → chunk-4INJGWE3.js} +18 -5
  44. package/chunk-4IVMDQBA.js +261 -0
  45. package/chunk-4Y6CZ2N4.js +82 -0
  46. package/{chunk-OKAXQFON.js → chunk-52BNL6GP.js} +4 -4
  47. package/{chunk-KZ4A7EIV.js → chunk-56OAS5RZ.js} +1 -1
  48. package/{chunk-QGFLVQ6E.js → chunk-6KUTNAPU.js} +4 -14
  49. package/{chunk-MNFUKRRU.js → chunk-6XAAKRJB.js} +7 -7
  50. package/{chunk-P27E22MA.js → chunk-6Z6DGDPI.js} +1 -1
  51. package/chunk-72VWN4VK.js +51 -0
  52. package/{chunk-L4XST72F.js → chunk-75FZ2Z7C.js} +16027 -17392
  53. package/{chunk-ADYWV732.js → chunk-76B6YUQS.js} +264 -177
  54. package/{chunk-MXA54TQM.js → chunk-76K4GTY5.js} +1 -1
  55. package/{chunk-VNHZJEQN.js → chunk-7HUCUD2I.js} +3 -3
  56. package/chunk-7LR2IFUH.js +100 -0
  57. package/{chunk-S73EPYNC.js → chunk-7LS5ATRP.js} +20 -6
  58. package/{chunk-Y2TCTNUD.js → chunk-7QO6YSA4.js} +4 -4
  59. package/{chunk-DBJODIZ6.js → chunk-7RYH7YIY.js} +19 -27
  60. package/{chunk-KHYSFS3W.js → chunk-A454UXB6.js} +148 -73
  61. package/chunk-AMNZPQCY.js +635 -0
  62. package/chunk-AMTF6FJD.js +356 -0
  63. package/{chunk-4MXYCQBS.js → chunk-AQNWWJLH.js} +2 -56
  64. package/{chunk-WSLL7VV4.js → chunk-B4NA5UJR.js} +9 -9
  65. package/{chunk-LHCGKAFO.js → chunk-BKP325XS.js} +184 -112
  66. package/{chunk-PENRYZ4D.js → chunk-BPB3T5EU.js} +4 -7
  67. package/{chunk-46FETNLF.js → chunk-BTIFQBYW.js} +7 -6
  68. package/{chunk-2JHGUL5K.js → chunk-BVYHE6QD.js} +2 -2
  69. package/{chunk-KXOPLLFP.js → chunk-CA7LGAHV.js} +69 -9
  70. package/{chunk-2FZVXOFX.js → chunk-CEIWXKHP.js} +112 -200
  71. package/{chunk-AIFQKNPP.js → chunk-CL33RFD7.js} +1 -1
  72. package/{chunk-MPGR4ZNR.js → chunk-CRGPRAJ4.js} +46 -42
  73. package/{chunk-P4R5KXU7.js → chunk-CW6LRDSF.js} +5 -5
  74. package/{chunk-R3TUHCSJ.js → chunk-CZHIOBBK.js} +8 -3
  75. package/chunk-D3ONA3FP.js +762 -0
  76. package/chunk-D3SAQ6T7.js +1697 -0
  77. package/{chunk-PIVTQRX6.js → chunk-DDKA6V6X.js} +111 -12
  78. package/{chunk-KQHEGELM.js → chunk-DEAII55O.js} +16 -6
  79. package/{chunk-J55F3IEZ.js → chunk-DKJQEFNG.js} +1 -1
  80. package/chunk-DLXL4NSL.js +1179 -0
  81. package/{chunk-EJQE5HB7.js → chunk-DSBRIUX5.js} +4 -2
  82. package/{chunk-XRGBJHZX.js → chunk-E36V7MPY.js} +9 -5
  83. package/{chunk-4YPH5KRA.js → chunk-EDKMRDET.js} +1 -1
  84. package/chunk-EJHLDJWZ.js +58 -0
  85. package/{chunk-6B2OBX5B.js → chunk-EMFZXJTN.js} +15 -47
  86. package/chunk-ER6NTALN.js +34 -0
  87. package/chunk-EUHMI5KG.js +101 -0
  88. package/{chunk-YQLAFJRQ.js → chunk-FBNVJ2TO.js} +1 -1
  89. package/{chunk-Q2EERN52.js → chunk-FF5ZRKW7.js} +12 -7
  90. package/{chunk-YFEK7ACQ.js → chunk-FGD4NMTP.js} +4 -4
  91. package/{chunk-6XIE5ZGI.js → chunk-FGFJUFPS.js} +5 -6
  92. package/chunk-FI4DPLR7.js +902 -0
  93. package/chunk-FKVLQNGJ.js +25 -0
  94. package/{chunk-JCQ3WCQ3.js → chunk-FOC4TORM.js} +69 -3
  95. package/{chunk-JPXACKSW.js → chunk-G22P2J7O.js} +30 -81
  96. package/{chunk-7WHCIA5V.js → chunk-G5IAIGGD.js} +3 -8
  97. package/{chunk-5BIDJVNX.js → chunk-G5JGA5YM.js} +180 -31
  98. package/{chunk-57V4PADY.js → chunk-GMBWWBSJ.js} +781 -449
  99. package/{chunk-WS36XPJD.js → chunk-GYFKKTDI.js} +82 -6
  100. package/{chunk-KT7S7ANZ.js → chunk-GZ4I5EMM.js} +9 -9
  101. package/{chunk-324FWHUA.js → chunk-HHXF57CL.js} +12 -3
  102. package/chunk-HJTI7RZV.js +94 -0
  103. package/{chunk-QXTEEEIN.js → chunk-HPIY372N.js} +7 -7
  104. package/{chunk-Q2MPKE4B.js → chunk-HVRG27HI.js} +76 -26
  105. package/{chunk-HDKMVYNJ.js → chunk-I3NWAILT.js} +6 -4
  106. package/{chunk-JZO7KUF3.js → chunk-IM7HCFB4.js} +313 -275
  107. package/{chunk-UWWOWTW2.js → chunk-INN2PBW7.js} +1 -1
  108. package/chunk-IV6VUVLJ.js +88 -0
  109. package/chunk-J42X32PV.js +472 -0
  110. package/{chunk-UA3QTA2S.js → chunk-JHQNWV2C.js} +4441 -2569
  111. package/{chunk-R7XWZDOH.js → chunk-JUMQJSQF.js} +1423 -282
  112. package/{chunk-BIDSIRTS.js → chunk-JUNYPVL6.js} +10 -16
  113. package/chunk-JVEKCQAP.js +222 -0
  114. package/{chunk-KVMLM5VD.js → chunk-KAHYBAEN.js} +211 -472
  115. package/chunk-KDDXC2IH.js +148 -0
  116. package/chunk-KGKTN2NX.js +25 -0
  117. package/chunk-KGWE224L.js +246 -0
  118. package/chunk-L3UFGEDU.js +17157 -0
  119. package/{chunk-CBIGMWMI.js → chunk-LHJB4BXJ.js} +1 -1
  120. package/{chunk-7OVOZRZF.js → chunk-LIH7WSX5.js} +23 -379
  121. package/chunk-LJOPY4TL.js +443 -0
  122. package/{chunk-TRRXYFTR.js → chunk-LOFRSJX2.js} +1 -0
  123. package/{chunk-SQL7YNED.js → chunk-LPXBBC32.js} +71 -5
  124. package/chunk-LXP53WGF.js +168 -0
  125. package/chunk-MDAYRIP7.js +1889 -0
  126. package/chunk-MRACVEPZ.js +7 -0
  127. package/chunk-NHLLXINQ.js +8 -0
  128. package/{chunk-FP37ELBT.js → chunk-NTBTVKKB.js} +17 -25
  129. package/{chunk-LVZVSLKO.js → chunk-O7ZY6SUK.js} +5 -22
  130. package/{chunk-2C5VN7NH.js → chunk-P4XAHM4B.js} +1 -1
  131. package/chunk-PL5RKESU.js +40 -0
  132. package/{chunk-MHKPUGPD.js → chunk-PQ3QZMJK.js} +20 -4
  133. package/chunk-Q5FJJ6XI.js +103 -0
  134. package/{createAgentAutomationAction-GRZ6XY7Q.js → chunk-QKM55LP2.js} +3 -160
  135. package/{chunk-6YX2RAQN.js → chunk-QZCLCAYC.js} +89 -164
  136. package/{chunk-FE7G6DSP.js → chunk-R72QWIFO.js} +14 -4
  137. package/{chunk-JLZJL3WC.js → chunk-RDZ5OIAT.js} +370 -39
  138. package/{chunk-5RGU3J7P.js → chunk-REAE2SZK.js} +0 -1
  139. package/chunk-RF576RYE.js +117 -0
  140. package/chunk-RI7SXDJW.js +1317 -0
  141. package/{chunk-FEIVARWR.js → chunk-RIOAPUGV.js} +238 -25
  142. package/{chunk-2CT2J3O6.js → chunk-RL6H2A2Z.js} +2493 -4055
  143. package/{chunk-BZLGPM5B.js → chunk-RNLKWUVY.js} +7 -12
  144. package/{chunk-J7JRCOIW.js → chunk-RWXHGPWJ.js} +1 -1
  145. package/chunk-S7BF2OGX.js +432 -0
  146. package/{chunk-6VEO7Z3Y.js → chunk-SD4MBKZ7.js} +6 -6
  147. package/{chunk-KWNVPY6M.js → chunk-SGEBRBF3.js} +7 -4
  148. package/{chunk-6SOWMEAY.js → chunk-SR57FDTX.js} +2 -258
  149. package/{chunk-CEKRIR22.js → chunk-SU4NCTW4.js} +1 -1
  150. package/{chunk-Y2GWUBNS.js → chunk-SX6PDLBZ.js} +279 -149
  151. package/{chunk-XNNBXUEM.js → chunk-T4WU747C.js} +5 -5
  152. package/{chunk-53W5BXLN.js → chunk-TCOHWKDM.js} +54 -55
  153. package/{chunk-QIGQFON2.js → chunk-TXMFSGRY.js} +1 -1
  154. package/{chunk-UUCYUN6Y.js → chunk-UB7NV7NN.js} +1 -1
  155. package/{chunk-NCFKHYDM.js → chunk-UOLGGEEC.js} +774 -119
  156. package/{chunk-4EACJPZI.js → chunk-USFG4EWQ.js} +51 -42
  157. package/{chunk-LLUBUHNT.js → chunk-UYZOBSSO.js} +5 -9
  158. package/{chunk-XPETQ4MR.js → chunk-VDC3BW24.js} +24 -10
  159. package/chunk-VH356OQ3.js +425 -0
  160. package/{chunk-U6QNVOR5.js → chunk-VKM7DOYB.js} +130 -6
  161. package/{chunk-CJOOF4L5.js → chunk-VPAO5WQX.js} +17 -14
  162. package/{chunk-OYUMJMC5.js → chunk-W2RQYNPI.js} +5 -0
  163. package/{chunk-6BMTKYAO.js → chunk-W2Z5E2R7.js} +126 -698
  164. package/{chunk-4ZCTKB27.js → chunk-W5GKF5ZW.js} +1 -0
  165. package/{chunk-NUHQO3RB.js → chunk-WIVVNJUS.js} +1 -1
  166. package/chunk-WLJNHFEB.js +1710 -0
  167. package/chunk-WMBJDXMY.js +408 -0
  168. package/chunk-WSQLCWLQ.js +201 -0
  169. package/{chunk-YN23INFZ.js → chunk-WXD6Y7DW.js} +23 -2
  170. package/{chunk-OOVOAG4Q.js → chunk-WY6DMHMG.js} +1 -1
  171. package/{chunk-6K32PBRY.js → chunk-XJW6SLBZ.js} +3 -3
  172. package/{chunk-7BIJFGKS.js → chunk-XQFDCRG3.js} +105 -51
  173. package/chunk-XT6C2QZW.js +46 -0
  174. package/{chunk-5YS6QHGT.js → chunk-Y7THFNVJ.js} +9 -9
  175. package/{chunk-ZEZC7IIM.js → chunk-YFSM2366.js} +35 -35
  176. package/{chunk-RD3QLZQV.js → chunk-YM5XULB2.js} +324 -2
  177. package/{chunk-FZENZCIA.js → chunk-YNP3ITPU.js} +19 -12
  178. package/{chunk-U35UUM5K.js → chunk-YOUSQIIK.js} +1 -1
  179. package/{chunk-RIWKZT7E.js → chunk-YRPIUIEQ.js} +11 -9
  180. package/{chunk-IYLUK67R.js → chunk-YU235GGN.js} +25 -8
  181. package/chunk-YWEZSBLL.js +790 -0
  182. package/chunk-Z3KTXWWB.js +76 -0
  183. package/{chunk-YLAHYLDQ.js → chunk-ZC3CMUKU.js} +2 -89
  184. package/chunk-ZD7OULYZ.js +368 -0
  185. package/{chunk-5P3PPQVP.js → chunk-ZQAADXSF.js} +1 -1
  186. package/{chunk-HQUGB2HM.js → chunk-ZTCMXPIS.js} +62 -50
  187. package/{cliAgentConfigHelpers-BXHQ3PXP.js → cliAgentConfigHelpers-KMXS7JP5.js} +20 -14
  188. package/{cliAuthorityBrokerClient-TFNXJLXL.js → cliAuthorityBrokerClient-3SKOA7OZ.js} +3 -1
  189. package/cliAuthorityBrokerProcess-DCCUT4YQ.js +34 -0
  190. package/{cliEnvHelpers-CNMP3RDX.js → cliEnvHelpers-YDGDHIEE.js} +5 -2
  191. package/{cliExecutor-K6FDZTQ2.js → cliExecutor-Z62UBJ5S.js} +12 -6
  192. package/cliLocalAgentRecordReader-X2YHEBWI.js +113 -0
  193. package/cloudAutomationCommands-C6Q3BFRB.js +310 -0
  194. package/{commandRegistry-IFYQLPGM.js → commandRegistry-TYYYTW5E.js} +260 -121
  195. package/{contentThunks-QCFCD2X3.js → contentThunks-E6BJ5YSX.js} +45 -43
  196. package/{cooldownCommands-WDOI5VD7.js → cooldownCommands-FPAFS7XG.js} +1 -1
  197. package/createAgentAutomationAction-L3NLCIIW.js +172 -0
  198. package/{createDialogAction-ZAJERW62.js → createDialogAction-QSWKRPWQ.js} +46 -42
  199. package/{createPageAction-QCVBMP4C.js → createPageAction-ZVVUT4CZ.js} +49 -45
  200. package/{db-VR74ADGC.js → db-KTQ3LL2Q.js} +3 -3
  201. package/{dbSlice-RWPSVHBC.js → dbSlice-SEVKNA7A.js} +21 -16
  202. package/deleteDbKey-43MTK2DI.js +86 -0
  203. package/{dialogCommands-4IEQUALS.js → dialogCommands-UVMTIFSA.js} +80 -66
  204. package/{dialogMessageRecord-OAV77LT7.js → dialogMessageRecord-2HJTEXQX.js} +1 -1
  205. package/{dialogNotifyCommand-IASQGEMW.js → dialogNotifyCommand-LMWF7EQI.js} +22 -14
  206. package/dialogPortabilityCommands-PAMLEBST.js +3036 -0
  207. package/{dialogSlice-XFYID6KE.js → dialogSlice-VHPXENDZ.js} +43 -42
  208. package/{dialogTraceCommand-Y67NRFCV.js → dialogTraceCommand-SO2WKAXW.js} +83 -69
  209. package/{dialogUsageCommand-WJ3U6KZU.js → dialogUsageCommand-EUO6JXTD.js} +6 -3
  210. package/{docCreateCommands-QLRIWRQE.js → docCreateCommands-H4RLIUNX.js} +68 -59
  211. package/{docDeleteCommands-XPRYA532.js → docDeleteCommands-OVAKCBMT.js} +68 -59
  212. package/{docReadCommands-EXQI7ETH.js → docReadCommands-KFISIUVA.js} +67 -58
  213. package/{docStore-MWFUKZL2.js → docStore-X7BEA735.js} +16 -17
  214. package/{docUpdateCommands-EFBFQV77.js → docUpdateCommands-VOEER36L.js} +68 -59
  215. package/{ebookDownloaderAgentCommand-DYSKF5ZY.js → ebookDownloaderAgentCommand-2DHPGEOQ.js} +14 -17
  216. package/{fetchMessages-TQEUZD7H.js → fetchMessages-RGPIYEPZ.js} +2 -2
  217. package/{getPricing-5BLZRPTM.js → getPricing-BK6CUBAE.js} +8 -4
  218. package/{handleSendMessageAction-GG3TR62X.js → handleSendMessageAction-GQ2KKOET.js} +265 -119
  219. package/{hostCredentialCreate-26S6DDJ5.js → hostCredentialCreate-PJAIKZQP.js} +138 -122
  220. package/index.js +35 -21
  221. package/{keys-RWF7UCB4.js → keys-FXEGMKSG.js} +2 -2
  222. package/localAutomationCommands-UU66LOWB.js +198 -0
  223. package/localAutomationRuntime-SW4R42SZ.js +60 -0
  224. package/{localDialogRead-BJJT3TF5.js → localDialogRead-W2EVXISA.js} +2 -2
  225. package/{localRuntimeAdapter-VREWZWPC.js → localRuntimeAdapter-WRBLXFUZ.js} +136 -119
  226. package/localRuntimeAuthority-3YDFZD3L.js +44 -0
  227. package/{localRuntimeDb-ZJFGNHML.js → localRuntimeDb-CJWJK47G.js} +1 -1
  228. package/{machineCommands-CL5XK5UC.js → machineCommands-JFYED66N.js} +251 -357
  229. package/{machineInfo-LWHTEBHJ.js → machineInfo-BJIU3WQ5.js} +4 -2
  230. package/machineWsRunDispatch-CZUV2FXE.js +227 -0
  231. package/{mcpLocalAuthorizeCommand-RBXJDE6J.js → mcpLocalAuthorizeCommand-HLU72QME.js} +40 -22
  232. package/mcpLocalManageCommands-OHHU6F5C.js +212 -0
  233. package/{memberThunks-43B7UYC5.js → memberThunks-FJW4GPM5.js} +102 -22
  234. package/{memoryCommands-BC6REPQB.js → memoryCommands-2RLHDMU2.js} +25 -34
  235. package/{models-ZX2BYIMB.js → models-TOXYINNM.js} +3 -2
  236. package/{offlineMarxistsAgentCommand-XVXUE6G5.js → offlineMarxistsAgentCommand-WZBJBCPZ.js} +16 -22
  237. package/package.json +3 -3
  238. package/parityCommands-7EWR34P3.js +613 -0
  239. package/{projectArchive-OC63TWTD.js → projectArchive-JIVRMXVV.js} +49 -45
  240. package/{providerPresetApply-NTJUINI6.js → providerPresetApply-IRJ56XIZ.js} +12 -16
  241. package/{providerRegistry-W45SLUV6.js → providerRegistry-26PAUYH2.js} +3 -13
  242. package/{read-KG6INYUT.js → read-6YR57D6V.js} +11 -10
  243. package/{readDocTool-N3GA52JR.js → readDocTool-NKOGL2MW.js} +5 -1
  244. package/{readlineWorkspace-2NO6D6IZ.js → readlineWorkspace-V26AN2FL.js} +926 -572
  245. package/{rememberExplicit-CPAPONSI.js → rememberExplicit-7KX4HXQC.js} +4 -4
  246. package/remove-BF33RCTH.js +32 -0
  247. package/{removeDialogAgentAction-EEVSOQOJ.js → removeDialogAgentAction-GWHBWF4W.js} +22 -26
  248. package/{runAgentClientLoop-U7V32UTD.js → runAgentClientLoop-EKD2EEEA.js} +117 -82
  249. package/{runtimeDoctorCommands-V3M3JTUV.js → runtimeDoctorCommands-IALUR5BZ.js} +23 -16
  250. package/{secretCommands-KVVZS7A6.js → secretCommands-CSTQYB6T.js} +2 -2
  251. package/{setDialogExtraReferencesAction-DNO5POHA.js → setDialogExtraReferencesAction-RL6FGO7T.js} +16 -17
  252. package/{setPrimaryDialogAgentAction-QABBEO4C.js → setPrimaryDialogAgentAction-XJASBB3K.js} +23 -27
  253. package/{settingThunks-DVKG4X4S.js → settingThunks-ZT7ZYXXL.js} +170 -497
  254. package/{skillDiscovery-5GEGWJ6N.js → skillDiscovery-IUEZZG2B.js} +3 -3
  255. package/{spaceCommands-7QKXKBDQ.js → spaceCommands-65WQHVOI.js} +68 -57
  256. package/spacePruneCommand-PTMRUWYJ.js +233 -0
  257. package/{store-Z53ICFL3.js → store-WSAVTR32.js} +3 -1
  258. package/{streamAgentChatTurn-UAGFOXNJ.js → streamAgentChatTurn-B5NICHZW.js} +225 -137
  259. package/{switchDialogAgentAction-KYWJSGOO.js → switchDialogAgentAction-X6DFOIAX.js} +19 -23
  260. package/{tableCommands-EFA754RE.js → tableCommands-6E77VD73.js} +28 -49
  261. package/{toolApiClient-N5PYW2R3.js → toolApiClient-GTTWEV6P.js} +15 -4
  262. package/{tools-2Q2LBDUC.js → tools-UMCPIQX6.js} +73 -63
  263. package/{tuiRestart-4QDWLHYZ.js → tuiRestart-O7UDLNQU.js} +20 -13
  264. package/tuiSummaryLlmCaller-7APIUIIV.js +52 -0
  265. package/{updateCommands-GJGRS6JK.js → updateCommands-DXDIAQFS.js} +12 -7
  266. package/{updateDialogTitleAction-GGNTTI5L.js → updateDialogTitleAction-HZLKWVKM.js} +57 -58
  267. package/{usageCommand-WI6SQOPB.js → usageCommand-WYLNBDHB.js} +6 -8
  268. package/{usageRebuildCommand-WQRLLZAT.js → usageRebuildCommand-AEUPY2PE.js} +11 -15
  269. package/{windowsSelfUpdate-C7LGVWYX.js → windowsSelfUpdate-SXSVXK4X.js} +2 -2
  270. package/workContext-ZAW6VXT7.js +18 -0
  271. package/workContextQueryProjection-CACY5VFE.js +23 -0
  272. package/{workloadLifecycle-DYX5ZMAT.js → workloadLifecycle-P2SJVV3S.js} +1 -1
  273. package/agentFavoriteCommands-7LOP3HUD.js +0 -186
  274. package/agentRecordCommands-TPE7NSZ6.js +0 -194
  275. package/agentRunCommand-DMVGBPLI.js +0 -232
  276. package/chunk-2MBTWINN.js +0 -89
  277. package/chunk-523DITKR.js +0 -32
  278. package/chunk-BUDVRYES.js +0 -2213
  279. package/chunk-BZMDWGQQ.js +0 -47
  280. package/chunk-GAHJLSDO.js +0 -107
  281. package/chunk-GYX6XTAI.js +0 -84
  282. package/chunk-HNUWUO75.js +0 -93
  283. package/chunk-HSBHS6KT.js +0 -33401
  284. package/chunk-KG27JIG4.js +0 -136
  285. package/chunk-OB4FBZXJ.js +0 -364
  286. package/chunk-OKH74FML.js +0 -3746
  287. package/chunk-OLZBQWZU.js +0 -6
  288. package/chunk-OOV5JN25.js +0 -1317
  289. package/chunk-OQFOE4SJ.js +0 -405
  290. package/chunk-PXYBUFDB.js +0 -53
  291. package/chunk-R3FZHW4Q.js +0 -103
  292. package/chunk-R3MV2GII.js +0 -106
  293. package/chunk-SCAC3NM5.js +0 -11751
  294. package/chunk-SR4FE5VD.js +0 -9
  295. package/chunk-SYTHYBMI.js +0 -3558
  296. package/chunk-UKZX3NHN.js +0 -48
  297. package/chunk-UVLYNWIE.js +0 -74
  298. package/chunk-VQX5JJNI.js +0 -861
  299. package/chunk-X4O7FJF5.js +0 -160
  300. package/chunk-YJPK35HB.js +0 -175
  301. package/chunk-YNIYE47Z.js +0 -105
  302. package/chunk-Z4PCXPUE.js +0 -127
  303. package/chunk-ZR5IVL4N.js +0 -862
  304. package/chunk-ZTHAJU3O.js +0 -2537
  305. package/cliAuthorityBrokerProcess-5ZFBTHLB.js +0 -22
  306. package/cliLocalAgentRecordReader-34UKRBLY.js +0 -104
  307. package/deleteFile-ECU6FU5C.js +0 -55
  308. package/localRuntimeAuthority-UF2DAQ3F.js +0 -28
  309. package/machineWsRunDispatch-TBVOYOAH.js +0 -209
  310. package/markdownToSlate-PXYAIBVL.js +0 -8
  311. package/tuiSummaryLlmCaller-HROLGN4F.js +0 -45
  312. package/webapi-QVV65DQF.js +0 -2487
  313. package/workContext-Y3ADAPZU.js +0 -14
  314. package/{chunk-USGHJSGO.js → chunk-GX2MFKF3.js} +3 -3
  315. package/{chunk-PHREU2KZ.js → chunk-WX266G2C.js} +0 -0
  316. package/{chunk-DXWGFL2Z.js → chunk-YY7IGJMN.js} +3 -3
@@ -0,0 +1,1710 @@
1
+ import {
2
+ isSkillSummaryMarker
3
+ } from "./chunk-VF4K2QE6.js";
4
+ import {
5
+ setDialogExtraReferencesAction
6
+ } from "./chunk-UYZOBSSO.js";
7
+ import {
8
+ fetchAndCacheTableRows
9
+ } from "./chunk-SX6PDLBZ.js";
10
+ import {
11
+ resolveDialogRuntimeAgentKey
12
+ } from "./chunk-RL6H2A2Z.js";
13
+ import {
14
+ createAsyncThunk
15
+ } from "./chunk-AMNZPQCY.js";
16
+ import {
17
+ createSpaceKey
18
+ } from "./chunk-UAD2WT54.js";
19
+ import {
20
+ selectById,
21
+ selectEntities,
22
+ selectOptionalEntities
23
+ } from "./chunk-76B6YUQS.js";
24
+ import {
25
+ selectRuntimeSnapshot
26
+ } from "./chunk-42JZNSAY.js";
27
+ import {
28
+ require_react,
29
+ selectIdentityUserId
30
+ } from "./chunk-YM5XULB2.js";
31
+ import {
32
+ isAgentSkillDisabled
33
+ } from "./chunk-TXMFSGRY.js";
34
+ import {
35
+ toErrorMessage
36
+ } from "./chunk-HNMXYYJR.js";
37
+ import {
38
+ listBuiltinSkills,
39
+ resolveBuiltinSkillByName
40
+ } from "./chunk-KAHYBAEN.js";
41
+ import {
42
+ parseSkillDocProtocol
43
+ } from "./chunk-AETZ7AD6.js";
44
+ import {
45
+ isDialogRecordKeyForId,
46
+ parseDialogKey
47
+ } from "./chunk-OJKUU3LP.js";
48
+ import {
49
+ asTrimmedString
50
+ } from "./chunk-3EUW3WEO.js";
51
+ import {
52
+ isRecord
53
+ } from "./chunk-KUG52IAP.js";
54
+ import {
55
+ asOptionalTrimmedString
56
+ } from "./chunk-G3SUCT4W.js";
57
+ import {
58
+ array,
59
+ boolean,
60
+ integer,
61
+ maxLength,
62
+ maxValue,
63
+ minLength,
64
+ minValue,
65
+ number,
66
+ optional,
67
+ pipe,
68
+ regex,
69
+ strictObject,
70
+ string
71
+ } from "./chunk-FI4DPLR7.js";
72
+ import {
73
+ normalizeServerOrigin
74
+ } from "./chunk-CF7PE763.js";
75
+ import {
76
+ __toESM
77
+ } from "./chunk-U67V476Y.js";
78
+
79
+ // node_modules/@valibot/to-json-schema/dist/index.mjs
80
+ function addError(errors2, message) {
81
+ if (errors2) {
82
+ errors2.push(message);
83
+ return errors2;
84
+ }
85
+ return [message];
86
+ }
87
+ var ESCAPE_REGEX = /[.*+?^${}()|[\]\\]/g;
88
+ function escapeRegExp(string2) {
89
+ return string2.replace(ESCAPE_REGEX, "\\$&");
90
+ }
91
+ function handleError(message, config) {
92
+ switch (config?.errorMode) {
93
+ case "ignore":
94
+ break;
95
+ case "warn":
96
+ console.warn(message);
97
+ break;
98
+ default:
99
+ throw new Error(message);
100
+ }
101
+ }
102
+ function isJsonConstValue(value) {
103
+ return typeof value === "boolean" || typeof value === "number" && Number.isFinite(value) || typeof value === "string";
104
+ }
105
+ function isJsonEnumValues(values) {
106
+ return values.every(isJsonConstValue);
107
+ }
108
+ var ReferenceMap = class extends Map {
109
+ /**
110
+ * Creates an empty schema reference map.
111
+ */
112
+ constructor() {
113
+ super();
114
+ this.count = 0;
115
+ this.usedIds = /* @__PURE__ */ new Set();
116
+ }
117
+ /**
118
+ * Adds a schema reference and reserves its ID.
119
+ *
120
+ * @param schema The Valibot schema.
121
+ * @param referenceId The reference ID.
122
+ *
123
+ * @returns The reference map.
124
+ */
125
+ set(schema, referenceId) {
126
+ this.usedIds.add(referenceId);
127
+ return super.set(schema, referenceId);
128
+ }
129
+ /**
130
+ * Creates a reference ID that is not yet used.
131
+ *
132
+ * @param definitions The JSON Schema definitions.
133
+ *
134
+ * @returns The unused reference ID.
135
+ */
136
+ createId(definitions) {
137
+ while (this.usedIds.has(`${this.count}`) || `${this.count}` in definitions) this.count++;
138
+ return `${this.count++}`;
139
+ }
140
+ };
141
+ function getLowerBound(current, value) {
142
+ if (typeof current !== "number" || !Number.isFinite(current) || value > current) return value;
143
+ return current;
144
+ }
145
+ function getUpperBound(current, value) {
146
+ if (typeof current !== "number" || !Number.isFinite(current) || value < current) return value;
147
+ return current;
148
+ }
149
+ // @__NO_SIDE_EFFECTS__
150
+ function getNotRestriction(current, value) {
151
+ return current !== void 0 ? { anyOf: [current, value] } : value;
152
+ }
153
+ function intersectEnum(jsonSchema, values) {
154
+ let enumValues = jsonSchema.enum ?? values;
155
+ if (jsonSchema.enum) {
156
+ const valueSet = new Set(values);
157
+ enumValues = enumValues.filter((value) => valueSet.has(value));
158
+ }
159
+ if (enumValues.length) jsonSchema.enum = [...new Set(enumValues)];
160
+ else {
161
+ delete jsonSchema.enum;
162
+ jsonSchema.not = /* @__PURE__ */ getNotRestriction(jsonSchema.not, {});
163
+ }
164
+ }
165
+ function convertAction(jsonSchema, valibotAction, config) {
166
+ if (config?.ignoreActions?.includes(valibotAction.type)) return jsonSchema;
167
+ let errors2;
168
+ switch (valibotAction.type) {
169
+ case "base64":
170
+ jsonSchema.contentEncoding = "base64";
171
+ break;
172
+ case "bic":
173
+ case "cuid2":
174
+ case "decimal":
175
+ case "digits":
176
+ case "domain":
177
+ case "emoji":
178
+ case "hash":
179
+ case "hexadecimal":
180
+ case "hex_color":
181
+ case "isrc":
182
+ case "iso_time_second":
183
+ case "iso_week":
184
+ case "ksuid":
185
+ case "mac":
186
+ case "mac48":
187
+ case "mac64":
188
+ case "nanoid":
189
+ case "octal":
190
+ case "slug":
191
+ case "ulid":
192
+ if (jsonSchema.pattern) errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
193
+ else jsonSchema.pattern = valibotAction.requirement.source;
194
+ break;
195
+ case "description":
196
+ jsonSchema.description = valibotAction.description;
197
+ break;
198
+ case "email":
199
+ case "rfc_email":
200
+ jsonSchema.format = "email";
201
+ break;
202
+ case "ends_with":
203
+ if (jsonSchema.pattern) errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
204
+ else jsonSchema.pattern = `${escapeRegExp(valibotAction.requirement)}$`;
205
+ break;
206
+ case "empty":
207
+ if (jsonSchema.type === "array") jsonSchema.maxItems = 0;
208
+ else {
209
+ if (jsonSchema.type !== "string") errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
210
+ jsonSchema.maxLength = 0;
211
+ }
212
+ break;
213
+ case "entries":
214
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
215
+ errors2 = addError(errors2, 'The requirement of the "entries" action must be a non-negative integer.');
216
+ break;
217
+ }
218
+ jsonSchema.minProperties = getLowerBound(jsonSchema.minProperties, valibotAction.requirement);
219
+ jsonSchema.maxProperties = getUpperBound(jsonSchema.maxProperties, valibotAction.requirement);
220
+ break;
221
+ case "examples":
222
+ if (Array.isArray(jsonSchema.examples)) jsonSchema.examples = [...jsonSchema.examples, ...valibotAction.examples];
223
+ else jsonSchema.examples = valibotAction.examples;
224
+ break;
225
+ case "gt_value":
226
+ if (jsonSchema.type !== "number" && jsonSchema.type !== "integer") {
227
+ errors2 = addError(errors2, `The "gt_value" action is not supported on type "${jsonSchema.type}".`);
228
+ break;
229
+ }
230
+ if (!Number.isFinite(valibotAction.requirement)) {
231
+ errors2 = addError(errors2, 'The requirement of the "gt_value" action is not JSON compatible.');
232
+ break;
233
+ }
234
+ if (config?.target === "openapi-3.0") {
235
+ errors2 = addError(errors2, 'The "gt_value" action is not supported for OpenAPI 3.0.');
236
+ break;
237
+ }
238
+ jsonSchema.exclusiveMinimum = getLowerBound(jsonSchema.exclusiveMinimum, valibotAction.requirement);
239
+ break;
240
+ case "includes":
241
+ if (jsonSchema.pattern) errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
242
+ else jsonSchema.pattern = escapeRegExp(valibotAction.requirement);
243
+ break;
244
+ case "integer":
245
+ jsonSchema.type = "integer";
246
+ break;
247
+ case "ipv4":
248
+ jsonSchema.format = "ipv4";
249
+ break;
250
+ case "ipv6":
251
+ jsonSchema.format = "ipv6";
252
+ break;
253
+ case "iso_date":
254
+ jsonSchema.format = "date";
255
+ break;
256
+ case "iso_date_time":
257
+ case "iso_timestamp":
258
+ jsonSchema.format = "date-time";
259
+ break;
260
+ case "iso_time":
261
+ jsonSchema.format = "time";
262
+ break;
263
+ case "jws_compact":
264
+ if (jsonSchema.pattern) errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
265
+ else jsonSchema.pattern = valibotAction.requirement.source;
266
+ break;
267
+ case "length":
268
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
269
+ errors2 = addError(errors2, 'The requirement of the "length" action must be a non-negative integer.');
270
+ break;
271
+ }
272
+ if (jsonSchema.type === "array") {
273
+ jsonSchema.minItems = getLowerBound(jsonSchema.minItems, valibotAction.requirement);
274
+ jsonSchema.maxItems = getUpperBound(jsonSchema.maxItems, valibotAction.requirement);
275
+ } else {
276
+ if (jsonSchema.type !== "string") errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
277
+ jsonSchema.minLength = getLowerBound(jsonSchema.minLength, valibotAction.requirement);
278
+ jsonSchema.maxLength = getUpperBound(jsonSchema.maxLength, valibotAction.requirement);
279
+ }
280
+ break;
281
+ case "lt_value":
282
+ if (jsonSchema.type !== "number" && jsonSchema.type !== "integer") {
283
+ errors2 = addError(errors2, `The "lt_value" action is not supported on type "${jsonSchema.type}".`);
284
+ break;
285
+ }
286
+ if (!Number.isFinite(valibotAction.requirement)) {
287
+ errors2 = addError(errors2, 'The requirement of the "lt_value" action is not JSON compatible.');
288
+ break;
289
+ }
290
+ if (config?.target === "openapi-3.0") {
291
+ errors2 = addError(errors2, 'The "lt_value" action is not supported for OpenAPI 3.0.');
292
+ break;
293
+ }
294
+ jsonSchema.exclusiveMaximum = getUpperBound(jsonSchema.exclusiveMaximum, valibotAction.requirement);
295
+ break;
296
+ case "max_entries":
297
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
298
+ errors2 = addError(errors2, 'The requirement of the "max_entries" action must be a non-negative integer.');
299
+ break;
300
+ }
301
+ jsonSchema.maxProperties = getUpperBound(jsonSchema.maxProperties, valibotAction.requirement);
302
+ break;
303
+ case "max_length":
304
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
305
+ errors2 = addError(errors2, 'The requirement of the "max_length" action must be a non-negative integer.');
306
+ break;
307
+ }
308
+ if (jsonSchema.type === "array") jsonSchema.maxItems = getUpperBound(jsonSchema.maxItems, valibotAction.requirement);
309
+ else {
310
+ if (jsonSchema.type !== "string") errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
311
+ jsonSchema.maxLength = getUpperBound(jsonSchema.maxLength, valibotAction.requirement);
312
+ }
313
+ break;
314
+ case "max_value":
315
+ if (jsonSchema.type !== "number" && jsonSchema.type !== "integer") {
316
+ errors2 = addError(errors2, `The "max_value" action is not supported on type "${jsonSchema.type}".`);
317
+ break;
318
+ }
319
+ if (!Number.isFinite(valibotAction.requirement)) {
320
+ errors2 = addError(errors2, 'The requirement of the "max_value" action is not JSON compatible.');
321
+ break;
322
+ }
323
+ jsonSchema.maximum = getUpperBound(jsonSchema.maximum, valibotAction.requirement);
324
+ break;
325
+ case "metadata":
326
+ if (typeof valibotAction.metadata.title === "string") jsonSchema.title = valibotAction.metadata.title;
327
+ if (typeof valibotAction.metadata.description === "string") jsonSchema.description = valibotAction.metadata.description;
328
+ if (Array.isArray(valibotAction.metadata.examples)) if (Array.isArray(jsonSchema.examples)) jsonSchema.examples = [...jsonSchema.examples, ...valibotAction.metadata.examples];
329
+ else jsonSchema.examples = valibotAction.metadata.examples;
330
+ for (const key of Object.keys(valibotAction.metadata)) if (key !== "title" && key !== "description" && key !== "examples" && key !== "__proto__") jsonSchema[key] = valibotAction.metadata[key];
331
+ break;
332
+ case "min_entries":
333
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
334
+ errors2 = addError(errors2, 'The requirement of the "min_entries" action must be a non-negative integer.');
335
+ break;
336
+ }
337
+ jsonSchema.minProperties = getLowerBound(jsonSchema.minProperties, valibotAction.requirement);
338
+ break;
339
+ case "min_length":
340
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
341
+ errors2 = addError(errors2, 'The requirement of the "min_length" action must be a non-negative integer.');
342
+ break;
343
+ }
344
+ if (jsonSchema.type === "array") jsonSchema.minItems = getLowerBound(jsonSchema.minItems, valibotAction.requirement);
345
+ else {
346
+ if (jsonSchema.type !== "string") errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
347
+ jsonSchema.minLength = getLowerBound(jsonSchema.minLength, valibotAction.requirement);
348
+ }
349
+ break;
350
+ case "min_value":
351
+ if (jsonSchema.type !== "number" && jsonSchema.type !== "integer") {
352
+ errors2 = addError(errors2, `The "min_value" action is not supported on type "${jsonSchema.type}".`);
353
+ break;
354
+ }
355
+ if (!Number.isFinite(valibotAction.requirement)) {
356
+ errors2 = addError(errors2, 'The requirement of the "min_value" action is not JSON compatible.');
357
+ break;
358
+ }
359
+ jsonSchema.minimum = getLowerBound(jsonSchema.minimum, valibotAction.requirement);
360
+ break;
361
+ case "multiple_of":
362
+ jsonSchema.multipleOf = valibotAction.requirement;
363
+ break;
364
+ case "non_empty":
365
+ if (jsonSchema.type === "array") jsonSchema.minItems = getLowerBound(jsonSchema.minItems, 1);
366
+ else {
367
+ if (jsonSchema.type !== "string") errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
368
+ jsonSchema.minLength = getLowerBound(jsonSchema.minLength, 1);
369
+ }
370
+ break;
371
+ case "not_value":
372
+ if (!isJsonConstValue(valibotAction.requirement)) {
373
+ errors2 = addError(errors2, 'The requirement of the "not_value" action is not JSON compatible.');
374
+ break;
375
+ }
376
+ jsonSchema.not = /* @__PURE__ */ getNotRestriction(jsonSchema.not, config?.target === "openapi-3.0" ? { enum: [valibotAction.requirement] } : { const: valibotAction.requirement });
377
+ break;
378
+ case "not_values":
379
+ if (!isJsonEnumValues(valibotAction.requirement)) {
380
+ errors2 = addError(errors2, 'A requirement of the "not_values" action is not JSON compatible.');
381
+ break;
382
+ }
383
+ if (valibotAction.requirement.length) jsonSchema.not = /* @__PURE__ */ getNotRestriction(jsonSchema.not, { enum: [...new Set(valibotAction.requirement)] });
384
+ break;
385
+ case "regex":
386
+ if (valibotAction.requirement.flags) errors2 = addError(errors2, "RegExp flags are not supported by JSON Schema.");
387
+ if (jsonSchema.pattern) errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
388
+ else jsonSchema.pattern = valibotAction.requirement.source;
389
+ break;
390
+ case "safe_integer":
391
+ jsonSchema.type = "integer";
392
+ jsonSchema.minimum = getLowerBound(jsonSchema.minimum, Number.MIN_SAFE_INTEGER);
393
+ jsonSchema.maximum = getUpperBound(jsonSchema.maximum, Number.MAX_SAFE_INTEGER);
394
+ break;
395
+ case "starts_with":
396
+ if (jsonSchema.pattern) errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
397
+ else jsonSchema.pattern = `^${escapeRegExp(valibotAction.requirement)}`;
398
+ break;
399
+ case "title":
400
+ jsonSchema.title = valibotAction.title;
401
+ break;
402
+ case "url":
403
+ jsonSchema.format = "uri";
404
+ break;
405
+ case "uuid":
406
+ jsonSchema.format = "uuid";
407
+ break;
408
+ case "value":
409
+ if (!isJsonConstValue(valibotAction.requirement)) {
410
+ errors2 = addError(errors2, 'The requirement of the "value" action is not JSON compatible.');
411
+ break;
412
+ }
413
+ if (config?.target === "openapi-3.0") intersectEnum(jsonSchema, [valibotAction.requirement]);
414
+ else if ("const" in jsonSchema && jsonSchema.const !== valibotAction.requirement) errors2 = addError(errors2, `The "${valibotAction.type}" action is not supported in combination with a different "const" restriction.`);
415
+ else jsonSchema.const = valibotAction.requirement;
416
+ break;
417
+ case "values":
418
+ if (!isJsonEnumValues(valibotAction.requirement)) {
419
+ errors2 = addError(errors2, 'A requirement of the "values" action is not JSON compatible.');
420
+ break;
421
+ }
422
+ intersectEnum(jsonSchema, valibotAction.requirement);
423
+ break;
424
+ default:
425
+ errors2 = addError(errors2, `The "${valibotAction.type}" action cannot be converted to JSON Schema.`);
426
+ }
427
+ if (config?.overrideAction) {
428
+ const actionOverride = config.overrideAction({
429
+ valibotAction,
430
+ jsonSchema,
431
+ errors: errors2
432
+ });
433
+ if (actionOverride) return { ...actionOverride };
434
+ }
435
+ if (errors2) for (const message of errors2) handleError(message, config);
436
+ return jsonSchema;
437
+ }
438
+ function flattenPipe(pipe2) {
439
+ return pipe2.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
440
+ }
441
+ function getDefinitionRef(referenceId) {
442
+ return `#/$defs/${referenceId.replaceAll("~", "~0").replaceAll("/", "~1")}`;
443
+ }
444
+ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {
445
+ if (!skipRef) {
446
+ const referenceId = context.referenceMap.get(valibotSchema);
447
+ if (referenceId) {
448
+ jsonSchema.$ref = getDefinitionRef(referenceId);
449
+ if (config?.overrideRef) {
450
+ const refOverride = config.overrideRef({
451
+ ...context,
452
+ referenceId,
453
+ valibotSchema,
454
+ jsonSchema
455
+ });
456
+ if (refOverride) jsonSchema.$ref = refOverride;
457
+ }
458
+ return jsonSchema;
459
+ }
460
+ }
461
+ if ("pipe" in valibotSchema) {
462
+ const flatPipe = flattenPipe(valibotSchema.pipe);
463
+ let startIndex = 0;
464
+ let stopIndex = flatPipe.length - 1;
465
+ if (config?.typeMode === "input") {
466
+ const inputStopIndex = flatPipe.slice(1).findIndex((item) => item.kind === "schema" || item.kind === "transformation" && (item.type === "find_item" || item.type === "parse_json" || item.type === "raw_transform" || item.type === "reduce_items" || item.type === "stringify_json" || item.type === "to_bigint" || item.type === "to_boolean" || item.type === "to_date" || item.type === "to_number" || item.type === "to_string" || item.type === "transform"));
467
+ if (inputStopIndex !== -1) stopIndex = inputStopIndex;
468
+ } else if (config?.typeMode === "output") {
469
+ const outputStartIndex = flatPipe.findLastIndex((item) => item.kind === "schema");
470
+ if (outputStartIndex !== -1) startIndex = outputStartIndex;
471
+ }
472
+ for (let index = startIndex; index <= stopIndex; index++) {
473
+ const valibotPipeItem = flatPipe[index];
474
+ if (valibotPipeItem.kind === "schema") {
475
+ if (index > startIndex) handleError('Set the "typeMode" config to "input" or "output" to convert pipelines with multiple schemas.', config);
476
+ jsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);
477
+ } else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
478
+ }
479
+ return jsonSchema;
480
+ }
481
+ let errors2;
482
+ switch (valibotSchema.type) {
483
+ case "boolean":
484
+ jsonSchema.type = "boolean";
485
+ break;
486
+ case "null":
487
+ if (config?.target === "openapi-3.0") jsonSchema.enum = [null];
488
+ else jsonSchema.type = "null";
489
+ break;
490
+ case "number":
491
+ jsonSchema.type = "number";
492
+ break;
493
+ case "string":
494
+ jsonSchema.type = "string";
495
+ break;
496
+ case "array":
497
+ jsonSchema.type = "array";
498
+ jsonSchema.items = convertSchema({}, valibotSchema.item, config, context);
499
+ break;
500
+ case "tuple":
501
+ case "tuple_with_rest":
502
+ case "loose_tuple":
503
+ case "strict_tuple":
504
+ jsonSchema.type = "array";
505
+ if (config?.target === "openapi-3.0") {
506
+ jsonSchema.items = { anyOf: [] };
507
+ jsonSchema.minItems = valibotSchema.items.length;
508
+ for (const item of valibotSchema.items) jsonSchema.items.anyOf.push(convertSchema({}, item, config, context));
509
+ if (valibotSchema.type === "tuple_with_rest") jsonSchema.items.anyOf.push(convertSchema({}, valibotSchema.rest, config, context));
510
+ else if (valibotSchema.type === "strict_tuple" || valibotSchema.type === "tuple") jsonSchema.maxItems = valibotSchema.items.length;
511
+ } else if (config?.target === "draft-2020-12") {
512
+ jsonSchema.prefixItems = [];
513
+ jsonSchema.minItems = valibotSchema.items.length;
514
+ for (const item of valibotSchema.items) jsonSchema.prefixItems.push(convertSchema({}, item, config, context));
515
+ if (valibotSchema.type === "tuple_with_rest") jsonSchema.items = convertSchema({}, valibotSchema.rest, config, context);
516
+ else if (valibotSchema.type === "strict_tuple") jsonSchema.items = false;
517
+ } else {
518
+ jsonSchema.items = [];
519
+ jsonSchema.minItems = valibotSchema.items.length;
520
+ for (const item of valibotSchema.items) jsonSchema.items.push(convertSchema({}, item, config, context));
521
+ if (valibotSchema.type === "tuple_with_rest") jsonSchema.additionalItems = convertSchema({}, valibotSchema.rest, config, context);
522
+ else if (valibotSchema.type === "strict_tuple") jsonSchema.additionalItems = false;
523
+ }
524
+ break;
525
+ case "object":
526
+ case "object_with_rest":
527
+ case "loose_object":
528
+ case "strict_object":
529
+ jsonSchema.type = "object";
530
+ jsonSchema.properties = {};
531
+ jsonSchema.required = [];
532
+ for (const key in valibotSchema.entries) {
533
+ const entry = valibotSchema.entries[key];
534
+ jsonSchema.properties[key] = convertSchema({}, entry, config, context);
535
+ if (entry.type !== "exact_optional" && entry.type !== "nullish" && entry.type !== "optional") jsonSchema.required.push(key);
536
+ }
537
+ if (valibotSchema.type === "object_with_rest") jsonSchema.additionalProperties = convertSchema({}, valibotSchema.rest, config, context);
538
+ else if (valibotSchema.type === "strict_object") jsonSchema.additionalProperties = false;
539
+ break;
540
+ case "record":
541
+ if (config?.target === "openapi-3.0" && "pipe" in valibotSchema.key) errors2 = addError(errors2, 'The "record" schema with a schema for the key that contains a "pipe" cannot be converted to JSON Schema.');
542
+ if (valibotSchema.key.type !== "string") errors2 = addError(errors2, `The "record" schema with the "${valibotSchema.key.type}" schema for the key cannot be converted to JSON Schema.`);
543
+ jsonSchema.type = "object";
544
+ if (config?.target !== "openapi-3.0") jsonSchema.propertyNames = convertSchema({}, valibotSchema.key, config, context);
545
+ jsonSchema.additionalProperties = convertSchema({}, valibotSchema.value, config, context);
546
+ break;
547
+ case "any":
548
+ case "unknown":
549
+ break;
550
+ case "never":
551
+ jsonSchema.not = {};
552
+ break;
553
+ case "nullable":
554
+ case "nullish":
555
+ if (config?.target === "openapi-3.0") {
556
+ const innerSchema = convertSchema({}, valibotSchema.wrapped, config, context);
557
+ Object.assign(jsonSchema, innerSchema);
558
+ jsonSchema.nullable = true;
559
+ } else jsonSchema.anyOf = [convertSchema({}, valibotSchema.wrapped, config, context), { type: "null" }];
560
+ if (valibotSchema.default !== void 0) jsonSchema.default = typeof valibotSchema.default === "function" ? valibotSchema.default() : valibotSchema.default;
561
+ break;
562
+ case "exact_optional":
563
+ case "optional":
564
+ case "undefinedable":
565
+ jsonSchema = convertSchema(jsonSchema, valibotSchema.wrapped, config, context);
566
+ if (valibotSchema.default !== void 0) jsonSchema.default = typeof valibotSchema.default === "function" ? valibotSchema.default() : valibotSchema.default;
567
+ break;
568
+ case "literal":
569
+ if (!isJsonConstValue(valibotSchema.literal)) {
570
+ errors2 = addError(errors2, 'The value of the "literal" schema is not JSON compatible.');
571
+ break;
572
+ }
573
+ if (config?.target === "openapi-3.0") jsonSchema.enum = [valibotSchema.literal];
574
+ else jsonSchema.const = valibotSchema.literal;
575
+ break;
576
+ case "enum":
577
+ case "picklist": {
578
+ const options = valibotSchema.options;
579
+ if (!options.every((option) => typeof option === "string" || typeof option === "number" && Number.isFinite(option))) {
580
+ errors2 = addError(errors2, `An option of the "${valibotSchema.type}" schema is not JSON compatible.`);
581
+ break;
582
+ }
583
+ jsonSchema.enum = options;
584
+ if (options.every((option) => typeof option === "string")) jsonSchema.type = "string";
585
+ else if (options.every((option) => typeof option === "number")) jsonSchema.type = "number";
586
+ else if (config?.target !== "openapi-3.0") jsonSchema.type = ["string", "number"];
587
+ break;
588
+ }
589
+ case "union":
590
+ jsonSchema.anyOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
591
+ break;
592
+ case "variant":
593
+ jsonSchema.oneOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
594
+ break;
595
+ case "intersect":
596
+ jsonSchema.allOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
597
+ break;
598
+ case "lazy": {
599
+ let wrappedValibotSchema = context.getterMap.get(valibotSchema.getter);
600
+ if (!wrappedValibotSchema) {
601
+ wrappedValibotSchema = valibotSchema.getter(void 0);
602
+ context.getterMap.set(valibotSchema.getter, wrappedValibotSchema);
603
+ }
604
+ let referenceId = context.referenceMap.get(wrappedValibotSchema);
605
+ if (!referenceId) {
606
+ referenceId = context.referenceMap.createId(context.definitions);
607
+ context.referenceMap.set(wrappedValibotSchema, referenceId);
608
+ context.definitions[referenceId] = convertSchema({}, wrappedValibotSchema, config, context, true);
609
+ }
610
+ jsonSchema.$ref = getDefinitionRef(referenceId);
611
+ if (config?.overrideRef) {
612
+ const refOverride = config.overrideRef({
613
+ ...context,
614
+ referenceId,
615
+ valibotSchema: wrappedValibotSchema,
616
+ jsonSchema
617
+ });
618
+ if (refOverride) jsonSchema.$ref = refOverride;
619
+ }
620
+ break;
621
+ }
622
+ default:
623
+ errors2 = addError(errors2, `The "${valibotSchema.type}" schema cannot be converted to JSON Schema.`);
624
+ }
625
+ if (config?.overrideSchema) {
626
+ const schemaOverride = config.overrideSchema({
627
+ ...context,
628
+ referenceId: context.referenceMap.get(valibotSchema),
629
+ valibotSchema,
630
+ jsonSchema,
631
+ errors: errors2
632
+ });
633
+ if (schemaOverride) return { ...schemaOverride };
634
+ }
635
+ if (errors2) for (const message of errors2) handleError(message, config);
636
+ return jsonSchema;
637
+ }
638
+ var store;
639
+ function getGlobalDefs() {
640
+ return store;
641
+ }
642
+ function toJsonSchema(schema, config) {
643
+ const context = {
644
+ definitions: {},
645
+ referenceMap: new ReferenceMap(),
646
+ getterMap: /* @__PURE__ */ new Map()
647
+ };
648
+ const definitions = config?.definitions ?? getGlobalDefs();
649
+ if (definitions) {
650
+ for (const key in definitions) context.referenceMap.set(definitions[key], key);
651
+ for (const key in definitions) context.definitions[key] = convertSchema({}, definitions[key], config, context, true);
652
+ }
653
+ const jsonSchema = convertSchema({}, schema, config, context);
654
+ const target = config?.target ?? "draft-07";
655
+ if (target === "draft-2020-12") jsonSchema.$schema = "https://json-schema.org/draft/2020-12/schema";
656
+ else if (target === "draft-07") jsonSchema.$schema = "http://json-schema.org/draft-07/schema#";
657
+ if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
658
+ return jsonSchema;
659
+ }
660
+
661
+ // packages/agent-runtime/zohoMailSpecs.ts
662
+ function toToolInputJsonSchema(schema) {
663
+ const { $schema: _ignored, ...jsonSchema } = toJsonSchema(schema);
664
+ return jsonSchema;
665
+ }
666
+ var datacenter = (id, label) => Object.freeze({
667
+ id,
668
+ label,
669
+ accountsBase: `https://accounts.zoho.${id}`,
670
+ mailApiBase: `https://mail.zoho.${id}`,
671
+ calendarApiBase: `https://calendar.zoho.${id}`
672
+ });
673
+ var ZOHO_MAIL_DATACENTERS = Object.freeze([
674
+ datacenter("com", "\u56FD\u9645\u7248"),
675
+ datacenter("com.cn", "\u4E2D\u56FD\u533A"),
676
+ datacenter("eu", "\u6B27\u6D32\u533A"),
677
+ datacenter("in", "\u5370\u5EA6\u533A"),
678
+ datacenter("com.au", "\u6FB3\u6D32\u533A"),
679
+ datacenter("jp", "\u65E5\u672C\u533A")
680
+ ]);
681
+ var ZOHO_MAIL_READONLY_SCOPES = Object.freeze([
682
+ "ZohoMail.accounts.READ",
683
+ "ZohoMail.folders.READ",
684
+ "ZohoMail.messages.READ"
685
+ ]);
686
+ var ZOHO_CAPABILITY_IDS = Object.freeze(["mail_read", "calendar_read"]);
687
+ var ZOHO_CALENDAR_READONLY_SCOPES = Object.freeze(["ZohoCalendar.calendar.READ", "ZohoCalendar.event.READ"]);
688
+ var ZOHO_CALENDAR_TOOL_VALIBOT_SCHEMAS = {
689
+ zohoCalendarListCalendars: strictObject({}),
690
+ zohoCalendarListEvents: strictObject({
691
+ calendarUid: optional(pipe(string(), minLength(1))),
692
+ startDate: optional(pipe(string(), regex(/^\d{4}-\d{2}-\d{2}$/))),
693
+ endDate: optional(pipe(string(), regex(/^\d{4}-\d{2}-\d{2}$/))),
694
+ limit: optional(pipe(number(), integer(), minValue(1), maxValue(50)), 20)
695
+ })
696
+ };
697
+ var ZOHO_CALENDAR_TOOL_SCHEMAS = {
698
+ zohoCalendarListCalendars: toToolInputJsonSchema(ZOHO_CALENDAR_TOOL_VALIBOT_SCHEMAS.zohoCalendarListCalendars),
699
+ zohoCalendarListEvents: toToolInputJsonSchema(ZOHO_CALENDAR_TOOL_VALIBOT_SCHEMAS.zohoCalendarListEvents)
700
+ };
701
+ var ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS = {
702
+ zohoMailListFolders: strictObject({}),
703
+ zohoMailSearchMessages: strictObject({
704
+ query: optional(string()),
705
+ folderId: optional(pipe(string(), minLength(1))),
706
+ limit: optional(pipe(number(), integer(), minValue(1), maxValue(30)), 10),
707
+ unreadOnly: optional(boolean())
708
+ }),
709
+ zohoMailReadMessage: strictObject({
710
+ messageId: pipe(string(), minLength(1)),
711
+ folderId: pipe(string(), minLength(1))
712
+ }),
713
+ // Batch read: one search plus one call instead of one call per message; capped to keep a single response bounded.
714
+ zohoMailReadMessages: strictObject({
715
+ messages: pipe(array(strictObject({
716
+ messageId: pipe(string(), minLength(1)),
717
+ folderId: pipe(string(), minLength(1))
718
+ })), minLength(1), maxLength(10))
719
+ })
720
+ };
721
+ var ZOHO_MAIL_TOOL_NAMES = ["zohoMailListFolders", "zohoMailSearchMessages", "zohoMailReadMessage", "zohoMailReadMessages"];
722
+ var ZOHO_MAIL_TOOL_SCHEMAS = {
723
+ zohoMailListFolders: toToolInputJsonSchema(ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS.zohoMailListFolders),
724
+ zohoMailSearchMessages: toToolInputJsonSchema(ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS.zohoMailSearchMessages),
725
+ zohoMailReadMessage: toToolInputJsonSchema(ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS.zohoMailReadMessage),
726
+ zohoMailReadMessages: toToolInputJsonSchema(ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS.zohoMailReadMessages)
727
+ };
728
+
729
+ // packages/app/utils/desktopActionGateChannel.ts
730
+ function targetForRunKind(kind, ctx = {}) {
731
+ if (kind === "server-run") {
732
+ return {
733
+ kind: "web",
734
+ server: ctx.server?.trim() ?? "",
735
+ token: ctx.token ?? null
736
+ };
737
+ }
738
+ return { kind: "desktop" };
739
+ }
740
+ var NEEDS_LOGIN_MESSAGE = "\u9700\u8981\u767B\u5F55\u540E\u624D\u80FD\u5904\u7406\u8BE5\u6388\u6743\u8BF7\u6C42";
741
+ var MISSING_SERVER_MESSAGE = "\u672A\u914D\u7F6E\u670D\u52A1\u5668\u5730\u5740\uFF0C\u65E0\u6CD5\u5904\u7406\u8BE5\u6388\u6743\u8BF7\u6C42";
742
+ var gates = /* @__PURE__ */ new Map();
743
+ var targets = /* @__PURE__ */ new Map();
744
+ var failures = /* @__PURE__ */ new Map();
745
+ var metadata = /* @__PURE__ */ new Map();
746
+ var errors = /* @__PURE__ */ new Map();
747
+ var listeners = /* @__PURE__ */ new Set();
748
+ var cachedSnapshot = null;
749
+ function invalidateSnapshot() {
750
+ cachedSnapshot = null;
751
+ }
752
+ function notify() {
753
+ for (const listener of listeners) {
754
+ try {
755
+ listener();
756
+ } catch {
757
+ }
758
+ }
759
+ }
760
+ function pushGate(gate, target = { kind: "desktop" }, meta) {
761
+ if (!gate || typeof gate.id !== "string" || gate.id.length === 0) return;
762
+ failures.delete(gate.id);
763
+ if (target.kind === "web" && (!target.token || !target.server.trim())) {
764
+ const message = !target.token ? NEEDS_LOGIN_MESSAGE : MISSING_SERVER_MESSAGE;
765
+ if (meta) failures.set(gate.id, { gateId: gate.id, meta: { ...meta, storage: "web" }, message });
766
+ gates.delete(gate.id);
767
+ targets.delete(gate.id);
768
+ metadata.delete(gate.id);
769
+ errors.set(gate.id, message);
770
+ invalidateSnapshot();
771
+ notify();
772
+ return;
773
+ }
774
+ metadata.delete(gate.id);
775
+ if (meta && target.kind !== "local") metadata.set(gate.id, { ...meta, storage: target.kind });
776
+ errors.delete(gate.id);
777
+ targets.set(gate.id, target);
778
+ gates.set(gate.id, gate);
779
+ invalidateSnapshot();
780
+ notify();
781
+ }
782
+ function clearGateTurn(turnId) {
783
+ for (const [id, failure] of failures) {
784
+ if (failure.meta.turnId === turnId) failures.delete(id);
785
+ }
786
+ for (const [id, meta] of metadata) {
787
+ if (meta.turnId !== turnId) continue;
788
+ gates.delete(id);
789
+ targets.delete(id);
790
+ metadata.delete(id);
791
+ errors.delete(id);
792
+ }
793
+ invalidateSnapshot();
794
+ notify();
795
+ }
796
+ function getSnapshot() {
797
+ if (!cachedSnapshot) {
798
+ cachedSnapshot = {
799
+ gates: [...gates.values()],
800
+ failures: [...failures.values()],
801
+ errors: Object.fromEntries(errors)
802
+ };
803
+ }
804
+ return cachedSnapshot;
805
+ }
806
+ async function resolveGate(gateId, options, fetchImpl = fetch, targetOverride) {
807
+ if (failures.has(gateId)) return false;
808
+ if (!targetOverride && !gates.has(gateId)) return false;
809
+ const target = targetOverride ?? targets.get(gateId) ?? { kind: "desktop" };
810
+ if (target.kind === "local") {
811
+ try {
812
+ const ok = target.resolve ? await target.resolve(options) : true;
813
+ if (!ok) {
814
+ return false;
815
+ }
816
+ errors.delete(gateId);
817
+ gates.delete(gateId);
818
+ targets.delete(gateId);
819
+ metadata.delete(gateId);
820
+ invalidateSnapshot();
821
+ notify();
822
+ return true;
823
+ } catch (error) {
824
+ errors.set(
825
+ gateId,
826
+ "\u6388\u6743\u8BF7\u6C42\u63D0\u4EA4\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"
827
+ );
828
+ invalidateSnapshot();
829
+ notify();
830
+ return false;
831
+ }
832
+ }
833
+ const isWeb = target.kind === "web";
834
+ const trimmedServer = isWeb ? target.server.trim().replace(/\/+$/, "") : "";
835
+ const url = isWeb ? `${trimmedServer}/api/agent/secret-request/${encodeURIComponent(gateId)}` : `/api/desktop/agent-runtime/action-gate/${encodeURIComponent(gateId)}`;
836
+ const headers = { "Content-Type": "application/json" };
837
+ if (isWeb) headers.Authorization = `Bearer ${target.token}`;
838
+ const failTerminal = (message) => {
839
+ gates.delete(gateId);
840
+ targets.delete(gateId);
841
+ metadata.delete(gateId);
842
+ errors.set(gateId, message);
843
+ invalidateSnapshot();
844
+ notify();
845
+ return false;
846
+ };
847
+ if (isWeb && (!target.token || !trimmedServer)) {
848
+ return failTerminal(!target.token ? NEEDS_LOGIN_MESSAGE : MISSING_SERVER_MESSAGE);
849
+ }
850
+ try {
851
+ const response = await fetchImpl(
852
+ url,
853
+ {
854
+ method: "POST",
855
+ headers,
856
+ body: JSON.stringify({ decision: options.decision, value: options.value })
857
+ }
858
+ );
859
+ if (!response.ok) {
860
+ const data = await response.json().catch(() => null);
861
+ const message = `\u6388\u6743\u8BF7\u6C42\u63D0\u4EA4\u5931\u8D25\uFF08HTTP ${response.status}\uFF09\uFF0C\u8BF7\u91CD\u8BD5`;
862
+ const isTerminal = response.status >= 400 && response.status < 500 && data?.gateId === gateId;
863
+ if (isTerminal) {
864
+ gates.delete(gateId);
865
+ targets.delete(gateId);
866
+ metadata.delete(gateId);
867
+ errors.set(gateId, message);
868
+ invalidateSnapshot();
869
+ notify();
870
+ return false;
871
+ }
872
+ throw new Error(message);
873
+ }
874
+ errors.delete(gateId);
875
+ gates.delete(gateId);
876
+ targets.delete(gateId);
877
+ metadata.delete(gateId);
878
+ invalidateSnapshot();
879
+ notify();
880
+ return true;
881
+ } catch (error) {
882
+ errors.set(
883
+ gateId,
884
+ "\u6388\u6743\u8BF7\u6C42\u63D0\u4EA4\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"
885
+ );
886
+ invalidateSnapshot();
887
+ notify();
888
+ return false;
889
+ }
890
+ }
891
+
892
+ // packages/ai/chat/parseMultilineSSE.ts
893
+ function createSSEParser() {
894
+ let buffer = "";
895
+ return function parseSSE(chunk) {
896
+ const results = [];
897
+ if (!chunk) return results;
898
+ buffer += chunk;
899
+ const events = buffer.split(/\r?\n\r?\n/);
900
+ buffer = events.pop() ?? "";
901
+ for (const ev of events) {
902
+ if (!ev.trim()) continue;
903
+ const lines = ev.split(/\r?\n/);
904
+ let accumulator = "";
905
+ for (const line of lines) {
906
+ const t = line.trim();
907
+ if (t === "data: [DONE]") {
908
+ if (accumulator.trim()) {
909
+ try {
910
+ results.push(JSON.parse(accumulator));
911
+ } catch (e) {
912
+ }
913
+ accumulator = "";
914
+ }
915
+ results.push("[DONE]");
916
+ continue;
917
+ }
918
+ let content = "";
919
+ let isDataLine = false;
920
+ if (t.startsWith("data:")) {
921
+ content = line.substring(line.indexOf("data:") + 5).trim();
922
+ isDataLine = true;
923
+ } else if (accumulator && t && !t.startsWith("event:") && !t.startsWith("id:") && !t.startsWith("retry:")) {
924
+ content = line;
925
+ } else {
926
+ continue;
927
+ }
928
+ if (isDataLine && !accumulator) {
929
+ try {
930
+ const obj = JSON.parse(content);
931
+ results.push(obj);
932
+ continue;
933
+ } catch (e) {
934
+ }
935
+ }
936
+ accumulator += content;
937
+ }
938
+ if (accumulator.trim()) {
939
+ try {
940
+ const obj = JSON.parse(accumulator);
941
+ results.push(obj);
942
+ } catch (e) {
943
+ }
944
+ }
945
+ }
946
+ return results;
947
+ };
948
+ }
949
+ var parseMultilineSSE = createSSEParser();
950
+
951
+ // packages/core/abortableDelay.ts
952
+ function waitForAbortableDelay(ms, signal) {
953
+ const delayMs = Number.isFinite(ms) && ms >= 0 ? Math.round(ms) : 0;
954
+ if (signal?.aborted) {
955
+ return Promise.reject(new DOMException("Aborted", "AbortError"));
956
+ }
957
+ return new Promise((resolve, reject) => {
958
+ const onAbort = () => {
959
+ clearTimeout(timeoutId);
960
+ signal?.removeEventListener("abort", onAbort);
961
+ reject(new DOMException("Aborted", "AbortError"));
962
+ };
963
+ const timeoutId = setTimeout(() => {
964
+ signal?.removeEventListener("abort", onAbort);
965
+ resolve();
966
+ }, delayMs);
967
+ signal?.addEventListener("abort", onAbort, { once: true });
968
+ });
969
+ }
970
+
971
+ // packages/ai/tools/memoryToolContext.ts
972
+ var trimmed = (value) => typeof value === "string" && value.trim() ? value.trim() : void 0;
973
+ function findLoadedDialogs(state, dialogId, exactKey) {
974
+ const entities = selectOptionalEntities(state);
975
+ if (!entities || typeof entities !== "object") return [];
976
+ const matches = [];
977
+ for (const key of Object.keys(entities)) {
978
+ if (!isDialogRecordKeyForId(key, dialogId)) continue;
979
+ const record = entities[key];
980
+ if (!record || trimmed(record.id) !== dialogId) continue;
981
+ if (exactKey && key !== exactKey) continue;
982
+ matches.push({ key, record });
983
+ }
984
+ return matches;
985
+ }
986
+ function resolveMemoryToolContext(state, context) {
987
+ return resolveToolAttributionContext(state, context);
988
+ }
989
+ function resolveToolAttributionContext(state, context, options) {
990
+ const UNRESOLVED = options?.errorLabel ?? "\u65E0\u6CD5\u786E\u5B9A\u8BB0\u5FC6\u5F52\u5C5E";
991
+ const agentKey = trimmed(context?.agentKey);
992
+ if (options?.requireAgentKey && !agentKey) {
993
+ throw new Error(`${UNRESOLVED}\uFF1A\u6267\u884C\u4E0A\u4E0B\u6587\u7F3A\u5C11 agentKey\uFF0C\u4E0D\u4F1A\u4ECE\u5F53\u524D\u5BF9\u8BDD\u63A8\u65AD\u3002`);
994
+ }
995
+ const contextDialogId = trimmed(context?.dialogId);
996
+ const contextDialogKey = trimmed(context?.dialogKey);
997
+ let keyIdentity = null;
998
+ if (contextDialogKey) {
999
+ keyIdentity = parseDialogKey(contextDialogKey);
1000
+ if (!keyIdentity) {
1001
+ throw new Error(
1002
+ `${UNRESOLVED}\uFF1A\u6267\u884C\u4E0A\u4E0B\u6587\u91CC\u7684\u5BF9\u8BDD\u952E ${contextDialogKey} \u4E0D\u662F\u53EF\u89E3\u6790\u7684 dialog-<owner>-<id>\uFF0C\u4E0D\u4F1A\u6309 id \u731C\u5F52\u5C5E\u3002`
1003
+ );
1004
+ }
1005
+ if (contextDialogId && keyIdentity.dialogId !== contextDialogId) {
1006
+ throw new Error(
1007
+ `${UNRESOLVED}\uFF1A\u6267\u884C\u4E0A\u4E0B\u6587\u81EA\u76F8\u77DB\u76FE\u2014\u2014\u5BF9\u8BDD\u952E ${contextDialogKey} \u6307\u5411 ${keyIdentity.dialogId}\uFF0C\u4F46 dialogId \u662F ${contextDialogId}\u3002`
1008
+ );
1009
+ }
1010
+ }
1011
+ const dialogId = keyIdentity?.dialogId ?? contextDialogId;
1012
+ if (!dialogId) {
1013
+ throw new Error(
1014
+ `${UNRESOLVED}\uFF1A\u672C\u6B21\u5DE5\u5177\u8C03\u7528\u7F3A\u5C11\u6240\u5C5E\u5BF9\u8BDD\uFF08dialogId\uFF09\uFF0C\u4E0D\u4F1A\u6539\u7528\u5F53\u524D\u6253\u5F00\u7684\u5BF9\u8BDD\u6216\u89C6\u56FE Space\u3002`
1015
+ );
1016
+ }
1017
+ const matches = findLoadedDialogs(state, dialogId, contextDialogKey);
1018
+ if (matches.length === 0) {
1019
+ throw new Error(
1020
+ `${UNRESOLVED}\uFF1A\u5BF9\u8BDD ${dialogId} \u672A\u52A0\u8F7D\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5B83\u7684 Space \u5F52\u5C5E\u3002`
1021
+ );
1022
+ }
1023
+ if (matches.length > 1) {
1024
+ throw new Error(
1025
+ `${UNRESOLVED}\uFF1A\u52A0\u8F7D\u4E2D\u6709 ${matches.length} \u4E2A\u540C id \u7684\u5BF9\u8BDD\uFF08${matches.map((m) => m.key).join(" / ")}\uFF09\uFF0C\u4EC5\u51ED dialogId \u65E0\u6CD5\u786E\u5B9A\u5F52\u5C5E\uFF1B\u6267\u884C\u4E0A\u4E0B\u6587\u9700\u8981\u63D0\u4F9B\u5B8C\u6574\u5BF9\u8BDD\u952E\u3002`
1026
+ );
1027
+ }
1028
+ const [dialog] = matches;
1029
+ return {
1030
+ dialogId,
1031
+ agentKey: resolveDialogRuntimeAgentKey(
1032
+ dialog.record,
1033
+ agentKey
1034
+ ),
1035
+ spaceId: trimmed(dialog.record.spaceId)
1036
+ };
1037
+ }
1038
+
1039
+ // packages/ai/tools/loadSkillTool.ts
1040
+ var loadSkillFunctionSchema = {
1041
+ name: "loadSkill",
1042
+ description: [
1043
+ "\u6309\u540D\u79F0\u6216\u7CBE\u786E\u5F15\u7528\u52A0\u8F7D\u4E00\u4E2A skill \u6587\u6863\uFF0C\u8FD4\u56DE\u5176\u5B8C\u6574\u6307\u4EE4\u6B63\u6587\u3002",
1044
+ "name \u4F7F\u7528 skill \u4FDD\u5B58\u65F6\u5199\u5165 skill-config \u7684 name\uFF08\u4E5F\u63A5\u53D7 skillId\uFF09\u3002",
1045
+ "\u7CBE\u786E\u5F15\u7528\u4E0D\u4F20 name\uFF1Asource=space + dbKey\uFF0Csource=builtin + slug\uFF0C\u6216 source=project + projectBinding + relativePath\uFF1B\u5404\u7EC4\u5B57\u6BB5\u4E92\u65A5\uFF0C\u4E0D\u6DF7\u7528\u3002",
1046
+ "\u6267\u884C\u5668\u652F\u6301\u8303\u56F4\uFF1A\u670D\u52A1\u7AEF\u652F\u6301 space/builtin\uFF0C\u672C\u5730 CLI/desktop \u652F\u6301 builtin/project\uFF1BWeb \u5BA2\u6237\u7AEF\u652F\u6301 name \u4E0E space/builtin \u7CBE\u786E\u5F15\u7528\uFF0C\u4E0D\u652F\u6301 project\u3002",
1047
+ "\u627E\u4E0D\u5230\u5BF9\u5E94 skill \u65F6\u8FD4\u56DE\u5F53\u524D\u53EF\u7528\u7684 skill \u540D\u79F0\u5217\u8868\uFF08\u4E0D\u62A5\u9519\uFF09\uFF1B\u7CBE\u786E\u5F15\u7528\u4E0D\u56DE\u9000\u5230\u540C\u540D skill\u3002",
1048
+ '\u7CFB\u7EDF\u5185\u7F6E\u5199\u4EE3\u7801\u6280\u80FD\uFF1A\u5BF9\u8BDD\u8F6C\u5411\u5199\u4EE3\u7801\u65F6\u7528 loadSkill("coding") \u8F7D\u5165\u5199\u4EE3\u7801\u80FD\u529B\u4E0E\u4EE3\u7801\u5BA1\u67E5\u7EAA\u5F8B\uFF08\u542B review \u89D2\u8272\u5207\u5272\uFF09\u3002',
1049
+ "\u7CFB\u7EDF\u5185\u7F6E\u4E13\u804C\u6280\u80FD\uFF1Afeedback\uFF08\u53CD\u9988\u6536\u96C6\uFF09/ agent-creator\uFF08\u521B\u5EFA Agent\uFF09/ nolo-app\uFF08Nolo \u5E94\u7528\uFF09/ automation\uFF08\u81EA\u52A8\u5316\uFF09/ memory\uFF08\u8BB0\u5FC6\u7BA1\u7406\uFF09\uFF0C\u540C\u6837\u53EF\u76F4\u63A5 loadSkill \u8F7D\u5165\u3002"
1050
+ ].join("\n"),
1051
+ parameters: {
1052
+ type: "object",
1053
+ properties: {
1054
+ name: {
1055
+ type: "string",
1056
+ description: "\u65E7\u7248 skill \u540D\u79F0\uFF1B\u4E0D\u4E0E\u7CBE\u786E\u5F15\u7528\u5B57\u6BB5\u6DF7\u7528\u3002"
1057
+ },
1058
+ source: {
1059
+ type: "string",
1060
+ enum: ["space", "builtin", "project"],
1061
+ description: "\u7CBE\u786E\u6765\u6E90\uFF1Aspace \u9700 dbKey\uFF0Cbuiltin \u9700 slug\uFF0Cproject \u9700 projectBinding \u4E0E relativePath\uFF1B\u4E0D\u4F20 name\u3002Web \u5BA2\u6237\u7AEF\u652F\u6301 space/builtin\uFF0C\u4E0D\u652F\u6301 project\u3002"
1062
+ },
1063
+ dbKey: {
1064
+ type: "string",
1065
+ description: "\u7CBE\u786E skill \u6587\u6863 dbKey\uFF0C\u4EC5\u7528\u4E8E source=space\uFF1B\u5FC5\u987B\u5728\u5F53\u524D\u7528\u6237 membership \u53EF\u89C1\u7684 Space Skill \u7D22\u5F15\u4E2D\uFF08\u670D\u52A1\u7AEF\u6216 Web \u5BA2\u6237\u7AEF\u6267\u884C\uFF09\u3002"
1066
+ },
1067
+ slug: {
1068
+ type: "string",
1069
+ description: "\u7CBE\u786E\u5185\u7F6E skill slug\uFF0C\u4EC5\u7528\u4E8E source=builtin\u3002"
1070
+ },
1071
+ projectBinding: {
1072
+ type: "string",
1073
+ description: "\u4E0E\u6267\u884C\u5668\u6388\u6743 cwd \u5339\u914D\u7684\u9879\u76EE\u6839\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u4EC5\u7528\u4E8E source=project\uFF08\u672C\u5730\u6267\u884C\uFF09\u3002"
1074
+ },
1075
+ relativePath: {
1076
+ type: "string",
1077
+ description: "\u9879\u76EE .agents/skills/ \u5185 SKILL.md \u7684\u9879\u76EE\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u4EC5\u7528\u4E8E source=project\uFF08\u672C\u5730\u6267\u884C\uFF09\u3002"
1078
+ }
1079
+ }
1080
+ }
1081
+ };
1082
+ var getRuntime = (thunkApi) => {
1083
+ const state = thunkApi?.getState?.();
1084
+ return state ? selectRuntimeSnapshot(state) : null;
1085
+ };
1086
+ var authHeaders = (token) => token ? { Authorization: `Bearer ${token}` } : {};
1087
+ async function readRemoteRecord(args) {
1088
+ const serverBase = normalizeServerOrigin(args.serverBase);
1089
+ if (!serverBase || !args.token) return null;
1090
+ const response = await fetch(
1091
+ `${serverBase}/api/v1/db/read/${encodeURIComponent(args.dbKey)}?includeDeleted=true`,
1092
+ { headers: authHeaders(args.token) }
1093
+ );
1094
+ if (!response.ok) return null;
1095
+ const payload = await response.json().catch(() => null);
1096
+ return payload?.data ?? payload;
1097
+ }
1098
+ function resolveWebSkill(candidates, requestedName) {
1099
+ const candidate = matchSkillCandidate(candidates, requestedName);
1100
+ if (candidate) return { kind: "space", candidate };
1101
+ const entry = resolveBuiltinSkillByName(requestedName);
1102
+ return entry ? { kind: "builtin", entry } : null;
1103
+ }
1104
+ function listWebSkillNames(candidates) {
1105
+ return Array.from(
1106
+ /* @__PURE__ */ new Set([
1107
+ ...candidates.map((candidate) => candidate.name),
1108
+ ...listBuiltinSkills().flatMap((skill) => [skill.slug, skill.title])
1109
+ ])
1110
+ );
1111
+ }
1112
+ function matchSkillCandidate(candidates, requestedName) {
1113
+ return candidates.find(
1114
+ (candidate) => candidate.name === requestedName || candidate.skillId === requestedName
1115
+ );
1116
+ }
1117
+ function collectSkillCandidatesFromSpace(space) {
1118
+ if (!space?.contents || typeof space.contents !== "object") return [];
1119
+ const candidates = [];
1120
+ for (const [entryKey, value] of Object.entries(space.contents)) {
1121
+ if (!isRecord(value)) continue;
1122
+ const skillSummary = value.skillSummary;
1123
+ if (!isSkillSummaryMarker(skillSummary)) continue;
1124
+ const name = asTrimmedString(skillSummary.name);
1125
+ if (!name) continue;
1126
+ candidates.push({
1127
+ dbKey: entryKey,
1128
+ name,
1129
+ skillId: asOptionalTrimmedString(skillSummary.skillId) ?? void 0
1130
+ });
1131
+ }
1132
+ return candidates;
1133
+ }
1134
+ function extractSkillBody(page) {
1135
+ return parseSkillDocProtocol(page?.content ?? "").content;
1136
+ }
1137
+ async function listSkillCandidates(thunkApi) {
1138
+ const runtime = getRuntime(thunkApi);
1139
+ const serverBase = runtime?.currentServer;
1140
+ const token = runtime?.currentToken;
1141
+ const userId = runtime?.currentUserId;
1142
+ if (!serverBase || !token || !userId) return [];
1143
+ const membershipsResponse = await fetch(
1144
+ `${normalizeServerOrigin(serverBase)}/rpc/getUserSpaceMemberships`,
1145
+ {
1146
+ method: "POST",
1147
+ headers: {
1148
+ "Content-Type": "application/json",
1149
+ ...authHeaders(token)
1150
+ },
1151
+ body: JSON.stringify({ userId })
1152
+ }
1153
+ ).catch(() => null);
1154
+ if (!membershipsResponse?.ok) return [];
1155
+ const memberships = await membershipsResponse.json().catch(() => []);
1156
+ if (!Array.isArray(memberships)) return [];
1157
+ const candidates = [];
1158
+ for (const membership of memberships) {
1159
+ const spaceId = asTrimmedString(membership?.spaceId);
1160
+ if (!spaceId) continue;
1161
+ const space = await readRemoteRecord({
1162
+ serverBase,
1163
+ token,
1164
+ dbKey: createSpaceKey.space(spaceId)
1165
+ });
1166
+ if (!space) continue;
1167
+ candidates.push(...collectSkillCandidatesFromSpace(space));
1168
+ }
1169
+ return candidates;
1170
+ }
1171
+ var readCurrentAgentSkillSource = async (thunkApi, agentKey) => {
1172
+ if (!agentKey) return null;
1173
+ const db = thunkApi?.extra?.db;
1174
+ if (!db) return null;
1175
+ try {
1176
+ const agent = await db.get(agentKey);
1177
+ if (!agent || typeof agent !== "object") return null;
1178
+ return agent;
1179
+ } catch {
1180
+ return null;
1181
+ }
1182
+ };
1183
+ async function loadSkillFunc(args, thunkApi, context) {
1184
+ const hasArg = (key) => Object.prototype.hasOwnProperty.call(args ?? {}, key);
1185
+ const exact = ["source", "dbKey", "slug", "projectBinding", "relativePath"].some(hasArg);
1186
+ const source = args?.source;
1187
+ if (exact) {
1188
+ const validSpace = source === "space" && typeof args.dbKey === "string" && !!args.dbKey.trim() && !hasArg("slug") && !hasArg("projectBinding") && !hasArg("relativePath");
1189
+ const validBuiltin = source === "builtin" && typeof args.slug === "string" && !!args.slug.trim() && !hasArg("dbKey") && !hasArg("projectBinding") && !hasArg("relativePath");
1190
+ if (hasArg("name") || !validSpace && !validBuiltin) {
1191
+ throw new Error(source === "project" ? "loadSkill: source=project is not supported by the Web client." : "loadSkill: use name, source=space + dbKey, or source=builtin + slug exclusively.");
1192
+ }
1193
+ }
1194
+ let requestedName = asTrimmedString(exact ? source === "space" ? args.dbKey : args.slug : args?.name);
1195
+ if (!requestedName) throw new Error("loadSkill \u9700\u8981\u63D0\u4F9B name\u3002");
1196
+ const state = thunkApi.getState();
1197
+ const attribution = resolveToolAttributionContext(state, context, {
1198
+ requireAgentKey: false,
1199
+ errorLabel: "loadSkill: \u65E0\u6CD5\u786E\u5B9A\u5F52\u5C5E"
1200
+ });
1201
+ const dialogKey = context?.dialogKey?.trim() || Object.entries(selectEntities(state)).find(
1202
+ ([key, record]) => isDialogRecordKeyForId(key, attribution.dialogId) && record?.id?.trim() === attribution.dialogId
1203
+ )?.[0];
1204
+ const candidates = await listSkillCandidates(thunkApi);
1205
+ let resolution;
1206
+ if (!exact) {
1207
+ resolution = resolveWebSkill(candidates, requestedName);
1208
+ } else if (source === "space") {
1209
+ const candidate = candidates.find((entry) => entry.dbKey === requestedName);
1210
+ resolution = candidate ? { kind: "space", candidate } : null;
1211
+ } else {
1212
+ const entry = listBuiltinSkills().find((entry2) => entry2.slug === requestedName);
1213
+ resolution = entry ? { kind: "builtin", entry } : null;
1214
+ }
1215
+ const matched = resolution?.kind === "space" ? resolution.candidate : void 0;
1216
+ if (exact && matched) requestedName = matched.name;
1217
+ const builtinEntry = resolution?.kind === "builtin" ? resolution.entry : null;
1218
+ const resolvedSlug = builtinEntry?.slug ?? matched?.skillId ?? null;
1219
+ if (resolvedSlug) {
1220
+ const agentSkillSource = await readCurrentAgentSkillSource(thunkApi, attribution.agentKey);
1221
+ if (agentSkillSource && isAgentSkillDisabled(agentSkillSource, resolvedSlug)) {
1222
+ return {
1223
+ rawData: {
1224
+ success: false,
1225
+ name: requestedName,
1226
+ slug: resolvedSlug,
1227
+ disabled: true
1228
+ },
1229
+ displayData: `Skill "${requestedName}" \u5DF2\u88AB\u7981\u7528\uFF1A\u8BE5\u80FD\u529B\u5728\u6B64 agent \u4E0A\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u52A0\u8F7D\u3002`
1230
+ };
1231
+ }
1232
+ }
1233
+ if (builtinEntry) {
1234
+ const body2 = builtinEntry.content;
1235
+ const dbKey = builtinEntry.slug;
1236
+ if (context?.skipSkillReferencePersist !== true) {
1237
+ await persistLoadedSkillReference(thunkApi, dialogKey, dbKey, requestedName);
1238
+ }
1239
+ return {
1240
+ rawData: {
1241
+ success: true,
1242
+ name: requestedName,
1243
+ dbKey,
1244
+ body: body2
1245
+ },
1246
+ displayData: `Skill "${requestedName}" loaded inline. Follow its instructions.
1247
+
1248
+ ${body2}`
1249
+ };
1250
+ }
1251
+ if (!matched) {
1252
+ const availableNames = listWebSkillNames(candidates);
1253
+ const availableText = availableNames.length ? availableNames.join(", ") : "(none)";
1254
+ return {
1255
+ rawData: {
1256
+ success: false,
1257
+ name: requestedName,
1258
+ availableSkills: availableNames
1259
+ },
1260
+ displayData: `Skill "${requestedName}" not found. Available skills: ${availableText}`
1261
+ };
1262
+ }
1263
+ const runtime = getRuntime(thunkApi);
1264
+ const page = await readRemoteRecord({
1265
+ serverBase: runtime?.currentServer,
1266
+ token: runtime?.currentToken,
1267
+ dbKey: matched.dbKey
1268
+ });
1269
+ if (exact && !page) {
1270
+ return {
1271
+ rawData: { success: false, name: requestedName, dbKey: matched.dbKey },
1272
+ displayData: `Skill "${requestedName}" could not be read.`
1273
+ };
1274
+ }
1275
+ const body = extractSkillBody(page);
1276
+ if (context?.skipSkillReferencePersist !== true) {
1277
+ await persistLoadedSkillReference(thunkApi, dialogKey, matched.dbKey, requestedName);
1278
+ }
1279
+ return {
1280
+ rawData: {
1281
+ success: true,
1282
+ name: requestedName,
1283
+ dbKey: matched.dbKey,
1284
+ body
1285
+ },
1286
+ displayData: `Skill "${requestedName}" loaded inline. Follow its instructions.
1287
+
1288
+ ${body}`
1289
+ };
1290
+ }
1291
+ async function persistLoadedSkillReference(thunkApi, currentDialogKey, dbKey, name) {
1292
+ try {
1293
+ const state = thunkApi?.getState?.();
1294
+ if (!state || !currentDialogKey) return;
1295
+ const dialogConfig = selectById(
1296
+ state,
1297
+ currentDialogKey
1298
+ );
1299
+ const existing = dialogConfig?.extraReferences ?? [];
1300
+ const alreadyMounted = existing.some((ref) => ref.dbKey === dbKey);
1301
+ if (alreadyMounted) return;
1302
+ const newRef = {
1303
+ dbKey,
1304
+ title: name,
1305
+ type: "instruction"
1306
+ };
1307
+ await setDialogExtraReferencesAction([...existing, newRef], thunkApi, currentDialogKey);
1308
+ } catch {
1309
+ }
1310
+ }
1311
+
1312
+ // packages/ai/tools/uiCardSchema.ts
1313
+ var UI_CARD_VERSION = 1;
1314
+ var MAX_BLOCKS = 32;
1315
+ var MAX_TEXT_BYTES = 2e4;
1316
+ var UI_CARD_MAX_BYTES = 1e5;
1317
+ var UI_CARD_ENVELOPE_MAX_BYTES = UI_CARD_MAX_BYTES + 4096;
1318
+ var MAX_COLLECTION_ITEMS = 500;
1319
+ var MAX_JSON_DEPTH = 12;
1320
+ var MAX_JSON_NODES = 2e3;
1321
+ var UI_STABLE_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
1322
+ function isRecord2(value) {
1323
+ return value !== null && typeof value === "object" && !Array.isArray(value);
1324
+ }
1325
+ function hasOnlyKeys(value, allowed) {
1326
+ return Object.keys(value).every((key) => allowed.includes(key));
1327
+ }
1328
+ function isText(value) {
1329
+ return typeof value === "string" && new TextEncoder().encode(value).byteLength <= MAX_TEXT_BYTES;
1330
+ }
1331
+ function isStringArray(value, max = MAX_COLLECTION_ITEMS) {
1332
+ return Array.isArray(value) && value.length <= max && value.every(isText);
1333
+ }
1334
+ function isJsonValue(value, depth, budget) {
1335
+ budget.nodes += 1;
1336
+ if (budget.nodes > MAX_JSON_NODES || depth > MAX_JSON_DEPTH) return false;
1337
+ if (value === null || typeof value === "boolean") return true;
1338
+ if (typeof value === "string") return isText(value);
1339
+ if (typeof value === "number") return Number.isFinite(value);
1340
+ if (Array.isArray(value)) return value.every((item) => isJsonValue(item, depth + 1, budget));
1341
+ if (!isRecord2(value)) return false;
1342
+ for (const [key, item] of Object.entries(value)) {
1343
+ if (["$ref", "$expr", "expression", "script"].includes(key)) return false;
1344
+ if (!isText(key) || !isJsonValue(item, depth + 1, budget)) return false;
1345
+ }
1346
+ return true;
1347
+ }
1348
+ function isChoiceQuestion(value) {
1349
+ if (!isRecord2(value) || !hasOnlyKeys(value, ["id", "header", "question", "choices", "multiSelect", "allowOther", "required"])) return false;
1350
+ if (!isText(value.id) || !value.id.trim() || !isText(value.question) || !value.question.trim()) return false;
1351
+ if (value.header !== void 0 && !isText(value.header)) return false;
1352
+ for (const flag of ["multiSelect", "allowOther", "required"]) {
1353
+ if (value[flag] !== void 0 && typeof value[flag] !== "boolean") return false;
1354
+ }
1355
+ if (!Array.isArray(value.choices) || value.choices.length === 0 || value.choices.length > MAX_COLLECTION_ITEMS) return false;
1356
+ const ids = /* @__PURE__ */ new Set();
1357
+ for (const option of value.choices) {
1358
+ if (!isRecord2(option) || !hasOnlyKeys(option, ["id", "label", "detail", "recommended", "userMessage"])) return false;
1359
+ if (!isText(option.label) || !option.label.trim()) return false;
1360
+ if (option.id !== void 0) {
1361
+ if (!isText(option.id) || !option.id.trim() || ids.has(option.id)) return false;
1362
+ ids.add(option.id);
1363
+ }
1364
+ if (option.detail !== void 0 && !isText(option.detail)) return false;
1365
+ if (option.userMessage !== void 0 && !isText(option.userMessage)) return false;
1366
+ if (option.recommended !== void 0 && typeof option.recommended !== "boolean") return false;
1367
+ }
1368
+ return true;
1369
+ }
1370
+ function isAppUrl(value) {
1371
+ try {
1372
+ const parsed = new URL(value);
1373
+ const hasWebProtocol = parsed.protocol === "http:" || parsed.protocol === "https:";
1374
+ const authority = value.slice(value.indexOf("//") + 2).split(/[/?#]/, 1)[0];
1375
+ return hasWebProtocol && authority.length > 0 && parsed.hostname.length > 0;
1376
+ } catch {
1377
+ return false;
1378
+ }
1379
+ }
1380
+ function isBlock(value) {
1381
+ if (!isRecord2(value) || typeof value.type !== "string") return false;
1382
+ switch (value.type) {
1383
+ case "text":
1384
+ return hasOnlyKeys(value, ["type", "text"]) && isText(value.text);
1385
+ case "metric":
1386
+ return hasOnlyKeys(value, ["type", "label", "value", "detail"]) && isText(value.label) && isText(value.value) && (value.detail === void 0 || isText(value.detail));
1387
+ case "list":
1388
+ return hasOnlyKeys(value, ["type", "title", "items"]) && (value.title === void 0 || isText(value.title)) && isStringArray(value.items);
1389
+ case "table": {
1390
+ const columns = value.columns;
1391
+ const rows = value.rows;
1392
+ return hasOnlyKeys(value, ["type", "columns", "rows"]) && isStringArray(columns, 50) && columns.length > 0 && Array.isArray(rows) && rows.length <= MAX_COLLECTION_ITEMS && rows.every((row) => isStringArray(row, 50) && row.length === columns.length);
1393
+ }
1394
+ case "choice":
1395
+ return hasOnlyKeys(value, ["type", "question"]) && isChoiceQuestion(value.question);
1396
+ case "action": {
1397
+ if (!isRecord2(value.action) || typeof value.action.type !== "string") return false;
1398
+ if (value.action.type === "submit") {
1399
+ if (!hasOnlyKeys(value, ["type", "action"]) || !hasOnlyKeys(value.action, ["type", "payload"])) return false;
1400
+ if (value.action.payload === void 0) return true;
1401
+ return isRecord2(value.action.payload) && isJsonValue(value.action.payload, 0, { nodes: 0 });
1402
+ }
1403
+ if (value.action.type === "openApp") {
1404
+ return hasOnlyKeys(value, ["type", "action"]) && hasOnlyKeys(value.action, ["type", "appId", "url"]) && isText(value.action.appId) && !!value.action.appId.trim() && (value.action.url === void 0 || isText(value.action.url) && isAppUrl(value.action.url));
1405
+ }
1406
+ if (value.action.type === "sendMessage") {
1407
+ return hasOnlyKeys(value, ["type", "action"]) && hasOnlyKeys(value.action, ["type", "id", "label", "userMessage"]) && typeof value.action.id === "string" && UI_STABLE_ID_PATTERN.test(value.action.id) && isText(value.action.label) && !!value.action.label.trim() && isText(value.action.userMessage) && !!value.action.userMessage.trim();
1408
+ }
1409
+ return false;
1410
+ }
1411
+ default:
1412
+ return false;
1413
+ }
1414
+ }
1415
+ function parseUiCard(input) {
1416
+ if (!isRecord2(input) || !hasOnlyKeys(input, ["id", "version", "source", "blocks"])) return { ok: false, error: "invalid card shape" };
1417
+ if (typeof input.id !== "string" || !UI_STABLE_ID_PATTERN.test(input.id)) return { ok: false, error: "invalid card id" };
1418
+ if (input.version !== UI_CARD_VERSION || input.source !== "tool") return { ok: false, error: "unsupported card version or source" };
1419
+ if (!Array.isArray(input.blocks) || input.blocks.length > MAX_BLOCKS || !input.blocks.every(isBlock)) return { ok: false, error: "invalid blocks" };
1420
+ const sendMessages = input.blocks.filter((block) => block.type === "action" && block.action.type === "sendMessage");
1421
+ if (sendMessages.length > 1) return { ok: false, error: "at most one sendMessage action per card" };
1422
+ if (sendMessages.length === 1 && input.blocks.some((block) => block.type === "choice")) return { ok: false, error: "sendMessage action cannot be combined with choice blocks" };
1423
+ try {
1424
+ if (new TextEncoder().encode(JSON.stringify(input)).byteLength > UI_CARD_MAX_BYTES) return { ok: false, error: "card too large" };
1425
+ } catch {
1426
+ return { ok: false, error: "unserializable card" };
1427
+ }
1428
+ return { ok: true, value: input };
1429
+ }
1430
+ function uiCardFallback(card) {
1431
+ return card.blocks.map((block) => {
1432
+ switch (block.type) {
1433
+ case "text":
1434
+ return block.text;
1435
+ case "metric":
1436
+ return `${block.label}: ${block.value}${block.detail ? ` (${block.detail})` : ""}`;
1437
+ case "list":
1438
+ return `${block.title ? `${block.title}
1439
+ ` : ""}${block.items.map((item) => `- ${item}`).join("\n")}`;
1440
+ case "table":
1441
+ return [block.columns.join(" | "), ...block.rows.map((row) => row.join(" | "))].join("\n");
1442
+ case "choice":
1443
+ return `${block.question.question}
1444
+ ${block.question.choices.map((item) => `- ${item.label}${item.detail ? ` \u2014 ${item.detail}` : ""}`).join("\n")}`;
1445
+ case "action": {
1446
+ if (block.action.type === "submit") return `Submit action (not executed): ${block.action.payload === void 0 ? "{}" : JSON.stringify(block.action.payload)}`;
1447
+ if (block.action.type === "sendMessage") {
1448
+ const { label, userMessage } = block.action;
1449
+ return `Send message (plain user message only, not executed): ${label}${userMessage === label ? "" : ` \u2014 ${userMessage}`}`;
1450
+ }
1451
+ return `Open app (not authorized): ${block.action.appId}${block.action.url ? ` (${block.action.url})` : ""}`;
1452
+ }
1453
+ }
1454
+ }).join("\n\n");
1455
+ }
1456
+
1457
+ // packages/core/clipMultilineText.ts
1458
+ function clipMultilineText(value, max) {
1459
+ const trimmed2 = value.trim();
1460
+ if (trimmed2.length <= max) return trimmed2;
1461
+ return `${trimmed2.slice(0, max)}
1462
+ ...[truncated ${trimmed2.length - max} chars]`;
1463
+ }
1464
+
1465
+ // packages/render/table/utils/tableSerialization.ts
1466
+ var fetchAndSerializeTable = async (tableMeta, db, options = {}) => {
1467
+ const tenantId = tableMeta.tenantId;
1468
+ const tableId = tableMeta.tableId;
1469
+ const results = await fetchAndCacheTableRows({
1470
+ db,
1471
+ tenantId,
1472
+ tableId,
1473
+ token: options.token,
1474
+ remoteServers: options.remoteServers ?? []
1475
+ });
1476
+ const columns = tableMeta.columns || [];
1477
+ const headerRow = columns.map((c) => c.label || c.name);
1478
+ const separatorRow = columns.map(() => "---");
1479
+ let tableMd = "";
1480
+ if (columns.length > 0) {
1481
+ tableMd = `| ${headerRow.join(" | ")} |
1482
+ | ${separatorRow.join(" | ")} |
1483
+ `;
1484
+ results.forEach((row) => {
1485
+ const rowData = columns.map((col) => {
1486
+ const val = row[col.name];
1487
+ return val === void 0 || val === null ? "" : String(val).replace(/\|/g, "\\|");
1488
+ });
1489
+ tableMd += `| ${rowData.join(" | ")} |
1490
+ `;
1491
+ });
1492
+ } else {
1493
+ tableMd = "(No columns defined for this table)";
1494
+ }
1495
+ return { rows: results, markdown: tableMd };
1496
+ };
1497
+
1498
+ // packages/ai/tools/toolResultError.ts
1499
+ var ToolResultError = class extends Error {
1500
+ code;
1501
+ rawData;
1502
+ displayData;
1503
+ retryable;
1504
+ constructor(message, options) {
1505
+ super(message);
1506
+ this.name = "ToolResultError";
1507
+ this.code = options?.code;
1508
+ this.rawData = options?.rawData;
1509
+ this.displayData = options?.displayData;
1510
+ this.retryable = options?.retryable;
1511
+ }
1512
+ };
1513
+ var getToolResultErrorData = (error) => {
1514
+ if (!error || typeof error !== "object") return null;
1515
+ const candidate = error;
1516
+ return {
1517
+ rawData: candidate.rawData,
1518
+ displayData: candidate.displayData,
1519
+ code: candidate.code,
1520
+ retryable: candidate.retryable,
1521
+ message: candidate.message
1522
+ };
1523
+ };
1524
+
1525
+ // packages/ai/tools/toolRunStore.ts
1526
+ var import_react = __toESM(require_react());
1527
+ var createToolRunId = () => `toolrun_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
1528
+ var runsById = /* @__PURE__ */ new Map();
1529
+ var listeners2 = /* @__PURE__ */ new Set();
1530
+ var version = 0;
1531
+ var notify2 = () => {
1532
+ version += 1;
1533
+ for (const listener of listeners2) {
1534
+ try {
1535
+ listener();
1536
+ } catch {
1537
+ }
1538
+ }
1539
+ };
1540
+ function toolRunStarted(payload) {
1541
+ const {
1542
+ id,
1543
+ messageId,
1544
+ toolName,
1545
+ behavior,
1546
+ inputSummary,
1547
+ startedAt,
1548
+ interaction,
1549
+ input
1550
+ } = payload;
1551
+ runsById.set(id, {
1552
+ id,
1553
+ messageId,
1554
+ toolName,
1555
+ behavior,
1556
+ inputSummary,
1557
+ status: "running",
1558
+ startedAt: startedAt ?? Date.now(),
1559
+ interaction,
1560
+ input,
1561
+ error: void 0,
1562
+ finishedAt: void 0,
1563
+ outputSummary: void 0,
1564
+ steps: void 0
1565
+ });
1566
+ notify2();
1567
+ }
1568
+ function toolRunSetPending(payload) {
1569
+ const { id } = payload;
1570
+ const run = runsById.get(id);
1571
+ if (run) {
1572
+ run.status = "pending";
1573
+ notify2();
1574
+ }
1575
+ }
1576
+ function toolRunSucceeded(payload) {
1577
+ const { id, outputSummary, steps, finishedAt } = payload;
1578
+ const run = runsById.get(id);
1579
+ if (run) {
1580
+ run.status = "succeeded";
1581
+ run.outputSummary = outputSummary;
1582
+ if (steps !== void 0) {
1583
+ run.steps = steps;
1584
+ }
1585
+ run.finishedAt = finishedAt ?? Date.now();
1586
+ notify2();
1587
+ }
1588
+ }
1589
+ function toolRunUpdated(payload) {
1590
+ const { id, outputSummary, steps } = payload;
1591
+ const run = runsById.get(id);
1592
+ if (run) {
1593
+ if (outputSummary !== void 0) {
1594
+ run.outputSummary = outputSummary;
1595
+ }
1596
+ if (steps !== void 0) {
1597
+ run.steps = steps;
1598
+ }
1599
+ notify2();
1600
+ }
1601
+ }
1602
+ function toolRunFailed(payload) {
1603
+ const { id, error, outputSummary, steps, finishedAt } = payload;
1604
+ const run = runsById.get(id);
1605
+ if (run) {
1606
+ run.status = "failed";
1607
+ run.error = error;
1608
+ if (outputSummary !== void 0) {
1609
+ run.outputSummary = outputSummary;
1610
+ }
1611
+ if (steps !== void 0) {
1612
+ run.steps = steps;
1613
+ }
1614
+ run.finishedAt = finishedAt ?? Date.now();
1615
+ notify2();
1616
+ }
1617
+ }
1618
+ function getAllToolRuns() {
1619
+ return Array.from(runsById.values()).sort((a, b) => a.startedAt - b.startedAt);
1620
+ }
1621
+ function getToolRunById(id) {
1622
+ return runsById.get(id);
1623
+ }
1624
+ var executeToolRun = createAsyncThunk(
1625
+ "toolRun/executeToolRun",
1626
+ async ({ id, inputOverride }, thunkApi) => {
1627
+ const run = getToolRunById(id);
1628
+ if (!run) {
1629
+ throw new Error(`ToolRun not found: ${id}`);
1630
+ }
1631
+ const executionInput = inputOverride ?? run.input;
1632
+ if (!executionInput) {
1633
+ throw new Error(`ToolRun ${id} has no input to execute with.`);
1634
+ }
1635
+ const { findToolExecutor } = await import("./tools-UMCPIQX6.js");
1636
+ const { executor } = findToolExecutor(run.toolName);
1637
+ toolRunStarted({
1638
+ id: run.id,
1639
+ messageId: run.messageId,
1640
+ toolName: run.toolName,
1641
+ behavior: run.behavior,
1642
+ inputSummary: run.inputSummary,
1643
+ startedAt: Date.now(),
1644
+ interaction: run.interaction,
1645
+ input: executionInput
1646
+ });
1647
+ try {
1648
+ const result = await executor(executionInput, thunkApi, {
1649
+ parentMessageId: run.messageId
1650
+ });
1651
+ toolRunSucceeded({
1652
+ id: run.id,
1653
+ outputSummary: result?.displayData || ""
1654
+ });
1655
+ if (run.toolName === "deleteSpaces") {
1656
+ const latestState = thunkApi.getState();
1657
+ const userId = selectIdentityUserId(latestState);
1658
+ if (userId) {
1659
+ const { fetchUserSpaceMemberships } = await import("./memberThunks-FJW4GPM5.js");
1660
+ await thunkApi.dispatch(fetchUserSpaceMemberships(userId));
1661
+ }
1662
+ }
1663
+ return {
1664
+ id: run.id,
1665
+ rawData: result?.rawData,
1666
+ displayData: result?.displayData
1667
+ };
1668
+ } catch (e) {
1669
+ const msg = toErrorMessage(e);
1670
+ const structured = getToolResultErrorData(e);
1671
+ toolRunFailed({
1672
+ id: run.id,
1673
+ error: msg,
1674
+ outputSummary: asOptionalTrimmedString(structured?.displayData)
1675
+ });
1676
+ throw e;
1677
+ }
1678
+ }
1679
+ );
1680
+
1681
+ export {
1682
+ UI_CARD_ENVELOPE_MAX_BYTES,
1683
+ parseUiCard,
1684
+ uiCardFallback,
1685
+ toJsonSchema,
1686
+ ZOHO_MAIL_TOOL_NAMES,
1687
+ ZOHO_MAIL_TOOL_SCHEMAS,
1688
+ targetForRunKind,
1689
+ pushGate,
1690
+ clearGateTurn,
1691
+ getSnapshot,
1692
+ resolveGate,
1693
+ createSSEParser,
1694
+ waitForAbortableDelay,
1695
+ clipMultilineText,
1696
+ fetchAndSerializeTable,
1697
+ ToolResultError,
1698
+ getToolResultErrorData,
1699
+ createToolRunId,
1700
+ toolRunStarted,
1701
+ toolRunSetPending,
1702
+ toolRunSucceeded,
1703
+ toolRunUpdated,
1704
+ toolRunFailed,
1705
+ getAllToolRuns,
1706
+ resolveMemoryToolContext,
1707
+ resolveToolAttributionContext,
1708
+ loadSkillFunctionSchema,
1709
+ loadSkillFunc
1710
+ };