nolo-cli 0.108.0-alpha.2 → 0.108.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 (606) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-BY3P5LBB.js → _executeModel-T7PIVJIW.js} +128 -83
  3. package/action-RHUT4OHH.js +23 -0
  4. package/{addContentAction-MB2HHMDZ.js → addContentAction-BQ3LJLUW.js} +19 -13
  5. package/{addDialogAgentAction-MCEABSBA.js → addDialogAgentAction-B6X7BXR4.js} +24 -20
  6. package/{agentDeleteCommand-66KXCSRR.js → agentDeleteCommand-VIDCZAFG.js} +154 -68
  7. package/{agentEmailCommands-63UTONDK.js → agentEmailCommands-PCHDY4ZP.js} +125 -105
  8. package/{agentGrantCommands-M3XFO6EN.js → agentGrantCommands-HOJ3JBBQ.js} +3 -3
  9. package/agentListCommands-QNUAN3YH.js +800 -0
  10. package/{agentMachineCommands-Z6RGPZSG.js → agentMachineCommands-C2TMTQNU.js} +54 -58
  11. package/{agentProviderCommands-X3UNW77C.js → agentProviderCommands-7PCGR77I.js} +97 -2
  12. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-7GCDM4BK.js} +7 -7
  13. package/agentRecordCommands-T4XAUFF5.js +149 -0
  14. package/agentRunCommand-T3AW43I6.js +179 -0
  15. package/{agentRunControl-AVJR4JW4.js → agentRunControl-2CDZNHXV.js} +10 -2
  16. package/{agentRuntimeLocal-E67CTV45.js → agentRuntimeLocal-SQUDRZWE.js} +41 -46
  17. package/{agentSlice-DG5TIQHE.js → agentSlice-HBGFNXUG.js} +22 -16
  18. package/{appDeleteCommands-Z36CLGUK.js → appDeleteCommands-CLLYGEBC.js} +55 -56
  19. package/{appDeployCommands-ECMUWG6S.js → appDeployCommands-HY2NBNDQ.js} +64 -60
  20. package/{appDeployStatusCommands-CL24TDMA.js → appDeployStatusCommands-SGO5GEXH.js} +53 -53
  21. package/{appGetCommands-ITHGOYGJ.js → appGetCommands-ZPYK2N5D.js} +53 -53
  22. package/{appListCommands-EEOSI6RC.js → appListCommands-O2BHIMKS.js} +54 -56
  23. package/{authCommand-HGP2XTKC.js → authCommand-GUIREPHK.js} +132 -83
  24. package/{authCommands-RGOGCPP6.js → authCommands-K3BDSTJ4.js} +10 -7
  25. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-MUOUTRNJ.js} +13 -10
  26. package/{chromeCommands-FZYAU75D.js → chromeCommands-Z2WRJB7O.js} +290 -38
  27. package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-YWYXZTIR.js} +157 -23
  28. package/{chunk-2F7RJC6L.js → chunk-2C47W7IJ.js} +1 -1
  29. package/chunk-2DRYS3G3.js +13941 -0
  30. package/{chunk-VLTIYV3X.js → chunk-2ECUZDEL.js} +37 -11
  31. package/{chunk-LPIYPEME.js → chunk-2FY3GHBV.js} +1449 -1094
  32. package/{chunk-ALXHV7NK.js → chunk-2GGXHQIW.js} +43 -4
  33. package/{chunk-AHAHBQMU.js → chunk-2OMUAIKR.js} +2 -2
  34. package/{chunk-DHDMC6FO.js → chunk-3CZM6HGQ.js} +53 -23
  35. package/{chunk-BNGW5ASC.js → chunk-3LI5UCTU.js} +23 -3
  36. package/{chunk-FDTR4QJ6.js → chunk-3MZAGMYY.js} +48 -1
  37. package/chunk-3PVYUPXK.js +40 -0
  38. package/{chunk-FV3JEYR3.js → chunk-3SK3J3IF.js} +69 -10
  39. package/chunk-4LCOCOR5.js +50 -0
  40. package/{chunk-V7E4PXQD.js → chunk-4MSYSHZD.js} +15 -7
  41. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  42. package/{chunk-MP64VFGD.js → chunk-4XEYAFLY.js} +60 -18
  43. package/chunk-4YRTZIVN.js +871 -0
  44. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  45. package/{chunk-N7J63Q6C.js → chunk-56GBUMO5.js} +10 -1
  46. package/chunk-5MMAK75Q.js +15 -0
  47. package/{chunk-KZJP33ZK.js → chunk-5WLADF62.js} +90 -36
  48. package/chunk-5XN3OSCT.js +164 -0
  49. package/{chunk-T3GEOSRJ.js → chunk-5YJWHTKD.js} +69 -57
  50. package/chunk-6CCAXGFK.js +1712 -0
  51. package/{chunk-42V6BK2E.js → chunk-6MXDOUMH.js} +18 -36
  52. package/{chunk-QOKAKDPE.js → chunk-6Q7UTJKR.js} +6 -94
  53. package/{chunk-J4MOO56S.js → chunk-6VRWNU5J.js} +10 -2
  54. package/{chunk-IQPFGYO3.js → chunk-726TCFLQ.js} +5 -5
  55. package/{chunk-CW67PN7L.js → chunk-7B3BVGU3.js} +61 -11
  56. package/chunk-7DPNBQSV.js +9 -0
  57. package/{chunk-LWKP7AWH.js → chunk-A337PRRR.js} +41 -17
  58. package/chunk-AGIM7IMJ.js +147 -0
  59. package/chunk-AI7XJMMQ.js +1858 -0
  60. package/{chunk-ABQYVJBJ.js → chunk-AIZE5TDM.js} +3 -3
  61. package/{chunk-LJ5VW2UJ.js → chunk-ALKCVCA5.js} +4 -4
  62. package/{chunk-5UTFL4QJ.js → chunk-APO5TOXO.js} +1 -1
  63. package/{chunk-E4MARS3Q.js → chunk-AU7AXHUL.js} +1 -1
  64. package/{chunk-DOTZ5GTO.js → chunk-AWYWIWTU.js} +310 -95
  65. package/chunk-B77W7P7J.js +95 -0
  66. package/{chunk-PBA4UJBK.js → chunk-BFYDNHYW.js} +12 -12
  67. package/{chunk-QTGQ2LTL.js → chunk-BIAETTOB.js} +5 -9
  68. package/{chunk-OIVSQH2O.js → chunk-CGEK73JN.js} +311 -12
  69. package/chunk-CHOZJMJS.js +78 -0
  70. package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
  71. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  72. package/chunk-EYLGAEB4.js +784 -0
  73. package/{chunk-3BMYXEUW.js → chunk-F2UJW3EK.js} +1 -1
  74. package/{chunk-RVE4DCV3.js → chunk-FBLRSLZH.js} +26 -31
  75. package/{chunk-P5EVSOPA.js → chunk-FWY6BHIJ.js} +363 -248
  76. package/{chunk-4MK3I7Y4.js → chunk-G23MQWLJ.js} +7 -128
  77. package/chunk-G6OOUQWJ.js +417 -0
  78. package/{chunk-WV42OMV7.js → chunk-GHZ2H2HJ.js} +11 -15
  79. package/chunk-I42VC5KR.js +15 -0
  80. package/{chunk-H4AHY5BU.js → chunk-IFALJPEX.js} +69 -20
  81. package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
  82. package/{chunk-UKWGR5SS.js → chunk-IJERIUXS.js} +242 -1146
  83. package/chunk-IN5UVHHP.js +843 -0
  84. package/{chunk-QDSINZM3.js → chunk-IXH3HKY2.js} +1 -22
  85. package/{chunk-SYXOBWOC.js → chunk-JGLKZGGZ.js} +124 -703
  86. package/chunk-JJM3WS6W.js +132 -0
  87. package/{chunk-TR22GEUU.js → chunk-JKDL7BRF.js} +20 -11
  88. package/chunk-JONVI6DK.js +593 -0
  89. package/{chunk-SH43IESU.js → chunk-KQ7DAEZ7.js} +202 -32
  90. package/chunk-KWEDNOZZ.js +7546 -0
  91. package/{chunk-6OZ36FXI.js → chunk-KY6GPQ7O.js} +36 -12
  92. package/{chunk-RZGLXO2B.js → chunk-L5YKEQLD.js} +1715 -451
  93. package/{chunk-MRIHM22T.js → chunk-LAVSW2C2.js} +77 -144
  94. package/{chunk-HSSRGGXJ.js → chunk-LNEKN523.js} +10 -7
  95. package/chunk-LWLNLZC5.js +265 -0
  96. package/{chunk-YTLRHRH3.js → chunk-MDOZSLDE.js} +17 -15
  97. package/{chunk-I3TQJXQ7.js → chunk-MHD5JBSS.js} +131 -10
  98. package/{chunk-QU7KDSZX.js → chunk-MW533QT3.js} +190 -8
  99. package/{chunk-4NNTATRH.js → chunk-NLEJWKF5.js} +10394 -8549
  100. package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
  101. package/{chunk-GQBOR3G6.js → chunk-NN4UUYGB.js} +18 -4
  102. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  103. package/chunk-OKARGYFT.js +15 -0
  104. package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
  105. package/{chunk-Z5625XML.js → chunk-OYBAT7RT.js} +113 -17
  106. package/chunk-P3SFAHIL.js +134 -0
  107. package/{chunk-XD2MJFUG.js → chunk-PBGO5AFD.js} +1 -1
  108. package/{chunk-EYAQT56M.js → chunk-PFEK4SA2.js} +13 -10
  109. package/{chunk-Z77CRGTW.js → chunk-PHHFVGOJ.js} +1 -1
  110. package/{chunk-3VNWWVKB.js → chunk-PJNFNEJE.js} +114 -28
  111. package/{chunk-HVURBGF3.js → chunk-PWRS2SU2.js} +27 -9
  112. package/chunk-QFEW2ULV.js +42 -0
  113. package/{chunk-IIVGDG4I.js → chunk-QLQ573SU.js} +124 -77
  114. package/chunk-QQ56R7KS.js +88 -0
  115. package/{chunk-PWBDVI4R.js → chunk-QRFI5NHO.js} +269 -141
  116. package/chunk-QYPE3TS3.js +43 -0
  117. package/{chunk-VMFTFOWF.js → chunk-RLRYVSCD.js} +31 -14
  118. package/{chunk-VRTTFDBM.js → chunk-RNNWTMKT.js} +56 -63
  119. package/{chunk-JRQFUXY7.js → chunk-RRQQAG7W.js} +93 -24
  120. package/chunk-SJ3QFSQS.js +1147 -0
  121. package/{chunk-Q67DOFOO.js → chunk-SZC4REES.js} +212 -105
  122. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  123. package/{chunk-GNCCNNZD.js → chunk-TSBCYK5F.js} +7 -7
  124. package/chunk-TY3TIUJK.js +89 -0
  125. package/chunk-U4STABYN.js +81 -0
  126. package/chunk-UEILX4EV.js +15 -0
  127. package/{chunk-AODJ7WSF.js → chunk-UIYVU3S4.js} +90 -79
  128. package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
  129. package/{chunk-7S4YWN7P.js → chunk-V2UPLOXT.js} +4 -4
  130. package/{chunk-LS2ZANRJ.js → chunk-V6WXGTUJ.js} +1 -1
  131. package/{chunk-6YTOJY35.js → chunk-VBG7GWWR.js} +253 -8
  132. package/{chunk-DVINR3PL.js → chunk-VEA7H5FG.js} +3 -3
  133. package/chunk-VIWDGTDA.js +8 -0
  134. package/chunk-VJVNU77E.js +83 -0
  135. package/{chunk-EADNWBAZ.js → chunk-VP3BINY7.js} +13 -0
  136. package/{chunk-HKNXJGEC.js → chunk-VSPO4S33.js} +47 -192
  137. package/{chunk-PHXD6JTX.js → chunk-W2N3ZC4P.js} +7 -7
  138. package/{chunk-EOARMOVD.js → chunk-W4S6OTSC.js} +6 -3
  139. package/{chunk-6Z7MY3V7.js → chunk-WCQNEMXG.js} +3 -3
  140. package/chunk-WJZOQR2J.js +151 -0
  141. package/{chunk-BFDFRLLQ.js → chunk-WW2USJ3C.js} +3 -3
  142. package/chunk-X5BIY654.js +29 -0
  143. package/{chunk-Q554LLSI.js → chunk-XETG4RIX.js} +5 -5
  144. package/{chunk-3L2WKC3W.js → chunk-XPWGOTBQ.js} +8 -1
  145. package/{chunk-2OASQKU2.js → chunk-XRXYRHE5.js} +187 -16
  146. package/{chunk-JEDZAO7L.js → chunk-YBNHPX4S.js} +257 -37
  147. package/{chunk-JPGCXHNM.js → chunk-YLMMECCH.js} +1 -1
  148. package/{chunk-6D6VBVEW.js → chunk-YVTZMLXZ.js} +96 -25
  149. package/{chunk-G4VIHCGJ.js → chunk-ZR5RAAVI.js} +35 -30
  150. package/chunk-ZRAU6T47.js +56 -0
  151. package/{chunk-ONXOABJR.js → chunk-ZWQUWF6W.js} +36 -1
  152. package/{cliExecutor-HG3S345O.js → cliExecutor-AWYR3T33.js} +1 -1
  153. package/commandRegistry-3XWUYELA.js +839 -0
  154. package/contentThunks-ALRPUDRE.js +83 -0
  155. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-JFKTYS2D.js} +2 -2
  156. package/{createAgentAutomationAction-7HX7KBES.js → createAgentAutomationAction-XXRXCDFJ.js} +51 -43
  157. package/createDialogAction-FVSAW7WZ.js +75 -0
  158. package/{createPageAction-QWNMGO3O.js → createPageAction-RT6DPYP5.js} +60 -51
  159. package/{chunk-UDIIVXKA.js → cursorProvider-YGGNMVWX.js} +2822 -10269
  160. package/{dbSlice-A6C6H32X.js → dbSlice-JQFBMJ55.js} +18 -12
  161. package/{deleteFile-YG6QMJLU.js → deleteFile-6JWDDRVP.js} +9 -5
  162. package/dialogCommands-K734RXEQ.js +108 -0
  163. package/{dialogSlice-P2K47T3P.js → dialogSlice-GFCT74GI.js} +66 -41
  164. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  165. package/{docCreateCommands-43JKQEIH.js → docCreateCommands-N3KPGP4A.js} +51 -54
  166. package/{docDeleteCommands-RL6D46XE.js → docDeleteCommands-4CR4TXZ7.js} +53 -55
  167. package/{docReadCommands-TOEUEQDG.js → docReadCommands-62XK57VS.js} +50 -53
  168. package/{docStore-3AHKTJRI.js → docStore-Z7KBPFXX.js} +24 -15
  169. package/{docUpdateCommands-FWU5G2XB.js → docUpdateCommands-DRAAWIDC.js} +51 -54
  170. package/{fetchMessages-EIU7UFFK.js → fetchMessages-LM6OMMQQ.js} +5 -4
  171. package/{getPricing-LUSEABA6.js → getPricing-XDF4OLTC.js} +6 -6
  172. package/handleSendMessageAction-NRKUSHK2.js +1849 -0
  173. package/index.js +91 -884
  174. package/{lib-FRRS27KN.js → lib-PU2G2MSO.js} +523 -191
  175. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-BOETO2TD.js} +2 -2
  176. package/localRuntimeAdapter-S6UEEOSA.js +239 -0
  177. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-YSE6NH7B.js} +12 -9
  178. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-7FBKDEQY.js} +1 -1
  179. package/{machineCommands-TTKK4F7C.js → machineCommands-IQYHOOVH.js} +493 -152
  180. package/machineWsRunDispatch-3ZUMZUGP.js +164 -0
  181. package/{memberThunks-P2ECUJ56.js → memberThunks-Y3Q7GZTG.js} +24 -17
  182. package/{models-T3SG6MJ5.js → models-6V4ZCHEE.js} +2 -2
  183. package/node_modules/abstract-level/CHANGELOG.md +150 -0
  184. package/node_modules/abstract-level/LICENSE +21 -0
  185. package/node_modules/abstract-level/README.md +1957 -0
  186. package/node_modules/abstract-level/UPGRADING.md +669 -0
  187. package/node_modules/abstract-level/abstract-chained-batch.js +397 -0
  188. package/node_modules/abstract-level/abstract-iterator.js +404 -0
  189. package/node_modules/abstract-level/abstract-level.js +1127 -0
  190. package/node_modules/abstract-level/abstract-snapshot.js +84 -0
  191. package/node_modules/abstract-level/index.d.ts +52 -0
  192. package/node_modules/abstract-level/index.js +9 -0
  193. package/node_modules/abstract-level/lib/abstract-sublevel-iterator.js +141 -0
  194. package/node_modules/abstract-level/lib/abstract-sublevel.js +290 -0
  195. package/node_modules/abstract-level/lib/common.js +33 -0
  196. package/node_modules/abstract-level/lib/default-chained-batch.js +29 -0
  197. package/node_modules/abstract-level/lib/default-kv-iterator.js +74 -0
  198. package/node_modules/abstract-level/lib/deferred-iterator.js +110 -0
  199. package/node_modules/abstract-level/lib/deferred-queue.js +84 -0
  200. package/node_modules/abstract-level/lib/errors.js +21 -0
  201. package/node_modules/abstract-level/lib/event-monitor.js +30 -0
  202. package/node_modules/abstract-level/lib/hooks.js +78 -0
  203. package/node_modules/abstract-level/lib/prefixes.js +21 -0
  204. package/node_modules/abstract-level/lib/prewrite-batch.js +96 -0
  205. package/node_modules/abstract-level/lib/range-options.js +26 -0
  206. package/node_modules/abstract-level/package.json +66 -0
  207. package/node_modules/abstract-level/test/async-iterator-test.js +132 -0
  208. package/node_modules/abstract-level/test/batch-test.js +214 -0
  209. package/node_modules/abstract-level/test/chained-batch-test.js +315 -0
  210. package/node_modules/abstract-level/test/clear-range-test.js +262 -0
  211. package/node_modules/abstract-level/test/clear-test.js +110 -0
  212. package/node_modules/abstract-level/test/common.js +90 -0
  213. package/node_modules/abstract-level/test/deferred-open-test.js +209 -0
  214. package/node_modules/abstract-level/test/del-test.js +65 -0
  215. package/node_modules/abstract-level/test/encoding-buffer-test.js +336 -0
  216. package/node_modules/abstract-level/test/encoding-custom-test.js +92 -0
  217. package/node_modules/abstract-level/test/encoding-decode-error-test.js +85 -0
  218. package/node_modules/abstract-level/test/encoding-json-test.js +75 -0
  219. package/node_modules/abstract-level/test/encoding-test.js +130 -0
  220. package/node_modules/abstract-level/test/events/write.js +132 -0
  221. package/node_modules/abstract-level/test/factory-test.js +36 -0
  222. package/node_modules/abstract-level/test/get-many-test.js +157 -0
  223. package/node_modules/abstract-level/test/get-sync-test.js +61 -0
  224. package/node_modules/abstract-level/test/get-test.js +83 -0
  225. package/node_modules/abstract-level/test/has-many-test.js +144 -0
  226. package/node_modules/abstract-level/test/has-test.js +81 -0
  227. package/node_modules/abstract-level/test/hooks/newsub.js +57 -0
  228. package/node_modules/abstract-level/test/hooks/postopen.js +229 -0
  229. package/node_modules/abstract-level/test/hooks/prewrite.js +816 -0
  230. package/node_modules/abstract-level/test/hooks/shared.js +38 -0
  231. package/node_modules/abstract-level/test/index.js +86 -0
  232. package/node_modules/abstract-level/test/iterator-explicit-snapshot-test.js +393 -0
  233. package/node_modules/abstract-level/test/iterator-no-snapshot-test.js +49 -0
  234. package/node_modules/abstract-level/test/iterator-range-test.js +277 -0
  235. package/node_modules/abstract-level/test/iterator-seek-test.js +335 -0
  236. package/node_modules/abstract-level/test/iterator-snapshot-test.js +56 -0
  237. package/node_modules/abstract-level/test/iterator-test.js +621 -0
  238. package/node_modules/abstract-level/test/manifest-test.js +21 -0
  239. package/node_modules/abstract-level/test/open-create-if-missing-test.js +39 -0
  240. package/node_modules/abstract-level/test/open-error-if-exists-test.js +25 -0
  241. package/node_modules/abstract-level/test/open-test.js +263 -0
  242. package/node_modules/abstract-level/test/put-get-del-test.js +97 -0
  243. package/node_modules/abstract-level/test/put-test.js +70 -0
  244. package/node_modules/abstract-level/test/self/abstract-iterator-test.js +182 -0
  245. package/node_modules/abstract-level/test/self/async-iterator-test.js +242 -0
  246. package/node_modules/abstract-level/test/self/attach-resource-test.js +74 -0
  247. package/node_modules/abstract-level/test/self/defer-test.js +140 -0
  248. package/node_modules/abstract-level/test/self/deferred-iterator-test.js +314 -0
  249. package/node_modules/abstract-level/test/self/deferred-operations-test.js +86 -0
  250. package/node_modules/abstract-level/test/self/deferred-queue-test.js +93 -0
  251. package/node_modules/abstract-level/test/self/encoding-test.js +391 -0
  252. package/node_modules/abstract-level/test/self/errors-test.js +11 -0
  253. package/node_modules/abstract-level/test/self/iterator-test.js +1050 -0
  254. package/node_modules/abstract-level/test/self/sublevel-test.js +1039 -0
  255. package/node_modules/abstract-level/test/self.js +905 -0
  256. package/node_modules/abstract-level/test/sublevel-test.js +209 -0
  257. package/node_modules/abstract-level/test/traits/closed.js +42 -0
  258. package/node_modules/abstract-level/test/traits/index.js +4 -0
  259. package/node_modules/abstract-level/test/traits/open.js +62 -0
  260. package/node_modules/abstract-level/test/util.js +275 -0
  261. package/node_modules/abstract-level/types/abstract-chained-batch.d.ts +124 -0
  262. package/node_modules/abstract-level/types/abstract-iterator.d.ts +241 -0
  263. package/node_modules/abstract-level/types/abstract-level.d.ts +636 -0
  264. package/node_modules/abstract-level/types/abstract-snapshot.d.ts +30 -0
  265. package/node_modules/abstract-level/types/abstract-sublevel.d.ts +76 -0
  266. package/node_modules/abstract-level/types/interfaces.d.ts +43 -0
  267. package/node_modules/base64-js/LICENSE +21 -0
  268. package/node_modules/base64-js/README.md +34 -0
  269. package/node_modules/base64-js/base64js.min.js +1 -0
  270. package/node_modules/base64-js/index.d.ts +3 -0
  271. package/node_modules/base64-js/index.js +150 -0
  272. package/node_modules/base64-js/package.json +47 -0
  273. package/node_modules/browser-level/CHANGELOG.md +44 -0
  274. package/node_modules/browser-level/LICENSE +21 -0
  275. package/node_modules/browser-level/README.md +124 -0
  276. package/node_modules/browser-level/UPGRADING.md +143 -0
  277. package/node_modules/browser-level/index.d.ts +108 -0
  278. package/node_modules/browser-level/index.js +323 -0
  279. package/node_modules/browser-level/iterator.js +239 -0
  280. package/node_modules/browser-level/package.json +48 -0
  281. package/node_modules/browser-level/util/clear.js +38 -0
  282. package/node_modules/browser-level/util/deserialize.js +17 -0
  283. package/node_modules/browser-level/util/key-range.js +20 -0
  284. package/node_modules/buffer/AUTHORS.md +73 -0
  285. package/node_modules/buffer/LICENSE +21 -0
  286. package/node_modules/buffer/README.md +410 -0
  287. package/node_modules/buffer/index.d.ts +194 -0
  288. package/node_modules/buffer/index.js +2106 -0
  289. package/node_modules/buffer/package.json +93 -0
  290. package/node_modules/classic-level/CHANGELOG.md +115 -0
  291. package/node_modules/classic-level/LICENSE +21 -0
  292. package/node_modules/classic-level/README.md +274 -0
  293. package/node_modules/classic-level/UPGRADING.md +131 -0
  294. package/node_modules/classic-level/binding.cc +2652 -0
  295. package/node_modules/classic-level/binding.gyp +71 -0
  296. package/node_modules/classic-level/binding.js +1 -0
  297. package/node_modules/classic-level/chained-batch.js +35 -0
  298. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/LICENSE +27 -0
  299. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/Makefile +424 -0
  300. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/build_detect_platform +256 -0
  301. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/autocompact_test.cc +118 -0
  302. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/builder.cc +88 -0
  303. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/builder.h +34 -0
  304. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/c.cc +595 -0
  305. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/c_test.c +390 -0
  306. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/corruption_test.cc +374 -0
  307. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_bench.cc +1020 -0
  308. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_impl.cc +1568 -0
  309. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_impl.h +212 -0
  310. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_iter.cc +317 -0
  311. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_iter.h +28 -0
  312. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_test.cc +2158 -0
  313. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat.cc +140 -0
  314. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat.h +230 -0
  315. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat_test.cc +112 -0
  316. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dumpfile.cc +225 -0
  317. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/fault_injection_test.cc +554 -0
  318. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename.cc +144 -0
  319. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename.h +85 -0
  320. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename_test.cc +123 -0
  321. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/leveldbutil.cc +64 -0
  322. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_format.h +35 -0
  323. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_reader.cc +284 -0
  324. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_reader.h +113 -0
  325. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_test.cc +591 -0
  326. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_writer.cc +112 -0
  327. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_writer.h +54 -0
  328. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/memtable.cc +145 -0
  329. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/memtable.h +89 -0
  330. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/recovery_test.cc +324 -0
  331. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/repair.cc +461 -0
  332. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/skiplist.h +384 -0
  333. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/skiplist_test.cc +378 -0
  334. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/snapshot.h +67 -0
  335. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/table_cache.cc +127 -0
  336. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/table_cache.h +61 -0
  337. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit.cc +266 -0
  338. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit.h +107 -0
  339. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit_test.cc +46 -0
  340. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set.cc +1535 -0
  341. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set.h +399 -0
  342. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set_test.cc +179 -0
  343. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch.cc +147 -0
  344. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch_internal.h +50 -0
  345. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch_test.cc +120 -0
  346. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv.cc +398 -0
  347. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv.h +20 -0
  348. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv_test.cc +241 -0
  349. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/c.h +290 -0
  350. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/cache.h +110 -0
  351. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/comparator.h +63 -0
  352. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/db.h +164 -0
  353. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/dumpfile.h +25 -0
  354. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/env.h +351 -0
  355. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/filter_policy.h +70 -0
  356. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/iterator.h +100 -0
  357. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/options.h +213 -0
  358. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/slice.h +109 -0
  359. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/status.h +112 -0
  360. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/table.h +85 -0
  361. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/table_builder.h +92 -0
  362. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/value_sink.h +26 -0
  363. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/write_batch.h +64 -0
  364. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/issues/issue178_test.cc +92 -0
  365. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/issues/issue200_test.cc +59 -0
  366. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/atomic_pointer.h +242 -0
  367. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port.h +21 -0
  368. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_example.h +141 -0
  369. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix.cc +53 -0
  370. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix.h +156 -0
  371. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix_sse.cc +129 -0
  372. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/thread_annotations.h +60 -0
  373. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/win/stdint.h +24 -0
  374. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block.cc +268 -0
  375. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block.h +44 -0
  376. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block_builder.cc +109 -0
  377. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block_builder.h +57 -0
  378. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block.cc +111 -0
  379. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block.h +68 -0
  380. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block_test.cc +128 -0
  381. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/format.cc +144 -0
  382. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/format.h +108 -0
  383. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/iterator.cc +67 -0
  384. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/iterator_wrapper.h +66 -0
  385. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/merger.cc +197 -0
  386. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/merger.h +26 -0
  387. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table.cc +285 -0
  388. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table_builder.cc +270 -0
  389. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table_test.cc +876 -0
  390. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/two_level_iterator.cc +182 -0
  391. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/two_level_iterator.h +34 -0
  392. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena.cc +68 -0
  393. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena.h +68 -0
  394. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena_test.cc +68 -0
  395. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/bloom.cc +95 -0
  396. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/bloom_test.cc +162 -0
  397. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/cache.cc +405 -0
  398. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/cache_test.cc +226 -0
  399. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding.cc +194 -0
  400. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding.h +104 -0
  401. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding_test.cc +196 -0
  402. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/comparator.cc +81 -0
  403. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c.cc +350 -0
  404. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c.h +45 -0
  405. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c_test.cc +72 -0
  406. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env.cc +100 -0
  407. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix.cc +695 -0
  408. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix_test.cc +66 -0
  409. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix_test_helper.h +28 -0
  410. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_test.cc +106 -0
  411. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/filter_policy.cc +11 -0
  412. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash.cc +52 -0
  413. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash.h +19 -0
  414. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash_test.cc +54 -0
  415. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/histogram.cc +139 -0
  416. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/histogram.h +42 -0
  417. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/logging.cc +72 -0
  418. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/logging.h +43 -0
  419. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/mutexlock.h +41 -0
  420. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/options.cc +30 -0
  421. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/posix_logger.h +98 -0
  422. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/random.h +64 -0
  423. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/status.cc +75 -0
  424. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testharness.cc +77 -0
  425. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testharness.h +138 -0
  426. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testutil.cc +51 -0
  427. package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testutil.h +63 -0
  428. package/node_modules/classic-level/deps/leveldb/leveldb.gyp +282 -0
  429. package/node_modules/classic-level/deps/leveldb/patches/001-value-sink.patch +164 -0
  430. package/node_modules/classic-level/deps/leveldb/port-libuv/atomic_pointer_win.h +48 -0
  431. package/node_modules/classic-level/deps/leveldb/port-libuv/env_win.cc +692 -0
  432. package/node_modules/classic-level/deps/leveldb/port-libuv/port_uv.cc +36 -0
  433. package/node_modules/classic-level/deps/leveldb/port-libuv/port_uv.h +157 -0
  434. package/node_modules/classic-level/deps/leveldb/port-libuv/port_uv.h.bak +153 -0
  435. package/node_modules/classic-level/deps/leveldb/port-libuv/stdint-msvc2008.h +247 -0
  436. package/node_modules/classic-level/deps/leveldb/port-libuv/uv_condvar.h +45 -0
  437. package/node_modules/classic-level/deps/leveldb/port-libuv/uv_condvar_posix.cc +139 -0
  438. package/node_modules/classic-level/deps/leveldb/port-libuv/win_logger.cc +79 -0
  439. package/node_modules/classic-level/deps/leveldb/port-libuv/win_logger.h +28 -0
  440. package/node_modules/classic-level/deps/snappy/freebsd/config.h +135 -0
  441. package/node_modules/classic-level/deps/snappy/freebsd/snappy-stubs-public.h +100 -0
  442. package/node_modules/classic-level/deps/snappy/linux/config.h +135 -0
  443. package/node_modules/classic-level/deps/snappy/linux/snappy-stubs-public.h +100 -0
  444. package/node_modules/classic-level/deps/snappy/mac/config.h +137 -0
  445. package/node_modules/classic-level/deps/snappy/mac/snappy-stubs-public.h +100 -0
  446. package/node_modules/classic-level/deps/snappy/openbsd/config.h +135 -0
  447. package/node_modules/classic-level/deps/snappy/openbsd/snappy-stubs-public.h +100 -0
  448. package/node_modules/classic-level/deps/snappy/snappy/COPYING +54 -0
  449. package/node_modules/classic-level/deps/snappy/snappy/cmake/SnappyConfig.cmake +1 -0
  450. package/node_modules/classic-level/deps/snappy/snappy/cmake/config.h.in +62 -0
  451. package/node_modules/classic-level/deps/snappy/snappy/snappy-c.cc +90 -0
  452. package/node_modules/classic-level/deps/snappy/snappy/snappy-c.h +138 -0
  453. package/node_modules/classic-level/deps/snappy/snappy/snappy-internal.h +224 -0
  454. package/node_modules/classic-level/deps/snappy/snappy/snappy-sinksource.cc +104 -0
  455. package/node_modules/classic-level/deps/snappy/snappy/snappy-sinksource.h +182 -0
  456. package/node_modules/classic-level/deps/snappy/snappy/snappy-stubs-internal.cc +42 -0
  457. package/node_modules/classic-level/deps/snappy/snappy/snappy-stubs-internal.h +561 -0
  458. package/node_modules/classic-level/deps/snappy/snappy/snappy-stubs-public.h.in +94 -0
  459. package/node_modules/classic-level/deps/snappy/snappy/snappy-test.cc +612 -0
  460. package/node_modules/classic-level/deps/snappy/snappy/snappy-test.h +573 -0
  461. package/node_modules/classic-level/deps/snappy/snappy/snappy.cc +1515 -0
  462. package/node_modules/classic-level/deps/snappy/snappy/snappy.h +203 -0
  463. package/node_modules/classic-level/deps/snappy/snappy/snappy_unittest.cc +1410 -0
  464. package/node_modules/classic-level/deps/snappy/snappy.gyp +119 -0
  465. package/node_modules/classic-level/deps/snappy/solaris/config.h +135 -0
  466. package/node_modules/classic-level/deps/snappy/solaris/snappy-stubs-public.h +100 -0
  467. package/node_modules/classic-level/deps/snappy/win32/config.h +29 -0
  468. package/node_modules/classic-level/deps/snappy/win32/snappy-stubs-public.h +100 -0
  469. package/node_modules/classic-level/index.d.ts +343 -0
  470. package/node_modules/classic-level/index.js +311 -0
  471. package/node_modules/classic-level/iterator.js +122 -0
  472. package/node_modules/classic-level/package.json +70 -0
  473. package/node_modules/classic-level/prebuilds/android-arm/classic-level.armv7.node +0 -0
  474. package/node_modules/classic-level/prebuilds/android-arm64/classic-level.armv8.node +0 -0
  475. package/node_modules/classic-level/prebuilds/darwin-x64+arm64/classic-level.node +0 -0
  476. package/node_modules/classic-level/prebuilds/linux-arm/classic-level.armv6.node +0 -0
  477. package/node_modules/classic-level/prebuilds/linux-arm/classic-level.armv7.node +0 -0
  478. package/node_modules/classic-level/prebuilds/linux-arm64/classic-level.armv8.node +0 -0
  479. package/node_modules/classic-level/prebuilds/linux-x64/classic-level.musl.node +0 -0
  480. package/node_modules/classic-level/prebuilds/linux-x64/classic-level.node +0 -0
  481. package/node_modules/classic-level/prebuilds/win32-ia32/classic-level.node +0 -0
  482. package/node_modules/classic-level/prebuilds/win32-x64/classic-level.node +0 -0
  483. package/node_modules/ieee754/LICENSE +11 -0
  484. package/node_modules/ieee754/README.md +51 -0
  485. package/node_modules/ieee754/index.d.ts +10 -0
  486. package/node_modules/ieee754/index.js +85 -0
  487. package/node_modules/ieee754/package.json +52 -0
  488. package/node_modules/is-buffer/LICENSE +21 -0
  489. package/node_modules/is-buffer/README.md +54 -0
  490. package/node_modules/is-buffer/index.d.ts +2 -0
  491. package/node_modules/is-buffer/index.js +11 -0
  492. package/node_modules/is-buffer/package.json +65 -0
  493. package/node_modules/level/CHANGELOG.md +532 -0
  494. package/node_modules/level/LICENSE +21 -0
  495. package/node_modules/level/README.md +107 -0
  496. package/node_modules/level/UPGRADING.md +413 -0
  497. package/node_modules/level/browser.js +1 -0
  498. package/node_modules/level/index.d.ts +75 -0
  499. package/node_modules/level/index.js +1 -0
  500. package/node_modules/level/package.json +62 -0
  501. package/node_modules/level-supports/CHANGELOG.md +140 -0
  502. package/node_modules/level-supports/LICENSE +21 -0
  503. package/node_modules/level-supports/README.md +276 -0
  504. package/node_modules/level-supports/index.d.ts +137 -0
  505. package/node_modules/level-supports/index.js +26 -0
  506. package/node_modules/level-supports/package.json +46 -0
  507. package/node_modules/level-supports/test/cloneable.js +26 -0
  508. package/node_modules/level-supports/test/index.js +24 -0
  509. package/node_modules/level-supports/test/self.js +86 -0
  510. package/node_modules/level-supports/test/shape.js +23 -0
  511. package/node_modules/level-transcoder/CHANGELOG.md +15 -0
  512. package/node_modules/level-transcoder/LICENSE +21 -0
  513. package/node_modules/level-transcoder/README.md +214 -0
  514. package/node_modules/level-transcoder/UPGRADING.md +13 -0
  515. package/node_modules/level-transcoder/index.d.ts +27 -0
  516. package/node_modules/level-transcoder/index.js +158 -0
  517. package/node_modules/level-transcoder/lib/encoding.d.ts +158 -0
  518. package/node_modules/level-transcoder/lib/encoding.js +105 -0
  519. package/node_modules/level-transcoder/lib/encodings.d.ts +9 -0
  520. package/node_modules/level-transcoder/lib/encodings.js +135 -0
  521. package/node_modules/level-transcoder/lib/formats.d.ts +13 -0
  522. package/node_modules/level-transcoder/lib/formats.js +111 -0
  523. package/node_modules/level-transcoder/lib/text-endec.d.ts +6 -0
  524. package/node_modules/level-transcoder/lib/text-endec.js +19 -0
  525. package/node_modules/level-transcoder/package.json +46 -0
  526. package/node_modules/maybe-combine-errors/LICENSE.md +21 -0
  527. package/node_modules/maybe-combine-errors/README.md +94 -0
  528. package/node_modules/maybe-combine-errors/index.js +60 -0
  529. package/node_modules/maybe-combine-errors/package.json +33 -0
  530. package/node_modules/module-error/CHANGELOG.md +23 -0
  531. package/node_modules/module-error/LICENSE +21 -0
  532. package/node_modules/module-error/README.md +89 -0
  533. package/node_modules/module-error/index.d.ts +18 -0
  534. package/node_modules/module-error/index.js +22 -0
  535. package/node_modules/module-error/package.json +36 -0
  536. package/node_modules/napi-macros/LICENSE +21 -0
  537. package/node_modules/napi-macros/README.md +277 -0
  538. package/node_modules/napi-macros/index.js +1 -0
  539. package/node_modules/napi-macros/napi-macros.h +255 -0
  540. package/node_modules/napi-macros/package.json +22 -0
  541. package/node_modules/node-gyp-build/LICENSE +21 -0
  542. package/node_modules/node-gyp-build/README.md +58 -0
  543. package/node_modules/node-gyp-build/SECURITY.md +5 -0
  544. package/node_modules/node-gyp-build/bin.js +84 -0
  545. package/node_modules/node-gyp-build/build-test.js +19 -0
  546. package/node_modules/node-gyp-build/index.js +6 -0
  547. package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
  548. package/node_modules/node-gyp-build/optional.js +7 -0
  549. package/node_modules/node-gyp-build/package.json +43 -0
  550. package/oauthTokenStore-PADKLNOC.js +23 -0
  551. package/package.json +6 -3
  552. package/processSpawn-SOAV3FEV.js +11 -0
  553. package/profileConfig-ZGOFORWV.js +43 -0
  554. package/{providerPresetApply-XI3WUPTI.js → providerPresetApply-HIPK67DU.js} +9 -9
  555. package/{providerRegistry-KEPWWGXD.js → providerRegistry-AI4U2FNM.js} +13 -9
  556. package/{read-COE3ZYR6.js → read-RNUQ7F34.js} +11 -7
  557. package/{readDocTool-5USN4A6V.js → readDocTool-6WIZHE6O.js} +5 -3
  558. package/{readlineWorkspace-KIMUDPPV.js → readlineWorkspace-BCDVMOR5.js} +6947 -3879
  559. package/{removeDialogAgentAction-J6X5QMTA.js → removeDialogAgentAction-EFQ4O2IQ.js} +27 -26
  560. package/{runAgentClientLoop-AN4WIRPQ.js → runAgentClientLoop-5RBD3DE6.js} +150 -90
  561. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-5CIWJEZ3.js} +36 -8
  562. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  563. package/setDialogExtraReferencesAction-MXAH2KPV.js +37 -0
  564. package/{setPrimaryDialogAgentAction-FN22THHT.js → setPrimaryDialogAgentAction-7OPVNK4M.js} +28 -27
  565. package/{chunk-GP5LKBUZ.js → settingThunks-GHVLHABJ.js} +240 -945
  566. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-QC35EQY4.js} +3 -3
  567. package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
  568. package/{spaceCommands-NA4JMIGT.js → spaceCommands-WZCLRGBO.js} +56 -56
  569. package/{streamAgentChatTurn-3TYTHZPJ.js → streamAgentChatTurn-YJTEHUH7.js} +371 -1556
  570. package/{switchDialogAgentAction-LVTEV3FR.js → switchDialogAgentAction-4PANDG3L.js} +24 -20
  571. package/{tableCommands-O6NWHFKV.js → tableCommands-U3QDY4L6.js} +19 -17
  572. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-54CXTU7C.js} +5 -4
  573. package/tools-ZT4GXXDQ.js +122 -0
  574. package/{tuiSummaryLlmCaller-UFGFOIIW.js → tuiSummaryLlmCaller-ISODIW2O.js} +14 -29
  575. package/{updateCommands-2M74UL7P.js → updateCommands-NQXAGFM7.js} +3 -3
  576. package/{updateDialogTitleAction-RDHNT265.js → updateDialogTitleAction-2PQTFUUV.js} +101 -57
  577. package/action-P4TNFGAD.js +0 -31
  578. package/agentListCommands-NXCOTTZL.js +0 -411
  579. package/agentRecordCommands-JP54ZWND.js +0 -129
  580. package/agentRunCommand-RMQWWSHF.js +0 -157
  581. package/browser-image-compression-MFDTD7K6.js +0 -1763
  582. package/chatQueueReduxAdapter-DKLWTT3G.js +0 -186
  583. package/chunk-ACTMNVHM.js +0 -93
  584. package/chunk-CQ3WA2NE.js +0 -299
  585. package/chunk-M76ECQRD.js +0 -13658
  586. package/chunk-MEYIRKDN.js +0 -8967
  587. package/chunk-N4G4PKQ6.js +0 -23
  588. package/chunk-P3GYTNDF.js +0 -34
  589. package/chunk-PUOC4YRO.js +0 -394
  590. package/chunk-S7Z2HMCN.js +0 -25
  591. package/chunk-Y5GCAMGP.js +0 -9
  592. package/chunk-YPREESF4.js +0 -225
  593. package/chunk-YWIEQS6H.js +0 -21409
  594. package/contentThunks-JHK6X2KU.js +0 -73
  595. package/createDialogAction-VUUUZL54.js +0 -65
  596. package/dialogCommands-EN7TYD3I.js +0 -100
  597. package/handleSendMessageAction-ID5IKXUE.js +0 -633
  598. package/machineWsRunDispatch-RX64L3ET.js +0 -145
  599. package/setDialogExtraReferencesAction-WX5VTY6O.js +0 -30
  600. package/settingSlice-P4ZW7K5X.js +0 -204
  601. package/syncMapping-N6RGXGBW.js +0 -437
  602. package/tools-34SEJSLQ.js +0 -110
  603. package/{chunk-SV5IJK6K.js → chunk-NBTY7YJF.js} +3 -3
  604. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  605. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
  606. package/{offlineMarxistsAgentCommand-HGXZV4XJ.js → offlineMarxistsAgentCommand-2QTHJCHV.js} +4 -4
@@ -0,0 +1,1147 @@
1
+ import {
2
+ getModelContextWindow
3
+ } from "./chunk-FWY6BHIJ.js";
4
+ import {
5
+ isRecord
6
+ } from "./chunk-KUG52IAP.js";
7
+ import {
8
+ asOptionalTrimmedString
9
+ } from "./chunk-G3SUCT4W.js";
10
+ import {
11
+ PLATFORM_HOSTED_KIMI_K3_MODEL,
12
+ isFireworksKimiModel,
13
+ isNoloHostedProvider
14
+ } from "./chunk-SZC4REES.js";
15
+ import {
16
+ asTrimmedLowercaseString
17
+ } from "./chunk-QSJ3HFEF.js";
18
+
19
+ // packages/integrations/openai/responsesHelpers.ts
20
+ var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
21
+ var sanitizeResponsesParameters = (parameters) => {
22
+ if (!isRecord(parameters)) {
23
+ return parameters;
24
+ }
25
+ const next = { ...parameters };
26
+ for (const key of RESPONSES_TOP_LEVEL_SCHEMA_KEYS) {
27
+ delete next[key];
28
+ }
29
+ return next;
30
+ };
31
+ var appendTextPart = (parts, text, role) => {
32
+ if (!text) return;
33
+ const last = parts.at(-1);
34
+ const textType = role === "assistant" ? "output_text" : "input_text";
35
+ if (last?.type === textType) {
36
+ last.text += text;
37
+ return;
38
+ }
39
+ parts.push({ type: textType, text });
40
+ };
41
+ var normalizeMessageParts = (content, role) => {
42
+ if (typeof content === "string") {
43
+ if (!content) return [];
44
+ return [
45
+ {
46
+ type: role === "assistant" ? "output_text" : "input_text",
47
+ text: content
48
+ }
49
+ ];
50
+ }
51
+ const parts = [];
52
+ for (const part of content ?? []) {
53
+ const typedPart = part;
54
+ if (typedPart?.type === "text" && typeof typedPart.text === "string") {
55
+ appendTextPart(parts, typedPart.text, role);
56
+ continue;
57
+ }
58
+ if (typedPart?.type === "image_url" && typeof typedPart.image_url?.url === "string" && typedPart.image_url.url) {
59
+ if (role === "assistant") continue;
60
+ parts.push({
61
+ type: "input_image",
62
+ image_url: typedPart.image_url.url,
63
+ detail: typedPart.image_url.detail
64
+ });
65
+ }
66
+ }
67
+ return parts;
68
+ };
69
+ var normalizeToolOutput = (content) => {
70
+ if (typeof content === "string") return content;
71
+ return JSON.stringify(content ?? "");
72
+ };
73
+ var toResponsesTools = (tools) => {
74
+ if (!Array.isArray(tools) || tools.length === 0) return void 0;
75
+ const normalized = tools.map((tool) => {
76
+ const fn = tool?.function;
77
+ const name = fn?.name ?? tool?.name;
78
+ if (!name) return null;
79
+ const parameters = fn?.parameters ?? tool?.parameters;
80
+ return {
81
+ type: "function",
82
+ name,
83
+ ...typeof (fn?.description ?? tool?.description) === "string" ? { description: fn?.description ?? tool?.description } : {},
84
+ parameters: sanitizeResponsesParameters(parameters),
85
+ ...fn?.strict !== void 0 || tool?.strict !== void 0 ? { strict: fn?.strict ?? tool?.strict } : {}
86
+ };
87
+ }).filter(Boolean);
88
+ return normalized.length > 0 ? normalized : void 0;
89
+ };
90
+ var convertMessagesToResponsesInput = (messages, options) => {
91
+ const input = [];
92
+ for (const message of messages) {
93
+ if (!message?.role) continue;
94
+ if (message.role === "tool") {
95
+ if (!message.tool_call_id) continue;
96
+ input.push({
97
+ type: "function_call_output",
98
+ call_id: message.tool_call_id,
99
+ output: normalizeToolOutput(message.content)
100
+ });
101
+ continue;
102
+ }
103
+ const role = message.role;
104
+ if (role === "assistant" && !options?.stripReasoningContent && typeof message.reasoning_content === "string" && message.reasoning_content) {
105
+ input.push({
106
+ type: "reasoning",
107
+ content: [
108
+ { type: "reasoning_text", text: message.reasoning_content }
109
+ ]
110
+ });
111
+ }
112
+ const contentParts = normalizeMessageParts(message.content, role);
113
+ if (contentParts.length > 0) {
114
+ input.push({
115
+ type: "message",
116
+ role,
117
+ content: contentParts
118
+ });
119
+ }
120
+ if (role === "assistant" && Array.isArray(message.content)) {
121
+ const replayImages = message.content.map((part) => part).filter(
122
+ (part) => part?.type === "image_url" && typeof part.image_url?.url === "string" && Boolean(part.image_url.url)
123
+ ).map((part) => ({
124
+ type: "input_image",
125
+ image_url: part.image_url.url,
126
+ detail: part.image_url.detail
127
+ }));
128
+ if (replayImages.length > 0) {
129
+ input.push({
130
+ type: "message",
131
+ role: "user",
132
+ content: replayImages
133
+ });
134
+ }
135
+ }
136
+ if (role === "assistant" && Array.isArray(message.tool_calls)) {
137
+ for (const toolCall of message.tool_calls) {
138
+ if (!toolCall?.id || !toolCall.function?.name) continue;
139
+ input.push({
140
+ type: "function_call",
141
+ call_id: toolCall.id,
142
+ name: toolCall.function.name,
143
+ arguments: typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments ?? {})
144
+ });
145
+ }
146
+ }
147
+ }
148
+ return input;
149
+ };
150
+ var extractTextFromResponseOutput = (response) => {
151
+ const parts = [];
152
+ for (const item of response?.output ?? []) {
153
+ if (item?.type !== "message") continue;
154
+ for (const content of item.content ?? []) {
155
+ if (content?.type === "output_text" && typeof content.text === "string") {
156
+ parts.push(content.text);
157
+ }
158
+ }
159
+ }
160
+ return parts.join("");
161
+ };
162
+ var extractReasoningFromResponseOutput = (response) => {
163
+ const parts = [];
164
+ for (const item of response?.output ?? []) {
165
+ if (item?.type !== "reasoning") continue;
166
+ if (typeof item.content === "string") {
167
+ parts.push(item.content);
168
+ continue;
169
+ }
170
+ for (const content of item.content ?? []) {
171
+ if (typeof content === "string") parts.push(content);
172
+ else if (typeof content?.text === "string") parts.push(content.text);
173
+ }
174
+ }
175
+ return parts.join("");
176
+ };
177
+ var toDataUrl = (base64Data, mimeType) => {
178
+ const normalizedMimeType = asOptionalTrimmedString(mimeType) ?? "image/png";
179
+ return `data:${normalizedMimeType};base64,${base64Data}`;
180
+ };
181
+ var extractImagePartsFromResponseOutput = (response) => {
182
+ const images = [];
183
+ for (const item of response?.output ?? []) {
184
+ if (item?.type === "image_generation_call") {
185
+ const result = asOptionalTrimmedString(item.result);
186
+ if (result) {
187
+ const outputFormat = asOptionalTrimmedString(item.output_format);
188
+ images.push({
189
+ type: "image_url",
190
+ image_url: {
191
+ url: toDataUrl(
192
+ result,
193
+ outputFormat ? `image/${outputFormat}` : void 0
194
+ )
195
+ }
196
+ });
197
+ }
198
+ continue;
199
+ }
200
+ if (item?.type !== "message") continue;
201
+ for (const content of item.content ?? []) {
202
+ const result = asOptionalTrimmedString(content?.result);
203
+ if (content?.type === "output_image" && result) {
204
+ images.push({
205
+ type: "image_url",
206
+ image_url: {
207
+ url: toDataUrl(
208
+ result,
209
+ content.mime_type ?? content.mimeType ?? null
210
+ )
211
+ }
212
+ });
213
+ }
214
+ }
215
+ }
216
+ return images;
217
+ };
218
+ var extractToolCallsFromResponseOutput = (response) => {
219
+ const calls = [];
220
+ for (const item of response?.output ?? []) {
221
+ if (item?.type !== "function_call") continue;
222
+ if (!item.call_id || !item.name) continue;
223
+ calls.push({
224
+ id: item.call_id,
225
+ type: "function",
226
+ function: {
227
+ name: item.name,
228
+ arguments: typeof item.arguments === "string" ? item.arguments : JSON.stringify(item.arguments ?? {})
229
+ }
230
+ });
231
+ }
232
+ return calls;
233
+ };
234
+
235
+ // packages/agent-runtime/declaredToolNames.ts
236
+ function extractDeclaredToolNames(tools) {
237
+ if (!Array.isArray(tools)) return void 0;
238
+ const names = /* @__PURE__ */ new Set();
239
+ for (const t of tools) {
240
+ const fn = t?.function;
241
+ if (fn && typeof fn.name === "string" && fn.name) names.add(fn.name);
242
+ }
243
+ return names;
244
+ }
245
+
246
+ // packages/agent-runtime/toolArgsShape.ts
247
+ function scanRawToolArgs(input) {
248
+ const stack = [];
249
+ const commaAtDepth = [];
250
+ let inString = false;
251
+ let escaped = false;
252
+ const closersOf2 = () => stack.slice().reverse().map((ch) => ch === "{" ? "}" : "]").join("");
253
+ for (let i = 0; i < input.length; i += 1) {
254
+ const ch = input[i];
255
+ if (inString) {
256
+ if (escaped) escaped = false;
257
+ else if (ch === "\\") escaped = true;
258
+ else if (ch === '"') inString = false;
259
+ continue;
260
+ }
261
+ if (ch === '"') {
262
+ inString = true;
263
+ } else if (ch === "{" || ch === "[") {
264
+ stack.push(ch);
265
+ commaAtDepth[stack.length] = void 0;
266
+ } else if (ch === "}" || ch === "]") {
267
+ const open = stack.pop();
268
+ if (open !== (ch === "}" ? "{" : "[")) {
269
+ return {
270
+ inString,
271
+ mismatched: true,
272
+ unclosed: false,
273
+ // 结构已坏:与迁移前一致,不再给出尾部数组逗号坐标。
274
+ tailArrayComma: null
275
+ };
276
+ }
277
+ commaAtDepth[stack.length + 1] = void 0;
278
+ } else if (ch === "," && stack[stack.length - 1] === "[") {
279
+ commaAtDepth[stack.length] = { index: i, closers: closersOf2() };
280
+ }
281
+ }
282
+ let tailArrayComma = null;
283
+ for (let d = stack.length; d >= 1; d -= 1) {
284
+ const c = commaAtDepth[d];
285
+ if (c && stack[d - 1] === "[") {
286
+ tailArrayComma = c;
287
+ break;
288
+ }
289
+ }
290
+ return {
291
+ inString,
292
+ mismatched: false,
293
+ unclosed: stack.length > 0,
294
+ tailArrayComma
295
+ };
296
+ }
297
+ function scanTruncation(input) {
298
+ const scan = scanRawToolArgs(input);
299
+ return {
300
+ inString: scan.inString,
301
+ malformed: scan.mismatched,
302
+ tailArrayComma: scan.tailArrayComma
303
+ };
304
+ }
305
+ function classifyUnparsableToolArgs(raw) {
306
+ if (typeof raw !== "string") return "malformed";
307
+ const scan = scanRawToolArgs(raw);
308
+ if (scan.inString) return "truncated";
309
+ return scan.mismatched || scan.unclosed ? "truncated" : "malformed";
310
+ }
311
+
312
+ // packages/agent-runtime/outboundHistorySanitize.ts
313
+ var DOWNGRADED_TOOL_TURN_ORIGIN = Symbol(
314
+ "nolo.downgradedToolTurnOrigin"
315
+ );
316
+ function markDowngradedToolTurnOrigin(message) {
317
+ Object.defineProperty(message, DOWNGRADED_TOOL_TURN_ORIGIN, {
318
+ value: true,
319
+ enumerable: false,
320
+ writable: false,
321
+ configurable: true
322
+ });
323
+ return message;
324
+ }
325
+ function transferDowngradedToolTurnOrigin(source, rebuilt) {
326
+ if (hasDowngradedToolTurnOrigin(source)) markDowngradedToolTurnOrigin(rebuilt);
327
+ return rebuilt;
328
+ }
329
+ function hasDowngradedToolTurnOrigin(message) {
330
+ return typeof message === "object" && message !== null && message[DOWNGRADED_TOOL_TURN_ORIGIN] === true;
331
+ }
332
+ function emptyToolArgsProjectionStats() {
333
+ return {
334
+ badArguments: { truncated: 0, malformed: 0 },
335
+ rewrittenToolCalls: 0,
336
+ rewrittenAssistantMessages: 0,
337
+ rewrittenToolMessages: 0
338
+ };
339
+ }
340
+ function sanitizeForOutbound(messages, tools) {
341
+ return sanitizeOutboundHistory(messages, {
342
+ declaredToolNames: extractDeclaredToolNames(tools)
343
+ });
344
+ }
345
+ function stableToolCallId(assistantIndex, callIndex) {
346
+ return `call_sanitize_${assistantIndex}_${callIndex}`;
347
+ }
348
+ function isString(v) {
349
+ return typeof v === "string";
350
+ }
351
+ function isNonEmptyString(v) {
352
+ return typeof v === "string" && v.length > 0;
353
+ }
354
+ function joinLines(...parts) {
355
+ return parts.filter(isNonEmptyString).join("\n");
356
+ }
357
+ function jsonStringifyArguments(args) {
358
+ if (typeof args === "string") return args;
359
+ try {
360
+ return JSON.stringify(args ?? "");
361
+ } catch {
362
+ return "";
363
+ }
364
+ }
365
+ function renderToolCallAsText(call) {
366
+ const c = call && typeof call === "object" ? call : {};
367
+ const name = isString(c.function?.name) && c.function.name.length > 0 ? c.function.name : "unknown";
368
+ const rawArgs = c.function?.arguments;
369
+ const args = jsonStringifyArguments(rawArgs);
370
+ return `[tool_call: ${name}(${args})]`;
371
+ }
372
+ function renderToolResultAsText(message) {
373
+ const name = isNonEmptyString(message.toolName) ? message.toolName : "tool";
374
+ const body = typeof message.content === "string" ? message.content : "";
375
+ return `[tool_result: ${name}: ${body}]`;
376
+ }
377
+ function normalizeToolCall(call, assistantIndex, callIndex) {
378
+ if (!call || typeof call !== "object") return null;
379
+ const c = call;
380
+ const fn = c.function;
381
+ if (!fn || typeof fn !== "object" || !isString(fn.name) || fn.name.length === 0) return null;
382
+ const id = isNonEmptyString(c.id) ? c.id : stableToolCallId(assistantIndex, callIndex);
383
+ return {
384
+ id,
385
+ type: isString(c.type) && c.type ? c.type : "function",
386
+ function: { name: fn.name, arguments: jsonStringifyArguments(fn.arguments) },
387
+ ...typeof c.extra_content?.google?.thought_signature === "string" ? { extra_content: { google: { thought_signature: c.extra_content.google.thought_signature } } } : {},
388
+ ...typeof c.thought_signature === "string" ? { thought_signature: c.thought_signature } : {}
389
+ };
390
+ }
391
+ function classifyAssistantCalls(toolCalls, assistantIndex) {
392
+ const callIds = [];
393
+ const idCounts = /* @__PURE__ */ new Map();
394
+ const unparsableIndices = /* @__PURE__ */ new Set();
395
+ const unparsableIds = /* @__PURE__ */ new Set();
396
+ toolCalls.forEach((rawCall, callIndex) => {
397
+ const c = rawCall && typeof rawCall === "object" ? rawCall : {};
398
+ const id = isNonEmptyString(c.id) ? c.id : stableToolCallId(assistantIndex, callIndex);
399
+ callIds.push(id);
400
+ idCounts.set(id, (idCounts.get(id) ?? 0) + 1);
401
+ if (!hasParsableObjectArguments(c.function?.arguments)) {
402
+ unparsableIndices.add(callIndex);
403
+ unparsableIds.add(id);
404
+ }
405
+ });
406
+ const duplicateIds = /* @__PURE__ */ new Set();
407
+ for (const [id, count] of idCounts) {
408
+ if (count > 1) duplicateIds.add(id);
409
+ }
410
+ return { callIds, duplicateIds, unparsableIndices, unparsableIds };
411
+ }
412
+ function sanitizeOutboundHistory(messages, options) {
413
+ if (!Array.isArray(messages) || messages.length === 0) return messages;
414
+ const declared = options?.declaredToolNames;
415
+ const keptCallIndicesPerAssistant = /* @__PURE__ */ new Map();
416
+ const keptToolIndices = /* @__PURE__ */ new Set();
417
+ let i = 0;
418
+ while (i < messages.length) {
419
+ const m = messages[i];
420
+ if (m.role === "assistant" && Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {
421
+ const asstIdx = i;
422
+ const { callIds, duplicateIds, unparsableIndices } = classifyAssistantCalls(m.tool_calls, asstIdx);
423
+ const candidateCallMap = /* @__PURE__ */ new Map();
424
+ m.tool_calls.forEach((call, callIndex) => {
425
+ const id = callIds[callIndex];
426
+ if (duplicateIds.has(id)) return;
427
+ if (unparsableIndices.has(callIndex)) return;
428
+ const name = call?.function?.name;
429
+ if (!isString(name) || name.length === 0) return;
430
+ const declaredAllows = !declared || declared.has(name);
431
+ if (!declaredAllows) return;
432
+ candidateCallMap.set(id, callIndex);
433
+ });
434
+ let j = i + 1;
435
+ const matchedCallIndices = /* @__PURE__ */ new Set();
436
+ const matchedToolIds = /* @__PURE__ */ new Set();
437
+ while (j < messages.length && messages[j].role === "tool") {
438
+ const toolMsg = messages[j];
439
+ const toolCallId = isNonEmptyString(toolMsg.tool_call_id) ? toolMsg.tool_call_id : "";
440
+ if (toolCallId && candidateCallMap.has(toolCallId) && !matchedToolIds.has(toolCallId)) {
441
+ matchedToolIds.add(toolCallId);
442
+ matchedCallIndices.add(candidateCallMap.get(toolCallId));
443
+ keptToolIndices.add(j);
444
+ }
445
+ j++;
446
+ }
447
+ keptCallIndicesPerAssistant.set(asstIdx, matchedCallIndices);
448
+ i = j;
449
+ } else {
450
+ i++;
451
+ }
452
+ }
453
+ const out = [];
454
+ let k = 0;
455
+ while (k < messages.length) {
456
+ const m = messages[k];
457
+ if (m.role === "assistant" && Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {
458
+ const asstIdx = k;
459
+ const keptIndices = keptCallIndicesPerAssistant.get(asstIdx) ?? /* @__PURE__ */ new Set();
460
+ const keptToolCalls = [];
461
+ const downgradedCallLines = [];
462
+ m.tool_calls.forEach((call, callIndex) => {
463
+ const name = call?.function?.name;
464
+ const declaredAllows = !declared || isString(name) && declared.has(name);
465
+ const keep = keptIndices.has(callIndex) && declaredAllows && hasParsableObjectArguments(call?.function?.arguments);
466
+ if (keep) {
467
+ const normalized = normalizeToolCall(call, asstIdx, callIndex);
468
+ if (normalized) {
469
+ keptToolCalls.push(normalized);
470
+ } else {
471
+ downgradedCallLines.push(renderToolCallAsText(call));
472
+ }
473
+ } else {
474
+ downgradedCallLines.push(renderToolCallAsText(call));
475
+ }
476
+ });
477
+ if (keptToolCalls.length === 0) {
478
+ const downgradedText = joinLines(...downgradedCallLines);
479
+ const contentWithDowngrade = downgradedText.length > 0 ? combineContentWithText(m.content, downgradedText) : m.content;
480
+ const sanitizedAssistant2 = transferDowngradedToolTurnOrigin(m, {
481
+ ...m,
482
+ content: contentWithDowngrade
483
+ });
484
+ delete sanitizedAssistant2.tool_calls;
485
+ markDowngradedToolTurnOrigin(sanitizedAssistant2);
486
+ out.push(sanitizedAssistant2);
487
+ let nextIdx2 = k + 1;
488
+ while (nextIdx2 < messages.length && messages[nextIdx2].role === "tool") {
489
+ const downgradedToolMsg = messages[nextIdx2];
490
+ out.push(
491
+ transferDowngradedToolTurnOrigin(downgradedToolMsg, {
492
+ role: "assistant",
493
+ content: renderToolResultAsText(downgradedToolMsg)
494
+ })
495
+ );
496
+ nextIdx2++;
497
+ }
498
+ k = nextIdx2;
499
+ continue;
500
+ }
501
+ const sanitizedAssistant = transferDowngradedToolTurnOrigin(m, {
502
+ ...m,
503
+ tool_calls: keptToolCalls
504
+ });
505
+ out.push(sanitizedAssistant);
506
+ let nextIdx = k + 1;
507
+ const deferredResultLines = [];
508
+ while (nextIdx < messages.length && messages[nextIdx].role === "tool") {
509
+ if (keptToolIndices.has(nextIdx)) {
510
+ const toolMsg = messages[nextIdx];
511
+ out.push({
512
+ ...toolMsg,
513
+ content: toolMsg.content ?? "",
514
+ tool_call_id: toolMsg.tool_call_id
515
+ });
516
+ } else {
517
+ deferredResultLines.push(renderToolResultAsText(messages[nextIdx]));
518
+ }
519
+ nextIdx++;
520
+ }
521
+ const deferredLines = [...downgradedCallLines, ...deferredResultLines];
522
+ if (deferredLines.length > 0) {
523
+ out.push({
524
+ role: "assistant",
525
+ content: joinLines(...deferredLines)
526
+ });
527
+ }
528
+ k = nextIdx;
529
+ continue;
530
+ }
531
+ if (m.role === "tool") {
532
+ out.push(
533
+ transferDowngradedToolTurnOrigin(m, {
534
+ role: "assistant",
535
+ content: renderToolResultAsText(m)
536
+ })
537
+ );
538
+ k++;
539
+ continue;
540
+ }
541
+ out.push(transferDowngradedToolTurnOrigin(m, { ...m }));
542
+ k++;
543
+ }
544
+ return out;
545
+ }
546
+ function combineContentWithText(base, extra) {
547
+ if (typeof base === "string") {
548
+ return base ? `${base}
549
+ ${extra}` : extra;
550
+ }
551
+ if (Array.isArray(base)) {
552
+ return [...base, { type: "text", text: extra }];
553
+ }
554
+ return extra;
555
+ }
556
+ function hasParsableObjectArguments(raw) {
557
+ if (raw === void 0) return true;
558
+ if (raw === null || typeof raw === "number" || typeof raw === "boolean") {
559
+ return false;
560
+ }
561
+ if (typeof raw !== "string") return true;
562
+ if (raw.trim() === "") return true;
563
+ try {
564
+ const parsed = JSON.parse(raw);
565
+ return parsed !== null && typeof parsed === "object";
566
+ } catch {
567
+ return false;
568
+ }
569
+ }
570
+ var STRICT_JSON_STRING_TOKEN = /^"(?:[^"\\\u0000-\u001F]|\\["\\/bfnrt]|\\u[0-9A-Fa-f]{4})*"$/;
571
+ function isStrictJsonStringToken(value) {
572
+ if (!STRICT_JSON_STRING_TOKEN.test(value)) return false;
573
+ try {
574
+ return typeof JSON.parse(value) === "string";
575
+ } catch {
576
+ return false;
577
+ }
578
+ }
579
+ function closersOf(openStack) {
580
+ return openStack.slice().reverse().map((ch) => ch === "{" ? "}" : "]").join("");
581
+ }
582
+ function scanJsonForTailRepair(input) {
583
+ const stack = [];
584
+ let inString = false;
585
+ let escaped = false;
586
+ let lastCommaOutsideString = null;
587
+ for (let i = 0; i < input.length; i += 1) {
588
+ const ch = input[i];
589
+ if (inString) {
590
+ if (escaped) escaped = false;
591
+ else if (ch === "\\") escaped = true;
592
+ else if (ch === '"') inString = false;
593
+ continue;
594
+ }
595
+ if (ch === '"') {
596
+ inString = true;
597
+ continue;
598
+ }
599
+ if (ch === "{" || ch === "[") {
600
+ stack.push(ch);
601
+ continue;
602
+ }
603
+ if (ch === "}" || ch === "]") {
604
+ const open = stack.pop();
605
+ if (open !== (ch === "}" ? "{" : "[")) return null;
606
+ continue;
607
+ }
608
+ if (ch === ",") {
609
+ lastCommaOutsideString = { index: i, closers: closersOf(stack) };
610
+ continue;
611
+ }
612
+ }
613
+ return { inString, closers: closersOf(stack), lastCommaOutsideString };
614
+ }
615
+ function repairTruncatedToolArguments(raw) {
616
+ if (typeof raw !== "string") return null;
617
+ const withoutTrailingSpace = raw.replace(/\s+$/, "");
618
+ const endsWithComma = withoutTrailingSpace.endsWith(",");
619
+ const trimmed = endsWithComma ? withoutTrailingSpace.slice(0, -1).replace(/\s+$/, "") : withoutTrailingSpace;
620
+ if (trimmed === "" || trimmed.endsWith(",")) return null;
621
+ const scan = scanJsonForTailRepair(trimmed);
622
+ if (!scan || scan.inString) return null;
623
+ const lastChar = trimmed[trimmed.length - 1];
624
+ const tailIsCompleteToken = endsWithComma || lastChar === '"' || lastChar === "}" || lastChar === "]";
625
+ if (!tailIsCompleteToken) return null;
626
+ const candidates = [trimmed + scan.closers];
627
+ const lastComma = scan.lastCommaOutsideString;
628
+ if (lastComma && lastComma.index > 0) {
629
+ const tailAfterComma = trimmed.slice(lastComma.index + 1).trim();
630
+ if (isStrictJsonStringToken(tailAfterComma)) {
631
+ const head = trimmed.slice(0, lastComma.index);
632
+ candidates.push(head + lastComma.closers);
633
+ }
634
+ }
635
+ for (const candidate of candidates) {
636
+ try {
637
+ const parsed = JSON.parse(candidate);
638
+ if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) && Object.keys(parsed).length > 0) {
639
+ return candidate;
640
+ }
641
+ } catch {
642
+ }
643
+ }
644
+ return null;
645
+ }
646
+ function downgradeUnparsableToolCalls(messages) {
647
+ if (!Array.isArray(messages) || messages.length === 0) {
648
+ return { messages, downgraded: 0, stats: emptyToolArgsProjectionStats() };
649
+ }
650
+ let hasAnyPoison = false;
651
+ for (const m of messages) {
652
+ if (m.role === "assistant" && Array.isArray(m.tool_calls)) {
653
+ for (const call of m.tool_calls) {
654
+ if (!hasParsableObjectArguments(call?.function?.arguments)) {
655
+ hasAnyPoison = true;
656
+ break;
657
+ }
658
+ }
659
+ }
660
+ if (hasAnyPoison) break;
661
+ }
662
+ if (!hasAnyPoison) return { messages, downgraded: 0, stats: emptyToolArgsProjectionStats() };
663
+ const poisonedCallsPerAssistant = /* @__PURE__ */ new Map();
664
+ const poisonedToolIndices = /* @__PURE__ */ new Set();
665
+ const badArguments = {
666
+ truncated: 0,
667
+ malformed: 0
668
+ };
669
+ let i = 0;
670
+ while (i < messages.length) {
671
+ const m = messages[i];
672
+ if (m.role === "assistant" && Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {
673
+ const asstIdx = i;
674
+ const { unparsableIds, unparsableIndices } = classifyAssistantCalls(m.tool_calls, asstIdx);
675
+ for (const badIndex of unparsableIndices) {
676
+ const badCall = m.tool_calls[badIndex];
677
+ badArguments[classifyUnparsableToolArgs(badCall?.function?.arguments)] += 1;
678
+ }
679
+ let j = i + 1;
680
+ while (j < messages.length && messages[j].role === "tool") {
681
+ const toolMsg = messages[j];
682
+ const toolCallId = isNonEmptyString(toolMsg.tool_call_id) ? toolMsg.tool_call_id : "";
683
+ if (toolCallId && unparsableIds.has(toolCallId)) {
684
+ poisonedToolIndices.add(j);
685
+ }
686
+ j++;
687
+ }
688
+ if (unparsableIds.size > 0) {
689
+ poisonedCallsPerAssistant.set(asstIdx, unparsableIds);
690
+ }
691
+ i = j;
692
+ } else {
693
+ i++;
694
+ }
695
+ }
696
+ let downgraded = 0;
697
+ let rewrittenAssistantMessages = 0;
698
+ let rewrittenToolMessages = 0;
699
+ const out = [];
700
+ let k = 0;
701
+ while (k < messages.length) {
702
+ const m = messages[k];
703
+ if (m.role === "assistant" && Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {
704
+ const badIds = poisonedCallsPerAssistant.get(k);
705
+ if (!badIds || badIds.size === 0) {
706
+ out.push(m);
707
+ k++;
708
+ continue;
709
+ }
710
+ const kept = [];
711
+ const lines = [];
712
+ const { callIds } = classifyAssistantCalls(m.tool_calls, k);
713
+ rewrittenAssistantMessages += 1;
714
+ m.tool_calls.forEach((call, callIndex) => {
715
+ const id = callIds[callIndex];
716
+ if (badIds.has(id)) {
717
+ lines.push(renderToolCallAsText(call));
718
+ downgraded++;
719
+ } else {
720
+ kept.push(call);
721
+ }
722
+ });
723
+ if (kept.length === 0) {
724
+ const sanitized2 = transferDowngradedToolTurnOrigin(m, {
725
+ ...m,
726
+ content: combineContentWithText(m.content, joinLines(...lines))
727
+ });
728
+ delete sanitized2.tool_calls;
729
+ markDowngradedToolTurnOrigin(sanitized2);
730
+ out.push(sanitized2);
731
+ let nextIdx2 = k + 1;
732
+ while (nextIdx2 < messages.length && messages[nextIdx2].role === "tool") {
733
+ if (poisonedToolIndices.has(nextIdx2)) {
734
+ const poisonedToolMsg = messages[nextIdx2];
735
+ out.push(
736
+ transferDowngradedToolTurnOrigin(poisonedToolMsg, {
737
+ role: "assistant",
738
+ content: renderToolResultAsText(poisonedToolMsg)
739
+ })
740
+ );
741
+ rewrittenToolMessages += 1;
742
+ } else {
743
+ out.push(messages[nextIdx2]);
744
+ }
745
+ nextIdx2++;
746
+ }
747
+ k = nextIdx2;
748
+ continue;
749
+ }
750
+ const sanitized = transferDowngradedToolTurnOrigin(m, {
751
+ ...m,
752
+ content: lines.length > 0 ? combineContentWithText(m.content, joinLines(...lines)) : m.content,
753
+ tool_calls: kept
754
+ });
755
+ out.push(sanitized);
756
+ let nextIdx = k + 1;
757
+ const deferredResultLines = [];
758
+ while (nextIdx < messages.length && messages[nextIdx].role === "tool") {
759
+ if (poisonedToolIndices.has(nextIdx)) {
760
+ deferredResultLines.push(renderToolResultAsText(messages[nextIdx]));
761
+ rewrittenToolMessages += 1;
762
+ } else {
763
+ out.push(messages[nextIdx]);
764
+ }
765
+ nextIdx++;
766
+ }
767
+ if (deferredResultLines.length > 0) {
768
+ out.push({
769
+ role: "assistant",
770
+ content: joinLines(...deferredResultLines)
771
+ });
772
+ }
773
+ k = nextIdx;
774
+ continue;
775
+ }
776
+ if (m.role === "tool") {
777
+ if (poisonedToolIndices.has(k)) {
778
+ out.push(
779
+ transferDowngradedToolTurnOrigin(m, {
780
+ role: "assistant",
781
+ content: renderToolResultAsText(m)
782
+ })
783
+ );
784
+ rewrittenToolMessages += 1;
785
+ } else {
786
+ out.push(m);
787
+ }
788
+ k++;
789
+ continue;
790
+ }
791
+ out.push(m);
792
+ k++;
793
+ }
794
+ return {
795
+ messages: out,
796
+ downgraded,
797
+ stats: {
798
+ badArguments,
799
+ // 投影改写数与坏参数数是两套口径:rewrittenToolCalls 含同 ID 连带降级的
800
+ // 调用,二者允许不相等(同 ID 一坏一好 → 坏参数 1、改写调用 2)。
801
+ rewrittenToolCalls: downgraded,
802
+ rewrittenAssistantMessages,
803
+ rewrittenToolMessages
804
+ }
805
+ };
806
+ }
807
+
808
+ // packages/core/ollamaEndpoint.ts
809
+ function isOllamaEndpoint(endpoint) {
810
+ if (!endpoint || typeof endpoint !== "string") return false;
811
+ try {
812
+ const url = new URL(endpoint.includes("://") ? endpoint : `http://${endpoint}`);
813
+ if (url.port === "11434") return true;
814
+ const host = url.hostname.toLowerCase();
815
+ return host === "ollama.com" || host.endsWith(".ollama.com") || host === "ollama.ai" || host.endsWith(".ollama.ai");
816
+ } catch {
817
+ return false;
818
+ }
819
+ }
820
+
821
+ // packages/ai/llm/usageRequestOptions.ts
822
+ var STREAM_USAGE_PROVIDERS = /* @__PURE__ */ new Set([
823
+ "google",
824
+ "openrouter",
825
+ "xai",
826
+ "openai",
827
+ "fireworks",
828
+ "mistral",
829
+ "cloudflare",
830
+ "gmi",
831
+ // OpenAI-compatible hosted providers expose the terminal usage chunk when
832
+ // requested, including DeepInfra and Vultr. Keep this capability decision
833
+ // in the shared seam so proxy and local runtimes cannot drift.
834
+ "deepinfra",
835
+ "vultr",
836
+ // Explicit local-runtime providers with OpenAI-compatible streaming: both
837
+ // DeepSeek official and Ollama honor stream_options.include_usage on their
838
+ // chat.completions endpoints. Without them, locally-configured agents lose
839
+ // token statistics / local billing (the whitelist replaced the previous
840
+ // always-on include_usage). ollama-cloud is the Ollama Cloud subscription
841
+ // endpoint (https://ollama.com/v1), an OpenAI-compatible API that likewise
842
+ // honors stream_options.include_usage.
843
+ "deepseek",
844
+ "ollama",
845
+ "ollama-cloud",
846
+ // RunInfra hosted fallback channel: OpenAI-compatible chat.completions
847
+ // endpoint, supports stream_options.include_usage (measured to return
848
+ // prompt_tokens_details.cached_tokens).
849
+ "runinfra",
850
+ "baseten",
851
+ // Kimi For Coding subscription (api.kimi.com/coding/v1): OpenAI-compatible
852
+ // chat.completions streaming that only emits the terminal usage frame when
853
+ // stream_options.include_usage is requested (measured; the official
854
+ // kimi-code CLI also sends include_usage). Custom agents pointing at the
855
+ // same endpoint are covered by the endpoint check below, not here.
856
+ "kimi-code"
857
+ ]);
858
+ var KIMI_CODE_ENDPOINT_MARKER = "api.kimi.com";
859
+ var isKimiCodeEndpoint = (endpoint) => typeof endpoint === "string" && endpoint.includes(KIMI_CODE_ENDPOINT_MARKER);
860
+ var EXTRA_USAGE_FIELD_PROVIDERS = /* @__PURE__ */ new Set(["openrouter"]);
861
+ var normalizeProviderName = (providerName) => asTrimmedLowercaseString(providerName);
862
+ var getUsageRequestOptions = (providerName, options) => {
863
+ const normalizedProvider = normalizeProviderName(providerName);
864
+ const api = options?.api ?? "chat-completions";
865
+ const shouldRequestStreamUsage = STREAM_USAGE_PROVIDERS.has(normalizedProvider) || normalizedProvider === "custom" && (isKimiCodeEndpoint(options?.endpoint) || isOllamaEndpoint(options?.endpoint));
866
+ if (api === "responses") {
867
+ return EXTRA_USAGE_FIELD_PROVIDERS.has(normalizedProvider) ? {
868
+ usage: {
869
+ include: true
870
+ }
871
+ } : {};
872
+ }
873
+ return {
874
+ ...shouldRequestStreamUsage ? {
875
+ stream_options: {
876
+ include_usage: true
877
+ }
878
+ } : {},
879
+ ...EXTRA_USAGE_FIELD_PROVIDERS.has(normalizedProvider) ? {
880
+ usage: {
881
+ include: true
882
+ }
883
+ } : {}
884
+ };
885
+ };
886
+
887
+ // packages/core/chat/imageParts.ts
888
+ function isImageUrlPart(part) {
889
+ return isRecord(part) && part.type === "image_url";
890
+ }
891
+ function hasImageParts(messages) {
892
+ return messages.some(
893
+ (message) => Array.isArray(message.content) && message.content.some(isImageUrlPart)
894
+ );
895
+ }
896
+
897
+ // packages/core/chat/bareImageUrlShape.ts
898
+ function requiresBareImageUrl(args) {
899
+ const model = asTrimmedLowercaseString(args.model);
900
+ if (!model.startsWith("gpt-")) return false;
901
+ const provider = asTrimmedLowercaseString(args.provider);
902
+ if (provider === "opencode-go") return true;
903
+ return asTrimmedLowercaseString(args.endpoint).includes("opencode.ai/zen/go");
904
+ }
905
+ function toBareImageUrlContent(content) {
906
+ if (!Array.isArray(content)) return content;
907
+ let changed = false;
908
+ const parts = content.map((part) => {
909
+ if (!isImageUrlPart(part)) return part;
910
+ const imageUrl = part.image_url;
911
+ if (!imageUrl || typeof imageUrl !== "object") return part;
912
+ const url = imageUrl.url;
913
+ if (typeof url !== "string" || !url) return part;
914
+ changed = true;
915
+ return { ...part, image_url: url };
916
+ });
917
+ return changed ? parts : content;
918
+ }
919
+ function toBareImageUrlMessages(messages) {
920
+ return messages.map((message) => {
921
+ const content = toBareImageUrlContent(message.content);
922
+ return content === message.content ? message : { ...message, content };
923
+ });
924
+ }
925
+
926
+ // packages/agent-runtime/openAiCompatibleMessages.ts
927
+ function isGeminiCompatibleTarget(provider, model) {
928
+ const p = (provider ?? "").trim().toLowerCase();
929
+ const m = (model ?? "").trim().toLowerCase();
930
+ return p === "google" || p === "google-antigravity" || p.startsWith("google-") || p.includes("gemini") || m.includes("gemini");
931
+ }
932
+ function preserveAgentStateFields(source, target, options) {
933
+ const mutableTarget = target;
934
+ if (source.role === "assistant") {
935
+ const shapingCounts = options?.shapingCounts;
936
+ if (!options?.stripReasoningContent && typeof source.reasoning_content === "string") {
937
+ mutableTarget.reasoning_content = source.reasoning_content;
938
+ }
939
+ if (Array.isArray(source.tool_calls)) {
940
+ if (shapingCounts && source.tool_calls.length > 0) {
941
+ shapingCounts.assistantToolTurns += 1;
942
+ const hadUsableReasoning = typeof source.reasoning_content === "string" && source.reasoning_content.length > 0;
943
+ if (options?.stripReasoningContent) {
944
+ if (hadUsableReasoning) shapingCounts.reasoningStrippedTurns += 1;
945
+ else shapingCounts.missingReasoningTurns += 1;
946
+ } else if (!hadUsableReasoning) {
947
+ shapingCounts.missingReasoningTurns += 1;
948
+ }
949
+ }
950
+ const isExplicitTarget = Boolean(options?.targetProvider || options?.targetModel);
951
+ const allowSignature = options?.allowThoughtSignature ?? (isExplicitTarget ? isGeminiCompatibleTarget(options?.targetProvider, options?.targetModel) : true);
952
+ mutableTarget.tool_calls = source.tool_calls.map((call) => {
953
+ if (!call || typeof call !== "object") return call;
954
+ const cleaned = {
955
+ id: call.id,
956
+ type: call.type ?? "function",
957
+ function: call.function
958
+ };
959
+ if (allowSignature) {
960
+ if (call.extra_content !== void 0) cleaned.extra_content = call.extra_content;
961
+ if (call.thought_signature !== void 0) cleaned.thought_signature = call.thought_signature;
962
+ }
963
+ return cleaned;
964
+ });
965
+ }
966
+ const hasReplayableToolCalls = Array.isArray(mutableTarget.tool_calls) && mutableTarget.tool_calls.length > 0;
967
+ const replayPlaceholder = options?.replayReasoningPlaceholder;
968
+ if (typeof replayPlaceholder === "string" && replayPlaceholder.length > 0 && // strip 优先:拒 string reasoning_content 的 provider 也会拒这个占位。
969
+ !options?.stripReasoningContent && (hasReplayableToolCalls || hasDowngradedToolTurnOrigin(source)) && !// 真实 reasoning_content 优先,永不被占位覆盖。
970
+ (typeof mutableTarget.reasoning_content === "string" && mutableTarget.reasoning_content.length > 0)) {
971
+ mutableTarget.reasoning_content = replayPlaceholder;
972
+ if (shapingCounts) shapingCounts.placeholderInjectedTurns += 1;
973
+ }
974
+ }
975
+ if (source.role === "tool") {
976
+ const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
977
+ if (toolCallId) mutableTarget.tool_call_id = toolCallId;
978
+ }
979
+ return target;
980
+ }
981
+ function toOpenAiCompatibleMessages(messages, options) {
982
+ return messages.map(
983
+ (message) => preserveAgentStateFields(message, {
984
+ role: message.role,
985
+ content: message.content ?? ""
986
+ }, options)
987
+ );
988
+ }
989
+ function shouldStripReasoningContentForOutbound(provider, model) {
990
+ const p = provider?.trim().toLowerCase();
991
+ const m = model?.trim().toLowerCase();
992
+ if (!p || !m) return false;
993
+ if (p === "deepseek" || p === "nolo") {
994
+ return m === "deepseek-flash" || m === "deepseek-v4-flash" || m === "deepseek-v4-flash-vision-exp" || m === "deepseek-v4-pro";
995
+ }
996
+ return false;
997
+ }
998
+ var REASONING_REPLAY_PLACEHOLDER = "(reasoning not captured for this turn)";
999
+ function shouldReplayReasoningContentForOutbound(provider, model) {
1000
+ const p = provider?.trim().toLowerCase();
1001
+ const m = model?.trim().toLowerCase();
1002
+ if (!p || !m) return false;
1003
+ return (p === "opencode-go" || p === "opencode") && m.includes("deepseek");
1004
+ }
1005
+ function resolveReasoningReplayOptions(provider, model, stripReasoningContent) {
1006
+ if (stripReasoningContent) return {};
1007
+ return shouldReplayReasoningContentForOutbound(provider, model) ? { replayReasoningPlaceholder: REASONING_REPLAY_PLACEHOLDER } : {};
1008
+ }
1009
+
1010
+ // packages/integrations/openai/providerBodyCompatibility.ts
1011
+ var MOONSHOT_KIMI_K3_MODEL = "kimi-k3";
1012
+ var isKimiK3ProviderModel = (provider, model) => {
1013
+ const normalizedModel = asTrimmedLowercaseString(model);
1014
+ if (asTrimmedLowercaseString(provider) === "moonshot") {
1015
+ return normalizedModel === MOONSHOT_KIMI_K3_MODEL;
1016
+ }
1017
+ return isNoloHostedProvider(provider) && normalizedModel === PLATFORM_HOSTED_KIMI_K3_MODEL;
1018
+ };
1019
+ var isOllamaProviderOrEndpoint = (provider, endpoint) => {
1020
+ const p = asTrimmedLowercaseString(provider);
1021
+ if (p === "ollama" || p === "ollama-cloud") return true;
1022
+ return isOllamaEndpoint(endpoint);
1023
+ };
1024
+ var applyFunctionToolReasoningCompatibility = (body, model) => {
1025
+ const effectiveModel = model ?? body?.model;
1026
+ const isLuna = typeof effectiveModel === "string" && /(?:^|\/)gpt-6-luna(?:$|[-._].*)/i.test(asTrimmedLowercaseString(effectiveModel));
1027
+ if (isLuna && Array.isArray(body?.tools) && body.tools.some((tool) => tool?.type === "function")) {
1028
+ return {
1029
+ ...body,
1030
+ reasoning_effort: "none"
1031
+ };
1032
+ }
1033
+ return body;
1034
+ };
1035
+ var normalizeChatCompletionsBodyForProvider = ({
1036
+ body,
1037
+ provider,
1038
+ model,
1039
+ endpoint
1040
+ }) => {
1041
+ let nextBody = { ...body, model };
1042
+ const normalizedProvider = asTrimmedLowercaseString(provider);
1043
+ nextBody = applyFunctionToolReasoningCompatibility(nextBody, model);
1044
+ if (Array.isArray(nextBody.messages)) {
1045
+ const isGemini = normalizedProvider === "google" || normalizedProvider === "google-antigravity" || normalizedProvider.startsWith("google-") || normalizedProvider.includes("gemini") || asTrimmedLowercaseString(model).includes("gemini") || typeof endpoint === "string" && endpoint.includes("googleapis.com");
1046
+ if (!isGemini) {
1047
+ nextBody.messages = nextBody.messages.map((msg) => {
1048
+ if (msg?.role === "assistant" && Array.isArray(msg.tool_calls)) {
1049
+ return {
1050
+ ...msg,
1051
+ tool_calls: msg.tool_calls.map((tc) => {
1052
+ if (!tc || typeof tc !== "object") return tc;
1053
+ const { id, type = "function", function: fn } = tc;
1054
+ return { id, type, function: fn };
1055
+ })
1056
+ };
1057
+ }
1058
+ return msg;
1059
+ });
1060
+ }
1061
+ }
1062
+ if (normalizedProvider === "fireworks" && isFireworksKimiModel(model)) {
1063
+ delete nextBody.reasoning;
1064
+ delete nextBody.reasoning_effort;
1065
+ }
1066
+ if (isKimiK3ProviderModel(provider, model)) {
1067
+ delete nextBody.temperature;
1068
+ delete nextBody.top_p;
1069
+ delete nextBody.frequency_penalty;
1070
+ delete nextBody.presence_penalty;
1071
+ if (typeof nextBody.max_tokens === "number") {
1072
+ nextBody.max_completion_tokens = nextBody.max_tokens;
1073
+ delete nextBody.max_tokens;
1074
+ }
1075
+ }
1076
+ if (isOllamaProviderOrEndpoint(provider, endpoint)) {
1077
+ const existingNumCtx = nextBody.options?.num_ctx ?? nextBody.num_ctx;
1078
+ if (existingNumCtx === void 0) {
1079
+ const cw = getModelContextWindow(model);
1080
+ const safeNumCtx = typeof cw === "number" && cw > 0 ? cw === 256e3 ? 32768 : Math.min(cw, 131072) : 32768;
1081
+ nextBody.options = {
1082
+ ...nextBody.options,
1083
+ num_ctx: safeNumCtx
1084
+ };
1085
+ }
1086
+ }
1087
+ if (Array.isArray(nextBody.messages) && requiresBareImageUrl({ provider, model })) {
1088
+ nextBody.messages = toBareImageUrlMessages(nextBody.messages);
1089
+ }
1090
+ return nextBody;
1091
+ };
1092
+
1093
+ // packages/agent-runtime/promptCacheKey.ts
1094
+ function collectStablePromptPrefix(messages, fallbackPrompt) {
1095
+ const systemTexts = [];
1096
+ if (fallbackPrompt?.trim()) systemTexts.push(fallbackPrompt.trim());
1097
+ for (const raw of messages) {
1098
+ if (!raw || typeof raw !== "object") continue;
1099
+ const message = raw;
1100
+ const role = String(message.role ?? "");
1101
+ if (role !== "system" && role !== "developer") continue;
1102
+ if (typeof message.content === "string") {
1103
+ const boundary = Number(message.stable_prefix_chars);
1104
+ const text = Number.isFinite(boundary) && boundary > 0 ? message.content.slice(0, boundary) : message.content;
1105
+ if (text.trim()) systemTexts.push(text.trim());
1106
+ }
1107
+ }
1108
+ return systemTexts.join("\n\n");
1109
+ }
1110
+ function stablePromptCacheKey(parts, namespace) {
1111
+ const value = JSON.stringify(parts);
1112
+ let hash = 2166136261;
1113
+ for (let index = 0; index < value.length; index += 1) {
1114
+ hash ^= value.charCodeAt(index);
1115
+ hash = Math.imul(hash, 16777619) >>> 0;
1116
+ }
1117
+ return `${namespace}-${hash.toString(16).padStart(8, "0")}`;
1118
+ }
1119
+
1120
+ export {
1121
+ scanTruncation,
1122
+ classifyUnparsableToolArgs,
1123
+ markDowngradedToolTurnOrigin,
1124
+ transferDowngradedToolTurnOrigin,
1125
+ sanitizeForOutbound,
1126
+ hasParsableObjectArguments,
1127
+ repairTruncatedToolArguments,
1128
+ downgradeUnparsableToolCalls,
1129
+ getUsageRequestOptions,
1130
+ hasImageParts,
1131
+ requiresBareImageUrl,
1132
+ toBareImageUrlMessages,
1133
+ preserveAgentStateFields,
1134
+ toOpenAiCompatibleMessages,
1135
+ shouldStripReasoningContentForOutbound,
1136
+ resolveReasoningReplayOptions,
1137
+ toResponsesTools,
1138
+ convertMessagesToResponsesInput,
1139
+ extractTextFromResponseOutput,
1140
+ extractReasoningFromResponseOutput,
1141
+ extractImagePartsFromResponseOutput,
1142
+ extractToolCallsFromResponseOutput,
1143
+ applyFunctionToolReasoningCompatibility,
1144
+ normalizeChatCompletionsBodyForProvider,
1145
+ collectStablePromptPrefix,
1146
+ stablePromptCacheKey
1147
+ };