nolo-cli 0.149.0-alpha.1 → 0.151.0-alpha.3
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-OW3H7ICR.js → _executeModel-T7ANHTUW.js} +134 -91
- package/accountResolver-7RYB4D2P.js +300 -0
- package/action-SXJD5N5R.js +23 -0
- package/{addContentAction-B2DRF7P6.js → addContentAction-ZV774PHH.js} +20 -14
- package/{addDialogAgentAction-2P2FLTLD.js → addDialogAgentAction-A6SMKAGH.js} +26 -22
- package/{agentDeleteCommand-7IDWF6E3.js → agentDeleteCommand-4L5KCKFY.js} +181 -93
- package/{agentEmailCommands-A6XBQZBN.js → agentEmailCommands-2IMMIRO2.js} +132 -112
- package/{agentGrantCommands-M3XFO6EN.js → agentGrantCommands-HOJ3JBBQ.js} +3 -3
- package/agentListCommands-TWFLUYIZ.js +802 -0
- package/{agentMachineCommands-DQPUIMAC.js → agentMachineCommands-KIWXWT6L.js} +58 -62
- package/{agentProviderCommands-YK2BIIXZ.js → agentProviderCommands-HL6MBLCL.js} +149 -2
- package/{agentPullCommand-HF4A42D4.js → agentPullCommand-FA43RBRU.js} +7 -7
- package/agentRecordCommands-727NPCRW.js +154 -0
- package/agentRunCommand-JASIG3FZ.js +183 -0
- package/{agentRunControl-2SKCR4SB.js → agentRunControl-IFM7IGMG.js} +10 -2
- package/{agentRuntimeLocal-AK2QVJHY.js → agentRuntimeLocal-KKSQJMTE.js} +47 -50
- package/{agentSlice-O4RUQUMT.js → agentSlice-SLV57QGU.js} +23 -16
- package/{appDeleteCommands-N3XEVVYC.js → appDeleteCommands-4PL4KYRN.js} +58 -59
- package/{appDeployCommands-AWFIXYVW.js → appDeployCommands-EEEXCEB6.js} +67 -63
- package/{appDeployStatusCommands-CZRON2FO.js → appDeployStatusCommands-35ZX7T66.js} +56 -56
- package/{appGetCommands-XQIUY4TD.js → appGetCommands-WFCHXJWF.js} +56 -56
- package/{appListCommands-NNG4H36Y.js → appListCommands-XY2U6DPF.js} +57 -59
- package/{authCommand-UBJ4EWYZ.js → authCommand-QYN47CQD.js} +371 -68
- package/{authCommands-H6WKKCRW.js → authCommands-77CHYBGF.js} +12 -9
- package/{builtinSkillRegistry-ZMF6YGNO.js → builtinSkillRegistry-TDQ6JB2E.js} +13 -11
- package/{chromeCommands-2N6MEWRU.js → chromeCommands-OBBNJCLS.js} +314 -13
- package/chromeOpsCommands-3Z34RKSE.js +472 -0
- package/{chunk-ALXHV7NK.js → chunk-2GGXHQIW.js} +43 -4
- package/{localRuntimeAuthority-5W6IJRAD.js → chunk-2IXDJNZI.js} +154 -75
- package/{chunk-IVZJWTDI.js → chunk-36OMEXXR.js} +89 -21
- package/{chunk-H6A6X4EK.js → chunk-3MZAGMYY.js} +16 -0
- package/chunk-3PVYUPXK.js +40 -0
- package/chunk-3SZA4U64.js +1192 -0
- package/{chunk-ID7LNBWR.js → chunk-3T4ZG6AC.js} +1920 -644
- package/{chunk-GNMAFAIS.js → chunk-44WXLHFI.js} +1 -1
- package/{chunk-AGGIDPCZ.js → chunk-4JH2UMJR.js} +6 -0
- package/chunk-4LCOCOR5.js +50 -0
- package/chunk-4YRTZIVN.js +871 -0
- package/{chunk-N7J63Q6C.js → chunk-56GBUMO5.js} +10 -1
- package/{chunk-W7XHHYWM.js → chunk-5BHQICF2.js} +5 -1
- package/{chunk-XUWRURDF.js → chunk-5EBLANFT.js} +1 -1
- package/{chunk-3AH7LNUB.js → chunk-5EMSBTQ6.js} +33 -14
- package/{chunk-YRRASA5Q.js → chunk-5MM7NNO6.js} +113 -52
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-TXH4IWJL.js → chunk-626KHJNX.js} +20 -11
- package/{chunk-M5PVFLD4.js → chunk-64K7WX26.js} +90 -21
- package/{chunk-AKG5W4LG.js → chunk-6CCFTVBP.js} +76 -221
- package/chunk-6MJNEXUU.js +614 -0
- package/{chunk-62IL3KQV.js → chunk-6MXDOUMH.js} +15 -3
- package/{chunk-QOKAKDPE.js → chunk-6Q7UTJKR.js} +6 -94
- package/chunk-6QDYSCPW.js +223 -0
- package/{chunk-HYZIYH2H.js → chunk-74RAWNQN.js} +56 -63
- package/chunk-7DPNBQSV.js +9 -0
- package/{chunk-IAESIMK7.js → chunk-A4MW3YZL.js} +10 -14
- package/{chunk-OMRJYNCI.js → chunk-AG7MCDLR.js} +26 -31
- package/chunk-AGIM7IMJ.js +147 -0
- package/{chunk-7CHC4W22.js → chunk-AIZE5TDM.js} +3 -3
- package/chunk-AJ3G7X2K.js +7012 -0
- package/{chunk-5GVBDNTO.js → chunk-AU7AXHUL.js} +1 -1
- package/{chunk-4H22P2JV.js → chunk-AUIJZACN.js} +2073 -1275
- package/{chunk-CIF4X6ZM.js → chunk-AWVFQMOV.js} +25 -3
- package/{chunk-YAQJJDC2.js → chunk-BJEZC5RA.js} +214 -51
- package/{chunk-RYZINGPM.js → chunk-BPMPOFWP.js} +347 -235
- package/{chunk-YUNJN43V.js → chunk-BU2YQBV4.js} +215 -28
- package/{chunk-XPRWFQQK.js → chunk-CBHGZRCE.js} +38 -12
- package/{chunk-Y3PMXGLH.js → chunk-CHCS6XPJ.js} +365 -144
- package/chunk-CHOZJMJS.js +78 -0
- package/chunk-CYJWI3NH.js +119 -0
- package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
- package/{chunk-3SV7RM24.js → chunk-D2QN6CTI.js} +117 -72
- package/{chunk-TZZ2WRBL.js → chunk-DFDXM2Y4.js} +20 -16
- package/{chunk-5TEEECZM.js → chunk-E2AKSW7L.js} +10 -7
- package/{chunk-RSEEDUMS.js → chunk-EDX5XSJM.js} +2 -2
- package/{chunk-QDSINZM3.js → chunk-EUGTFFO6.js} +2 -23
- package/{chunk-UNYJU5L6.js → chunk-EYLGAEB4.js} +5 -1
- package/{chunk-CU3QB4HW.js → chunk-EYWJT7A2.js} +12 -12
- package/{chunk-BNGW5ASC.js → chunk-EZVK3N5L.js} +66 -18
- package/{chunk-6FGTMQCL.js → chunk-F32Z66T4.js} +6 -10
- package/{chunk-ZOVKKMF6.js → chunk-FY4SDK2E.js} +1 -1
- package/chunk-G6OOUQWJ.js +417 -0
- package/{chunk-PQWU42UQ.js → chunk-GCKHQECX.js} +6 -6
- package/chunk-GKXCHNTE.js +15 -0
- package/{chunk-P6GMCCAT.js → chunk-GQV5KHJU.js} +78 -12
- package/{chunk-B2XUQXQX.js → chunk-HIQ4GF53.js} +191 -68
- package/{chunk-GMZLP5DV.js → chunk-HNUWUO75.js} +30 -19
- package/{chunk-UASIEDKM.js → chunk-I2XLRXVX.js} +36 -31
- package/{chunk-5UTFL4QJ.js → chunk-I2ZMGXXF.js} +10 -5
- package/chunk-I42VC5KR.js +15 -0
- package/{chunk-3BXNTXYI.js → chunk-I4SN4NUQ.js} +1199 -56
- package/chunk-IA7TRNNR.js +11 -0
- package/{chunk-WIWM4FE3.js → chunk-IJERIUXS.js} +55 -748
- package/{chunk-BIDGLJQ3.js → chunk-IK2TSJQA.js} +45 -8
- package/{chunk-CPUFH46E.js → chunk-ILU2NPWY.js} +10 -10
- package/{chunk-SLLGJZDT.js → chunk-ISQL4V7C.js} +4 -4
- package/chunk-IT3ZZRJE.js +12 -0
- package/{chunk-DY7ANLKG.js → chunk-JKMLSTZK.js} +43 -12
- package/{chunk-6TPOEJMQ.js → chunk-JZX2XLKC.js} +64 -23
- package/{chunk-27ONFIEY.js → chunk-K2AER7RX.js} +19 -12
- package/{chunk-O2OWEFII.js → chunk-KFHQQ3NO.js} +1 -1
- package/{chunk-QXGPFY6J.js → chunk-LGN377P3.js} +27 -17
- package/{chunk-L36OWPP3.js → chunk-LIQJTQRN.js} +118 -139
- package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
- package/{chunk-5J3PYNUP.js → chunk-NYYFIKHI.js} +17 -3
- package/{chunk-6O4IK4V2.js → chunk-OFFL4DCR.js} +1 -1
- package/{chunk-B6SAMB33.js → chunk-OWYYDMGJ.js} +209 -9
- package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
- package/{chunk-CTUQJVQM.js → chunk-P5QACQDK.js} +1 -1
- package/{chunk-TB3MIBRC.js → chunk-PIDUNDFS.js} +572 -430
- package/{chunk-4JMDLJAD.js → chunk-PJNFNEJE.js} +114 -37
- package/chunk-PKZKOVA5.js +11507 -0
- package/{chunk-Z4CSIXYP.js → chunk-PLSVXHSA.js} +3 -3
- package/chunk-PWTNI4N7.js +47 -0
- package/chunk-QFEW2ULV.js +42 -0
- package/{chunk-RGNEEJ3Y.js → chunk-QLQ573SU.js} +35 -9
- package/chunk-QQ56R7KS.js +88 -0
- package/chunk-QYPE3TS3.js +43 -0
- package/{chunk-HTVYCXBP.js → chunk-RN2GPWN6.js} +354 -120
- package/{chunk-ATLTFRYJ.js → chunk-ROCUB2H2.js} +280 -98
- package/{chunk-4DPP773Q.js → chunk-RSHPU4PD.js} +59 -11
- package/chunk-RVWMAFIT.js +134 -0
- package/{chunk-ESHYE7WU.js → chunk-S73EPYNC.js} +10 -7
- package/{chunk-UQNS32WZ.js → chunk-SCMHQUMK.js} +1 -1
- package/chunk-SW4S4XYB.js +1794 -0
- package/{chunk-ZUEK6A6C.js → chunk-TTH4HOJD.js} +1973 -754
- package/chunk-TY3TIUJK.js +89 -0
- package/{chunk-X2QRZXZH.js → chunk-TYJ5XFEA.js} +4 -4
- package/{chunk-ALFH24P3.js → chunk-TYYRSFBG.js} +197 -155
- package/{chunk-MST6R3E4.js → chunk-U5GPBQDG.js} +34 -22
- package/chunk-U5ICMAFV.js +14110 -0
- package/{chunk-7KVZ5LDQ.js → chunk-UBUH2TCC.js} +18 -4
- package/chunk-UEILX4EV.js +15 -0
- package/chunk-UHTDNB5Y.js +140 -0
- package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
- package/{chunk-OHOVNO7I.js → chunk-UOKFKFPO.js} +6 -3
- package/{chunk-XISEYOGH.js → chunk-USHQX6VT.js} +5 -5
- package/chunk-UUPR3TD7.js +53 -0
- package/{chunk-3DAVPNFT.js → chunk-V4EE3D54.js} +122 -107
- package/{chunk-HDLLCBRF.js → chunk-VEA7H5FG.js} +2 -2
- package/chunk-VHGD6FHV.js +116 -0
- package/chunk-VIWDGTDA.js +8 -0
- package/{chunk-GOH6RW6F.js → chunk-VJXHL6MH.js} +34 -11
- package/{chunk-4XEYAFLY.js → chunk-VL5KOY2C.js} +623 -94
- package/{chunk-EADNWBAZ.js → chunk-VP3BINY7.js} +13 -0
- package/{chunk-DXHL7G2L.js → chunk-VWW6O2TL.js} +274 -93
- package/{chunk-EOARMOVD.js → chunk-W4S6OTSC.js} +6 -3
- package/chunk-WD4XYDYC.js +567 -0
- package/chunk-WJZOQR2J.js +151 -0
- package/{chunk-AUDNYVRC.js → chunk-XETG4RIX.js} +5 -5
- package/{chunk-MX574M24.js → chunk-XI7DGLUK.js} +4 -4
- package/{chunk-3L2WKC3W.js → chunk-XPWGOTBQ.js} +8 -1
- package/chunk-XRUSXPCQ.js +514 -0
- package/{chunk-I4OPU5TK.js → chunk-XS47QOFV.js} +273 -11
- package/{chunk-S5XGT6GB.js → chunk-XZNCX52W.js} +30 -9
- package/{chunk-5OA5HMTL.js → chunk-YLMMECCH.js} +1 -1
- package/{chunk-CFT5HBGW.js → chunk-YVLQXTUB.js} +448 -12
- package/chunk-YVPQATSC.js +709 -0
- package/chunk-ZEZC7IIM.js +126 -0
- package/{chunk-ALGORS6Y.js → chunk-ZF6526IQ.js} +43 -8
- package/chunk-ZIWPQEFU.js +165 -0
- package/chunk-ZRAU6T47.js +56 -0
- package/{cliExecutor-AWYR3T33.js → cliExecutor-BWBF2MTI.js} +4 -3
- package/{clipboardy-BX4NMYHE.js → clipboardy-GCO3GT3I.js} +3 -8
- package/{commandRegistry-2KBOXZQC.js → commandRegistry-NBLZEMCW.js} +183 -107
- package/contentThunks-6AIWNSGO.js +84 -0
- package/{cooldownCommands-ZLEPIB4A.js → cooldownCommands-JFKTYS2D.js} +2 -2
- package/{createAgentAutomationAction-5UGTB26P.js → createAgentAutomationAction-4BUS65DZ.js} +53 -44
- package/createDialogAction-QAIKSCG4.js +76 -0
- package/{createPageAction-CDLDKPRM.js → createPageAction-DXCZ334C.js} +65 -54
- package/cursorProvider-YGGNMVWX.js +6123 -0
- package/{db-VQSAOWAO.js → db-2QOTXYGH.js} +11 -5
- package/{dbSlice-DQ32LYTJ.js → dbSlice-J37OGIXH.js} +19 -13
- package/{deleteFile-NX6QHCWZ.js → deleteFile-6JWDDRVP.js} +10 -6
- package/dialogCommands-YZLSJB6X.js +113 -0
- package/{dialogSlice-N3YB65G5.js → dialogSlice-PVUSMKFW.js} +53 -39
- package/{docCreateCommands-ZSLGVBZT.js → docCreateCommands-JB2RRMRJ.js} +54 -57
- package/{docDeleteCommands-5N4GVZBG.js → docDeleteCommands-AQENULNM.js} +56 -58
- package/{docReadCommands-YJSAA7AV.js → docReadCommands-DYD25YLQ.js} +53 -56
- package/{docStore-E3CEOV5Q.js → docStore-CSEBEMKP.js} +25 -16
- package/{docUpdateCommands-WEMLSW6W.js → docUpdateCommands-3GVS23QL.js} +54 -57
- package/{fetchMessages-67MEFPZR.js → fetchMessages-IIJWQ3HR.js} +5 -4
- package/{getPricing-NMMFT3YI.js → getPricing-FKK3F5EJ.js} +11 -9
- package/{handleSendMessageAction-DQAD5ERJ.js → handleSendMessageAction-G2TLYGC4.js} +422 -118
- package/index.js +11 -7
- package/{lib-FRRS27KN.js → lib-4YTWAGY7.js} +581 -248
- package/{localDialogRead-EBRS242U.js → localDialogRead-FSOMOPDZ.js} +2 -2
- package/localRuntimeAdapter-B4TAYYA7.js +244 -0
- package/localRuntimeAuthority-JDAD7CB6.js +16 -0
- package/{localRuntimeDb-3LRMNLCM.js → localRuntimeDb-CVC62PM5.js} +1 -1
- package/{machineCommands-HAP75VSG.js → machineCommands-6OBFD3XF.js} +503 -161
- package/{machineInfo-66ZFUMLE.js → machineInfo-UKPTZO5Y.js} +2 -2
- package/machineWsRunDispatch-OO7N3O3Y.js +169 -0
- package/{memberThunks-5ZXPR63F.js → memberThunks-66DH6ABQ.js} +25 -18
- package/{models-ZPU5EDF4.js → models-LAS4B2B5.js} +2 -2
- package/package.json +1 -1
- package/{providerPresetApply-DD6NGWW6.js → providerPresetApply-MY66I6NT.js} +10 -10
- package/{providerRegistry-XDRLMYGJ.js → providerRegistry-QOE2FT57.js} +13 -9
- package/{read-EPTJRAEF.js → read-DC4NUGN6.js} +12 -8
- package/{readDocTool-W4NDXNEX.js → readDocTool-NCJ5NT25.js} +1 -1
- package/{readlineWorkspace-7BC66QSX.js → readlineWorkspace-UIQN7JUR.js} +5017 -915
- package/{removeDialogAgentAction-OSYNZRX7.js → removeDialogAgentAction-E2H3OZU6.js} +29 -28
- package/{runAgentClientLoop-6E6UC3CE.js → runAgentClientLoop-GS3SGG37.js} +154 -97
- package/{runtimeDoctorCommands-ID23PNNZ.js → runtimeDoctorCommands-GIOGC5SC.js} +17 -17
- package/secretCommands-ZXZRLR3R.js +700 -0
- package/setDialogExtraReferencesAction-SITRPMYU.js +37 -0
- package/{setPrimaryDialogAgentAction-WZ7KI3YA.js → setPrimaryDialogAgentAction-U7N45TGC.js} +30 -29
- package/{chunk-SONWNI3L.js → settingThunks-Y7SVJOMZ.js} +223 -928
- package/{skillDiscovery-ZBU76COE.js → skillDiscovery-QC35EQY4.js} +2 -2
- package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
- package/{spaceCommands-UJOVU4XI.js → spaceCommands-ZR5BR3GX.js} +59 -59
- package/{streamAgentChatTurn-3UXPYFNX.js → streamAgentChatTurn-4XYC33KE.js} +309 -165
- package/{switchDialogAgentAction-GMR7WN3P.js → switchDialogAgentAction-OMGBD3N2.js} +26 -22
- package/{tableCommands-G7RV3RU3.js → tableCommands-U3QDY4L6.js} +19 -17
- package/{toolApiClient-CVGWM4PN.js → toolApiClient-7WSJJJBV.js} +6 -5
- package/tools-P77EE7Q4.js +124 -0
- package/tuiSummaryLlmCaller-BM3VSTBU.js +130 -0
- package/{updateCommands-4EHDLF5J.js → updateCommands-NQXAGFM7.js} +3 -3
- package/{updateDialogTitleAction-UPFV7TDT.js → updateDialogTitleAction-CIANVPZC.js} +102 -57
- package/workloadLifecycle-36DXRZKU.js +320 -0
- package/action-GI44T4DR.js +0 -31
- package/agentListCommands-IW3GQVUP.js +0 -427
- package/agentRecordCommands-VCA76W6B.js +0 -134
- package/agentRunCommand-YNLDKVR7.js +0 -161
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-TJRMXMYA.js +0 -186
- package/chromeOpsCommands-IXRLN57H.js +0 -289
- package/chunk-36KZDDO5.js +0 -2415
- package/chunk-ACQD6YI2.js +0 -25363
- package/chunk-CQ3WA2NE.js +0 -299
- package/chunk-CYSYR67N.js +0 -93
- package/chunk-JBTJAPUF.js +0 -35
- package/chunk-K2CSUCHJ.js +0 -620
- package/chunk-LTRXGFMS.js +0 -83
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-MEYIRKDN.js +0 -8967
- package/chunk-OCZKATRC.js +0 -129
- package/chunk-OTGFTBLI.js +0 -13
- package/chunk-PUOC4YRO.js +0 -394
- package/chunk-PZZTFEKK.js +0 -34
- package/chunk-URMS4XY2.js +0 -10
- package/chunk-UV6VISQJ.js +0 -20
- package/chunk-VJVNU77E.js +0 -83
- package/chunk-XYJSY4KG.js +0 -13807
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YPREESF4.js +0 -225
- package/contentThunks-BDIQRZR6.js +0 -73
- package/createDialogAction-B7VGVEVU.js +0 -66
- package/dialogCommands-G7YBVAMC.js +0 -102
- package/levelLazyShim-GZBKODGI.js +0 -7
- package/machineWsRunDispatch-L32G7C4P.js +0 -149
- package/serverStoreFactory-YMXDF4NI.js +0 -20
- package/setDialogExtraReferencesAction-M32UYNCG.js +0 -30
- package/settingSlice-Q6EKL7EQ.js +0 -204
- package/syncMapping-N6RGXGBW.js +0 -437
- package/tools-MKYDMWA4.js +0 -111
- package/tuiSummaryLlmCaller-3YFNHCTW.js +0 -128
- package/{chunk-SV5IJK6K.js → chunk-NBTY7YJF.js} +3 -3
- package/{chunk-2SYTUTLI.js → chunk-YBNHPX4S.js} +3 -3
- package/{offlineMarxistsAgentCommand-HGXZV4XJ.js → offlineMarxistsAgentCommand-2QTHJCHV.js} +4 -4
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
resolveCliAuthorityBrokerEndpoint,
|
|
3
3
|
resolveCliAuthorityBrokerHealthPath,
|
|
4
4
|
resolveCliAuthorityBrokerMetadataPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NMFV26UG.js";
|
|
6
6
|
import {
|
|
7
7
|
createCliAuthorityBrokerClient,
|
|
8
8
|
createCliAuthorityBrokerSocketInvoker,
|
|
@@ -10,19 +10,15 @@ import {
|
|
|
10
10
|
} from "./chunk-EXAJ6DCR.js";
|
|
11
11
|
import {
|
|
12
12
|
createLegacyServerDb,
|
|
13
|
-
createLevelAuthorityStore
|
|
14
|
-
} from "./chunk-CIF4X6ZM.js";
|
|
15
|
-
import {
|
|
13
|
+
createLevelAuthorityStore,
|
|
16
14
|
isLevelLockError
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-UV6VISQJ.js";
|
|
19
|
-
import {
|
|
20
|
-
resolveNoloHome
|
|
21
|
-
} from "./chunk-GLKOYSRU.js";
|
|
15
|
+
} from "./chunk-AWVFQMOV.js";
|
|
22
16
|
import {
|
|
23
17
|
toErrorMessage
|
|
24
18
|
} from "./chunk-HNMXYYJR.js";
|
|
25
|
-
import
|
|
19
|
+
import {
|
|
20
|
+
resolveNoloHome
|
|
21
|
+
} from "./chunk-GLKOYSRU.js";
|
|
26
22
|
|
|
27
23
|
// packages/cli/localRuntimeAuthority.ts
|
|
28
24
|
import fs2 from "node:fs";
|
|
@@ -33,6 +29,7 @@ import fs from "node:fs";
|
|
|
33
29
|
import path from "node:path";
|
|
34
30
|
import { createServer } from "node:net";
|
|
35
31
|
var brokerRegistry = /* @__PURE__ */ new Map();
|
|
32
|
+
var databaseOwners = /* @__PURE__ */ new Map();
|
|
36
33
|
var DEFAULT_ITERATOR_LIMIT = 200;
|
|
37
34
|
function resolveBrokerListenTarget(endpoint) {
|
|
38
35
|
if (endpoint.startsWith("unix://")) {
|
|
@@ -118,7 +115,6 @@ async function dispatchCliAuthorityBrokerRequest(store, request) {
|
|
|
118
115
|
await store.open();
|
|
119
116
|
return { ok: true, result: { type: "open" } };
|
|
120
117
|
case "close":
|
|
121
|
-
await store.close();
|
|
122
118
|
return { ok: true, result: { type: "close" } };
|
|
123
119
|
case "get":
|
|
124
120
|
return { ok: true, result: { type: "get", value: await store.get(request.key) } };
|
|
@@ -146,77 +142,100 @@ async function dispatchCliAuthorityBrokerRequest(store, request) {
|
|
|
146
142
|
}
|
|
147
143
|
async function createBrokerHandle(options) {
|
|
148
144
|
const target = resolveBrokerListenTarget(options.endpoint);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
const store = await options.createStore();
|
|
154
|
-
await store.open();
|
|
145
|
+
const socketMode = (options.transportMode ?? "socket") === "socket";
|
|
146
|
+
let store;
|
|
147
|
+
const sockets = /* @__PURE__ */ new Set();
|
|
155
148
|
const server = createServer((socket) => {
|
|
149
|
+
sockets.add(socket);
|
|
150
|
+
socket.once("close", () => sockets.delete(socket));
|
|
151
|
+
socket.on("error", () => {
|
|
152
|
+
});
|
|
153
|
+
if (!storeReady || !store) {
|
|
154
|
+
socket.once("data", () => {
|
|
155
|
+
socket.end(`${JSON.stringify({ ok: false, error: { code: "BROKER_UNAVAILABLE", message: "CLI authority broker is starting", retryable: true } })}
|
|
156
|
+
`);
|
|
157
|
+
});
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
156
160
|
bindSocketRequestHandler({ socket, store });
|
|
157
161
|
});
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
let storeReady = false;
|
|
163
|
+
try {
|
|
164
|
+
if (socketMode) {
|
|
165
|
+
if (target.kind === "unix") ensureParentDir(target.path);
|
|
160
166
|
await new Promise((resolve, reject) => {
|
|
161
167
|
server.once("error", reject);
|
|
162
|
-
|
|
163
|
-
server.listen(target.path, () => {
|
|
164
|
-
server.off("error", reject);
|
|
165
|
-
resolve();
|
|
166
|
-
});
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
server.listen(target.port, target.host, () => {
|
|
168
|
+
const onListening = () => {
|
|
170
169
|
server.off("error", reject);
|
|
171
170
|
resolve();
|
|
172
|
-
}
|
|
171
|
+
};
|
|
172
|
+
if (target.kind === "unix") server.listen(target.path, onListening);
|
|
173
|
+
else server.listen(target.port, target.host, onListening);
|
|
173
174
|
});
|
|
174
175
|
server.unref();
|
|
175
|
-
} catch (error) {
|
|
176
|
-
await store.close().catch(() => {
|
|
177
|
-
});
|
|
178
|
-
throw error;
|
|
179
176
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
177
|
+
store = await options.createStore();
|
|
178
|
+
await store.open();
|
|
179
|
+
storeReady = true;
|
|
180
|
+
const readyStore = store;
|
|
181
|
+
const now = options.now ?? Date.now;
|
|
182
|
+
const listeningEndpoint = (options.transportMode ?? "socket") === "socket" ? buildListeningEndpoint(server, target) : options.endpoint;
|
|
183
|
+
writeJsonFile(options.metadataPath, {
|
|
184
|
+
pid: process.pid,
|
|
185
|
+
endpoint: listeningEndpoint,
|
|
186
|
+
location: readyStore.location ?? listeningEndpoint,
|
|
187
|
+
startedAt: new Date(now()).toISOString()
|
|
188
|
+
});
|
|
189
|
+
writeJsonFile(options.healthPath, {
|
|
190
|
+
ok: true,
|
|
191
|
+
pid: process.pid,
|
|
192
|
+
endpoint: listeningEndpoint,
|
|
193
|
+
checkedAt: new Date(now()).toISOString()
|
|
194
|
+
});
|
|
195
|
+
let closing;
|
|
196
|
+
return {
|
|
197
|
+
endpoint: options.endpoint,
|
|
198
|
+
listeningEndpoint,
|
|
199
|
+
authorityStore: readyStore,
|
|
200
|
+
request(request) {
|
|
201
|
+
return dispatchCliAuthorityBrokerRequest(readyStore, request);
|
|
202
|
+
},
|
|
203
|
+
async close() {
|
|
204
|
+
closing ??= (async () => {
|
|
205
|
+
storeReady = false;
|
|
206
|
+
for (const socket of sockets) socket.destroy();
|
|
207
|
+
if (server.listening) {
|
|
208
|
+
await new Promise((resolve, reject) => {
|
|
209
|
+
server.close((error) => error ? reject(error) : resolve());
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
await readyStore.close();
|
|
213
|
+
brokerRegistry.delete(options.endpoint);
|
|
214
|
+
releaseDatabaseOwnership(options);
|
|
215
|
+
removeFileIfPresent(options.metadataPath);
|
|
216
|
+
removeFileIfPresent(options.healthPath);
|
|
217
|
+
})().catch((error) => {
|
|
218
|
+
closing = void 0;
|
|
219
|
+
throw error;
|
|
210
220
|
});
|
|
221
|
+
return closing;
|
|
211
222
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
223
|
+
};
|
|
224
|
+
} catch (error) {
|
|
225
|
+
storeReady = false;
|
|
226
|
+
for (const socket of sockets) socket.destroy();
|
|
227
|
+
if (server.listening) {
|
|
228
|
+
await new Promise((resolve) => server.close(() => resolve()));
|
|
229
|
+
}
|
|
230
|
+
if (store) {
|
|
231
|
+
try {
|
|
232
|
+
await store.close();
|
|
233
|
+
} catch (closeError) {
|
|
234
|
+
throw Object.assign(new AggregateError([error, closeError], "Broker startup failed and the native authority store could not close"), { retainAuthorityOwnership: true });
|
|
215
235
|
}
|
|
216
|
-
removeFileIfPresent(options.metadataPath);
|
|
217
|
-
removeFileIfPresent(options.healthPath);
|
|
218
236
|
}
|
|
219
|
-
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
220
239
|
}
|
|
221
240
|
function bindSocketRequestHandler(args) {
|
|
222
241
|
let buffer = "";
|
|
@@ -239,10 +258,41 @@ function bindSocketRequestHandler(args) {
|
|
|
239
258
|
`);
|
|
240
259
|
});
|
|
241
260
|
}
|
|
261
|
+
function canonicalDatabasePath(dbPath) {
|
|
262
|
+
const absolute = path.resolve(dbPath);
|
|
263
|
+
try {
|
|
264
|
+
return fs.realpathSync(absolute);
|
|
265
|
+
} catch (error) {
|
|
266
|
+
if (error.code !== "ENOENT") throw error;
|
|
267
|
+
const parent = path.dirname(absolute);
|
|
268
|
+
if (parent === absolute) throw error;
|
|
269
|
+
return path.join(canonicalDatabasePath(parent), path.basename(absolute));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function releaseDatabaseOwnership(options) {
|
|
273
|
+
if (!options.dbPath) return;
|
|
274
|
+
const identity = options.dbPath;
|
|
275
|
+
if (databaseOwners.get(identity) === options.endpoint) databaseOwners.delete(identity);
|
|
276
|
+
}
|
|
242
277
|
function getOrCreateCliAuthorityBrokerServer(options) {
|
|
278
|
+
options = { ...options, dbPath: options.dbPath ? canonicalDatabasePath(options.dbPath) : void 0 };
|
|
243
279
|
const existing = brokerRegistry.get(options.endpoint);
|
|
244
|
-
if (existing)
|
|
280
|
+
if (existing) {
|
|
281
|
+
if (options.dbPath && databaseOwners.get(options.dbPath) !== options.endpoint) {
|
|
282
|
+
return Promise.reject(new Error(`CLI authority endpoint ${options.endpoint} already owns another database`));
|
|
283
|
+
}
|
|
284
|
+
return existing;
|
|
285
|
+
}
|
|
286
|
+
if (options.dbPath) {
|
|
287
|
+
const identity = canonicalDatabasePath(options.dbPath);
|
|
288
|
+
const owner = databaseOwners.get(identity);
|
|
289
|
+
if (owner) {
|
|
290
|
+
return Promise.reject(Object.assign(new Error(`CLI authority database already owned by ${owner}`), { code: "LEVEL_LOCKED" }));
|
|
291
|
+
}
|
|
292
|
+
databaseOwners.set(identity, options.endpoint);
|
|
293
|
+
}
|
|
245
294
|
const pending = createBrokerHandle(options).catch((error) => {
|
|
295
|
+
if (!error?.retainAuthorityOwnership) releaseDatabaseOwnership(options);
|
|
246
296
|
brokerRegistry.delete(options.endpoint);
|
|
247
297
|
throw error;
|
|
248
298
|
});
|
|
@@ -254,10 +304,33 @@ function getOrCreateCliAuthorityBrokerServer(options) {
|
|
|
254
304
|
function ensureDbParentDir(dbPath) {
|
|
255
305
|
fs2.mkdirSync(path2.dirname(dbPath), { recursive: true });
|
|
256
306
|
}
|
|
307
|
+
function findCliAuthorityCorruption(error) {
|
|
308
|
+
const seen = /* @__PURE__ */ new Set();
|
|
309
|
+
let current = error;
|
|
310
|
+
while (current && !seen.has(current)) {
|
|
311
|
+
seen.add(current);
|
|
312
|
+
if (current.code === "LEVEL_CORRUPTION" || /Corruption:|missing files/i.test(toErrorMessage(current))) return current;
|
|
313
|
+
current = current.cause;
|
|
314
|
+
}
|
|
315
|
+
return void 0;
|
|
316
|
+
}
|
|
317
|
+
function throwCliAuthorityStartupError(error) {
|
|
318
|
+
const corruption = findCliAuthorityCorruption(error);
|
|
319
|
+
if (corruption) {
|
|
320
|
+
throw new Error(`Local authority database corruption: ${toErrorMessage(corruption)}`, { cause: error });
|
|
321
|
+
}
|
|
322
|
+
throw error;
|
|
323
|
+
}
|
|
257
324
|
function isCliAuthorityLockError(error) {
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
|
|
325
|
+
if (findCliAuthorityCorruption(error)) return false;
|
|
326
|
+
const seen = /* @__PURE__ */ new Set();
|
|
327
|
+
let current = error;
|
|
328
|
+
while (current && !seen.has(current)) {
|
|
329
|
+
seen.add(current);
|
|
330
|
+
if (isLevelLockError(current)) return true;
|
|
331
|
+
current = current.cause;
|
|
332
|
+
}
|
|
333
|
+
return /EADDRINUSE|Failed to listen/i.test(toErrorMessage(error));
|
|
261
334
|
}
|
|
262
335
|
async function sleep(ms) {
|
|
263
336
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -313,12 +386,13 @@ async function connectCliAuthorityBroker(args) {
|
|
|
313
386
|
endpoint: args.endpoint,
|
|
314
387
|
metadataPath: args.metadataPath,
|
|
315
388
|
healthPath: args.healthPath,
|
|
389
|
+
dbPath: args.dbPath,
|
|
316
390
|
createStore: () => createLevelAuthorityStore(args.dbPath)
|
|
317
391
|
});
|
|
318
392
|
await client2.open();
|
|
319
393
|
return client2;
|
|
320
394
|
} catch (error) {
|
|
321
|
-
if (!isCliAuthorityLockError(error))
|
|
395
|
+
if (!isCliAuthorityLockError(error)) throwCliAuthorityStartupError(error);
|
|
322
396
|
if (await attachToExistingBroker(5)) {
|
|
323
397
|
return client2;
|
|
324
398
|
}
|
|
@@ -330,6 +404,7 @@ async function connectCliAuthorityBroker(args) {
|
|
|
330
404
|
endpoint: args.endpoint,
|
|
331
405
|
metadataPath: args.metadataPath,
|
|
332
406
|
healthPath: args.healthPath,
|
|
407
|
+
dbPath: args.dbPath,
|
|
333
408
|
createStore: () => createLevelAuthorityStore(args.dbPath)
|
|
334
409
|
});
|
|
335
410
|
await client2.open();
|
|
@@ -345,10 +420,13 @@ async function connectCliAuthorityBroker(args) {
|
|
|
345
420
|
if (isCliAuthorityBrokerUnavailableError(retryError)) {
|
|
346
421
|
continue;
|
|
347
422
|
}
|
|
348
|
-
|
|
423
|
+
throwCliAuthorityStartupError(retryError);
|
|
349
424
|
}
|
|
350
425
|
}
|
|
351
|
-
|
|
426
|
+
const lastMessage = toErrorMessage(lastError);
|
|
427
|
+
const portInUse = lastError !== null && typeof lastError === "object" && "code" in lastError && lastError.code === "EADDRINUSE" || /EADDRINUSE/i.test(lastMessage);
|
|
428
|
+
const detail = portInUse ? `: 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` : "";
|
|
429
|
+
throw new Error(`CLI authority broker could not attach or take ownership for ${args.endpoint}${detail}`, {
|
|
352
430
|
cause: lastError
|
|
353
431
|
});
|
|
354
432
|
}
|
|
@@ -481,6 +559,7 @@ async function getDefaultCliLocalRuntimeDb(options = {}) {
|
|
|
481
559
|
const authorityStore = await getDefaultCliLocalRuntimeAuthority(options);
|
|
482
560
|
return createLegacyServerDb(authorityStore);
|
|
483
561
|
}
|
|
562
|
+
|
|
484
563
|
export {
|
|
485
564
|
connectCliAuthorityBroker,
|
|
486
565
|
getDefaultCliLocalRuntimeAuthority,
|
|
@@ -1,15 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_appendRetiredStateBatch,
|
|
3
|
+
loadMemoryVNextCatalog
|
|
4
|
+
} from "./chunk-TY3TIUJK.js";
|
|
1
5
|
import {
|
|
2
6
|
resolveMachineId
|
|
3
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-S73EPYNC.js";
|
|
8
|
+
import {
|
|
9
|
+
createMemoryKey,
|
|
10
|
+
createMemoryOwnerIndexKey,
|
|
11
|
+
createMemorySubjectKindIndexKey,
|
|
12
|
+
memoryOwnerRange
|
|
13
|
+
} from "./chunk-5EMSBTQ6.js";
|
|
14
|
+
import {
|
|
15
|
+
asTrimmedNonEmptyStringArray
|
|
16
|
+
} from "./chunk-I42VC5KR.js";
|
|
17
|
+
import {
|
|
18
|
+
asTrimmedString
|
|
19
|
+
} from "./chunk-3EUW3WEO.js";
|
|
4
20
|
import {
|
|
5
21
|
getDefaultCliLocalRuntimeDb
|
|
6
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-FY4SDK2E.js";
|
|
7
23
|
import {
|
|
8
24
|
resolveAuthTokenFromEnv
|
|
9
25
|
} from "./chunk-A7GB5UGH.js";
|
|
10
26
|
import {
|
|
11
27
|
DEFAULT_NOLO_SERVER_URL
|
|
12
28
|
} from "./chunk-OLZBQWZU.js";
|
|
29
|
+
import {
|
|
30
|
+
normalizeServerOrigin
|
|
31
|
+
} from "./chunk-CF7PE763.js";
|
|
13
32
|
import {
|
|
14
33
|
buildCliRuntimeEnv,
|
|
15
34
|
clearProfileAuthToken,
|
|
@@ -19,19 +38,6 @@ import {
|
|
|
19
38
|
loadProfileConfig,
|
|
20
39
|
saveDefaultProfile
|
|
21
40
|
} from "./chunk-TNIX77YM.js";
|
|
22
|
-
import {
|
|
23
|
-
asTrimmedNonEmptyStringArray,
|
|
24
|
-
createMemoryKey,
|
|
25
|
-
createMemoryOwnerIndexKey,
|
|
26
|
-
createMemorySubjectKindIndexKey,
|
|
27
|
-
memoryOwnerRange
|
|
28
|
-
} from "./chunk-3AH7LNUB.js";
|
|
29
|
-
import {
|
|
30
|
-
asTrimmedString
|
|
31
|
-
} from "./chunk-3EUW3WEO.js";
|
|
32
|
-
import {
|
|
33
|
-
normalizeServerOrigin
|
|
34
|
-
} from "./chunk-CF7PE763.js";
|
|
35
41
|
|
|
36
42
|
// packages/cli/authCommands.ts
|
|
37
43
|
import { createInterface } from "node:readline/promises";
|
|
@@ -39,6 +45,29 @@ import { stdin as input, stdout as output } from "node:process";
|
|
|
39
45
|
import { spawn } from "node:child_process";
|
|
40
46
|
|
|
41
47
|
// packages/ai/memory/delete.ts
|
|
48
|
+
var VNEXT_STATE_ID_PREFIX = "vnext-state-";
|
|
49
|
+
var toVNextMemoryItem = (state, owner) => ({
|
|
50
|
+
id: `${VNEXT_STATE_ID_PREFIX}${state.id}`,
|
|
51
|
+
ownerType: owner.ownerType,
|
|
52
|
+
ownerId: owner.ownerId,
|
|
53
|
+
visibility: "private",
|
|
54
|
+
subjectType: "user",
|
|
55
|
+
subjectId: owner.ownerId,
|
|
56
|
+
kind: "semantic",
|
|
57
|
+
content: state.text.trim(),
|
|
58
|
+
createdAt: state.createdAt,
|
|
59
|
+
lastActivatedAt: state.createdAt,
|
|
60
|
+
activationCount: 1,
|
|
61
|
+
importance: 0.9,
|
|
62
|
+
confidence: 0.9,
|
|
63
|
+
resident: state.facet === "preference" || state.facet === "style"
|
|
64
|
+
});
|
|
65
|
+
var matchesVNextFilters = (state, idSet, contentSub) => {
|
|
66
|
+
if (!idSet && !contentSub) return false;
|
|
67
|
+
if (idSet && !idSet.has(`${VNEXT_STATE_ID_PREFIX}${state.id}`)) return false;
|
|
68
|
+
if (contentSub && !state.text.toLowerCase().includes(contentSub)) return false;
|
|
69
|
+
return true;
|
|
70
|
+
};
|
|
42
71
|
function hasExplicitDeleteFilters(filters) {
|
|
43
72
|
return Boolean(
|
|
44
73
|
filters.ids && filters.ids.length > 0 || typeof filters.contentSubstring === "string" && filters.contentSubstring.trim().length > 0 || filters.tags && filters.tags.length > 0 || typeof filters.sourceDialogId === "string" && filters.sourceDialogId.trim().length > 0 || typeof filters.patternKeyPrefix === "string" && filters.patternKeyPrefix.trim().length > 0 || filters.facets && filters.facets.length > 0 || typeof filters.subjectId === "string" && filters.subjectId.trim().length > 0
|
|
@@ -127,8 +156,32 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
|
|
|
127
156
|
matchedItems.push(item);
|
|
128
157
|
if (matchedItems.length >= limit) break;
|
|
129
158
|
}
|
|
159
|
+
const idSet = normalizeSet(filters.ids);
|
|
160
|
+
const contentSub = asTrimmedString(filters.contentSubstring).toLowerCase();
|
|
161
|
+
const vnextStateIdsToRetire = [];
|
|
162
|
+
const vnextStatesToRetire = [];
|
|
163
|
+
const vnextMatchedItems = [];
|
|
164
|
+
let vnextPrincipalId = null;
|
|
165
|
+
const hasScopingFilters = Boolean(
|
|
166
|
+
normalizeSet(filters.kinds) || normalizeSet(filters.facets) || normalizeSet(filters.tags) || asTrimmedString(filters.subjectType) || asTrimmedString(filters.subjectId) || asTrimmedString(filters.patternKeyPrefix) || asTrimmedString(filters.sourceDialogId)
|
|
167
|
+
);
|
|
168
|
+
const canMatchVNext = !hasScopingFilters && (contentSub.length > 0 || idSet !== null && [...idSet].some((id) => id.startsWith(VNEXT_STATE_ID_PREFIX)));
|
|
169
|
+
if (canMatchVNext) {
|
|
170
|
+
vnextPrincipalId = `${owner.ownerType}:${encodeURIComponent(owner.ownerId)}`;
|
|
171
|
+
const catalog = await loadMemoryVNextCatalog(db, vnextPrincipalId);
|
|
172
|
+
for (const state of catalog.states) {
|
|
173
|
+
if (matchedItems.length >= limit) break;
|
|
174
|
+
if (state.retiredAt) continue;
|
|
175
|
+
if (!matchesVNextFilters(state, idSet, contentSub)) continue;
|
|
176
|
+
vnextStateIdsToRetire.push(state.id);
|
|
177
|
+
vnextStatesToRetire.push(state);
|
|
178
|
+
const projected = toVNextMemoryItem(state, owner);
|
|
179
|
+
vnextMatchedItems.push(projected);
|
|
180
|
+
matchedItems.push(projected);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
130
183
|
if (matchedItems.length === 0) {
|
|
131
|
-
return { deletedCount: 0, deletedIds: [], matchedItems: [] };
|
|
184
|
+
return { deletedCount: 0, deletedIds: [], retiredIds: [], matchedItems: [] };
|
|
132
185
|
}
|
|
133
186
|
const token = generateMemoryDeletionToken(
|
|
134
187
|
owner.ownerId,
|
|
@@ -138,23 +191,38 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
|
|
|
138
191
|
return {
|
|
139
192
|
deletedCount: 0,
|
|
140
193
|
deletedIds: [],
|
|
194
|
+
retiredIds: [],
|
|
141
195
|
matchedItems,
|
|
142
196
|
deletionToken: token
|
|
143
197
|
};
|
|
144
198
|
}
|
|
145
199
|
if (filters.deletionToken && filters.deletionToken !== token) {
|
|
146
200
|
throw new Error(
|
|
147
|
-
"deletionToken mismatch:
|
|
201
|
+
"deletionToken mismatch: target set differs from preview; preview exact intended targets again."
|
|
148
202
|
);
|
|
149
203
|
}
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
204
|
+
const vnextMatchedIdSet = new Set(
|
|
205
|
+
vnextStateIdsToRetire.map((stateId) => `${VNEXT_STATE_ID_PREFIX}${stateId}`)
|
|
206
|
+
);
|
|
207
|
+
const legacyItems = matchedItems.filter((item) => !vnextMatchedIdSet.has(item.id));
|
|
208
|
+
const shouldRetireVNext = vnextStatesToRetire.length > 0;
|
|
209
|
+
if (legacyItems.length > 0 || shouldRetireVNext) {
|
|
210
|
+
const batch = db.batch();
|
|
211
|
+
for (const item of legacyItems) {
|
|
212
|
+
deleteMemoryItemWithIndexesInBatch(batch, item);
|
|
213
|
+
}
|
|
214
|
+
if (shouldRetireVNext) {
|
|
215
|
+
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
216
|
+
for (const state of vnextStatesToRetire) {
|
|
217
|
+
_appendRetiredStateBatch(batch, { ...state, retiredAt: nowIso });
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
await batch.write();
|
|
153
221
|
}
|
|
154
|
-
await batch.write();
|
|
155
222
|
return {
|
|
156
223
|
deletedCount: matchedItems.length,
|
|
157
224
|
deletedIds: matchedItems.map((item) => item.id),
|
|
225
|
+
retiredIds: vnextMatchedItems.map((item) => item.id),
|
|
158
226
|
matchedItems,
|
|
159
227
|
deletionToken: token
|
|
160
228
|
};
|
|
@@ -78,6 +78,20 @@ function clampCooldownDeadline(at, now) {
|
|
|
78
78
|
const max = now + MAX_COOLDOWN_MS;
|
|
79
79
|
return Math.min(Math.max(at, min), max);
|
|
80
80
|
}
|
|
81
|
+
function shouldClearCooldownFromQuota(entry, quota, now) {
|
|
82
|
+
if (!(typeof entry.nextAvailableAt === "number" && entry.nextAvailableAt > now)) return false;
|
|
83
|
+
if (typeof entry.markedAt !== "number" || !Number.isFinite(entry.markedAt)) return false;
|
|
84
|
+
if (!quota || !(quota.observedAt > entry.markedAt)) return false;
|
|
85
|
+
const subscriptionWindows = quota.windows.filter((window) => window.scope === "5h" || window.scope === "7d");
|
|
86
|
+
if (subscriptionWindows.length === 0) return false;
|
|
87
|
+
if (quota.windows.some((window) => window.scope !== "5h" && window.scope !== "7d" && (window.remaining === 0 || typeof window.utilization === "number" && window.utilization >= 0.95))) return false;
|
|
88
|
+
return subscriptionWindows.every((window) => {
|
|
89
|
+
const hasUtilization = typeof window.utilization === "number";
|
|
90
|
+
const hasRemaining = typeof window.remaining === "number";
|
|
91
|
+
if (!hasUtilization && !hasRemaining) return false;
|
|
92
|
+
return (!hasUtilization || window.utilization < 0.95) && (!hasRemaining || window.remaining > 0);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
81
95
|
function isAgentUnavailableNow(agent, now = Date.now()) {
|
|
82
96
|
const at = agent?.nextAvailableAt;
|
|
83
97
|
return typeof at === "number" && Number.isFinite(at) && at > now;
|
|
@@ -214,10 +228,12 @@ function resolveCredentialKeyWithFallback(agent) {
|
|
|
214
228
|
export {
|
|
215
229
|
QUOTA_ERROR_PATTERNS,
|
|
216
230
|
isQuotaExhaustedError,
|
|
231
|
+
shouldClearCooldownFromQuota,
|
|
217
232
|
isAgentUnavailableNow,
|
|
218
233
|
isQuotaLimited403Body,
|
|
219
234
|
resolveAvailabilityAction,
|
|
220
235
|
mergeAvailabilityDeadline,
|
|
236
|
+
PROBE_INTERVAL_MS,
|
|
221
237
|
resolveCooldownGate,
|
|
222
238
|
resolveCredentialKeyWithFallback
|
|
223
239
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// packages/app/utils/fileUtils.ts
|
|
2
|
+
var fileConstructor = typeof globalThis !== "undefined" && typeof globalThis.File === "function" ? globalThis.File : void 0;
|
|
3
|
+
var isImageMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("image/");
|
|
4
|
+
var IMAGE_FILE_NAME_RE = /\.(avif|bmp|gif|heic|heif|ico|jpe?g|png|svg|tiff?|webp)$/i;
|
|
5
|
+
var VIDEO_FILE_NAME_RE = /\.(avi|m4v|mkv|mov|mp4|mpeg|mpg|webm)$/i;
|
|
6
|
+
var AUDIO_FILE_NAME_RE = /\.(aac|flac|m4a|mp3|ogg|wav|weba)$/i;
|
|
7
|
+
var DOCUMENT_FILE_NAME_RE = /\.(csv|doc|docx|md|odt|pdf|ppt|pptx|rtf|txt|xls|xlsx)$/i;
|
|
8
|
+
var isImageFileName = (value) => typeof value === "string" && IMAGE_FILE_NAME_RE.test(value.trim());
|
|
9
|
+
var isVideoMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("video/");
|
|
10
|
+
var isAudioMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("audio/");
|
|
11
|
+
var isPdfMimeType = (value) => typeof value === "string" && value.toLowerCase() === "application/pdf";
|
|
12
|
+
var isDocumentMimeType = (value) => {
|
|
13
|
+
if (typeof value !== "string") return false;
|
|
14
|
+
const normalized = value.toLowerCase();
|
|
15
|
+
return isPdfMimeType(normalized) || normalized === "text/plain" || normalized === "text/markdown" || normalized === "text/csv" || normalized === "application/msword" || normalized === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || normalized === "application/vnd.ms-powerpoint" || normalized === "application/vnd.openxmlformats-officedocument.presentationml.presentation" || normalized === "application/vnd.ms-excel" || normalized === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || normalized === "application/rtf" || normalized === "application/vnd.oasis.opendocument.text";
|
|
16
|
+
};
|
|
17
|
+
var resolveFileCategory = ({
|
|
18
|
+
mimeType,
|
|
19
|
+
fileName
|
|
20
|
+
}) => {
|
|
21
|
+
if (isImageMimeType(mimeType) || isImageFileName(fileName)) return "image";
|
|
22
|
+
if (isVideoMimeType(mimeType) || typeof fileName === "string" && VIDEO_FILE_NAME_RE.test(fileName.trim())) {
|
|
23
|
+
return "video";
|
|
24
|
+
}
|
|
25
|
+
if (isAudioMimeType(mimeType) || typeof fileName === "string" && AUDIO_FILE_NAME_RE.test(fileName.trim())) {
|
|
26
|
+
return "audio";
|
|
27
|
+
}
|
|
28
|
+
if (isDocumentMimeType(mimeType) || typeof fileName === "string" && DOCUMENT_FILE_NAME_RE.test(fileName.trim())) {
|
|
29
|
+
return "document";
|
|
30
|
+
}
|
|
31
|
+
return "other";
|
|
32
|
+
};
|
|
33
|
+
var MEDIA_EXTENSION_RE = /\.(aac|avi|flac|m4a|m4v|mkv|mov|mp3|mp4|mpeg|mpg|ogg|wav|weba|webm)$/i;
|
|
34
|
+
var isMediaFile = (file) => file.type.toLowerCase().startsWith("audio/") || file.type.toLowerCase().startsWith("video/") || MEDIA_EXTENSION_RE.test(file.name.trim());
|
|
35
|
+
var MAX_MEDIA_FILE_SIZE = 120 * 1024 * 1024;
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
resolveFileCategory,
|
|
39
|
+
isMediaFile
|
|
40
|
+
};
|