nolo-cli 0.264.0-alpha.2 → 0.266.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 (538) hide show
  1. package/{chunk-LXP53WGF.js → chunk-05wkntba.js} +44 -40
  2. package/{chunk-XFYFMTOM.js → chunk-08ts2q1n.js} +9 -11
  3. package/{chromeCommands-MVEEIY4R.js → chunk-0a3m1n6h.js} +182 -238
  4. package/chunk-0gfvc7g8.js +13 -0
  5. package/{chunk-CF7PE763.js → chunk-0h0sncy4.js} +3 -4
  6. package/{chunk-3UH7SS4W.js → chunk-0nsxwrge.js} +232 -241
  7. package/chunk-0ra8cne4.js +11 -0
  8. package/{chunk-MRACVEPZ.js → chunk-0sgwk7am.js} +1 -3
  9. package/{chunk-PEXGRTTQ.js → chunk-0tsfn0dk.js} +44 -45
  10. package/{chunk-WOAZVUSN.js → chunk-0y8cbwzy.js} +26 -30
  11. package/chunk-12gz55kk.js +6 -0
  12. package/{chunk-GLKOYSRU.js → chunk-186gshgw.js} +3 -6
  13. package/chunk-19w4ss38.js +44 -0
  14. package/{chunk-RF576RYE.js → chunk-1cakzp6r.js} +23 -23
  15. package/chunk-1fbfwbzp.js +27 -0
  16. package/{chunk-4IVMDQBA.js → chunk-1fv9k8zt.js} +103 -68
  17. package/{chunk-Q5FJJ6XI.js → chunk-1js4cdzp.js} +11 -19
  18. package/{chunk-YECCIUYU.js → chunk-1nhx0er5.js} +63 -63
  19. package/chunk-1p152b7g.js +12 -0
  20. package/{chunk-HXEO5DNV.js → chunk-1ynbq3yr.js} +322 -353
  21. package/{chunk-6UBGXX2W.js → chunk-1zrg4h5n.js} +3 -4
  22. package/{chunk-Y5GCAMGP.js → chunk-2g6zsfq8.js} +1 -3
  23. package/chunk-2hekb0eh.js +17 -0
  24. package/chunk-2pj6qzq5.js +12 -0
  25. package/chunk-2tvd4jyp.js +226 -0
  26. package/chunk-2ygg7azv.js +846 -0
  27. package/chunk-33405wtv.js +50 -0
  28. package/chunk-34axejtd.js +30 -0
  29. package/{tableCommands-FCPDULSU.js → chunk-3700dvt3.js} +224 -276
  30. package/{pdf-KE3QI2V7.js → chunk-3j08t1nm.js} +12505 -10133
  31. package/chunk-3j9gq18v.js +111 -0
  32. package/{chunk-LYPJYBE5.js → chunk-3qfpcdkm.js} +486 -505
  33. package/{settingThunks-PNC7ZISV.js → chunk-3r2x7h64.js} +189 -272
  34. package/{agentGrantCommands-2VLLXGIU.js → chunk-3tbj5fxt.js} +61 -56
  35. package/chunk-40whhjj5.js +168 -0
  36. package/chunk-4301919y.js +7 -0
  37. package/chunk-43adz39e.js +77 -0
  38. package/{chunk-5ZUL4CUO.js → chunk-49v3zc4g.js} +1 -3
  39. package/chunk-4dd7mxkb.js +72 -0
  40. package/{chunk-BKP325XS.js → chunk-4hapfzpq.js} +66 -62
  41. package/chunk-4mm7dz0m.js +95 -0
  42. package/chunk-4pqxempz.js +440 -0
  43. package/chunk-4x9zf5pv.js +10 -0
  44. package/{chunk-CA7LGAHV.js → chunk-511q8qzv.js} +66 -57
  45. package/{chunk-U7OULUMF.js → chunk-53v9g0np.js} +49 -64
  46. package/chunk-572mg6q5.js +19 -0
  47. package/{chunk-QAW6BEWQ.js → chunk-57eyhmwr.js} +17173 -16165
  48. package/chunk-5hsr0zjm.js +156 -0
  49. package/chunk-5k883yyd.js +20 -0
  50. package/chunk-5m0wsee4.js +639 -0
  51. package/{memberThunks-NEZRAW5K.js → chunk-5r1sq2gt.js} +299 -373
  52. package/chunk-648rq4np.js +255 -0
  53. package/{chunk-IYRZKHA6.js → chunk-666yjw5c.js} +63 -86
  54. package/{chunk-4O22PGNQ.js → chunk-6cdcbmtp.js} +19 -19
  55. package/chunk-6dbyqcf7.js +59 -0
  56. package/{agentProviderCommands-2W3VXDLV.js → chunk-6e8mgp1x.js} +82 -105
  57. package/chunk-6n0pw7sx.js +44 -0
  58. package/chunk-6q1b7381.js +361 -0
  59. package/chunk-6sj756ry.js +23 -0
  60. package/{chunk-4UNN45DS.js → chunk-6t7a7zck.js} +14785 -14454
  61. package/chunk-6yarwtxh.js +776 -0
  62. package/chunk-708h542p.js +18 -0
  63. package/chunk-76f076t8.js +266 -0
  64. package/chunk-782rrrwv.js +523 -0
  65. package/{workloadLifecycle-P2SJVV3S.js → chunk-7gk330wp.js} +77 -84
  66. package/{chunk-EZKIRVLJ.js → chunk-7ks60vxy.js} +146 -128
  67. package/{chunk-FI4DPLR7.js → chunk-7mrqbxe8.js} +342 -228
  68. package/chunk-7sztayrd.js +169 -0
  69. package/chunk-7vgt2mxz.js +15 -0
  70. package/{localFirstLog-OIETGK66.js → chunk-7z8y4k6y.js} +0 -2
  71. package/{chunk-KDDXC2IH.js → chunk-82htft2m.js} +49 -11
  72. package/{updateDialogTitleAction-XOSLNRT3.js → chunk-88vrtxxg.js} +65 -137
  73. package/{chunk-LS5KAVFQ.js → chunk-8dtjbp79.js} +293 -229
  74. package/chunk-8fajbkaz.js +50 -0
  75. package/chunk-8m1ebxpw.js +65 -0
  76. package/{accountResolver-JYG5L7YP.js → chunk-8mgfeg0w.js} +37 -30
  77. package/{chunk-LPXBBC32.js → chunk-8myksy35.js} +156 -160
  78. package/{chunk-BMQ2MJUK.js → chunk-8nrj7dc7.js} +75 -66
  79. package/{commandRegistry-ENNFT77C.js → chunk-8t8x64ec.js} +228 -286
  80. package/chunk-8yj4pq79.js +458 -0
  81. package/{chunk-5MKPNTJP.js → chunk-8z6pepcx.js} +43 -48
  82. package/{chunk-UYQILGDR.js → chunk-90egc9vb.js} +122 -102
  83. package/{chunk-EODBQPRM.js → chunk-91q5dc5r.js} +10 -14
  84. package/{chunk-U6VC4MU4.js → chunk-96jtrqk1.js} +2 -4
  85. package/{chunk-H57T64RA.js → chunk-996j61av.js} +28 -31
  86. package/{chunk-Q6FKWH66.js → chunk-9cxgb9jy.js} +137 -243
  87. package/{chunk-2ZBPWX7N.js → chunk-9q1gbmet.js} +62 -104
  88. package/chunk-9qtjh73q.js +344 -0
  89. package/{chunk-SR57FDTX.js → chunk-9raka469.js} +72 -155
  90. package/{chunk-V6K5U4YE.js → chunk-9vh4v046.js} +32 -41
  91. package/{chunk-AGIM7IMJ.js → chunk-9yr1fy7j.js} +14 -49
  92. package/{chunk-FGFJUFPS.js → chunk-a16x0wt6.js} +11 -18
  93. package/chunk-a5b2rvzs.js +131 -0
  94. package/{chunk-7DPNBQSV.js → chunk-a7bz6nc3.js} +3 -4
  95. package/chunk-ac85azv9.js +29 -0
  96. package/{chunk-VXL2FZTP.js → chunk-ahhbkad4.js} +16 -20
  97. package/{chunk-37DGW762.js → chunk-anhksj2j.js} +16 -29
  98. package/{cliAuthorityBrokerServer-27C5YBYP.js → chunk-atvmx76t.js} +180 -186
  99. package/{chunk-E6A5NHDH.js → chunk-av2mzeqz.js} +16 -17
  100. package/chunk-avbwrb0z.js +614 -0
  101. package/chunk-avr6rqe5.js +544 -0
  102. package/{workContextQueryProjection-CACY5VFE.js → chunk-axx60d5a.js} +7 -7
  103. package/{chunk-EWQ3HGNZ.js → chunk-b00vzjkb.js} +30 -23
  104. package/chunk-b0m6ezxr.js +132 -0
  105. package/chunk-bbd5mgdt.js +47 -0
  106. package/chunk-bcecft0r.js +28 -0
  107. package/chunk-beyr4pyp.js +33 -0
  108. package/{chunk-BR3GT6MR.js → chunk-bge0cagn.js} +7 -18
  109. package/{offlineMarxistsAgentCommand-MFURGWHL.js → chunk-bh53zg3t.js} +33 -43
  110. package/chunk-bmx1cw89.js +37 -0
  111. package/chunk-br2195h4.js +22 -0
  112. package/chunk-bsqkwveq.js +56 -0
  113. package/{chunk-QAU6KM2U.js → chunk-c09s2z1m.js} +139 -98
  114. package/chunk-c235kypv.js +24636 -0
  115. package/{chunk-2JMYAH5O.js → chunk-c30j6pyh.js} +213 -256
  116. package/chunk-c3v6r6sq.js +29 -0
  117. package/{chunk-PDSXYHNI.js → chunk-c5z7qspt.js} +1177 -1196
  118. package/{chunk-GWB6AGME.js → chunk-c6jvz0mp.js} +34 -50
  119. package/{chunk-PRJ473FK.js → chunk-cd6h9qqs.js} +14 -12
  120. package/chunk-cdt0amyy.js +37 -0
  121. package/{chunk-2AJLG6PY.js → chunk-cfh6tfc3.js} +73 -86
  122. package/{chunk-WIVVNJUS.js → chunk-ch4ck1yz.js} +38 -68
  123. package/chunk-chtvrtp5.js +55 -0
  124. package/{chunk-EYLGAEB4.js → chunk-ckvz7abv.js} +170 -165
  125. package/{chunk-YZMNK53S.js → chunk-csf18m5w.js} +32 -25
  126. package/{chunk-C36L6ZID.js → chunk-cwnvf8dt.js} +2 -10
  127. package/chunk-cy7thb6n.js +19877 -0
  128. package/{dialogPortabilityCommands-YQJNB2KL.js → chunk-d61q9nah.js} +439 -487
  129. package/chunk-d6xdy0gp.js +142 -0
  130. package/{chunk-EBH4RFJ6.js → chunk-dh69vqbd.js} +6390 -6496
  131. package/{chunk-KJ4J2XQB.js → chunk-dj4ggbc6.js} +17 -19
  132. package/{chunk-LISC7BD4.js → chunk-djrrhbk3.js} +29 -37
  133. package/chunk-drqzzzvr.js +822 -0
  134. package/chunk-e1n7edjk.js +33 -0
  135. package/chunk-e3atr4hk.js +59 -0
  136. package/chunk-e9bn2aav.js +13 -0
  137. package/chunk-ed396rfq.js +87 -0
  138. package/chunk-eha8ggh6.js +10 -0
  139. package/{chunk-MALPQFGT.js → chunk-ek122zzt.js} +893 -948
  140. package/chunk-epnmvek4.js +22 -0
  141. package/{chunk-S25VJYXV.js → chunk-eqzvk3xm.js} +69 -80
  142. package/chunk-ex34n71b.js +2874 -0
  143. package/{chunk-56OAS5RZ.js → chunk-f3ad6q4h.js} +7 -11
  144. package/{chunk-3PVYUPXK.js → chunk-f8jepva1.js} +6 -7
  145. package/{chunk-GH34JXNV.js → chunk-f9yvy9t9.js} +114 -92
  146. package/chunk-fbdz4f0j.js +90 -0
  147. package/{chunk-J44TXB4J.js → chunk-fcsc2day.js} +216 -164
  148. package/chunk-fevdhnbh.js +19 -0
  149. package/chunk-fkrgqq8w.js +3300 -0
  150. package/{chunk-TSBJVMNW.js → chunk-fs3bvh2p.js} +42 -57
  151. package/chunk-fvwzyhah.js +134 -0
  152. package/chunk-g0mpxdp9.js +101 -0
  153. package/{chunk-LTQ6ECCF.js → chunk-g35f20d1.js} +450 -414
  154. package/{chunk-3L2WKC3W.js → chunk-g5fhtjqg.js} +13 -16
  155. package/{chunk-DBEOW57U.js → chunk-gcq01td7.js} +270 -227
  156. package/{chunk-ADMRXWXJ.js → chunk-ge97b11r.js} +121 -42
  157. package/chunk-ghjtgbkw.js +180 -0
  158. package/chunk-gkra36c1.js +16 -0
  159. package/chunk-gmz86t60.js +1000 -0
  160. package/{localDialogRead-GWGWSL5K.js → chunk-gszpesze.js} +5 -12
  161. package/chunk-gvsfec9m.js +16536 -0
  162. package/{chunk-QSJ3HFEF.js → chunk-h1hzmqph.js} +1 -3
  163. package/chunk-h30dg154.js +17 -0
  164. package/chunk-h3hkb7cw.js +241 -0
  165. package/chunk-h40py996.js +28 -0
  166. package/{chunk-47T3QP4V.js → chunk-h60gnewh.js} +112 -116
  167. package/{agentPullCommand-XEGOUYQT.js → chunk-hkwsv9xf.js} +33 -45
  168. package/chunk-hnyg0gwj.js +28 -0
  169. package/{chunk-KSV6T4AH.js → chunk-hqqqph5w.js} +12 -4
  170. package/{chunk-YQJEXXDK.js → chunk-hrngs1wy.js} +157 -246
  171. package/{chunk-LRLLWD4P.js → chunk-htf69s94.js} +14 -12
  172. package/chunk-j0yxesh3.js +83 -0
  173. package/{chunk-VF4K2QE6.js → chunk-j22t9g05.js} +3 -6
  174. package/{chunk-3R4AYHJR.js → chunk-j4a8m2zn.js} +5 -34
  175. package/chunk-j9p4jnwg.js +27 -0
  176. package/{chunk-R72QWIFO.js → chunk-jdycmfsm.js} +9 -9
  177. package/chunk-jdyvrne0.js +52 -0
  178. package/{spacePruneCommand-YKIEUIDQ.js → chunk-je0b66qf.js} +44 -62
  179. package/{chunk-HNMXYYJR.js → chunk-jec44fkj.js} +3 -4
  180. package/{chunk-526GLZJE.js → chunk-jf1ex00r.js} +107 -73
  181. package/chunk-jgqdec9b.js +31 -0
  182. package/{chunk-56GBUMO5.js → chunk-jkw9n4h5.js} +16 -25
  183. package/{chunk-7422ZLGL.js → chunk-jmnzdwjt.js} +867 -965
  184. package/chunk-jqq57s0a.js +58 -0
  185. package/{chunk-OKUSDVRS.js → chunk-jtkn5aj6.js} +27 -38
  186. package/chunk-jwvzn9r0.js +316 -0
  187. package/chunk-k1re0fc7.js +107 -0
  188. package/chunk-k2ep3rb2.js +103 -0
  189. package/{chunk-JEXVIMYZ.js → chunk-k6ycb24w.js} +5 -8
  190. package/{chunk-RI7SXDJW.js → chunk-kawvydbk.js} +383 -195
  191. package/chunk-kf2ghpzh.js +10 -0
  192. package/{chunk-S6FAHQDH.js → chunk-kgah9e46.js} +28 -59
  193. package/{chunk-T3MWVUBE.js → chunk-kjjepkvc.js} +71 -82
  194. package/chunk-kn4dgg4j.js +4113 -0
  195. package/{chunk-2LFYMWM3.js → chunk-kn5p91n8.js} +43 -53
  196. package/{chunk-MVOZ22RZ.js → chunk-kntqrbwc.js} +8 -12
  197. package/{chunk-I6YIA2TY.js → chunk-kq3vr7mx.js} +25 -20
  198. package/chunk-kz1x1d8n.js +15 -0
  199. package/{mcpLocalAuthorizeCommand-IKOFKY5U.js → chunk-m22e7tt2.js} +53 -71
  200. package/{chunk-ZNFJWEN4.js → chunk-m32rwr4d.js} +11 -8
  201. package/chunk-m39e9m18.js +93 -0
  202. package/{chunk-4D4QD7FT.js → chunk-m5518371.js} +64 -56
  203. package/{chunk-LHTXSC2E.js → chunk-mb5hnfyp.js} +9 -11
  204. package/chunk-mexet11v.js +11 -0
  205. package/chunk-mg2hgfgh.js +185 -0
  206. package/chunk-mmdhm4kx.js +10317 -0
  207. package/chunk-mz002yz8.js +2821 -0
  208. package/chunk-mzadqnyq.js +56 -0
  209. package/{chunk-VIDPVFP3.js → chunk-n3r1ebdm.js} +5 -6
  210. package/chunk-n438qea7.js +33 -0
  211. package/chunk-n5ffnhnb.js +93 -0
  212. package/chunk-nbvd87fy.js +9 -0
  213. package/{chunk-E36V7MPY.js → chunk-ndej7jc9.js} +53 -43
  214. package/{chunk-B767MA64.js → chunk-nen6rwe4.js} +62 -22
  215. package/chunk-nf06tr3v.js +16 -0
  216. package/chunk-ng8z355q.js +16 -0
  217. package/{chunk-4MEKE5D3.js → chunk-nhtxfv8k.js} +78 -63
  218. package/{runAgentClientLoop-2SFASHDS.js → chunk-nj62jscj.js} +132 -214
  219. package/{chunk-GBWGPTA7.js → chunk-nkryrkyp.js} +16 -19
  220. package/chunk-nmesxem8.js +197 -0
  221. package/{chunk-YR4J7RFS.js → chunk-nmq0qwbn.js} +117 -164
  222. package/chunk-nph8brvw.js +7 -0
  223. package/chunk-nr8fees9.js +10 -0
  224. package/{chunk-DFI7MVCQ.js → chunk-nvewvf7h.js} +1441 -1427
  225. package/{chunk-G7Y4GXTY.js → chunk-nyamhphs.js} +70 -79
  226. package/chunk-nz1c8tcg.js +111 -0
  227. package/{chunk-GPLUFN2E.js → chunk-nzc5yffh.js} +176 -217
  228. package/{chunk-G3SUCT4W.js → chunk-p1vg4bx8.js} +2 -4
  229. package/chunk-p3k3abe8.js +202 -0
  230. package/chunk-p4zy30q5.js +8 -0
  231. package/{chunk-ZJACPM5O.js → chunk-p6se1rx0.js} +102 -102
  232. package/chunk-p9dpshev.js +6968 -0
  233. package/chunk-pa42wxr0.js +116 -0
  234. package/{chunk-TA5QI4MM.js → chunk-paxthgqp.js} +56 -107
  235. package/{readlineWorkspace-ZH5FGDMI.js → chunk-pb35s8d9.js} +5395 -5786
  236. package/{chunk-XT6C2QZW.js → chunk-pbebzbcq.js} +8 -8
  237. package/chunk-pbx7e1mb.js +11 -0
  238. package/chunk-pe5czfn9.js +8 -0
  239. package/chunk-pextk1j4.js +62 -0
  240. package/chunk-pf5rywc6.js +575 -0
  241. package/chunk-pjfhd3fz.js +136 -0
  242. package/{chunk-ZCMAKAZM.js → chunk-pkhqb0fs.js} +118 -59
  243. package/chunk-pm5xb9jh.js +26 -0
  244. package/{chunk-Y3KGWZKF.js → chunk-ppdmmdkx.js} +110 -97
  245. package/chunk-pqp6y2hs.js +9 -0
  246. package/{chunk-QHEN7NZ7.js → chunk-ptz8fm2n.js} +12 -17
  247. package/{chunk-EUHMI5KG.js → chunk-pwqnvbt7.js} +65 -46
  248. package/chunk-pzr31nz7.js +12 -0
  249. package/{chunk-WWC7I6TA.js → chunk-q3cx89sw.js} +2 -4
  250. package/chunk-q5pe7be3.js +78 -0
  251. package/{chunk-ZHWTBHT3.js → chunk-q6zqbxp2.js} +418 -409
  252. package/chunk-q7r0e1p3.js +15 -0
  253. package/chunk-q8t2fecd.js +6 -0
  254. package/{chunk-2QAZCYOM.js → chunk-q94zx4d0.js} +721 -753
  255. package/{runtimeDoctorCommands-52MBG5JN.js → chunk-qarz1az1.js} +65 -85
  256. package/{chunk-4INJGWE3.js → chunk-qdcvr25b.js} +72 -53
  257. package/{streamAgentChatTurn-KOUWITHH.js → chunk-qxs27wfg.js} +1079 -1475
  258. package/{chunk-GIXWVN2W.js → chunk-r06ycjjr.js} +50 -47
  259. package/{chunk-63W5N6P3.js → chunk-r20jw5hb.js} +57 -38
  260. package/{chunk-I5BYFTYK.js → chunk-r7sfwdka.js} +1201 -1142
  261. package/{chunk-UMADT6B2.js → chunk-r9sp1yyb.js} +6 -8
  262. package/{handleSendMessageAction-FHGUFT2X.js → chunk-rbd2vgb3.js} +627 -757
  263. package/chunk-rc37js46.js +12 -0
  264. package/{chunk-5YI447UL.js → chunk-rmngk6r3.js} +67 -76
  265. package/chunk-rnhbnbrq.js +15 -0
  266. package/{chunk-WRHVVIGI.js → chunk-rsfnmrt5.js} +111 -131
  267. package/{chunk-YFSM2366.js → chunk-rvvn2rhj.js} +28 -22
  268. package/{chunk-4Y6CZ2N4.js → chunk-s0fpz7ht.js} +37 -33
  269. package/{chunk-VI4SWTUO.js → chunk-s1cqzb2r.js} +77 -65
  270. package/{chunk-6QDYSCPW.js → chunk-s8q81tda.js} +73 -65
  271. package/chunk-s9hy639e.js +6 -0
  272. package/{chunk-R5GO3YZP.js → chunk-s9vbwme8.js} +115 -106
  273. package/chunk-sger1m1b.js +20 -0
  274. package/chunk-spe6crvk.js +60 -0
  275. package/chunk-spwsrvh9.js +70 -0
  276. package/chunk-sr05zpk7.js +573 -0
  277. package/{chunk-M2EJHDJP.js → chunk-srncrd3f.js} +1 -12
  278. package/{chunk-QXHFIX7W.js → chunk-sry80bpx.js} +71 -53
  279. package/{chunk-PSCNXBYA.js → chunk-t6q69p83.js} +3 -4
  280. package/{chunk-UAD2WT54.js → chunk-t714r4q0.js} +9 -28
  281. package/chunk-t7vbraqe.js +42 -0
  282. package/{chunk-CVMMWN6P.js → chunk-td7653rr.js} +10 -20
  283. package/{chunk-3BQDF4QB.js → chunk-tmytcetz.js} +17 -21
  284. package/{chunk-AMWMV56B.js → chunk-tta4prwg.js} +16 -15
  285. package/chunk-tvh8azgq.js +4829 -0
  286. package/{chunk-ID4G2MAR.js → chunk-v08kbfm8.js} +10 -11
  287. package/{chunk-OKPOQGQJ.js → chunk-v1x702q8.js} +801 -852
  288. package/{chunk-KHCLMKZZ.js → chunk-v39fea91.js} +576 -247
  289. package/{chunk-OW765XBU.js → chunk-vejtd8p2.js} +3 -4
  290. package/chunk-vep7zkha.js +368 -0
  291. package/chunk-vfwn1k7n.js +142 -0
  292. package/chunk-vg68vxhx.js +20 -0
  293. package/chunk-vgcqgnsm.js +31 -0
  294. package/{chunk-NF64D32W.js → chunk-vnzyjdea.js} +1 -3
  295. package/{chunk-ZCLSM5AK.js → chunk-vqgtw1px.js} +800 -717
  296. package/chunk-vv1gr5xz.js +76 -0
  297. package/{spaceCommands-Z2CTQD6G.js → chunk-w1qeadpq.js} +176 -242
  298. package/chunk-w468ez1p.js +13 -0
  299. package/chunk-w49s0t79.js +14 -0
  300. package/{mcpLocalManageCommands-KUDZQRM4.js → chunk-w58zhfbn.js} +91 -93
  301. package/chunk-w5b74aq6.js +11 -0
  302. package/chunk-w7y41qyw.js +117 -0
  303. package/chunk-w820gg1w.js +4165 -0
  304. package/{chunk-DBJAJ4UD.js → chunk-wdsmaqmt.js} +399 -453
  305. package/{chunk-3EUW3WEO.js → chunk-wfvvnmmj.js} +1 -3
  306. package/{chunk-QY4NZCDA.js → chunk-wkr04bhk.js} +432 -651
  307. package/{chunk-KUG52IAP.js → chunk-ws402twv.js} +1 -3
  308. package/chunk-wzwh311q.js +164 -0
  309. package/{runtimeModeArgs-X7DL7PUN.js → chunk-x5vtgvwn.js} +6 -5
  310. package/{agentMachineCommands-COJD2KPZ.js → chunk-x8h2csmq.js} +152 -195
  311. package/{chunk-BAZCS5XG.js → chunk-x9zfjnrc.js} +59 -47
  312. package/{chunk-WTIJKWCI.js → chunk-xcarc2rf.js} +50 -56
  313. package/chunk-xf33gz0a.js +8 -0
  314. package/{chunk-PVFYPUIM.js → chunk-y7b3gwx1.js} +78 -71
  315. package/{memoryCommands-SVLAVFCV.js → chunk-y7sphmnh.js} +119 -95
  316. package/{agentListCommands-436FHOIT.js → chunk-ycvaafhc.js} +260 -374
  317. package/chunk-yd7zprb0.js +9 -0
  318. package/chunk-yfz3d27k.js +40 -0
  319. package/{chunk-MKR6KDD3.js → chunk-ykv9g3m4.js} +141 -125
  320. package/chunk-ystjgb9e.js +544 -0
  321. package/chunk-yysxn7ep.js +12 -0
  322. package/{chunk-AL3TYDIF.js → chunk-z17eyawk.js} +18 -16
  323. package/{machineCommands-RVB5OG2X.js → chunk-z17q416p.js} +442 -563
  324. package/chunk-z1n98pcf.js +12 -0
  325. package/{dialogTraceCommand-HWXGIGZX.js → chunk-z566jx5r.js} +292 -397
  326. package/chunk-zjxd6942.js +6 -0
  327. package/{versionChangeNotice-RFABJGJE.js → chunk-zk11x9y5.js} +7 -9
  328. package/{chunk-TEFD5E2D.js → chunk-zt73yc33.js} +48 -51
  329. package/chunk-zvs2fra1.js +5 -0
  330. package/{chunk-SVFFKLMR.js → chunk-zwee84rh.js} +117 -141
  331. package/chunk-zxgfqv72.js +8 -0
  332. package/index.js +53 -69
  333. package/package.json +4 -4
  334. package/_executeModel-YQNZNR2Y.js +0 -341
  335. package/action-UK3HXGXF.js +0 -30
  336. package/addContentAction-CAKFVBDM.js +0 -38
  337. package/addDialogAgentAction-KLJ2YWWM.js +0 -77
  338. package/agentDeleteCommand-S5FVPYKT.js +0 -523
  339. package/agentEmailCommands-ZEFMGVKM.js +0 -742
  340. package/agentRecordCommands-JZ35AC5A.js +0 -211
  341. package/agentRun-UIO43TUG.js +0 -251
  342. package/agentRunCommand-ATLKKD6O.js +0 -249
  343. package/agentRunControl-U2MV74WR.js +0 -211
  344. package/agentRuntimeLocal-P4MMGIR6.js +0 -189
  345. package/agentSlice-HHNKNNYM.js +0 -52
  346. package/appConfigCommands-W4JQHMOJ.js +0 -417
  347. package/appDeleteCommands-IXR47IAV.js +0 -183
  348. package/appDeployCommands-LB6DHDF4.js +0 -232
  349. package/appDeployStatusCommands-UQ6MJL6D.js +0 -204
  350. package/appGetCommands-M5JCTDDQ.js +0 -185
  351. package/appListCommands-TE3ZHE3I.js +0 -186
  352. package/appMigrateCommands-FOXH6R4B.js +0 -230
  353. package/appSourceCommands-3ACYB6I7.js +0 -279
  354. package/authCommand-I5OBJP5S.js +0 -66
  355. package/authCommands-I6KCGOCN.js +0 -54
  356. package/builtinSkillRegistry-MIXYSZUU.js +0 -35
  357. package/chromeOpsCommands-IZRCYDSW.js +0 -579
  358. package/chunk-24BICQPB.js +0 -25
  359. package/chunk-2E4BYAUE.js +0 -69
  360. package/chunk-2O72G3U2.js +0 -17157
  361. package/chunk-2OROOEOQ.js +0 -229
  362. package/chunk-2R6M34JP.js +0 -27225
  363. package/chunk-2SXN7LAY.js +0 -15
  364. package/chunk-35JIFLIG.js +0 -30
  365. package/chunk-3VXVE2LF.js +0 -12
  366. package/chunk-4DBTBNTX.js +0 -477
  367. package/chunk-4JH2UMJR.js +0 -40
  368. package/chunk-4RUQ2PFX.js +0 -432
  369. package/chunk-4SN6J65J.js +0 -38
  370. package/chunk-5MMAK75Q.js +0 -15
  371. package/chunk-6NYQHXMV.js +0 -1737
  372. package/chunk-6R4IY46J.js +0 -14
  373. package/chunk-7E6YXSFZ.js +0 -441
  374. package/chunk-7K4J76JQ.js +0 -917
  375. package/chunk-7LR2IFUH.js +0 -100
  376. package/chunk-AETZ7AD6.js +0 -274
  377. package/chunk-ATNTHIZI.js +0 -13
  378. package/chunk-BPB3T5EU.js +0 -791
  379. package/chunk-BV3FLP2L.js +0 -133
  380. package/chunk-BVYHE6QD.js +0 -110
  381. package/chunk-BWJLEN6X.js +0 -1388
  382. package/chunk-CHOZJMJS.js +0 -78
  383. package/chunk-D2LTQAGN.js +0 -464
  384. package/chunk-DALXH7BG.js +0 -3392
  385. package/chunk-DBCWXGOC.js +0 -15210
  386. package/chunk-DLXL4NSL.js +0 -1179
  387. package/chunk-DSBRIUX5.js +0 -23
  388. package/chunk-DWLEOOGR.js +0 -8
  389. package/chunk-E2KZNP6C.js +0 -13
  390. package/chunk-E5JV4DCB.js +0 -272
  391. package/chunk-EUGTFFO6.js +0 -42
  392. package/chunk-FBNVJ2TO.js +0 -294
  393. package/chunk-FGXG6OLW.js +0 -34
  394. package/chunk-G22P2J7O.js +0 -1775
  395. package/chunk-HEVRQGGH.js +0 -106
  396. package/chunk-HHXF57CL.js +0 -180
  397. package/chunk-HI5RS2O4.js +0 -2109
  398. package/chunk-HJTI7RZV.js +0 -94
  399. package/chunk-HRWRIPTB.js +0 -531
  400. package/chunk-HYCVEESH.js +0 -2824
  401. package/chunk-I42VC5KR.js +0 -15
  402. package/chunk-IB5AR52X.js +0 -15
  403. package/chunk-IIRJ4P4I.js +0 -24
  404. package/chunk-IT3ZZRJE.js +0 -12
  405. package/chunk-IV6VUVLJ.js +0 -88
  406. package/chunk-J42X32PV.js +0 -472
  407. package/chunk-JDMWYVUF.js +0 -449
  408. package/chunk-JKVOKKMQ.js +0 -53
  409. package/chunk-JRTNUU5Z.js +0 -54
  410. package/chunk-K7HLFORE.js +0 -226
  411. package/chunk-KGBASAB5.js +0 -74
  412. package/chunk-KGKTN2NX.js +0 -25
  413. package/chunk-KX6YBIHG.js +0 -8
  414. package/chunk-KYHNSSL2.js +0 -62
  415. package/chunk-KZO2MTVM.js +0 -140
  416. package/chunk-LKZPX6YH.js +0 -0
  417. package/chunk-LLP2NDED.js +0 -201
  418. package/chunk-LOFRSJX2.js +0 -47
  419. package/chunk-M75RM77T.js +0 -3970
  420. package/chunk-MDAYRIP7.js +0 -1889
  421. package/chunk-MI6HRMCK.js +0 -25
  422. package/chunk-MTNQNLSE.js +0 -1029
  423. package/chunk-NH4PUEWK.js +0 -762
  424. package/chunk-NHLLXINQ.js +0 -8
  425. package/chunk-NTUNHTJV.js +0 -40
  426. package/chunk-OJKUU3LP.js +0 -67
  427. package/chunk-OQH3TAB7.js +0 -299
  428. package/chunk-P62DHV4F.js +0 -443
  429. package/chunk-PHIERFHT.js +0 -574
  430. package/chunk-PKDFU6MY.js +0 -102
  431. package/chunk-PL5RKESU.js +0 -40
  432. package/chunk-PSJJBBWV.js +0 -42
  433. package/chunk-QKM55LP2.js +0 -739
  434. package/chunk-QQ56R7KS.js +0 -88
  435. package/chunk-QYPE3TS3.js +0 -43
  436. package/chunk-REAE2SZK.js +0 -62
  437. package/chunk-RGQ4UUWZ.js +0 -208
  438. package/chunk-RIRFHJTW.js +0 -353
  439. package/chunk-RYMLMTPZ.js +0 -547
  440. package/chunk-SSGTV4FC.js +0 -303
  441. package/chunk-SVKWZ3EG.js +0 -607
  442. package/chunk-T7KODHYS.js +0 -317
  443. package/chunk-TGVVE5BA.js +0 -3085
  444. package/chunk-TKLBBR7P.js +0 -779
  445. package/chunk-TZXPT53C.js +0 -8
  446. package/chunk-U67V476Y.js +0 -35
  447. package/chunk-UEILX4EV.js +0 -15
  448. package/chunk-VIWDGTDA.js +0 -8
  449. package/chunk-VXUQWCEZ.js +0 -138
  450. package/chunk-W5GKF5ZW.js +0 -32
  451. package/chunk-WDWZPASX.js +0 -29
  452. package/chunk-WX266G2C.js +0 -9594
  453. package/chunk-YCITCYSJ.js +0 -356
  454. package/chunk-Z3KTXWWB.js +0 -76
  455. package/chunk-ZC3CMUKU.js +0 -322
  456. package/chunk-ZSZBHRLP.js +0 -1710
  457. package/chunk-ZV7ZY46L.js +0 -1343
  458. package/cliAgentConfigHelpers-WB2S7PDO.js +0 -47
  459. package/cliAuthorityBrokerClient-3SKOA7OZ.js +0 -23
  460. package/cliAuthorityBrokerProcess-BMBVXPKU.js +0 -24
  461. package/cliAuthorityStoreDriver-6FE3BJNB.js +0 -20
  462. package/cliEnvHelpers-7V5ZWUJA.js +0 -34
  463. package/cliExecutor-N3445G2Z.js +0 -45
  464. package/cliLocalAgentRecordReader-QKKRK53P.js +0 -113
  465. package/cloudAutomationCommands-S52NKCLL.js +0 -310
  466. package/contentThunks-ERA42OXW.js +0 -100
  467. package/cooldownCommands-ZFDAL4MR.js +0 -79
  468. package/createAgentAutomationAction-DMD2VDPI.js +0 -173
  469. package/createDialogAction-3SPOJQAK.js +0 -87
  470. package/createPageAction-AVXUMZVT.js +0 -91
  471. package/cursorProvider-2RACMEMF.js +0 -6123
  472. package/db-LTHLW7QA.js +0 -178
  473. package/dbSlice-WNUHTF4C.js +0 -76
  474. package/deleteDbKey-KV6MYBAI.js +0 -87
  475. package/desktopFolderProjects-4POAMVJN.js +0 -45
  476. package/dialogCommands-4MOLJW4G.js +0 -165
  477. package/dialogMessageRecord-2HJTEXQX.js +0 -7
  478. package/dialogNotifyCommand-YL2GFKLO.js +0 -45
  479. package/dialogSlice-Q7H2YVNO.js +0 -200
  480. package/dialogUsageCommand-IO2BQKL2.js +0 -31
  481. package/docCreateCommands-OYLRBK2M.js +0 -255
  482. package/docDeleteCommands-3NF6QPJU.js +0 -226
  483. package/docReadCommands-CBAERJAP.js +0 -184
  484. package/docStore-GWPFDV6Y.js +0 -89
  485. package/docUpdateCommands-BAMCGX6F.js +0 -326
  486. package/ebookDownloaderAgentCommand-NOIZ6U7Y.js +0 -675
  487. package/fetchMessages-P7FSCSXV.js +0 -19
  488. package/getPricing-KNXVEIUI.js +0 -40
  489. package/hostCredentialCreate-2VEYBXJV.js +0 -402
  490. package/i18n-SAK6DDY4.js +0 -51
  491. package/keys-FXEGMKSG.js +0 -183
  492. package/legacyMigration-TF4SYJCZ.js +0 -19
  493. package/levelAuthorityStore-L5SVDM5O.js +0 -10
  494. package/localAutomationCommands-XSK7SM7I.js +0 -199
  495. package/localAutomationRuntime-5WBO7HGQ.js +0 -61
  496. package/localRecall-BDYKXB46.js +0 -17
  497. package/localRuntimeAdapter-Y6H6XRIH.js +0 -310
  498. package/localRuntimeAuthority-Q5C2KWGF.js +0 -45
  499. package/localRuntimeDb-MM3DINZM.js +0 -12
  500. package/machineInfo-HNPJHQFU.js +0 -14
  501. package/machineWsRunDispatch-Y5SJGCEE.js +0 -228
  502. package/models-TOXYINNM.js +0 -10
  503. package/oauthTokenStore-RUYNYALS.js +0 -24
  504. package/overlay-JA3SPVUS.js +0 -15
  505. package/parityCommands-5OCBPVES.js +0 -613
  506. package/processSpawn-6GEO77KV.js +0 -11
  507. package/profileConfig-KOWK4HOG.js +0 -49
  508. package/projectArchive-WE3VVPZ2.js +0 -132
  509. package/providerPresetApply-YCVSP2WX.js +0 -235
  510. package/providerRegistry-26PAUYH2.js +0 -24
  511. package/read-D4WYJQJQ.js +0 -32
  512. package/readDocTool-3S3OQFOH.js +0 -22
  513. package/rememberExplicit-ZPI6KK5M.js +0 -16
  514. package/remove-AHRMUDMH.js +0 -32
  515. package/removeDialogAgentAction-AALRBFSA.js +0 -81
  516. package/secretCommands-2PSS3QNZ.js +0 -24
  517. package/setDialogExtraReferencesAction-SLHQ3GYL.js +0 -39
  518. package/setPrimaryDialogAgentAction-XKCSGJ7M.js +0 -96
  519. package/skillDiscovery-IUEZZG2B.js +0 -29
  520. package/skillSummaryMarker-62UW7HI7.js +0 -9
  521. package/slateToRenderMarkdown-R3X74MCX.js +0 -7
  522. package/slateUtils-ESQAJ6RN.js +0 -19
  523. package/store-WSAVTR32.js +0 -50
  524. package/switchDialogAgentAction-YJIWQGIR.js +0 -70
  525. package/tombstones-FQQMEDOW.js +0 -32
  526. package/toolApiClient-FVXTIIEN.js +0 -42
  527. package/tools-WN4AVSNS.js +0 -147
  528. package/tuiRestart-LU2BDLAW.js +0 -50
  529. package/tuiSummaryLlmCaller-Z2ZVBIGN.js +0 -53
  530. package/updateCommands-4QP7WJLA.js +0 -63
  531. package/usageCommand-AZX7D3LB.js +0 -31
  532. package/usageRebuildCommand-XV5QQCHK.js +0 -623
  533. package/userDataMerge-HT2ZVHBJ.js +0 -13
  534. package/windowsSelfUpdate-5OFKSW6Y.js +0 -14
  535. package/workContext-ZAW6VXT7.js +0 -18
  536. package/workContextAccess-VU5I4LKZ.js +0 -11
  537. package/workContextWriteNotice-YCSSMHN4.js +0 -7
  538. /package/{chunk-BYXBJQAS.js → chunk-0bcc25vg.js} +0 -0
@@ -0,0 +1,2874 @@
1
+ import {
2
+ integer,
3
+ maxLength,
4
+ maxValue,
5
+ minLength,
6
+ minValue,
7
+ regex,
8
+ array,
9
+ boolean,
10
+ number,
11
+ optional,
12
+ strictObject,
13
+ string,
14
+ pipe
15
+ } from "./chunk-7mrqbxe8.js";
16
+ import {
17
+ noloAgentId,
18
+ googleSessionServer,
19
+ require_react,
20
+ getRuntimeServerSnapshot,
21
+ getActiveDialogKey,
22
+ selectIdentityUserId,
23
+ selectIdentityToken,
24
+ normalizeMediaConfirmExecutionRevision,
25
+ selectRuntimeSnapshot,
26
+ selectById2,
27
+ selectEntities2,
28
+ selectOptionalEntities2,
29
+ resolveDialogRuntimeAgentKey,
30
+ createActionAsyncThunk,
31
+ fetchAndCacheTableRows
32
+ } from "./chunk-c235kypv.js";
33
+ import {
34
+ splitDialogKeyIdentity
35
+ } from "./chunk-csf18m5w.js";
36
+ import {
37
+ parseDialogKey,
38
+ isDialogRecordKeyForId
39
+ } from "./chunk-mzadqnyq.js";
40
+ import {
41
+ createSpaceKey
42
+ } from "./chunk-t714r4q0.js";
43
+ import {
44
+ parseSkillDocProtocol
45
+ } from "./chunk-v39fea91.js";
46
+ import {
47
+ isSkillSummaryMarker2
48
+ } from "./chunk-j22t9g05.js";
49
+ import {
50
+ setDialogExtraReferencesAction2
51
+ } from "./chunk-jgqdec9b.js";
52
+ import {
53
+ listBuiltinSkills2,
54
+ resolveBuiltinSkillByName2,
55
+ isAgentSkillDisabled
56
+ } from "./chunk-w820gg1w.js";
57
+ import {
58
+ DEFAULT_SYSTEM_AGENT_CAPABILITIES
59
+ } from "./chunk-8yj4pq79.js";
60
+ import {
61
+ markdownToSlate
62
+ } from "./chunk-mmdhm4kx.js";
63
+ import {
64
+ slateToRenderMarkdown2
65
+ } from "./chunk-r20jw5hb.js";
66
+ import {
67
+ createEmptyParagraph2,
68
+ extractMentionsFromSlate2
69
+ } from "./chunk-9yr1fy7j.js";
70
+ import {
71
+ __toESM
72
+ } from "./chunk-33405wtv.js";
73
+ import {
74
+ compactWhitespace
75
+ } from "./chunk-vqgtw1px.js";
76
+ import {
77
+ asTrimmedLowercaseString
78
+ } from "./chunk-h1hzmqph.js";
79
+ import {
80
+ isRecord
81
+ } from "./chunk-ws402twv.js";
82
+ import {
83
+ toErrorMessage
84
+ } from "./chunk-jec44fkj.js";
85
+ import {
86
+ asTrimmedString
87
+ } from "./chunk-wfvvnmmj.js";
88
+ import {
89
+ normalizeServerOrigin
90
+ } from "./chunk-0h0sncy4.js";
91
+ import {
92
+ asOptionalTrimmedString
93
+ } from "./chunk-p1vg4bx8.js";
94
+
95
+ // packages/ai/skills/userPromptSkillSlugs.ts
96
+ var RECOMMENDED_PROMPT_SKILL_SLUGS = ["ub-mode"];
97
+ var ALLOWED_PROMPT_SKILL_SLUGS = new Set(RECOMMENDED_PROMPT_SKILL_SLUGS);
98
+ function normalizeEnabledPromptSkills(value) {
99
+ if (!Array.isArray(value)) {
100
+ return [];
101
+ }
102
+ const result = [];
103
+ const seen = new Set;
104
+ for (const item of value) {
105
+ if (typeof item !== "string") {
106
+ continue;
107
+ }
108
+ const trimmed = item.trim();
109
+ if (ALLOWED_PROMPT_SKILL_SLUGS.has(trimmed) && !seen.has(trimmed)) {
110
+ seen.add(trimmed);
111
+ result.push(trimmed);
112
+ }
113
+ }
114
+ return result;
115
+ }
116
+
117
+ // packages/ai/skills/userSkills.ts
118
+ var NEW_ACCOUNT_DEFAULT_WORKFLOW_SKILLS = [
119
+ "response-presentation",
120
+ "external-copywriting"
121
+ ];
122
+ function isAccountOnDemandWorkflowSkill(slug) {
123
+ return typeof slug === "string" && NEW_ACCOUNT_DEFAULT_WORKFLOW_SKILLS.some((candidate) => candidate === slug.trim());
124
+ }
125
+ var SUPPORTED_USER_SKILL_SLUGS = [
126
+ "ub-mode",
127
+ "auto-review",
128
+ "code-style",
129
+ "worktree-isolation",
130
+ "systematic-investigation",
131
+ "show-me",
132
+ "caveman",
133
+ "secrets-manager",
134
+ "skill-creator",
135
+ "code-planning",
136
+ "coding",
137
+ "coding-review",
138
+ "android-adb",
139
+ "mihome-assistant",
140
+ "stock-quotes",
141
+ "unslop-ui",
142
+ "motion-polish",
143
+ ...NEW_ACCOUNT_DEFAULT_WORKFLOW_SKILLS
144
+ ];
145
+ var SUPPORTED_USER_SKILL_SLUG_SET = new Set(SUPPORTED_USER_SKILL_SLUGS);
146
+ function normalizeEnabledSkills(value) {
147
+ if (!Array.isArray(value)) {
148
+ return [];
149
+ }
150
+ const result = [];
151
+ const seen = new Set;
152
+ for (const item of value) {
153
+ if (typeof item !== "string") {
154
+ continue;
155
+ }
156
+ const trimmed = item.trim();
157
+ if (SUPPORTED_USER_SKILL_SLUG_SET.has(trimmed) && !seen.has(trimmed)) {
158
+ seen.add(trimmed);
159
+ result.push(trimmed);
160
+ }
161
+ }
162
+ return result;
163
+ }
164
+ function resolveUserEnabledSkills(preferences) {
165
+ if (!preferences || typeof preferences !== "object") {
166
+ return [];
167
+ }
168
+ if (Object.prototype.hasOwnProperty.call(preferences, "enabledSkills")) {
169
+ return normalizeEnabledSkills(preferences.enabledSkills);
170
+ }
171
+ if (Object.prototype.hasOwnProperty.call(preferences, "enabledPromptSkills")) {
172
+ const legacy = normalizeEnabledPromptSkills(preferences.enabledPromptSkills);
173
+ return legacy.filter((slug) => SUPPORTED_USER_SKILL_SLUG_SET.has(slug));
174
+ }
175
+ return [];
176
+ }
177
+
178
+ // packages/ai/tools/uiCardSchema.ts
179
+ var UI_CARD_VERSION = 1;
180
+ var MAX_BLOCKS = 32;
181
+ var MAX_TEXT_BYTES = 20000;
182
+ var UI_CARD_MAX_BYTES = 1e5;
183
+ var UI_CARD_ENVELOPE_MAX_BYTES = UI_CARD_MAX_BYTES + 4096;
184
+ var MAX_COLLECTION_ITEMS = 500;
185
+ var MAX_JSON_DEPTH = 12;
186
+ var MAX_JSON_NODES = 2000;
187
+ var UI_STABLE_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
188
+ function isRecord2(value) {
189
+ return value !== null && typeof value === "object" && !Array.isArray(value);
190
+ }
191
+ function hasOnlyKeys(value, allowed) {
192
+ return Object.keys(value).every((key) => allowed.includes(key));
193
+ }
194
+ function isText(value) {
195
+ return typeof value === "string" && new TextEncoder().encode(value).byteLength <= MAX_TEXT_BYTES;
196
+ }
197
+ function isStringArray(value, max = MAX_COLLECTION_ITEMS) {
198
+ return Array.isArray(value) && value.length <= max && value.every(isText);
199
+ }
200
+ function isJsonValue(value, depth, budget) {
201
+ budget.nodes += 1;
202
+ if (budget.nodes > MAX_JSON_NODES || depth > MAX_JSON_DEPTH)
203
+ return false;
204
+ if (value === null || typeof value === "boolean")
205
+ return true;
206
+ if (typeof value === "string")
207
+ return isText(value);
208
+ if (typeof value === "number")
209
+ return Number.isFinite(value);
210
+ if (Array.isArray(value))
211
+ return value.every((item) => isJsonValue(item, depth + 1, budget));
212
+ if (!isRecord2(value))
213
+ return false;
214
+ for (const [key, item] of Object.entries(value)) {
215
+ if (["$ref", "$expr", "expression", "script"].includes(key))
216
+ return false;
217
+ if (!isText(key) || !isJsonValue(item, depth + 1, budget))
218
+ return false;
219
+ }
220
+ return true;
221
+ }
222
+ function isChoiceQuestion(value) {
223
+ if (!isRecord2(value) || !hasOnlyKeys(value, ["id", "header", "question", "choices", "multiSelect", "allowOther", "required"]))
224
+ return false;
225
+ if (!isText(value.id) || !value.id.trim() || !isText(value.question) || !value.question.trim())
226
+ return false;
227
+ if (value.header !== undefined && !isText(value.header))
228
+ return false;
229
+ for (const flag of ["multiSelect", "allowOther", "required"]) {
230
+ if (value[flag] !== undefined && typeof value[flag] !== "boolean")
231
+ return false;
232
+ }
233
+ if (!Array.isArray(value.choices) || value.choices.length === 0 || value.choices.length > MAX_COLLECTION_ITEMS)
234
+ return false;
235
+ const ids = new Set;
236
+ for (const option of value.choices) {
237
+ if (!isRecord2(option) || !hasOnlyKeys(option, ["id", "label", "detail", "recommended", "userMessage"]))
238
+ return false;
239
+ if (!isText(option.label) || !option.label.trim())
240
+ return false;
241
+ if (option.id !== undefined) {
242
+ if (!isText(option.id) || !option.id.trim() || ids.has(option.id))
243
+ return false;
244
+ ids.add(option.id);
245
+ }
246
+ if (option.detail !== undefined && !isText(option.detail))
247
+ return false;
248
+ if (option.userMessage !== undefined && !isText(option.userMessage))
249
+ return false;
250
+ if (option.recommended !== undefined && typeof option.recommended !== "boolean")
251
+ return false;
252
+ }
253
+ return true;
254
+ }
255
+ function isAppUrl(value) {
256
+ try {
257
+ const parsed = new URL(value);
258
+ const hasWebProtocol = parsed.protocol === "http:" || parsed.protocol === "https:";
259
+ const authority = value.slice(value.indexOf("//") + 2).split(/[/?#]/, 1)[0];
260
+ return hasWebProtocol && authority.length > 0 && parsed.hostname.length > 0;
261
+ } catch {
262
+ return false;
263
+ }
264
+ }
265
+ function isBlock(value) {
266
+ if (!isRecord2(value) || typeof value.type !== "string")
267
+ return false;
268
+ switch (value.type) {
269
+ case "text":
270
+ return hasOnlyKeys(value, ["type", "text"]) && isText(value.text);
271
+ case "metric":
272
+ return hasOnlyKeys(value, ["type", "label", "value", "detail"]) && isText(value.label) && isText(value.value) && (value.detail === undefined || isText(value.detail));
273
+ case "list":
274
+ return hasOnlyKeys(value, ["type", "title", "items"]) && (value.title === undefined || isText(value.title)) && isStringArray(value.items);
275
+ case "table": {
276
+ const columns = value.columns;
277
+ const rows = value.rows;
278
+ 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);
279
+ }
280
+ case "choice":
281
+ return hasOnlyKeys(value, ["type", "question"]) && isChoiceQuestion(value.question);
282
+ case "action": {
283
+ if (!isRecord2(value.action) || typeof value.action.type !== "string")
284
+ return false;
285
+ if (value.action.type === "submit") {
286
+ if (!hasOnlyKeys(value, ["type", "action"]) || !hasOnlyKeys(value.action, ["type", "payload"]))
287
+ return false;
288
+ if (value.action.payload === undefined)
289
+ return true;
290
+ return isRecord2(value.action.payload) && isJsonValue(value.action.payload, 0, { nodes: 0 });
291
+ }
292
+ if (value.action.type === "openApp") {
293
+ return hasOnlyKeys(value, ["type", "action"]) && hasOnlyKeys(value.action, ["type", "appId", "url"]) && isText(value.action.appId) && !!value.action.appId.trim() && (value.action.url === undefined || isText(value.action.url) && isAppUrl(value.action.url));
294
+ }
295
+ if (value.action.type === "sendMessage") {
296
+ 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();
297
+ }
298
+ return false;
299
+ }
300
+ default:
301
+ return false;
302
+ }
303
+ }
304
+ function parseUiCard(input) {
305
+ if (!isRecord2(input) || !hasOnlyKeys(input, ["id", "version", "source", "blocks"]))
306
+ return { ok: false, error: "invalid card shape" };
307
+ if (typeof input.id !== "string" || !UI_STABLE_ID_PATTERN.test(input.id))
308
+ return { ok: false, error: "invalid card id" };
309
+ if (input.version !== UI_CARD_VERSION || input.source !== "tool")
310
+ return { ok: false, error: "unsupported card version or source" };
311
+ if (!Array.isArray(input.blocks) || input.blocks.length > MAX_BLOCKS || !input.blocks.every(isBlock))
312
+ return { ok: false, error: "invalid blocks" };
313
+ const sendMessages = input.blocks.filter((block) => block.type === "action" && block.action.type === "sendMessage");
314
+ if (sendMessages.length > 1)
315
+ return { ok: false, error: "at most one sendMessage action per card" };
316
+ if (sendMessages.length === 1 && input.blocks.some((block) => block.type === "choice"))
317
+ return { ok: false, error: "sendMessage action cannot be combined with choice blocks" };
318
+ try {
319
+ if (new TextEncoder().encode(JSON.stringify(input)).byteLength > UI_CARD_MAX_BYTES)
320
+ return { ok: false, error: "card too large" };
321
+ } catch {
322
+ return { ok: false, error: "unserializable card" };
323
+ }
324
+ return { ok: true, value: input };
325
+ }
326
+ function uiCardFallback(card) {
327
+ return card.blocks.map((block) => {
328
+ switch (block.type) {
329
+ case "text":
330
+ return block.text;
331
+ case "metric":
332
+ return `${block.label}: ${block.value}${block.detail ? ` (${block.detail})` : ""}`;
333
+ case "list":
334
+ return `${block.title ? `${block.title}
335
+ ` : ""}${block.items.map((item) => `- ${item}`).join(`
336
+ `)}`;
337
+ case "table":
338
+ return [block.columns.join(" | "), ...block.rows.map((row) => row.join(" | "))].join(`
339
+ `);
340
+ case "choice":
341
+ return `${block.question.question}
342
+ ${block.question.choices.map((item) => `- ${item.label}${item.detail ? ` — ${item.detail}` : ""}`).join(`
343
+ `)}`;
344
+ case "action": {
345
+ if (block.action.type === "submit")
346
+ return `Submit action (not executed): ${block.action.payload === undefined ? "{}" : JSON.stringify(block.action.payload)}`;
347
+ if (block.action.type === "sendMessage") {
348
+ const { label, userMessage } = block.action;
349
+ return `Send message (plain user message only, not executed): ${label}${userMessage === label ? "" : ` — ${userMessage}`}`;
350
+ }
351
+ return `Open app (not authorized): ${block.action.appId}${block.action.url ? ` (${block.action.url})` : ""}`;
352
+ }
353
+ }
354
+ }).join(`
355
+
356
+ `);
357
+ }
358
+
359
+ // node_modules/@valibot/to-json-schema/dist/index.mjs
360
+ function addError(errors, message) {
361
+ if (errors) {
362
+ errors.push(message);
363
+ return errors;
364
+ }
365
+ return [message];
366
+ }
367
+ var ESCAPE_REGEX = /[.*+?^${}()|[\]\\]/g;
368
+ function escapeRegExp(string) {
369
+ return string.replace(ESCAPE_REGEX, "\\$&");
370
+ }
371
+ function handleError(message, config) {
372
+ switch (config?.errorMode) {
373
+ case "ignore":
374
+ break;
375
+ case "warn":
376
+ console.warn(message);
377
+ break;
378
+ default:
379
+ throw new Error(message);
380
+ }
381
+ }
382
+ function isJsonConstValue(value) {
383
+ return typeof value === "boolean" || typeof value === "number" && Number.isFinite(value) || typeof value === "string";
384
+ }
385
+ function isJsonEnumValues(values) {
386
+ return values.every(isJsonConstValue);
387
+ }
388
+ var ReferenceMap = class extends Map {
389
+ constructor() {
390
+ super();
391
+ this.count = 0;
392
+ this.usedIds = /* @__PURE__ */ new Set;
393
+ }
394
+ set(schema, referenceId) {
395
+ this.usedIds.add(referenceId);
396
+ return super.set(schema, referenceId);
397
+ }
398
+ createId(definitions) {
399
+ while (this.usedIds.has(`${this.count}`) || `${this.count}` in definitions)
400
+ this.count++;
401
+ return `${this.count++}`;
402
+ }
403
+ };
404
+ function getLowerBound(current, value) {
405
+ if (typeof current !== "number" || !Number.isFinite(current) || value > current)
406
+ return value;
407
+ return current;
408
+ }
409
+ function getUpperBound(current, value) {
410
+ if (typeof current !== "number" || !Number.isFinite(current) || value < current)
411
+ return value;
412
+ return current;
413
+ }
414
+ function getNotRestriction(current, value) {
415
+ return current !== undefined ? { anyOf: [current, value] } : value;
416
+ }
417
+ function intersectEnum(jsonSchema, values) {
418
+ let enumValues = jsonSchema.enum ?? values;
419
+ if (jsonSchema.enum) {
420
+ const valueSet = new Set(values);
421
+ enumValues = enumValues.filter((value) => valueSet.has(value));
422
+ }
423
+ if (enumValues.length)
424
+ jsonSchema.enum = [...new Set(enumValues)];
425
+ else {
426
+ delete jsonSchema.enum;
427
+ jsonSchema.not = /* @__PURE__ */ getNotRestriction(jsonSchema.not, {});
428
+ }
429
+ }
430
+ function convertAction(jsonSchema, valibotAction, config) {
431
+ if (config?.ignoreActions?.includes(valibotAction.type))
432
+ return jsonSchema;
433
+ let errors;
434
+ switch (valibotAction.type) {
435
+ case "base64":
436
+ jsonSchema.contentEncoding = "base64";
437
+ break;
438
+ case "bic":
439
+ case "cuid2":
440
+ case "decimal":
441
+ case "digits":
442
+ case "domain":
443
+ case "emoji":
444
+ case "hash":
445
+ case "hexadecimal":
446
+ case "hex_color":
447
+ case "isrc":
448
+ case "iso_time_second":
449
+ case "iso_week":
450
+ case "ksuid":
451
+ case "mac":
452
+ case "mac48":
453
+ case "mac64":
454
+ case "nanoid":
455
+ case "octal":
456
+ case "slug":
457
+ case "ulid":
458
+ if (jsonSchema.pattern)
459
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
460
+ else
461
+ jsonSchema.pattern = valibotAction.requirement.source;
462
+ break;
463
+ case "description":
464
+ jsonSchema.description = valibotAction.description;
465
+ break;
466
+ case "email":
467
+ case "rfc_email":
468
+ jsonSchema.format = "email";
469
+ break;
470
+ case "ends_with":
471
+ if (jsonSchema.pattern)
472
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
473
+ else
474
+ jsonSchema.pattern = `${escapeRegExp(valibotAction.requirement)}$`;
475
+ break;
476
+ case "empty":
477
+ if (jsonSchema.type === "array")
478
+ jsonSchema.maxItems = 0;
479
+ else {
480
+ if (jsonSchema.type !== "string")
481
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
482
+ jsonSchema.maxLength = 0;
483
+ }
484
+ break;
485
+ case "entries":
486
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
487
+ errors = addError(errors, 'The requirement of the "entries" action must be a non-negative integer.');
488
+ break;
489
+ }
490
+ jsonSchema.minProperties = getLowerBound(jsonSchema.minProperties, valibotAction.requirement);
491
+ jsonSchema.maxProperties = getUpperBound(jsonSchema.maxProperties, valibotAction.requirement);
492
+ break;
493
+ case "examples":
494
+ if (Array.isArray(jsonSchema.examples))
495
+ jsonSchema.examples = [...jsonSchema.examples, ...valibotAction.examples];
496
+ else
497
+ jsonSchema.examples = valibotAction.examples;
498
+ break;
499
+ case "gt_value":
500
+ if (jsonSchema.type !== "number" && jsonSchema.type !== "integer") {
501
+ errors = addError(errors, `The "gt_value" action is not supported on type "${jsonSchema.type}".`);
502
+ break;
503
+ }
504
+ if (!Number.isFinite(valibotAction.requirement)) {
505
+ errors = addError(errors, 'The requirement of the "gt_value" action is not JSON compatible.');
506
+ break;
507
+ }
508
+ if (config?.target === "openapi-3.0") {
509
+ errors = addError(errors, 'The "gt_value" action is not supported for OpenAPI 3.0.');
510
+ break;
511
+ }
512
+ jsonSchema.exclusiveMinimum = getLowerBound(jsonSchema.exclusiveMinimum, valibotAction.requirement);
513
+ break;
514
+ case "includes":
515
+ if (jsonSchema.pattern)
516
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
517
+ else
518
+ jsonSchema.pattern = escapeRegExp(valibotAction.requirement);
519
+ break;
520
+ case "integer":
521
+ jsonSchema.type = "integer";
522
+ break;
523
+ case "ipv4":
524
+ jsonSchema.format = "ipv4";
525
+ break;
526
+ case "ipv6":
527
+ jsonSchema.format = "ipv6";
528
+ break;
529
+ case "iso_date":
530
+ jsonSchema.format = "date";
531
+ break;
532
+ case "iso_date_time":
533
+ case "iso_timestamp":
534
+ jsonSchema.format = "date-time";
535
+ break;
536
+ case "iso_time":
537
+ jsonSchema.format = "time";
538
+ break;
539
+ case "jws_compact":
540
+ if (jsonSchema.pattern)
541
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
542
+ else
543
+ jsonSchema.pattern = valibotAction.requirement.source;
544
+ break;
545
+ case "length":
546
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
547
+ errors = addError(errors, 'The requirement of the "length" action must be a non-negative integer.');
548
+ break;
549
+ }
550
+ if (jsonSchema.type === "array") {
551
+ jsonSchema.minItems = getLowerBound(jsonSchema.minItems, valibotAction.requirement);
552
+ jsonSchema.maxItems = getUpperBound(jsonSchema.maxItems, valibotAction.requirement);
553
+ } else {
554
+ if (jsonSchema.type !== "string")
555
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
556
+ jsonSchema.minLength = getLowerBound(jsonSchema.minLength, valibotAction.requirement);
557
+ jsonSchema.maxLength = getUpperBound(jsonSchema.maxLength, valibotAction.requirement);
558
+ }
559
+ break;
560
+ case "lt_value":
561
+ if (jsonSchema.type !== "number" && jsonSchema.type !== "integer") {
562
+ errors = addError(errors, `The "lt_value" action is not supported on type "${jsonSchema.type}".`);
563
+ break;
564
+ }
565
+ if (!Number.isFinite(valibotAction.requirement)) {
566
+ errors = addError(errors, 'The requirement of the "lt_value" action is not JSON compatible.');
567
+ break;
568
+ }
569
+ if (config?.target === "openapi-3.0") {
570
+ errors = addError(errors, 'The "lt_value" action is not supported for OpenAPI 3.0.');
571
+ break;
572
+ }
573
+ jsonSchema.exclusiveMaximum = getUpperBound(jsonSchema.exclusiveMaximum, valibotAction.requirement);
574
+ break;
575
+ case "max_entries":
576
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
577
+ errors = addError(errors, 'The requirement of the "max_entries" action must be a non-negative integer.');
578
+ break;
579
+ }
580
+ jsonSchema.maxProperties = getUpperBound(jsonSchema.maxProperties, valibotAction.requirement);
581
+ break;
582
+ case "max_length":
583
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
584
+ errors = addError(errors, 'The requirement of the "max_length" action must be a non-negative integer.');
585
+ break;
586
+ }
587
+ if (jsonSchema.type === "array")
588
+ jsonSchema.maxItems = getUpperBound(jsonSchema.maxItems, valibotAction.requirement);
589
+ else {
590
+ if (jsonSchema.type !== "string")
591
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
592
+ jsonSchema.maxLength = getUpperBound(jsonSchema.maxLength, valibotAction.requirement);
593
+ }
594
+ break;
595
+ case "max_value":
596
+ if (jsonSchema.type !== "number" && jsonSchema.type !== "integer") {
597
+ errors = addError(errors, `The "max_value" action is not supported on type "${jsonSchema.type}".`);
598
+ break;
599
+ }
600
+ if (!Number.isFinite(valibotAction.requirement)) {
601
+ errors = addError(errors, 'The requirement of the "max_value" action is not JSON compatible.');
602
+ break;
603
+ }
604
+ jsonSchema.maximum = getUpperBound(jsonSchema.maximum, valibotAction.requirement);
605
+ break;
606
+ case "metadata":
607
+ if (typeof valibotAction.metadata.title === "string")
608
+ jsonSchema.title = valibotAction.metadata.title;
609
+ if (typeof valibotAction.metadata.description === "string")
610
+ jsonSchema.description = valibotAction.metadata.description;
611
+ if (Array.isArray(valibotAction.metadata.examples))
612
+ if (Array.isArray(jsonSchema.examples))
613
+ jsonSchema.examples = [...jsonSchema.examples, ...valibotAction.metadata.examples];
614
+ else
615
+ jsonSchema.examples = valibotAction.metadata.examples;
616
+ for (const key of Object.keys(valibotAction.metadata))
617
+ if (key !== "title" && key !== "description" && key !== "examples" && key !== "__proto__")
618
+ jsonSchema[key] = valibotAction.metadata[key];
619
+ break;
620
+ case "min_entries":
621
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
622
+ errors = addError(errors, 'The requirement of the "min_entries" action must be a non-negative integer.');
623
+ break;
624
+ }
625
+ jsonSchema.minProperties = getLowerBound(jsonSchema.minProperties, valibotAction.requirement);
626
+ break;
627
+ case "min_length":
628
+ if (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {
629
+ errors = addError(errors, 'The requirement of the "min_length" action must be a non-negative integer.');
630
+ break;
631
+ }
632
+ if (jsonSchema.type === "array")
633
+ jsonSchema.minItems = getLowerBound(jsonSchema.minItems, valibotAction.requirement);
634
+ else {
635
+ if (jsonSchema.type !== "string")
636
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
637
+ jsonSchema.minLength = getLowerBound(jsonSchema.minLength, valibotAction.requirement);
638
+ }
639
+ break;
640
+ case "min_value":
641
+ if (jsonSchema.type !== "number" && jsonSchema.type !== "integer") {
642
+ errors = addError(errors, `The "min_value" action is not supported on type "${jsonSchema.type}".`);
643
+ break;
644
+ }
645
+ if (!Number.isFinite(valibotAction.requirement)) {
646
+ errors = addError(errors, 'The requirement of the "min_value" action is not JSON compatible.');
647
+ break;
648
+ }
649
+ jsonSchema.minimum = getLowerBound(jsonSchema.minimum, valibotAction.requirement);
650
+ break;
651
+ case "multiple_of":
652
+ jsonSchema.multipleOf = valibotAction.requirement;
653
+ break;
654
+ case "non_empty":
655
+ if (jsonSchema.type === "array")
656
+ jsonSchema.minItems = getLowerBound(jsonSchema.minItems, 1);
657
+ else {
658
+ if (jsonSchema.type !== "string")
659
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
660
+ jsonSchema.minLength = getLowerBound(jsonSchema.minLength, 1);
661
+ }
662
+ break;
663
+ case "not_value":
664
+ if (!isJsonConstValue(valibotAction.requirement)) {
665
+ errors = addError(errors, 'The requirement of the "not_value" action is not JSON compatible.');
666
+ break;
667
+ }
668
+ jsonSchema.not = /* @__PURE__ */ getNotRestriction(jsonSchema.not, config?.target === "openapi-3.0" ? { enum: [valibotAction.requirement] } : { const: valibotAction.requirement });
669
+ break;
670
+ case "not_values":
671
+ if (!isJsonEnumValues(valibotAction.requirement)) {
672
+ errors = addError(errors, 'A requirement of the "not_values" action is not JSON compatible.');
673
+ break;
674
+ }
675
+ if (valibotAction.requirement.length)
676
+ jsonSchema.not = /* @__PURE__ */ getNotRestriction(jsonSchema.not, { enum: [...new Set(valibotAction.requirement)] });
677
+ break;
678
+ case "regex":
679
+ if (valibotAction.requirement.flags)
680
+ errors = addError(errors, "RegExp flags are not supported by JSON Schema.");
681
+ if (jsonSchema.pattern)
682
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
683
+ else
684
+ jsonSchema.pattern = valibotAction.requirement.source;
685
+ break;
686
+ case "safe_integer":
687
+ jsonSchema.type = "integer";
688
+ jsonSchema.minimum = getLowerBound(jsonSchema.minimum, Number.MIN_SAFE_INTEGER);
689
+ jsonSchema.maximum = getUpperBound(jsonSchema.maximum, Number.MAX_SAFE_INTEGER);
690
+ break;
691
+ case "starts_with":
692
+ if (jsonSchema.pattern)
693
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported in combination with another regex action.`);
694
+ else
695
+ jsonSchema.pattern = `^${escapeRegExp(valibotAction.requirement)}`;
696
+ break;
697
+ case "title":
698
+ jsonSchema.title = valibotAction.title;
699
+ break;
700
+ case "url":
701
+ jsonSchema.format = "uri";
702
+ break;
703
+ case "uuid":
704
+ jsonSchema.format = "uuid";
705
+ break;
706
+ case "value":
707
+ if (!isJsonConstValue(valibotAction.requirement)) {
708
+ errors = addError(errors, 'The requirement of the "value" action is not JSON compatible.');
709
+ break;
710
+ }
711
+ if (config?.target === "openapi-3.0")
712
+ intersectEnum(jsonSchema, [valibotAction.requirement]);
713
+ else if ("const" in jsonSchema && jsonSchema.const !== valibotAction.requirement)
714
+ errors = addError(errors, `The "${valibotAction.type}" action is not supported in combination with a different "const" restriction.`);
715
+ else
716
+ jsonSchema.const = valibotAction.requirement;
717
+ break;
718
+ case "values":
719
+ if (!isJsonEnumValues(valibotAction.requirement)) {
720
+ errors = addError(errors, 'A requirement of the "values" action is not JSON compatible.');
721
+ break;
722
+ }
723
+ intersectEnum(jsonSchema, valibotAction.requirement);
724
+ break;
725
+ default:
726
+ errors = addError(errors, `The "${valibotAction.type}" action cannot be converted to JSON Schema.`);
727
+ }
728
+ if (config?.overrideAction) {
729
+ const actionOverride = config.overrideAction({
730
+ valibotAction,
731
+ jsonSchema,
732
+ errors
733
+ });
734
+ if (actionOverride)
735
+ return { ...actionOverride };
736
+ }
737
+ if (errors)
738
+ for (const message of errors)
739
+ handleError(message, config);
740
+ return jsonSchema;
741
+ }
742
+ function flattenPipe(pipe) {
743
+ return pipe.flatMap((item) => ("pipe" in item) ? flattenPipe(item.pipe) : item);
744
+ }
745
+ function getDefinitionRef(referenceId) {
746
+ return `#/$defs/${referenceId.replaceAll("~", "~0").replaceAll("/", "~1")}`;
747
+ }
748
+ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {
749
+ if (!skipRef) {
750
+ const referenceId = context.referenceMap.get(valibotSchema);
751
+ if (referenceId) {
752
+ jsonSchema.$ref = getDefinitionRef(referenceId);
753
+ if (config?.overrideRef) {
754
+ const refOverride = config.overrideRef({
755
+ ...context,
756
+ referenceId,
757
+ valibotSchema,
758
+ jsonSchema
759
+ });
760
+ if (refOverride)
761
+ jsonSchema.$ref = refOverride;
762
+ }
763
+ return jsonSchema;
764
+ }
765
+ }
766
+ if ("pipe" in valibotSchema) {
767
+ const flatPipe = flattenPipe(valibotSchema.pipe);
768
+ let startIndex = 0;
769
+ let stopIndex = flatPipe.length - 1;
770
+ if (config?.typeMode === "input") {
771
+ const inputStopIndex = flatPipe.slice(1).findIndex((item) => item.kind === "schema" || item.kind === "transformation" && (item.type === "find_item" || item.type === "map_items" || item.type === "parse_boolean" || 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"));
772
+ if (inputStopIndex !== -1)
773
+ stopIndex = inputStopIndex;
774
+ } else if (config?.typeMode === "output") {
775
+ const outputStartIndex = flatPipe.findLastIndex((item) => item.kind === "schema");
776
+ if (outputStartIndex !== -1)
777
+ startIndex = outputStartIndex;
778
+ }
779
+ for (let index = startIndex;index <= stopIndex; index++) {
780
+ const valibotPipeItem = flatPipe[index];
781
+ if (valibotPipeItem.kind === "schema") {
782
+ if (index > startIndex)
783
+ handleError('Set the "typeMode" config to "input" or "output" to convert pipelines with multiple schemas.', config);
784
+ jsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);
785
+ } else
786
+ jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
787
+ }
788
+ return jsonSchema;
789
+ }
790
+ let errors;
791
+ switch (valibotSchema.type) {
792
+ case "boolean":
793
+ jsonSchema.type = "boolean";
794
+ break;
795
+ case "null":
796
+ if (config?.target === "openapi-3.0")
797
+ jsonSchema.enum = [null];
798
+ else
799
+ jsonSchema.type = "null";
800
+ break;
801
+ case "number":
802
+ jsonSchema.type = "number";
803
+ break;
804
+ case "string":
805
+ jsonSchema.type = "string";
806
+ break;
807
+ case "array":
808
+ jsonSchema.type = "array";
809
+ jsonSchema.items = convertSchema({}, valibotSchema.item, config, context);
810
+ break;
811
+ case "tuple":
812
+ case "tuple_with_rest":
813
+ case "loose_tuple":
814
+ case "strict_tuple":
815
+ jsonSchema.type = "array";
816
+ if (config?.target === "openapi-3.0") {
817
+ jsonSchema.items = { anyOf: [] };
818
+ jsonSchema.minItems = valibotSchema.items.length;
819
+ for (const item of valibotSchema.items)
820
+ jsonSchema.items.anyOf.push(convertSchema({}, item, config, context));
821
+ if (valibotSchema.type === "tuple_with_rest")
822
+ jsonSchema.items.anyOf.push(convertSchema({}, valibotSchema.rest, config, context));
823
+ else if (valibotSchema.type === "strict_tuple" || valibotSchema.type === "tuple")
824
+ jsonSchema.maxItems = valibotSchema.items.length;
825
+ } else if (config?.target === "draft-2020-12") {
826
+ jsonSchema.prefixItems = [];
827
+ jsonSchema.minItems = valibotSchema.items.length;
828
+ for (const item of valibotSchema.items)
829
+ jsonSchema.prefixItems.push(convertSchema({}, item, config, context));
830
+ if (valibotSchema.type === "tuple_with_rest")
831
+ jsonSchema.items = convertSchema({}, valibotSchema.rest, config, context);
832
+ else if (valibotSchema.type === "strict_tuple")
833
+ jsonSchema.items = false;
834
+ } else {
835
+ jsonSchema.items = [];
836
+ jsonSchema.minItems = valibotSchema.items.length;
837
+ for (const item of valibotSchema.items)
838
+ jsonSchema.items.push(convertSchema({}, item, config, context));
839
+ if (valibotSchema.type === "tuple_with_rest")
840
+ jsonSchema.additionalItems = convertSchema({}, valibotSchema.rest, config, context);
841
+ else if (valibotSchema.type === "strict_tuple")
842
+ jsonSchema.additionalItems = false;
843
+ }
844
+ break;
845
+ case "object":
846
+ case "object_with_rest":
847
+ case "loose_object":
848
+ case "strict_object":
849
+ jsonSchema.type = "object";
850
+ jsonSchema.properties = {};
851
+ jsonSchema.required = [];
852
+ for (const key in valibotSchema.entries) {
853
+ const entry = valibotSchema.entries[key];
854
+ jsonSchema.properties[key] = convertSchema({}, entry, config, context);
855
+ if (entry.type !== "exact_optional" && entry.type !== "nullish" && entry.type !== "optional")
856
+ jsonSchema.required.push(key);
857
+ }
858
+ if (valibotSchema.type === "object_with_rest")
859
+ jsonSchema.additionalProperties = convertSchema({}, valibotSchema.rest, config, context);
860
+ else if (valibotSchema.type === "strict_object")
861
+ jsonSchema.additionalProperties = false;
862
+ break;
863
+ case "record":
864
+ if (config?.target === "openapi-3.0" && "pipe" in valibotSchema.key)
865
+ errors = addError(errors, 'The "record" schema with a schema for the key that contains a "pipe" cannot be converted to JSON Schema.');
866
+ if (valibotSchema.key.type !== "string")
867
+ errors = addError(errors, `The "record" schema with the "${valibotSchema.key.type}" schema for the key cannot be converted to JSON Schema.`);
868
+ jsonSchema.type = "object";
869
+ if (config?.target !== "openapi-3.0")
870
+ jsonSchema.propertyNames = convertSchema({}, valibotSchema.key, config, context);
871
+ jsonSchema.additionalProperties = convertSchema({}, valibotSchema.value, config, context);
872
+ break;
873
+ case "any":
874
+ case "unknown":
875
+ break;
876
+ case "never":
877
+ jsonSchema.not = {};
878
+ break;
879
+ case "nullable":
880
+ case "nullish":
881
+ if (config?.target === "openapi-3.0") {
882
+ const innerSchema = convertSchema({}, valibotSchema.wrapped, config, context);
883
+ Object.assign(jsonSchema, innerSchema);
884
+ jsonSchema.nullable = true;
885
+ } else
886
+ jsonSchema.anyOf = [convertSchema({}, valibotSchema.wrapped, config, context), { type: "null" }];
887
+ if (valibotSchema.default !== undefined)
888
+ jsonSchema.default = typeof valibotSchema.default === "function" ? valibotSchema.default() : valibotSchema.default;
889
+ break;
890
+ case "exact_optional":
891
+ case "optional":
892
+ case "undefinedable":
893
+ jsonSchema = convertSchema(jsonSchema, valibotSchema.wrapped, config, context);
894
+ if (valibotSchema.default !== undefined)
895
+ jsonSchema.default = typeof valibotSchema.default === "function" ? valibotSchema.default() : valibotSchema.default;
896
+ break;
897
+ case "literal":
898
+ if (!isJsonConstValue(valibotSchema.literal)) {
899
+ errors = addError(errors, 'The value of the "literal" schema is not JSON compatible.');
900
+ break;
901
+ }
902
+ if (config?.target === "openapi-3.0")
903
+ jsonSchema.enum = [valibotSchema.literal];
904
+ else
905
+ jsonSchema.const = valibotSchema.literal;
906
+ break;
907
+ case "enum":
908
+ case "picklist": {
909
+ const options = valibotSchema.options;
910
+ if (!options.every((option) => typeof option === "string" || typeof option === "number" && Number.isFinite(option))) {
911
+ errors = addError(errors, `An option of the "${valibotSchema.type}" schema is not JSON compatible.`);
912
+ break;
913
+ }
914
+ jsonSchema.enum = options;
915
+ if (options.every((option) => typeof option === "string"))
916
+ jsonSchema.type = "string";
917
+ else if (options.every((option) => typeof option === "number"))
918
+ jsonSchema.type = "number";
919
+ else if (config?.target !== "openapi-3.0")
920
+ jsonSchema.type = ["string", "number"];
921
+ break;
922
+ }
923
+ case "union":
924
+ jsonSchema.anyOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
925
+ break;
926
+ case "variant":
927
+ jsonSchema.oneOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
928
+ break;
929
+ case "intersect":
930
+ jsonSchema.allOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
931
+ break;
932
+ case "lazy": {
933
+ let wrappedValibotSchema = context.getterMap.get(valibotSchema.getter);
934
+ if (!wrappedValibotSchema) {
935
+ wrappedValibotSchema = valibotSchema.getter(undefined);
936
+ context.getterMap.set(valibotSchema.getter, wrappedValibotSchema);
937
+ }
938
+ let referenceId = context.referenceMap.get(wrappedValibotSchema);
939
+ if (!referenceId) {
940
+ referenceId = context.referenceMap.createId(context.definitions);
941
+ context.referenceMap.set(wrappedValibotSchema, referenceId);
942
+ context.definitions[referenceId] = convertSchema({}, wrappedValibotSchema, config, context, true);
943
+ }
944
+ jsonSchema.$ref = getDefinitionRef(referenceId);
945
+ if (config?.overrideRef) {
946
+ const refOverride = config.overrideRef({
947
+ ...context,
948
+ referenceId,
949
+ valibotSchema: wrappedValibotSchema,
950
+ jsonSchema
951
+ });
952
+ if (refOverride)
953
+ jsonSchema.$ref = refOverride;
954
+ }
955
+ break;
956
+ }
957
+ default:
958
+ errors = addError(errors, `The "${valibotSchema.type}" schema cannot be converted to JSON Schema.`);
959
+ }
960
+ if (config?.overrideSchema) {
961
+ const schemaOverride = config.overrideSchema({
962
+ ...context,
963
+ referenceId: context.referenceMap.get(valibotSchema),
964
+ valibotSchema,
965
+ jsonSchema,
966
+ errors
967
+ });
968
+ if (schemaOverride)
969
+ return { ...schemaOverride };
970
+ }
971
+ if (errors)
972
+ for (const message of errors)
973
+ handleError(message, config);
974
+ return jsonSchema;
975
+ }
976
+ var store;
977
+ function getGlobalDefs() {
978
+ return store;
979
+ }
980
+ function toJsonSchema(schema, config) {
981
+ const context = {
982
+ definitions: {},
983
+ referenceMap: new ReferenceMap,
984
+ getterMap: /* @__PURE__ */ new Map
985
+ };
986
+ const definitions = config?.definitions ?? getGlobalDefs();
987
+ if (definitions) {
988
+ for (const key in definitions)
989
+ context.referenceMap.set(definitions[key], key);
990
+ for (const key in definitions)
991
+ context.definitions[key] = convertSchema({}, definitions[key], config, context, true);
992
+ }
993
+ const jsonSchema = convertSchema({}, schema, config, context);
994
+ const target = config?.target ?? "draft-07";
995
+ if (target === "draft-2020-12")
996
+ jsonSchema.$schema = "https://json-schema.org/draft/2020-12/schema";
997
+ else if (target === "draft-07")
998
+ jsonSchema.$schema = "http://json-schema.org/draft-07/schema#";
999
+ if (context.referenceMap.size)
1000
+ jsonSchema.$defs = context.definitions;
1001
+ return jsonSchema;
1002
+ }
1003
+
1004
+ // packages/agent-runtime/zohoMailSpecs.ts
1005
+ function toToolInputJsonSchema(schema) {
1006
+ const { $schema: _ignored, ...jsonSchema } = toJsonSchema(schema);
1007
+ return jsonSchema;
1008
+ }
1009
+ var datacenter = (id, label) => Object.freeze({
1010
+ id,
1011
+ label,
1012
+ accountsBase: `https://accounts.zoho.${id}`,
1013
+ mailApiBase: `https://mail.zoho.${id}`,
1014
+ calendarApiBase: `https://calendar.zoho.${id}`
1015
+ });
1016
+ var ZOHO_MAIL_DATACENTERS = Object.freeze([
1017
+ datacenter("com", "国际版"),
1018
+ datacenter("com.cn", "中国区"),
1019
+ datacenter("eu", "欧洲区"),
1020
+ datacenter("in", "印度区"),
1021
+ datacenter("com.au", "澳洲区"),
1022
+ datacenter("jp", "日本区")
1023
+ ]);
1024
+ var ZOHO_MAIL_READONLY_SCOPES = Object.freeze([
1025
+ "ZohoMail.accounts.READ",
1026
+ "ZohoMail.folders.READ",
1027
+ "ZohoMail.messages.READ"
1028
+ ]);
1029
+ var ZOHO_CAPABILITY_IDS = Object.freeze(["mail_read", "calendar_read"]);
1030
+ var ZOHO_CALENDAR_READONLY_SCOPES = Object.freeze(["ZohoCalendar.calendar.READ", "ZohoCalendar.event.READ"]);
1031
+ var ZOHO_CALENDAR_TOOL_VALIBOT_SCHEMAS = {
1032
+ zohoCalendarListCalendars: strictObject({}),
1033
+ zohoCalendarListEvents: strictObject({
1034
+ calendarUid: optional(pipe(string(), minLength(1))),
1035
+ startDate: optional(pipe(string(), regex(/^\d{4}-\d{2}-\d{2}$/))),
1036
+ endDate: optional(pipe(string(), regex(/^\d{4}-\d{2}-\d{2}$/))),
1037
+ limit: optional(pipe(number(), integer(), minValue(1), maxValue(50)), 20)
1038
+ })
1039
+ };
1040
+ var ZOHO_CALENDAR_TOOL_SCHEMAS = {
1041
+ zohoCalendarListCalendars: toToolInputJsonSchema(ZOHO_CALENDAR_TOOL_VALIBOT_SCHEMAS.zohoCalendarListCalendars),
1042
+ zohoCalendarListEvents: toToolInputJsonSchema(ZOHO_CALENDAR_TOOL_VALIBOT_SCHEMAS.zohoCalendarListEvents)
1043
+ };
1044
+ var ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS = {
1045
+ zohoMailListFolders: strictObject({}),
1046
+ zohoMailSearchMessages: strictObject({
1047
+ query: optional(string()),
1048
+ folderId: optional(pipe(string(), minLength(1))),
1049
+ limit: optional(pipe(number(), integer(), minValue(1), maxValue(30)), 10),
1050
+ unreadOnly: optional(boolean())
1051
+ }),
1052
+ zohoMailReadMessage: strictObject({
1053
+ messageId: pipe(string(), minLength(1)),
1054
+ folderId: pipe(string(), minLength(1))
1055
+ }),
1056
+ zohoMailReadMessages: strictObject({
1057
+ messages: pipe(array(strictObject({
1058
+ messageId: pipe(string(), minLength(1)),
1059
+ folderId: pipe(string(), minLength(1))
1060
+ })), minLength(1), maxLength(10))
1061
+ })
1062
+ };
1063
+ var ZOHO_MAIL_TOOL_NAMES = ["zohoMailListFolders", "zohoMailSearchMessages", "zohoMailReadMessage", "zohoMailReadMessages"];
1064
+ var ZOHO_MAIL_TOOL_SCHEMAS = {
1065
+ zohoMailListFolders: toToolInputJsonSchema(ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS.zohoMailListFolders),
1066
+ zohoMailSearchMessages: toToolInputJsonSchema(ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS.zohoMailSearchMessages),
1067
+ zohoMailReadMessage: toToolInputJsonSchema(ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS.zohoMailReadMessage),
1068
+ zohoMailReadMessages: toToolInputJsonSchema(ZOHO_MAIL_TOOL_VALIBOT_SCHEMAS.zohoMailReadMessages)
1069
+ };
1070
+
1071
+ // packages/ai/tools/toolApiClient.ts
1072
+ var MAIN_SERVER = "https://nolo.chat";
1073
+ var getIsDesktopApp = () => typeof window !== "undefined" && Boolean(window.__NOLO_DESKTOP__);
1074
+ var isLocalServerUrl = (value) => {
1075
+ if (!value)
1076
+ return false;
1077
+ try {
1078
+ const hostname = new URL(value).hostname.toLowerCase();
1079
+ return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
1080
+ } catch {
1081
+ return false;
1082
+ }
1083
+ };
1084
+ var resolveDesktopSafeServer = (value) => {
1085
+ if (!getIsDesktopApp())
1086
+ return value || MAIN_SERVER;
1087
+ return isLocalServerUrl(value) ? MAIN_SERVER : value || MAIN_SERVER;
1088
+ };
1089
+ var selectCurrentTokenFromState = (state) => {
1090
+ const token = selectIdentityToken(state);
1091
+ return typeof token === "string" ? token : null;
1092
+ };
1093
+ var selectCurrentDialogKeyFromState = (_state) => getActiveDialogKey();
1094
+ var CONTROL_OR_WHITESPACE_RE = /[\u0000-\u001f\u007f\s]/;
1095
+ var hasSuppliedDialogValue = (value) => value != null && (typeof value !== "string" || value.trim().length > 0);
1096
+ var normalizeToolDialogId = (value) => {
1097
+ if (typeof value !== "string")
1098
+ return null;
1099
+ if (/[\u0000-\u001f\u007f]/.test(value))
1100
+ return null;
1101
+ const trimmed = value.trim();
1102
+ if (!trimmed || CONTROL_OR_WHITESPACE_RE.test(trimmed))
1103
+ return null;
1104
+ if (trimmed.includes("-msg-"))
1105
+ return null;
1106
+ if (trimmed.startsWith("dialog-")) {
1107
+ const identity = splitDialogKeyIdentity(trimmed);
1108
+ const parsedId = identity?.dialogId?.trim();
1109
+ if (!parsedId || CONTROL_OR_WHITESPACE_RE.test(parsedId) || parsedId.includes("-msg-")) {
1110
+ return null;
1111
+ }
1112
+ return parsedId;
1113
+ }
1114
+ return trimmed;
1115
+ };
1116
+ var resolveToolDialogId = (thunkApi, options = {}) => {
1117
+ if (hasSuppliedDialogValue(options?.dialogId)) {
1118
+ return normalizeToolDialogId(options.dialogId);
1119
+ }
1120
+ if (hasSuppliedDialogValue(options?.dialogKey)) {
1121
+ return normalizeToolDialogId(options.dialogKey);
1122
+ }
1123
+ if (hasSuppliedDialogValue(thunkApi?.extra?.dialogId)) {
1124
+ return normalizeToolDialogId(thunkApi.extra.dialogId);
1125
+ }
1126
+ if (hasSuppliedDialogValue(thunkApi?.extra?.dialogKey)) {
1127
+ return normalizeToolDialogId(thunkApi.extra.dialogKey);
1128
+ }
1129
+ if (hasSuppliedDialogValue(thunkApi?.dialogId)) {
1130
+ return normalizeToolDialogId(thunkApi.dialogId);
1131
+ }
1132
+ if (hasSuppliedDialogValue(thunkApi?.dialogKey)) {
1133
+ return normalizeToolDialogId(thunkApi.dialogKey);
1134
+ }
1135
+ let state;
1136
+ try {
1137
+ state = typeof thunkApi?.getState === "function" ? thunkApi.getState() : undefined;
1138
+ } catch {
1139
+ state = undefined;
1140
+ }
1141
+ if (hasSuppliedDialogValue(state?.dialog?.currentDialogKey)) {
1142
+ return normalizeToolDialogId(state.dialog.currentDialogKey);
1143
+ }
1144
+ return normalizeToolDialogId(selectCurrentDialogKeyFromState(state));
1145
+ };
1146
+ var resolveToolBaseUrl2 = (currentServer) => {
1147
+ const _window = globalThis.window;
1148
+ if (!_window)
1149
+ return (currentServer || "").replace(/\/+$/, "");
1150
+ const origin = _window.location?.origin;
1151
+ if (!getIsDesktopApp() && typeof origin === "string" && /^https?:\/\//.test(origin)) {
1152
+ return origin.replace(/\/+$/, "");
1153
+ }
1154
+ const fallbackLocal = typeof origin === "string" ? origin.replace(/\/+$/, "") : "";
1155
+ if (!currentServer)
1156
+ return fallbackLocal;
1157
+ return currentServer.replace(/\/+$/, "");
1158
+ };
1159
+ var DESKTOP_LOCAL_TOOL_PATHS = new Set([
1160
+ "/api/exec-shell",
1161
+ "/api/check-env",
1162
+ "/api/read-file",
1163
+ "/api/write-file",
1164
+ "/api/apply-edit",
1165
+ "/api/apply-line-edits",
1166
+ "/api/code-search",
1167
+ "/api/desktop/files/roots",
1168
+ "/api/desktop/files/roots/request",
1169
+ "/api/desktop/files/list",
1170
+ "/api/desktop/files/read",
1171
+ "/api/desktop/files/plan",
1172
+ "/api/desktop/files/approve",
1173
+ "/api/desktop/files/execute",
1174
+ "/api/desktop/files/undo",
1175
+ "/api/desktop/files/history"
1176
+ ]);
1177
+ var getWindowOrigin = () => {
1178
+ const _window = globalThis.window;
1179
+ const origin = _window?.location?.origin;
1180
+ return typeof origin === "string" && origin ? origin.replace(/\/+$/, "") : null;
1181
+ };
1182
+ var resolveToolApiBaseUrl = (currentServer, path) => {
1183
+ if (path && DESKTOP_LOCAL_TOOL_PATHS.has(path) && getIsDesktopApp()) {
1184
+ const localOrigin = getWindowOrigin();
1185
+ if (localOrigin)
1186
+ return localOrigin;
1187
+ }
1188
+ return resolveToolBaseUrl2(currentServer);
1189
+ };
1190
+ var getRequestConfig2 = (thunkApi) => {
1191
+ const state = thunkApi.getState();
1192
+ const token = selectCurrentTokenFromState(state);
1193
+ const currentServer = thunkApi.serverBase ?? (() => {
1194
+ const server = getRuntimeServerSnapshot(state).currentServer;
1195
+ return googleSessionServer(token, server) ?? resolveDesktopSafeServer(server);
1196
+ })();
1197
+ if (!currentServer)
1198
+ throw new Error("无法获取当前服务器地址。");
1199
+ return { currentServer, token };
1200
+ };
1201
+ var getToolBaseUrl2 = (thunkApi) => {
1202
+ const { currentServer } = getRequestConfig2(thunkApi);
1203
+ const baseUrl = resolveToolBaseUrl2(currentServer);
1204
+ if (!baseUrl)
1205
+ throw new Error("无法获取工具服务器地址。");
1206
+ return baseUrl;
1207
+ };
1208
+ var getToolRequestContext2 = (thunkApi) => {
1209
+ const { currentServer, token } = getRequestConfig2(thunkApi);
1210
+ const baseUrl = resolveToolBaseUrl2(currentServer);
1211
+ if (!baseUrl)
1212
+ throw new Error("无法获取工具服务器地址。");
1213
+ return {
1214
+ currentServer,
1215
+ token,
1216
+ baseUrl
1217
+ };
1218
+ };
1219
+
1220
+ class ToolApiError2 extends Error {
1221
+ status;
1222
+ code;
1223
+ details;
1224
+ upperCredits;
1225
+ executionRevision;
1226
+ constructor(message, options) {
1227
+ super(message);
1228
+ this.name = "ToolApiError";
1229
+ this.status = options?.status;
1230
+ this.code = options?.code;
1231
+ this.details = options?.details;
1232
+ this.upperCredits = options?.upperCredits;
1233
+ this.executionRevision = normalizeMediaConfirmExecutionRevision(options?.executionRevision);
1234
+ }
1235
+ }
1236
+ var buildToolRequestHeaders2 = (thunkApi, options = {}) => {
1237
+ const { withAuth = false, agentKey } = options;
1238
+ const { token } = getRequestConfig2(thunkApi);
1239
+ const headers = {
1240
+ "Content-Type": "application/json"
1241
+ };
1242
+ if (withAuth && token) {
1243
+ headers["Authorization"] = `Bearer ${token}`;
1244
+ }
1245
+ if (agentKey && typeof agentKey === "string" && agentKey.trim()) {
1246
+ headers["X-Nolo-Agent-Key"] = agentKey.trim();
1247
+ }
1248
+ const dialogId = resolveToolDialogId(thunkApi, options);
1249
+ if (dialogId) {
1250
+ headers["X-Nolo-Dialog-Id"] = dialogId;
1251
+ }
1252
+ if (typeof window !== "undefined" && window.__NOLO_DESKTOP__) {
1253
+ headers["X-Nolo-Desktop-Tool"] = "1";
1254
+ }
1255
+ return headers;
1256
+ };
1257
+ var buildToolRequestBody = (thunkApi, body, options) => {
1258
+ if (!options.injectDialogId)
1259
+ return body;
1260
+ if (!isRecord(body))
1261
+ return body;
1262
+ if ("dialogId" in body)
1263
+ return body;
1264
+ const dialogId = resolveToolDialogId(thunkApi, options);
1265
+ if (!dialogId)
1266
+ return body;
1267
+ return {
1268
+ ...body,
1269
+ dialogId
1270
+ };
1271
+ };
1272
+ var buildResponsePreview = (text) => compactWhitespace(text).slice(0, 240);
1273
+ var looksLikeHtmlResponse = (text, contentType) => {
1274
+ if (contentType?.toLowerCase().includes("text/html"))
1275
+ return true;
1276
+ const trimmed = asTrimmedLowercaseString(text);
1277
+ return trimmed.startsWith("<!doctype html") || trimmed.startsWith("<html");
1278
+ };
1279
+ async function callToolApi2(thunkApi, path, body, options = {}) {
1280
+ const { currentServer } = getRequestConfig2(thunkApi);
1281
+ const baseUrl = resolveToolApiBaseUrl(currentServer, path);
1282
+ if (!baseUrl)
1283
+ throw new Error("无法获取工具服务器地址。");
1284
+ const url = `${baseUrl}${path}`;
1285
+ const headers = buildToolRequestHeaders2(thunkApi, options);
1286
+ const method = options.method ?? "POST";
1287
+ const response = await fetch(url, {
1288
+ method,
1289
+ headers,
1290
+ ...options.signal ? { signal: options.signal } : {},
1291
+ ...method === "GET" || method === "DELETE" && Object.keys(body ?? {}).length === 0 ? {} : { body: JSON.stringify(buildToolRequestBody(thunkApi, body, options)) }
1292
+ });
1293
+ const contentType = response.headers.get("content-type");
1294
+ const responseText = await response.text();
1295
+ if (!response.ok) {
1296
+ let errorMessage = `API 请求失败,状态码: ${response.status}`;
1297
+ let errorCode;
1298
+ let errorDetails;
1299
+ let upperCredits;
1300
+ let errorExecutionRevision;
1301
+ try {
1302
+ const errorData = JSON.parse(responseText);
1303
+ const err = errorData?.error;
1304
+ if (err) {
1305
+ errorMessage += `: ${err.message ?? JSON.stringify(err)}`;
1306
+ errorCode = typeof err.code === "string" ? err.code : undefined;
1307
+ errorDetails = err.details;
1308
+ if (typeof err.upperCredits === "number") {
1309
+ upperCredits = err.upperCredits;
1310
+ }
1311
+ errorExecutionRevision = err.executionRevision ?? err.details?.executionRevision;
1312
+ }
1313
+ } catch {
1314
+ errorCode = looksLikeHtmlResponse(responseText, contentType) ? "HTML_ERROR_RESPONSE" : "NON_JSON_ERROR_RESPONSE";
1315
+ errorDetails = {
1316
+ contentType,
1317
+ responsePreview: buildResponsePreview(responseText)
1318
+ };
1319
+ if (typeof errorDetails.responsePreview === "string" && errorDetails.responsePreview) {
1320
+ errorMessage += `: ${errorDetails.responsePreview}`;
1321
+ }
1322
+ }
1323
+ throw new ToolApiError2(errorMessage, {
1324
+ status: response.status,
1325
+ code: errorCode,
1326
+ details: errorDetails,
1327
+ upperCredits,
1328
+ executionRevision: errorExecutionRevision
1329
+ });
1330
+ }
1331
+ try {
1332
+ return JSON.parse(responseText);
1333
+ } catch {
1334
+ throw new ToolApiError2("服务端返回了无法解析的非 JSON 响应", {
1335
+ status: response.status,
1336
+ code: looksLikeHtmlResponse(responseText, contentType) ? "HTML_RESPONSE" : "INVALID_JSON_RESPONSE",
1337
+ details: {
1338
+ contentType,
1339
+ responsePreview: buildResponsePreview(responseText)
1340
+ }
1341
+ });
1342
+ }
1343
+ }
1344
+
1345
+ // packages/app/utils/desktopActionGateChannel.ts
1346
+ function targetForRunKind(kind, ctx = {}) {
1347
+ if (kind === "server-run") {
1348
+ return {
1349
+ kind: "web",
1350
+ server: ctx.server?.trim() ?? "",
1351
+ token: ctx.token ?? null
1352
+ };
1353
+ }
1354
+ return { kind: "desktop" };
1355
+ }
1356
+ var NEEDS_LOGIN_MESSAGE = "需要登录后才能处理该授权请求";
1357
+ var MISSING_SERVER_MESSAGE = "未配置服务器地址,无法处理该授权请求";
1358
+ var gates = new Map;
1359
+ var targets = new Map;
1360
+ var failures = new Map;
1361
+ var metadata = new Map;
1362
+ var errors = new Map;
1363
+ var listeners = new Set;
1364
+ var cachedSnapshot = null;
1365
+ function invalidateSnapshot() {
1366
+ cachedSnapshot = null;
1367
+ }
1368
+ function notify() {
1369
+ for (const listener of listeners) {
1370
+ try {
1371
+ listener();
1372
+ } catch {}
1373
+ }
1374
+ }
1375
+ function pushGate(gate, target = { kind: "desktop" }, meta) {
1376
+ if (!gate || typeof gate.id !== "string" || gate.id.length === 0)
1377
+ return;
1378
+ failures.delete(gate.id);
1379
+ if (target.kind === "web" && (!target.token || !target.server.trim())) {
1380
+ const message = !target.token ? NEEDS_LOGIN_MESSAGE : MISSING_SERVER_MESSAGE;
1381
+ if (meta)
1382
+ failures.set(gate.id, { gateId: gate.id, meta: { ...meta, storage: "web" }, message });
1383
+ gates.delete(gate.id);
1384
+ targets.delete(gate.id);
1385
+ metadata.delete(gate.id);
1386
+ errors.set(gate.id, message);
1387
+ invalidateSnapshot();
1388
+ notify();
1389
+ return;
1390
+ }
1391
+ metadata.delete(gate.id);
1392
+ if (meta && target.kind !== "local")
1393
+ metadata.set(gate.id, { ...meta, storage: target.kind });
1394
+ errors.delete(gate.id);
1395
+ targets.set(gate.id, target);
1396
+ gates.set(gate.id, gate);
1397
+ invalidateSnapshot();
1398
+ notify();
1399
+ }
1400
+ function clearGateTurn(turnId) {
1401
+ for (const [id, failure] of failures) {
1402
+ if (failure.meta.turnId === turnId)
1403
+ failures.delete(id);
1404
+ }
1405
+ for (const [id, meta] of metadata) {
1406
+ if (meta.turnId !== turnId)
1407
+ continue;
1408
+ gates.delete(id);
1409
+ targets.delete(id);
1410
+ metadata.delete(id);
1411
+ errors.delete(id);
1412
+ }
1413
+ invalidateSnapshot();
1414
+ notify();
1415
+ }
1416
+ function getSnapshot() {
1417
+ if (!cachedSnapshot) {
1418
+ cachedSnapshot = {
1419
+ gates: [...gates.values()],
1420
+ failures: [...failures.values()],
1421
+ errors: Object.fromEntries(errors)
1422
+ };
1423
+ }
1424
+ return cachedSnapshot;
1425
+ }
1426
+ async function resolveGate(gateId, options, fetchImpl = fetch, targetOverride) {
1427
+ if (failures.has(gateId))
1428
+ return false;
1429
+ if (!targetOverride && !gates.has(gateId))
1430
+ return false;
1431
+ const target = targetOverride ?? targets.get(gateId) ?? { kind: "desktop" };
1432
+ if (target.kind === "local") {
1433
+ try {
1434
+ const ok = target.resolve ? await target.resolve(options) : true;
1435
+ if (!ok) {
1436
+ return false;
1437
+ }
1438
+ errors.delete(gateId);
1439
+ gates.delete(gateId);
1440
+ targets.delete(gateId);
1441
+ metadata.delete(gateId);
1442
+ invalidateSnapshot();
1443
+ notify();
1444
+ return true;
1445
+ } catch (error) {
1446
+ errors.set(gateId, "授权请求提交失败,请重试");
1447
+ invalidateSnapshot();
1448
+ notify();
1449
+ return false;
1450
+ }
1451
+ }
1452
+ const isWeb = target.kind === "web";
1453
+ const trimmedServer = isWeb ? target.server.trim().replace(/\/+$/, "") : "";
1454
+ const url = isWeb ? `${trimmedServer}/api/agent/secret-request/${encodeURIComponent(gateId)}` : `/api/desktop/agent-runtime/action-gate/${encodeURIComponent(gateId)}`;
1455
+ const headers = { "Content-Type": "application/json" };
1456
+ if (isWeb)
1457
+ headers.Authorization = `Bearer ${target.token}`;
1458
+ const failTerminal = (message) => {
1459
+ gates.delete(gateId);
1460
+ targets.delete(gateId);
1461
+ metadata.delete(gateId);
1462
+ errors.set(gateId, message);
1463
+ invalidateSnapshot();
1464
+ notify();
1465
+ return false;
1466
+ };
1467
+ if (isWeb && (!target.token || !trimmedServer)) {
1468
+ return failTerminal(!target.token ? NEEDS_LOGIN_MESSAGE : MISSING_SERVER_MESSAGE);
1469
+ }
1470
+ try {
1471
+ const response = await fetchImpl(url, {
1472
+ method: "POST",
1473
+ headers,
1474
+ body: JSON.stringify({ decision: options.decision, value: options.value })
1475
+ });
1476
+ if (!response.ok) {
1477
+ const data = await response.json().catch(() => null);
1478
+ const message = `授权请求提交失败(HTTP ${response.status}),请重试`;
1479
+ const isTerminal = response.status >= 400 && response.status < 500 && data?.gateId === gateId;
1480
+ if (isTerminal) {
1481
+ gates.delete(gateId);
1482
+ targets.delete(gateId);
1483
+ metadata.delete(gateId);
1484
+ errors.set(gateId, message);
1485
+ invalidateSnapshot();
1486
+ notify();
1487
+ return false;
1488
+ }
1489
+ throw new Error(message);
1490
+ }
1491
+ errors.delete(gateId);
1492
+ gates.delete(gateId);
1493
+ targets.delete(gateId);
1494
+ metadata.delete(gateId);
1495
+ invalidateSnapshot();
1496
+ notify();
1497
+ return true;
1498
+ } catch (error) {
1499
+ errors.set(gateId, "授权请求提交失败,请重试");
1500
+ invalidateSnapshot();
1501
+ notify();
1502
+ return false;
1503
+ }
1504
+ }
1505
+
1506
+ // packages/ai/tools/memoryToolContext.ts
1507
+ var trimmed = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
1508
+ function findLoadedDialogs(state, dialogId, exactKey) {
1509
+ const entities = selectOptionalEntities2(state);
1510
+ if (!entities || typeof entities !== "object")
1511
+ return [];
1512
+ const matches = [];
1513
+ for (const key of Object.keys(entities)) {
1514
+ if (!isDialogRecordKeyForId(key, dialogId))
1515
+ continue;
1516
+ const record = entities[key];
1517
+ if (!record || trimmed(record.id) !== dialogId)
1518
+ continue;
1519
+ if (exactKey && key !== exactKey)
1520
+ continue;
1521
+ matches.push({ key, record });
1522
+ }
1523
+ return matches;
1524
+ }
1525
+ function resolveMemoryToolContext(state, context) {
1526
+ return resolveToolAttributionContext(state, context);
1527
+ }
1528
+ function resolveToolAttributionContext(state, context, options) {
1529
+ const UNRESOLVED = options?.errorLabel ?? "无法确定记忆归属";
1530
+ const agentKey = trimmed(context?.agentKey);
1531
+ if (options?.requireAgentKey && !agentKey) {
1532
+ throw new Error(`${UNRESOLVED}:执行上下文缺少 agentKey,不会从当前对话推断。`);
1533
+ }
1534
+ const contextDialogId = trimmed(context?.dialogId);
1535
+ const contextDialogKey = trimmed(context?.dialogKey);
1536
+ let keyIdentity = null;
1537
+ if (contextDialogKey) {
1538
+ keyIdentity = parseDialogKey(contextDialogKey);
1539
+ if (!keyIdentity) {
1540
+ throw new Error(`${UNRESOLVED}:执行上下文里的对话键 ${contextDialogKey} 不是可解析的 dialog-<owner>-<id>,不会按 id 猜归属。`);
1541
+ }
1542
+ if (contextDialogId && keyIdentity.dialogId !== contextDialogId) {
1543
+ throw new Error(`${UNRESOLVED}:执行上下文自相矛盾——对话键 ${contextDialogKey} 指向 ${keyIdentity.dialogId},但 dialogId 是 ${contextDialogId}。`);
1544
+ }
1545
+ }
1546
+ const dialogId = keyIdentity?.dialogId ?? contextDialogId;
1547
+ if (!dialogId) {
1548
+ throw new Error(`${UNRESOLVED}:本次工具调用缺少所属对话(dialogId),不会改用当前打开的对话或视图 Space。`);
1549
+ }
1550
+ const matches = findLoadedDialogs(state, dialogId, contextDialogKey);
1551
+ if (matches.length === 0) {
1552
+ throw new Error(`${UNRESOLVED}:对话 ${dialogId} 未加载,无法确认它的 Space 归属。`);
1553
+ }
1554
+ if (matches.length > 1) {
1555
+ throw new Error(`${UNRESOLVED}:加载中有 ${matches.length} 个同 id 的对话(${matches.map((m) => m.key).join(" / ")}),仅凭 dialogId 无法确定归属;执行上下文需要提供完整对话键。`);
1556
+ }
1557
+ const [dialog] = matches;
1558
+ return {
1559
+ dialogId,
1560
+ agentKey: resolveDialogRuntimeAgentKey(dialog.record, agentKey),
1561
+ spaceId: trimmed(dialog.record.spaceId)
1562
+ };
1563
+ }
1564
+
1565
+ // packages/ai/policy/selfUpdateFields.ts
1566
+ var AGENT_UPDATE_FIELD_NAMES = [
1567
+ "name",
1568
+ "handle",
1569
+ "model",
1570
+ "provider",
1571
+ "prompt",
1572
+ "introduction",
1573
+ "greeting",
1574
+ "isPublic",
1575
+ "tags",
1576
+ "tools",
1577
+ "references",
1578
+ "temperature",
1579
+ "top_p",
1580
+ "frequency_penalty",
1581
+ "presence_penalty",
1582
+ "max_tokens",
1583
+ "reasoning_effort"
1584
+ ];
1585
+ var PRIMARY_AUTO_APPROVE_SELF_UPDATE_FIELDS = [
1586
+ "greeting",
1587
+ "introduction",
1588
+ "tags"
1589
+ ];
1590
+ var DEFAULT_AUTO_APPROVED_SELF_UPDATE_FIELDS = [
1591
+ ...PRIMARY_AUTO_APPROVE_SELF_UPDATE_FIELDS
1592
+ ];
1593
+ var VALID_AGENT_UPDATE_FIELDS = new Set(AGENT_UPDATE_FIELD_NAMES);
1594
+ var normalizeAgentUpdateFieldList = (value, fallback = DEFAULT_AUTO_APPROVED_SELF_UPDATE_FIELDS) => {
1595
+ if (!Array.isArray(value)) {
1596
+ return [...fallback];
1597
+ }
1598
+ const normalized = Array.from(new Set(value.filter((item) => typeof item === "string" && VALID_AGENT_UPDATE_FIELDS.has(item))));
1599
+ return normalized;
1600
+ };
1601
+
1602
+ // packages/ai/tools/toolResultError.ts
1603
+ class ToolResultError extends Error {
1604
+ code;
1605
+ rawData;
1606
+ displayData;
1607
+ retryable;
1608
+ constructor(message, options) {
1609
+ super(message);
1610
+ this.name = "ToolResultError";
1611
+ this.code = options?.code;
1612
+ this.rawData = options?.rawData;
1613
+ this.displayData = options?.displayData;
1614
+ this.retryable = options?.retryable;
1615
+ }
1616
+ }
1617
+ var getToolResultErrorData = (error) => {
1618
+ if (!error || typeof error !== "object")
1619
+ return null;
1620
+ const candidate = error;
1621
+ return {
1622
+ rawData: candidate.rawData,
1623
+ displayData: candidate.displayData,
1624
+ code: candidate.code,
1625
+ retryable: candidate.retryable,
1626
+ message: candidate.message
1627
+ };
1628
+ };
1629
+
1630
+ // packages/ai/tools/loadSkillTool.ts
1631
+ var loadSkillFunctionSchema = {
1632
+ name: "loadSkill",
1633
+ description: "按名称或精确引用加载 skill 正文。精确引用禁传 name(space+dbKey / builtin+slug / project+projectBinding+relativePath 互斥,不回退同名);Web/Server 支持 space/builtin,本地支持 builtin/project。未找到时列可用列表。常用内置:coding、feedback、agent-creator、nolo-app、automation、memory。",
1634
+ parameters: {
1635
+ type: "object",
1636
+ properties: {
1637
+ name: { type: "string", description: "skill 名称或 skillId(不与精确字段混用)。" },
1638
+ source: { type: "string", enum: ["space", "builtin", "project"], description: "精确来源(互斥,不传 name)。" },
1639
+ dbKey: { type: "string", description: "source=space 必填:Space Skill dbKey。" },
1640
+ slug: { type: "string", description: "source=builtin 必填:内置 skill slug。" },
1641
+ projectBinding: { type: "string", description: "source=project 必填:授权项目根绝对路径(仅本地)。" },
1642
+ relativePath: { type: "string", description: "source=project 必填:.agents/skills/ 内 SKILL.md 相对路径(仅本地)。" },
1643
+ assetPath: { type: "string", description: "仅本地 bundle:skill 同目录附带文件相对路径(如 references/guide.md)。" }
1644
+ }
1645
+ }
1646
+ };
1647
+ var getRuntime = (thunkApi) => {
1648
+ const state = thunkApi?.getState?.();
1649
+ return state ? selectRuntimeSnapshot(state) : null;
1650
+ };
1651
+ var authHeaders = (token) => token ? { Authorization: `Bearer ${token}` } : {};
1652
+ async function readRemoteRecord(args) {
1653
+ const serverBase = normalizeServerOrigin(args.serverBase);
1654
+ if (!serverBase || !args.token)
1655
+ return null;
1656
+ const response = await fetch(`${serverBase}/api/v1/db/read/${encodeURIComponent(args.dbKey)}?includeDeleted=true`, { headers: authHeaders(args.token) });
1657
+ if (!response.ok)
1658
+ return null;
1659
+ const payload = await response.json().catch(() => null);
1660
+ return payload?.data ?? payload;
1661
+ }
1662
+ function resolveWebSkill(candidates, requestedName) {
1663
+ const candidate = matchSkillCandidate(candidates, requestedName);
1664
+ if (candidate)
1665
+ return { kind: "space", candidate };
1666
+ const entry = resolveBuiltinSkillByName2(requestedName);
1667
+ return entry ? { kind: "builtin", entry } : null;
1668
+ }
1669
+ function listWebSkillNames(candidates) {
1670
+ return Array.from(new Set([
1671
+ ...candidates.map((candidate) => candidate.name),
1672
+ ...listBuiltinSkills2().flatMap((skill) => [skill.slug, skill.title])
1673
+ ]));
1674
+ }
1675
+ function matchSkillCandidate(candidates, requestedName) {
1676
+ return candidates.find((candidate) => candidate.name === requestedName || candidate.skillId === requestedName);
1677
+ }
1678
+ function collectSkillCandidatesFromSpace(space) {
1679
+ if (!space?.contents || typeof space.contents !== "object")
1680
+ return [];
1681
+ const candidates = [];
1682
+ for (const [entryKey, value] of Object.entries(space.contents)) {
1683
+ if (!isRecord(value))
1684
+ continue;
1685
+ const skillSummary = value.skillSummary;
1686
+ if (!isSkillSummaryMarker2(skillSummary))
1687
+ continue;
1688
+ const name = asTrimmedString(skillSummary.name);
1689
+ if (!name)
1690
+ continue;
1691
+ candidates.push({
1692
+ dbKey: entryKey,
1693
+ name,
1694
+ skillId: asOptionalTrimmedString(skillSummary.skillId) ?? undefined
1695
+ });
1696
+ }
1697
+ return candidates;
1698
+ }
1699
+ function extractSkillBody(page) {
1700
+ return parseSkillDocProtocol(page?.content ?? "").content;
1701
+ }
1702
+ var MAX_PAGE_SKILL_ATTACHMENTS = 20;
1703
+ var MAX_PAGE_SKILL_ATTACHMENT_NAME_LEN = 120;
1704
+ function extractPageSkillAttachments(page) {
1705
+ if (!page || typeof page !== "object")
1706
+ return [];
1707
+ const results = [];
1708
+ const seen = new Set;
1709
+ const firstTrimmed = (...values) => {
1710
+ for (const value of values) {
1711
+ const trimmed = asOptionalTrimmedString(value);
1712
+ if (trimmed)
1713
+ return trimmed;
1714
+ }
1715
+ return;
1716
+ };
1717
+ const pushItem = (raw) => {
1718
+ if (results.length >= MAX_PAGE_SKILL_ATTACHMENTS)
1719
+ return;
1720
+ const fileKey = firstTrimmed(raw.fileKey, raw.key, raw.attachmentKey);
1721
+ const rawUrl = firstTrimmed(raw.url, raw.src, raw.href);
1722
+ const url = rawUrl && !/^data:/i.test(rawUrl) ? rawUrl : undefined;
1723
+ if (!fileKey && !url)
1724
+ return;
1725
+ const rawName = firstTrimmed(raw.name, raw.filename, raw.title, raw.label, fileKey ? fileKey.split("/").pop() : undefined, url ? url.split("/").pop()?.split("?")[0] : undefined);
1726
+ if (!rawName)
1727
+ return;
1728
+ const name = rawName.slice(0, MAX_PAGE_SKILL_ATTACHMENT_NAME_LEN);
1729
+ const dedupeKey = `${name}|${fileKey ?? ""}|${url ?? ""}`;
1730
+ if (seen.has(dedupeKey))
1731
+ return;
1732
+ seen.add(dedupeKey);
1733
+ results.push({ name, ...fileKey ? { fileKey } : {}, ...url ? { url } : {} });
1734
+ };
1735
+ if (Array.isArray(page.attachments)) {
1736
+ for (const item of page.attachments) {
1737
+ if (isRecord(item))
1738
+ pushItem(item);
1739
+ }
1740
+ }
1741
+ const walkSlate = (nodes, depth) => {
1742
+ if (depth > 8 || !Array.isArray(nodes) || results.length >= MAX_PAGE_SKILL_ATTACHMENTS)
1743
+ return;
1744
+ for (const node of nodes) {
1745
+ if (results.length >= MAX_PAGE_SKILL_ATTACHMENTS)
1746
+ break;
1747
+ if (!isRecord(node))
1748
+ continue;
1749
+ const nodeType = typeof node.type === "string" ? node.type.toLowerCase() : "";
1750
+ if (nodeType === "file" || nodeType === "attachment" || nodeType === "asset" || nodeType === "image" && (node.fileKey || node.url || node.src)) {
1751
+ pushItem(node);
1752
+ }
1753
+ if (Array.isArray(node.children)) {
1754
+ walkSlate(node.children, depth + 1);
1755
+ }
1756
+ }
1757
+ };
1758
+ walkSlate(page.slateData, 0);
1759
+ return results;
1760
+ }
1761
+ function formatSkillAttachmentsFooter(attachments) {
1762
+ if (!attachments.length)
1763
+ return "";
1764
+ const names = attachments.map((a) => a.name).join(", ");
1765
+ return `
1766
+
1767
+ [Skill attachments: ${names}]`;
1768
+ }
1769
+ async function listSkillCandidates(thunkApi) {
1770
+ const runtime = getRuntime(thunkApi);
1771
+ const serverBase = runtime?.currentServer;
1772
+ const token = runtime?.currentToken;
1773
+ const userId = runtime?.currentUserId;
1774
+ if (!serverBase || !token || !userId)
1775
+ return [];
1776
+ const membershipsResponse = await fetch(`${normalizeServerOrigin(serverBase)}/rpc/getUserSpaceMemberships`, {
1777
+ method: "POST",
1778
+ headers: {
1779
+ "Content-Type": "application/json",
1780
+ ...authHeaders(token)
1781
+ },
1782
+ body: JSON.stringify({ userId })
1783
+ }).catch(() => null);
1784
+ if (!membershipsResponse?.ok)
1785
+ return [];
1786
+ const memberships = await membershipsResponse.json().catch(() => []);
1787
+ if (!Array.isArray(memberships))
1788
+ return [];
1789
+ const candidates = [];
1790
+ for (const membership of memberships) {
1791
+ const spaceId = asTrimmedString(membership?.spaceId);
1792
+ if (!spaceId)
1793
+ continue;
1794
+ const space = await readRemoteRecord({
1795
+ serverBase,
1796
+ token,
1797
+ dbKey: createSpaceKey.space(spaceId)
1798
+ });
1799
+ if (!space)
1800
+ continue;
1801
+ candidates.push(...collectSkillCandidatesFromSpace(space));
1802
+ }
1803
+ return candidates;
1804
+ }
1805
+ var readCurrentAgentSkillSource = async (thunkApi, agentKey) => {
1806
+ if (!agentKey)
1807
+ return null;
1808
+ const db = thunkApi?.extra?.db;
1809
+ if (!db)
1810
+ return null;
1811
+ try {
1812
+ const agent = await db.get(agentKey);
1813
+ if (!agent || typeof agent !== "object")
1814
+ return null;
1815
+ return agent;
1816
+ } catch {
1817
+ return null;
1818
+ }
1819
+ };
1820
+ async function loadSkillFunc(args, thunkApi, context) {
1821
+ const hasArg = (key) => Object.prototype.hasOwnProperty.call(args ?? {}, key);
1822
+ if (hasArg("assetPath") && args.assetPath !== undefined) {
1823
+ throw new Error("loadSkill: assetPath is only supported for local filesystem/project skill bundles, not Web client skills.");
1824
+ }
1825
+ const exact = ["source", "dbKey", "slug", "projectBinding", "relativePath"].some(hasArg);
1826
+ const source = args?.source;
1827
+ if (exact) {
1828
+ const validSpace = source === "space" && typeof args.dbKey === "string" && !!args.dbKey.trim() && !hasArg("slug") && !hasArg("projectBinding") && !hasArg("relativePath");
1829
+ const validBuiltin = source === "builtin" && typeof args.slug === "string" && !!args.slug.trim() && !hasArg("dbKey") && !hasArg("projectBinding") && !hasArg("relativePath");
1830
+ if (hasArg("name") || !validSpace && !validBuiltin) {
1831
+ 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.");
1832
+ }
1833
+ }
1834
+ let requestedName = asTrimmedString(exact ? source === "space" ? args.dbKey : args.slug : args?.name);
1835
+ if (!requestedName)
1836
+ throw new Error("loadSkill 需要提供 name。");
1837
+ const state = thunkApi.getState();
1838
+ const attribution = resolveToolAttributionContext(state, context, {
1839
+ requireAgentKey: false,
1840
+ errorLabel: "loadSkill: 无法确定归属"
1841
+ });
1842
+ const dialogKey = context?.dialogKey?.trim() || Object.entries(selectEntities2(state)).find(([key, record]) => isDialogRecordKeyForId(key, attribution.dialogId) && record?.id?.trim() === attribution.dialogId)?.[0];
1843
+ const candidates = await listSkillCandidates(thunkApi);
1844
+ let resolution;
1845
+ if (!exact) {
1846
+ resolution = resolveWebSkill(candidates, requestedName);
1847
+ } else if (source === "space") {
1848
+ const candidate = candidates.find((entry) => entry.dbKey === requestedName);
1849
+ resolution = candidate ? { kind: "space", candidate } : null;
1850
+ } else {
1851
+ const entry = listBuiltinSkills2().find((entry) => entry.slug === requestedName);
1852
+ resolution = entry ? { kind: "builtin", entry } : null;
1853
+ }
1854
+ const matched = resolution?.kind === "space" ? resolution.candidate : undefined;
1855
+ if (exact && matched)
1856
+ requestedName = matched.name;
1857
+ const builtinEntry = resolution?.kind === "builtin" ? resolution.entry : null;
1858
+ const resolvedSlug = builtinEntry?.slug ?? matched?.skillId ?? null;
1859
+ if (resolvedSlug) {
1860
+ const agentSkillSource = await readCurrentAgentSkillSource(thunkApi, attribution.agentKey);
1861
+ if (agentSkillSource && isAgentSkillDisabled(agentSkillSource, resolvedSlug)) {
1862
+ return {
1863
+ rawData: {
1864
+ success: false,
1865
+ name: requestedName,
1866
+ slug: resolvedSlug,
1867
+ disabled: true
1868
+ },
1869
+ displayData: `Skill "${requestedName}" 已被禁用:该能力在此 agent 上不可用,无法加载。`
1870
+ };
1871
+ }
1872
+ }
1873
+ if (builtinEntry) {
1874
+ const body = builtinEntry.content;
1875
+ const dbKey = builtinEntry.slug;
1876
+ if (context?.skipSkillReferencePersist !== true) {
1877
+ await persistLoadedSkillReference(thunkApi, dialogKey, dbKey, requestedName);
1878
+ }
1879
+ return {
1880
+ rawData: {
1881
+ success: true,
1882
+ name: requestedName,
1883
+ dbKey,
1884
+ body
1885
+ },
1886
+ displayData: `Skill "${requestedName}" loaded inline. Follow its instructions.
1887
+
1888
+ ${body}`
1889
+ };
1890
+ }
1891
+ if (!matched) {
1892
+ const availableNames = listWebSkillNames(candidates);
1893
+ const availableText = availableNames.length ? availableNames.join(", ") : "(none)";
1894
+ return {
1895
+ rawData: {
1896
+ success: false,
1897
+ name: requestedName,
1898
+ availableSkills: availableNames
1899
+ },
1900
+ displayData: `Skill "${requestedName}" not found. Available skills: ${availableText}`
1901
+ };
1902
+ }
1903
+ const runtime = getRuntime(thunkApi);
1904
+ const page = await readRemoteRecord({
1905
+ serverBase: runtime?.currentServer,
1906
+ token: runtime?.currentToken,
1907
+ dbKey: matched.dbKey
1908
+ });
1909
+ if (exact && !page) {
1910
+ return {
1911
+ rawData: { success: false, name: requestedName, dbKey: matched.dbKey },
1912
+ displayData: `Skill "${requestedName}" could not be read.`
1913
+ };
1914
+ }
1915
+ const body = extractSkillBody(page);
1916
+ const attachments = extractPageSkillAttachments(page);
1917
+ const attachmentFooter = formatSkillAttachmentsFooter(attachments);
1918
+ if (context?.skipSkillReferencePersist !== true) {
1919
+ await persistLoadedSkillReference(thunkApi, dialogKey, matched.dbKey, requestedName);
1920
+ }
1921
+ return {
1922
+ rawData: {
1923
+ success: true,
1924
+ name: requestedName,
1925
+ dbKey: matched.dbKey,
1926
+ body,
1927
+ ...attachments.length ? { attachments } : {}
1928
+ },
1929
+ displayData: `Skill "${requestedName}" loaded inline. Follow its instructions.
1930
+
1931
+ ${body}${attachmentFooter}`
1932
+ };
1933
+ }
1934
+ async function persistLoadedSkillReference(thunkApi, currentDialogKey, dbKey, name) {
1935
+ try {
1936
+ const state = thunkApi?.getState?.();
1937
+ if (!state || !currentDialogKey)
1938
+ return;
1939
+ const dialogConfig = selectById2(state, currentDialogKey);
1940
+ const existing = dialogConfig?.extraReferences ?? [];
1941
+ const alreadyMounted = existing.some((ref) => ref.dbKey === dbKey);
1942
+ if (alreadyMounted)
1943
+ return;
1944
+ const newRef = {
1945
+ dbKey,
1946
+ title: name,
1947
+ type: "instruction"
1948
+ };
1949
+ await setDialogExtraReferencesAction2([...existing, newRef], thunkApi, currentDialogKey);
1950
+ } catch {}
1951
+ }
1952
+
1953
+ // packages/create/editor/transforms/slateToSimplifiedMarkdown.ts
1954
+ function renderTextNode(node) {
1955
+ if (!node || typeof node.text !== "string")
1956
+ return "";
1957
+ let text = node.text;
1958
+ if (!text)
1959
+ return "";
1960
+ if (node.bold)
1961
+ text = `**${text}**`;
1962
+ if (node.italic)
1963
+ text = `*${text}*`;
1964
+ if (node.strikethrough)
1965
+ text = `~~${text}~~`;
1966
+ return text;
1967
+ }
1968
+ function renderPlainText(node, options = {}) {
1969
+ if (!node)
1970
+ return "";
1971
+ if (typeof node.text === "string")
1972
+ return renderTextNode(node);
1973
+ if (!Array.isArray(node.children))
1974
+ return "";
1975
+ return node.children.map((child) => renderPlainText(child, options)).join("");
1976
+ }
1977
+ function renderTable(node, listDepth, options) {
1978
+ const rows = Array.isArray(node.children) ? node.children : [];
1979
+ if (rows.length === 0)
1980
+ return "";
1981
+ const alignments = Array.isArray(node.columns) ? node.columns.map((column) => column?.align || "left") : [];
1982
+ const renderedRows = rows.map((row) => (Array.isArray(row?.children) ? row.children : []).map((cell) => {
1983
+ const content = renderPlainText(cell, options).replace(/\n+/g, " ").trim();
1984
+ return content || " ";
1985
+ }));
1986
+ const header = renderedRows[0] || [];
1987
+ const divider = header.map((_, index) => {
1988
+ const align = alignments[index];
1989
+ if (align === "center")
1990
+ return ":---:";
1991
+ if (align === "right")
1992
+ return "---:";
1993
+ return "---";
1994
+ });
1995
+ const body = renderedRows.slice(1);
1996
+ const allRows = [header, divider, ...body].map((cells) => `| ${cells.join(" | ")} |`).join(`
1997
+ `);
1998
+ return `${allRows}
1999
+
2000
+ `;
2001
+ }
2002
+ function renderListItem(node, listDepth, ordered, start, index, options = {}) {
2003
+ const indentation = " ".repeat(listDepth);
2004
+ const marker = node.checked === true ? "- [x]" : node.checked === false ? "- [ ]" : ordered ? `${start + index}.` : "-";
2005
+ const segments = Array.isArray(node.children) ? node.children : [];
2006
+ const renderedSegments = segments.flatMap((child) => {
2007
+ const rendered = renderNode(child, listDepth + 1, options).trimEnd();
2008
+ return rendered ? [rendered] : [];
2009
+ });
2010
+ if (renderedSegments.length === 0) {
2011
+ return `${indentation}${marker}
2012
+ `;
2013
+ }
2014
+ const [first, ...rest] = renderedSegments;
2015
+ const lines = first.split(`
2016
+ `);
2017
+ const firstLine = lines.shift() || "";
2018
+ const restFirst = lines.map((line) => `${indentation} ${line}`).join(`
2019
+ `);
2020
+ const restBlocks = rest.map((block) => `${indentation} ${block}`).join(`
2021
+ `);
2022
+ return [
2023
+ `${indentation}${marker} ${firstLine}`,
2024
+ restFirst,
2025
+ restBlocks
2026
+ ].filter(Boolean).join(`
2027
+ `) + `
2028
+ `;
2029
+ }
2030
+ function renderNode(node, listDepth = 0, options = {}) {
2031
+ if (!node)
2032
+ return "";
2033
+ const indentation = " ".repeat(listDepth);
2034
+ switch (node.type) {
2035
+ case "heading-one":
2036
+ return `# ${node.children.map((n) => renderNode(n, listDepth, options)).join("")}
2037
+
2038
+ `;
2039
+ case "heading-two":
2040
+ return `## ${node.children.map((n) => renderNode(n, listDepth, options)).join("")}
2041
+
2042
+ `;
2043
+ case "heading-three":
2044
+ return `### ${node.children.map((n) => renderNode(n, listDepth, options)).join("")}
2045
+
2046
+ `;
2047
+ case "heading-four":
2048
+ return `#### ${node.children.map((n) => renderNode(n, listDepth, options)).join("")}
2049
+
2050
+ `;
2051
+ case "heading-five":
2052
+ return `##### ${node.children.map((n) => renderNode(n, listDepth, options)).join("")}
2053
+
2054
+ `;
2055
+ case "heading-six":
2056
+ return `###### ${node.children.map((n) => renderNode(n, listDepth, options)).join("")}
2057
+
2058
+ `;
2059
+ case "paragraph":
2060
+ return `${node.children.map((n) => renderNode(n, listDepth, options)).join("")}
2061
+
2062
+ `;
2063
+ case "list":
2064
+ return node.children.map((item, index) => renderListItem(item, listDepth, !!node.ordered, node.start || 1, index, options)).join("");
2065
+ case "list-item":
2066
+ return renderListItem(node, listDepth, false, 1, 0, options);
2067
+ case "quote":
2068
+ const content = node.children.map((n) => renderNode(n, listDepth, options)).join("").trim();
2069
+ return `> ${content.replace(/\n/g, `
2070
+ > `)}
2071
+
2072
+ `;
2073
+ case "code-block":
2074
+ const code = node.children.map((line) => (line.children || []).map((text) => text.text).join("")).join(`
2075
+ `);
2076
+ return "```" + (node.language || "") + `
2077
+ ` + code + "\n```\n\n";
2078
+ case "link":
2079
+ const linkText = node.children.map((n) => renderNode(n, listDepth, options)).join("");
2080
+ return `[${linkText}](${node.url})`;
2081
+ case "table":
2082
+ return renderTable(node, listDepth, options);
2083
+ case "code-inline":
2084
+ return `\`${node.children.map((n) => renderNode(n, listDepth, options)).join("")}\``;
2085
+ case "mention": {
2086
+ if (options.mentionResolver) {
2087
+ return options.mentionResolver(node);
2088
+ }
2089
+ const label = node.label || node.resourceId || "mention";
2090
+ const resourceType = node.resourceType || "unknown";
2091
+ const resourceId = node.resourceId || "unknown";
2092
+ return `@[${resourceType}:${resourceId}|${label}]`;
2093
+ }
2094
+ case "image": {
2095
+ const alt = node.alt || "";
2096
+ const title = node.title ? ` "${node.title}"` : "";
2097
+ return `![${alt}](${node.url || ""}${title})`;
2098
+ }
2099
+ case "html-inline":
2100
+ return typeof node.html === "string" ? node.html : "";
2101
+ case "html-block":
2102
+ return typeof node.html === "string" ? `${node.html}
2103
+
2104
+ ` : "";
2105
+ case "thematic-break":
2106
+ return `---
2107
+
2108
+ `;
2109
+ default:
2110
+ return renderTextNode(node) || (node.children ? node.children.map((child) => renderNode(child, listDepth, options)).join("") : "");
2111
+ }
2112
+ }
2113
+ function slateToSimplifiedMarkdown(nodes, options = {}) {
2114
+ if (!nodes || nodes.length === 0) {
2115
+ return "";
2116
+ }
2117
+ return nodes.map((node) => renderNode(node, 0, options)).join("").trim() + `
2118
+ `;
2119
+ }
2120
+
2121
+ // packages/render/page/pageDocumentOps.ts
2122
+ var SKILL_PROTOCOL_COMMENT_RE = /<!--\s*(?:skill-config|eval-config|workflow-config)\b[\s\S]*?-->/i;
2123
+
2124
+ class PageDocumentOpsError extends Error {
2125
+ code;
2126
+ constructor(code, message) {
2127
+ super(message);
2128
+ this.code = code;
2129
+ this.name = "PageDocumentOpsError";
2130
+ }
2131
+ }
2132
+ var cloneJson = (value) => JSON.parse(JSON.stringify(value));
2133
+ var hasAuthoritativeSlateData = (pageData) => Array.isArray(pageData?.slateData);
2134
+ var isPlainEmptyTextLeaf = (child) => {
2135
+ if (!child || typeof child !== "object")
2136
+ return false;
2137
+ const record = child;
2138
+ return typeof record.text === "string" && record.text === "" && typeof record.type !== "string";
2139
+ };
2140
+ var isEmptyParagraphNode = (node) => {
2141
+ if (!node || typeof node !== "object")
2142
+ return false;
2143
+ const record = node;
2144
+ if (record.type !== "paragraph")
2145
+ return false;
2146
+ const extraKeys = Object.keys(record).filter((key) => key !== "type" && key !== "children");
2147
+ if (extraKeys.length > 0)
2148
+ return false;
2149
+ if (!Array.isArray(record.children))
2150
+ return false;
2151
+ return record.children.length === 0 || record.children.every(isPlainEmptyTextLeaf);
2152
+ };
2153
+ var isEmptySlateDocument = (nodes) => {
2154
+ if (!Array.isArray(nodes))
2155
+ return false;
2156
+ if (nodes.length === 0)
2157
+ return true;
2158
+ return nodes.every(isEmptyParagraphNode);
2159
+ };
2160
+ var hasSkillMetadataCommentBlocks = (markdown) => typeof markdown === "string" && SKILL_PROTOCOL_COMMENT_RE.test(markdown);
2161
+ var isProtectedSkillPage = (pageData) => {
2162
+ const meta = pageData?.meta;
2163
+ if (!meta || typeof meta !== "object")
2164
+ return false;
2165
+ return meta.kind === "skill" || Boolean(meta.skillConfig) || Boolean(meta.workflowConfig) || Boolean(meta.evalConfig);
2166
+ };
2167
+ var markdownToSlateBlocks = (markdown) => {
2168
+ if (typeof markdown !== "string" || markdown.length === 0) {
2169
+ return [];
2170
+ }
2171
+ const parsed = markdownToSlate(markdown);
2172
+ if (Array.isArray(parsed) && parsed.length > 0) {
2173
+ return parsed;
2174
+ }
2175
+ if (markdown.trim().length === 0) {
2176
+ return [];
2177
+ }
2178
+ return [{ type: "paragraph", children: [{ text: markdown }] }];
2179
+ };
2180
+ var resolvePageSlateNodes = (pageData) => {
2181
+ if (hasAuthoritativeSlateData(pageData)) {
2182
+ return cloneJson(pageData.slateData);
2183
+ }
2184
+ if (typeof pageData.content === "string" && pageData.content.length > 0) {
2185
+ return markdownToSlateBlocks(pageData.content);
2186
+ }
2187
+ return [];
2188
+ };
2189
+ var resolvePageMarkdown = (pageData, options = {}) => {
2190
+ const format = options.format ?? "simplified";
2191
+ if (hasAuthoritativeSlateData(pageData)) {
2192
+ const nodes = pageData.slateData;
2193
+ if (isEmptySlateDocument(nodes)) {
2194
+ return "";
2195
+ }
2196
+ return format === "render" ? slateToRenderMarkdown2(nodes) : slateToSimplifiedMarkdown(nodes);
2197
+ }
2198
+ return typeof pageData.content === "string" ? pageData.content : "";
2199
+ };
2200
+ var STANDARD_SLATE_BLOCK_TYPES = new Set([
2201
+ "paragraph",
2202
+ "heading-one",
2203
+ "heading-two",
2204
+ "heading-three",
2205
+ "heading-four",
2206
+ "heading-five",
2207
+ "heading-six",
2208
+ "list",
2209
+ "list-item",
2210
+ "quote",
2211
+ "code-block",
2212
+ "code-line",
2213
+ "table",
2214
+ "table-row",
2215
+ "table-cell",
2216
+ "image",
2217
+ "thematic-break",
2218
+ "html-block"
2219
+ ]);
2220
+ var applyPageContentMutation = (originalData, input) => {
2221
+ const {
2222
+ mode,
2223
+ markdown,
2224
+ allowSkillMetadataWrite = false,
2225
+ nowIso = new Date().toISOString()
2226
+ } = input;
2227
+ if (!allowSkillMetadataWrite && hasSkillMetadataCommentBlocks(markdown)) {
2228
+ throw new PageDocumentOpsError("SKILL_METADATA_PROTECTED", "Ordinary page content writes cannot inject or modify Skill/Workflow/Eval metadata blocks.");
2229
+ }
2230
+ const incomingNodes = markdownToSlateBlocks(markdown);
2231
+ let finalSlateData;
2232
+ if (mode === "append") {
2233
+ const baseNodes = resolvePageSlateNodes(originalData);
2234
+ if (incomingNodes.length === 0) {
2235
+ finalSlateData = baseNodes;
2236
+ } else if (isEmptySlateDocument(baseNodes)) {
2237
+ finalSlateData = incomingNodes;
2238
+ } else {
2239
+ finalSlateData = [...baseNodes, ...incomingNodes];
2240
+ }
2241
+ } else {
2242
+ finalSlateData = incomingNodes.length > 0 ? incomingNodes : [createEmptyParagraph2()];
2243
+ }
2244
+ const renderMarkdown = isEmptySlateDocument(finalSlateData) ? "" : slateToRenderMarkdown2(finalSlateData);
2245
+ const extractedTools = extractMentionsFromSlate2(finalSlateData);
2246
+ const tools = !allowSkillMetadataWrite && isProtectedSkillPage(originalData) && Array.isArray(originalData.tools) ? [...originalData.tools] : extractedTools;
2247
+ const updatedPage = {
2248
+ ...originalData,
2249
+ slateData: finalSlateData,
2250
+ content: renderMarkdown,
2251
+ tools,
2252
+ ...originalData.meta !== undefined ? { meta: cloneJson(originalData.meta) } : {},
2253
+ updated_at: nowIso
2254
+ };
2255
+ return {
2256
+ updatedPage,
2257
+ slateData: finalSlateData,
2258
+ renderMarkdown,
2259
+ tools
2260
+ };
2261
+ };
2262
+
2263
+ // packages/ai/tools/readDocTool.ts
2264
+ var resolvePageReadMarkdown2 = (pageData) => resolvePageMarkdown(pageData, { format: "simplified" });
2265
+ var readDocFunctionSchema2 = {
2266
+ name: "readDoc",
2267
+ description: [
2268
+ "读取指定页面的内容,并将结构化的数据转换为 Markdown 格式返回。",
2269
+ "如果你拿到了页面的 dbKey(如 page-xxx),请使用此工具查看页面内容。"
2270
+ ].join(`
2271
+ `),
2272
+ parameters: {
2273
+ type: "object",
2274
+ properties: {
2275
+ id: {
2276
+ type: "string",
2277
+ description: "页面/文档的数据库键(dbKey),例如 page-xxx。"
2278
+ }
2279
+ },
2280
+ required: ["id"]
2281
+ }
2282
+ };
2283
+ var readPageFunctionSchema2 = {
2284
+ ...readDocFunctionSchema2,
2285
+ name: "readPage"
2286
+ };
2287
+ var buildReadDocResult2 = (pageData) => {
2288
+ const markdownContent = resolvePageReadMarkdown2(pageData);
2289
+ const rawData = {
2290
+ success: true,
2291
+ id: pageData.dbKey,
2292
+ title: pageData.title,
2293
+ content: markdownContent,
2294
+ metadata: {
2295
+ spaceId: pageData.spaceId,
2296
+ created: pageData.created
2297
+ }
2298
+ };
2299
+ const displayData = `已成功读取页面《${pageData.title}》。
2300
+
2301
+ 内容如下:
2302
+
2303
+ ${markdownContent}`;
2304
+ return { rawData, displayData };
2305
+ };
2306
+ async function readDocFunc2(args, thunkApi) {
2307
+ const id = args.id ?? args.doc ?? args.docKey ?? args.pageKey ?? args.key;
2308
+ if (!id || !id.toLowerCase().startsWith("page-")) {
2309
+ throw new Error(`无效的页面 ID: ${id}。页面 ID 通常以 "page-" 开头。`);
2310
+ }
2311
+ try {
2312
+ const { readAction } = await import("./chunk-pbx7e1mb.js");
2313
+ const pageData = await readAction({ dbKey: id }, thunkApi);
2314
+ if (!pageData) {
2315
+ throw new Error(`未找到 ID 为 ${id} 的页面。`);
2316
+ }
2317
+ return buildReadDocResult2(pageData);
2318
+ } catch (error) {
2319
+ throw new Error(`读取页面时出错: ${toErrorMessage(error)}`);
2320
+ }
2321
+ }
2322
+ var readPageFunc2 = readDocFunc2;
2323
+
2324
+ // packages/render/table/utils/tableSerialization.ts
2325
+ var fetchAndSerializeTable = async (tableMeta, db, options = {}) => {
2326
+ const tenantId = tableMeta.tenantId;
2327
+ const tableId = tableMeta.tableId;
2328
+ const results = await fetchAndCacheTableRows({
2329
+ db,
2330
+ tenantId,
2331
+ tableId,
2332
+ token: options.token,
2333
+ remoteServers: options.remoteServers ?? []
2334
+ });
2335
+ const columns = tableMeta.columns || [];
2336
+ const headerRow = columns.map((c) => c.label || c.name);
2337
+ const separatorRow = columns.map(() => "---");
2338
+ let tableMd = "";
2339
+ if (columns.length > 0) {
2340
+ tableMd = `| ${headerRow.join(" | ")} |
2341
+ | ${separatorRow.join(" | ")} |
2342
+ `;
2343
+ results.forEach((row) => {
2344
+ const rowData = columns.map((col) => {
2345
+ const val = row[col.name];
2346
+ return val === undefined || val === null ? "" : String(val).replace(/\|/g, "\\|");
2347
+ });
2348
+ tableMd += `| ${rowData.join(" | ")} |
2349
+ `;
2350
+ });
2351
+ } else {
2352
+ tableMd = "(No columns defined for this table)";
2353
+ }
2354
+ return { rows: results, markdown: tableMd };
2355
+ };
2356
+
2357
+ // packages/app/settings/userPreferencesStore.ts
2358
+ var import_react = __toESM(require_react());
2359
+
2360
+ // packages/app/settings/accountChatDisplayOwner.ts
2361
+ var DEFAULT_CHAT_UI_PREFERENCES = Object.freeze({
2362
+ showThinking: true,
2363
+ showScrollToTopButton: false,
2364
+ showScrollToBottomButton: false,
2365
+ showNewFileDiff: false,
2366
+ showShellTreeOutput: false
2367
+ });
2368
+ var CHAT_UI_PREFERENCE_KEYS = Object.keys(DEFAULT_CHAT_UI_PREFERENCES);
2369
+ // packages/app/settings/settingTypes.ts
2370
+ var SYSTEM_DEFAULT_AGENT_ID = "system-default";
2371
+
2372
+ // packages/app/settings/settingNormalizers.ts
2373
+ var hasOwn = (target, key) => Object.prototype.hasOwnProperty.call(target, key);
2374
+ var normalizeDefaultAgentIdSetting = (value) => {
2375
+ if (typeof value !== "string" || value.trim() === "") {
2376
+ return;
2377
+ }
2378
+ return value === noloAgentId || value === SYSTEM_DEFAULT_AGENT_ID ? SYSTEM_DEFAULT_AGENT_ID : value;
2379
+ };
2380
+ var normalizeAuthorityHomeServerSetting = (value) => {
2381
+ const normalized = normalizeServerOrigin(value);
2382
+ return /^https?:\/\//i.test(normalized) ? normalized : null;
2383
+ };
2384
+ var resolveDefaultAgentIdSetting = (value) => normalizeDefaultAgentIdSetting(value) ?? SYSTEM_DEFAULT_AGENT_ID;
2385
+ var omitKeys = (record, keys) => {
2386
+ const next = { ...record };
2387
+ keys.forEach((key) => {
2388
+ delete next[key];
2389
+ });
2390
+ return next;
2391
+ };
2392
+ var isRecordLike = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
2393
+ var normalizeSystemBuiltinSkills = (value, defaults) => {
2394
+ const base = isRecordLike(value) ? value : {};
2395
+ const result = { ...defaults };
2396
+ for (const key of Object.keys(base)) {
2397
+ result[key] = Boolean(base[key]);
2398
+ }
2399
+ return result;
2400
+ };
2401
+
2402
+ // packages/app/settings/userPreferencesStore.ts
2403
+ var policyDefaults = {
2404
+ enabledPromptSkills: Object.freeze([]),
2405
+ autoApproveSelfUpdateFields: Object.freeze([...DEFAULT_AUTO_APPROVED_SELF_UPDATE_FIELDS]),
2406
+ aiRecentContentLimit: 50,
2407
+ systemBuiltinSkills: Object.freeze({ ...DEFAULT_SYSTEM_AGENT_CAPABILITIES }),
2408
+ maxExecutionTime: 600000,
2409
+ maxCost: 1,
2410
+ defaultAgentId: SYSTEM_DEFAULT_AGENT_ID,
2411
+ quickChatAutoAgentId: ""
2412
+ };
2413
+ var ACCOUNT_POLICY_KEYS = [
2414
+ ...Object.keys(policyDefaults),
2415
+ "enabledSkills",
2416
+ "quickChatRuntimeTarget"
2417
+ ];
2418
+ var DEFAULT_SHORTCUTS = Object.freeze({
2419
+ heading: true,
2420
+ ulist: true,
2421
+ olist: true,
2422
+ quote: true,
2423
+ code: true,
2424
+ tasklist: true
2425
+ });
2426
+ var defaults = Object.freeze({
2427
+ ...DEFAULT_CHAT_UI_PREFERENCES,
2428
+ editorDefaultMode: "markdown",
2429
+ editorLightCodeTheme: "default",
2430
+ editorDarkCodeTheme: "okaidia",
2431
+ editorWordCountEnabled: true,
2432
+ editorShortcuts: DEFAULT_SHORTCUTS,
2433
+ editorFontSize: 14,
2434
+ editorAutoSave: true,
2435
+ editorAutoSaveInterval: 30,
2436
+ editorLineNumbers: false,
2437
+ editorWordWrap: true,
2438
+ editorSpellCheck: true,
2439
+ editorTabSize: 2,
2440
+ editorFontFamily: "SF Mono, Monaco, Cascadia Code, Roboto Mono, monospace",
2441
+ ocrModel: "google_document_ocr",
2442
+ developerModeEnabled: false,
2443
+ diagnosticModeEnabled: false
2444
+ });
2445
+ var DEFAULT_USER_PREFERENCES = Object.freeze({ ...defaults, ...policyDefaults });
2446
+ var USER_PREFERENCE_KEYS = [...Object.keys(defaults), ...ACCOUNT_POLICY_KEYS];
2447
+ function pickUserPreferences(record) {
2448
+ if (!record || typeof record !== "object")
2449
+ return {};
2450
+ const source = record;
2451
+ const patch = {};
2452
+ for (const key of USER_PREFERENCE_KEYS) {
2453
+ if (!Object.prototype.hasOwnProperty.call(source, key))
2454
+ continue;
2455
+ const value = source[key];
2456
+ switch (key) {
2457
+ case "enabledPromptSkills":
2458
+ patch[key] = Object.freeze(normalizeEnabledPromptSkills(value));
2459
+ break;
2460
+ case "enabledSkills":
2461
+ patch[key] = Object.freeze(normalizeEnabledSkills(value));
2462
+ break;
2463
+ case "defaultAgentId":
2464
+ patch[key] = resolveDefaultAgentIdSetting(value);
2465
+ break;
2466
+ case "autoApproveSelfUpdateFields":
2467
+ patch[key] = Object.freeze(normalizeAgentUpdateFieldList(value, DEFAULT_AUTO_APPROVED_SELF_UPDATE_FIELDS));
2468
+ break;
2469
+ case "systemBuiltinSkills":
2470
+ patch[key] = Object.freeze(normalizeSystemBuiltinSkills(value, DEFAULT_SYSTEM_AGENT_CAPABILITIES));
2471
+ break;
2472
+ case "quickChatRuntimeTarget": {
2473
+ const target = value;
2474
+ if (target?.kind === "server" || target?.kind === "machine") {
2475
+ patch[key] = Object.freeze({
2476
+ kind: target.kind,
2477
+ ...typeof target.machineId === "string" ? { machineId: target.machineId } : {},
2478
+ ...typeof target.serverOrigin === "string" ? { serverOrigin: target.serverOrigin } : {}
2479
+ });
2480
+ }
2481
+ break;
2482
+ }
2483
+ case "editorDefaultMode":
2484
+ if (value === "markdown" || value === "block")
2485
+ patch[key] = value;
2486
+ break;
2487
+ case "ocrModel":
2488
+ if (value === "none" || value === "olm_ocr" || value === "google_document_ocr")
2489
+ patch[key] = value;
2490
+ break;
2491
+ case "editorShortcuts": {
2492
+ if (!value || typeof value !== "object" || Array.isArray(value))
2493
+ break;
2494
+ const shortcuts = { ...DEFAULT_SHORTCUTS };
2495
+ for (const name of Object.keys(shortcuts)) {
2496
+ const candidate = value[name];
2497
+ if (typeof candidate === "boolean")
2498
+ shortcuts[name] = candidate;
2499
+ }
2500
+ patch[key] = Object.freeze(shortcuts);
2501
+ break;
2502
+ }
2503
+ default:
2504
+ if (typeof value === typeof DEFAULT_USER_PREFERENCES[key] && (typeof value !== "number" || Number.isFinite(value)))
2505
+ patch[key] = value;
2506
+ }
2507
+ }
2508
+ return patch;
2509
+ }
2510
+ var sameSession = (a, b) => a?.accountId === b?.accountId && a?.generation === b?.generation;
2511
+ var DEFAULT_RUNTIME = Object.freeze({
2512
+ autoApproveCredits: 0,
2513
+ serverAuthorityEchoSeq: 0,
2514
+ localIntentEpoch: 0,
2515
+ localIntentKeyEpochs: Object.freeze({}),
2516
+ lastWriteFailure: null
2517
+ });
2518
+ function createUserPreferencesStore(initialPersist) {
2519
+ let session = null;
2520
+ let snapshot = DEFAULT_USER_PREFERENCES;
2521
+ let runtime = DEFAULT_RUNTIME;
2522
+ let persist = initialPersist;
2523
+ const listeners = new Set;
2524
+ const notify = () => listeners.forEach((listener) => listener());
2525
+ const publishRuntime = (patch) => {
2526
+ runtime = Object.freeze({ ...runtime, ...patch });
2527
+ notify();
2528
+ };
2529
+ const publish = (expected, record) => {
2530
+ if (!sameSession(session, expected))
2531
+ return;
2532
+ const changes = pickUserPreferences(record);
2533
+ const next = { ...snapshot };
2534
+ let changed = false;
2535
+ for (const [key, value] of Object.entries(changes)) {
2536
+ const previous = snapshot[key];
2537
+ if (previous === value || value && previous && typeof value === "object" && typeof previous === "object" && Object.keys(previous).length === Object.keys(value).length && Object.entries(value).every(([name, item]) => Object.hasOwn(previous, name) && Reflect.get(previous, name) === item))
2538
+ continue;
2539
+ Object.assign(next, { [key]: value });
2540
+ changed = true;
2541
+ }
2542
+ if (!changed)
2543
+ return;
2544
+ snapshot = Object.freeze(next);
2545
+ notify();
2546
+ };
2547
+ const update = async (changes) => {
2548
+ const expected = session;
2549
+ if (!expected)
2550
+ throw new Error("User not found for persisting settings.");
2551
+ if (!persist)
2552
+ throw new Error("User preferences persistence is not bound.");
2553
+ const patch = pickUserPreferences(changes);
2554
+ if (Object.keys(patch).length === 0)
2555
+ return;
2556
+ const before = snapshot;
2557
+ const pending = persist(patch, expected);
2558
+ if (snapshot === before)
2559
+ publish(expected, patch);
2560
+ await pending;
2561
+ };
2562
+ return {
2563
+ getSnapshot: () => snapshot,
2564
+ getRuntimeSnapshot: () => runtime,
2565
+ bumpLocalIntentEpoch: (keys) => {
2566
+ const localIntentEpoch = runtime.localIntentEpoch + 1;
2567
+ const localIntentKeyEpochs = { ...runtime.localIntentKeyEpochs };
2568
+ for (const key of keys)
2569
+ Object.defineProperty(localIntentKeyEpochs, key, {
2570
+ value: localIntentEpoch,
2571
+ enumerable: true,
2572
+ configurable: true
2573
+ });
2574
+ publishRuntime({ localIntentEpoch, localIntentKeyEpochs: Object.freeze(localIntentKeyEpochs) });
2575
+ return localIntentEpoch;
2576
+ },
2577
+ recordSettingsWriteFailure: (lastWriteFailure) => publishRuntime({ lastWriteFailure }),
2578
+ recordServerAuthorityEcho: (autoApproveCredits) => {
2579
+ if (Number.isFinite(autoApproveCredits))
2580
+ publishRuntime({
2581
+ autoApproveCredits,
2582
+ serverAuthorityEchoSeq: runtime.serverAuthorityEchoSeq + 1
2583
+ });
2584
+ },
2585
+ hydrateAutoApproveCredits: (autoApproveCredits, expectedSeq) => {
2586
+ if (runtime.serverAuthorityEchoSeq === expectedSeq)
2587
+ publishRuntime({ autoApproveCredits });
2588
+ },
2589
+ getServerSnapshot: () => DEFAULT_USER_PREFERENCES,
2590
+ getSession: () => session,
2591
+ subscribe: (listener) => {
2592
+ listeners.add(listener);
2593
+ return () => {
2594
+ listeners.delete(listener);
2595
+ };
2596
+ },
2597
+ setSession: (next) => {
2598
+ if (sameSession(session, next))
2599
+ return;
2600
+ runtime = Object.freeze({ ...runtime, ...session ? { autoApproveCredits: 0 } : {} });
2601
+ session = next;
2602
+ snapshot = DEFAULT_USER_PREFERENCES;
2603
+ notify();
2604
+ },
2605
+ bindPersistence: (write) => {
2606
+ persist = write;
2607
+ },
2608
+ hydrate: publish,
2609
+ applyLocalPatch: publish,
2610
+ updatePolicy: (changes) => update(changes),
2611
+ setSystemBuiltinSkill: (id, enabled) => update({
2612
+ systemBuiltinSkills: { ...snapshot.systemBuiltinSkills, [id]: enabled }
2613
+ }),
2614
+ updateEditor: (changes) => update(changes),
2615
+ updateChatUi: (changes) => update(changes),
2616
+ setOcrModel: (ocrModel) => update({ ocrModel }),
2617
+ setDeveloperMode: (enabled) => update(enabled ? { developerModeEnabled: true } : { developerModeEnabled: false, diagnosticModeEnabled: false }),
2618
+ setDiagnosticMode: (diagnosticModeEnabled) => snapshot.developerModeEnabled ? update({ diagnosticModeEnabled }) : Promise.resolve(),
2619
+ toggleEditorShortcut: (key) => update({
2620
+ editorShortcuts: { ...snapshot.editorShortcuts, [key]: !snapshot.editorShortcuts[key] }
2621
+ })
2622
+ };
2623
+ }
2624
+ var owners = new WeakMap;
2625
+ function getUserPreferencesStore(getState) {
2626
+ let owner = owners.get(getState);
2627
+ if (!owner) {
2628
+ owner = createUserPreferencesStore();
2629
+ owners.set(getState, owner);
2630
+ }
2631
+ return owner;
2632
+ }
2633
+ var defaultStore = createUserPreferencesStore();
2634
+ var UserPreferencesContext = import_react.createContext(null);
2635
+ // packages/core/abortableDelay.ts
2636
+ function waitForAbortableDelay(ms, signal) {
2637
+ const delayMs = Number.isFinite(ms) && ms >= 0 ? Math.round(ms) : 0;
2638
+ if (signal?.aborted) {
2639
+ return Promise.reject(new DOMException("Aborted", "AbortError"));
2640
+ }
2641
+ return new Promise((resolve, reject) => {
2642
+ const onAbort = () => {
2643
+ clearTimeout(timeoutId);
2644
+ signal?.removeEventListener("abort", onAbort);
2645
+ reject(new DOMException("Aborted", "AbortError"));
2646
+ };
2647
+ const timeoutId = setTimeout(() => {
2648
+ signal?.removeEventListener("abort", onAbort);
2649
+ resolve();
2650
+ }, delayMs);
2651
+ signal?.addEventListener("abort", onAbort, { once: true });
2652
+ });
2653
+ }
2654
+
2655
+ // packages/ai/chat/parseMultilineSSE.ts
2656
+ function createSSEParser() {
2657
+ let buffer = "";
2658
+ return function parseSSE(chunk) {
2659
+ const results = [];
2660
+ if (!chunk)
2661
+ return results;
2662
+ buffer += chunk;
2663
+ const events = buffer.split(/\r?\n\r?\n/);
2664
+ buffer = events.pop() ?? "";
2665
+ for (const ev of events) {
2666
+ if (!ev.trim())
2667
+ continue;
2668
+ const lines = ev.split(/\r?\n/);
2669
+ let accumulator = "";
2670
+ for (const line of lines) {
2671
+ const t = line.trim();
2672
+ if (t === "data: [DONE]") {
2673
+ if (accumulator.trim()) {
2674
+ try {
2675
+ results.push(JSON.parse(accumulator));
2676
+ } catch (e) {}
2677
+ accumulator = "";
2678
+ }
2679
+ results.push("[DONE]");
2680
+ continue;
2681
+ }
2682
+ let content = "";
2683
+ let isDataLine = false;
2684
+ if (t.startsWith("data:")) {
2685
+ content = line.substring(line.indexOf("data:") + 5).trim();
2686
+ isDataLine = true;
2687
+ } else if (accumulator && t && !t.startsWith("event:") && !t.startsWith("id:") && !t.startsWith("retry:")) {
2688
+ content = line;
2689
+ } else {
2690
+ continue;
2691
+ }
2692
+ if (isDataLine && !accumulator) {
2693
+ try {
2694
+ const obj = JSON.parse(content);
2695
+ results.push(obj);
2696
+ continue;
2697
+ } catch (e) {}
2698
+ }
2699
+ accumulator += content;
2700
+ }
2701
+ if (accumulator.trim()) {
2702
+ try {
2703
+ const obj = JSON.parse(accumulator);
2704
+ results.push(obj);
2705
+ } catch (e) {}
2706
+ }
2707
+ }
2708
+ return results;
2709
+ };
2710
+ }
2711
+ var parseMultilineSSE = createSSEParser();
2712
+
2713
+ // packages/ai/tools/toolRunStore.ts
2714
+ var import_react2 = __toESM(require_react());
2715
+ var createToolRunId = () => `toolrun_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
2716
+ var runsById = new Map;
2717
+ var listeners2 = new Set;
2718
+ var version = 0;
2719
+ var notify2 = () => {
2720
+ version += 1;
2721
+ for (const listener of listeners2) {
2722
+ try {
2723
+ listener();
2724
+ } catch {}
2725
+ }
2726
+ };
2727
+ function toolRunStarted(payload) {
2728
+ const {
2729
+ id,
2730
+ messageId,
2731
+ toolName,
2732
+ behavior,
2733
+ inputSummary,
2734
+ startedAt,
2735
+ interaction,
2736
+ input
2737
+ } = payload;
2738
+ runsById.set(id, {
2739
+ id,
2740
+ messageId,
2741
+ toolName,
2742
+ behavior,
2743
+ inputSummary,
2744
+ status: "running",
2745
+ startedAt: startedAt ?? Date.now(),
2746
+ interaction,
2747
+ input,
2748
+ error: undefined,
2749
+ finishedAt: undefined,
2750
+ outputSummary: undefined,
2751
+ steps: undefined
2752
+ });
2753
+ notify2();
2754
+ }
2755
+ function toolRunSetPending(payload) {
2756
+ const { id } = payload;
2757
+ const run = runsById.get(id);
2758
+ if (run) {
2759
+ run.status = "pending";
2760
+ notify2();
2761
+ }
2762
+ }
2763
+ function toolRunSucceeded(payload) {
2764
+ const { id, outputSummary, steps, finishedAt } = payload;
2765
+ const run = runsById.get(id);
2766
+ if (run) {
2767
+ run.status = "succeeded";
2768
+ run.outputSummary = outputSummary;
2769
+ if (steps !== undefined) {
2770
+ run.steps = steps;
2771
+ }
2772
+ run.finishedAt = finishedAt ?? Date.now();
2773
+ notify2();
2774
+ }
2775
+ }
2776
+ function toolRunUpdated(payload) {
2777
+ const { id, outputSummary, steps } = payload;
2778
+ const run = runsById.get(id);
2779
+ if (run) {
2780
+ if (outputSummary !== undefined) {
2781
+ run.outputSummary = outputSummary;
2782
+ }
2783
+ if (steps !== undefined) {
2784
+ run.steps = steps;
2785
+ }
2786
+ notify2();
2787
+ }
2788
+ }
2789
+ function toolRunFailed(payload) {
2790
+ const { id, error, outputSummary, steps, finishedAt } = payload;
2791
+ const run = runsById.get(id);
2792
+ if (run) {
2793
+ run.status = "failed";
2794
+ run.error = error;
2795
+ if (outputSummary !== undefined) {
2796
+ run.outputSummary = outputSummary;
2797
+ }
2798
+ if (steps !== undefined) {
2799
+ run.steps = steps;
2800
+ }
2801
+ run.finishedAt = finishedAt ?? Date.now();
2802
+ notify2();
2803
+ }
2804
+ }
2805
+ function getAllToolRuns() {
2806
+ return Array.from(runsById.values()).sort((a, b) => a.startedAt - b.startedAt);
2807
+ }
2808
+ function getToolRunById(id) {
2809
+ return runsById.get(id);
2810
+ }
2811
+ var executeToolRun = createActionAsyncThunk("toolRun/executeToolRun", async ({ id, inputOverride }, thunkApi) => {
2812
+ const run = getToolRunById(id);
2813
+ if (!run) {
2814
+ throw new Error(`ToolRun not found: ${id}`);
2815
+ }
2816
+ const executionInput = inputOverride ?? run.input;
2817
+ if (!executionInput) {
2818
+ throw new Error(`ToolRun ${id} has no input to execute with.`);
2819
+ }
2820
+ const { findToolExecutor } = await import("./chunk-jqq57s0a.js");
2821
+ const { executor } = findToolExecutor(run.toolName);
2822
+ toolRunStarted({
2823
+ id: run.id,
2824
+ messageId: run.messageId,
2825
+ toolName: run.toolName,
2826
+ behavior: run.behavior,
2827
+ inputSummary: run.inputSummary,
2828
+ startedAt: Date.now(),
2829
+ interaction: run.interaction,
2830
+ input: executionInput
2831
+ });
2832
+ try {
2833
+ const result = await executor(executionInput, thunkApi, {
2834
+ parentMessageId: run.messageId
2835
+ });
2836
+ toolRunSucceeded({
2837
+ id: run.id,
2838
+ outputSummary: result?.displayData || ""
2839
+ });
2840
+ if (run.toolName === "deleteSpaces") {
2841
+ const latestState = thunkApi.getState();
2842
+ const userId = selectIdentityUserId(latestState);
2843
+ if (userId) {
2844
+ const { fetchUserSpaceMemberships } = await import("./chunk-5r1sq2gt.js");
2845
+ await thunkApi.dispatch(fetchUserSpaceMemberships(userId));
2846
+ }
2847
+ }
2848
+ return {
2849
+ id: run.id,
2850
+ rawData: result?.rawData,
2851
+ displayData: result?.displayData
2852
+ };
2853
+ } catch (e) {
2854
+ const msg = toErrorMessage(e);
2855
+ const structured = getToolResultErrorData(e);
2856
+ toolRunFailed({
2857
+ id: run.id,
2858
+ error: msg,
2859
+ outputSummary: asOptionalTrimmedString(structured?.displayData)
2860
+ });
2861
+ throw e;
2862
+ }
2863
+ });
2864
+
2865
+ // packages/core/clipMultilineText.ts
2866
+ function clipMultilineText(value, max) {
2867
+ const trimmed = value.trim();
2868
+ if (trimmed.length <= max)
2869
+ return trimmed;
2870
+ return `${trimmed.slice(0, max)}
2871
+ ...[truncated ${trimmed.length - max} chars]`;
2872
+ }
2873
+
2874
+ export { normalizeEnabledPromptSkills, isAccountOnDemandWorkflowSkill, normalizeEnabledSkills, resolveUserEnabledSkills, UI_CARD_ENVELOPE_MAX_BYTES, parseUiCard, uiCardFallback, toJsonSchema, ZOHO_MAIL_TOOL_NAMES, ZOHO_MAIL_TOOL_SCHEMAS, resolveToolBaseUrl2, getRequestConfig2, getToolBaseUrl2, getToolRequestContext2, ToolApiError2, buildToolRequestHeaders2, callToolApi2, targetForRunKind, pushGate, clearGateTurn, getSnapshot, resolveGate, CHAT_UI_PREFERENCE_KEYS, AGENT_UPDATE_FIELD_NAMES, normalizeAgentUpdateFieldList, SYSTEM_DEFAULT_AGENT_ID, hasOwn, normalizeDefaultAgentIdSetting, normalizeAuthorityHomeServerSetting, omitKeys, ACCOUNT_POLICY_KEYS, USER_PREFERENCE_KEYS, pickUserPreferences, getUserPreferencesStore, createSSEParser, waitForAbortableDelay, slateToSimplifiedMarkdown, applyPageContentMutation, resolvePageReadMarkdown2, readDocFunctionSchema2, readPageFunctionSchema2, buildReadDocResult2, readDocFunc2, readPageFunc2, clipMultilineText, fetchAndSerializeTable, ToolResultError, getToolResultErrorData, createToolRunId, toolRunStarted, toolRunSetPending, toolRunSucceeded, toolRunUpdated, toolRunFailed, getAllToolRuns, resolveMemoryToolContext, resolveToolAttributionContext, loadSkillFunctionSchema, loadSkillFunc };