nolo-cli 0.259.0-alpha.1 → 0.260.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/{_executeModel-MTM4BJK3.js → _executeModel-EO6JFCOF.js} +97 -83
- package/accountResolver-NGICIMEE.js +1 -1
- package/{action-C6IQAKN4.js → action-WIA56QT4.js} +12 -10
- package/{addContentAction-53364YDW.js → addContentAction-OCMWZLYG.js} +14 -13
- package/{addDialogAgentAction-U5DD5EN5.js → addDialogAgentAction-ER2NZ7BC.js} +20 -24
- package/{agentDeleteCommand-53NN3VSK.js → agentDeleteCommand-KSXSNPAU.js} +184 -146
- package/{agentEmailCommands-KOGGIT6I.js → agentEmailCommands-NXRWS7NS.js} +142 -126
- package/{agentGrantCommands-L6O2HVJI.js → agentGrantCommands-D2S7LCTU.js} +8 -5
- package/{agentListCommands-62UYUQDI.js → agentListCommands-PFXGZZ3Y.js} +87 -68
- package/{agentMachineCommands-W6TNJXEA.js → agentMachineCommands-2Q55CSL4.js} +68 -59
- package/{agentProviderCommands-QLTABYR7.js → agentProviderCommands-EUNS7Y2Z.js} +10 -7
- package/{agentPullCommand-2EYJ5ENC.js → agentPullCommand-S2VMPSWL.js} +9 -6
- package/agentRecordCommands-FUFI526H.js +210 -0
- package/agentRun-ZNMUPDHF.js +250 -0
- package/agentRunCommand-ISVQ2UYC.js +248 -0
- package/{agentRunControl-LXMADX3N.js → agentRunControl-NEK44LDM.js} +19 -12
- package/{agentRuntimeLocal-YGNJMQW3.js → agentRuntimeLocal-SST4EPLT.js} +62 -49
- package/{agentSlice-3HHYUQLM.js → agentSlice-4ZJJJN4M.js} +15 -18
- package/appConfigCommands-MPHS6FHD.js +417 -0
- package/{appDeleteCommands-5COJ6CSG.js → appDeleteCommands-W26WGENW.js} +68 -58
- package/{appDeployCommands-3JPAT3XO.js → appDeployCommands-ER7IOF5E.js} +74 -59
- package/{appDeployStatusCommands-RHZKF3G4.js → appDeployStatusCommands-VKLL3A77.js} +68 -58
- package/{appGetCommands-73DXOAQW.js → appGetCommands-P6GXJNUD.js} +74 -58
- package/{appListCommands-HD5LOQ3G.js → appListCommands-ACA2IZZM.js} +74 -58
- package/appMigrateCommands-OGF4E2W6.js +230 -0
- package/appSourceCommands-GAHVBRUM.js +279 -0
- package/{authCommand-V6EOMZX6.js → authCommand-PXE7NZTQ.js} +26 -40
- package/{authCommands-T5FODCEG.js → authCommands-AZPYXTUB.js} +20 -17
- package/{builtinSkillRegistry-EDHD2UHU.js → builtinSkillRegistry-6XUWMAV5.js} +8 -6
- package/{chromeOpsCommands-3SSTDFRF.js → chromeOpsCommands-7UKKUOBU.js} +68 -18
- package/{chunk-KLMBM6P6.js → chunk-2CKFROQS.js} +2454 -1115
- package/{chunk-MJBLXJMP.js → chunk-2I4R6ZRV.js} +12 -9
- package/{chunk-FXEPZKNJ.js → chunk-2MIZHEND.js} +506 -64
- package/{chunk-TLE77UJ5.js → chunk-2OROOEOQ.js} +0 -1
- package/{chunk-6RSNVJGO.js → chunk-2ZBPWX7N.js} +4 -4
- package/chunk-35JIFLIG.js +30 -0
- package/{chunk-ZYPXOQS2.js → chunk-3EPED3UO.js} +1 -1
- package/{chunk-DNNPARJK.js → chunk-3QMN3T6L.js} +50 -37
- package/{chunk-DMPZMYH4.js → chunk-3R4AYHJR.js} +13 -1
- package/{chunk-HPDLPEUG.js → chunk-42JZNSAY.js} +267 -234
- package/{chunk-223KZUJ6.js → chunk-4HZCBA4Q.js} +18 -15
- package/{chunk-C5A54QS7.js → chunk-4INJGWE3.js} +18 -5
- package/chunk-4IVMDQBA.js +261 -0
- package/chunk-4Y6CZ2N4.js +82 -0
- package/{chunk-OKAXQFON.js → chunk-52BNL6GP.js} +4 -4
- package/{chunk-KZ4A7EIV.js → chunk-56OAS5RZ.js} +1 -1
- package/{chunk-QGFLVQ6E.js → chunk-6KUTNAPU.js} +4 -14
- package/{chunk-MNFUKRRU.js → chunk-6XAAKRJB.js} +7 -7
- package/{chunk-P27E22MA.js → chunk-6Z6DGDPI.js} +1 -1
- package/chunk-72VWN4VK.js +51 -0
- package/{chunk-L4XST72F.js → chunk-75FZ2Z7C.js} +16027 -17392
- package/{chunk-ADYWV732.js → chunk-76B6YUQS.js} +264 -177
- package/{chunk-MXA54TQM.js → chunk-76K4GTY5.js} +1 -1
- package/{chunk-VNHZJEQN.js → chunk-7HUCUD2I.js} +3 -3
- package/chunk-7LR2IFUH.js +100 -0
- package/{chunk-S73EPYNC.js → chunk-7LS5ATRP.js} +20 -6
- package/{chunk-Y2TCTNUD.js → chunk-7QO6YSA4.js} +4 -4
- package/{chunk-DBJODIZ6.js → chunk-7RYH7YIY.js} +19 -27
- package/{chunk-KHYSFS3W.js → chunk-A454UXB6.js} +148 -73
- package/chunk-AMNZPQCY.js +635 -0
- package/chunk-AMTF6FJD.js +356 -0
- package/{chunk-4MXYCQBS.js → chunk-AQNWWJLH.js} +2 -56
- package/{chunk-WSLL7VV4.js → chunk-B4NA5UJR.js} +9 -9
- package/{chunk-LHCGKAFO.js → chunk-BKP325XS.js} +184 -112
- package/{chunk-PENRYZ4D.js → chunk-BPB3T5EU.js} +4 -7
- package/{chunk-46FETNLF.js → chunk-BTIFQBYW.js} +7 -6
- package/{chunk-2JHGUL5K.js → chunk-BVYHE6QD.js} +2 -2
- package/{chunk-KXOPLLFP.js → chunk-CA7LGAHV.js} +69 -9
- package/{chunk-2FZVXOFX.js → chunk-CEIWXKHP.js} +112 -200
- package/{chunk-AIFQKNPP.js → chunk-CL33RFD7.js} +1 -1
- package/{chunk-MPGR4ZNR.js → chunk-CRGPRAJ4.js} +46 -42
- package/{chunk-P4R5KXU7.js → chunk-CW6LRDSF.js} +5 -5
- package/{chunk-R3TUHCSJ.js → chunk-CZHIOBBK.js} +8 -3
- package/chunk-D3ONA3FP.js +762 -0
- package/chunk-D3SAQ6T7.js +1697 -0
- package/{chunk-PIVTQRX6.js → chunk-DDKA6V6X.js} +111 -12
- package/{chunk-KQHEGELM.js → chunk-DEAII55O.js} +16 -6
- package/{chunk-J55F3IEZ.js → chunk-DKJQEFNG.js} +1 -1
- package/chunk-DLXL4NSL.js +1179 -0
- package/{chunk-EJQE5HB7.js → chunk-DSBRIUX5.js} +4 -2
- package/{chunk-XRGBJHZX.js → chunk-E36V7MPY.js} +9 -5
- package/{chunk-4YPH5KRA.js → chunk-EDKMRDET.js} +1 -1
- package/chunk-EJHLDJWZ.js +58 -0
- package/{chunk-6B2OBX5B.js → chunk-EMFZXJTN.js} +15 -47
- package/chunk-ER6NTALN.js +34 -0
- package/chunk-EUHMI5KG.js +101 -0
- package/{chunk-YQLAFJRQ.js → chunk-FBNVJ2TO.js} +1 -1
- package/{chunk-Q2EERN52.js → chunk-FF5ZRKW7.js} +12 -7
- package/{chunk-YFEK7ACQ.js → chunk-FGD4NMTP.js} +4 -4
- package/{chunk-6XIE5ZGI.js → chunk-FGFJUFPS.js} +5 -6
- package/chunk-FI4DPLR7.js +902 -0
- package/chunk-FKVLQNGJ.js +25 -0
- package/{chunk-JCQ3WCQ3.js → chunk-FOC4TORM.js} +69 -3
- package/{chunk-JPXACKSW.js → chunk-G22P2J7O.js} +30 -81
- package/{chunk-7WHCIA5V.js → chunk-G5IAIGGD.js} +3 -8
- package/{chunk-5BIDJVNX.js → chunk-G5JGA5YM.js} +180 -31
- package/{chunk-57V4PADY.js → chunk-GMBWWBSJ.js} +781 -449
- package/{chunk-WS36XPJD.js → chunk-GYFKKTDI.js} +82 -6
- package/{chunk-KT7S7ANZ.js → chunk-GZ4I5EMM.js} +9 -9
- package/{chunk-324FWHUA.js → chunk-HHXF57CL.js} +12 -3
- package/chunk-HJTI7RZV.js +94 -0
- package/{chunk-QXTEEEIN.js → chunk-HPIY372N.js} +7 -7
- package/{chunk-Q2MPKE4B.js → chunk-HVRG27HI.js} +76 -26
- package/{chunk-HDKMVYNJ.js → chunk-I3NWAILT.js} +6 -4
- package/{chunk-JZO7KUF3.js → chunk-IM7HCFB4.js} +313 -275
- package/{chunk-UWWOWTW2.js → chunk-INN2PBW7.js} +1 -1
- package/chunk-IV6VUVLJ.js +88 -0
- package/chunk-J42X32PV.js +472 -0
- package/{chunk-UA3QTA2S.js → chunk-JHQNWV2C.js} +4441 -2569
- package/{chunk-R7XWZDOH.js → chunk-JUMQJSQF.js} +1423 -282
- package/{chunk-BIDSIRTS.js → chunk-JUNYPVL6.js} +10 -16
- package/chunk-JVEKCQAP.js +222 -0
- package/{chunk-KVMLM5VD.js → chunk-KAHYBAEN.js} +211 -472
- package/chunk-KDDXC2IH.js +148 -0
- package/chunk-KGKTN2NX.js +25 -0
- package/chunk-KGWE224L.js +246 -0
- package/chunk-L3UFGEDU.js +17157 -0
- package/{chunk-CBIGMWMI.js → chunk-LHJB4BXJ.js} +1 -1
- package/{chunk-7OVOZRZF.js → chunk-LIH7WSX5.js} +23 -379
- package/chunk-LJOPY4TL.js +443 -0
- package/{chunk-TRRXYFTR.js → chunk-LOFRSJX2.js} +1 -0
- package/{chunk-SQL7YNED.js → chunk-LPXBBC32.js} +71 -5
- package/chunk-LXP53WGF.js +168 -0
- package/chunk-MDAYRIP7.js +1889 -0
- package/chunk-MRACVEPZ.js +7 -0
- package/chunk-NHLLXINQ.js +8 -0
- package/{chunk-FP37ELBT.js → chunk-NTBTVKKB.js} +17 -25
- package/{chunk-LVZVSLKO.js → chunk-O7ZY6SUK.js} +5 -22
- package/{chunk-2C5VN7NH.js → chunk-P4XAHM4B.js} +1 -1
- package/chunk-PL5RKESU.js +40 -0
- package/{chunk-MHKPUGPD.js → chunk-PQ3QZMJK.js} +20 -4
- package/chunk-Q5FJJ6XI.js +103 -0
- package/{createAgentAutomationAction-GRZ6XY7Q.js → chunk-QKM55LP2.js} +3 -160
- package/{chunk-6YX2RAQN.js → chunk-QZCLCAYC.js} +89 -164
- package/{chunk-FE7G6DSP.js → chunk-R72QWIFO.js} +14 -4
- package/{chunk-JLZJL3WC.js → chunk-RDZ5OIAT.js} +370 -39
- package/{chunk-5RGU3J7P.js → chunk-REAE2SZK.js} +0 -1
- package/chunk-RF576RYE.js +117 -0
- package/chunk-RI7SXDJW.js +1317 -0
- package/{chunk-FEIVARWR.js → chunk-RIOAPUGV.js} +238 -25
- package/{chunk-2CT2J3O6.js → chunk-RL6H2A2Z.js} +2493 -4055
- package/{chunk-BZLGPM5B.js → chunk-RNLKWUVY.js} +7 -12
- package/{chunk-J7JRCOIW.js → chunk-RWXHGPWJ.js} +1 -1
- package/chunk-S7BF2OGX.js +432 -0
- package/{chunk-6VEO7Z3Y.js → chunk-SD4MBKZ7.js} +6 -6
- package/{chunk-KWNVPY6M.js → chunk-SGEBRBF3.js} +7 -4
- package/{chunk-6SOWMEAY.js → chunk-SR57FDTX.js} +2 -258
- package/{chunk-CEKRIR22.js → chunk-SU4NCTW4.js} +1 -1
- package/{chunk-Y2GWUBNS.js → chunk-SX6PDLBZ.js} +279 -149
- package/{chunk-XNNBXUEM.js → chunk-T4WU747C.js} +5 -5
- package/{chunk-53W5BXLN.js → chunk-TCOHWKDM.js} +54 -55
- package/{chunk-QIGQFON2.js → chunk-TXMFSGRY.js} +1 -1
- package/{chunk-UUCYUN6Y.js → chunk-UB7NV7NN.js} +1 -1
- package/{chunk-NCFKHYDM.js → chunk-UOLGGEEC.js} +774 -119
- package/{chunk-4EACJPZI.js → chunk-USFG4EWQ.js} +51 -42
- package/{chunk-LLUBUHNT.js → chunk-UYZOBSSO.js} +5 -9
- package/{chunk-XPETQ4MR.js → chunk-VDC3BW24.js} +24 -10
- package/chunk-VH356OQ3.js +425 -0
- package/{chunk-U6QNVOR5.js → chunk-VKM7DOYB.js} +130 -6
- package/{chunk-CJOOF4L5.js → chunk-VPAO5WQX.js} +17 -14
- package/{chunk-OYUMJMC5.js → chunk-W2RQYNPI.js} +5 -0
- package/{chunk-6BMTKYAO.js → chunk-W2Z5E2R7.js} +126 -698
- package/{chunk-4ZCTKB27.js → chunk-W5GKF5ZW.js} +1 -0
- package/{chunk-NUHQO3RB.js → chunk-WIVVNJUS.js} +1 -1
- package/chunk-WLJNHFEB.js +1710 -0
- package/chunk-WMBJDXMY.js +408 -0
- package/chunk-WSQLCWLQ.js +201 -0
- package/{chunk-YN23INFZ.js → chunk-WXD6Y7DW.js} +23 -2
- package/{chunk-OOVOAG4Q.js → chunk-WY6DMHMG.js} +1 -1
- package/{chunk-6K32PBRY.js → chunk-XJW6SLBZ.js} +3 -3
- package/{chunk-7BIJFGKS.js → chunk-XQFDCRG3.js} +105 -51
- package/chunk-XT6C2QZW.js +46 -0
- package/{chunk-5YS6QHGT.js → chunk-Y7THFNVJ.js} +9 -9
- package/{chunk-ZEZC7IIM.js → chunk-YFSM2366.js} +35 -35
- package/{chunk-RD3QLZQV.js → chunk-YM5XULB2.js} +324 -2
- package/{chunk-FZENZCIA.js → chunk-YNP3ITPU.js} +19 -12
- package/{chunk-U35UUM5K.js → chunk-YOUSQIIK.js} +1 -1
- package/{chunk-RIWKZT7E.js → chunk-YRPIUIEQ.js} +11 -9
- package/{chunk-IYLUK67R.js → chunk-YU235GGN.js} +25 -8
- package/chunk-YWEZSBLL.js +790 -0
- package/chunk-Z3KTXWWB.js +76 -0
- package/{chunk-YLAHYLDQ.js → chunk-ZC3CMUKU.js} +2 -89
- package/chunk-ZD7OULYZ.js +368 -0
- package/{chunk-5P3PPQVP.js → chunk-ZQAADXSF.js} +1 -1
- package/{chunk-HQUGB2HM.js → chunk-ZTCMXPIS.js} +62 -50
- package/{cliAgentConfigHelpers-BXHQ3PXP.js → cliAgentConfigHelpers-KMXS7JP5.js} +20 -14
- package/{cliAuthorityBrokerClient-TFNXJLXL.js → cliAuthorityBrokerClient-3SKOA7OZ.js} +3 -1
- package/cliAuthorityBrokerProcess-DCCUT4YQ.js +34 -0
- package/{cliEnvHelpers-CNMP3RDX.js → cliEnvHelpers-YDGDHIEE.js} +5 -2
- package/{cliExecutor-K6FDZTQ2.js → cliExecutor-Z62UBJ5S.js} +12 -6
- package/cliLocalAgentRecordReader-X2YHEBWI.js +113 -0
- package/cloudAutomationCommands-C6Q3BFRB.js +310 -0
- package/{commandRegistry-IFYQLPGM.js → commandRegistry-TYYYTW5E.js} +260 -121
- package/{contentThunks-QCFCD2X3.js → contentThunks-E6BJ5YSX.js} +45 -43
- package/{cooldownCommands-WDOI5VD7.js → cooldownCommands-FPAFS7XG.js} +1 -1
- package/createAgentAutomationAction-L3NLCIIW.js +172 -0
- package/{createDialogAction-ZAJERW62.js → createDialogAction-QSWKRPWQ.js} +46 -42
- package/{createPageAction-QCVBMP4C.js → createPageAction-ZVVUT4CZ.js} +49 -45
- package/{db-VR74ADGC.js → db-KTQ3LL2Q.js} +3 -3
- package/{dbSlice-RWPSVHBC.js → dbSlice-SEVKNA7A.js} +21 -16
- package/deleteDbKey-43MTK2DI.js +86 -0
- package/{dialogCommands-4IEQUALS.js → dialogCommands-UVMTIFSA.js} +80 -66
- package/{dialogMessageRecord-OAV77LT7.js → dialogMessageRecord-2HJTEXQX.js} +1 -1
- package/{dialogNotifyCommand-IASQGEMW.js → dialogNotifyCommand-LMWF7EQI.js} +22 -14
- package/dialogPortabilityCommands-PAMLEBST.js +3036 -0
- package/{dialogSlice-XFYID6KE.js → dialogSlice-VHPXENDZ.js} +43 -42
- package/{dialogTraceCommand-Y67NRFCV.js → dialogTraceCommand-SO2WKAXW.js} +83 -69
- package/{dialogUsageCommand-WJ3U6KZU.js → dialogUsageCommand-EUO6JXTD.js} +6 -3
- package/{docCreateCommands-QLRIWRQE.js → docCreateCommands-H4RLIUNX.js} +68 -59
- package/{docDeleteCommands-XPRYA532.js → docDeleteCommands-OVAKCBMT.js} +68 -59
- package/{docReadCommands-EXQI7ETH.js → docReadCommands-KFISIUVA.js} +67 -58
- package/{docStore-MWFUKZL2.js → docStore-X7BEA735.js} +16 -17
- package/{docUpdateCommands-EFBFQV77.js → docUpdateCommands-VOEER36L.js} +68 -59
- package/{ebookDownloaderAgentCommand-DYSKF5ZY.js → ebookDownloaderAgentCommand-2DHPGEOQ.js} +14 -17
- package/{fetchMessages-TQEUZD7H.js → fetchMessages-RGPIYEPZ.js} +2 -2
- package/{getPricing-5BLZRPTM.js → getPricing-BK6CUBAE.js} +8 -4
- package/{handleSendMessageAction-GG3TR62X.js → handleSendMessageAction-GQ2KKOET.js} +265 -119
- package/{hostCredentialCreate-26S6DDJ5.js → hostCredentialCreate-PJAIKZQP.js} +138 -122
- package/index.js +35 -21
- package/{keys-RWF7UCB4.js → keys-FXEGMKSG.js} +2 -2
- package/localAutomationCommands-UU66LOWB.js +198 -0
- package/localAutomationRuntime-SW4R42SZ.js +60 -0
- package/{localDialogRead-BJJT3TF5.js → localDialogRead-W2EVXISA.js} +2 -2
- package/{localRuntimeAdapter-VREWZWPC.js → localRuntimeAdapter-WRBLXFUZ.js} +136 -119
- package/localRuntimeAuthority-3YDFZD3L.js +44 -0
- package/{localRuntimeDb-ZJFGNHML.js → localRuntimeDb-CJWJK47G.js} +1 -1
- package/{machineCommands-CL5XK5UC.js → machineCommands-JFYED66N.js} +251 -357
- package/{machineInfo-LWHTEBHJ.js → machineInfo-BJIU3WQ5.js} +4 -2
- package/machineWsRunDispatch-CZUV2FXE.js +227 -0
- package/{mcpLocalAuthorizeCommand-RBXJDE6J.js → mcpLocalAuthorizeCommand-HLU72QME.js} +40 -22
- package/mcpLocalManageCommands-OHHU6F5C.js +212 -0
- package/{memberThunks-43B7UYC5.js → memberThunks-FJW4GPM5.js} +102 -22
- package/{memoryCommands-BC6REPQB.js → memoryCommands-2RLHDMU2.js} +25 -34
- package/{models-ZX2BYIMB.js → models-TOXYINNM.js} +3 -2
- package/{offlineMarxistsAgentCommand-XVXUE6G5.js → offlineMarxistsAgentCommand-WZBJBCPZ.js} +16 -22
- package/package.json +3 -3
- package/parityCommands-7EWR34P3.js +613 -0
- package/{projectArchive-OC63TWTD.js → projectArchive-JIVRMXVV.js} +49 -45
- package/{providerPresetApply-NTJUINI6.js → providerPresetApply-IRJ56XIZ.js} +12 -16
- package/{providerRegistry-W45SLUV6.js → providerRegistry-26PAUYH2.js} +3 -13
- package/{read-KG6INYUT.js → read-6YR57D6V.js} +11 -10
- package/{readDocTool-N3GA52JR.js → readDocTool-NKOGL2MW.js} +5 -1
- package/{readlineWorkspace-2NO6D6IZ.js → readlineWorkspace-V26AN2FL.js} +926 -572
- package/{rememberExplicit-CPAPONSI.js → rememberExplicit-7KX4HXQC.js} +4 -4
- package/remove-BF33RCTH.js +32 -0
- package/{removeDialogAgentAction-EEVSOQOJ.js → removeDialogAgentAction-GWHBWF4W.js} +22 -26
- package/{runAgentClientLoop-U7V32UTD.js → runAgentClientLoop-EKD2EEEA.js} +117 -82
- package/{runtimeDoctorCommands-V3M3JTUV.js → runtimeDoctorCommands-IALUR5BZ.js} +23 -16
- package/{secretCommands-KVVZS7A6.js → secretCommands-CSTQYB6T.js} +2 -2
- package/{setDialogExtraReferencesAction-DNO5POHA.js → setDialogExtraReferencesAction-RL6FGO7T.js} +16 -17
- package/{setPrimaryDialogAgentAction-QABBEO4C.js → setPrimaryDialogAgentAction-XJASBB3K.js} +23 -27
- package/{settingThunks-DVKG4X4S.js → settingThunks-ZT7ZYXXL.js} +170 -497
- package/{skillDiscovery-5GEGWJ6N.js → skillDiscovery-IUEZZG2B.js} +3 -3
- package/{spaceCommands-7QKXKBDQ.js → spaceCommands-65WQHVOI.js} +68 -57
- package/spacePruneCommand-PTMRUWYJ.js +233 -0
- package/{store-Z53ICFL3.js → store-WSAVTR32.js} +3 -1
- package/{streamAgentChatTurn-UAGFOXNJ.js → streamAgentChatTurn-B5NICHZW.js} +225 -137
- package/{switchDialogAgentAction-KYWJSGOO.js → switchDialogAgentAction-X6DFOIAX.js} +19 -23
- package/{tableCommands-EFA754RE.js → tableCommands-6E77VD73.js} +28 -49
- package/{toolApiClient-N5PYW2R3.js → toolApiClient-GTTWEV6P.js} +15 -4
- package/{tools-2Q2LBDUC.js → tools-UMCPIQX6.js} +73 -63
- package/{tuiRestart-4QDWLHYZ.js → tuiRestart-O7UDLNQU.js} +20 -13
- package/tuiSummaryLlmCaller-7APIUIIV.js +52 -0
- package/{updateCommands-GJGRS6JK.js → updateCommands-DXDIAQFS.js} +12 -7
- package/{updateDialogTitleAction-GGNTTI5L.js → updateDialogTitleAction-HZLKWVKM.js} +57 -58
- package/{usageCommand-WI6SQOPB.js → usageCommand-WYLNBDHB.js} +6 -8
- package/{usageRebuildCommand-WQRLLZAT.js → usageRebuildCommand-AEUPY2PE.js} +11 -15
- package/{windowsSelfUpdate-C7LGVWYX.js → windowsSelfUpdate-SXSVXK4X.js} +2 -2
- package/workContext-ZAW6VXT7.js +18 -0
- package/workContextQueryProjection-CACY5VFE.js +23 -0
- package/{workloadLifecycle-DYX5ZMAT.js → workloadLifecycle-P2SJVV3S.js} +1 -1
- package/agentFavoriteCommands-7LOP3HUD.js +0 -186
- package/agentRecordCommands-TPE7NSZ6.js +0 -194
- package/agentRunCommand-DMVGBPLI.js +0 -232
- package/chunk-2MBTWINN.js +0 -89
- package/chunk-523DITKR.js +0 -32
- package/chunk-BUDVRYES.js +0 -2213
- package/chunk-BZMDWGQQ.js +0 -47
- package/chunk-GAHJLSDO.js +0 -107
- package/chunk-GYX6XTAI.js +0 -84
- package/chunk-HNUWUO75.js +0 -93
- package/chunk-HSBHS6KT.js +0 -33401
- package/chunk-KG27JIG4.js +0 -136
- package/chunk-OB4FBZXJ.js +0 -364
- package/chunk-OKH74FML.js +0 -3746
- package/chunk-OLZBQWZU.js +0 -6
- package/chunk-OOV5JN25.js +0 -1317
- package/chunk-OQFOE4SJ.js +0 -405
- package/chunk-PXYBUFDB.js +0 -53
- package/chunk-R3FZHW4Q.js +0 -103
- package/chunk-R3MV2GII.js +0 -106
- package/chunk-SCAC3NM5.js +0 -11751
- package/chunk-SR4FE5VD.js +0 -9
- package/chunk-SYTHYBMI.js +0 -3558
- package/chunk-UKZX3NHN.js +0 -48
- package/chunk-UVLYNWIE.js +0 -74
- package/chunk-VQX5JJNI.js +0 -861
- package/chunk-X4O7FJF5.js +0 -160
- package/chunk-YJPK35HB.js +0 -175
- package/chunk-YNIYE47Z.js +0 -105
- package/chunk-Z4PCXPUE.js +0 -127
- package/chunk-ZR5IVL4N.js +0 -862
- package/chunk-ZTHAJU3O.js +0 -2537
- package/cliAuthorityBrokerProcess-5ZFBTHLB.js +0 -22
- package/cliLocalAgentRecordReader-34UKRBLY.js +0 -104
- package/deleteFile-ECU6FU5C.js +0 -55
- package/localRuntimeAuthority-UF2DAQ3F.js +0 -28
- package/machineWsRunDispatch-TBVOYOAH.js +0 -209
- package/markdownToSlate-PXYAIBVL.js +0 -8
- package/tuiSummaryLlmCaller-HROLGN4F.js +0 -45
- package/webapi-QVV65DQF.js +0 -2487
- package/workContext-Y3ADAPZU.js +0 -14
- package/{chunk-USGHJSGO.js → chunk-GX2MFKF3.js} +3 -3
- package/{chunk-PHREU2KZ.js → chunk-WX266G2C.js} +0 -0
- package/{chunk-DXWGFL2Z.js → chunk-YY7IGJMN.js} +3 -3
|
@@ -0,0 +1,790 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLegacyServerDb,
|
|
3
|
+
isLevelLockError
|
|
4
|
+
} from "./chunk-LOFRSJX2.js";
|
|
5
|
+
import {
|
|
6
|
+
createDialogTurnAuthority,
|
|
7
|
+
startCliAuthorityBrokerProcess
|
|
8
|
+
} from "./chunk-RDZ5OIAT.js";
|
|
9
|
+
import {
|
|
10
|
+
loadCliAuthorityBrokerTls
|
|
11
|
+
} from "./chunk-3A5NNQCN.js";
|
|
12
|
+
import {
|
|
13
|
+
DIALOG_TURN_DEFAULT_TTL_MS
|
|
14
|
+
} from "./chunk-EUHMI5KG.js";
|
|
15
|
+
import {
|
|
16
|
+
CLI_AUTHORITY_BROKER_PROTOCOL_VERSION,
|
|
17
|
+
createCliAuthorityBrokerClient,
|
|
18
|
+
createCliAuthorityBrokerSocketInvoker,
|
|
19
|
+
createCliAuthorityDialogTurnClient,
|
|
20
|
+
isCliAuthorityBrokerTimeoutError,
|
|
21
|
+
isCliAuthorityBrokerUnavailableError
|
|
22
|
+
} from "./chunk-LPXBBC32.js";
|
|
23
|
+
import {
|
|
24
|
+
resolveCliAuthorityBrokerEndpoint,
|
|
25
|
+
resolveCliAuthorityBrokerHealthPath,
|
|
26
|
+
resolveCliAuthorityBrokerMetadataPath
|
|
27
|
+
} from "./chunk-CVMMWN6P.js";
|
|
28
|
+
import {
|
|
29
|
+
resolveNoloHome
|
|
30
|
+
} from "./chunk-GLKOYSRU.js";
|
|
31
|
+
import {
|
|
32
|
+
toErrorMessage
|
|
33
|
+
} from "./chunk-HNMXYYJR.js";
|
|
34
|
+
import {
|
|
35
|
+
getLogger
|
|
36
|
+
} from "./chunk-EYLGAEB4.js";
|
|
37
|
+
|
|
38
|
+
// packages/cli/localRuntimeAuthority.ts
|
|
39
|
+
import fs from "node:fs";
|
|
40
|
+
import { randomUUID } from "node:crypto";
|
|
41
|
+
import path from "node:path";
|
|
42
|
+
|
|
43
|
+
// packages/cli/client/localDialogTurnAuthority.ts
|
|
44
|
+
var DialogTurnBusyError = class extends Error {
|
|
45
|
+
errorCode = "dialog_busy";
|
|
46
|
+
dialogRef;
|
|
47
|
+
dialogRevision;
|
|
48
|
+
activeTurn;
|
|
49
|
+
constructor(args) {
|
|
50
|
+
super(`Dialog is busy (activeRunId=${args.activeTurn.runId}, holder=${args.activeTurn.holder})`);
|
|
51
|
+
this.name = "DialogTurnBusyError";
|
|
52
|
+
this.dialogRef = args.dialogRef;
|
|
53
|
+
this.dialogRevision = args.dialogRevision;
|
|
54
|
+
this.activeTurn = args.activeTurn;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var DialogTurnCommitError = class extends Error {
|
|
58
|
+
status;
|
|
59
|
+
dialogRef;
|
|
60
|
+
activeTurn;
|
|
61
|
+
expectedRevision;
|
|
62
|
+
actualRevision;
|
|
63
|
+
constructor(args) {
|
|
64
|
+
super(args.message ?? `Dialog turn commit rejected (${args.status})`);
|
|
65
|
+
this.name = "DialogTurnCommitError";
|
|
66
|
+
this.status = args.status;
|
|
67
|
+
this.dialogRef = args.dialogRef;
|
|
68
|
+
if (args.activeTurn !== void 0) this.activeTurn = args.activeTurn;
|
|
69
|
+
if (args.expectedRevision !== void 0) this.expectedRevision = args.expectedRevision;
|
|
70
|
+
if (args.actualRevision !== void 0) this.actualRevision = args.actualRevision;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var attachedDialogTurnAuthorityMap = /* @__PURE__ */ new WeakMap();
|
|
74
|
+
var embeddedDialogTurnAuthorityMap = /* @__PURE__ */ new WeakMap();
|
|
75
|
+
var hybridStoreUnderlyingDbMap = /* @__PURE__ */ new WeakMap();
|
|
76
|
+
var fallbackDeletedKeysMap = /* @__PURE__ */ new WeakMap();
|
|
77
|
+
function attachLocalDialogTurnAuthority(target, authority) {
|
|
78
|
+
attachedDialogTurnAuthorityMap.set(target, authority);
|
|
79
|
+
return target;
|
|
80
|
+
}
|
|
81
|
+
function isDialogAuthorityProtectedStore(storeOrAuthority) {
|
|
82
|
+
if (!storeOrAuthority || typeof storeOrAuthority !== "object") return false;
|
|
83
|
+
if (attachedDialogTurnAuthorityMap.has(storeOrAuthority)) return true;
|
|
84
|
+
if (isAuthorityStoreLike(storeOrAuthority)) return true;
|
|
85
|
+
const underlyingDb = hybridStoreUnderlyingDbMap.get(storeOrAuthority);
|
|
86
|
+
if (underlyingDb && typeof underlyingDb === "object") {
|
|
87
|
+
return attachedDialogTurnAuthorityMap.has(underlyingDb) || isAuthorityStoreLike(underlyingDb) || isCliLocalRuntimeDbLike(underlyingDb) && typeof underlyingDb.status === "string";
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
function propagateLocalDialogTurnAuthority(source, target) {
|
|
92
|
+
if (source && typeof source === "object") {
|
|
93
|
+
const attached = attachedDialogTurnAuthorityMap.get(source);
|
|
94
|
+
if (attached) {
|
|
95
|
+
attachedDialogTurnAuthorityMap.set(target, attached);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return target;
|
|
99
|
+
}
|
|
100
|
+
function registerHybridStoreUnderlyingDb(hybridStore, db) {
|
|
101
|
+
if (db !== void 0 && db !== null) {
|
|
102
|
+
hybridStoreUnderlyingDbMap.set(hybridStore, db);
|
|
103
|
+
}
|
|
104
|
+
return hybridStore;
|
|
105
|
+
}
|
|
106
|
+
function isDialogTurnAuthority(value) {
|
|
107
|
+
if (!value || typeof value !== "object") return false;
|
|
108
|
+
const candidate = value;
|
|
109
|
+
return typeof candidate.getDialogTurnState === "function" && typeof candidate.beginDialogTurn === "function" && typeof candidate.heartbeatDialogTurn === "function" && typeof candidate.endDialogTurn === "function" && typeof candidate.commitDialogTurn === "function" && typeof candidate.patchDialogMetadata === "function";
|
|
110
|
+
}
|
|
111
|
+
function createNotFoundError() {
|
|
112
|
+
return Object.assign(new Error("NotFound"), {
|
|
113
|
+
notFound: true,
|
|
114
|
+
name: "NotFoundError",
|
|
115
|
+
code: "LEVEL_NOT_FOUND"
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function isAuthorityStoreLike(value) {
|
|
119
|
+
if (!value || typeof value !== "object") return false;
|
|
120
|
+
const v = value;
|
|
121
|
+
return typeof v.get === "function" && typeof v.put === "function" && typeof v.del === "function" && typeof v.batchWrite === "function";
|
|
122
|
+
}
|
|
123
|
+
function isCliLocalRuntimeDbLike(value) {
|
|
124
|
+
if (!value || typeof value !== "object") return false;
|
|
125
|
+
const v = value;
|
|
126
|
+
return typeof v.get === "function" && typeof v.put === "function" && typeof v.del === "function" && typeof v.batch === "function";
|
|
127
|
+
}
|
|
128
|
+
function isHybridRecordStoreLike(value) {
|
|
129
|
+
if (!value || typeof value !== "object") return false;
|
|
130
|
+
const v = value;
|
|
131
|
+
return typeof v.read === "function" && typeof v.write === "function";
|
|
132
|
+
}
|
|
133
|
+
function getDeletedKeys(store) {
|
|
134
|
+
let set = fallbackDeletedKeysMap.get(store);
|
|
135
|
+
if (!set) {
|
|
136
|
+
set = /* @__PURE__ */ new Set();
|
|
137
|
+
fallbackDeletedKeysMap.set(store, set);
|
|
138
|
+
}
|
|
139
|
+
return set;
|
|
140
|
+
}
|
|
141
|
+
function adaptCliLocalRuntimeDbToTurnStore(db) {
|
|
142
|
+
return {
|
|
143
|
+
get: (key) => db.get(key),
|
|
144
|
+
put: async (key, value) => {
|
|
145
|
+
await db.put(key, value);
|
|
146
|
+
},
|
|
147
|
+
del: async (key) => {
|
|
148
|
+
await db.del(key);
|
|
149
|
+
},
|
|
150
|
+
batchWrite: async (ops) => {
|
|
151
|
+
const puts = [];
|
|
152
|
+
const dels = [];
|
|
153
|
+
for (const op of ops) {
|
|
154
|
+
if (op.type === "put") puts.push({ type: "put", key: op.key, value: op.value });
|
|
155
|
+
else if (op.type === "del") dels.push(op.key);
|
|
156
|
+
}
|
|
157
|
+
if (puts.length > 0) await db.batch(puts);
|
|
158
|
+
for (const key of dels) await db.del(key);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function adaptHybridRecordStoreToTurnStore(store) {
|
|
163
|
+
const deletedKeys = getDeletedKeys(store);
|
|
164
|
+
const underlyingDb = hybridStoreUnderlyingDbMap.get(store);
|
|
165
|
+
const deleteKey = async (key) => {
|
|
166
|
+
deletedKeys.add(key);
|
|
167
|
+
if (typeof store.del === "function") {
|
|
168
|
+
await store.del(key);
|
|
169
|
+
} else if (typeof underlyingDb?.del === "function") {
|
|
170
|
+
await underlyingDb.del(key);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
return {
|
|
174
|
+
get: async (key) => {
|
|
175
|
+
if (deletedKeys.has(key)) throw createNotFoundError();
|
|
176
|
+
const value = await store.read(key, { remote: false });
|
|
177
|
+
if (value === null || value === void 0) {
|
|
178
|
+
throw createNotFoundError();
|
|
179
|
+
}
|
|
180
|
+
return value;
|
|
181
|
+
},
|
|
182
|
+
put: async (key, value) => {
|
|
183
|
+
deletedKeys.delete(key);
|
|
184
|
+
await store.write(key, value);
|
|
185
|
+
},
|
|
186
|
+
del: deleteKey,
|
|
187
|
+
batchWrite: async (ops) => {
|
|
188
|
+
const putOps = [];
|
|
189
|
+
const delKeys = [];
|
|
190
|
+
for (const op of ops) {
|
|
191
|
+
if (op.type === "put") {
|
|
192
|
+
putOps.push({ type: "put", key: op.key, value: op.value });
|
|
193
|
+
} else if (op.type === "del") {
|
|
194
|
+
delKeys.push(op.key);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (putOps.length > 0) {
|
|
198
|
+
if (typeof store.batch === "function") {
|
|
199
|
+
await store.batch(putOps);
|
|
200
|
+
} else {
|
|
201
|
+
for (const op of putOps) {
|
|
202
|
+
await store.write(op.key, op.value);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
for (const op of putOps) deletedKeys.delete(op.key);
|
|
206
|
+
}
|
|
207
|
+
for (const key of delKeys) {
|
|
208
|
+
await deleteKey(key);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function resolveLocalDialogTurnAuthority(storeOrAuthority) {
|
|
214
|
+
if (isDialogTurnAuthority(storeOrAuthority)) {
|
|
215
|
+
return storeOrAuthority;
|
|
216
|
+
}
|
|
217
|
+
if (!storeOrAuthority || typeof storeOrAuthority !== "object") {
|
|
218
|
+
throw new Error("Local dialog turn authority requires a store or authority instance");
|
|
219
|
+
}
|
|
220
|
+
const attached = attachedDialogTurnAuthorityMap.get(storeOrAuthority);
|
|
221
|
+
if (attached) return attached;
|
|
222
|
+
const cached = embeddedDialogTurnAuthorityMap.get(storeOrAuthority);
|
|
223
|
+
if (cached) return cached;
|
|
224
|
+
let authority;
|
|
225
|
+
if (isAuthorityStoreLike(storeOrAuthority)) {
|
|
226
|
+
authority = createDialogTurnAuthority(storeOrAuthority);
|
|
227
|
+
} else if (isCliLocalRuntimeDbLike(storeOrAuthority)) {
|
|
228
|
+
authority = createDialogTurnAuthority(adaptCliLocalRuntimeDbToTurnStore(storeOrAuthority));
|
|
229
|
+
} else if (isHybridRecordStoreLike(storeOrAuthority)) {
|
|
230
|
+
authority = createDialogTurnAuthority(adaptHybridRecordStoreToTurnStore(storeOrAuthority));
|
|
231
|
+
} else {
|
|
232
|
+
throw new Error("Unsupported store type for local dialog turn authority");
|
|
233
|
+
}
|
|
234
|
+
embeddedDialogTurnAuthorityMap.set(storeOrAuthority, authority);
|
|
235
|
+
return authority;
|
|
236
|
+
}
|
|
237
|
+
function sanitizeDialogTurnIdentifier(raw, fallbackPrefix = "id") {
|
|
238
|
+
const cleaned = raw.replace(/[\s\p{C}\uFEFF:/\\?#]+/gu, "-").replace(/^-+|-+$/g, "");
|
|
239
|
+
const candidate = cleaned || fallbackPrefix;
|
|
240
|
+
return candidate.length <= 256 ? candidate : candidate.slice(0, 256);
|
|
241
|
+
}
|
|
242
|
+
async function acquireLocalDialogTurnLease(args) {
|
|
243
|
+
const runId = sanitizeDialogTurnIdentifier(args.runId, "run");
|
|
244
|
+
const commandId = sanitizeDialogTurnIdentifier(args.commandId ?? `commit-${runId}`, "cmd");
|
|
245
|
+
const res = await args.authority.beginDialogTurn({
|
|
246
|
+
dialogRef: args.dialogRef,
|
|
247
|
+
runId,
|
|
248
|
+
holder: args.holder,
|
|
249
|
+
holderKind: args.holderKind,
|
|
250
|
+
...args.ttlMs !== void 0 ? { ttlMs: args.ttlMs } : {}
|
|
251
|
+
});
|
|
252
|
+
if (res.status === "acquired") {
|
|
253
|
+
return {
|
|
254
|
+
ok: true,
|
|
255
|
+
replayed: res.replayed,
|
|
256
|
+
dialogRevision: res.dialogRevision,
|
|
257
|
+
activeTurn: res.activeTurn,
|
|
258
|
+
lease: {
|
|
259
|
+
dialogRef: args.dialogRef,
|
|
260
|
+
runId,
|
|
261
|
+
runToken: res.activeTurn.runToken,
|
|
262
|
+
holder: args.holder,
|
|
263
|
+
holderKind: args.holderKind,
|
|
264
|
+
baseRevision: res.dialogRevision,
|
|
265
|
+
commandId,
|
|
266
|
+
authority: args.authority
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
if (res.status === "busy") {
|
|
271
|
+
return {
|
|
272
|
+
ok: false,
|
|
273
|
+
status: "busy",
|
|
274
|
+
dialogRevision: res.dialogRevision,
|
|
275
|
+
activeTurn: res.activeTurn
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
ok: false,
|
|
280
|
+
status: res.status,
|
|
281
|
+
result: res
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function startDialogTurnHeartbeat(args) {
|
|
285
|
+
const ttlMs = args.ttlMs ?? DIALOG_TURN_DEFAULT_TTL_MS;
|
|
286
|
+
const intervalMs = args.intervalMs ?? Math.max(1e3, Math.floor(ttlMs / 3));
|
|
287
|
+
let stopped = false;
|
|
288
|
+
const timer = setInterval(() => {
|
|
289
|
+
if (stopped) return;
|
|
290
|
+
void args.authority.heartbeatDialogTurn({
|
|
291
|
+
dialogRef: args.dialogRef,
|
|
292
|
+
runToken: args.runToken,
|
|
293
|
+
ttlMs
|
|
294
|
+
}).then((result) => {
|
|
295
|
+
if (result.status !== "token_mismatch" || !args.onLeaseLost || stopped) return;
|
|
296
|
+
stopped = true;
|
|
297
|
+
clearInterval(timer);
|
|
298
|
+
args.onLeaseLost();
|
|
299
|
+
}).catch(() => {
|
|
300
|
+
});
|
|
301
|
+
}, intervalMs);
|
|
302
|
+
timer.unref?.();
|
|
303
|
+
return {
|
|
304
|
+
stop() {
|
|
305
|
+
if (stopped) return;
|
|
306
|
+
stopped = true;
|
|
307
|
+
clearInterval(timer);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// packages/cli/localRuntimeAuthority.ts
|
|
313
|
+
function ensureDbParentDir(dbPath) {
|
|
314
|
+
fs.mkdirSync(path.dirname(dbPath), { recursive: true });
|
|
315
|
+
}
|
|
316
|
+
function findCliAuthorityCorruption(error) {
|
|
317
|
+
const seen = /* @__PURE__ */ new Set();
|
|
318
|
+
let current = error;
|
|
319
|
+
while (current && !seen.has(current)) {
|
|
320
|
+
seen.add(current);
|
|
321
|
+
if (current.code === "LEVEL_CORRUPTION" || /Corruption:|missing files/i.test(toErrorMessage(current))) return current;
|
|
322
|
+
current = current.cause;
|
|
323
|
+
}
|
|
324
|
+
return void 0;
|
|
325
|
+
}
|
|
326
|
+
function throwCliAuthorityStartupError(error) {
|
|
327
|
+
const corruption = findCliAuthorityCorruption(error);
|
|
328
|
+
if (corruption) {
|
|
329
|
+
throw new Error(`Local authority database corruption: ${toErrorMessage(corruption)}`, { cause: error });
|
|
330
|
+
}
|
|
331
|
+
throw error;
|
|
332
|
+
}
|
|
333
|
+
function isCliAuthorityLockError(error) {
|
|
334
|
+
if (findCliAuthorityCorruption(error)) return false;
|
|
335
|
+
const seen = /* @__PURE__ */ new Set();
|
|
336
|
+
let current = error;
|
|
337
|
+
while (current && !seen.has(current)) {
|
|
338
|
+
seen.add(current);
|
|
339
|
+
if (isLevelLockError(current)) return true;
|
|
340
|
+
current = current.cause;
|
|
341
|
+
}
|
|
342
|
+
return /EADDRINUSE|Failed to listen/i.test(toErrorMessage(error));
|
|
343
|
+
}
|
|
344
|
+
async function sleep(ms) {
|
|
345
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
346
|
+
}
|
|
347
|
+
function resolveCliLocalRuntimeDbPath(options = {}) {
|
|
348
|
+
return path.join(
|
|
349
|
+
resolveNoloHome({
|
|
350
|
+
env: options.env,
|
|
351
|
+
homeDir: options.homeDir
|
|
352
|
+
}),
|
|
353
|
+
"data",
|
|
354
|
+
"leveldb"
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
var DEFAULT_ATTACH_BACKOFF_MS = [100, 200, 400, 800];
|
|
358
|
+
var DEFAULT_ATTACH_RETRY_BUDGET_MS = 9e3;
|
|
359
|
+
function findOwnerPid(error) {
|
|
360
|
+
const seen = /* @__PURE__ */ new Set();
|
|
361
|
+
let current = error;
|
|
362
|
+
while (current && typeof current === "object" && !seen.has(current)) {
|
|
363
|
+
seen.add(current);
|
|
364
|
+
const pid = current.ownerPid;
|
|
365
|
+
if (typeof pid === "number" && Number.isInteger(pid) && pid > 0) {
|
|
366
|
+
return pid;
|
|
367
|
+
}
|
|
368
|
+
current = current.cause;
|
|
369
|
+
}
|
|
370
|
+
return void 0;
|
|
371
|
+
}
|
|
372
|
+
function isTransientBrokerOpenError(error) {
|
|
373
|
+
return isCliAuthorityBrokerUnavailableError(error) || isCliAuthorityBrokerTimeoutError(error);
|
|
374
|
+
}
|
|
375
|
+
var defaultCliAuthorityBrokerConnectDeps = {
|
|
376
|
+
createClient: (options) => createCliAuthorityBrokerClient(options),
|
|
377
|
+
startBroker: startCliAuthorityBrokerProcess,
|
|
378
|
+
sleep,
|
|
379
|
+
useFastPath: true
|
|
380
|
+
};
|
|
381
|
+
function verifyBrokerDatabase(args, liveLocation) {
|
|
382
|
+
const expected = fs.existsSync(args.dbPath) ? fs.realpathSync(args.dbPath) : path.join(fs.realpathSync(path.dirname(args.dbPath)), path.basename(args.dbPath));
|
|
383
|
+
if (typeof liveLocation !== "string" || fs.realpathSync(liveLocation) !== expected) {
|
|
384
|
+
throw new Error(`Authority broker at ${args.endpoint} does not match the requested database ${args.dbPath}`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function readBrokerUpgradeMetadata(args) {
|
|
388
|
+
try {
|
|
389
|
+
const metadata = JSON.parse(fs.readFileSync(args.metadataPath, "utf8"));
|
|
390
|
+
if (metadata.endpoint !== args.endpoint || !isBrokerPid(metadata.pid)) return void 0;
|
|
391
|
+
return {
|
|
392
|
+
pid: metadata.pid,
|
|
393
|
+
supervisorPid: isBrokerPid(metadata.supervisorPid) ? metadata.supervisorPid : void 0,
|
|
394
|
+
protocolVersion: metadata.protocolVersion === void 0 ? 1 : metadata.protocolVersion
|
|
395
|
+
};
|
|
396
|
+
} catch {
|
|
397
|
+
return void 0;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
function isBrokerPid(pid) {
|
|
401
|
+
return typeof pid === "number" && Number.isInteger(pid) && pid > 0 && pid <= 2147483647;
|
|
402
|
+
}
|
|
403
|
+
function brokerPidHasExited(pid) {
|
|
404
|
+
try {
|
|
405
|
+
process.kill(pid, 0);
|
|
406
|
+
return false;
|
|
407
|
+
} catch (error) {
|
|
408
|
+
return error.code === "ESRCH";
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function findLegacyBrokerOwner(args) {
|
|
412
|
+
try {
|
|
413
|
+
const metadata = JSON.parse(fs.readFileSync(args.metadataPath, "utf8"));
|
|
414
|
+
const owner = JSON.parse(fs.readFileSync(`${args.dbPath}.owner`, "utf8"));
|
|
415
|
+
if (metadata.transportSecurity !== void 0 || metadata.supervisorPid !== void 0 || metadata.endpoint !== args.endpoint || !Number.isInteger(metadata.pid) || metadata.pid <= 0 || owner.pid !== metadata.pid || fs.realpathSync(metadata.location) !== fs.realpathSync(args.dbPath)) return void 0;
|
|
416
|
+
process.kill(metadata.pid, 0);
|
|
417
|
+
return metadata.pid;
|
|
418
|
+
} catch {
|
|
419
|
+
return void 0;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
async function connectCliAuthorityBroker(args) {
|
|
423
|
+
const deps = {
|
|
424
|
+
...defaultCliAuthorityBrokerConnectDeps,
|
|
425
|
+
...args.deps
|
|
426
|
+
};
|
|
427
|
+
async function connectClient() {
|
|
428
|
+
const invoke = createCliAuthorityBrokerSocketInvoker({ endpoint: args.endpoint, tls: args.tls });
|
|
429
|
+
const readBrokerProcess = () => readBrokerUpgradeMetadata(args);
|
|
430
|
+
const clientOptions = { endpoint: args.endpoint, invoke, readBrokerProcess };
|
|
431
|
+
const client2 = deps.createClient({
|
|
432
|
+
...clientOptions,
|
|
433
|
+
requireDialogTurn: true,
|
|
434
|
+
...deps.verifyBroker ? { verifyLocation: (location) => deps.verifyBroker(args, location) } : {}
|
|
435
|
+
});
|
|
436
|
+
attachLocalDialogTurnAuthority(client2, createCliAuthorityDialogTurnClient(clientOptions));
|
|
437
|
+
const backoffSchedule = deps.attachBackoffMs?.length ? deps.attachBackoffMs : DEFAULT_ATTACH_BACKOFF_MS;
|
|
438
|
+
const retryBudgetMs = deps.attachRetryBudgetMs ?? DEFAULT_ATTACH_RETRY_BUDGET_MS;
|
|
439
|
+
let waitedMs = 0;
|
|
440
|
+
let backoffStep = 0;
|
|
441
|
+
let lastAttachError;
|
|
442
|
+
const waitBackoff = async () => {
|
|
443
|
+
if (waitedMs >= retryBudgetMs) return false;
|
|
444
|
+
const delay = backoffSchedule[Math.min(backoffStep, backoffSchedule.length - 1)];
|
|
445
|
+
if (waitedMs > 0 && waitedMs + delay > retryBudgetMs) return false;
|
|
446
|
+
backoffStep += 1;
|
|
447
|
+
const startedAt = Date.now();
|
|
448
|
+
await deps.sleep(delay);
|
|
449
|
+
waitedMs += Math.max(delay, Date.now() - startedAt);
|
|
450
|
+
return true;
|
|
451
|
+
};
|
|
452
|
+
async function attachToExistingBroker(attempts) {
|
|
453
|
+
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
454
|
+
if (!await waitBackoff()) return false;
|
|
455
|
+
const probeStartedAt = Date.now();
|
|
456
|
+
try {
|
|
457
|
+
await client2.open();
|
|
458
|
+
return true;
|
|
459
|
+
} catch (error) {
|
|
460
|
+
waitedMs += Date.now() - probeStartedAt;
|
|
461
|
+
if (!isTransientBrokerOpenError(error)) throw error;
|
|
462
|
+
lastAttachError = error;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return false;
|
|
466
|
+
}
|
|
467
|
+
if (deps.useFastPath) {
|
|
468
|
+
try {
|
|
469
|
+
await client2.open();
|
|
470
|
+
return client2;
|
|
471
|
+
} catch (error) {
|
|
472
|
+
if (!isTransientBrokerOpenError(error)) throw error;
|
|
473
|
+
lastAttachError = error;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const metadata = readBrokerProcess();
|
|
477
|
+
if (metadata && Number.isInteger(metadata.protocolVersion) && metadata.protocolVersion >= 1 && metadata.protocolVersion < CLI_AUTHORITY_BROKER_PROTOCOL_VERSION && brokerPidHasExited(metadata.pid) && (metadata.supervisorPid === void 0 || brokerPidHasExited(metadata.supervisorPid))) {
|
|
478
|
+
getLogger("cli.authorityBroker").warn(
|
|
479
|
+
`Stale CLI Authority Broker metadata at ${args.metadataPath} for ${args.endpoint} (protocol ${metadata.protocolVersion}, worker PID ${metadata.pid}). The recorded broker is no longer running; attempting normal startup with protocol ${CLI_AUTHORITY_BROKER_PROTOCOL_VERSION} on the same database.`
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
try {
|
|
483
|
+
await deps.startBroker({
|
|
484
|
+
endpoint: args.endpoint,
|
|
485
|
+
metadataPath: args.metadataPath,
|
|
486
|
+
healthPath: args.healthPath,
|
|
487
|
+
dbPath: args.dbPath
|
|
488
|
+
});
|
|
489
|
+
await client2.open();
|
|
490
|
+
return client2;
|
|
491
|
+
} catch (error) {
|
|
492
|
+
if (!isCliAuthorityLockError(error)) throwCliAuthorityStartupError(error);
|
|
493
|
+
if (await attachToExistingBroker(5)) {
|
|
494
|
+
return client2;
|
|
495
|
+
}
|
|
496
|
+
let lastError = error;
|
|
497
|
+
while (await waitBackoff()) {
|
|
498
|
+
try {
|
|
499
|
+
await deps.startBroker({
|
|
500
|
+
endpoint: args.endpoint,
|
|
501
|
+
metadataPath: args.metadataPath,
|
|
502
|
+
healthPath: args.healthPath,
|
|
503
|
+
dbPath: args.dbPath
|
|
504
|
+
});
|
|
505
|
+
await client2.open();
|
|
506
|
+
return client2;
|
|
507
|
+
} catch (retryError) {
|
|
508
|
+
lastError = retryError;
|
|
509
|
+
if (isCliAuthorityLockError(retryError)) {
|
|
510
|
+
if (await attachToExistingBroker(2)) {
|
|
511
|
+
return client2;
|
|
512
|
+
}
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
if (isTransientBrokerOpenError(retryError)) {
|
|
516
|
+
lastAttachError = retryError;
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
throwCliAuthorityStartupError(retryError);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
const lastMessage = toErrorMessage(lastError);
|
|
523
|
+
const attachCause = lastAttachError instanceof Error ? lastAttachError.cause : void 0;
|
|
524
|
+
const attachMessage = lastAttachError ? [toErrorMessage(lastAttachError), ...attachCause ? [toErrorMessage(attachCause)] : []].join(" / ") : "";
|
|
525
|
+
const portInUse = lastError !== null && typeof lastError === "object" && "code" in lastError && lastError.code === "EADDRINUSE" || /EADDRINUSE/i.test(lastMessage);
|
|
526
|
+
const ownerPid = findOwnerPid(lastError);
|
|
527
|
+
const legacyOwner = args.tls ? findLegacyBrokerOwner(args) : void 0;
|
|
528
|
+
if (legacyOwner !== void 0) {
|
|
529
|
+
throw new Error(`CLI authority broker upgrade requires exit of the previous Nolo process (PID ${legacyOwner}). Close its Nolo window or let it finish, then retry. The new broker will reopen the same database.`, {
|
|
530
|
+
cause: lastError
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
let detail = "";
|
|
534
|
+
if (portInUse) {
|
|
535
|
+
detail = `: EADDRINUSE (${lastMessage}). The broker endpoint is already in use; check the process using it or set NOLO_CLI_AUTHORITY_BROKER_PORT to a free port for all local CLI processes`;
|
|
536
|
+
} else {
|
|
537
|
+
const parts = [
|
|
538
|
+
ownerPid !== void 0 ? `ownerPid=${ownerPid}` : void 0,
|
|
539
|
+
lastMessage || void 0,
|
|
540
|
+
attachMessage && attachMessage !== lastMessage ? `attach=${attachMessage}` : void 0
|
|
541
|
+
].filter(Boolean);
|
|
542
|
+
if (parts.length > 0) {
|
|
543
|
+
detail = `: ${parts.join("; ")}`;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
throw new Error(`CLI authority broker could not attach or take ownership for ${args.endpoint}${detail}`, {
|
|
547
|
+
cause: lastError
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
let client = await connectClient();
|
|
552
|
+
let reconnecting = null;
|
|
553
|
+
async function reconnect() {
|
|
554
|
+
reconnecting ??= connectClient();
|
|
555
|
+
try {
|
|
556
|
+
client = await reconnecting;
|
|
557
|
+
return client;
|
|
558
|
+
} finally {
|
|
559
|
+
reconnecting = null;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
async function runWithSelfHealing(operation) {
|
|
563
|
+
try {
|
|
564
|
+
return await operation(client);
|
|
565
|
+
} catch (error) {
|
|
566
|
+
if (!isCliAuthorityBrokerUnavailableError(error)) throw error;
|
|
567
|
+
const recoveredClient = await reconnect();
|
|
568
|
+
return operation(recoveredClient);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
const wrappedStore = {
|
|
572
|
+
get location() {
|
|
573
|
+
return client.location;
|
|
574
|
+
},
|
|
575
|
+
get status() {
|
|
576
|
+
return client.status;
|
|
577
|
+
},
|
|
578
|
+
open: () => runWithSelfHealing((activeClient) => activeClient.open()),
|
|
579
|
+
close: () => runWithSelfHealing((activeClient) => activeClient.close()),
|
|
580
|
+
get: (key) => runWithSelfHealing((activeClient) => activeClient.get(key)),
|
|
581
|
+
conditionalPut: (key, expectedRevision, value) => runWithSelfHealing((activeClient) => {
|
|
582
|
+
if (!activeClient.conditionalPut) {
|
|
583
|
+
throw new Error("CLI authority broker does not support conditionalPut");
|
|
584
|
+
}
|
|
585
|
+
return activeClient.conditionalPut(key, expectedRevision, value);
|
|
586
|
+
}),
|
|
587
|
+
conditionalDelete: (key, expectedRevision) => runWithSelfHealing((activeClient) => {
|
|
588
|
+
if (!activeClient.conditionalDelete) {
|
|
589
|
+
throw new Error("CLI authority broker does not support conditionalDelete");
|
|
590
|
+
}
|
|
591
|
+
return activeClient.conditionalDelete(key, expectedRevision);
|
|
592
|
+
}),
|
|
593
|
+
put: (key, value) => runWithSelfHealing((activeClient) => activeClient.put(key, value)),
|
|
594
|
+
del: (key) => runWithSelfHealing((activeClient) => activeClient.del(key)),
|
|
595
|
+
batchWrite: (ops) => runWithSelfHealing((activeClient) => activeClient.batchWrite(ops)),
|
|
596
|
+
createBatch() {
|
|
597
|
+
const ops = [];
|
|
598
|
+
return {
|
|
599
|
+
put(key, value) {
|
|
600
|
+
ops.push({ type: "put", key, value });
|
|
601
|
+
},
|
|
602
|
+
del(key) {
|
|
603
|
+
ops.push({ type: "del", key });
|
|
604
|
+
},
|
|
605
|
+
write: () => runWithSelfHealing((activeClient) => activeClient.batchWrite(ops))
|
|
606
|
+
};
|
|
607
|
+
},
|
|
608
|
+
iterator(options = {}) {
|
|
609
|
+
return async function* iterate() {
|
|
610
|
+
let activeOptions = options;
|
|
611
|
+
let lastYieldedKey;
|
|
612
|
+
let skipResumeKey = false;
|
|
613
|
+
let recovered = false;
|
|
614
|
+
while (true) {
|
|
615
|
+
try {
|
|
616
|
+
for await (const entry of client.iterator(activeOptions)) {
|
|
617
|
+
if (skipResumeKey && entry[0] === lastYieldedKey) {
|
|
618
|
+
skipResumeKey = false;
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
skipResumeKey = false;
|
|
622
|
+
lastYieldedKey = entry[0];
|
|
623
|
+
yield entry;
|
|
624
|
+
}
|
|
625
|
+
return;
|
|
626
|
+
} catch (error) {
|
|
627
|
+
if (recovered || !isCliAuthorityBrokerUnavailableError(error)) {
|
|
628
|
+
throw error;
|
|
629
|
+
}
|
|
630
|
+
recovered = true;
|
|
631
|
+
await reconnect();
|
|
632
|
+
if (lastYieldedKey === void 0) {
|
|
633
|
+
activeOptions = options;
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
if (options.reverse) {
|
|
637
|
+
activeOptions = {
|
|
638
|
+
...options,
|
|
639
|
+
lt: lastYieldedKey
|
|
640
|
+
};
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
activeOptions = {
|
|
644
|
+
...options,
|
|
645
|
+
gte: lastYieldedKey
|
|
646
|
+
};
|
|
647
|
+
skipResumeKey = true;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}();
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
const dialogTurnAuthority = {
|
|
654
|
+
getDialogTurnState: (input) => runWithSelfHealing((activeClient) => resolveLocalDialogTurnAuthority(activeClient).getDialogTurnState(input)),
|
|
655
|
+
beginDialogTurn: (input) => runWithSelfHealing((activeClient) => resolveLocalDialogTurnAuthority(activeClient).beginDialogTurn(input)),
|
|
656
|
+
heartbeatDialogTurn: (input) => runWithSelfHealing((activeClient) => resolveLocalDialogTurnAuthority(activeClient).heartbeatDialogTurn(input)),
|
|
657
|
+
endDialogTurn: (input) => runWithSelfHealing((activeClient) => resolveLocalDialogTurnAuthority(activeClient).endDialogTurn(input)),
|
|
658
|
+
commitDialogTurn: (input) => runWithSelfHealing((activeClient) => resolveLocalDialogTurnAuthority(activeClient).commitDialogTurn(input)),
|
|
659
|
+
patchDialogMetadata: (input) => runWithSelfHealing((activeClient) => resolveLocalDialogTurnAuthority(activeClient).patchDialogMetadata(input))
|
|
660
|
+
};
|
|
661
|
+
return attachLocalDialogTurnAuthority(wrappedStore, dialogTurnAuthority);
|
|
662
|
+
}
|
|
663
|
+
async function getDefaultCliLocalRuntimeAuthority(options = {}) {
|
|
664
|
+
const ambientNoloHome = process.env.NOLO_HOME?.trim();
|
|
665
|
+
const ambientBrokerPort = process.env.NOLO_CLI_AUTHORITY_BROKER_PORT?.trim();
|
|
666
|
+
const callerHome = options.env?.NOLO_HOME?.trim();
|
|
667
|
+
const homeOverridden = Boolean(callerHome && callerHome !== ambientNoloHome);
|
|
668
|
+
const env = {
|
|
669
|
+
...ambientNoloHome ? { NOLO_HOME: ambientNoloHome } : {},
|
|
670
|
+
...ambientBrokerPort && !homeOverridden ? { NOLO_CLI_AUTHORITY_BROKER_PORT: ambientBrokerPort } : {},
|
|
671
|
+
...options.env ?? process.env
|
|
672
|
+
};
|
|
673
|
+
const dbPath = resolveCliLocalRuntimeDbPath({
|
|
674
|
+
env,
|
|
675
|
+
homeDir: options.homeDir
|
|
676
|
+
});
|
|
677
|
+
ensureDbParentDir(dbPath);
|
|
678
|
+
const endpoint = resolveCliAuthorityBrokerEndpoint({
|
|
679
|
+
transport: "tcp",
|
|
680
|
+
env,
|
|
681
|
+
homeDir: options.homeDir
|
|
682
|
+
});
|
|
683
|
+
const metadataPath = resolveCliAuthorityBrokerMetadataPath({
|
|
684
|
+
transport: "tcp",
|
|
685
|
+
env,
|
|
686
|
+
homeDir: options.homeDir
|
|
687
|
+
});
|
|
688
|
+
const healthPath = resolveCliAuthorityBrokerHealthPath({
|
|
689
|
+
transport: "tcp",
|
|
690
|
+
env,
|
|
691
|
+
homeDir: options.homeDir
|
|
692
|
+
});
|
|
693
|
+
return connectCliAuthorityBroker({
|
|
694
|
+
endpoint,
|
|
695
|
+
metadataPath,
|
|
696
|
+
healthPath,
|
|
697
|
+
dbPath,
|
|
698
|
+
tls: await loadCliAuthorityBrokerTls(metadataPath),
|
|
699
|
+
deps: { verifyBroker: verifyBrokerDatabase }
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
async function getDefaultCliLocalRuntimeDb(options = {}) {
|
|
703
|
+
const authorityStore = await getDefaultCliLocalRuntimeAuthority(options);
|
|
704
|
+
const legacyDb = createLegacyServerDb(authorityStore);
|
|
705
|
+
if (typeof authorityStore.conditionalPut === "function") {
|
|
706
|
+
legacyDb.conditionalPut = authorityStore.conditionalPut.bind(authorityStore);
|
|
707
|
+
}
|
|
708
|
+
return propagateLocalDialogTurnAuthority(authorityStore, legacyDb);
|
|
709
|
+
}
|
|
710
|
+
async function getDefaultCliLocalDialogTurnAuthority(options = {}) {
|
|
711
|
+
const authorityStore = await getDefaultCliLocalRuntimeAuthority(options);
|
|
712
|
+
return resolveLocalDialogTurnAuthority(authorityStore);
|
|
713
|
+
}
|
|
714
|
+
function createCliLocalMcpConnectionRevisionWriter(authority, authenticatedUserId) {
|
|
715
|
+
if (!authenticatedUserId) throw new Error("Local MCP connection owner is required");
|
|
716
|
+
const prefix = `mcp-private:v1:${encodeURIComponent(authenticatedUserId)}:connection:`;
|
|
717
|
+
const conditionalPut = authority.conditionalPut?.bind(authority);
|
|
718
|
+
if (!conditionalPut) throw new Error("CLI authority broker does not support conditionalPut");
|
|
719
|
+
const validId = (id) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id);
|
|
720
|
+
return {
|
|
721
|
+
async remove(id, expectedRevision) {
|
|
722
|
+
if (!validId(id) || !Number.isSafeInteger(expectedRevision) || expectedRevision < 1) throw new Error("Invalid local MCP connection identity or revision");
|
|
723
|
+
if (!authority.conditionalDelete) throw new Error("CLI authority broker does not support conditionalDelete");
|
|
724
|
+
return authority.conditionalDelete(prefix + id, expectedRevision);
|
|
725
|
+
},
|
|
726
|
+
async create(value) {
|
|
727
|
+
const id = randomUUID();
|
|
728
|
+
const result = await conditionalPut(prefix + id, null, { ...value, revision: 1 });
|
|
729
|
+
return { id, ...result };
|
|
730
|
+
},
|
|
731
|
+
async update(id, expectedRevision, value) {
|
|
732
|
+
if (!validId(id) || !Number.isSafeInteger(expectedRevision) || expectedRevision < 1 || expectedRevision >= Number.MAX_SAFE_INTEGER) {
|
|
733
|
+
throw new Error("Invalid local MCP connection identity or revision");
|
|
734
|
+
}
|
|
735
|
+
return conditionalPut(prefix + id, expectedRevision, { ...value, revision: expectedRevision + 1 });
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
function createCliLocalAutomationRevisionWriter(authority, authenticatedUserId) {
|
|
740
|
+
if (!authenticatedUserId) throw new Error("Local automation owner is required");
|
|
741
|
+
const prefix = `local-automation:v1:${encodeURIComponent(authenticatedUserId)}:`;
|
|
742
|
+
const conditionalPut = authority.conditionalPut?.bind(authority);
|
|
743
|
+
const conditionalDelete = authority.conditionalDelete?.bind(authority);
|
|
744
|
+
if (!conditionalPut || !conditionalDelete) throw new Error("CLI authority broker does not support automation CAS");
|
|
745
|
+
const key = (id) => {
|
|
746
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(id)) {
|
|
747
|
+
throw new Error("Invalid local automation ID");
|
|
748
|
+
}
|
|
749
|
+
return prefix + id;
|
|
750
|
+
};
|
|
751
|
+
const revision = (expected) => {
|
|
752
|
+
if (!Number.isSafeInteger(expected) || expected < 1 || expected >= Number.MAX_SAFE_INTEGER) {
|
|
753
|
+
throw new Error("Invalid local automation revision");
|
|
754
|
+
}
|
|
755
|
+
return expected;
|
|
756
|
+
};
|
|
757
|
+
return {
|
|
758
|
+
prefix,
|
|
759
|
+
key,
|
|
760
|
+
async create(value) {
|
|
761
|
+
const id = randomUUID();
|
|
762
|
+
const row = { ...value, id, revision: 1 };
|
|
763
|
+
return { row, result: await conditionalPut(key(id), null, row) };
|
|
764
|
+
},
|
|
765
|
+
update(id, expected, value) {
|
|
766
|
+
return conditionalPut(key(id), revision(expected), { ...value, id, revision: expected + 1 });
|
|
767
|
+
},
|
|
768
|
+
remove(id, expected) {
|
|
769
|
+
return conditionalDelete(key(id), revision(expected));
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
export {
|
|
775
|
+
DialogTurnBusyError,
|
|
776
|
+
DialogTurnCommitError,
|
|
777
|
+
isDialogAuthorityProtectedStore,
|
|
778
|
+
propagateLocalDialogTurnAuthority,
|
|
779
|
+
registerHybridStoreUnderlyingDb,
|
|
780
|
+
resolveLocalDialogTurnAuthority,
|
|
781
|
+
sanitizeDialogTurnIdentifier,
|
|
782
|
+
acquireLocalDialogTurnLease,
|
|
783
|
+
startDialogTurnHeartbeat,
|
|
784
|
+
connectCliAuthorityBroker,
|
|
785
|
+
getDefaultCliLocalRuntimeAuthority,
|
|
786
|
+
getDefaultCliLocalRuntimeDb,
|
|
787
|
+
getDefaultCliLocalDialogTurnAuthority,
|
|
788
|
+
createCliLocalMcpConnectionRevisionWriter,
|
|
789
|
+
createCliLocalAutomationRevisionWriter
|
|
790
|
+
};
|