nolo-cli 0.261.0-alpha.2 → 0.263.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/{_executeModel-PODMRXJJ.js → _executeModel-GZEGNZDC.js} +97 -96
- package/{accountResolver-NGICIMEE.js → accountResolver-JYG5L7YP.js} +2 -2
- package/{action-NJTYNXXR.js → action-UK3HXGXF.js} +9 -9
- package/{addContentAction-RUPXLROG.js → addContentAction-CAKFVBDM.js} +14 -14
- package/{addDialogAgentAction-57EJ2UBC.js → addDialogAgentAction-KLJ2YWWM.js} +16 -16
- package/{agentDeleteCommand-DRFCOTYP.js → agentDeleteCommand-PYQFS2IO.js} +135 -131
- package/{agentEmailCommands-FHENHUBF.js → agentEmailCommands-MSPYHNQA.js} +137 -136
- package/{agentGrantCommands-BMVKNYIY.js → agentGrantCommands-2VLLXGIU.js} +10 -9
- package/{agentListCommands-W66W5K3V.js → agentListCommands-436FHOIT.js} +68 -68
- package/{agentMachineCommands-C3BUBCXU.js → agentMachineCommands-HHH7DR26.js} +65 -65
- package/{agentProviderCommands-VIWKP7DM.js → agentProviderCommands-2W3VXDLV.js} +4 -3
- package/{agentPullCommand-5SNSXOY7.js → agentPullCommand-XEGOUYQT.js} +9 -8
- package/{agentRecordCommands-DYMHWTID.js → agentRecordCommands-ANOOR7DX.js} +127 -126
- package/{agentRun-QVFG3CI4.js → agentRun-P6GEVWAT.js} +137 -136
- package/{agentRunCommand-YV4V5HSL.js → agentRunCommand-SF4QKUF2.js} +139 -138
- package/{agentRunControl-RGBHKPKJ.js → agentRunControl-U2MV74WR.js} +17 -16
- package/{agentRuntimeLocal-LVEMOYS2.js → agentRuntimeLocal-P4MMGIR6.js} +55 -55
- package/{agentSlice-OJCM7OUX.js → agentSlice-NWSWCYRW.js} +17 -17
- package/{appConfigCommands-ZUXQLE7L.js → appConfigCommands-W4JQHMOJ.js} +61 -61
- package/{appDeleteCommands-L5UKUMXY.js → appDeleteCommands-IXR47IAV.js} +61 -61
- package/{appDeployCommands-KX2BRQUW.js → appDeployCommands-LB6DHDF4.js} +61 -61
- package/{appDeployStatusCommands-7LHRSWW7.js → appDeployStatusCommands-UQ6MJL6D.js} +61 -61
- package/{appGetCommands-F7SDFCUK.js → appGetCommands-M5JCTDDQ.js} +61 -61
- package/{appListCommands-U4NJKSMZ.js → appListCommands-TE3ZHE3I.js} +61 -61
- package/{appMigrateCommands-JAPOLYSW.js → appMigrateCommands-FOXH6R4B.js} +61 -61
- package/{appSourceCommands-TLXPWXUH.js → appSourceCommands-3ACYB6I7.js} +61 -61
- package/{authCommand-AU3GZBZ2.js → authCommand-I5OBJP5S.js} +20 -19
- package/{authCommands-JKBWMUQ4.js → authCommands-I6KCGOCN.js} +13 -12
- package/{builtinSkillRegistry-6XUWMAV5.js → builtinSkillRegistry-MIXYSZUU.js} +3 -6
- package/{chromeCommands-O4IIKTBD.js → chromeCommands-MVEEIY4R.js} +2 -2
- package/{chromeOpsCommands-F47WYQWF.js → chromeOpsCommands-IZRCYDSW.js} +7 -6
- package/{chunk-GF4LYNNZ.js → chunk-24BICQPB.js} +2 -2
- package/{chunk-LTCZOOAM.js → chunk-2AJLG6PY.js} +4 -4
- package/{chunk-HMFKYZKP.js → chunk-2JMYAH5O.js} +16 -16
- package/{chunk-WMBJDXMY.js → chunk-2LFYMWM3.js} +13 -16
- package/{chunk-VOO3YQQP.js → chunk-2O72G3U2.js} +1 -1
- package/{chunk-2I4R6ZRV.js → chunk-2QAZCYOM.js} +38 -10
- package/{chunk-CNYPQYXT.js → chunk-2R6M34JP.js} +75 -75
- package/{chunk-ZB2E724W.js → chunk-37DGW762.js} +4 -4
- package/{chunk-3A5NNQCN.js → chunk-3BQDF4QB.js} +46 -12
- package/{chunk-RWXHGPWJ.js → chunk-3UH7SS4W.js} +1 -1
- package/chunk-3VXVE2LF.js +12 -0
- package/{chunk-HAZ6UVH4.js → chunk-47T3QP4V.js} +3 -3
- package/{chunk-YRPIUIEQ.js → chunk-4DBTBNTX.js} +3 -6
- package/chunk-4MEKE5D3.js +229 -0
- package/chunk-526GLZJE.js +275 -0
- package/{chunk-FP46RAJQ.js → chunk-5MGXBQ3H.js} +3 -3
- package/{chunk-TJXO66M2.js → chunk-5MKPNTJP.js} +5 -5
- package/{chunk-L43DGEPZ.js → chunk-5YI447UL.js} +1 -1
- package/{chunk-SRVLHMES.js → chunk-6KA4XDEI.js} +32 -32
- package/{chunk-U5PSCTMR.js → chunk-6NYQHXMV.js} +13 -13
- package/chunk-6R4IY46J.js +14 -0
- package/{chunk-A4O76A6V.js → chunk-6S4VPBSW.js} +11 -11
- package/{chunk-MMXHIHJZ.js → chunk-7K4J76JQ.js} +20 -20
- package/{chunk-SU4NCTW4.js → chunk-B767MA64.js} +1 -1
- package/{chunk-RNLKWUVY.js → chunk-BAZCS5XG.js} +4 -4
- package/{chunk-EQOWWSNQ.js → chunk-BUO76CEE.js} +13 -13
- package/{chunk-NTBTVKKB.js → chunk-BWJLEN6X.js} +7 -7
- package/{chunk-UB7NV7NN.js → chunk-C36L6ZID.js} +1 -1
- package/{chunk-OSZNERNW.js → chunk-CQNGHKSG.js} +11 -11
- package/{chunk-TXMFSGRY.js → chunk-D2LTQAGN.js} +1 -1
- package/{chunk-DDKA6V6X.js → chunk-DBJAJ4UD.js} +3 -3
- package/{chunk-2MIZHEND.js → chunk-DFI7MVCQ.js} +4 -4
- package/{chunk-NJCTPWJU.js → chunk-DPFHC2DK.js} +6 -6
- package/{chunk-LHJB4BXJ.js → chunk-E2KZNP6C.js} +1 -1
- package/{chunk-IN4B6Z2D.js → chunk-E5JV4DCB.js} +4 -4
- package/{chunk-OIOMBPCA.js → chunk-EHFDVQF5.js} +2 -2
- package/{chunk-XJW6SLBZ.js → chunk-EZKIRVLJ.js} +6 -6
- package/{chunk-ER6NTALN.js → chunk-FGXG6OLW.js} +1 -1
- package/{chunk-CL33RFD7.js → chunk-GH34JXNV.js} +1 -1
- package/{chunk-WY6DMHMG.js → chunk-GWB6AGME.js} +1 -1
- package/{chunk-SWJRX4M5.js → chunk-HI5RS2O4.js} +328 -9
- package/{chunk-J22PFCQN.js → chunk-HRWRIPTB.js} +7 -7
- package/{chunk-KAHYBAEN.js → chunk-HYCVEESH.js} +12 -72
- package/{chunk-7X4BFUJV.js → chunk-I5BYFTYK.js} +3 -3
- package/{chunk-AQNWWJLH.js → chunk-I6YIA2TY.js} +1 -1
- package/{chunk-ZQAADXSF.js → chunk-IB5AR52X.js} +1 -1
- package/{chunk-TCOHWKDM.js → chunk-IYRZKHA6.js} +1 -1
- package/{chunk-XUDXQT7R.js → chunk-J44TXB4J.js} +20 -18
- package/{chunk-VZDSNDUD.js → chunk-JTRU7WEG.js} +35 -35
- package/{chunk-FNLT7NKG.js → chunk-K7HLFORE.js} +3 -3
- package/{chunk-UBOTXA3Z.js → chunk-KGBASAB5.js} +6 -6
- package/chunk-KJ4J2XQB.js +129 -0
- package/{chunk-GEC4CHS2.js → chunk-KTK64ZZN.js} +5 -5
- package/{chunk-6BBXJGIQ.js → chunk-KUZSTAE3.js} +36 -36
- package/{chunk-Z7EP5HDL.js → chunk-KYHNSSL2.js} +1 -1
- package/chunk-KZO2MTVM.js +140 -0
- package/{chunk-ERCSHBUD.js → chunk-L4KZCAIJ.js} +95 -95
- package/{chunk-72VWN4VK.js → chunk-LHTXSC2E.js} +18 -6
- package/{chunk-MSFKHPA6.js → chunk-LRLLWD4P.js} +1 -1
- package/{chunk-RIOAPUGV.js → chunk-M75RM77T.js} +9 -0
- package/{chunk-SARJZIGR.js → chunk-MI6HRMCK.js} +1 -1
- package/{chunk-A454UXB6.js → chunk-MKR6KDD3.js} +13 -9
- package/{chunk-MPWQI36J.js → chunk-MTNQNLSE.js} +12 -12
- package/{chunk-D3ONA3FP.js → chunk-NH4PUEWK.js} +2 -2
- package/{chunk-IWWJSSST.js → chunk-NTUNHTJV.js} +4 -4
- package/{chunk-XREMPMNK.js → chunk-OKUSDVRS.js} +3 -3
- package/{chunk-UEZL3RBG.js → chunk-OLJSB44A.js} +37 -36
- package/{chunk-63G7JWEA.js → chunk-OQH3TAB7.js} +6 -6
- package/{chunk-M7VNNPVX.js → chunk-OV47NSYQ.js} +117 -121
- package/{chunk-WEEB2JKA.js → chunk-P62DHV4F.js} +4 -4
- package/{chunk-3QMN3T6L.js → chunk-PEXGRTTQ.js} +4 -4
- package/{chunk-4HZCBA4Q.js → chunk-PHIERFHT.js} +4 -4
- package/{chunk-P4I55ASV.js → chunk-PJVJIDTH.js} +12 -12
- package/{chunk-QZYQ3Y3G.js → chunk-PKDFU6MY.js} +1 -1
- package/chunk-PSJJBBWV.js +42 -0
- package/{chunk-3B7OTHDW.js → chunk-Q6FKWH66.js} +14 -14
- package/{chunk-NLS7F5DW.js → chunk-QAUBNGF2.js} +22 -22
- package/{chunk-LUTSMSIL.js → chunk-QHSF7SPP.js} +7 -7
- package/{chunk-7LS5ATRP.js → chunk-QXHFIX7W.js} +82 -2
- package/{chunk-W2Z5E2R7.js → chunk-QY4NZCDA.js} +10 -10
- package/{chunk-BUGLH2A7.js → chunk-RIRFHJTW.js} +4 -4
- package/{chunk-G5IAIGGD.js → chunk-RYMLMTPZ.js} +10 -10
- package/{chunk-XKNDVHF5.js → chunk-S6FAHQDH.js} +4 -4
- package/{chunk-GH6SS2DZ.js → chunk-SVFFKLMR.js} +11 -11
- package/{chunk-YVOUSIIA.js → chunk-SVKWZ3EG.js} +1 -1
- package/{chunk-Q5IXZF3S.js → chunk-T7KODHYS.js} +3 -3
- package/{chunk-P4XAHM4B.js → chunk-TA5QI4MM.js} +1 -1
- package/{chunk-VCESLFF4.js → chunk-TEFD5E2D.js} +3 -3
- package/{chunk-EDKMRDET.js → chunk-UMADT6B2.js} +3 -3
- package/{chunk-3TII7WCF.js → chunk-V6K5U4YE.js} +9 -9
- package/{chunk-LHCIIUCX.js → chunk-VI4SWTUO.js} +7 -7
- package/{chunk-Z27AH6A5.js → chunk-VXUQWCEZ.js} +4 -4
- package/{chunk-QXWXRBOL.js → chunk-WJ5IXN23.js} +3 -3
- package/{chunk-T3Y2NA4H.js → chunk-WRHVVIGI.js} +4 -4
- package/chunk-WTIJKWCI.js +118 -0
- package/{chunk-UJL23HBL.js → chunk-WWE3TYSA.js} +24 -24
- package/{chunk-ULPU4C43.js → chunk-XCPC4RXE.js} +24 -24
- package/{chunk-CK2LMTYO.js → chunk-Y3KGWZKF.js} +5 -5
- package/{chunk-SJFL32RD.js → chunk-YCITCYSJ.js} +2 -2
- package/{chunk-HB4J5HA6.js → chunk-YR4J7RFS.js} +3 -3
- package/{chunk-KALCFXQO.js → chunk-YSYTCIFN.js} +200 -151
- package/{chunk-2FGFY72B.js → chunk-Z7TB2J74.js} +14 -14
- package/{chunk-CEIWXKHP.js → chunk-ZCLSM5AK.js} +12 -12
- package/{chunk-L45P4JTE.js → chunk-ZHWTBHT3.js} +17 -17
- package/{chunk-FF5ZRKW7.js → chunk-ZJACPM5O.js} +2 -2
- package/{chunk-JPYOHIHX.js → chunk-ZMOKHBV5.js} +18 -18
- package/{chunk-VC3MAT33.js → chunk-ZZOXGB2Z.js} +195 -151
- package/{cliAgentConfigHelpers-BJJEXHSZ.js → cliAgentConfigHelpers-WB2S7PDO.js} +16 -15
- package/{cliAuthorityBrokerProcess-VIJEKQSX.js → cliAuthorityBrokerProcess-BMBVXPKU.js} +7 -17
- package/{chunk-O77F26YB.js → cliAuthorityBrokerServer-27C5YBYP.js} +31 -504
- package/{cliEnvHelpers-NDMKN4X2.js → cliEnvHelpers-7V5ZWUJA.js} +4 -3
- package/{cliLocalAgentRecordReader-KCZS2MZU.js → cliLocalAgentRecordReader-QKKRK53P.js} +61 -61
- package/{cloudAutomationCommands-2WQUGQSW.js → cloudAutomationCommands-S52NKCLL.js} +61 -61
- package/{commandRegistry-C64JBZJ3.js → commandRegistry-ZEZY7MPW.js} +131 -131
- package/{contentThunks-G3HEIRXC.js → contentThunks-N3DDKRNJ.js} +48 -47
- package/{cooldownCommands-FPAFS7XG.js → cooldownCommands-ZFDAL4MR.js} +1 -1
- package/{createAgentAutomationAction-DSBL3X3A.js → createAgentAutomationAction-W3B6KOIW.js} +50 -49
- package/{createDialogAction-OHFUHC53.js → createDialogAction-V6WA7USR.js} +49 -48
- package/{createPageAction-E6JZSZLU.js → createPageAction-P2HDHBCU.js} +51 -50
- package/{db-KTQ3LL2Q.js → db-LTHLW7QA.js} +6 -4
- package/{dbSlice-U3GPLEL3.js → dbSlice-WNUHTF4C.js} +13 -13
- package/{deleteDbKey-DRXKWJX5.js → deleteDbKey-TDXLWHVF.js} +49 -48
- package/{dialogCommands-4EX2OTIC.js → dialogCommands-4MOLJW4G.js} +71 -71
- package/{dialogNotifyCommand-4SCE2Z2R.js → dialogNotifyCommand-YL2GFKLO.js} +19 -18
- package/{dialogPortabilityCommands-ZSFFHRX4.js → dialogPortabilityCommands-YQJNB2KL.js} +4 -3
- package/{dialogSlice-PRZCIJCH.js → dialogSlice-TEV6XXOO.js} +46 -45
- package/{dialogTraceCommand-RKB76OVX.js → dialogTraceCommand-HWXGIGZX.js} +79 -79
- package/{dialogUsageCommand-BP7HMRYP.js → dialogUsageCommand-IO2BQKL2.js} +6 -5
- package/{docCreateCommands-JGPNGIZ7.js → docCreateCommands-OYLRBK2M.js} +60 -60
- package/{docDeleteCommands-XRJTNRDH.js → docDeleteCommands-3NF6QPJU.js} +61 -61
- package/{docReadCommands-6GFO4ARS.js → docReadCommands-CBAERJAP.js} +60 -60
- package/{docStore-QRLIWFTU.js → docStore-OVBEONC7.js} +15 -15
- package/{docUpdateCommands-W2GXMUXW.js → docUpdateCommands-BAMCGX6F.js} +60 -60
- package/{ebookDownloaderAgentCommand-2DHPGEOQ.js → ebookDownloaderAgentCommand-NOIZ6U7Y.js} +8 -7
- package/{fetchMessages-RGPIYEPZ.js → fetchMessages-P7FSCSXV.js} +2 -2
- package/{getPricing-BK6CUBAE.js → getPricing-KNXVEIUI.js} +6 -6
- package/{handleSendMessageAction-DHGWURJZ.js → handleSendMessageAction-5GZ44SKK.js} +95 -93
- package/{hostCredentialCreate-FPUZ7RMI.js → hostCredentialCreate-WOLFFVCM.js} +130 -129
- package/i18n-SAK6DDY4.js +51 -0
- package/index.js +163 -184
- package/levelAuthorityStore-L5SVDM5O.js +10 -0
- package/{localAutomationCommands-ZMU22RQJ.js → localAutomationCommands-L333FJPR.js} +32 -31
- package/{localAutomationRuntime-MU5FGJ3V.js → localAutomationRuntime-CIHGJBSC.js} +30 -29
- package/{localDialogRead-W2EVXISA.js → localDialogRead-GWGWSL5K.js} +2 -2
- package/{localRuntimeAdapter-YBXQBV4G.js → localRuntimeAdapter-6WNR7IYN.js} +123 -122
- package/{localRuntimeAuthority-LDXMEDO5.js → localRuntimeAuthority-Q5C2KWGF.js} +11 -10
- package/{localRuntimeDb-6TQZDLNU.js → localRuntimeDb-MM3DINZM.js} +1 -1
- package/{machineCommands-57RTUYRV.js → machineCommands-CP7NCD6O.js} +132 -131
- package/{machineInfo-BJIU3WQ5.js → machineInfo-HNPJHQFU.js} +5 -3
- package/{machineWsRunDispatch-VBKV3FFE.js → machineWsRunDispatch-YIAY2LPK.js} +124 -123
- package/{mcpLocalAuthorizeCommand-J76SOJVZ.js → mcpLocalAuthorizeCommand-IKOFKY5U.js} +32 -31
- package/{mcpLocalManageCommands-USETIMHB.js → mcpLocalManageCommands-KUDZQRM4.js} +32 -31
- package/{memberThunks-7UERUEMI.js → memberThunks-TD76IFGA.js} +209 -26
- package/{memoryCommands-N7NHEE55.js → memoryCommands-SVLAVFCV.js} +4 -3
- package/{offlineMarxistsAgentCommand-WZBJBCPZ.js → offlineMarxistsAgentCommand-MFURGWHL.js} +5 -4
- package/package.json +1 -1
- package/{parityCommands-LYDLWSLK.js → parityCommands-5OCBPVES.js} +61 -61
- package/{projectArchive-KCNQDVWJ.js → projectArchive-KJRBIY3O.js} +55 -54
- package/{read-SPSQ6NLR.js → read-D4WYJQJQ.js} +10 -10
- package/{readDocTool-ENUL2GNL.js → readDocTool-3S3OQFOH.js} +2 -2
- package/{readlineWorkspace-MKS7TAEF.js → readlineWorkspace-2PLTEZDM.js} +223 -222
- package/{rememberExplicit-7KX4HXQC.js → rememberExplicit-ZPI6KK5M.js} +3 -2
- package/{remove-TNNDO635.js → remove-AHRMUDMH.js} +10 -10
- package/{removeDialogAgentAction-POPUZ3WU.js → removeDialogAgentAction-AALRBFSA.js} +19 -19
- package/{runAgentClientLoop-KVILXQNI.js → runAgentClientLoop-IBWSCK2D.js} +93 -92
- package/{runtimeDoctorCommands-4J2DP4LZ.js → runtimeDoctorCommands-52MBG5JN.js} +25 -24
- package/{secretCommands-CSTQYB6T.js → secretCommands-2PSS3QNZ.js} +2 -2
- package/{setDialogExtraReferencesAction-35THMVBP.js → setDialogExtraReferencesAction-SLHQ3GYL.js} +15 -15
- package/{setPrimaryDialogAgentAction-WLXBNIG7.js → setPrimaryDialogAgentAction-XKCSGJ7M.js} +19 -19
- package/{settingThunks-6Y5U5M5N.js → settingThunks-PNC7ZISV.js} +22 -22
- package/{spaceCommands-LXNJBO2U.js → spaceCommands-Z2CTQD6G.js} +62 -62
- package/{spacePruneCommand-2ITUFYBM.js → spacePruneCommand-YKIEUIDQ.js} +4 -3
- package/{streamAgentChatTurn-EY6MFKCA.js → streamAgentChatTurn-JAAROGLD.js} +123 -122
- package/{switchDialogAgentAction-TG6BQRDA.js → switchDialogAgentAction-YJIWQGIR.js} +16 -16
- package/{tableCommands-35G34R4B.js → tableCommands-FCPDULSU.js} +19 -18
- package/{toolApiClient-MPQIFYXP.js → toolApiClient-FVXTIIEN.js} +9 -9
- package/{tools-CSLTRRUR.js → tools-TCOYT5DJ.js} +73 -72
- package/{tuiRestart-ALR4Q3JM.js → tuiRestart-LU2BDLAW.js} +18 -17
- package/{tuiSummaryLlmCaller-3Y3JEXJK.js → tuiSummaryLlmCaller-Z2ZVBIGN.js} +23 -22
- package/{updateCommands-GHQVP6Z5.js → updateCommands-4QP7WJLA.js} +9 -8
- package/{updateDialogTitleAction-LFAWF5EW.js → updateDialogTitleAction-O3TRFRIH.js} +51 -50
- package/{usageCommand-5VKW6T4C.js → usageCommand-AZX7D3LB.js} +2 -2
- package/{usageRebuildCommand-VUQETFMW.js → usageRebuildCommand-XV5QQCHK.js} +3 -3
- package/versionChangeNotice-RFABJGJE.js +35 -0
- package/{windowsSelfUpdate-SXSVXK4X.js → windowsSelfUpdate-5OFKSW6Y.js} +2 -2
- package/chunk-AMNZPQCY.js +0 -635
- package/chunk-IVK2KT3H.js +0 -209
- package/chunk-KGWE224L.js +0 -246
- package/{chunk-YY7IGJMN.js → chunk-ADMRXWXJ.js} +3 -3
- package/{chunk-CW6LRDSF.js → chunk-LLP2NDED.js} +6 -6
- package/{chunk-GX2MFKF3.js → chunk-SSGTV4FC.js} +3 -3
- package/{chunk-FOC4TORM.js → chunk-TSBJVMNW.js} +5 -5
- package/{chunk-O7ZY6SUK.js → chunk-UYQILGDR.js} +9 -9
- package/{chunk-HXER7YJF.js → chunk-VXL2FZTP.js} +3 -3
- package/{chunk-WSQLCWLQ.js → chunk-YECCIUYU.js} +3 -3
- package/{chunk-U6RD332P.js → chunk-YQJEXXDK.js} +3 -3
- package/{chunk-HVRG27HI.js → chunk-ZV7ZY46L.js} +7 -7
- package/{providerPresetApply-IRJ56XIZ.js → providerPresetApply-YCVSP2WX.js} +3 -3
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadCliAuthorityBrokerTls
|
|
3
|
+
} from "./chunk-3BQDF4QB.js";
|
|
4
|
+
import {
|
|
5
|
+
getLogger
|
|
6
|
+
} from "./chunk-EYLGAEB4.js";
|
|
7
|
+
import {
|
|
8
|
+
getHostRuntimeExecutable,
|
|
9
|
+
isCompiledBinary,
|
|
10
|
+
resolveCliEntrypointPath
|
|
11
|
+
} from "./chunk-2AJLG6PY.js";
|
|
12
|
+
import {
|
|
13
|
+
createCliAuthorityBrokerSocketInvoker
|
|
14
|
+
} from "./chunk-LPXBBC32.js";
|
|
15
|
+
|
|
16
|
+
// packages/cli/cliAuthorityBrokerProcess.ts
|
|
17
|
+
import { spawn } from "node:child_process";
|
|
18
|
+
import { dirname, isAbsolute, resolve } from "node:path";
|
|
19
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
20
|
+
var testOwnedBroker = () => process.env.NOLO_TEST_AUTHORITY_BROKER_LIFETIME === "1";
|
|
21
|
+
function stopOnParentExit(stop) {
|
|
22
|
+
process.stdin.once("end", stop);
|
|
23
|
+
process.stdin.once("error", stop);
|
|
24
|
+
process.stdin.resume();
|
|
25
|
+
}
|
|
26
|
+
function describeFailure(error, depth = 0) {
|
|
27
|
+
if (!(error instanceof Error)) return { message: String(error) };
|
|
28
|
+
const { message, code, ownerPid, cause } = error;
|
|
29
|
+
return {
|
|
30
|
+
message,
|
|
31
|
+
...typeof code === "string" ? { code } : {},
|
|
32
|
+
...typeof ownerPid === "number" ? { ownerPid } : {},
|
|
33
|
+
...cause !== void 0 && depth < 4 ? { cause: describeFailure(cause, depth + 1) } : {}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async function startCliAuthorityBrokerProcess(options) {
|
|
37
|
+
const child = await launchBroker(options, true);
|
|
38
|
+
child.unref();
|
|
39
|
+
}
|
|
40
|
+
async function launchBroker(options, detached) {
|
|
41
|
+
const { endpoint, dbPath, metadataPath, healthPath } = options;
|
|
42
|
+
if (!dbPath || !metadataPath || !healthPath) throw new Error("Missing authority broker paths");
|
|
43
|
+
const entrypoint = isCompiledBinary() ? [] : [resolveCliEntrypointPath(import.meta.url)];
|
|
44
|
+
const { PATH, HOME, USERPROFILE, LOCALAPPDATA, SystemRoot, TMPDIR, TEMP, TMP } = process.env;
|
|
45
|
+
const testOwned = testOwnedBroker();
|
|
46
|
+
const child = spawn(getHostRuntimeExecutable(), [
|
|
47
|
+
...entrypoint,
|
|
48
|
+
detached ? "__authority-broker-supervise" : "__authority-broker",
|
|
49
|
+
endpoint,
|
|
50
|
+
resolve(dbPath),
|
|
51
|
+
resolve(metadataPath),
|
|
52
|
+
resolve(healthPath),
|
|
53
|
+
...detached ? [] : [String(process.pid)]
|
|
54
|
+
], {
|
|
55
|
+
detached,
|
|
56
|
+
windowsHide: true,
|
|
57
|
+
// Only tests hold a lifetime pipe. Production deliberately outlives its launcher.
|
|
58
|
+
stdio: [testOwned ? "pipe" : "ignore", "pipe", "ignore"],
|
|
59
|
+
env: {
|
|
60
|
+
PATH,
|
|
61
|
+
HOME,
|
|
62
|
+
USERPROFILE,
|
|
63
|
+
LOCALAPPDATA,
|
|
64
|
+
SystemRoot,
|
|
65
|
+
TMPDIR,
|
|
66
|
+
TEMP,
|
|
67
|
+
TMP,
|
|
68
|
+
NOLO_HOME: dirname(dirname(resolve(dbPath))),
|
|
69
|
+
...testOwned ? { NOLO_TEST_AUTHORITY_BROKER_LIFETIME: "1" } : {}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
child.stdin?.on("error", () => {
|
|
73
|
+
});
|
|
74
|
+
const output = child.stdout;
|
|
75
|
+
try {
|
|
76
|
+
await new Promise((resolve2, reject) => {
|
|
77
|
+
let response = "";
|
|
78
|
+
const timer = setTimeout(() => reject(new Error(`Authority broker startup timed out at ${endpoint}`)), 3e4);
|
|
79
|
+
const done = (error) => {
|
|
80
|
+
clearTimeout(timer);
|
|
81
|
+
if (error) reject(error);
|
|
82
|
+
else resolve2();
|
|
83
|
+
};
|
|
84
|
+
child.once("error", done);
|
|
85
|
+
child.once("exit", (_code, signal) => {
|
|
86
|
+
if (signal) done(new Error(`Authority broker exited during startup (${signal})`));
|
|
87
|
+
});
|
|
88
|
+
output.once("error", done);
|
|
89
|
+
output.once("end", () => done(new Error("Authority broker exited before reporting readiness")));
|
|
90
|
+
output.setEncoding("utf8");
|
|
91
|
+
output.on("data", (chunk) => {
|
|
92
|
+
response += chunk;
|
|
93
|
+
if (response.length > 64 * 1024) return done(new Error("Oversized authority broker startup response"));
|
|
94
|
+
const newline = response.indexOf("\n");
|
|
95
|
+
if (newline < 0) return;
|
|
96
|
+
try {
|
|
97
|
+
const result = JSON.parse(response.slice(0, newline));
|
|
98
|
+
if (result.ok === true) done();
|
|
99
|
+
else if (result.error) done(Object.assign(new Error(result.error.message), result.error));
|
|
100
|
+
else done(new Error("Invalid authority broker startup response"));
|
|
101
|
+
} catch {
|
|
102
|
+
done(new Error("Invalid authority broker startup response"));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return child;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
child.stdin?.end();
|
|
109
|
+
child.unref();
|
|
110
|
+
throw error;
|
|
111
|
+
} finally {
|
|
112
|
+
output.destroy();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async function superviseCliAuthorityBrokerProcess(args) {
|
|
116
|
+
const [endpoint, dbPath, metadataPath, healthPath] = args;
|
|
117
|
+
const options = { endpoint: endpoint ?? "", dbPath, metadataPath, healthPath };
|
|
118
|
+
const logger = getLogger("cli.authorityBroker");
|
|
119
|
+
const stop = new AbortController();
|
|
120
|
+
const requestStop = () => stop.abort();
|
|
121
|
+
process.once("SIGTERM", requestStop);
|
|
122
|
+
process.once("SIGINT", requestStop);
|
|
123
|
+
if (testOwnedBroker()) stopOnParentExit(requestStop);
|
|
124
|
+
process.stdout.on("error", () => {
|
|
125
|
+
});
|
|
126
|
+
let ready = false;
|
|
127
|
+
try {
|
|
128
|
+
if (!metadataPath) throw new Error("Missing authority broker metadata path");
|
|
129
|
+
const tls = await loadCliAuthorityBrokerTls(metadataPath);
|
|
130
|
+
while (!stop.signal.aborted) {
|
|
131
|
+
const child = await launchBroker(options, false);
|
|
132
|
+
logger.info("Authority broker worker ready", { endpoint, workerPid: child.pid, supervisorPid: process.pid });
|
|
133
|
+
if (!ready) {
|
|
134
|
+
process.stdout.write('{"ok":true}\n');
|
|
135
|
+
ready = true;
|
|
136
|
+
}
|
|
137
|
+
const workerExit = new AbortController();
|
|
138
|
+
const exited = child.exitCode !== null || child.signalCode !== null ? Promise.resolve(workerExit.abort()) : new Promise((resolve2) => child.once("exit", () => {
|
|
139
|
+
workerExit.abort();
|
|
140
|
+
resolve2();
|
|
141
|
+
}));
|
|
142
|
+
const workerRunning = AbortSignal.any([workerExit.signal, stop.signal]);
|
|
143
|
+
const invoke = createCliAuthorityBrokerSocketInvoker({ endpoint: options.endpoint, timeoutMs: 2e3, tls });
|
|
144
|
+
let failures = 0;
|
|
145
|
+
while (!workerRunning.aborted && failures < 3) {
|
|
146
|
+
await delay(5e3, void 0, { signal: workerRunning }).catch(() => {
|
|
147
|
+
});
|
|
148
|
+
if (workerRunning.aborted) break;
|
|
149
|
+
try {
|
|
150
|
+
const health = await invoke({ type: "get", key: "cli-authority-broker-health" });
|
|
151
|
+
failures = health.ok && health.result.type === "get" ? 0 : failures + 1;
|
|
152
|
+
} catch (error) {
|
|
153
|
+
failures += 1;
|
|
154
|
+
logger.warn("Authority broker storage probe failed", error, { endpoint, workerPid: child.pid, failures });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
invoke.close?.();
|
|
158
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
159
|
+
if (!stop.signal.aborted) logger.warn("Restarting unresponsive authority broker worker", { endpoint, workerPid: child.pid });
|
|
160
|
+
if (child.stdin) child.stdin.end();
|
|
161
|
+
else child.kill("SIGTERM");
|
|
162
|
+
const killed = await Promise.race([exited.then(() => true), delay(5e3, false, { ref: false })]);
|
|
163
|
+
if (!killed) {
|
|
164
|
+
child.kill("SIGKILL");
|
|
165
|
+
await exited;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (!stop.signal.aborted) await delay(1e3);
|
|
169
|
+
}
|
|
170
|
+
} catch (error) {
|
|
171
|
+
process.exitCode = 1;
|
|
172
|
+
const failure = JSON.stringify({ ok: false, error: describeFailure(error) });
|
|
173
|
+
if (!ready) process.stdout.write(`${failure}
|
|
174
|
+
`);
|
|
175
|
+
logger.error("Authority broker supervisor stopped", error, { endpoint, ready });
|
|
176
|
+
} finally {
|
|
177
|
+
process.off("SIGTERM", requestStop);
|
|
178
|
+
process.off("SIGINT", requestStop);
|
|
179
|
+
if (testOwnedBroker()) process.stdin.destroy();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
async function runCliAuthorityBrokerProcess(args) {
|
|
183
|
+
const [endpoint, dbPath, metadataPath, healthPath, supervisor] = args;
|
|
184
|
+
process.stdout.on("error", () => {
|
|
185
|
+
});
|
|
186
|
+
try {
|
|
187
|
+
if (args.length !== 4 && args.length !== 5 || ![dbPath, metadataPath, healthPath].every(isAbsolute)) {
|
|
188
|
+
throw new Error("Expected authority broker endpoint and absolute database, metadata and health paths");
|
|
189
|
+
}
|
|
190
|
+
if (!/^tcp:\/\/127\.0\.0\.1:[0-9]+$/.test(endpoint)) {
|
|
191
|
+
throw new Error("Authority broker must listen on IPv4 loopback");
|
|
192
|
+
}
|
|
193
|
+
const [{ getOrCreateCliAuthorityBrokerServer }, { createLevelAuthorityStore }] = await Promise.all([
|
|
194
|
+
import("./cliAuthorityBrokerServer-27C5YBYP.js"),
|
|
195
|
+
import("./levelAuthorityStore-L5SVDM5O.js")
|
|
196
|
+
]);
|
|
197
|
+
const broker = await getOrCreateCliAuthorityBrokerServer({
|
|
198
|
+
endpoint,
|
|
199
|
+
dbPath,
|
|
200
|
+
metadataPath,
|
|
201
|
+
healthPath,
|
|
202
|
+
keepProcessAlive: true,
|
|
203
|
+
tls: await loadCliAuthorityBrokerTls(metadataPath),
|
|
204
|
+
...supervisor === String(process.ppid) ? { supervisorPid: process.ppid } : {},
|
|
205
|
+
createStore: () => createLevelAuthorityStore(dbPath)
|
|
206
|
+
});
|
|
207
|
+
const close = () => {
|
|
208
|
+
if (testOwnedBroker()) process.stdin.destroy();
|
|
209
|
+
void broker.close().catch((error) => {
|
|
210
|
+
getLogger("cli.authorityBroker").error("Authority broker worker shutdown failed", error);
|
|
211
|
+
process.exit(1);
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
process.once("SIGTERM", close);
|
|
215
|
+
process.once("SIGINT", close);
|
|
216
|
+
if (testOwnedBroker()) stopOnParentExit(close);
|
|
217
|
+
process.stdout.write('{"ok":true}\n');
|
|
218
|
+
} catch (error) {
|
|
219
|
+
process.exitCode = 1;
|
|
220
|
+
process.stdout.write(`${JSON.stringify({ ok: false, error: describeFailure(error) })}
|
|
221
|
+
`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export {
|
|
226
|
+
startCliAuthorityBrokerProcess,
|
|
227
|
+
superviseCliAuthorityBrokerProcess,
|
|
228
|
+
runCliAuthorityBrokerProcess
|
|
229
|
+
};
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DIALOG_TURN_DEFAULT_TTL_MS,
|
|
3
|
+
DIALOG_TURN_MAX_PAYLOAD_BYTES,
|
|
4
|
+
isDialogTurnMessageId,
|
|
5
|
+
isDialogTurnRecord,
|
|
6
|
+
validateDialogTurnRequest
|
|
7
|
+
} from "./chunk-EUHMI5KG.js";
|
|
8
|
+
import {
|
|
9
|
+
isLevelNotFoundError
|
|
10
|
+
} from "./chunk-OW765XBU.js";
|
|
11
|
+
import {
|
|
12
|
+
createKey
|
|
13
|
+
} from "./chunk-DLXL4NSL.js";
|
|
14
|
+
import {
|
|
15
|
+
dialogMessageKey
|
|
16
|
+
} from "./chunk-OJKUU3LP.js";
|
|
17
|
+
|
|
18
|
+
// packages/database-engine/dialogTurnAuthority.ts
|
|
19
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
20
|
+
var DIALOG_TURN_STATE_PREFIX = "dialog-turn-state:";
|
|
21
|
+
var DIALOG_TURN_IDEM_PREFIX = "dialog-turn-idem:";
|
|
22
|
+
var isDialogTurnAuthorityReservedKey = (key) => typeof key === "string" && (key.startsWith(DIALOG_TURN_STATE_PREFIX) || key.startsWith(DIALOG_TURN_IDEM_PREFIX));
|
|
23
|
+
var dialogTurnNamespaceKey = (dialogId) => `${DIALOG_TURN_STATE_PREFIX}:owner:${dialogId}`;
|
|
24
|
+
var dialogTurnStateKey = ({ userId, dialogId }) => `${DIALOG_TURN_STATE_PREFIX}${userId}:${dialogId}`;
|
|
25
|
+
var keysFor = ({ userId, dialogId }) => ({
|
|
26
|
+
dialogKey: createKey("dialog" /* DIALOG */, userId, dialogId),
|
|
27
|
+
stateKey: dialogTurnStateKey({ userId, dialogId }),
|
|
28
|
+
namespaceKey: dialogTurnNamespaceKey(dialogId),
|
|
29
|
+
idemKey: (commandId) => `${DIALOG_TURN_IDEM_PREFIX}${userId}:${dialogId}:${commandId}`
|
|
30
|
+
});
|
|
31
|
+
var queues = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
function serialize(store, key, task) {
|
|
33
|
+
let tails = queues.get(store);
|
|
34
|
+
if (!tails) queues.set(store, tails = /* @__PURE__ */ new Map());
|
|
35
|
+
const current = (tails.get(key) ?? Promise.resolve()).then(task);
|
|
36
|
+
const settled = current.then(() => void 0, () => void 0);
|
|
37
|
+
tails.set(key, settled);
|
|
38
|
+
void settled.then(() => {
|
|
39
|
+
if (tails.get(key) === settled) tails.delete(key);
|
|
40
|
+
});
|
|
41
|
+
return current;
|
|
42
|
+
}
|
|
43
|
+
async function getOptional(store, key) {
|
|
44
|
+
try {
|
|
45
|
+
return await store.get(key);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (isLevelNotFoundError(error)) return void 0;
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function summarize(turn) {
|
|
52
|
+
if (!turn) return null;
|
|
53
|
+
const { runId, holder, holderKind, startedAt, heartbeatAt, expiresAt } = turn;
|
|
54
|
+
return { runId, holder, holderKind, startedAt, heartbeatAt, expiresAt };
|
|
55
|
+
}
|
|
56
|
+
function revisionOf(row) {
|
|
57
|
+
return isDialogTurnRecord(row) && typeof row.dialogRevision === "number" ? row.dialogRevision : 0;
|
|
58
|
+
}
|
|
59
|
+
function fingerprint(value) {
|
|
60
|
+
const hash = createHash("sha256");
|
|
61
|
+
let bytes = 0;
|
|
62
|
+
const tooLarge = Symbol();
|
|
63
|
+
const invalid = Symbol();
|
|
64
|
+
const add = (part) => {
|
|
65
|
+
bytes += Buffer.byteLength(part);
|
|
66
|
+
if (bytes > DIALOG_TURN_MAX_PAYLOAD_BYTES) throw tooLarge;
|
|
67
|
+
hash.update(part);
|
|
68
|
+
};
|
|
69
|
+
const visit = (item, depth) => {
|
|
70
|
+
if (depth > 64) throw invalid;
|
|
71
|
+
if (item === null || typeof item === "boolean" || typeof item === "string" || typeof item === "number" && Number.isFinite(item)) {
|
|
72
|
+
if (typeof item === "string" && item.length > DIALOG_TURN_MAX_PAYLOAD_BYTES) throw tooLarge;
|
|
73
|
+
add(JSON.stringify(item));
|
|
74
|
+
} else if (Array.isArray(item)) {
|
|
75
|
+
add("[");
|
|
76
|
+
for (let i = 0; i < item.length; i++) {
|
|
77
|
+
if (i) add(",");
|
|
78
|
+
visit(item[i], depth + 1);
|
|
79
|
+
}
|
|
80
|
+
add("]");
|
|
81
|
+
} else if (isDialogTurnRecord(item)) {
|
|
82
|
+
add("{");
|
|
83
|
+
for (const [index, key] of Object.keys(item).sort().entries()) {
|
|
84
|
+
if (index) add(",");
|
|
85
|
+
add(JSON.stringify(key));
|
|
86
|
+
add(":");
|
|
87
|
+
visit(item[key], depth + 1);
|
|
88
|
+
}
|
|
89
|
+
add("}");
|
|
90
|
+
} else throw invalid;
|
|
91
|
+
};
|
|
92
|
+
try {
|
|
93
|
+
visit(value, 0);
|
|
94
|
+
return { hash: hash.digest("hex") };
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (error !== tooLarge && error !== invalid) throw error;
|
|
97
|
+
return { status: error === tooLarge ? "payload_too_large" : "invalid_request", field: "payload" };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
var titleFields = ["title", "titleSource", "titleUpdatedAt"];
|
|
101
|
+
function createDialogTurnAuthority(store, options = {}) {
|
|
102
|
+
const now = options.now ?? Date.now;
|
|
103
|
+
const guarded = (task) => store.runPublicationBatch && typeof store.batchWrite === "function" ? store.runPublicationBatch((access) => task({
|
|
104
|
+
...access,
|
|
105
|
+
put: (key, value) => access.batchWrite([{ type: "put", key, value }]),
|
|
106
|
+
del: (key) => access.batchWrite([{ type: "del", key }])
|
|
107
|
+
})) : task(store);
|
|
108
|
+
const run = (method, raw, task) => {
|
|
109
|
+
const parsed = validateDialogTurnRequest(method, raw);
|
|
110
|
+
if (!parsed.ok) return Promise.resolve(parsed.error);
|
|
111
|
+
const keys = keysFor(parsed.input.dialogRef);
|
|
112
|
+
return serialize(store, keys.namespaceKey, () => guarded((access) => task(parsed.input, keys, access)));
|
|
113
|
+
};
|
|
114
|
+
const active = async (access, key) => await getOptional(access, key) ?? null;
|
|
115
|
+
const checkNamespace = async (access, { namespaceKey, dialogKey }, ref, row) => {
|
|
116
|
+
const owner = await getOptional(access, namespaceKey);
|
|
117
|
+
if (owner !== void 0 && owner !== dialogKey) return "forbidden";
|
|
118
|
+
if (options.verifyNamespace && (owner === void 0 || row !== void 0) && !await options.verifyNamespace(ref, row)) return "forbidden";
|
|
119
|
+
return owner === void 0 ? "unclaimed" : "claimed";
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
getDialogTurnState: (raw) => run("getDialogTurnState", raw, async (_, { dialogKey, stateKey }, access) => ({
|
|
123
|
+
ok: true,
|
|
124
|
+
dialogKey,
|
|
125
|
+
dialogRevision: revisionOf(await getOptional(access, dialogKey)),
|
|
126
|
+
activeTurn: summarize(await active(access, stateKey))
|
|
127
|
+
})),
|
|
128
|
+
beginDialogTurn: (raw) => run("beginDialogTurn", raw, async (input, { dialogKey, stateKey, namespaceKey }, access) => {
|
|
129
|
+
const current = await active(access, stateKey);
|
|
130
|
+
const row = await getOptional(access, dialogKey);
|
|
131
|
+
const dialogRevision = revisionOf(row);
|
|
132
|
+
const namespace = options.verifyNamespace ? await checkNamespace(access, { namespaceKey, dialogKey }, input.dialogRef, row) : void 0;
|
|
133
|
+
if (namespace === "forbidden") return { status: "forbidden" };
|
|
134
|
+
const replayed = current !== null;
|
|
135
|
+
if (current && (current.runId !== input.runId || current.holder !== input.holder || current.holderKind !== input.holderKind)) {
|
|
136
|
+
return { status: "busy", dialogRevision, activeTurn: summarize(current) };
|
|
137
|
+
}
|
|
138
|
+
const timestamp = now();
|
|
139
|
+
const turn = current ?? {
|
|
140
|
+
runId: input.runId,
|
|
141
|
+
runToken: randomUUID(),
|
|
142
|
+
holder: input.holder,
|
|
143
|
+
holderKind: input.holderKind,
|
|
144
|
+
startedAt: timestamp,
|
|
145
|
+
heartbeatAt: timestamp,
|
|
146
|
+
expiresAt: timestamp + (input.ttlMs ?? DIALOG_TURN_DEFAULT_TTL_MS)
|
|
147
|
+
};
|
|
148
|
+
if (namespace === "unclaimed") {
|
|
149
|
+
if (typeof access.batchWrite !== "function") return { status: "atomic_batch_unsupported" };
|
|
150
|
+
await access.batchWrite([{ type: "put", key: namespaceKey, value: dialogKey }, { type: "put", key: stateKey, value: turn }]);
|
|
151
|
+
} else if (!replayed) await access.put(stateKey, turn);
|
|
152
|
+
return { status: "acquired", replayed, dialogRevision, activeTurn: turn };
|
|
153
|
+
}),
|
|
154
|
+
heartbeatDialogTurn: (raw) => run("heartbeatDialogTurn", raw, async (input, { stateKey }, access) => {
|
|
155
|
+
const current = await active(access, stateKey);
|
|
156
|
+
if (!current || current.runToken !== input.runToken) return { status: "token_mismatch", activeTurn: summarize(current) };
|
|
157
|
+
const heartbeatAt = Math.max(now(), current.heartbeatAt);
|
|
158
|
+
const turn = { ...current, heartbeatAt, expiresAt: heartbeatAt + (input.ttlMs ?? DIALOG_TURN_DEFAULT_TTL_MS) };
|
|
159
|
+
await access.put(stateKey, turn);
|
|
160
|
+
return { status: "renewed", activeTurn: turn };
|
|
161
|
+
}),
|
|
162
|
+
endDialogTurn: (raw) => run("endDialogTurn", raw, async (input, { stateKey }, access) => {
|
|
163
|
+
const current = await active(access, stateKey);
|
|
164
|
+
if (!current) return { status: "already_idle" };
|
|
165
|
+
if (input.runToken !== void 0 ? current.runToken !== input.runToken : current.runId !== input.expectedRunId) {
|
|
166
|
+
return { status: "token_mismatch", activeTurn: summarize(current) };
|
|
167
|
+
}
|
|
168
|
+
await access.del(stateKey);
|
|
169
|
+
return { status: "ended" };
|
|
170
|
+
}),
|
|
171
|
+
commitDialogTurn: (raw) => run("commitDialogTurn", raw, async (input, keys, access) => {
|
|
172
|
+
const { dialogKey, stateKey, namespaceKey, idemKey } = keys;
|
|
173
|
+
if (typeof access.batchWrite !== "function") return { status: "atomic_batch_unsupported" };
|
|
174
|
+
const { mode, dialogRef, runToken, commandId, baseRevision, dialogRecord, messageRecords, keepTurnActive } = input;
|
|
175
|
+
const idleSync = mode === "idle_sync";
|
|
176
|
+
const idleStored = idleSync ? await getOptional(access, dialogKey) : void 0;
|
|
177
|
+
const namespace = idleSync ? await checkNamespace(access, keys, dialogRef, idleStored) : void 0;
|
|
178
|
+
if (namespace === "forbidden") return { status: "forbidden" };
|
|
179
|
+
const { userId, dialogId } = dialogRef;
|
|
180
|
+
if (dialogRecord.id !== void 0 && dialogRecord.id !== dialogId || dialogRecord.userId !== void 0 && dialogRecord.userId !== userId || dialogRecord.type !== void 0 && dialogRecord.type !== "dialog" /* DIALOG */) {
|
|
181
|
+
return { status: "invalid_request", field: "dialogRecord" };
|
|
182
|
+
}
|
|
183
|
+
const prefix = dialogMessageKey(dialogId, "");
|
|
184
|
+
const seen = /* @__PURE__ */ new Set();
|
|
185
|
+
for (const { key, value } of messageRecords) {
|
|
186
|
+
const messageId = key.slice(prefix.length);
|
|
187
|
+
if (!key.startsWith(prefix) || !isDialogTurnMessageId(messageId) || seen.has(key) || value.id !== void 0 && value.id !== messageId) return { status: "invalid_message_key", field: "messageRecords" };
|
|
188
|
+
seen.add(key);
|
|
189
|
+
}
|
|
190
|
+
const digest = fingerprint({
|
|
191
|
+
method: "commit",
|
|
192
|
+
baseRevision,
|
|
193
|
+
dialogRecord,
|
|
194
|
+
messageRecords,
|
|
195
|
+
...idleSync ? { mode } : { runToken, keepTurnActive: keepTurnActive === true }
|
|
196
|
+
});
|
|
197
|
+
if (!("hash" in digest)) return digest;
|
|
198
|
+
const receiptKey = idemKey(commandId);
|
|
199
|
+
const prior = await getOptional(access, receiptKey);
|
|
200
|
+
if (prior !== void 0) return prior.hash === digest.hash ? { status: "committed", replayed: true, dialogRevision: prior.dialogRevision, commandId, committedAt: prior.committedAt } : { status: "idempotency_conflict", commandId };
|
|
201
|
+
const current = await active(access, stateKey);
|
|
202
|
+
const stored = idleSync ? idleStored : await getOptional(access, dialogKey);
|
|
203
|
+
const storedRevision = revisionOf(stored);
|
|
204
|
+
if (idleSync) {
|
|
205
|
+
if (current) return { ok: true, status: "busy", dialogKey, dialogRevision: storedRevision, activeTurn: summarize(current) };
|
|
206
|
+
} else if (!current || current.runToken !== runToken) {
|
|
207
|
+
return { status: "fenced", activeTurn: summarize(current), dialogRevision: storedRevision };
|
|
208
|
+
}
|
|
209
|
+
if (storedRevision !== baseRevision) return { status: "revision_conflict", expectedRevision: baseRevision, actualRevision: storedRevision };
|
|
210
|
+
if (!idleSync && options.verifyNamespace && (await getOptional(access, namespaceKey) !== dialogKey || stored !== void 0 && !await options.verifyNamespace(dialogRef, stored))) return { status: "forbidden" };
|
|
211
|
+
const dialogRevision = baseRevision + 1;
|
|
212
|
+
const committedAt = now();
|
|
213
|
+
await access.batchWrite([
|
|
214
|
+
...messageRecords.map(({ key, value }) => ({ type: "put", key, value })),
|
|
215
|
+
{ type: "put", key: dialogKey, value: {
|
|
216
|
+
...dialogRecord,
|
|
217
|
+
// A history writer may have read the header before a narrow memory patch.
|
|
218
|
+
...isDialogTurnRecord(stored) && Object.hasOwn(stored, "memoryCaptureResult") ? { memoryCaptureResult: stored.memoryCaptureResult } : {},
|
|
219
|
+
...isDialogTurnRecord(stored) && Object.hasOwn(stored, "memoryEvents") ? { memoryEvents: stored.memoryEvents } : {},
|
|
220
|
+
id: dialogId,
|
|
221
|
+
userId,
|
|
222
|
+
type: "dialog" /* DIALOG */,
|
|
223
|
+
dbKey: dialogKey,
|
|
224
|
+
dialogRevision
|
|
225
|
+
} },
|
|
226
|
+
{ type: "put", key: receiptKey, value: { ...digest, dialogRevision, committedAt } },
|
|
227
|
+
...namespace === "unclaimed" ? [{ type: "put", key: namespaceKey, value: dialogKey }] : [],
|
|
228
|
+
...!idleSync && keepTurnActive !== true ? [{ type: "del", key: stateKey }] : []
|
|
229
|
+
]);
|
|
230
|
+
return { status: "committed", replayed: false, dialogRevision, commandId, committedAt };
|
|
231
|
+
}),
|
|
232
|
+
patchDialogMetadata: (raw) => run("patchDialogMetadata", raw, async (input, { dialogKey, idemKey }, access) => {
|
|
233
|
+
const { patch, commandId, expectedTitleUpdatedAt } = input;
|
|
234
|
+
const key = commandId === void 0 ? void 0 : idemKey(commandId);
|
|
235
|
+
if (key && typeof access.batchWrite !== "function") return { status: "atomic_batch_unsupported" };
|
|
236
|
+
const digest = fingerprint({ method: "metadata", patch, ...expectedTitleUpdatedAt !== void 0 ? { expectedTitleUpdatedAt } : {} });
|
|
237
|
+
if (!("hash" in digest)) return digest;
|
|
238
|
+
const prior = key ? await getOptional(access, key) : void 0;
|
|
239
|
+
if (prior !== void 0) return prior.hash === digest.hash ? { status: "patched", replayed: true, dialogRevision: prior.dialogRevision } : { status: "idempotency_conflict", commandId };
|
|
240
|
+
const row = await getOptional(access, dialogKey);
|
|
241
|
+
if (!isDialogTurnRecord(row) || row.deletedAt) return { status: "not_found" };
|
|
242
|
+
if (expectedTitleUpdatedAt !== void 0 && (row.titleUpdatedAt ?? null) !== expectedTitleUpdatedAt) return { status: "title_conflict" };
|
|
243
|
+
if (row.titleSource === "manual" && titleFields.some((field) => Object.hasOwn(patch, field)) && patch.titleSource !== "manual") {
|
|
244
|
+
return { status: "manual_title_protected" };
|
|
245
|
+
}
|
|
246
|
+
const dialogRevision = revisionOf(row);
|
|
247
|
+
const { memoryEvents, ...fields } = patch;
|
|
248
|
+
const value = { ...row, ...fields };
|
|
249
|
+
if (memoryEvents) {
|
|
250
|
+
const events = Array.isArray(row.memoryEvents) ? [...row.memoryEvents] : [];
|
|
251
|
+
const eventKey = (event) => isDialogTurnRecord(event) ? JSON.stringify([event.type, event.sourceKind, event.content]) : void 0;
|
|
252
|
+
const seen = new Set(events.map(eventKey));
|
|
253
|
+
for (const event of memoryEvents) {
|
|
254
|
+
const key2 = eventKey(event);
|
|
255
|
+
if (!seen.has(key2)) {
|
|
256
|
+
events.push(event);
|
|
257
|
+
seen.add(key2);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
value.memoryEvents = events;
|
|
261
|
+
}
|
|
262
|
+
if (key) await access.batchWrite([
|
|
263
|
+
{ type: "put", key: dialogKey, value },
|
|
264
|
+
{ type: "put", key, value: { ...digest, dialogRevision, committedAt: now() } }
|
|
265
|
+
]);
|
|
266
|
+
else await access.put(dialogKey, value);
|
|
267
|
+
return { status: "patched", dialogRevision, replayed: false };
|
|
268
|
+
})
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export {
|
|
273
|
+
isDialogTurnAuthorityReservedKey,
|
|
274
|
+
createDialogTurnAuthority
|
|
275
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchReferenceContents,
|
|
3
3
|
resolveReferenceAssets
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZMOKHBV5.js";
|
|
5
5
|
import {
|
|
6
6
|
updateTokensAction
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OV47NSYQ.js";
|
|
8
8
|
import {
|
|
9
9
|
applyUpdateTokensFulfilled
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SVKWZ3EG.js";
|
|
11
11
|
|
|
12
12
|
// packages/ai/agent/fetchAgentContexts.ts
|
|
13
13
|
async function fetchAgentContexts(references, dispatch) {
|
|
@@ -7,13 +7,16 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
readDbRecord,
|
|
9
9
|
writeAgentRecord
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7K4J76JQ.js";
|
|
11
|
+
import {
|
|
12
|
+
asTrimmedLowercaseString
|
|
13
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
11
14
|
import {
|
|
12
15
|
parseUserIdFromAuthToken,
|
|
13
16
|
readOption,
|
|
14
17
|
resolveAuthToken,
|
|
15
18
|
resolveServerUrl
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-2AJLG6PY.js";
|
|
17
20
|
import {
|
|
18
21
|
hasCliFlag
|
|
19
22
|
} from "./chunk-RF576RYE.js";
|
|
@@ -26,9 +29,6 @@ import {
|
|
|
26
29
|
import {
|
|
27
30
|
normalizeServerOrigin
|
|
28
31
|
} from "./chunk-CF7PE763.js";
|
|
29
|
-
import {
|
|
30
|
-
asTrimmedLowercaseString
|
|
31
|
-
} from "./chunk-QSJ3HFEF.js";
|
|
32
32
|
|
|
33
33
|
// packages/cli/docSpaceHelpers.ts
|
|
34
34
|
async function ensurePageAttachedToSpace(params) {
|