nolo-cli 0.259.0-alpha.1 → 0.261.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 (320) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-MTM4BJK3.js → _executeModel-PODMRXJJ.js} +97 -83
  3. package/accountResolver-NGICIMEE.js +1 -1
  4. package/{action-C6IQAKN4.js → action-NJTYNXXR.js} +12 -10
  5. package/{addContentAction-53364YDW.js → addContentAction-RUPXLROG.js} +14 -13
  6. package/{addDialogAgentAction-U5DD5EN5.js → addDialogAgentAction-57EJ2UBC.js} +20 -24
  7. package/{agentDeleteCommand-53NN3VSK.js → agentDeleteCommand-DRFCOTYP.js} +185 -147
  8. package/{agentEmailCommands-KOGGIT6I.js → agentEmailCommands-FHENHUBF.js} +143 -127
  9. package/{agentGrantCommands-L6O2HVJI.js → agentGrantCommands-BMVKNYIY.js} +9 -6
  10. package/{agentListCommands-62UYUQDI.js → agentListCommands-W66W5K3V.js} +88 -69
  11. package/{agentMachineCommands-W6TNJXEA.js → agentMachineCommands-C3BUBCXU.js} +69 -60
  12. package/{agentProviderCommands-QLTABYR7.js → agentProviderCommands-VIWKP7DM.js} +11 -8
  13. package/{agentPullCommand-2EYJ5ENC.js → agentPullCommand-5SNSXOY7.js} +10 -7
  14. package/agentRecordCommands-DYMHWTID.js +210 -0
  15. package/agentRun-QVFG3CI4.js +250 -0
  16. package/agentRunCommand-YV4V5HSL.js +248 -0
  17. package/{agentRunControl-LXMADX3N.js → agentRunControl-RGBHKPKJ.js} +19 -12
  18. package/{agentRuntimeLocal-YGNJMQW3.js → agentRuntimeLocal-LVEMOYS2.js} +62 -49
  19. package/{agentSlice-3HHYUQLM.js → agentSlice-OJCM7OUX.js} +15 -18
  20. package/appConfigCommands-ZUXQLE7L.js +417 -0
  21. package/{appDeleteCommands-5COJ6CSG.js → appDeleteCommands-L5UKUMXY.js} +68 -58
  22. package/{appDeployCommands-3JPAT3XO.js → appDeployCommands-KX2BRQUW.js} +74 -59
  23. package/{appDeployStatusCommands-RHZKF3G4.js → appDeployStatusCommands-7LHRSWW7.js} +68 -58
  24. package/{appGetCommands-73DXOAQW.js → appGetCommands-F7SDFCUK.js} +74 -58
  25. package/{appListCommands-HD5LOQ3G.js → appListCommands-U4NJKSMZ.js} +74 -58
  26. package/appMigrateCommands-JAPOLYSW.js +230 -0
  27. package/appSourceCommands-TLXPWXUH.js +279 -0
  28. package/authCommand-AU3GZBZ2.js +65 -0
  29. package/{authCommands-T5FODCEG.js → authCommands-JKBWMUQ4.js} +20 -17
  30. package/{builtinSkillRegistry-EDHD2UHU.js → builtinSkillRegistry-6XUWMAV5.js} +8 -6
  31. package/{chromeOpsCommands-3SSTDFRF.js → chromeOpsCommands-F47WYQWF.js} +68 -18
  32. package/{chunk-5YS6QHGT.js → chunk-2FGFY72B.js} +9 -9
  33. package/{chunk-MJBLXJMP.js → chunk-2I4R6ZRV.js} +12 -9
  34. package/{chunk-FXEPZKNJ.js → chunk-2MIZHEND.js} +506 -64
  35. package/{chunk-TLE77UJ5.js → chunk-2OROOEOQ.js} +0 -1
  36. package/{chunk-6RSNVJGO.js → chunk-2ZBPWX7N.js} +4 -4
  37. package/chunk-35JIFLIG.js +30 -0
  38. package/{chunk-7OVOZRZF.js → chunk-3B7OTHDW.js} +23 -379
  39. package/{chunk-DNNPARJK.js → chunk-3QMN3T6L.js} +50 -37
  40. package/{chunk-DMPZMYH4.js → chunk-3R4AYHJR.js} +13 -1
  41. package/{chunk-XNNBXUEM.js → chunk-3TII7WCF.js} +5 -5
  42. package/{chunk-223KZUJ6.js → chunk-4HZCBA4Q.js} +18 -15
  43. package/{chunk-C5A54QS7.js → chunk-4INJGWE3.js} +18 -5
  44. package/chunk-4IVMDQBA.js +261 -0
  45. package/chunk-4Y6CZ2N4.js +82 -0
  46. package/{chunk-KZ4A7EIV.js → chunk-56OAS5RZ.js} +1 -1
  47. package/{chunk-KQHEGELM.js → chunk-63G7JWEA.js} +16 -6
  48. package/{chunk-4EACJPZI.js → chunk-6BBXJGIQ.js} +51 -42
  49. package/chunk-72VWN4VK.js +51 -0
  50. package/chunk-7LR2IFUH.js +100 -0
  51. package/{chunk-S73EPYNC.js → chunk-7LS5ATRP.js} +20 -6
  52. package/{chunk-XPETQ4MR.js → chunk-7X4BFUJV.js} +24 -10
  53. package/{chunk-KHYSFS3W.js → chunk-A454UXB6.js} +148 -73
  54. package/chunk-A4O76A6V.js +432 -0
  55. package/chunk-AMNZPQCY.js +635 -0
  56. package/{chunk-4MXYCQBS.js → chunk-AQNWWJLH.js} +2 -56
  57. package/{chunk-LHCGKAFO.js → chunk-BKP325XS.js} +184 -112
  58. package/{chunk-PENRYZ4D.js → chunk-BPB3T5EU.js} +4 -7
  59. package/{chunk-U6QNVOR5.js → chunk-BUGLH2A7.js} +130 -6
  60. package/{chunk-2JHGUL5K.js → chunk-BVYHE6QD.js} +2 -2
  61. package/{chunk-KXOPLLFP.js → chunk-CA7LGAHV.js} +69 -9
  62. package/{chunk-2FZVXOFX.js → chunk-CEIWXKHP.js} +112 -200
  63. package/{chunk-Y2TCTNUD.js → chunk-CK2LMTYO.js} +4 -4
  64. package/{chunk-AIFQKNPP.js → chunk-CL33RFD7.js} +1 -1
  65. package/{chunk-57V4PADY.js → chunk-CNYPQYXT.js} +781 -449
  66. package/{chunk-P4R5KXU7.js → chunk-CW6LRDSF.js} +5 -5
  67. package/chunk-D3ONA3FP.js +762 -0
  68. package/{chunk-PIVTQRX6.js → chunk-DDKA6V6X.js} +111 -12
  69. package/chunk-DLXL4NSL.js +1179 -0
  70. package/{chunk-EJQE5HB7.js → chunk-DSBRIUX5.js} +4 -2
  71. package/{chunk-XRGBJHZX.js → chunk-E36V7MPY.js} +9 -5
  72. package/{chunk-4YPH5KRA.js → chunk-EDKMRDET.js} +1 -1
  73. package/{chunk-DBJODIZ6.js → chunk-EQOWWSNQ.js} +19 -27
  74. package/chunk-ER6NTALN.js +34 -0
  75. package/{chunk-L4XST72F.js → chunk-ERCSHBUD.js} +16027 -17392
  76. package/chunk-EUHMI5KG.js +101 -0
  77. package/{chunk-YQLAFJRQ.js → chunk-FBNVJ2TO.js} +1 -1
  78. package/{chunk-Q2EERN52.js → chunk-FF5ZRKW7.js} +12 -7
  79. package/{chunk-6XIE5ZGI.js → chunk-FGFJUFPS.js} +5 -6
  80. package/chunk-FI4DPLR7.js +902 -0
  81. package/{chunk-HDKMVYNJ.js → chunk-FNLT7NKG.js} +7 -11
  82. package/{chunk-JCQ3WCQ3.js → chunk-FOC4TORM.js} +69 -3
  83. package/chunk-FP46RAJQ.js +58 -0
  84. package/{chunk-JPXACKSW.js → chunk-G22P2J7O.js} +30 -81
  85. package/{chunk-7WHCIA5V.js → chunk-G5IAIGGD.js} +3 -8
  86. package/{chunk-FZENZCIA.js → chunk-GEC4CHS2.js} +19 -12
  87. package/chunk-GF4LYNNZ.js +25 -0
  88. package/{chunk-IYLUK67R.js → chunk-GH6SS2DZ.js} +25 -8
  89. package/chunk-HAZ6UVH4.js +368 -0
  90. package/{chunk-OKAXQFON.js → chunk-HB4J5HA6.js} +4 -4
  91. package/{chunk-324FWHUA.js → chunk-HHXF57CL.js} +12 -3
  92. package/chunk-HJTI7RZV.js +94 -0
  93. package/{chunk-HQUGB2HM.js → chunk-HMFKYZKP.js} +62 -50
  94. package/{chunk-Q2MPKE4B.js → chunk-HVRG27HI.js} +76 -26
  95. package/{chunk-46FETNLF.js → chunk-IN4B6Z2D.js} +7 -6
  96. package/chunk-IV6VUVLJ.js +88 -0
  97. package/{chunk-LLUBUHNT.js → chunk-IWWJSSST.js} +5 -9
  98. package/{chunk-7BIJFGKS.js → chunk-J22PFCQN.js} +106 -52
  99. package/chunk-J42X32PV.js +472 -0
  100. package/{chunk-LCBAMY2M.js → chunk-JKVOKKMQ.js} +0 -7
  101. package/{chunk-KT7S7ANZ.js → chunk-JPYOHIHX.js} +9 -9
  102. package/{chunk-R7XWZDOH.js → chunk-JUMQJSQF.js} +1423 -282
  103. package/{chunk-KVMLM5VD.js → chunk-KAHYBAEN.js} +211 -472
  104. package/{chunk-KLMBM6P6.js → chunk-KALCFXQO.js} +2454 -1115
  105. package/chunk-KDDXC2IH.js +148 -0
  106. package/chunk-KGKTN2NX.js +25 -0
  107. package/chunk-KGWE224L.js +246 -0
  108. package/{chunk-OYUMJMC5.js → chunk-KSV6T4AH.js} +6 -1
  109. package/{chunk-P27E22MA.js → chunk-L43DGEPZ.js} +1 -1
  110. package/{chunk-5BIDJVNX.js → chunk-L45P4JTE.js} +180 -31
  111. package/chunk-LHCIIUCX.js +222 -0
  112. package/{chunk-CBIGMWMI.js → chunk-LHJB4BXJ.js} +1 -1
  113. package/{chunk-TRRXYFTR.js → chunk-LOFRSJX2.js} +1 -0
  114. package/{chunk-SQL7YNED.js → chunk-LPXBBC32.js} +71 -5
  115. package/{chunk-BIDSIRTS.js → chunk-LTCZOOAM.js} +11 -17
  116. package/chunk-LUTSMSIL.js +425 -0
  117. package/chunk-LXP53WGF.js +168 -0
  118. package/{chunk-2CT2J3O6.js → chunk-M7VNNPVX.js} +2493 -4055
  119. package/chunk-MDAYRIP7.js +1889 -0
  120. package/{chunk-6B2OBX5B.js → chunk-MMXHIHJZ.js} +15 -47
  121. package/{chunk-HPDLPEUG.js → chunk-MPWQI36J.js} +267 -234
  122. package/chunk-MRACVEPZ.js +7 -0
  123. package/{chunk-ZYPXOQS2.js → chunk-MSFKHPA6.js} +1 -1
  124. package/chunk-NHLLXINQ.js +8 -0
  125. package/{chunk-QXTEEEIN.js → chunk-NJCTPWJU.js} +8 -8
  126. package/chunk-NLS7F5DW.js +1697 -0
  127. package/{chunk-FP37ELBT.js → chunk-NTBTVKKB.js} +17 -25
  128. package/{chunk-JLZJL3WC.js → chunk-O77F26YB.js} +370 -39
  129. package/{chunk-LVZVSLKO.js → chunk-O7ZY6SUK.js} +5 -22
  130. package/{chunk-YN23INFZ.js → chunk-OIOMBPCA.js} +23 -2
  131. package/{chunk-CJOOF4L5.js → chunk-OSZNERNW.js} +17 -14
  132. package/{chunk-JZO7KUF3.js → chunk-P4I55ASV.js} +313 -275
  133. package/{chunk-2C5VN7NH.js → chunk-P4XAHM4B.js} +1 -1
  134. package/chunk-PL5RKESU.js +40 -0
  135. package/chunk-Q5FJJ6XI.js +103 -0
  136. package/{chunk-WS36XPJD.js → chunk-Q5IXZF3S.js} +82 -6
  137. package/{createAgentAutomationAction-GRZ6XY7Q.js → chunk-QKM55LP2.js} +3 -160
  138. package/{chunk-WSLL7VV4.js → chunk-QXWXRBOL.js} +9 -9
  139. package/{chunk-MXA54TQM.js → chunk-QZYQ3Y3G.js} +1 -1
  140. package/{chunk-FE7G6DSP.js → chunk-R72QWIFO.js} +14 -4
  141. package/{chunk-5RGU3J7P.js → chunk-REAE2SZK.js} +0 -1
  142. package/chunk-RF576RYE.js +117 -0
  143. package/chunk-RI7SXDJW.js +1317 -0
  144. package/{chunk-FEIVARWR.js → chunk-RIOAPUGV.js} +238 -25
  145. package/{chunk-BZLGPM5B.js → chunk-RNLKWUVY.js} +7 -12
  146. package/{chunk-J7JRCOIW.js → chunk-RWXHGPWJ.js} +1 -1
  147. package/{chunk-J55F3IEZ.js → chunk-SARJZIGR.js} +1 -1
  148. package/chunk-SJFL32RD.js +356 -0
  149. package/{chunk-6SOWMEAY.js → chunk-SR57FDTX.js} +2 -258
  150. package/{chunk-MPGR4ZNR.js → chunk-SRVLHMES.js} +46 -42
  151. package/{chunk-CEKRIR22.js → chunk-SU4NCTW4.js} +1 -1
  152. package/{chunk-RD3QLZQV.js → chunk-SWJRX4M5.js} +324 -2
  153. package/{chunk-R3TUHCSJ.js → chunk-T3Y2NA4H.js} +8 -3
  154. package/{chunk-53W5BXLN.js → chunk-TCOHWKDM.js} +54 -55
  155. package/{chunk-KWNVPY6M.js → chunk-TJXO66M2.js} +8 -5
  156. package/{chunk-QIGQFON2.js → chunk-TXMFSGRY.js} +1 -1
  157. package/{chunk-ADYWV732.js → chunk-U5PSCTMR.js} +264 -177
  158. package/{chunk-UUCYUN6Y.js → chunk-UB7NV7NN.js} +1 -1
  159. package/{chunk-QGFLVQ6E.js → chunk-UBOTXA3Z.js} +4 -14
  160. package/{chunk-6YX2RAQN.js → chunk-UEZL3RBG.js} +89 -164
  161. package/{chunk-NCFKHYDM.js → chunk-UJL23HBL.js} +774 -119
  162. package/chunk-ULPU4C43.js +1710 -0
  163. package/{chunk-UA3QTA2S.js → chunk-VC3MAT33.js} +4442 -2570
  164. package/{chunk-VNHZJEQN.js → chunk-VCESLFF4.js} +3 -3
  165. package/chunk-VOO3YQQP.js +17157 -0
  166. package/{chunk-Y2GWUBNS.js → chunk-VZDSNDUD.js} +279 -149
  167. package/{chunk-6BMTKYAO.js → chunk-W2Z5E2R7.js} +126 -698
  168. package/{chunk-4ZCTKB27.js → chunk-W5GKF5ZW.js} +1 -0
  169. package/chunk-WEEB2JKA.js +443 -0
  170. package/{chunk-NUHQO3RB.js → chunk-WIVVNJUS.js} +1 -1
  171. package/chunk-WMBJDXMY.js +408 -0
  172. package/chunk-WSQLCWLQ.js +201 -0
  173. package/{chunk-OOVOAG4Q.js → chunk-WY6DMHMG.js} +1 -1
  174. package/{chunk-6K32PBRY.js → chunk-XJW6SLBZ.js} +3 -3
  175. package/{chunk-MNFUKRRU.js → chunk-XKNDVHF5.js} +7 -7
  176. package/{chunk-MHKPUGPD.js → chunk-XREMPMNK.js} +20 -4
  177. package/chunk-XT6C2QZW.js +46 -0
  178. package/chunk-XUDXQT7R.js +790 -0
  179. package/{chunk-ZEZC7IIM.js → chunk-YFSM2366.js} +35 -35
  180. package/{chunk-RIWKZT7E.js → chunk-YRPIUIEQ.js} +11 -9
  181. package/{chunk-U35UUM5K.js → chunk-YVOUSIIA.js} +1 -1
  182. package/{chunk-6VEO7Z3Y.js → chunk-Z27AH6A5.js} +6 -6
  183. package/chunk-Z3KTXWWB.js +76 -0
  184. package/{chunk-UWWOWTW2.js → chunk-Z7EP5HDL.js} +1 -1
  185. package/{chunk-YFEK7ACQ.js → chunk-ZB2E724W.js} +4 -4
  186. package/{chunk-YLAHYLDQ.js → chunk-ZC3CMUKU.js} +2 -89
  187. package/{chunk-5P3PPQVP.js → chunk-ZQAADXSF.js} +1 -1
  188. package/{cliAgentConfigHelpers-BXHQ3PXP.js → cliAgentConfigHelpers-BJJEXHSZ.js} +20 -14
  189. package/{cliAuthorityBrokerClient-TFNXJLXL.js → cliAuthorityBrokerClient-3SKOA7OZ.js} +3 -1
  190. package/cliAuthorityBrokerProcess-VIJEKQSX.js +34 -0
  191. package/{cliEnvHelpers-CNMP3RDX.js → cliEnvHelpers-NDMKN4X2.js} +6 -3
  192. package/{cliExecutor-K6FDZTQ2.js → cliExecutor-Z62UBJ5S.js} +12 -6
  193. package/cliLocalAgentRecordReader-KCZS2MZU.js +113 -0
  194. package/cloudAutomationCommands-2WQUGQSW.js +310 -0
  195. package/{commandRegistry-IFYQLPGM.js → commandRegistry-C64JBZJ3.js} +288 -121
  196. package/{contentThunks-QCFCD2X3.js → contentThunks-G3HEIRXC.js} +45 -43
  197. package/{cooldownCommands-WDOI5VD7.js → cooldownCommands-FPAFS7XG.js} +1 -1
  198. package/createAgentAutomationAction-DSBL3X3A.js +172 -0
  199. package/createDialogAction-OHFUHC53.js +86 -0
  200. package/{createPageAction-QCVBMP4C.js → createPageAction-E6JZSZLU.js} +49 -45
  201. package/{db-VR74ADGC.js → db-KTQ3LL2Q.js} +3 -3
  202. package/{dbSlice-RWPSVHBC.js → dbSlice-U3GPLEL3.js} +21 -16
  203. package/deleteDbKey-DRXKWJX5.js +86 -0
  204. package/{dialogCommands-4IEQUALS.js → dialogCommands-4EX2OTIC.js} +80 -66
  205. package/{dialogMessageRecord-OAV77LT7.js → dialogMessageRecord-2HJTEXQX.js} +1 -1
  206. package/dialogNotifyCommand-4SCE2Z2R.js +44 -0
  207. package/dialogPortabilityCommands-ZSFFHRX4.js +3036 -0
  208. package/{dialogSlice-XFYID6KE.js → dialogSlice-PRZCIJCH.js} +43 -42
  209. package/{dialogTraceCommand-Y67NRFCV.js → dialogTraceCommand-RKB76OVX.js} +84 -70
  210. package/{dialogUsageCommand-WJ3U6KZU.js → dialogUsageCommand-BP7HMRYP.js} +7 -4
  211. package/{docCreateCommands-QLRIWRQE.js → docCreateCommands-JGPNGIZ7.js} +68 -59
  212. package/{docDeleteCommands-XPRYA532.js → docDeleteCommands-XRJTNRDH.js} +68 -59
  213. package/{docReadCommands-EXQI7ETH.js → docReadCommands-6GFO4ARS.js} +67 -58
  214. package/{docStore-MWFUKZL2.js → docStore-QRLIWFTU.js} +16 -17
  215. package/{docUpdateCommands-EFBFQV77.js → docUpdateCommands-W2GXMUXW.js} +68 -59
  216. package/{ebookDownloaderAgentCommand-DYSKF5ZY.js → ebookDownloaderAgentCommand-2DHPGEOQ.js} +14 -17
  217. package/{fetchMessages-TQEUZD7H.js → fetchMessages-RGPIYEPZ.js} +2 -2
  218. package/{getPricing-5BLZRPTM.js → getPricing-BK6CUBAE.js} +8 -4
  219. package/{handleSendMessageAction-GG3TR62X.js → handleSendMessageAction-DHGWURJZ.js} +265 -119
  220. package/{hostCredentialCreate-26S6DDJ5.js → hostCredentialCreate-FPUZ7RMI.js} +138 -122
  221. package/index.js +36 -22
  222. package/{keys-RWF7UCB4.js → keys-FXEGMKSG.js} +2 -2
  223. package/localAutomationCommands-ZMU22RQJ.js +198 -0
  224. package/localAutomationRuntime-MU5FGJ3V.js +60 -0
  225. package/{localDialogRead-BJJT3TF5.js → localDialogRead-W2EVXISA.js} +2 -2
  226. package/{localRuntimeAdapter-VREWZWPC.js → localRuntimeAdapter-YBXQBV4G.js} +136 -119
  227. package/localRuntimeAuthority-LDXMEDO5.js +44 -0
  228. package/{localRuntimeDb-ZJFGNHML.js → localRuntimeDb-6TQZDLNU.js} +1 -1
  229. package/{machineCommands-CL5XK5UC.js → machineCommands-57RTUYRV.js} +251 -357
  230. package/{machineInfo-LWHTEBHJ.js → machineInfo-BJIU3WQ5.js} +4 -2
  231. package/machineWsRunDispatch-VBKV3FFE.js +227 -0
  232. package/{mcpLocalAuthorizeCommand-RBXJDE6J.js → mcpLocalAuthorizeCommand-J76SOJVZ.js} +40 -22
  233. package/mcpLocalManageCommands-USETIMHB.js +212 -0
  234. package/{memberThunks-43B7UYC5.js → memberThunks-7UERUEMI.js} +102 -22
  235. package/{memoryCommands-BC6REPQB.js → memoryCommands-N7NHEE55.js} +25 -34
  236. package/{models-ZX2BYIMB.js → models-TOXYINNM.js} +3 -2
  237. package/{offlineMarxistsAgentCommand-XVXUE6G5.js → offlineMarxistsAgentCommand-WZBJBCPZ.js} +16 -22
  238. package/package.json +3 -3
  239. package/parityCommands-LYDLWSLK.js +613 -0
  240. package/{projectArchive-OC63TWTD.js → projectArchive-KCNQDVWJ.js} +49 -45
  241. package/{providerPresetApply-NTJUINI6.js → providerPresetApply-IRJ56XIZ.js} +12 -16
  242. package/{providerRegistry-W45SLUV6.js → providerRegistry-26PAUYH2.js} +3 -13
  243. package/{read-KG6INYUT.js → read-SPSQ6NLR.js} +11 -10
  244. package/{readDocTool-N3GA52JR.js → readDocTool-ENUL2GNL.js} +5 -1
  245. package/{readlineWorkspace-2NO6D6IZ.js → readlineWorkspace-MKS7TAEF.js} +927 -573
  246. package/{rememberExplicit-CPAPONSI.js → rememberExplicit-7KX4HXQC.js} +4 -4
  247. package/remove-TNNDO635.js +32 -0
  248. package/{removeDialogAgentAction-EEVSOQOJ.js → removeDialogAgentAction-POPUZ3WU.js} +22 -26
  249. package/{runAgentClientLoop-U7V32UTD.js → runAgentClientLoop-KVILXQNI.js} +117 -82
  250. package/{runtimeDoctorCommands-V3M3JTUV.js → runtimeDoctorCommands-4J2DP4LZ.js} +23 -16
  251. package/{secretCommands-KVVZS7A6.js → secretCommands-CSTQYB6T.js} +2 -2
  252. package/{setDialogExtraReferencesAction-DNO5POHA.js → setDialogExtraReferencesAction-35THMVBP.js} +16 -17
  253. package/{setPrimaryDialogAgentAction-QABBEO4C.js → setPrimaryDialogAgentAction-WLXBNIG7.js} +23 -27
  254. package/{settingThunks-DVKG4X4S.js → settingThunks-6Y5U5M5N.js} +170 -497
  255. package/{skillDiscovery-5GEGWJ6N.js → skillDiscovery-IUEZZG2B.js} +3 -3
  256. package/{spaceCommands-7QKXKBDQ.js → spaceCommands-LXNJBO2U.js} +293 -58
  257. package/spacePruneCommand-2ITUFYBM.js +233 -0
  258. package/{store-Z53ICFL3.js → store-WSAVTR32.js} +3 -1
  259. package/{streamAgentChatTurn-UAGFOXNJ.js → streamAgentChatTurn-EY6MFKCA.js} +225 -137
  260. package/{switchDialogAgentAction-KYWJSGOO.js → switchDialogAgentAction-TG6BQRDA.js} +19 -23
  261. package/{tableCommands-EFA754RE.js → tableCommands-35G34R4B.js} +28 -49
  262. package/{toolApiClient-N5PYW2R3.js → toolApiClient-MPQIFYXP.js} +15 -4
  263. package/{tools-2Q2LBDUC.js → tools-CSLTRRUR.js} +73 -63
  264. package/{tuiRestart-4QDWLHYZ.js → tuiRestart-ALR4Q3JM.js} +20 -13
  265. package/tuiSummaryLlmCaller-3Y3JEXJK.js +52 -0
  266. package/{updateCommands-GJGRS6JK.js → updateCommands-GHQVP6Z5.js} +13 -8
  267. package/{updateDialogTitleAction-GGNTTI5L.js → updateDialogTitleAction-LFAWF5EW.js} +57 -58
  268. package/{usageCommand-WI6SQOPB.js → usageCommand-5VKW6T4C.js} +6 -8
  269. package/{usageRebuildCommand-WQRLLZAT.js → usageRebuildCommand-VUQETFMW.js} +11 -15
  270. package/{windowsSelfUpdate-C7LGVWYX.js → windowsSelfUpdate-SXSVXK4X.js} +2 -2
  271. package/workContext-ZAW6VXT7.js +18 -0
  272. package/workContextQueryProjection-CACY5VFE.js +23 -0
  273. package/{workloadLifecycle-DYX5ZMAT.js → workloadLifecycle-P2SJVV3S.js} +1 -1
  274. package/agentFavoriteCommands-7LOP3HUD.js +0 -186
  275. package/agentRecordCommands-TPE7NSZ6.js +0 -194
  276. package/agentRunCommand-DMVGBPLI.js +0 -232
  277. package/authCommand-V6EOMZX6.js +0 -79
  278. package/chunk-2MBTWINN.js +0 -89
  279. package/chunk-523DITKR.js +0 -32
  280. package/chunk-BUDVRYES.js +0 -2213
  281. package/chunk-BZMDWGQQ.js +0 -47
  282. package/chunk-GAHJLSDO.js +0 -107
  283. package/chunk-GYX6XTAI.js +0 -84
  284. package/chunk-HNUWUO75.js +0 -93
  285. package/chunk-HSBHS6KT.js +0 -33401
  286. package/chunk-KG27JIG4.js +0 -136
  287. package/chunk-OB4FBZXJ.js +0 -364
  288. package/chunk-OKH74FML.js +0 -3746
  289. package/chunk-OLZBQWZU.js +0 -6
  290. package/chunk-OOV5JN25.js +0 -1317
  291. package/chunk-OQFOE4SJ.js +0 -405
  292. package/chunk-PXYBUFDB.js +0 -53
  293. package/chunk-R3FZHW4Q.js +0 -103
  294. package/chunk-R3MV2GII.js +0 -106
  295. package/chunk-SCAC3NM5.js +0 -11751
  296. package/chunk-SR4FE5VD.js +0 -9
  297. package/chunk-SYTHYBMI.js +0 -3558
  298. package/chunk-UKZX3NHN.js +0 -48
  299. package/chunk-UVLYNWIE.js +0 -74
  300. package/chunk-VQX5JJNI.js +0 -861
  301. package/chunk-X4O7FJF5.js +0 -160
  302. package/chunk-YJPK35HB.js +0 -175
  303. package/chunk-YNIYE47Z.js +0 -105
  304. package/chunk-Z4PCXPUE.js +0 -127
  305. package/chunk-ZR5IVL4N.js +0 -862
  306. package/chunk-ZTHAJU3O.js +0 -2537
  307. package/cliAuthorityBrokerProcess-5ZFBTHLB.js +0 -22
  308. package/cliLocalAgentRecordReader-34UKRBLY.js +0 -104
  309. package/createDialogAction-ZAJERW62.js +0 -82
  310. package/deleteFile-ECU6FU5C.js +0 -55
  311. package/dialogNotifyCommand-IASQGEMW.js +0 -36
  312. package/localRuntimeAuthority-UF2DAQ3F.js +0 -28
  313. package/machineWsRunDispatch-TBVOYOAH.js +0 -209
  314. package/markdownToSlate-PXYAIBVL.js +0 -8
  315. package/tuiSummaryLlmCaller-HROLGN4F.js +0 -45
  316. package/webapi-QVV65DQF.js +0 -2487
  317. package/workContext-Y3ADAPZU.js +0 -14
  318. package/{chunk-USGHJSGO.js → chunk-GX2MFKF3.js} +3 -3
  319. package/{chunk-PHREU2KZ.js → chunk-WX266G2C.js} +0 -0
  320. package/{chunk-DXWGFL2Z.js → chunk-YY7IGJMN.js} +3 -3
@@ -5,8 +5,9 @@ import {
5
5
  fnv1a32Hex
6
6
  } from "./chunk-UEILX4EV.js";
7
7
  import {
8
- compareAgentSelection
9
- } from "./chunk-Q2MPKE4B.js";
8
+ compareAgentSelection,
9
+ isEmptyListAgentsFragmentRequest
10
+ } from "./chunk-HVRG27HI.js";
10
11
  import {
11
12
  resolveAgentAvailability
12
13
  } from "./chunk-LS5KAVFQ.js";
@@ -14,31 +15,32 @@ import {
14
15
  LIST_AGENTS_PAGE_BUDGET,
15
16
  sanitizeToolOutputText,
16
17
  scrubSecrets
17
- } from "./chunk-QIGQFON2.js";
18
+ } from "./chunk-TXMFSGRY.js";
18
19
  import {
19
20
  isOAuthApiKeyRef
20
- } from "./chunk-UKZX3NHN.js";
21
+ } from "./chunk-CEIWXKHP.js";
21
22
  import {
22
23
  resolveModelTier
23
24
  } from "./chunk-HEVRQGGH.js";
24
25
  import {
25
26
  createKey,
26
27
  createTokenKey
27
- } from "./chunk-SYTHYBMI.js";
28
+ } from "./chunk-DLXL4NSL.js";
28
29
  import {
29
30
  isOwnedAgentKey,
30
31
  ownedAgentKey,
31
32
  publicAgentKey
32
33
  } from "./chunk-M2EJHDJP.js";
33
34
  import {
34
- isAntigravityOAuthAgent,
35
+ resolveModelReasoningCapability
36
+ } from "./chunk-RI7SXDJW.js";
37
+ import {
38
+ REASONING_EFFORT_OPTIONS
39
+ } from "./chunk-7LR2IFUH.js";
40
+ import {
35
41
  isSubscriptionEndpoint,
36
42
  isSubscriptionOAuthCredential
37
- } from "./chunk-6SOWMEAY.js";
38
- import {
39
- REASONING_EFFORT_OPTIONS,
40
- resolveModelReasoningCapability
41
- } from "./chunk-OKH74FML.js";
43
+ } from "./chunk-SR57FDTX.js";
42
44
  import {
43
45
  asTrimmedLowercaseString
44
46
  } from "./chunk-QSJ3HFEF.js";
@@ -110,12 +112,7 @@ function resolveBillingSource(candidate) {
110
112
  if (candidate?.local === true || candidate?.isLocal === true || candidate?.cliProvider === "local" || candidate?.apiSource === "local" || candidate?.provider === "local" || candidate?.billingSource === "local") return "local";
111
113
  if (candidate?.isOwned !== true) {
112
114
  const ownerUserId = typeof candidate?.userId === "string" && candidate.userId.trim() ? candidate.userId.trim() : typeof candidate?.ownerId === "string" && candidate.ownerId.trim() ? candidate.ownerId.trim() : "";
113
- if (ownerUserId && (candidate?.isOAuth === true || isOAuthApiKeyRef(candidate?.apiKeyRef) || isAntigravityOAuthAgent({
114
- key: "billing-source-probe",
115
- apiKeyRef: candidate?.apiKeyRef ?? void 0,
116
- provider: candidate?.provider ?? void 0,
117
- customProviderUrl: candidate?.customProviderUrl ?? void 0
118
- }))) {
115
+ if (ownerUserId && (candidate?.isOAuth === true || isOAuthApiKeyRef(candidate?.apiKeyRef))) {
119
116
  return "owner_subscription";
120
117
  }
121
118
  return "platform_credits";
@@ -765,12 +762,7 @@ function toUltraCompactAgentSummary(summary) {
765
762
 
766
763
  // packages/ai/agent/platformPaidCall.ts
767
764
  var asTrimmed = (value) => typeof value === "string" ? value.trim() : "";
768
- var hasOAuthCredentialShape = (agentConfig) => isOAuthApiKeyRef(agentConfig?.apiKeyRef) || isAntigravityOAuthAgent({
769
- key: "platform-paid-call-probe",
770
- apiKeyRef: agentConfig?.apiKeyRef ?? void 0,
771
- provider: agentConfig?.provider ?? void 0,
772
- customProviderUrl: agentConfig?.customProviderUrl ?? void 0
773
- });
765
+ var hasOAuthCredentialShape = (agentConfig) => isOAuthApiKeyRef(agentConfig?.apiKeyRef);
774
766
  function isPlatformPaidAgentCall(probe) {
775
767
  const agentConfig = probe?.agentConfig ?? {};
776
768
  const authKind = asTrimmed(probe?.authKind);
@@ -1200,7 +1192,7 @@ async function serializeCompactAgentPage(parsed, samples, snapshotAgeMs, options
1200
1192
  const candidates = parsed.agents;
1201
1193
  const availableCount = typeof parsed.availableCount === "number" ? parsed.availableCount : parsed.total;
1202
1194
  const groups = Array.isArray(parsed.credentialGroups) ? parsed.credentialGroups : [];
1203
- if (options.fragmentOffset !== void 0) {
1195
+ if (!isEmptyListAgentsFragmentRequest(options)) {
1204
1196
  const fragmentOffset = Number(options.fragmentOffset);
1205
1197
  const agentKey2 = candidates[0]?.agentKey;
1206
1198
  if (typeof options.fragmentOffset !== "number" && (typeof options.fragmentOffset !== "string" || !/^\d+$/.test(options.fragmentOffset)) || !Number.isSafeInteger(fragmentOffset) || fragmentOffset < 0 || typeof agentKey2 !== "string" || agentKey2 !== options.fragmentAgentKey) {
@@ -1245,7 +1237,7 @@ async function serializeCompactAgentPage(parsed, samples, snapshotAgeMs, options
1245
1237
  let end = Math.min(serialized.length, fragmentOffset + 3e3);
1246
1238
  if (end < serialized.length && /[\uD800-\uDBFF]/.test(serialized[end - 1]) && /[\uDC00-\uDFFF]/.test(serialized[end])) end--;
1247
1239
  const fragment = serialized.slice(fragmentOffset, end);
1248
- const result = JSON.stringify({ success: true, agentKey: agentKey2, offset, digest, fragment, fragmentOffset, nextFragmentOffset: end, hasMoreFragments: end < serialized.length, nextOffset: offset + 1, ...speedContext ? { speedContext: cleanText(speedContext) } : {} });
1240
+ const result = JSON.stringify({ success: true, agentKey: agentKey2, offset, digest, fragment, fragmentOffset, nextFragmentOffset: end, hasMoreFragments: end < serialized.length, nextOffset: offset + 1, ...options.targetedRecheck ? { poolComplete: false } : {}, ...speedContext ? { speedContext: cleanText(speedContext) } : {} });
1249
1241
  return fits(result) ? result : JSON.stringify({ success: false, error: "LIST_AGENTS_FRAGMENT_METADATA_TOO_LARGE", offset });
1250
1242
  }
1251
1243
  const makePage = (count) => {
@@ -1,14 +1,39 @@
1
1
  import {
2
2
  loadCliAuthorityBrokerTls
3
3
  } from "./chunk-3A5NNQCN.js";
4
+ import {
5
+ DIALOG_TURN_DEFAULT_TTL_MS,
6
+ DIALOG_TURN_MAX_PAYLOAD_BYTES,
7
+ isDialogTurnMessageId,
8
+ isDialogTurnRecord,
9
+ validateDialogTurnRequest
10
+ } from "./chunk-EUHMI5KG.js";
4
11
  import {
5
12
  Level,
6
- createLevelAuthorityStore
7
- } from "./chunk-R3MV2GII.js";
13
+ MAX_AUTHORITY_BATCH_GET_KEYS,
14
+ compareUtf8Keys,
15
+ createBatchedStoreIterator,
16
+ createLevelAuthorityStore,
17
+ readIteratorWindow
18
+ } from "./chunk-KGWE224L.js";
8
19
  import {
20
+ CLI_AUTHORITY_BROKER_PROTOCOL_VERSION,
21
+ MAX_BROKER_ITERATE_PAGE_LIMIT,
9
22
  createCliAuthorityBrokerClient,
10
23
  createCliAuthorityBrokerSocketInvoker
11
- } from "./chunk-SQL7YNED.js";
24
+ } from "./chunk-LPXBBC32.js";
25
+ import {
26
+ toErrorMessage
27
+ } from "./chunk-HNMXYYJR.js";
28
+ import {
29
+ isLevelNotFoundError
30
+ } from "./chunk-OW765XBU.js";
31
+ import {
32
+ createKey
33
+ } from "./chunk-DLXL4NSL.js";
34
+ import {
35
+ dialogMessageKey
36
+ } from "./chunk-OJKUU3LP.js";
12
37
  import {
13
38
  getLogger
14
39
  } from "./chunk-EYLGAEB4.js";
@@ -16,16 +41,267 @@ import {
16
41
  getHostRuntimeExecutable,
17
42
  isCompiledBinary,
18
43
  resolveCliEntrypointPath
19
- } from "./chunk-BIDSIRTS.js";
20
- import {
21
- toErrorMessage
22
- } from "./chunk-HNMXYYJR.js";
44
+ } from "./chunk-LTCZOOAM.js";
23
45
 
24
46
  // packages/cli/cliAuthorityBrokerProcess.ts
25
47
  import { spawn } from "node:child_process";
26
48
  import { dirname, isAbsolute, resolve } from "node:path";
27
49
  import { setTimeout as delay } from "node:timers/promises";
28
50
 
51
+ // packages/database-engine/dialogTurnAuthority.ts
52
+ import { createHash, randomUUID } from "node:crypto";
53
+ var DIALOG_TURN_STATE_PREFIX = "dialog-turn-state:";
54
+ var DIALOG_TURN_IDEM_PREFIX = "dialog-turn-idem:";
55
+ var isDialogTurnAuthorityReservedKey = (key) => typeof key === "string" && (key.startsWith(DIALOG_TURN_STATE_PREFIX) || key.startsWith(DIALOG_TURN_IDEM_PREFIX));
56
+ var dialogTurnNamespaceKey = (dialogId) => `${DIALOG_TURN_STATE_PREFIX}:owner:${dialogId}`;
57
+ var dialogTurnStateKey = ({ userId, dialogId }) => `${DIALOG_TURN_STATE_PREFIX}${userId}:${dialogId}`;
58
+ var keysFor = ({ userId, dialogId }) => ({
59
+ dialogKey: createKey("dialog" /* DIALOG */, userId, dialogId),
60
+ stateKey: dialogTurnStateKey({ userId, dialogId }),
61
+ namespaceKey: dialogTurnNamespaceKey(dialogId),
62
+ idemKey: (commandId) => `${DIALOG_TURN_IDEM_PREFIX}${userId}:${dialogId}:${commandId}`
63
+ });
64
+ var queues = /* @__PURE__ */ new WeakMap();
65
+ function serialize(store, key, task) {
66
+ let tails = queues.get(store);
67
+ if (!tails) queues.set(store, tails = /* @__PURE__ */ new Map());
68
+ const current = (tails.get(key) ?? Promise.resolve()).then(task);
69
+ const settled = current.then(() => void 0, () => void 0);
70
+ tails.set(key, settled);
71
+ void settled.then(() => {
72
+ if (tails.get(key) === settled) tails.delete(key);
73
+ });
74
+ return current;
75
+ }
76
+ async function getOptional(store, key) {
77
+ try {
78
+ return await store.get(key);
79
+ } catch (error) {
80
+ if (isLevelNotFoundError(error)) return void 0;
81
+ throw error;
82
+ }
83
+ }
84
+ function summarize(turn) {
85
+ if (!turn) return null;
86
+ const { runId, holder, holderKind, startedAt, heartbeatAt, expiresAt } = turn;
87
+ return { runId, holder, holderKind, startedAt, heartbeatAt, expiresAt };
88
+ }
89
+ function revisionOf(row) {
90
+ return isDialogTurnRecord(row) && typeof row.dialogRevision === "number" ? row.dialogRevision : 0;
91
+ }
92
+ function fingerprint(value) {
93
+ const hash = createHash("sha256");
94
+ let bytes = 0;
95
+ const tooLarge = Symbol();
96
+ const invalid = Symbol();
97
+ const add = (part) => {
98
+ bytes += Buffer.byteLength(part);
99
+ if (bytes > DIALOG_TURN_MAX_PAYLOAD_BYTES) throw tooLarge;
100
+ hash.update(part);
101
+ };
102
+ const visit = (item, depth) => {
103
+ if (depth > 64) throw invalid;
104
+ if (item === null || typeof item === "boolean" || typeof item === "string" || typeof item === "number" && Number.isFinite(item)) {
105
+ if (typeof item === "string" && item.length > DIALOG_TURN_MAX_PAYLOAD_BYTES) throw tooLarge;
106
+ add(JSON.stringify(item));
107
+ } else if (Array.isArray(item)) {
108
+ add("[");
109
+ for (let i = 0; i < item.length; i++) {
110
+ if (i) add(",");
111
+ visit(item[i], depth + 1);
112
+ }
113
+ add("]");
114
+ } else if (isDialogTurnRecord(item)) {
115
+ add("{");
116
+ for (const [index, key] of Object.keys(item).sort().entries()) {
117
+ if (index) add(",");
118
+ add(JSON.stringify(key));
119
+ add(":");
120
+ visit(item[key], depth + 1);
121
+ }
122
+ add("}");
123
+ } else throw invalid;
124
+ };
125
+ try {
126
+ visit(value, 0);
127
+ return { hash: hash.digest("hex") };
128
+ } catch (error) {
129
+ if (error !== tooLarge && error !== invalid) throw error;
130
+ return { status: error === tooLarge ? "payload_too_large" : "invalid_request", field: "payload" };
131
+ }
132
+ }
133
+ var titleFields = ["title", "titleSource", "titleUpdatedAt"];
134
+ function createDialogTurnAuthority(store, options = {}) {
135
+ const now = options.now ?? Date.now;
136
+ const guarded = (task) => store.runPublicationBatch && typeof store.batchWrite === "function" ? store.runPublicationBatch((access) => task({
137
+ ...access,
138
+ put: (key, value) => access.batchWrite([{ type: "put", key, value }]),
139
+ del: (key) => access.batchWrite([{ type: "del", key }])
140
+ })) : task(store);
141
+ const run = (method, raw, task) => {
142
+ const parsed = validateDialogTurnRequest(method, raw);
143
+ if (!parsed.ok) return Promise.resolve(parsed.error);
144
+ const keys = keysFor(parsed.input.dialogRef);
145
+ return serialize(store, keys.namespaceKey, () => guarded((access) => task(parsed.input, keys, access)));
146
+ };
147
+ const active = async (access, key) => await getOptional(access, key) ?? null;
148
+ const checkNamespace = async (access, { namespaceKey, dialogKey }, ref, row) => {
149
+ const owner = await getOptional(access, namespaceKey);
150
+ if (owner !== void 0 && owner !== dialogKey) return "forbidden";
151
+ if (options.verifyNamespace && (owner === void 0 || row !== void 0) && !await options.verifyNamespace(ref, row)) return "forbidden";
152
+ return owner === void 0 ? "unclaimed" : "claimed";
153
+ };
154
+ return {
155
+ getDialogTurnState: (raw) => run("getDialogTurnState", raw, async (_, { dialogKey, stateKey }, access) => ({
156
+ ok: true,
157
+ dialogKey,
158
+ dialogRevision: revisionOf(await getOptional(access, dialogKey)),
159
+ activeTurn: summarize(await active(access, stateKey))
160
+ })),
161
+ beginDialogTurn: (raw) => run("beginDialogTurn", raw, async (input, { dialogKey, stateKey, namespaceKey }, access) => {
162
+ const current = await active(access, stateKey);
163
+ const row = await getOptional(access, dialogKey);
164
+ const dialogRevision = revisionOf(row);
165
+ const namespace = options.verifyNamespace ? await checkNamespace(access, { namespaceKey, dialogKey }, input.dialogRef, row) : void 0;
166
+ if (namespace === "forbidden") return { status: "forbidden" };
167
+ const replayed = current !== null;
168
+ if (current && (current.runId !== input.runId || current.holder !== input.holder || current.holderKind !== input.holderKind)) {
169
+ return { status: "busy", dialogRevision, activeTurn: summarize(current) };
170
+ }
171
+ const timestamp = now();
172
+ const turn = current ?? {
173
+ runId: input.runId,
174
+ runToken: randomUUID(),
175
+ holder: input.holder,
176
+ holderKind: input.holderKind,
177
+ startedAt: timestamp,
178
+ heartbeatAt: timestamp,
179
+ expiresAt: timestamp + (input.ttlMs ?? DIALOG_TURN_DEFAULT_TTL_MS)
180
+ };
181
+ if (namespace === "unclaimed") {
182
+ if (typeof access.batchWrite !== "function") return { status: "atomic_batch_unsupported" };
183
+ await access.batchWrite([{ type: "put", key: namespaceKey, value: dialogKey }, { type: "put", key: stateKey, value: turn }]);
184
+ } else if (!replayed) await access.put(stateKey, turn);
185
+ return { status: "acquired", replayed, dialogRevision, activeTurn: turn };
186
+ }),
187
+ heartbeatDialogTurn: (raw) => run("heartbeatDialogTurn", raw, async (input, { stateKey }, access) => {
188
+ const current = await active(access, stateKey);
189
+ if (!current || current.runToken !== input.runToken) return { status: "token_mismatch", activeTurn: summarize(current) };
190
+ const heartbeatAt = Math.max(now(), current.heartbeatAt);
191
+ const turn = { ...current, heartbeatAt, expiresAt: heartbeatAt + (input.ttlMs ?? DIALOG_TURN_DEFAULT_TTL_MS) };
192
+ await access.put(stateKey, turn);
193
+ return { status: "renewed", activeTurn: turn };
194
+ }),
195
+ endDialogTurn: (raw) => run("endDialogTurn", raw, async (input, { stateKey }, access) => {
196
+ const current = await active(access, stateKey);
197
+ if (!current) return { status: "already_idle" };
198
+ if (input.runToken !== void 0 ? current.runToken !== input.runToken : current.runId !== input.expectedRunId) {
199
+ return { status: "token_mismatch", activeTurn: summarize(current) };
200
+ }
201
+ await access.del(stateKey);
202
+ return { status: "ended" };
203
+ }),
204
+ commitDialogTurn: (raw) => run("commitDialogTurn", raw, async (input, keys, access) => {
205
+ const { dialogKey, stateKey, namespaceKey, idemKey } = keys;
206
+ if (typeof access.batchWrite !== "function") return { status: "atomic_batch_unsupported" };
207
+ const { mode, dialogRef, runToken, commandId, baseRevision, dialogRecord, messageRecords, keepTurnActive } = input;
208
+ const idleSync = mode === "idle_sync";
209
+ const idleStored = idleSync ? await getOptional(access, dialogKey) : void 0;
210
+ const namespace = idleSync ? await checkNamespace(access, keys, dialogRef, idleStored) : void 0;
211
+ if (namespace === "forbidden") return { status: "forbidden" };
212
+ const { userId, dialogId } = dialogRef;
213
+ if (dialogRecord.id !== void 0 && dialogRecord.id !== dialogId || dialogRecord.userId !== void 0 && dialogRecord.userId !== userId || dialogRecord.type !== void 0 && dialogRecord.type !== "dialog" /* DIALOG */) {
214
+ return { status: "invalid_request", field: "dialogRecord" };
215
+ }
216
+ const prefix = dialogMessageKey(dialogId, "");
217
+ const seen = /* @__PURE__ */ new Set();
218
+ for (const { key, value } of messageRecords) {
219
+ const messageId = key.slice(prefix.length);
220
+ if (!key.startsWith(prefix) || !isDialogTurnMessageId(messageId) || seen.has(key) || value.id !== void 0 && value.id !== messageId) return { status: "invalid_message_key", field: "messageRecords" };
221
+ seen.add(key);
222
+ }
223
+ const digest = fingerprint({
224
+ method: "commit",
225
+ baseRevision,
226
+ dialogRecord,
227
+ messageRecords,
228
+ ...idleSync ? { mode } : { runToken, keepTurnActive: keepTurnActive === true }
229
+ });
230
+ if (!("hash" in digest)) return digest;
231
+ const receiptKey = idemKey(commandId);
232
+ const prior = await getOptional(access, receiptKey);
233
+ if (prior !== void 0) return prior.hash === digest.hash ? { status: "committed", replayed: true, dialogRevision: prior.dialogRevision, commandId, committedAt: prior.committedAt } : { status: "idempotency_conflict", commandId };
234
+ const current = await active(access, stateKey);
235
+ const stored = idleSync ? idleStored : await getOptional(access, dialogKey);
236
+ const storedRevision = revisionOf(stored);
237
+ if (idleSync) {
238
+ if (current) return { ok: true, status: "busy", dialogKey, dialogRevision: storedRevision, activeTurn: summarize(current) };
239
+ } else if (!current || current.runToken !== runToken) {
240
+ return { status: "fenced", activeTurn: summarize(current), dialogRevision: storedRevision };
241
+ }
242
+ if (storedRevision !== baseRevision) return { status: "revision_conflict", expectedRevision: baseRevision, actualRevision: storedRevision };
243
+ if (!idleSync && options.verifyNamespace && (await getOptional(access, namespaceKey) !== dialogKey || stored !== void 0 && !await options.verifyNamespace(dialogRef, stored))) return { status: "forbidden" };
244
+ const dialogRevision = baseRevision + 1;
245
+ const committedAt = now();
246
+ await access.batchWrite([
247
+ ...messageRecords.map(({ key, value }) => ({ type: "put", key, value })),
248
+ { type: "put", key: dialogKey, value: {
249
+ ...dialogRecord,
250
+ // A history writer may have read the header before a narrow memory patch.
251
+ ...isDialogTurnRecord(stored) && Object.hasOwn(stored, "memoryCaptureResult") ? { memoryCaptureResult: stored.memoryCaptureResult } : {},
252
+ ...isDialogTurnRecord(stored) && Object.hasOwn(stored, "memoryEvents") ? { memoryEvents: stored.memoryEvents } : {},
253
+ id: dialogId,
254
+ userId,
255
+ type: "dialog" /* DIALOG */,
256
+ dbKey: dialogKey,
257
+ dialogRevision
258
+ } },
259
+ { type: "put", key: receiptKey, value: { ...digest, dialogRevision, committedAt } },
260
+ ...namespace === "unclaimed" ? [{ type: "put", key: namespaceKey, value: dialogKey }] : [],
261
+ ...!idleSync && keepTurnActive !== true ? [{ type: "del", key: stateKey }] : []
262
+ ]);
263
+ return { status: "committed", replayed: false, dialogRevision, commandId, committedAt };
264
+ }),
265
+ patchDialogMetadata: (raw) => run("patchDialogMetadata", raw, async (input, { dialogKey, idemKey }, access) => {
266
+ const { patch, commandId, expectedTitleUpdatedAt } = input;
267
+ const key = commandId === void 0 ? void 0 : idemKey(commandId);
268
+ if (key && typeof access.batchWrite !== "function") return { status: "atomic_batch_unsupported" };
269
+ const digest = fingerprint({ method: "metadata", patch, ...expectedTitleUpdatedAt !== void 0 ? { expectedTitleUpdatedAt } : {} });
270
+ if (!("hash" in digest)) return digest;
271
+ const prior = key ? await getOptional(access, key) : void 0;
272
+ if (prior !== void 0) return prior.hash === digest.hash ? { status: "patched", replayed: true, dialogRevision: prior.dialogRevision } : { status: "idempotency_conflict", commandId };
273
+ const row = await getOptional(access, dialogKey);
274
+ if (!isDialogTurnRecord(row) || row.deletedAt) return { status: "not_found" };
275
+ if (expectedTitleUpdatedAt !== void 0 && (row.titleUpdatedAt ?? null) !== expectedTitleUpdatedAt) return { status: "title_conflict" };
276
+ if (row.titleSource === "manual" && titleFields.some((field) => Object.hasOwn(patch, field)) && patch.titleSource !== "manual") {
277
+ return { status: "manual_title_protected" };
278
+ }
279
+ const dialogRevision = revisionOf(row);
280
+ const { memoryEvents, ...fields } = patch;
281
+ const value = { ...row, ...fields };
282
+ if (memoryEvents) {
283
+ const events = Array.isArray(row.memoryEvents) ? [...row.memoryEvents] : [];
284
+ const eventKey = (event) => isDialogTurnRecord(event) ? JSON.stringify([event.type, event.sourceKind, event.content]) : void 0;
285
+ const seen = new Set(events.map(eventKey));
286
+ for (const event of memoryEvents) {
287
+ const key2 = eventKey(event);
288
+ if (!seen.has(key2)) {
289
+ events.push(event);
290
+ seen.add(key2);
291
+ }
292
+ }
293
+ value.memoryEvents = events;
294
+ }
295
+ if (key) await access.batchWrite([
296
+ { type: "put", key: dialogKey, value },
297
+ { type: "put", key, value: { ...digest, dialogRevision, committedAt: now() } }
298
+ ]);
299
+ else await access.put(dialogKey, value);
300
+ return { status: "patched", dialogRevision, replayed: false };
301
+ })
302
+ };
303
+ }
304
+
29
305
  // packages/database-engine/cliAuthorityBrokerServer.ts
30
306
  import fs3 from "node:fs";
31
307
  import path3 from "node:path";
@@ -251,43 +527,55 @@ function removeFileIfPresent(filePath) {
251
527
  } catch {
252
528
  }
253
529
  }
254
- async function buildIteratorPage(store, request) {
530
+ async function buildIteratorPage(store, request, limit) {
531
+ if (limit === 0) return { entries: [], nextCursor: null, done: true };
255
532
  const base = request.options ?? {};
256
533
  const reverse = base.reverse === true;
257
534
  const cursor = typeof request.cursor === "string" && request.cursor.length > 0 ? request.cursor : void 0;
258
535
  const iterOptions = { ...base };
259
- if (cursor) {
536
+ delete iterOptions.limit;
537
+ const cursorBytes = cursor === void 0 ? void 0 : Buffer.from(cursor);
538
+ if (cursor !== void 0 && cursorBytes !== void 0) {
260
539
  if (reverse) {
261
- if (iterOptions.lte !== void 0 && iterOptions.lte < cursor) {
540
+ if (iterOptions.lte !== void 0 && compareUtf8Keys(iterOptions.lte, cursorBytes) < 0) {
262
541
  } else {
263
542
  delete iterOptions.lte;
264
- iterOptions.lt = iterOptions.lt !== void 0 && iterOptions.lt < cursor ? iterOptions.lt : cursor;
543
+ iterOptions.lt = iterOptions.lt !== void 0 && compareUtf8Keys(iterOptions.lt, cursorBytes) < 0 ? iterOptions.lt : cursor;
265
544
  }
266
545
  } else {
267
- if (iterOptions.gte !== void 0 && iterOptions.gte > cursor) {
546
+ if (iterOptions.gte !== void 0 && compareUtf8Keys(iterOptions.gte, cursorBytes) > 0) {
268
547
  } else {
269
548
  delete iterOptions.gte;
270
- iterOptions.gt = iterOptions.gt !== void 0 && iterOptions.gt > cursor ? iterOptions.gt : cursor;
549
+ iterOptions.gt = iterOptions.gt !== void 0 && compareUtf8Keys(iterOptions.gt, cursorBytes) > 0 ? iterOptions.gt : cursor;
271
550
  }
272
551
  }
273
552
  }
274
- const limit = Math.max(0, Math.floor(request.limit ?? DEFAULT_ITERATOR_LIMIT));
553
+ const baseGt = base.gt === void 0 ? void 0 : Buffer.from(base.gt);
275
554
  const entries = [];
276
555
  let hasMore = false;
277
- for await (const entry of store.iterator(iterOptions)) {
278
- const [key] = entry;
279
- if (cursor && (reverse ? key >= cursor : key <= cursor)) {
280
- continue;
281
- }
282
- if (base.gt !== void 0 && key <= base.gt) {
283
- continue;
284
- }
285
- if (entries.length >= limit) {
286
- hasMore = true;
287
- break;
556
+ await readIteratorWindow(createBatchedStoreIterator(store, iterOptions), {
557
+ batchSize: () => Math.min(Math.max(1, limit + 1 - entries.length), 256),
558
+ onBatch: (chunk) => {
559
+ for (const entry of chunk) {
560
+ const [key] = entry;
561
+ if (isDialogTurnAuthorityReservedKey(key)) continue;
562
+ if (cursorBytes || baseGt) {
563
+ const keyBytes = Buffer.from(key);
564
+ if (cursorBytes) {
565
+ const order = compareUtf8Keys(keyBytes, cursorBytes);
566
+ if (reverse ? order >= 0 : order <= 0) continue;
567
+ }
568
+ if (baseGt && compareUtf8Keys(keyBytes, baseGt) <= 0) continue;
569
+ }
570
+ if (entries.length >= limit) {
571
+ hasMore = true;
572
+ return false;
573
+ }
574
+ entries.push(entry);
575
+ }
576
+ return true;
288
577
  }
289
- entries.push(entry);
290
- }
578
+ });
291
579
  const lastEntry = entries.at(-1) ?? null;
292
580
  return {
293
581
  entries,
@@ -331,7 +619,7 @@ function validConditionalPut(request) {
331
619
  function dispatchCliAuthorityBrokerRequest(store, request) {
332
620
  const state = ownerQueue(store);
333
621
  if (state.closed) return Promise.resolve({ ok: false, error: { code: "BROKER_CLOSING", message: "Authority broker is closing" } });
334
- const isRead = request?.type === "get" || request?.type === "batchGet" || request?.type === "status" || request?.type === "iterator" || request?.type === "close";
622
+ const isRead = request?.type === "dialogTurnGetState" || request?.type === "get" || request?.type === "batchGet" || request?.type === "status" || request?.type === "iterator" || request?.type === "close";
335
623
  const execute = () => executeCliAuthorityBrokerRequest(store, request);
336
624
  const result = isRead ? Promise.resolve().then(execute) : state.tail.then(execute);
337
625
  if (!isRead) state.tail = result.catch(() => void 0);
@@ -345,24 +633,46 @@ async function executeCliAuthorityBrokerRequest(store, request) {
345
633
  if (!request || typeof request !== "object") {
346
634
  return { ok: false, error: { code: "BROKER_INVALID_REQUEST", message: "Invalid broker request" } };
347
635
  }
636
+ const forbidden = { ok: false, error: { code: "BROKER_FORBIDDEN", message: "Reserved dialog turn key" } };
637
+ if ("key" in request && isDialogTurnAuthorityReservedKey(request.key) || request.type === "batchGet" && Array.isArray(request.keys) && request.keys.some(isDialogTurnAuthorityReservedKey) || request.type === "batchWrite" && Array.isArray(request.ops) && request.ops.some((op) => isDialogTurnAuthorityReservedKey(op?.key))) return forbidden;
348
638
  switch (request.type) {
349
- case "conditionalPut": {
350
- if (!validConditionalPut(request)) {
351
- return { ok: false, error: { code: "BROKER_INVALID_REQUEST", message: "Invalid conditionalPut request" } };
639
+ case "dialogTurnGetState":
640
+ return { ok: true, result: { type: request.type, response: await createDialogTurnAuthority(store).getDialogTurnState(request.input) } };
641
+ case "dialogTurnBegin":
642
+ return { ok: true, result: { type: request.type, response: await createDialogTurnAuthority(store).beginDialogTurn(request.input) } };
643
+ case "dialogTurnHeartbeat":
644
+ return { ok: true, result: { type: request.type, response: await createDialogTurnAuthority(store).heartbeatDialogTurn(request.input) } };
645
+ case "dialogTurnEnd":
646
+ return { ok: true, result: { type: request.type, response: await createDialogTurnAuthority(store).endDialogTurn(request.input) } };
647
+ case "dialogTurnCommit":
648
+ return { ok: true, result: { type: request.type, response: await createDialogTurnAuthority(store).commitDialogTurn(request.input) } };
649
+ case "dialogTurnPatchMetadata":
650
+ return { ok: true, result: { type: request.type, response: await createDialogTurnAuthority(store).patchDialogMetadata(request.input) } };
651
+ case "conditionalPut":
652
+ case "conditionalDelete": {
653
+ const deleting = request.type === "conditionalDelete";
654
+ const valid = deleting ? Object.keys(request).length === 3 && typeof request.key === "string" && request.key.length > 0 && Number.isSafeInteger(request.expectedRevision) && request.expectedRevision >= 0 : validConditionalPut(request);
655
+ if (!valid) {
656
+ return { ok: false, error: { code: "BROKER_INVALID_REQUEST", message: `Invalid ${request.type} request` } };
352
657
  }
353
658
  let current;
354
659
  try {
355
660
  current = await store.get(request.key);
356
661
  } catch (error) {
357
- if (error?.code !== "LEVEL_NOT_FOUND") throw error;
662
+ if (!isLevelNotFoundError(error)) throw error;
358
663
  }
359
664
  const matches = request.expectedRevision === null ? current === void 0 : typeof current === "object" && current !== null && !Array.isArray(current) && Object.hasOwn(current, "revision") && current.revision === request.expectedRevision;
360
- if (!matches) return { ok: true, result: { type: "conditionalPut", status: "conflict" } };
361
- await store.put(request.key, request.value);
362
- return { ok: true, result: { type: "conditionalPut", status: "updated" } };
665
+ if (!matches) return { ok: true, result: { type: request.type, status: "conflict" } };
666
+ if (deleting) await store.del(request.key);
667
+ else await store.put(request.key, request.value);
668
+ return { ok: true, result: { type: request.type, status: "updated" } };
363
669
  }
364
670
  case "status":
365
- return { ok: true, result: { type: "status", ...request.includeLocation && store.location ? { location: store.location } : {} } };
671
+ return { ok: true, result: {
672
+ type: "status",
673
+ protocolVersion: CLI_AUTHORITY_BROKER_PROTOCOL_VERSION,
674
+ ...request.includeLocation && store.location ? { location: store.location } : {}
675
+ } };
366
676
  case "open":
367
677
  await store.open();
368
678
  return { ok: true, result: { type: "open" } };
@@ -374,6 +684,19 @@ async function executeCliAuthorityBrokerRequest(store, request) {
374
684
  if (!Array.isArray(request.keys) || !request.keys.every((key) => typeof key === "string")) {
375
685
  return { ok: false, error: { code: "BROKER_INVALID_REQUEST", message: "Invalid batchGet request" } };
376
686
  }
687
+ if (request.keys.length > MAX_AUTHORITY_BATCH_GET_KEYS) {
688
+ return {
689
+ ok: false,
690
+ error: {
691
+ code: "BROKER_INVALID_REQUEST",
692
+ message: `batchGet exceeds maximum batch size (${MAX_AUTHORITY_BATCH_GET_KEYS})`
693
+ }
694
+ };
695
+ }
696
+ if (typeof store.batchGet === "function") {
697
+ const items2 = await store.batchGet(request.keys);
698
+ return { ok: true, result: { type: "batchGet", items: items2 } };
699
+ }
377
700
  const items = await Promise.all(
378
701
  request.keys.map(async (key) => {
379
702
  try {
@@ -398,19 +721,24 @@ async function executeCliAuthorityBrokerRequest(store, request) {
398
721
  case "batchWrite":
399
722
  await store.batchWrite(request.ops);
400
723
  return { ok: true, result: { type: "batchWrite" } };
401
- case "iterator":
724
+ case "iterator": {
725
+ const limit = request.limit === void 0 ? DEFAULT_ITERATOR_LIMIT : request.limit;
726
+ if (!Number.isSafeInteger(limit) || limit < 0 || limit > MAX_BROKER_ITERATE_PAGE_LIMIT) {
727
+ return { ok: false, error: { code: "BROKER_INVALID_REQUEST", message: "Invalid iterator page limit" } };
728
+ }
402
729
  return {
403
730
  ok: true,
404
731
  result: {
405
732
  type: "iterator",
406
- page: await buildIteratorPage(store, request)
733
+ page: await buildIteratorPage(store, request, limit)
407
734
  }
408
735
  };
736
+ }
409
737
  default:
410
738
  return { ok: false, error: { code: "BROKER_UNSUPPORTED_REQUEST", message: "Unsupported broker request" } };
411
739
  }
412
740
  } catch (error) {
413
- if (request?.type === "conditionalPut") {
741
+ if (request?.type === "conditionalPut" || request?.type === "conditionalDelete") {
414
742
  return { ok: false, error: { code: "BROKER_CONDITIONAL_WRITE_FAILED", message: "Conditional write failed" } };
415
743
  }
416
744
  return createErrorResponse(error);
@@ -508,6 +836,7 @@ async function createBrokerHandle(options) {
508
836
  const listeningEndpoint = (options.transportMode ?? "socket") === "socket" ? buildListeningEndpoint(server, target) : options.endpoint;
509
837
  writeJsonFile(options.metadataPath, {
510
838
  pid: process.pid,
839
+ protocolVersion: CLI_AUTHORITY_BROKER_PROTOCOL_VERSION,
511
840
  ...options.tls ? { transportSecurity: "mutual-tls" } : {},
512
841
  ...options.supervisorPid === void 0 ? {} : { supervisorPid: options.supervisorPid },
513
842
  endpoint: listeningEndpoint,
@@ -517,6 +846,7 @@ async function createBrokerHandle(options) {
517
846
  writeJsonFile(options.healthPath, {
518
847
  ok: true,
519
848
  pid: process.pid,
849
+ protocolVersion: CLI_AUTHORITY_BROKER_PROTOCOL_VERSION,
520
850
  endpoint: listeningEndpoint,
521
851
  checkedAt: new Date(now()).toISOString()
522
852
  });
@@ -982,6 +1312,7 @@ async function runCliAuthorityBrokerProcess(args) {
982
1312
  }
983
1313
 
984
1314
  export {
1315
+ createDialogTurnAuthority,
985
1316
  startCliAuthorityBrokerProcess,
986
1317
  superviseCliAuthorityBrokerProcess,
987
1318
  runCliAuthorityBrokerProcess