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,154 +2,178 @@ import {
|
|
|
2
2
|
buildMachinePermissionPromptBlock,
|
|
3
3
|
handleConnectorRunMessage,
|
|
4
4
|
resolveMachineRunPermissionPolicy
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-I2XLRXVX.js";
|
|
6
6
|
import {
|
|
7
|
+
MAX_CONNECTOR_TIMER_DELAY_MS,
|
|
8
|
+
clampConnectorTimerDelayMs,
|
|
7
9
|
isConnectorWebSocketAuthError,
|
|
8
10
|
isConnectorWebSocketRetryableError,
|
|
11
|
+
resolveConnectorProbeTimeoutMs,
|
|
9
12
|
resolveConnectorWebSocketTarget
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-2GGXHQIW.js";
|
|
14
|
+
import "./chunk-PKZKOVA5.js";
|
|
15
|
+
import "./chunk-XS47QOFV.js";
|
|
16
|
+
import "./chunk-6MXDOUMH.js";
|
|
17
|
+
import "./chunk-SW4S4XYB.js";
|
|
18
|
+
import "./chunk-VP3BINY7.js";
|
|
19
|
+
import "./chunk-UUPR3TD7.js";
|
|
20
|
+
import "./chunk-NBTY7YJF.js";
|
|
21
|
+
import "./chunk-VL5KOY2C.js";
|
|
15
22
|
import {
|
|
16
23
|
detectMachineInfo
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-GLKOYSRU.js";
|
|
24
|
-
import "./chunk-4XEYAFLY.js";
|
|
25
|
-
import "./chunk-JBTJAPUF.js";
|
|
26
|
-
import "./chunk-O2OWEFII.js";
|
|
24
|
+
} from "./chunk-S73EPYNC.js";
|
|
25
|
+
import "./chunk-ZEZC7IIM.js";
|
|
26
|
+
import "./chunk-VIWDGTDA.js";
|
|
27
|
+
import "./chunk-6MJNEXUU.js";
|
|
28
|
+
import "./chunk-BU2YQBV4.js";
|
|
29
|
+
import "./chunk-XRUSXPCQ.js";
|
|
27
30
|
import "./chunk-ATNTHIZI.js";
|
|
28
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-KFHQQ3NO.js";
|
|
32
|
+
import "./chunk-V4EE3D54.js";
|
|
29
33
|
import "./chunk-HS7MLR74.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-3T4ZG6AC.js";
|
|
35
|
+
import "./chunk-JKMLSTZK.js";
|
|
36
|
+
import "./chunk-I2ZMGXXF.js";
|
|
37
|
+
import "./chunk-OXME3PEE.js";
|
|
38
|
+
import "./chunk-ROCUB2H2.js";
|
|
35
39
|
import "./chunk-NF64D32W.js";
|
|
36
40
|
import {
|
|
37
|
-
CORE_DRAIN_REASON
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
42
|
-
import "./chunk-
|
|
41
|
+
CORE_DRAIN_REASON,
|
|
42
|
+
parsePositiveFiniteNumberOrFallback
|
|
43
|
+
} from "./chunk-XPWGOTBQ.js";
|
|
44
|
+
import "./chunk-ZIWPQEFU.js";
|
|
45
|
+
import "./chunk-CBHGZRCE.js";
|
|
46
|
+
import "./chunk-SCMHQUMK.js";
|
|
47
|
+
import "./chunk-RSHPU4PD.js";
|
|
48
|
+
import "./chunk-VIDPVFP3.js";
|
|
49
|
+
import "./chunk-5MM7NNO6.js";
|
|
50
|
+
import "./chunk-IA7TRNNR.js";
|
|
51
|
+
import "./chunk-AGIM7IMJ.js";
|
|
43
52
|
import "./chunk-63W5N6P3.js";
|
|
44
53
|
import "./chunk-VF4K2QE6.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-ACQD6YI2.js";
|
|
54
|
+
import "./chunk-626KHJNX.js";
|
|
55
|
+
import "./chunk-ILU2NPWY.js";
|
|
56
|
+
import "./chunk-AG7MCDLR.js";
|
|
57
|
+
import "./chunk-F32Z66T4.js";
|
|
58
|
+
import "./chunk-EYWJT7A2.js";
|
|
59
|
+
import "./chunk-AJ3G7X2K.js";
|
|
60
|
+
import "./chunk-U5ICMAFV.js";
|
|
53
61
|
import "./chunk-523DITKR.js";
|
|
54
|
-
import "./chunk-
|
|
55
|
-
import "./chunk-
|
|
56
|
-
import "./chunk-
|
|
57
|
-
import "./chunk-
|
|
62
|
+
import "./chunk-UKZX3NHN.js";
|
|
63
|
+
import "./chunk-OFFL4DCR.js";
|
|
64
|
+
import "./chunk-QYPE3TS3.js";
|
|
65
|
+
import "./chunk-DFDXM2Y4.js";
|
|
66
|
+
import "./chunk-4JH2UMJR.js";
|
|
67
|
+
import "./chunk-ZJ7UHBJS.js";
|
|
68
|
+
import "./chunk-BYXBJQAS.js";
|
|
69
|
+
import "./chunk-PLSVXHSA.js";
|
|
58
70
|
import "./chunk-5RGU3J7P.js";
|
|
59
|
-
import "./chunk-
|
|
60
|
-
import "./chunk-
|
|
71
|
+
import "./chunk-OWYYDMGJ.js";
|
|
72
|
+
import "./chunk-ZRAU6T47.js";
|
|
73
|
+
import "./chunk-4LCOCOR5.js";
|
|
61
74
|
import "./chunk-YDH3FDFQ.js";
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import "./chunk-
|
|
64
|
-
import "./chunk-
|
|
65
|
-
import "./chunk-
|
|
66
|
-
import "./chunk-
|
|
67
|
-
import "./chunk-
|
|
68
|
-
import "./chunk-
|
|
69
|
-
import "./chunk-
|
|
70
|
-
import "./chunk-
|
|
75
|
+
import "./chunk-QFEW2ULV.js";
|
|
76
|
+
import "./chunk-XI7DGLUK.js";
|
|
77
|
+
import "./chunk-EDX5XSJM.js";
|
|
78
|
+
import "./chunk-UAD2WT54.js";
|
|
79
|
+
import "./chunk-74RAWNQN.js";
|
|
80
|
+
import "./chunk-3PVYUPXK.js";
|
|
81
|
+
import "./chunk-A4MW3YZL.js";
|
|
82
|
+
import "./chunk-AIZE5TDM.js";
|
|
83
|
+
import "./chunk-4YRTZIVN.js";
|
|
84
|
+
import "./chunk-UEILX4EV.js";
|
|
85
|
+
import "./chunk-IJERIUXS.js";
|
|
86
|
+
import "./chunk-6Q7UTJKR.js";
|
|
87
|
+
import "./chunk-QQ56R7KS.js";
|
|
88
|
+
import "./chunk-OW765XBU.js";
|
|
89
|
+
import "./chunk-SEJ5OS6F.js";
|
|
90
|
+
import "./chunk-D2MDMY2M.js";
|
|
91
|
+
import "./chunk-HIQ4GF53.js";
|
|
92
|
+
import "./chunk-JZX2XLKC.js";
|
|
93
|
+
import "./chunk-EUGTFFO6.js";
|
|
94
|
+
import "./chunk-XETG4RIX.js";
|
|
95
|
+
import "./chunk-GKXCHNTE.js";
|
|
71
96
|
import {
|
|
97
|
+
NEW_TEXT_FIELD_ALIASES,
|
|
72
98
|
PATH_FIELD_ALIASES,
|
|
73
|
-
createLocalWorkspaceToolExecutors
|
|
74
|
-
|
|
75
|
-
|
|
99
|
+
createLocalWorkspaceToolExecutors,
|
|
100
|
+
resolveRequestedWorkspacePath
|
|
101
|
+
} from "./chunk-AUIJZACN.js";
|
|
102
|
+
import "./chunk-GQV5KHJU.js";
|
|
76
103
|
import "./chunk-ZNFJWEN4.js";
|
|
77
|
-
import "./chunk-
|
|
78
|
-
import "./chunk-
|
|
79
|
-
import "./chunk-
|
|
104
|
+
import "./chunk-LGN377P3.js";
|
|
105
|
+
import "./chunk-HNUWUO75.js";
|
|
106
|
+
import "./chunk-CHOZJMJS.js";
|
|
107
|
+
import "./chunk-PWTNI4N7.js";
|
|
108
|
+
import "./chunk-UOKFKFPO.js";
|
|
80
109
|
import "./chunk-5ZUL4CUO.js";
|
|
81
|
-
import "./chunk-
|
|
82
|
-
import "./chunk-
|
|
110
|
+
import "./chunk-GCKHQECX.js";
|
|
111
|
+
import "./chunk-G6OOUQWJ.js";
|
|
112
|
+
import "./chunk-56GBUMO5.js";
|
|
113
|
+
import "./chunk-WJZOQR2J.js";
|
|
114
|
+
import "./chunk-WD4XYDYC.js";
|
|
115
|
+
import "./chunk-3SZA4U64.js";
|
|
116
|
+
import "./chunk-QLQ573SU.js";
|
|
117
|
+
import "./chunk-3MZAGMYY.js";
|
|
83
118
|
import "./chunk-2MBTWINN.js";
|
|
84
|
-
import "./chunk-
|
|
85
|
-
import "./chunk-
|
|
86
|
-
import "./chunk-
|
|
87
|
-
import "./chunk-RGNEEJ3Y.js";
|
|
88
|
-
import "./chunk-H6A6X4EK.js";
|
|
89
|
-
import "./chunk-S5XGT6GB.js";
|
|
90
|
-
import "./chunk-27ONFIEY.js";
|
|
91
|
-
import "./chunk-AKG5W4LG.js";
|
|
92
|
-
import "./chunk-RYZINGPM.js";
|
|
93
|
-
import "./chunk-PSCNXBYA.js";
|
|
94
|
-
import "./chunk-L36OWPP3.js";
|
|
95
|
-
import "./chunk-BYXBJQAS.js";
|
|
119
|
+
import "./chunk-6CCFTVBP.js";
|
|
120
|
+
import "./chunk-BPMPOFWP.js";
|
|
121
|
+
import "./chunk-5MMAK75Q.js";
|
|
96
122
|
import "./chunk-DWLEOOGR.js";
|
|
97
|
-
import "./chunk-
|
|
123
|
+
import "./chunk-LIQJTQRN.js";
|
|
124
|
+
import "./chunk-UHTDNB5Y.js";
|
|
125
|
+
import "./chunk-KX6YBIHG.js";
|
|
126
|
+
import "./chunk-7DPNBQSV.js";
|
|
127
|
+
import "./chunk-5EBLANFT.js";
|
|
128
|
+
import "./chunk-NYYFIKHI.js";
|
|
129
|
+
import "./chunk-EZVK3N5L.js";
|
|
130
|
+
import "./chunk-M2EJHDJP.js";
|
|
131
|
+
import "./chunk-5EMSBTQ6.js";
|
|
132
|
+
import "./chunk-I42VC5KR.js";
|
|
133
|
+
import "./chunk-U6VC4MU4.js";
|
|
134
|
+
import "./chunk-TYYRSFBG.js";
|
|
135
|
+
import "./chunk-XZNCX52W.js";
|
|
136
|
+
import "./chunk-WWC7I6TA.js";
|
|
137
|
+
import "./chunk-YVLQXTUB.js";
|
|
138
|
+
import "./chunk-PJNFNEJE.js";
|
|
139
|
+
import "./chunk-PSCNXBYA.js";
|
|
140
|
+
import "./chunk-K2AER7RX.js";
|
|
141
|
+
import "./chunk-UBUH2TCC.js";
|
|
142
|
+
import "./chunk-I4SN4NUQ.js";
|
|
143
|
+
import "./chunk-5BHQICF2.js";
|
|
144
|
+
import {
|
|
145
|
+
isRecord
|
|
146
|
+
} from "./chunk-KUG52IAP.js";
|
|
147
|
+
import {
|
|
148
|
+
asTrimmedString
|
|
149
|
+
} from "./chunk-3EUW3WEO.js";
|
|
98
150
|
import {
|
|
99
151
|
toErrorMessage
|
|
100
152
|
} from "./chunk-HNMXYYJR.js";
|
|
101
|
-
import "./chunk-
|
|
102
|
-
import "./chunk-
|
|
103
|
-
import "./chunk-
|
|
104
|
-
import "./chunk-UAD2WT54.js";
|
|
105
|
-
import "./chunk-ZWQUWF6W.js";
|
|
106
|
-
import "./chunk-HDLLCBRF.js";
|
|
107
|
-
import "./chunk-4VJAC32I.js";
|
|
108
|
-
import "./chunk-XUWRURDF.js";
|
|
109
|
-
import "./chunk-5J3PYNUP.js";
|
|
110
|
-
import "./chunk-UNYJU5L6.js";
|
|
153
|
+
import "./chunk-FY4SDK2E.js";
|
|
154
|
+
import "./chunk-GLKOYSRU.js";
|
|
155
|
+
import "./chunk-EYLGAEB4.js";
|
|
111
156
|
import {
|
|
112
157
|
isCompiledBinary
|
|
113
158
|
} from "./chunk-A7GB5UGH.js";
|
|
114
159
|
import {
|
|
115
160
|
DEFAULT_NOLO_SERVER_URL
|
|
116
161
|
} from "./chunk-OLZBQWZU.js";
|
|
117
|
-
import "./chunk-TNIX77YM.js";
|
|
118
|
-
import "./chunk-Y6ROFCZO.js";
|
|
119
|
-
import "./chunk-CYSYR67N.js";
|
|
120
|
-
import "./chunk-Y3PMXGLH.js";
|
|
121
|
-
import "./chunk-SONWNI3L.js";
|
|
122
|
-
import {
|
|
123
|
-
parsePositiveFiniteNumberOrFallback
|
|
124
|
-
} from "./chunk-Y5GCAMGP.js";
|
|
125
|
-
import "./chunk-QDSINZM3.js";
|
|
126
|
-
import "./chunk-KX6YBIHG.js";
|
|
127
|
-
import "./chunk-HYZIYH2H.js";
|
|
128
|
-
import "./chunk-7CHC4W22.js";
|
|
129
|
-
import "./chunk-3AH7LNUB.js";
|
|
130
|
-
import "./chunk-WWC7I6TA.js";
|
|
131
|
-
import "./chunk-QSJ3HFEF.js";
|
|
132
|
-
import "./chunk-IAESIMK7.js";
|
|
133
|
-
import "./chunk-WIWM4FE3.js";
|
|
134
|
-
import "./chunk-QOKAKDPE.js";
|
|
135
|
-
import "./chunk-SEJ5OS6F.js";
|
|
136
|
-
import "./chunk-OW765XBU.js";
|
|
137
|
-
import "./chunk-GBRG75BQ.js";
|
|
138
|
-
import {
|
|
139
|
-
isRecord
|
|
140
|
-
} from "./chunk-KUG52IAP.js";
|
|
141
|
-
import "./chunk-BNGW5ASC.js";
|
|
142
|
-
import "./chunk-M2EJHDJP.js";
|
|
143
|
-
import {
|
|
144
|
-
asTrimmedString
|
|
145
|
-
} from "./chunk-3EUW3WEO.js";
|
|
146
|
-
import "./chunk-U6VC4MU4.js";
|
|
147
162
|
import "./chunk-LCBAMY2M.js";
|
|
148
163
|
import "./chunk-4SN6J65J.js";
|
|
149
164
|
import {
|
|
150
165
|
normalizeServerOrigin
|
|
151
166
|
} from "./chunk-CF7PE763.js";
|
|
152
167
|
import "./chunk-G3SUCT4W.js";
|
|
168
|
+
import "./chunk-TNIX77YM.js";
|
|
169
|
+
import "./chunk-Y6ROFCZO.js";
|
|
170
|
+
import "./chunk-RVWMAFIT.js";
|
|
171
|
+
import "./chunk-CHCS6XPJ.js";
|
|
172
|
+
import "./chunk-QSJ3HFEF.js";
|
|
173
|
+
import "./chunk-ZWQUWF6W.js";
|
|
174
|
+
import "./chunk-KHCLMKZZ.js";
|
|
175
|
+
import "./chunk-VEA7H5FG.js";
|
|
176
|
+
import "./chunk-4VJAC32I.js";
|
|
153
177
|
import "./chunk-4VNS5WPM.js";
|
|
154
178
|
|
|
155
179
|
// packages/connector-experimental/heartbeatLoop.ts
|
|
@@ -371,16 +395,104 @@ async function runMachineWatchCommand(deps) {
|
|
|
371
395
|
}
|
|
372
396
|
|
|
373
397
|
// packages/cli/machineToolInvokeDispatch.ts
|
|
374
|
-
import { lstat, realpath } from "node:fs/promises";
|
|
375
|
-
import {
|
|
376
|
-
|
|
398
|
+
import { appendFile, lstat, mkdir, realpath, stat } from "node:fs/promises";
|
|
399
|
+
import { homedir as homedir2 } from "node:os";
|
|
400
|
+
import { dirname as dirname2, isAbsolute as isAbsolute2, join as join2, relative as relative2, resolve as resolve2, sep } from "node:path";
|
|
401
|
+
|
|
402
|
+
// packages/agent-runtime/machineToolGrants.ts
|
|
403
|
+
function isRecord2(value) {
|
|
404
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
405
|
+
}
|
|
406
|
+
function normalizeMachineToolGrants(raw) {
|
|
407
|
+
if (!isRecord2(raw)) return void 0;
|
|
408
|
+
const grants = {};
|
|
409
|
+
for (const [rawKey, rawEntry] of Object.entries(raw)) {
|
|
410
|
+
const agentKey = rawKey.trim();
|
|
411
|
+
if (!agentKey) continue;
|
|
412
|
+
if (!isRecord2(rawEntry)) continue;
|
|
413
|
+
if (typeof rawEntry.write !== "boolean") continue;
|
|
414
|
+
grants[agentKey] = { write: rawEntry.write };
|
|
415
|
+
}
|
|
416
|
+
return Object.keys(grants).length > 0 ? grants : void 0;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// packages/cli/machineToolInvokeDispatch.ts
|
|
420
|
+
var MACHINE_TOOL_INVOKE_V1_READ_ONLY_TOOL_NAMES = ["readFile", "globFiles"];
|
|
421
|
+
var READ_ONLY_TOOL_NAME_SET = new Set(MACHINE_TOOL_INVOKE_V1_READ_ONLY_TOOL_NAMES);
|
|
422
|
+
var MACHINE_TOOL_INVOKE_V1_TOOL_NAMES = [
|
|
423
|
+
"readFile",
|
|
424
|
+
"globFiles",
|
|
425
|
+
"writeFile",
|
|
426
|
+
"editFile"
|
|
427
|
+
];
|
|
377
428
|
var V1_ALLOWED_TOOL_NAMES = new Set(MACHINE_TOOL_INVOKE_V1_TOOL_NAMES);
|
|
378
429
|
var DEFAULT_TOOL_INVOKE_TIMEOUT_MS = 3e4;
|
|
379
430
|
var TOOL_RESULT_MESSAGE_MAX_CHARS = 1e6;
|
|
380
|
-
var TOOL_NOT_ALLOWED_MESSAGE = "tool not allowed in v1 (read
|
|
431
|
+
var TOOL_NOT_ALLOWED_MESSAGE = "tool not allowed in v1 (allowlisted read/write file tools only)";
|
|
381
432
|
var TOOL_PAYLOAD_MALFORMED_MESSAGE = "malformed tool.invoke payload (payload object required)";
|
|
382
433
|
var TOOL_ARGS_MALFORMED_MESSAGE = "malformed tool.invoke args (args object required)";
|
|
434
|
+
var GRANT_DIMENSION_BY_TOOL = {
|
|
435
|
+
writeFile: "write",
|
|
436
|
+
editFile: "write"
|
|
437
|
+
};
|
|
438
|
+
var MACHINE_TOOL_INVOKE_V1_WRITE_TOOL_NAMES = Object.keys(GRANT_DIMENSION_BY_TOOL);
|
|
439
|
+
function grantDimensionForTool(toolName) {
|
|
440
|
+
return Object.hasOwn(GRANT_DIMENSION_BY_TOOL, toolName) ? GRANT_DIMENSION_BY_TOOL[toolName] : void 0;
|
|
441
|
+
}
|
|
442
|
+
var AUDIT_TARGET_MAX_CHARS = 200;
|
|
443
|
+
function machineToolNotGrantedMessage(toolName, agentKey) {
|
|
444
|
+
const dimension = grantDimensionForTool(toolName);
|
|
445
|
+
if (!dimension) {
|
|
446
|
+
return `tool not granted on this machine: ${toolName} is not a registered machine tool (no grant dimension) (NOLO_MACHINE_TOOL_GRANTS)`;
|
|
447
|
+
}
|
|
448
|
+
return agentKey ? `tool not granted on this machine: ${toolName} requires ${dimension} grant for agent ${agentKey} (NOLO_MACHINE_TOOL_GRANTS)` : `tool not granted on this machine: ${toolName} requires an agentKey with ${dimension} grant (NOLO_MACHINE_TOOL_GRANTS)`;
|
|
449
|
+
}
|
|
450
|
+
function isMachineToolGranted(grants, toolName, agentKey) {
|
|
451
|
+
if (READ_ONLY_TOOL_NAME_SET.has(toolName)) return true;
|
|
452
|
+
const dimension = grantDimensionForTool(toolName);
|
|
453
|
+
if (!dimension) return false;
|
|
454
|
+
const normalizedAgentKey = typeof agentKey === "string" ? agentKey.trim() : "";
|
|
455
|
+
if (!normalizedAgentKey || !grants) return false;
|
|
456
|
+
if (!Object.prototype.hasOwnProperty.call(grants, normalizedAgentKey)) return false;
|
|
457
|
+
const entry = grants[normalizedAgentKey];
|
|
458
|
+
if (!isRecord3(entry)) return false;
|
|
459
|
+
return Object.hasOwn(entry, dimension) && entry[dimension] === true;
|
|
460
|
+
}
|
|
461
|
+
function resolveMachineToolAuditLogPath() {
|
|
462
|
+
const noloHome = process.env.NOLO_HOME?.trim();
|
|
463
|
+
const base = noloHome ? noloHome : join2(homedir2(), ".nolo");
|
|
464
|
+
return join2(base, "logs", "machine-tool-audit.jsonl");
|
|
465
|
+
}
|
|
466
|
+
function auditTargetFor(executorArgs) {
|
|
467
|
+
const target = extractMachineToolRequestPath(executorArgs) ?? "";
|
|
468
|
+
return target.length > AUDIT_TARGET_MAX_CHARS ? target.slice(0, AUDIT_TARGET_MAX_CHARS) : target;
|
|
469
|
+
}
|
|
470
|
+
function machineToolOutcomeFailed(outcome) {
|
|
471
|
+
const metadata = outcome.metadata;
|
|
472
|
+
if (!isRecord3(metadata)) return false;
|
|
473
|
+
if (metadata.timedOut === true) return true;
|
|
474
|
+
if (metadata.aborted === true) return true;
|
|
475
|
+
const exitCode = metadata.exitCode;
|
|
476
|
+
return typeof exitCode === "number" && exitCode !== 0;
|
|
477
|
+
}
|
|
478
|
+
async function appendMachineToolAudit(entry) {
|
|
479
|
+
try {
|
|
480
|
+
const logPath = resolveMachineToolAuditLogPath();
|
|
481
|
+
await mkdir(dirname2(logPath), { recursive: true });
|
|
482
|
+
await appendFile(
|
|
483
|
+
logPath,
|
|
484
|
+
`${JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), agentKey: entry.agentKey ?? null, tool: entry.tool, target: entry.target, ok: entry.ok })}
|
|
485
|
+
`,
|
|
486
|
+
"utf8"
|
|
487
|
+
);
|
|
488
|
+
} catch (error) {
|
|
489
|
+
console.warn(`[nolo] machine tool audit write failed: ${toMessage(error)}`);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
383
492
|
function createMachineToolInvokeHandlers(args) {
|
|
493
|
+
const grants = normalizeMachineToolGrants(
|
|
494
|
+
args.grants ?? readMachineToolGrants(args.env ?? process.env)
|
|
495
|
+
);
|
|
384
496
|
const executors = (args.createToolExecutors ?? createLocalWorkspaceToolExecutors)({
|
|
385
497
|
workspaceRoot: args.workspaceRoot,
|
|
386
498
|
// v1 硬 containment:localWorkspaceTools 在无确认回调时对工作区外路径
|
|
@@ -396,7 +508,7 @@ function createMachineToolInvokeHandlers(args) {
|
|
|
396
508
|
readFileNoLedger: true
|
|
397
509
|
});
|
|
398
510
|
const executorMap = executors;
|
|
399
|
-
const invokeWithTimeout = async (toolName, executorArgs, timeoutMs, workspaceRoot) => {
|
|
511
|
+
const invokeWithTimeout = async (toolName, executorArgs, timeoutMs, workspaceRoot, agentKey) => {
|
|
400
512
|
const call = {
|
|
401
513
|
id: "machine-tool-invoke",
|
|
402
514
|
name: toolName,
|
|
@@ -410,7 +522,11 @@ function createMachineToolInvokeHandlers(args) {
|
|
|
410
522
|
});
|
|
411
523
|
if (preflightError) return { error: preflightError };
|
|
412
524
|
}
|
|
525
|
+
const deleteGuardError = await machinePureDeleteGuard(toolName, executorArgs, workspaceRoot);
|
|
526
|
+
if (deleteGuardError) return { error: deleteGuardError };
|
|
413
527
|
let timer = null;
|
|
528
|
+
const audited = grantDimensionForTool(toolName) !== void 0;
|
|
529
|
+
let auditOk = false;
|
|
414
530
|
try {
|
|
415
531
|
const outcome = await Promise.race([
|
|
416
532
|
executorMap[toolName](call),
|
|
@@ -419,6 +535,7 @@ function createMachineToolInvokeHandlers(args) {
|
|
|
419
535
|
})
|
|
420
536
|
]);
|
|
421
537
|
const content = typeof outcome?.content === "string" ? outcome.content : "";
|
|
538
|
+
auditOk = !machineToolOutcomeFailed(outcome);
|
|
422
539
|
if (content.length > TOOL_RESULT_MESSAGE_MAX_CHARS) {
|
|
423
540
|
return {
|
|
424
541
|
result: content.slice(0, TOOL_RESULT_MESSAGE_MAX_CHARS) + `
|
|
@@ -431,14 +548,25 @@ function createMachineToolInvokeHandlers(args) {
|
|
|
431
548
|
return { error: toMessage(error) };
|
|
432
549
|
} finally {
|
|
433
550
|
if (timer) clearTimeout(timer);
|
|
551
|
+
if (audited) {
|
|
552
|
+
await appendMachineToolAudit({
|
|
553
|
+
agentKey,
|
|
554
|
+
tool: toolName,
|
|
555
|
+
target: auditTargetFor(executorArgs),
|
|
556
|
+
ok: auditOk
|
|
557
|
+
});
|
|
558
|
+
}
|
|
434
559
|
}
|
|
435
560
|
};
|
|
436
|
-
const invokeMachineTool = async (requestId, toolName, toolArgs, timeoutMs) => {
|
|
561
|
+
const invokeMachineTool = async (requestId, toolName, toolArgs, timeoutMs, agentKey) => {
|
|
437
562
|
if (!V1_ALLOWED_TOOL_NAMES.has(toolName)) {
|
|
438
563
|
return { error: TOOL_NOT_ALLOWED_MESSAGE };
|
|
439
564
|
}
|
|
565
|
+
if (!isMachineToolGranted(grants, toolName, agentKey)) {
|
|
566
|
+
return { error: machineToolNotGrantedMessage(toolName, agentKey) };
|
|
567
|
+
}
|
|
440
568
|
const resolvedTimeout = resolveTimeoutMs(timeoutMs);
|
|
441
|
-
return invokeWithTimeout(toolName, toolArgs, resolvedTimeout, args.workspaceRoot);
|
|
569
|
+
return invokeWithTimeout(toolName, toolArgs, resolvedTimeout, args.workspaceRoot, agentKey);
|
|
442
570
|
};
|
|
443
571
|
return {
|
|
444
572
|
handleToolInvokeMessage: async (message, send) => {
|
|
@@ -451,7 +579,7 @@ function createMachineToolInvokeHandlers(args) {
|
|
|
451
579
|
);
|
|
452
580
|
return JSON.stringify({ type: "tool.result", requestId, error: TOOL_PAYLOAD_MALFORMED_MESSAGE });
|
|
453
581
|
}
|
|
454
|
-
if (!
|
|
582
|
+
if (!isRecord3(payload.args)) {
|
|
455
583
|
send(
|
|
456
584
|
JSON.stringify({ type: "tool.result", requestId, error: TOOL_ARGS_MALFORMED_MESSAGE })
|
|
457
585
|
);
|
|
@@ -461,7 +589,8 @@ function createMachineToolInvokeHandlers(args) {
|
|
|
461
589
|
requestId,
|
|
462
590
|
payload.tool,
|
|
463
591
|
payload.args,
|
|
464
|
-
payload.timeoutMs
|
|
592
|
+
payload.timeoutMs,
|
|
593
|
+
payload.agentKey
|
|
465
594
|
);
|
|
466
595
|
send(
|
|
467
596
|
JSON.stringify(
|
|
@@ -490,7 +619,7 @@ function isLexicallyInsideRoot(root, targetPath) {
|
|
|
490
619
|
}
|
|
491
620
|
async function machinePathPreflight(args) {
|
|
492
621
|
const workspaceRoot = resolve2(args.workspaceRoot);
|
|
493
|
-
const lexicalPath =
|
|
622
|
+
const lexicalPath = resolveRequestedWorkspacePath(workspaceRoot, args.request);
|
|
494
623
|
if (!isLexicallyInsideRoot(workspaceRoot, lexicalPath)) {
|
|
495
624
|
return `path outside workspace root: ${args.request}`;
|
|
496
625
|
}
|
|
@@ -499,11 +628,19 @@ async function machinePathPreflight(args) {
|
|
|
499
628
|
while (true) {
|
|
500
629
|
const stats = await lstat(current).catch(() => void 0);
|
|
501
630
|
if (!stats) {
|
|
502
|
-
|
|
631
|
+
const parent = resolve2(current, "..");
|
|
632
|
+
if (parent === current) return null;
|
|
633
|
+
return await ancestorContainmentPreflight({
|
|
634
|
+
workspaceRoot,
|
|
635
|
+
ancestor: parent,
|
|
636
|
+
request: args.request
|
|
637
|
+
});
|
|
503
638
|
}
|
|
504
639
|
if (!stats.isSymbolicLink()) break;
|
|
505
640
|
const target = await realpath(current).catch(() => void 0);
|
|
506
|
-
if (!target)
|
|
641
|
+
if (!target) {
|
|
642
|
+
return `path outside workspace root after symlink resolution: ${args.request}`;
|
|
643
|
+
}
|
|
507
644
|
symlinks.push({ link: current, target });
|
|
508
645
|
current = resolve2(current, "..");
|
|
509
646
|
if (current === dirname2(current)) break;
|
|
@@ -519,6 +656,76 @@ async function machinePathPreflight(args) {
|
|
|
519
656
|
}
|
|
520
657
|
return null;
|
|
521
658
|
}
|
|
659
|
+
async function ancestorContainmentPreflight(args) {
|
|
660
|
+
const workspaceRoot = resolve2(args.workspaceRoot);
|
|
661
|
+
let existing = args.ancestor;
|
|
662
|
+
while (true) {
|
|
663
|
+
const stats = await lstat(existing).catch(() => void 0);
|
|
664
|
+
if (stats) break;
|
|
665
|
+
const parent = resolve2(existing, "..");
|
|
666
|
+
if (parent === existing) return null;
|
|
667
|
+
existing = parent;
|
|
668
|
+
}
|
|
669
|
+
try {
|
|
670
|
+
const [realExisting, realRoot] = await Promise.all([realpath(existing), realpath(workspaceRoot)]);
|
|
671
|
+
if (!isLexicallyInsideRoot(realRoot, realExisting)) {
|
|
672
|
+
return `path outside workspace root after symlink resolution: ${args.request}`;
|
|
673
|
+
}
|
|
674
|
+
} catch {
|
|
675
|
+
return `path outside workspace root after symlink resolution: ${args.request}`;
|
|
676
|
+
}
|
|
677
|
+
return null;
|
|
678
|
+
}
|
|
679
|
+
var WRITEFILE_DELETE_GUARD_MESSAGE = "writeFile blocked: refusing to overwrite an existing non-empty file with empty content (data-deletion guard). Use editFile with the exact oldText to remove specific text, or write the intended content explicitly.";
|
|
680
|
+
var WRITEFILE_DIRECTORY_TARGET_MESSAGE = "writeFile blocked: target path is an existing directory, not a file (refusing to write; nothing was modified).";
|
|
681
|
+
var EDITFILE_DELETE_GUARD_MESSAGE = "editFile blocked: refusing to replace matched text with an empty newText (data-deletion guard). Provide the intended replacement text.";
|
|
682
|
+
function extractMachineToolStringField(executorArgs, aliases) {
|
|
683
|
+
const rawArgs = typeof executorArgs === "string" ? executorArgs : executorArgs !== void 0 && executorArgs !== null ? JSON.stringify(executorArgs) : null;
|
|
684
|
+
if (rawArgs === null) return void 0;
|
|
685
|
+
let parsed;
|
|
686
|
+
try {
|
|
687
|
+
parsed = JSON.parse(rawArgs);
|
|
688
|
+
} catch {
|
|
689
|
+
return void 0;
|
|
690
|
+
}
|
|
691
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
692
|
+
for (const key of aliases) {
|
|
693
|
+
const value = parsed[key];
|
|
694
|
+
if (typeof value === "string") return value;
|
|
695
|
+
}
|
|
696
|
+
return void 0;
|
|
697
|
+
}
|
|
698
|
+
function writeFileUninspectableTargetMessage(code) {
|
|
699
|
+
return `writeFile blocked: target cannot be inspected (${code}); refusing to write (fail closed \u2014 only a missing target counts as a new file).`;
|
|
700
|
+
}
|
|
701
|
+
function fsErrorCode(error) {
|
|
702
|
+
if (!error || typeof error !== "object") return void 0;
|
|
703
|
+
const code = error.code;
|
|
704
|
+
return typeof code === "string" ? code : void 0;
|
|
705
|
+
}
|
|
706
|
+
async function machinePureDeleteGuard(toolName, executorArgs, workspaceRoot) {
|
|
707
|
+
if (toolName === "writeFile") {
|
|
708
|
+
const content = extractMachineToolStringField(executorArgs, ["content"]);
|
|
709
|
+
if (content === void 0 || content.trim() !== "") return null;
|
|
710
|
+
const requestPath = extractMachineToolRequestPath(executorArgs);
|
|
711
|
+
if (requestPath === null) return null;
|
|
712
|
+
let stats;
|
|
713
|
+
try {
|
|
714
|
+
stats = await stat(resolveRequestedWorkspacePath(workspaceRoot, requestPath));
|
|
715
|
+
} catch (error) {
|
|
716
|
+
if (fsErrorCode(error) === "ENOENT") return null;
|
|
717
|
+
return writeFileUninspectableTargetMessage(fsErrorCode(error) ?? "unknown");
|
|
718
|
+
}
|
|
719
|
+
if (stats.isDirectory()) return WRITEFILE_DIRECTORY_TARGET_MESSAGE;
|
|
720
|
+
return stats.size > 0 ? WRITEFILE_DELETE_GUARD_MESSAGE : null;
|
|
721
|
+
}
|
|
722
|
+
if (toolName === "editFile") {
|
|
723
|
+
const newText = extractMachineToolStringField(executorArgs, NEW_TEXT_FIELD_ALIASES);
|
|
724
|
+
if (newText !== void 0 && newText.trim() === "") return EDITFILE_DELETE_GUARD_MESSAGE;
|
|
725
|
+
return null;
|
|
726
|
+
}
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
522
729
|
function extractMachineToolRequestPath(executorArgs) {
|
|
523
730
|
const rawArgs = typeof executorArgs === "string" ? executorArgs : executorArgs !== void 0 && executorArgs !== null ? JSON.stringify(executorArgs) : null;
|
|
524
731
|
if (rawArgs === null) return null;
|
|
@@ -542,9 +749,9 @@ function parseToolInvokeFrame(message) {
|
|
|
542
749
|
} catch {
|
|
543
750
|
return null;
|
|
544
751
|
}
|
|
545
|
-
if (!
|
|
752
|
+
if (!isRecord3(parsed) || parsed.type !== "tool.invoke") return null;
|
|
546
753
|
if (typeof parsed.requestId !== "string" || parsed.requestId.length === 0) return null;
|
|
547
|
-
if (!
|
|
754
|
+
if (!isRecord3(parsed.payload)) {
|
|
548
755
|
return {
|
|
549
756
|
requestId: parsed.requestId,
|
|
550
757
|
payload: { tool: "", args: {}, timeoutMs: void 0 },
|
|
@@ -557,23 +764,46 @@ function parseToolInvokeFrame(message) {
|
|
|
557
764
|
payload: {
|
|
558
765
|
tool: typeof payload.tool === "string" ? payload.tool : "",
|
|
559
766
|
args: payload.args,
|
|
560
|
-
timeoutMs: payload.timeoutMs
|
|
767
|
+
timeoutMs: payload.timeoutMs,
|
|
768
|
+
agentKey: typeof payload.agentKey === "string" && payload.agentKey.length > 0 ? payload.agentKey : void 0
|
|
561
769
|
}
|
|
562
770
|
};
|
|
563
771
|
}
|
|
564
|
-
function
|
|
772
|
+
function isRecord3(value) {
|
|
565
773
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
566
774
|
}
|
|
567
775
|
|
|
568
776
|
// packages/cli/machineWsSession.ts
|
|
569
777
|
var CONNECTOR_WS_KEEPALIVE_MS = 25e3;
|
|
778
|
+
var DEFAULT_CONNECTOR_TEARDOWN_TIMEOUT_MS = 2e3;
|
|
779
|
+
function resolveTeardownTimeoutMs(env) {
|
|
780
|
+
return clampConnectorTimerDelayMs(
|
|
781
|
+
parsePositiveFiniteNumberOrFallback(
|
|
782
|
+
env.NOLO_CONNECT_TEARDOWN_TIMEOUT_MS,
|
|
783
|
+
DEFAULT_CONNECTOR_TEARDOWN_TIMEOUT_MS
|
|
784
|
+
)
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
async function settleWithinTimeout(promises, timeoutMs) {
|
|
788
|
+
let timer = null;
|
|
789
|
+
try {
|
|
790
|
+
const outcome = await Promise.race([
|
|
791
|
+
Promise.allSettled(promises).then(() => "settled"),
|
|
792
|
+
new Promise((resolve3) => {
|
|
793
|
+
timer = setTimeout(() => resolve3("timeout"), timeoutMs);
|
|
794
|
+
})
|
|
795
|
+
]);
|
|
796
|
+
return { timedOut: outcome === "timeout" };
|
|
797
|
+
} finally {
|
|
798
|
+
if (timer) clearTimeout(timer);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
570
801
|
function buildConnectorKeepaliveMessage() {
|
|
571
802
|
return JSON.stringify({ type: "connector.keepalive", sentAt: Date.now() });
|
|
572
803
|
}
|
|
573
804
|
function resolveHeartbeatIntervalMs2(env) {
|
|
574
|
-
return
|
|
575
|
-
env.NOLO_CONNECT_HEARTBEAT_MS,
|
|
576
|
-
3e4
|
|
805
|
+
return clampConnectorTimerDelayMs(
|
|
806
|
+
parsePositiveFiniteNumberOrFallback(env.NOLO_CONNECT_HEARTBEAT_MS, 3e4)
|
|
577
807
|
);
|
|
578
808
|
}
|
|
579
809
|
async function defaultConnectWebSocket(url, options) {
|
|
@@ -604,6 +834,7 @@ async function defaultConnectWebSocket(url, options) {
|
|
|
604
834
|
}
|
|
605
835
|
};
|
|
606
836
|
options.signal?.addEventListener("abort", handleAbort, { once: true });
|
|
837
|
+
options.teardownSignal?.addEventListener("abort", handleAbort, { once: true });
|
|
607
838
|
ws.addEventListener(
|
|
608
839
|
"open",
|
|
609
840
|
() => {
|
|
@@ -613,8 +844,13 @@ async function defaultConnectWebSocket(url, options) {
|
|
|
613
844
|
ws.send(buildConnectorKeepaliveMessage());
|
|
614
845
|
} catch {
|
|
615
846
|
clearKeepalive();
|
|
847
|
+
try {
|
|
848
|
+
ws.close();
|
|
849
|
+
} catch {
|
|
850
|
+
resolve3();
|
|
851
|
+
}
|
|
616
852
|
}
|
|
617
|
-
}, CONNECTOR_WS_KEEPALIVE_MS);
|
|
853
|
+
}, options.keepaliveMs ?? CONNECTOR_WS_KEEPALIVE_MS);
|
|
618
854
|
},
|
|
619
855
|
{ once: true }
|
|
620
856
|
);
|
|
@@ -648,8 +884,19 @@ async function defaultConnectWebSocket(url, options) {
|
|
|
648
884
|
async function runMachineWsSession(options) {
|
|
649
885
|
const sentMessages = [];
|
|
650
886
|
const heartbeatAbort = new AbortController();
|
|
887
|
+
const teardownAbort = new AbortController();
|
|
888
|
+
const teardownTimeoutMs = resolveTeardownTimeoutMs(options.env);
|
|
651
889
|
let heartbeatLoopPromise = null;
|
|
652
890
|
let websocketPromise = null;
|
|
891
|
+
const settleTeardown = async () => {
|
|
892
|
+
const { timedOut } = await settleWithinTimeout(
|
|
893
|
+
[websocketPromise, heartbeatLoopPromise].filter(Boolean),
|
|
894
|
+
teardownTimeoutMs
|
|
895
|
+
);
|
|
896
|
+
if (timedOut) {
|
|
897
|
+
teardownAbort.abort();
|
|
898
|
+
}
|
|
899
|
+
};
|
|
653
900
|
try {
|
|
654
901
|
if (options.signal?.aborted) {
|
|
655
902
|
return { exitCode: 0 };
|
|
@@ -673,11 +920,13 @@ async function runMachineWsSession(options) {
|
|
|
673
920
|
serverUrl: options.serverUrl,
|
|
674
921
|
machineId: options.machine.machineId,
|
|
675
922
|
connectorSurface: "cli",
|
|
676
|
-
headers: { Authorization: `Bearer ${options.authToken}` }
|
|
923
|
+
headers: { Authorization: `Bearer ${options.authToken}` },
|
|
924
|
+
probeTimeoutMs: resolveConnectorProbeTimeoutMs(options.env)
|
|
677
925
|
});
|
|
678
926
|
websocketPromise = options.connectWebSocket(wsTarget, {
|
|
679
927
|
headers: { Authorization: `Bearer ${options.authToken}` },
|
|
680
928
|
signal: options.signal,
|
|
929
|
+
teardownSignal: teardownAbort.signal,
|
|
681
930
|
sentMessages,
|
|
682
931
|
onMessage: (message) => options.onMessage(message, (response) => {
|
|
683
932
|
sentMessages.push(response);
|
|
@@ -694,16 +943,14 @@ async function runMachineWsSession(options) {
|
|
|
694
943
|
[websocketPromise, heartbeatMonitorPromise, abortPromise].filter(Boolean)
|
|
695
944
|
);
|
|
696
945
|
heartbeatAbort.abort();
|
|
697
|
-
await
|
|
946
|
+
await settleTeardown();
|
|
698
947
|
if (raceResult === "aborted") {
|
|
699
948
|
return { exitCode: 0 };
|
|
700
949
|
}
|
|
701
950
|
return { exitCode: 0 };
|
|
702
951
|
} catch (error) {
|
|
703
952
|
heartbeatAbort.abort();
|
|
704
|
-
await
|
|
705
|
-
[websocketPromise, heartbeatLoopPromise].filter(Boolean)
|
|
706
|
-
);
|
|
953
|
+
await settleTeardown();
|
|
707
954
|
if (isConnectorWebSocketAuthError(error)) {
|
|
708
955
|
options.output.write(
|
|
709
956
|
`[nolo] Connector websocket auth failed: ${error.message}. Re-register this machine or update NOLO_MACHINE_API_KEY.
|
|
@@ -806,6 +1053,43 @@ async function handleMachineWsMessageDemux(message, send, handlers, runConnector
|
|
|
806
1053
|
}
|
|
807
1054
|
await runConnectorMessage();
|
|
808
1055
|
}
|
|
1056
|
+
function readMachineToolGrants(env) {
|
|
1057
|
+
const raw = env.NOLO_MACHINE_TOOL_GRANTS?.trim();
|
|
1058
|
+
if (!raw) return void 0;
|
|
1059
|
+
let parsed;
|
|
1060
|
+
try {
|
|
1061
|
+
parsed = JSON.parse(raw);
|
|
1062
|
+
} catch (error) {
|
|
1063
|
+
warnMalformedMachineToolGrantsOnce(
|
|
1064
|
+
`json:${raw}`,
|
|
1065
|
+
`[nolo] NOLO_MACHINE_TOOL_GRANTS is not valid JSON, ignoring it: ${error instanceof Error ? error.message : String(error)}`
|
|
1066
|
+
);
|
|
1067
|
+
return void 0;
|
|
1068
|
+
}
|
|
1069
|
+
if (!isRecord(parsed)) {
|
|
1070
|
+
warnMalformedMachineToolGrantsOnce(
|
|
1071
|
+
`shape:${raw}`,
|
|
1072
|
+
"[nolo] NOLO_MACHINE_TOOL_GRANTS must be a JSON object, ignoring it"
|
|
1073
|
+
);
|
|
1074
|
+
return void 0;
|
|
1075
|
+
}
|
|
1076
|
+
return parsed;
|
|
1077
|
+
}
|
|
1078
|
+
var warnedMalformedMachineToolGrants = /* @__PURE__ */ new Set();
|
|
1079
|
+
function warnMalformedMachineToolGrantsOnce(dedupeKey, message) {
|
|
1080
|
+
if (warnedMalformedMachineToolGrants.has(dedupeKey)) return;
|
|
1081
|
+
warnedMalformedMachineToolGrants.add(dedupeKey);
|
|
1082
|
+
console.warn(message);
|
|
1083
|
+
}
|
|
1084
|
+
function __resetMalformedMachineToolGrantsWarningsForTests() {
|
|
1085
|
+
warnedMalformedMachineToolGrants.clear();
|
|
1086
|
+
}
|
|
1087
|
+
function appendToolGrantsToWsUrl(wsUrl, grants) {
|
|
1088
|
+
if (!grants) return wsUrl;
|
|
1089
|
+
const target = new URL(wsUrl);
|
|
1090
|
+
target.searchParams.set("toolGrants", JSON.stringify(grants));
|
|
1091
|
+
return target.toString();
|
|
1092
|
+
}
|
|
809
1093
|
function resolveAuthToken2(env) {
|
|
810
1094
|
return env.AUTH_TOKEN || env.AUTH || "";
|
|
811
1095
|
}
|
|
@@ -854,11 +1138,60 @@ async function sleepWithAbort(ms, sleep, signal) {
|
|
|
854
1138
|
]);
|
|
855
1139
|
}
|
|
856
1140
|
function resolveConnectorReconnectDelayMs(env) {
|
|
857
|
-
const
|
|
858
|
-
|
|
1141
|
+
const rawValue = env.NOLO_CONNECT_RECONNECT_MS;
|
|
1142
|
+
if (rawValue === void 0 || rawValue.trim() === "") return 5e3;
|
|
1143
|
+
const raw = Number(rawValue);
|
|
1144
|
+
if (!Number.isFinite(raw) || raw < 0) return 5e3;
|
|
1145
|
+
return Math.min(raw, MAX_CONNECTOR_TIMER_DELAY_MS);
|
|
1146
|
+
}
|
|
1147
|
+
var DEFAULT_CONNECTOR_HEARTBEAT_TIMEOUT_MS = 1e4;
|
|
1148
|
+
function resolveConnectorHeartbeatTimeoutMs(env) {
|
|
1149
|
+
return clampConnectorTimerDelayMs(
|
|
1150
|
+
parsePositiveFiniteNumberOrFallback(
|
|
1151
|
+
env.NOLO_CONNECT_HEARTBEAT_TIMEOUT_MS,
|
|
1152
|
+
DEFAULT_CONNECTOR_HEARTBEAT_TIMEOUT_MS
|
|
1153
|
+
)
|
|
1154
|
+
);
|
|
1155
|
+
}
|
|
1156
|
+
async function postMachineHeartbeat(args) {
|
|
1157
|
+
const { fetchImpl, serverUrl, authToken, machine, timeoutMs } = args;
|
|
1158
|
+
const controller = new AbortController();
|
|
1159
|
+
const startedAt = Date.now();
|
|
1160
|
+
let timer = null;
|
|
1161
|
+
const timeoutPromise = new Promise((_resolve, reject) => {
|
|
1162
|
+
timer = setTimeout(() => {
|
|
1163
|
+
controller.abort();
|
|
1164
|
+
reject(
|
|
1165
|
+
new Error(
|
|
1166
|
+
`heartbeat timed out after ${Date.now() - startedAt}ms (NOLO_CONNECT_HEARTBEAT_TIMEOUT_MS=${timeoutMs})`
|
|
1167
|
+
)
|
|
1168
|
+
);
|
|
1169
|
+
}, timeoutMs);
|
|
1170
|
+
});
|
|
1171
|
+
try {
|
|
1172
|
+
const res = await Promise.race([
|
|
1173
|
+
fetchImpl(`${serverUrl}/api/machines/heartbeat`, {
|
|
1174
|
+
method: "POST",
|
|
1175
|
+
headers: {
|
|
1176
|
+
Authorization: `Bearer ${authToken}`,
|
|
1177
|
+
"Content-Type": "application/json"
|
|
1178
|
+
},
|
|
1179
|
+
body: JSON.stringify(machine),
|
|
1180
|
+
signal: controller.signal
|
|
1181
|
+
}),
|
|
1182
|
+
timeoutPromise
|
|
1183
|
+
]);
|
|
1184
|
+
if (!res.ok) {
|
|
1185
|
+
const text = await res.text().catch(() => "");
|
|
1186
|
+
throw new Error(`HTTP ${res.status}
|
|
1187
|
+
${text}`);
|
|
1188
|
+
}
|
|
1189
|
+
} finally {
|
|
1190
|
+
if (timer) clearTimeout(timer);
|
|
1191
|
+
}
|
|
859
1192
|
}
|
|
860
1193
|
async function defaultExecuteCli(provider, prompt, options) {
|
|
861
|
-
const { executeCli } = await import("./cliExecutor-
|
|
1194
|
+
const { executeCli } = await import("./cliExecutor-BWBF2MTI.js");
|
|
862
1195
|
return executeCli(provider, prompt, options);
|
|
863
1196
|
}
|
|
864
1197
|
function detectLaunchableMachineInfo() {
|
|
@@ -928,21 +1261,13 @@ async function runMachineConnectCommand(args, deps = {}) {
|
|
|
928
1261
|
});
|
|
929
1262
|
}
|
|
930
1263
|
const machine = (deps.machineInfo ?? detectLaunchableMachineInfo)();
|
|
931
|
-
const sendHeartbeat =
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
body: JSON.stringify(machine)
|
|
939
|
-
});
|
|
940
|
-
if (!res.ok) {
|
|
941
|
-
const text = await res.text().catch(() => "");
|
|
942
|
-
throw new Error(`HTTP ${res.status}
|
|
943
|
-
${text}`);
|
|
944
|
-
}
|
|
945
|
-
};
|
|
1264
|
+
const sendHeartbeat = () => postMachineHeartbeat({
|
|
1265
|
+
fetchImpl,
|
|
1266
|
+
serverUrl,
|
|
1267
|
+
authToken,
|
|
1268
|
+
machine,
|
|
1269
|
+
timeoutMs: resolveConnectorHeartbeatTimeoutMs(env)
|
|
1270
|
+
});
|
|
946
1271
|
if (hasFlag(args, "--ws")) {
|
|
947
1272
|
const validateWorkspaceLinks = deps.validateWorkspaceLinks ?? (() => []);
|
|
948
1273
|
if (!await checkConnectorWorkspaceLinks(process.cwd(), output, validateWorkspaceLinks)) {
|
|
@@ -951,8 +1276,15 @@ ${text}`);
|
|
|
951
1276
|
const maxAttempts = deps.maxConnectorAttempts ?? Infinity;
|
|
952
1277
|
const sleep = deps.sleep ?? defaultSleep2;
|
|
953
1278
|
const reconnectDelayMs = resolveConnectorReconnectDelayMs(env);
|
|
1279
|
+
const toolGrants = readMachineToolGrants(env);
|
|
954
1280
|
const toolInvokeHandlers = createMachineToolInvokeHandlers({
|
|
955
|
-
workspaceRoot: process.cwd()
|
|
1281
|
+
workspaceRoot: process.cwd(),
|
|
1282
|
+
// M2 修复:机器侧授权复核与握手上报共用同一来源——本次 `deps.env ??
|
|
1283
|
+
// process.env`。grants 快照与 WS URL 上报的那份逐字节相同;未配置时也
|
|
1284
|
+
// 显式传 env,工厂不再回落到 process.env(调用方经 deps.env 注入环境时
|
|
1285
|
+
// 两端曾不一致)。
|
|
1286
|
+
env,
|
|
1287
|
+
...toolGrants ? { grants: toolGrants } : {}
|
|
956
1288
|
});
|
|
957
1289
|
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
958
1290
|
if (deps.signal?.aborted) {
|
|
@@ -969,10 +1301,13 @@ ${text}`);
|
|
|
969
1301
|
connectWebSocket: deps.connectWebSocket ?? defaultConnectWebSocket,
|
|
970
1302
|
serverUrl,
|
|
971
1303
|
authToken,
|
|
972
|
-
resolveConnectorWebSocketTarget: (options) =>
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1304
|
+
resolveConnectorWebSocketTarget: async (options) => appendToolGrantsToWsUrl(
|
|
1305
|
+
await resolveConnectorWebSocketTarget({
|
|
1306
|
+
...options,
|
|
1307
|
+
fetchImpl
|
|
1308
|
+
}),
|
|
1309
|
+
toolGrants
|
|
1310
|
+
),
|
|
976
1311
|
onMessage: (message, send) => handleMachineWsMessageDemux(
|
|
977
1312
|
message,
|
|
978
1313
|
send,
|
|
@@ -1002,7 +1337,10 @@ ${text}`);
|
|
|
1002
1337
|
return 0;
|
|
1003
1338
|
}
|
|
1004
1339
|
if (attempt >= maxAttempts) return exitCode;
|
|
1005
|
-
const retryDelayMs =
|
|
1340
|
+
const retryDelayMs = Math.min(
|
|
1341
|
+
sessionResult.retryAfterMs ?? reconnectDelayMs,
|
|
1342
|
+
MAX_CONNECTOR_TIMER_DELAY_MS
|
|
1343
|
+
);
|
|
1006
1344
|
const reconnectContext = sessionResult.reconnectReason === CORE_DRAIN_REASON ? " during core draining" : "";
|
|
1007
1345
|
output.write(
|
|
1008
1346
|
`[nolo] Connector websocket disconnected${reconnectContext}. Reconnecting in ${retryDelayMs}ms.
|
|
@@ -1028,7 +1366,11 @@ ${text}`);
|
|
|
1028
1366
|
});
|
|
1029
1367
|
}
|
|
1030
1368
|
export {
|
|
1369
|
+
__resetMalformedMachineToolGrantsWarningsForTests,
|
|
1031
1370
|
formatMachineStatus,
|
|
1371
|
+
postMachineHeartbeat,
|
|
1372
|
+
readMachineToolGrants,
|
|
1373
|
+
resolveConnectorHeartbeatTimeoutMs,
|
|
1032
1374
|
runMachineConnectCommand,
|
|
1033
1375
|
runMachineStatusCommand
|
|
1034
1376
|
};
|