nolo-cli 0.259.0-alpha.1 → 0.260.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/{_executeModel-MTM4BJK3.js → _executeModel-EO6JFCOF.js} +97 -83
- package/accountResolver-NGICIMEE.js +1 -1
- package/{action-C6IQAKN4.js → action-WIA56QT4.js} +12 -10
- package/{addContentAction-53364YDW.js → addContentAction-OCMWZLYG.js} +14 -13
- package/{addDialogAgentAction-U5DD5EN5.js → addDialogAgentAction-ER2NZ7BC.js} +20 -24
- package/{agentDeleteCommand-53NN3VSK.js → agentDeleteCommand-KSXSNPAU.js} +184 -146
- package/{agentEmailCommands-KOGGIT6I.js → agentEmailCommands-NXRWS7NS.js} +142 -126
- package/{agentGrantCommands-L6O2HVJI.js → agentGrantCommands-D2S7LCTU.js} +8 -5
- package/{agentListCommands-62UYUQDI.js → agentListCommands-PFXGZZ3Y.js} +87 -68
- package/{agentMachineCommands-W6TNJXEA.js → agentMachineCommands-2Q55CSL4.js} +68 -59
- package/{agentProviderCommands-QLTABYR7.js → agentProviderCommands-EUNS7Y2Z.js} +10 -7
- package/{agentPullCommand-2EYJ5ENC.js → agentPullCommand-S2VMPSWL.js} +9 -6
- package/agentRecordCommands-FUFI526H.js +210 -0
- package/agentRun-ZNMUPDHF.js +250 -0
- package/agentRunCommand-ISVQ2UYC.js +248 -0
- package/{agentRunControl-LXMADX3N.js → agentRunControl-NEK44LDM.js} +19 -12
- package/{agentRuntimeLocal-YGNJMQW3.js → agentRuntimeLocal-SST4EPLT.js} +62 -49
- package/{agentSlice-3HHYUQLM.js → agentSlice-4ZJJJN4M.js} +15 -18
- package/appConfigCommands-MPHS6FHD.js +417 -0
- package/{appDeleteCommands-5COJ6CSG.js → appDeleteCommands-W26WGENW.js} +68 -58
- package/{appDeployCommands-3JPAT3XO.js → appDeployCommands-ER7IOF5E.js} +74 -59
- package/{appDeployStatusCommands-RHZKF3G4.js → appDeployStatusCommands-VKLL3A77.js} +68 -58
- package/{appGetCommands-73DXOAQW.js → appGetCommands-P6GXJNUD.js} +74 -58
- package/{appListCommands-HD5LOQ3G.js → appListCommands-ACA2IZZM.js} +74 -58
- package/appMigrateCommands-OGF4E2W6.js +230 -0
- package/appSourceCommands-GAHVBRUM.js +279 -0
- package/{authCommand-V6EOMZX6.js → authCommand-PXE7NZTQ.js} +26 -40
- package/{authCommands-T5FODCEG.js → authCommands-AZPYXTUB.js} +20 -17
- package/{builtinSkillRegistry-EDHD2UHU.js → builtinSkillRegistry-6XUWMAV5.js} +8 -6
- package/{chromeOpsCommands-3SSTDFRF.js → chromeOpsCommands-7UKKUOBU.js} +68 -18
- package/{chunk-KLMBM6P6.js → chunk-2CKFROQS.js} +2454 -1115
- package/{chunk-MJBLXJMP.js → chunk-2I4R6ZRV.js} +12 -9
- package/{chunk-FXEPZKNJ.js → chunk-2MIZHEND.js} +506 -64
- package/{chunk-TLE77UJ5.js → chunk-2OROOEOQ.js} +0 -1
- package/{chunk-6RSNVJGO.js → chunk-2ZBPWX7N.js} +4 -4
- package/chunk-35JIFLIG.js +30 -0
- package/{chunk-ZYPXOQS2.js → chunk-3EPED3UO.js} +1 -1
- package/{chunk-DNNPARJK.js → chunk-3QMN3T6L.js} +50 -37
- package/{chunk-DMPZMYH4.js → chunk-3R4AYHJR.js} +13 -1
- package/{chunk-HPDLPEUG.js → chunk-42JZNSAY.js} +267 -234
- package/{chunk-223KZUJ6.js → chunk-4HZCBA4Q.js} +18 -15
- package/{chunk-C5A54QS7.js → chunk-4INJGWE3.js} +18 -5
- package/chunk-4IVMDQBA.js +261 -0
- package/chunk-4Y6CZ2N4.js +82 -0
- package/{chunk-OKAXQFON.js → chunk-52BNL6GP.js} +4 -4
- package/{chunk-KZ4A7EIV.js → chunk-56OAS5RZ.js} +1 -1
- package/{chunk-QGFLVQ6E.js → chunk-6KUTNAPU.js} +4 -14
- package/{chunk-MNFUKRRU.js → chunk-6XAAKRJB.js} +7 -7
- package/{chunk-P27E22MA.js → chunk-6Z6DGDPI.js} +1 -1
- package/chunk-72VWN4VK.js +51 -0
- package/{chunk-L4XST72F.js → chunk-75FZ2Z7C.js} +16027 -17392
- package/{chunk-ADYWV732.js → chunk-76B6YUQS.js} +264 -177
- package/{chunk-MXA54TQM.js → chunk-76K4GTY5.js} +1 -1
- package/{chunk-VNHZJEQN.js → chunk-7HUCUD2I.js} +3 -3
- package/chunk-7LR2IFUH.js +100 -0
- package/{chunk-S73EPYNC.js → chunk-7LS5ATRP.js} +20 -6
- package/{chunk-Y2TCTNUD.js → chunk-7QO6YSA4.js} +4 -4
- package/{chunk-DBJODIZ6.js → chunk-7RYH7YIY.js} +19 -27
- package/{chunk-KHYSFS3W.js → chunk-A454UXB6.js} +148 -73
- package/chunk-AMNZPQCY.js +635 -0
- package/chunk-AMTF6FJD.js +356 -0
- package/{chunk-4MXYCQBS.js → chunk-AQNWWJLH.js} +2 -56
- package/{chunk-WSLL7VV4.js → chunk-B4NA5UJR.js} +9 -9
- package/{chunk-LHCGKAFO.js → chunk-BKP325XS.js} +184 -112
- package/{chunk-PENRYZ4D.js → chunk-BPB3T5EU.js} +4 -7
- package/{chunk-46FETNLF.js → chunk-BTIFQBYW.js} +7 -6
- package/{chunk-2JHGUL5K.js → chunk-BVYHE6QD.js} +2 -2
- package/{chunk-KXOPLLFP.js → chunk-CA7LGAHV.js} +69 -9
- package/{chunk-2FZVXOFX.js → chunk-CEIWXKHP.js} +112 -200
- package/{chunk-AIFQKNPP.js → chunk-CL33RFD7.js} +1 -1
- package/{chunk-MPGR4ZNR.js → chunk-CRGPRAJ4.js} +46 -42
- package/{chunk-P4R5KXU7.js → chunk-CW6LRDSF.js} +5 -5
- package/{chunk-R3TUHCSJ.js → chunk-CZHIOBBK.js} +8 -3
- package/chunk-D3ONA3FP.js +762 -0
- package/chunk-D3SAQ6T7.js +1697 -0
- package/{chunk-PIVTQRX6.js → chunk-DDKA6V6X.js} +111 -12
- package/{chunk-KQHEGELM.js → chunk-DEAII55O.js} +16 -6
- package/{chunk-J55F3IEZ.js → chunk-DKJQEFNG.js} +1 -1
- package/chunk-DLXL4NSL.js +1179 -0
- package/{chunk-EJQE5HB7.js → chunk-DSBRIUX5.js} +4 -2
- package/{chunk-XRGBJHZX.js → chunk-E36V7MPY.js} +9 -5
- package/{chunk-4YPH5KRA.js → chunk-EDKMRDET.js} +1 -1
- package/chunk-EJHLDJWZ.js +58 -0
- package/{chunk-6B2OBX5B.js → chunk-EMFZXJTN.js} +15 -47
- package/chunk-ER6NTALN.js +34 -0
- package/chunk-EUHMI5KG.js +101 -0
- package/{chunk-YQLAFJRQ.js → chunk-FBNVJ2TO.js} +1 -1
- package/{chunk-Q2EERN52.js → chunk-FF5ZRKW7.js} +12 -7
- package/{chunk-YFEK7ACQ.js → chunk-FGD4NMTP.js} +4 -4
- package/{chunk-6XIE5ZGI.js → chunk-FGFJUFPS.js} +5 -6
- package/chunk-FI4DPLR7.js +902 -0
- package/chunk-FKVLQNGJ.js +25 -0
- package/{chunk-JCQ3WCQ3.js → chunk-FOC4TORM.js} +69 -3
- package/{chunk-JPXACKSW.js → chunk-G22P2J7O.js} +30 -81
- package/{chunk-7WHCIA5V.js → chunk-G5IAIGGD.js} +3 -8
- package/{chunk-5BIDJVNX.js → chunk-G5JGA5YM.js} +180 -31
- package/{chunk-57V4PADY.js → chunk-GMBWWBSJ.js} +781 -449
- package/{chunk-WS36XPJD.js → chunk-GYFKKTDI.js} +82 -6
- package/{chunk-KT7S7ANZ.js → chunk-GZ4I5EMM.js} +9 -9
- package/{chunk-324FWHUA.js → chunk-HHXF57CL.js} +12 -3
- package/chunk-HJTI7RZV.js +94 -0
- package/{chunk-QXTEEEIN.js → chunk-HPIY372N.js} +7 -7
- package/{chunk-Q2MPKE4B.js → chunk-HVRG27HI.js} +76 -26
- package/{chunk-HDKMVYNJ.js → chunk-I3NWAILT.js} +6 -4
- package/{chunk-JZO7KUF3.js → chunk-IM7HCFB4.js} +313 -275
- package/{chunk-UWWOWTW2.js → chunk-INN2PBW7.js} +1 -1
- package/chunk-IV6VUVLJ.js +88 -0
- package/chunk-J42X32PV.js +472 -0
- package/{chunk-UA3QTA2S.js → chunk-JHQNWV2C.js} +4441 -2569
- package/{chunk-R7XWZDOH.js → chunk-JUMQJSQF.js} +1423 -282
- package/{chunk-BIDSIRTS.js → chunk-JUNYPVL6.js} +10 -16
- package/chunk-JVEKCQAP.js +222 -0
- package/{chunk-KVMLM5VD.js → chunk-KAHYBAEN.js} +211 -472
- package/chunk-KDDXC2IH.js +148 -0
- package/chunk-KGKTN2NX.js +25 -0
- package/chunk-KGWE224L.js +246 -0
- package/chunk-L3UFGEDU.js +17157 -0
- package/{chunk-CBIGMWMI.js → chunk-LHJB4BXJ.js} +1 -1
- package/{chunk-7OVOZRZF.js → chunk-LIH7WSX5.js} +23 -379
- package/chunk-LJOPY4TL.js +443 -0
- package/{chunk-TRRXYFTR.js → chunk-LOFRSJX2.js} +1 -0
- package/{chunk-SQL7YNED.js → chunk-LPXBBC32.js} +71 -5
- package/chunk-LXP53WGF.js +168 -0
- package/chunk-MDAYRIP7.js +1889 -0
- package/chunk-MRACVEPZ.js +7 -0
- package/chunk-NHLLXINQ.js +8 -0
- package/{chunk-FP37ELBT.js → chunk-NTBTVKKB.js} +17 -25
- package/{chunk-LVZVSLKO.js → chunk-O7ZY6SUK.js} +5 -22
- package/{chunk-2C5VN7NH.js → chunk-P4XAHM4B.js} +1 -1
- package/chunk-PL5RKESU.js +40 -0
- package/{chunk-MHKPUGPD.js → chunk-PQ3QZMJK.js} +20 -4
- package/chunk-Q5FJJ6XI.js +103 -0
- package/{createAgentAutomationAction-GRZ6XY7Q.js → chunk-QKM55LP2.js} +3 -160
- package/{chunk-6YX2RAQN.js → chunk-QZCLCAYC.js} +89 -164
- package/{chunk-FE7G6DSP.js → chunk-R72QWIFO.js} +14 -4
- package/{chunk-JLZJL3WC.js → chunk-RDZ5OIAT.js} +370 -39
- package/{chunk-5RGU3J7P.js → chunk-REAE2SZK.js} +0 -1
- package/chunk-RF576RYE.js +117 -0
- package/chunk-RI7SXDJW.js +1317 -0
- package/{chunk-FEIVARWR.js → chunk-RIOAPUGV.js} +238 -25
- package/{chunk-2CT2J3O6.js → chunk-RL6H2A2Z.js} +2493 -4055
- package/{chunk-BZLGPM5B.js → chunk-RNLKWUVY.js} +7 -12
- package/{chunk-J7JRCOIW.js → chunk-RWXHGPWJ.js} +1 -1
- package/chunk-S7BF2OGX.js +432 -0
- package/{chunk-6VEO7Z3Y.js → chunk-SD4MBKZ7.js} +6 -6
- package/{chunk-KWNVPY6M.js → chunk-SGEBRBF3.js} +7 -4
- package/{chunk-6SOWMEAY.js → chunk-SR57FDTX.js} +2 -258
- package/{chunk-CEKRIR22.js → chunk-SU4NCTW4.js} +1 -1
- package/{chunk-Y2GWUBNS.js → chunk-SX6PDLBZ.js} +279 -149
- package/{chunk-XNNBXUEM.js → chunk-T4WU747C.js} +5 -5
- package/{chunk-53W5BXLN.js → chunk-TCOHWKDM.js} +54 -55
- package/{chunk-QIGQFON2.js → chunk-TXMFSGRY.js} +1 -1
- package/{chunk-UUCYUN6Y.js → chunk-UB7NV7NN.js} +1 -1
- package/{chunk-NCFKHYDM.js → chunk-UOLGGEEC.js} +774 -119
- package/{chunk-4EACJPZI.js → chunk-USFG4EWQ.js} +51 -42
- package/{chunk-LLUBUHNT.js → chunk-UYZOBSSO.js} +5 -9
- package/{chunk-XPETQ4MR.js → chunk-VDC3BW24.js} +24 -10
- package/chunk-VH356OQ3.js +425 -0
- package/{chunk-U6QNVOR5.js → chunk-VKM7DOYB.js} +130 -6
- package/{chunk-CJOOF4L5.js → chunk-VPAO5WQX.js} +17 -14
- package/{chunk-OYUMJMC5.js → chunk-W2RQYNPI.js} +5 -0
- package/{chunk-6BMTKYAO.js → chunk-W2Z5E2R7.js} +126 -698
- package/{chunk-4ZCTKB27.js → chunk-W5GKF5ZW.js} +1 -0
- package/{chunk-NUHQO3RB.js → chunk-WIVVNJUS.js} +1 -1
- package/chunk-WLJNHFEB.js +1710 -0
- package/chunk-WMBJDXMY.js +408 -0
- package/chunk-WSQLCWLQ.js +201 -0
- package/{chunk-YN23INFZ.js → chunk-WXD6Y7DW.js} +23 -2
- package/{chunk-OOVOAG4Q.js → chunk-WY6DMHMG.js} +1 -1
- package/{chunk-6K32PBRY.js → chunk-XJW6SLBZ.js} +3 -3
- package/{chunk-7BIJFGKS.js → chunk-XQFDCRG3.js} +105 -51
- package/chunk-XT6C2QZW.js +46 -0
- package/{chunk-5YS6QHGT.js → chunk-Y7THFNVJ.js} +9 -9
- package/{chunk-ZEZC7IIM.js → chunk-YFSM2366.js} +35 -35
- package/{chunk-RD3QLZQV.js → chunk-YM5XULB2.js} +324 -2
- package/{chunk-FZENZCIA.js → chunk-YNP3ITPU.js} +19 -12
- package/{chunk-U35UUM5K.js → chunk-YOUSQIIK.js} +1 -1
- package/{chunk-RIWKZT7E.js → chunk-YRPIUIEQ.js} +11 -9
- package/{chunk-IYLUK67R.js → chunk-YU235GGN.js} +25 -8
- package/chunk-YWEZSBLL.js +790 -0
- package/chunk-Z3KTXWWB.js +76 -0
- package/{chunk-YLAHYLDQ.js → chunk-ZC3CMUKU.js} +2 -89
- package/chunk-ZD7OULYZ.js +368 -0
- package/{chunk-5P3PPQVP.js → chunk-ZQAADXSF.js} +1 -1
- package/{chunk-HQUGB2HM.js → chunk-ZTCMXPIS.js} +62 -50
- package/{cliAgentConfigHelpers-BXHQ3PXP.js → cliAgentConfigHelpers-KMXS7JP5.js} +20 -14
- package/{cliAuthorityBrokerClient-TFNXJLXL.js → cliAuthorityBrokerClient-3SKOA7OZ.js} +3 -1
- package/cliAuthorityBrokerProcess-DCCUT4YQ.js +34 -0
- package/{cliEnvHelpers-CNMP3RDX.js → cliEnvHelpers-YDGDHIEE.js} +5 -2
- package/{cliExecutor-K6FDZTQ2.js → cliExecutor-Z62UBJ5S.js} +12 -6
- package/cliLocalAgentRecordReader-X2YHEBWI.js +113 -0
- package/cloudAutomationCommands-C6Q3BFRB.js +310 -0
- package/{commandRegistry-IFYQLPGM.js → commandRegistry-TYYYTW5E.js} +260 -121
- package/{contentThunks-QCFCD2X3.js → contentThunks-E6BJ5YSX.js} +45 -43
- package/{cooldownCommands-WDOI5VD7.js → cooldownCommands-FPAFS7XG.js} +1 -1
- package/createAgentAutomationAction-L3NLCIIW.js +172 -0
- package/{createDialogAction-ZAJERW62.js → createDialogAction-QSWKRPWQ.js} +46 -42
- package/{createPageAction-QCVBMP4C.js → createPageAction-ZVVUT4CZ.js} +49 -45
- package/{db-VR74ADGC.js → db-KTQ3LL2Q.js} +3 -3
- package/{dbSlice-RWPSVHBC.js → dbSlice-SEVKNA7A.js} +21 -16
- package/deleteDbKey-43MTK2DI.js +86 -0
- package/{dialogCommands-4IEQUALS.js → dialogCommands-UVMTIFSA.js} +80 -66
- package/{dialogMessageRecord-OAV77LT7.js → dialogMessageRecord-2HJTEXQX.js} +1 -1
- package/{dialogNotifyCommand-IASQGEMW.js → dialogNotifyCommand-LMWF7EQI.js} +22 -14
- package/dialogPortabilityCommands-PAMLEBST.js +3036 -0
- package/{dialogSlice-XFYID6KE.js → dialogSlice-VHPXENDZ.js} +43 -42
- package/{dialogTraceCommand-Y67NRFCV.js → dialogTraceCommand-SO2WKAXW.js} +83 -69
- package/{dialogUsageCommand-WJ3U6KZU.js → dialogUsageCommand-EUO6JXTD.js} +6 -3
- package/{docCreateCommands-QLRIWRQE.js → docCreateCommands-H4RLIUNX.js} +68 -59
- package/{docDeleteCommands-XPRYA532.js → docDeleteCommands-OVAKCBMT.js} +68 -59
- package/{docReadCommands-EXQI7ETH.js → docReadCommands-KFISIUVA.js} +67 -58
- package/{docStore-MWFUKZL2.js → docStore-X7BEA735.js} +16 -17
- package/{docUpdateCommands-EFBFQV77.js → docUpdateCommands-VOEER36L.js} +68 -59
- package/{ebookDownloaderAgentCommand-DYSKF5ZY.js → ebookDownloaderAgentCommand-2DHPGEOQ.js} +14 -17
- package/{fetchMessages-TQEUZD7H.js → fetchMessages-RGPIYEPZ.js} +2 -2
- package/{getPricing-5BLZRPTM.js → getPricing-BK6CUBAE.js} +8 -4
- package/{handleSendMessageAction-GG3TR62X.js → handleSendMessageAction-GQ2KKOET.js} +265 -119
- package/{hostCredentialCreate-26S6DDJ5.js → hostCredentialCreate-PJAIKZQP.js} +138 -122
- package/index.js +35 -21
- package/{keys-RWF7UCB4.js → keys-FXEGMKSG.js} +2 -2
- package/localAutomationCommands-UU66LOWB.js +198 -0
- package/localAutomationRuntime-SW4R42SZ.js +60 -0
- package/{localDialogRead-BJJT3TF5.js → localDialogRead-W2EVXISA.js} +2 -2
- package/{localRuntimeAdapter-VREWZWPC.js → localRuntimeAdapter-WRBLXFUZ.js} +136 -119
- package/localRuntimeAuthority-3YDFZD3L.js +44 -0
- package/{localRuntimeDb-ZJFGNHML.js → localRuntimeDb-CJWJK47G.js} +1 -1
- package/{machineCommands-CL5XK5UC.js → machineCommands-JFYED66N.js} +251 -357
- package/{machineInfo-LWHTEBHJ.js → machineInfo-BJIU3WQ5.js} +4 -2
- package/machineWsRunDispatch-CZUV2FXE.js +227 -0
- package/{mcpLocalAuthorizeCommand-RBXJDE6J.js → mcpLocalAuthorizeCommand-HLU72QME.js} +40 -22
- package/mcpLocalManageCommands-OHHU6F5C.js +212 -0
- package/{memberThunks-43B7UYC5.js → memberThunks-FJW4GPM5.js} +102 -22
- package/{memoryCommands-BC6REPQB.js → memoryCommands-2RLHDMU2.js} +25 -34
- package/{models-ZX2BYIMB.js → models-TOXYINNM.js} +3 -2
- package/{offlineMarxistsAgentCommand-XVXUE6G5.js → offlineMarxistsAgentCommand-WZBJBCPZ.js} +16 -22
- package/package.json +3 -3
- package/parityCommands-7EWR34P3.js +613 -0
- package/{projectArchive-OC63TWTD.js → projectArchive-JIVRMXVV.js} +49 -45
- package/{providerPresetApply-NTJUINI6.js → providerPresetApply-IRJ56XIZ.js} +12 -16
- package/{providerRegistry-W45SLUV6.js → providerRegistry-26PAUYH2.js} +3 -13
- package/{read-KG6INYUT.js → read-6YR57D6V.js} +11 -10
- package/{readDocTool-N3GA52JR.js → readDocTool-NKOGL2MW.js} +5 -1
- package/{readlineWorkspace-2NO6D6IZ.js → readlineWorkspace-V26AN2FL.js} +926 -572
- package/{rememberExplicit-CPAPONSI.js → rememberExplicit-7KX4HXQC.js} +4 -4
- package/remove-BF33RCTH.js +32 -0
- package/{removeDialogAgentAction-EEVSOQOJ.js → removeDialogAgentAction-GWHBWF4W.js} +22 -26
- package/{runAgentClientLoop-U7V32UTD.js → runAgentClientLoop-EKD2EEEA.js} +117 -82
- package/{runtimeDoctorCommands-V3M3JTUV.js → runtimeDoctorCommands-IALUR5BZ.js} +23 -16
- package/{secretCommands-KVVZS7A6.js → secretCommands-CSTQYB6T.js} +2 -2
- package/{setDialogExtraReferencesAction-DNO5POHA.js → setDialogExtraReferencesAction-RL6FGO7T.js} +16 -17
- package/{setPrimaryDialogAgentAction-QABBEO4C.js → setPrimaryDialogAgentAction-XJASBB3K.js} +23 -27
- package/{settingThunks-DVKG4X4S.js → settingThunks-ZT7ZYXXL.js} +170 -497
- package/{skillDiscovery-5GEGWJ6N.js → skillDiscovery-IUEZZG2B.js} +3 -3
- package/{spaceCommands-7QKXKBDQ.js → spaceCommands-65WQHVOI.js} +68 -57
- package/spacePruneCommand-PTMRUWYJ.js +233 -0
- package/{store-Z53ICFL3.js → store-WSAVTR32.js} +3 -1
- package/{streamAgentChatTurn-UAGFOXNJ.js → streamAgentChatTurn-B5NICHZW.js} +225 -137
- package/{switchDialogAgentAction-KYWJSGOO.js → switchDialogAgentAction-X6DFOIAX.js} +19 -23
- package/{tableCommands-EFA754RE.js → tableCommands-6E77VD73.js} +28 -49
- package/{toolApiClient-N5PYW2R3.js → toolApiClient-GTTWEV6P.js} +15 -4
- package/{tools-2Q2LBDUC.js → tools-UMCPIQX6.js} +73 -63
- package/{tuiRestart-4QDWLHYZ.js → tuiRestart-O7UDLNQU.js} +20 -13
- package/tuiSummaryLlmCaller-7APIUIIV.js +52 -0
- package/{updateCommands-GJGRS6JK.js → updateCommands-DXDIAQFS.js} +12 -7
- package/{updateDialogTitleAction-GGNTTI5L.js → updateDialogTitleAction-HZLKWVKM.js} +57 -58
- package/{usageCommand-WI6SQOPB.js → usageCommand-WYLNBDHB.js} +6 -8
- package/{usageRebuildCommand-WQRLLZAT.js → usageRebuildCommand-AEUPY2PE.js} +11 -15
- package/{windowsSelfUpdate-C7LGVWYX.js → windowsSelfUpdate-SXSVXK4X.js} +2 -2
- package/workContext-ZAW6VXT7.js +18 -0
- package/workContextQueryProjection-CACY5VFE.js +23 -0
- package/{workloadLifecycle-DYX5ZMAT.js → workloadLifecycle-P2SJVV3S.js} +1 -1
- package/agentFavoriteCommands-7LOP3HUD.js +0 -186
- package/agentRecordCommands-TPE7NSZ6.js +0 -194
- package/agentRunCommand-DMVGBPLI.js +0 -232
- package/chunk-2MBTWINN.js +0 -89
- package/chunk-523DITKR.js +0 -32
- package/chunk-BUDVRYES.js +0 -2213
- package/chunk-BZMDWGQQ.js +0 -47
- package/chunk-GAHJLSDO.js +0 -107
- package/chunk-GYX6XTAI.js +0 -84
- package/chunk-HNUWUO75.js +0 -93
- package/chunk-HSBHS6KT.js +0 -33401
- package/chunk-KG27JIG4.js +0 -136
- package/chunk-OB4FBZXJ.js +0 -364
- package/chunk-OKH74FML.js +0 -3746
- package/chunk-OLZBQWZU.js +0 -6
- package/chunk-OOV5JN25.js +0 -1317
- package/chunk-OQFOE4SJ.js +0 -405
- package/chunk-PXYBUFDB.js +0 -53
- package/chunk-R3FZHW4Q.js +0 -103
- package/chunk-R3MV2GII.js +0 -106
- package/chunk-SCAC3NM5.js +0 -11751
- package/chunk-SR4FE5VD.js +0 -9
- package/chunk-SYTHYBMI.js +0 -3558
- package/chunk-UKZX3NHN.js +0 -48
- package/chunk-UVLYNWIE.js +0 -74
- package/chunk-VQX5JJNI.js +0 -861
- package/chunk-X4O7FJF5.js +0 -160
- package/chunk-YJPK35HB.js +0 -175
- package/chunk-YNIYE47Z.js +0 -105
- package/chunk-Z4PCXPUE.js +0 -127
- package/chunk-ZR5IVL4N.js +0 -862
- package/chunk-ZTHAJU3O.js +0 -2537
- package/cliAuthorityBrokerProcess-5ZFBTHLB.js +0 -22
- package/cliLocalAgentRecordReader-34UKRBLY.js +0 -104
- package/deleteFile-ECU6FU5C.js +0 -55
- package/localRuntimeAuthority-UF2DAQ3F.js +0 -28
- package/machineWsRunDispatch-TBVOYOAH.js +0 -209
- package/markdownToSlate-PXYAIBVL.js +0 -8
- package/tuiSummaryLlmCaller-HROLGN4F.js +0 -45
- package/webapi-QVV65DQF.js +0 -2487
- package/workContext-Y3ADAPZU.js +0 -14
- package/{chunk-USGHJSGO.js → chunk-GX2MFKF3.js} +3 -3
- package/{chunk-PHREU2KZ.js → chunk-WX266G2C.js} +0 -0
- package/{chunk-DXWGFL2Z.js → chunk-YY7IGJMN.js} +3 -3
|
@@ -1,56 +1,298 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
|
+
getOrCreateSharedStore,
|
|
4
|
+
isCliProviderAgentConfig,
|
|
3
5
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JHQNWV2C.js";
|
|
7
|
+
import {
|
|
8
|
+
attachExecutionStoppedPromise,
|
|
9
|
+
getExecutionStoppedPromise
|
|
10
|
+
} from "./chunk-JUMQJSQF.js";
|
|
11
|
+
import {
|
|
12
|
+
isCursorOAuthAgent
|
|
13
|
+
} from "./chunk-VIWDGTDA.js";
|
|
5
14
|
import {
|
|
6
15
|
clipMultilineText
|
|
7
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WLJNHFEB.js";
|
|
17
|
+
import {
|
|
18
|
+
withQueueLock
|
|
19
|
+
} from "./chunk-VDC3BW24.js";
|
|
20
|
+
import {
|
|
21
|
+
DialogTurnBusyError,
|
|
22
|
+
acquireLocalDialogTurnLease,
|
|
23
|
+
propagateLocalDialogTurnAuthority,
|
|
24
|
+
resolveLocalDialogTurnAuthority,
|
|
25
|
+
sanitizeDialogTurnIdentifier,
|
|
26
|
+
startDialogTurnHeartbeat
|
|
27
|
+
} from "./chunk-YWEZSBLL.js";
|
|
8
28
|
import {
|
|
29
|
+
isDialogTurnRef
|
|
30
|
+
} from "./chunk-EUHMI5KG.js";
|
|
31
|
+
import {
|
|
32
|
+
createLocalWorkspaceToolExecutors,
|
|
33
|
+
executeLocalToolWithPolicy,
|
|
34
|
+
isPathInsideRoot,
|
|
9
35
|
runLocalAgentTurn
|
|
10
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-GMBWWBSJ.js";
|
|
11
37
|
import {
|
|
12
38
|
resolveLocalRuntimeEnvFromPolicy
|
|
13
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-GX2MFKF3.js";
|
|
14
40
|
import {
|
|
15
41
|
asRecordOrEmpty
|
|
16
42
|
} from "./chunk-KX6YBIHG.js";
|
|
43
|
+
import {
|
|
44
|
+
toErrorMessage
|
|
45
|
+
} from "./chunk-HNMXYYJR.js";
|
|
46
|
+
import {
|
|
47
|
+
resolveLocalUserId
|
|
48
|
+
} from "./chunk-6KUTNAPU.js";
|
|
17
49
|
import {
|
|
18
50
|
applyToolSurfaceConstraints
|
|
19
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-FOC4TORM.js";
|
|
20
52
|
import {
|
|
21
53
|
ownedAgentKey
|
|
22
54
|
} from "./chunk-M2EJHDJP.js";
|
|
23
55
|
import {
|
|
24
56
|
asTrimmedNonEmptyStringArray
|
|
25
57
|
} from "./chunk-I42VC5KR.js";
|
|
58
|
+
import {
|
|
59
|
+
asTrimmedString
|
|
60
|
+
} from "./chunk-3EUW3WEO.js";
|
|
26
61
|
import {
|
|
27
62
|
asOptionalPositiveFiniteNumber
|
|
28
63
|
} from "./chunk-U6VC4MU4.js";
|
|
64
|
+
import {
|
|
65
|
+
isRecord
|
|
66
|
+
} from "./chunk-KUG52IAP.js";
|
|
29
67
|
import {
|
|
30
68
|
parseUserIdFromAuthToken
|
|
31
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-JUNYPVL6.js";
|
|
32
70
|
import {
|
|
33
71
|
DEFAULT_NOLO_SERVER_URL
|
|
34
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-RF576RYE.js";
|
|
73
|
+
import {
|
|
74
|
+
asOptionalTrimmedString
|
|
75
|
+
} from "./chunk-G3SUCT4W.js";
|
|
35
76
|
import {
|
|
36
77
|
readPipeText,
|
|
37
78
|
spawnProcess
|
|
38
79
|
} from "./chunk-4O22PGNQ.js";
|
|
39
80
|
import {
|
|
40
81
|
t
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} from "
|
|
45
|
-
import {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
isRecord
|
|
50
|
-
} from "./chunk-KUG52IAP.js";
|
|
82
|
+
} from "./chunk-RIOAPUGV.js";
|
|
83
|
+
|
|
84
|
+
// packages/cli/machineWsRunDispatch.ts
|
|
85
|
+
import { randomUUID } from "node:crypto";
|
|
86
|
+
import { readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
87
|
+
import { join as join4, resolve as resolve2 } from "node:path";
|
|
88
|
+
|
|
89
|
+
// packages/cli/connectorInstanceLock.ts
|
|
51
90
|
import {
|
|
52
|
-
|
|
53
|
-
|
|
91
|
+
closeSync,
|
|
92
|
+
mkdirSync,
|
|
93
|
+
openSync,
|
|
94
|
+
readFileSync,
|
|
95
|
+
renameSync,
|
|
96
|
+
statSync,
|
|
97
|
+
unlinkSync,
|
|
98
|
+
writeFileSync
|
|
99
|
+
} from "node:fs";
|
|
100
|
+
import { homedir } from "node:os";
|
|
101
|
+
import { join } from "node:path";
|
|
102
|
+
function resolveConnectorStateDir(args = {}) {
|
|
103
|
+
const homeDir = args.homeDir?.trim();
|
|
104
|
+
if (homeDir) return join(homeDir, ".nolo", "connector");
|
|
105
|
+
const noloHome = args.noloHome?.trim() || process.env.NOLO_HOME?.trim();
|
|
106
|
+
if (noloHome) return join(noloHome, "connector");
|
|
107
|
+
return join(homedir(), ".nolo", "connector");
|
|
108
|
+
}
|
|
109
|
+
function sanitizeMachineId(machineId) {
|
|
110
|
+
const safe = String(machineId ?? "").replace(/[^A-Za-z0-9._-]/g, "_");
|
|
111
|
+
return safe || "unknown";
|
|
112
|
+
}
|
|
113
|
+
function connectorInstanceLockPath(args) {
|
|
114
|
+
return join(resolveConnectorStateDir(args), `${sanitizeMachineId(args.machineId)}.lock`);
|
|
115
|
+
}
|
|
116
|
+
function connectorAliveSignalPath(args) {
|
|
117
|
+
return join(resolveConnectorStateDir(args), `${sanitizeMachineId(args.machineId)}.alive`);
|
|
118
|
+
}
|
|
119
|
+
function isProcessAlive(pid) {
|
|
120
|
+
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
121
|
+
try {
|
|
122
|
+
process.kill(pid, 0);
|
|
123
|
+
return true;
|
|
124
|
+
} catch (error) {
|
|
125
|
+
return error?.code === "EPERM";
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function readLockPid(lockPath) {
|
|
129
|
+
let raw;
|
|
130
|
+
try {
|
|
131
|
+
raw = readFileSync(lockPath, "utf8");
|
|
132
|
+
} catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const parsed = JSON.parse(raw);
|
|
137
|
+
const pid = Number(parsed?.pid);
|
|
138
|
+
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
139
|
+
} catch {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function isEexist(error) {
|
|
144
|
+
return error?.code === "EEXIST";
|
|
145
|
+
}
|
|
146
|
+
var CONNECTOR_LOCK_CORRUPT_RECLAIM_SECONDS = 300;
|
|
147
|
+
function inspectCorruptLock(lockPath, now = Date.now()) {
|
|
148
|
+
try {
|
|
149
|
+
const stat = statSync(lockPath);
|
|
150
|
+
const ageMs = now - stat.mtimeMs;
|
|
151
|
+
return ageMs > CONNECTOR_LOCK_CORRUPT_RECLAIM_SECONDS * 1e3 ? "expired" : "fresh";
|
|
152
|
+
} catch (error) {
|
|
153
|
+
const code = error?.code;
|
|
154
|
+
if (code === "ENOENT") return "gone";
|
|
155
|
+
return "fresh";
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function acquireConnectorInstanceLock(args) {
|
|
159
|
+
const lockPath = connectorInstanceLockPath(args);
|
|
160
|
+
mkdirSync(resolveConnectorStateDir(args), { recursive: true });
|
|
161
|
+
let reclaimed;
|
|
162
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
163
|
+
let fd = null;
|
|
164
|
+
try {
|
|
165
|
+
fd = openSync(lockPath, "wx");
|
|
166
|
+
} catch (error) {
|
|
167
|
+
if (!isEexist(error)) throw error;
|
|
168
|
+
const ownerPid2 = readLockPid(lockPath);
|
|
169
|
+
if (ownerPid2 !== null) {
|
|
170
|
+
if (isProcessAlive(ownerPid2)) {
|
|
171
|
+
return { ok: false, pid: ownerPid2 };
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
unlinkSync(lockPath);
|
|
175
|
+
} catch {
|
|
176
|
+
}
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
const state = inspectCorruptLock(lockPath);
|
|
180
|
+
if (state === "gone") {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (state === "fresh") {
|
|
184
|
+
return { ok: false, pid: 0 };
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
unlinkSync(lockPath);
|
|
188
|
+
} catch {
|
|
189
|
+
}
|
|
190
|
+
reclaimed = "corrupt";
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
writeFileSync(fd, JSON.stringify({ pid: process.pid, startedAt: Date.now() }), "utf8");
|
|
195
|
+
} finally {
|
|
196
|
+
closeSync(fd);
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
ok: true,
|
|
200
|
+
release: () => releaseConnectorInstanceLock(lockPath),
|
|
201
|
+
...reclaimed ? { reclaimed } : {}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
const ownerPid = readLockPid(lockPath);
|
|
205
|
+
return { ok: false, pid: ownerPid ?? 0 };
|
|
206
|
+
}
|
|
207
|
+
function releaseConnectorInstanceLock(lockPath) {
|
|
208
|
+
const ownerPid = readLockPid(lockPath);
|
|
209
|
+
if (ownerPid !== process.pid) return;
|
|
210
|
+
try {
|
|
211
|
+
unlinkSync(lockPath);
|
|
212
|
+
} catch {
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function markConnectorAlive(args) {
|
|
216
|
+
const path = connectorAliveSignalPath(args);
|
|
217
|
+
try {
|
|
218
|
+
mkdirSync(resolveConnectorStateDir(args), { recursive: true });
|
|
219
|
+
const tmpPath = `${path}.${process.pid}.tmp`;
|
|
220
|
+
writeFileSync(tmpPath, String(Date.now()), "utf8");
|
|
221
|
+
try {
|
|
222
|
+
renameSync(tmpPath, path);
|
|
223
|
+
} catch (error) {
|
|
224
|
+
try {
|
|
225
|
+
unlinkSync(tmpPath);
|
|
226
|
+
} catch {
|
|
227
|
+
}
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
} catch {
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function clearConnectorAlive(args) {
|
|
234
|
+
try {
|
|
235
|
+
unlinkSync(connectorAliveSignalPath(args));
|
|
236
|
+
} catch {
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function withConnectorAliveSignal(sendHeartbeat, args) {
|
|
240
|
+
return async () => {
|
|
241
|
+
const result = await sendHeartbeat();
|
|
242
|
+
markConnectorAlive(args);
|
|
243
|
+
return result;
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// packages/agent-runtime/connectorWorkspaceRequest.ts
|
|
248
|
+
function isConnectorWorkspacePathHint(value) {
|
|
249
|
+
return typeof value === "string" && value.trim().length > 0 && !value.includes("\0");
|
|
250
|
+
}
|
|
251
|
+
function isConnectorWorkspaceRequest(value) {
|
|
252
|
+
if (!value || typeof value !== "object") return false;
|
|
253
|
+
const request = value;
|
|
254
|
+
return request.mode === "strict" && isConnectorWorkspacePathHint(request.path);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// packages/cli/connectorWorkspaceCwd.ts
|
|
258
|
+
import { realpathSync, statSync as statSync2 } from "node:fs";
|
|
259
|
+
import { isAbsolute } from "node:path";
|
|
260
|
+
var ConnectorWorkspaceError = class extends Error {
|
|
261
|
+
constructor(code, message) {
|
|
262
|
+
super(message);
|
|
263
|
+
this.code = code;
|
|
264
|
+
this.name = "ConnectorWorkspaceError";
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
function realDirectory(path) {
|
|
268
|
+
if (!isAbsolute(path)) throw new ConnectorWorkspaceError("workspace_path_unauthorized", "Workspace directory must be absolute.");
|
|
269
|
+
try {
|
|
270
|
+
const real = realpathSync(path);
|
|
271
|
+
if (statSync2(real).isDirectory()) return real;
|
|
272
|
+
} catch (err) {
|
|
273
|
+
const code = err.code;
|
|
274
|
+
if (code !== "ENOENT" && code !== "ENOTDIR") {
|
|
275
|
+
throw new ConnectorWorkspaceError("workspace_path_unauthorized", "Workspace directory could not be authorized.");
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
throw new ConnectorWorkspaceError("workspace_path_missing", "Workspace directory does not exist or is not a directory.");
|
|
279
|
+
}
|
|
280
|
+
function connectorWorkspaceIsWithinRoots(realCwd, roots) {
|
|
281
|
+
return roots.map((root) => {
|
|
282
|
+
try {
|
|
283
|
+
return realDirectory(root);
|
|
284
|
+
} catch {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
}).some((root) => root !== null && isPathInsideRoot(root, realCwd));
|
|
288
|
+
}
|
|
289
|
+
function resolveAuthorizedConnectorWorkspaceCwd(path, roots) {
|
|
290
|
+
const realCwd = realDirectory(path);
|
|
291
|
+
if (!connectorWorkspaceIsWithinRoots(realCwd, roots)) {
|
|
292
|
+
throw new ConnectorWorkspaceError("workspace_path_unauthorized", "Workspace directory is outside authorized roots.");
|
|
293
|
+
}
|
|
294
|
+
return realCwd;
|
|
295
|
+
}
|
|
54
296
|
|
|
55
297
|
// packages/ai/agent/machineRunPermissions.ts
|
|
56
298
|
var DEFAULT_POLICY = {
|
|
@@ -75,7 +317,7 @@ function resolveMachineRunPermissionPolicy(agentConfig) {
|
|
|
75
317
|
return {
|
|
76
318
|
mode,
|
|
77
319
|
allowFilesystemRead: raw.allowFilesystemRead !== false,
|
|
78
|
-
allowFilesystemWrite:
|
|
320
|
+
allowFilesystemWrite: raw.allowFilesystemWrite !== false,
|
|
79
321
|
allowShell: raw.allowShell !== false,
|
|
80
322
|
writableRoots: normalizeWritableRoots(raw.writableRoots)
|
|
81
323
|
};
|
|
@@ -139,7 +381,7 @@ function resolveConnectorRunCwd(args) {
|
|
|
139
381
|
var RUN_GIT_TIMEOUT_MS = 1e4;
|
|
140
382
|
async function runGit(args, cwd, options = {}) {
|
|
141
383
|
const proc = spawnProcess({
|
|
142
|
-
cmd: ["git", ...args],
|
|
384
|
+
cmd: options.workspaceOnly ? ["git", "--literal-pathspecs", "-c", "core.fsmonitor=false", "-c", "core.hooksPath=", ...args] : ["git", ...args],
|
|
143
385
|
cwd,
|
|
144
386
|
stdout: "pipe",
|
|
145
387
|
stderr: "pipe",
|
|
@@ -153,14 +395,14 @@ async function runGit(args, cwd, options = {}) {
|
|
|
153
395
|
readPipeText(proc.stderr),
|
|
154
396
|
// 超时保险丝:该路径历史上出过「进程不退出」类挂死(见上);超时 kill 后流关闭、
|
|
155
397
|
// Promise.all 收敛,-1 与真实非零退出一样走「无数据」降级。
|
|
156
|
-
new Promise((
|
|
398
|
+
new Promise((resolve3) => {
|
|
157
399
|
const timer = setTimeout(() => {
|
|
158
400
|
proc.kill();
|
|
159
|
-
|
|
401
|
+
resolve3(-1);
|
|
160
402
|
}, RUN_GIT_TIMEOUT_MS);
|
|
161
403
|
void proc.exited.then((code) => {
|
|
162
404
|
clearTimeout(timer);
|
|
163
|
-
|
|
405
|
+
resolve3(code);
|
|
164
406
|
});
|
|
165
407
|
})
|
|
166
408
|
]);
|
|
@@ -176,17 +418,22 @@ function parseStatusChangedFiles(statusShort) {
|
|
|
176
418
|
return trimmedMatch?.[1]?.trim() ?? "";
|
|
177
419
|
}).map((line) => line.includes(" -> ") ? line.split(" -> ").at(-1) ?? line : line).filter(Boolean))];
|
|
178
420
|
}
|
|
179
|
-
async function readConnectorGitHead(cwd) {
|
|
180
|
-
return runGit(["rev-parse", "HEAD"], cwd);
|
|
421
|
+
async function readConnectorGitHead(cwd, options) {
|
|
422
|
+
return runGit(["rev-parse", "HEAD"], cwd, options);
|
|
181
423
|
}
|
|
182
424
|
async function collectConnectorRunArtifact(args) {
|
|
183
425
|
const collectedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
184
426
|
try {
|
|
427
|
+
const scope = args.workspaceOnly ? ["--", "."] : [];
|
|
428
|
+
const submoduleOptions = args.workspaceOnly ? ["--ignore-submodules=all"] : [];
|
|
429
|
+
const untrackedOptions = args.workspaceOnly ? ["--untracked-files=all"] : [];
|
|
430
|
+
const diffOptions = args.workspaceOnly ? ["--no-ext-diff", "--no-textconv", ...submoduleOptions] : [];
|
|
431
|
+
const options = { workspaceOnly: args.workspaceOnly };
|
|
185
432
|
const [headSha, statusShort, diffStat, patchText] = await Promise.all([
|
|
186
|
-
readConnectorGitHead(args.cwd),
|
|
187
|
-
runGit(["status", "--short"], args.cwd, { trim: false }),
|
|
188
|
-
runGit(["diff", "--stat"], args.cwd),
|
|
189
|
-
runGit(["diff", "--no-color", "--unified=3"], args.cwd)
|
|
433
|
+
readConnectorGitHead(args.cwd, options),
|
|
434
|
+
runGit(["status", "--short", ...submoduleOptions, ...untrackedOptions, ...scope], args.cwd, { ...options, trim: false }),
|
|
435
|
+
runGit(["diff", "--stat", ...diffOptions, ...scope], args.cwd, options),
|
|
436
|
+
runGit(["diff", "--no-color", "--unified=3", ...diffOptions, ...scope], args.cwd, options)
|
|
190
437
|
]);
|
|
191
438
|
const patchPreview = patchText ? clipMultilineText(patchText, MAX_PATCH_PREVIEW_CHARS) || void 0 : void 0;
|
|
192
439
|
return {
|
|
@@ -215,8 +462,8 @@ async function collectConnectorRunArtifact(args) {
|
|
|
215
462
|
|
|
216
463
|
// packages/cli/machineWsPromptMaterialization.ts
|
|
217
464
|
import { createHash } from "node:crypto";
|
|
218
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
219
|
-
import { join } from "node:path";
|
|
465
|
+
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
466
|
+
import { join as join2 } from "node:path";
|
|
220
467
|
var CLOUD_PROMPT_PAGE_READ_COMMAND = "bun packages/cli/index.ts doc read";
|
|
221
468
|
function byteLength(value) {
|
|
222
469
|
return Buffer.byteLength(value, "utf8");
|
|
@@ -240,10 +487,10 @@ function materializeLargeConnectorPrompt(args) {
|
|
|
240
487
|
promptRef: null
|
|
241
488
|
};
|
|
242
489
|
}
|
|
243
|
-
const promptDir =
|
|
244
|
-
|
|
245
|
-
const promptRef =
|
|
246
|
-
|
|
490
|
+
const promptDir = join2(args.cwd, ".nolo", "agent-prompts");
|
|
491
|
+
mkdirSync2(promptDir, { recursive: true });
|
|
492
|
+
const promptRef = join2(promptDir, `${args.requestId}-${promptHash}.md`);
|
|
493
|
+
writeFileSync2(promptRef, args.prompt, "utf8");
|
|
247
494
|
return {
|
|
248
495
|
prompt: [
|
|
249
496
|
"A large Nolo runtime prompt has been materialized outside this command argument.",
|
|
@@ -279,6 +526,12 @@ function readRuntimePromptPageMeta(parsed) {
|
|
|
279
526
|
}
|
|
280
527
|
|
|
281
528
|
// packages/cli/machineWsRunDispatchPurity.ts
|
|
529
|
+
var WindowsConnectorCliFencingUnsupportedError = class extends Error {
|
|
530
|
+
code = "connector_windows_cli_fencing_unsupported";
|
|
531
|
+
constructor() {
|
|
532
|
+
super("Windows Connector CLI process-tree isolation is not enabled; Windows Job Object support is required for dialog turns.");
|
|
533
|
+
}
|
|
534
|
+
};
|
|
282
535
|
function logConnectorRun(message, fields = {}) {
|
|
283
536
|
console.error(`[nolo-connector] ${message} ${JSON.stringify(fields)}`);
|
|
284
537
|
}
|
|
@@ -365,6 +618,26 @@ function runtimeWorkspacePermissionPolicy(runtimePolicy, runtimeEnv, cwd) {
|
|
|
365
618
|
writableRoots: [cwd]
|
|
366
619
|
};
|
|
367
620
|
}
|
|
621
|
+
var STRICT_READ_TOOLS = ["readFile"];
|
|
622
|
+
var STRICT_WRITE_TOOLS = ["writeFile", "editFile"];
|
|
623
|
+
function strictConnectorWorkspacePolicy(machine, runtime, cwd) {
|
|
624
|
+
const runtimeTools = Array.isArray(runtime?.runtimeTools) ? runtime.runtimeTools : [];
|
|
625
|
+
const withinRuntimeRoots = (roots) => roots === void 0 || Array.isArray(roots) && connectorWorkspaceIsWithinRoots(cwd, roots);
|
|
626
|
+
const allowFilesystemWrite = machine.allowFilesystemWrite && connectorWorkspaceIsWithinRoots(cwd, machine.writableRoots) && withinRuntimeRoots(runtime?.workspace?.writableRoots) && STRICT_WRITE_TOOLS.some((tool) => runtimeTools.includes(tool));
|
|
627
|
+
return {
|
|
628
|
+
mode: allowFilesystemWrite ? "full_access" : "read_only",
|
|
629
|
+
allowFilesystemRead: machine.allowFilesystemRead && withinRuntimeRoots(runtime?.workspace?.readableRoots),
|
|
630
|
+
allowFilesystemWrite,
|
|
631
|
+
allowShell: false,
|
|
632
|
+
writableRoots: allowFilesystemWrite ? [cwd] : []
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
function strictConnectorWorkspaceToolNames(permission, runtime) {
|
|
636
|
+
return [
|
|
637
|
+
...permission.allowFilesystemRead ? STRICT_READ_TOOLS : [],
|
|
638
|
+
...permission.allowFilesystemWrite ? STRICT_WRITE_TOOLS.filter((tool) => tool !== "editFile" || permission.allowFilesystemRead) : []
|
|
639
|
+
].filter((tool) => Array.isArray(runtime?.runtimeTools) && runtime.runtimeTools.includes(tool));
|
|
640
|
+
}
|
|
368
641
|
function scopePermissionPolicyToRuntimeWorkspace(policy, runtimePolicy, cwd) {
|
|
369
642
|
if (!requestsLocalWorkspaceRuntime(runtimePolicy)) return policy;
|
|
370
643
|
return {
|
|
@@ -445,6 +718,31 @@ function buildArtifactProgress(args) {
|
|
|
445
718
|
updatedAt: Date.now()
|
|
446
719
|
};
|
|
447
720
|
}
|
|
721
|
+
function createStrictConnectorWorkspaceExecutor(cwd, env, toolNames) {
|
|
722
|
+
const executors = createLocalWorkspaceToolExecutors({
|
|
723
|
+
workspaceRoot: cwd,
|
|
724
|
+
confirmExternalFileAccess: async () => false,
|
|
725
|
+
denyExternalReadSpills: true
|
|
726
|
+
});
|
|
727
|
+
const allowedExecutors = Object.fromEntries(Object.entries(executors).filter(([name]) => toolNames.includes(name)));
|
|
728
|
+
return (call, opts) => executeLocalToolWithPolicy({
|
|
729
|
+
env,
|
|
730
|
+
call,
|
|
731
|
+
runToolNames: toolNames,
|
|
732
|
+
agentToolNames: toolNames,
|
|
733
|
+
executors: allowedExecutors,
|
|
734
|
+
workspaceRoot: cwd,
|
|
735
|
+
abortSignal: opts?.abortSignal
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
function normalizeConnectorLocalAgentConfig(config) {
|
|
739
|
+
const { apiSource, provider } = config;
|
|
740
|
+
return {
|
|
741
|
+
...config,
|
|
742
|
+
apiSource: typeof apiSource === "string" ? apiSource : "platform",
|
|
743
|
+
provider: typeof provider === "string" ? provider : typeof apiSource === "string" ? apiSource : "openai"
|
|
744
|
+
};
|
|
745
|
+
}
|
|
448
746
|
async function defaultRunConnectorLocalRuntimeAgent(args) {
|
|
449
747
|
const obj = asRecordOrEmpty(args.parsed);
|
|
450
748
|
const payload = asRecordOrEmpty(obj.payload);
|
|
@@ -452,7 +750,9 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
|
|
|
452
750
|
const agentKey = typeof agentKeyRaw === "string" ? agentKeyRaw : "";
|
|
453
751
|
const agentConfigRaw = readField(payload, "agentConfig");
|
|
454
752
|
const payloadAgentConfig = asRecordOrEmpty(agentConfigRaw);
|
|
455
|
-
const
|
|
753
|
+
const runtimePolicy = runtimePolicyFromConnectorPayload(args.parsed);
|
|
754
|
+
const strictNames = args.strictPermission ? strictConnectorWorkspaceToolNames(args.strictPermission, runtimePolicy) : void 0;
|
|
755
|
+
const policy = strictNames ? { ...runtimePolicy, runtimeTools: strictNames, agentTools: [], workspace: { mode: "current", cwd: args.cwd }, shell: { enabled: false } } : runtimePolicy;
|
|
456
756
|
const candidateToolNames = mergeToolNames(
|
|
457
757
|
readField(payloadAgentConfig, "toolNames"),
|
|
458
758
|
readField(payloadAgentConfig, "tools"),
|
|
@@ -460,23 +760,20 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
|
|
|
460
760
|
policy?.runtimeTools
|
|
461
761
|
);
|
|
462
762
|
const runtimeContext = asRecordOrEmpty(readField(payload, "runtimeContext"));
|
|
463
|
-
const
|
|
763
|
+
const requestedSurface = applyToolSurfaceConstraints(
|
|
464
764
|
{ explicitToolNames: candidateToolNames, injectedToolNames: [], finalToolNames: candidateToolNames },
|
|
465
765
|
{
|
|
466
766
|
allowedToolNames: Array.isArray(readField(runtimeContext, "allowedToolNames")) ? readField(runtimeContext, "allowedToolNames") : void 0,
|
|
467
767
|
blockedToolNames: Array.isArray(readField(runtimeContext, "blockedToolNames")) ? readField(runtimeContext, "blockedToolNames") : void 0
|
|
468
768
|
}
|
|
469
769
|
);
|
|
770
|
+
const constrainedSurface = strictNames ? applyToolSurfaceConstraints(requestedSurface, { allowedToolNames: strictNames }) : requestedSurface;
|
|
470
771
|
const toolNames = constrainedSurface.finalToolNames;
|
|
471
|
-
const apiSourceRaw = readField(payloadAgentConfig, "apiSource");
|
|
472
|
-
const providerRaw = readField(payloadAgentConfig, "provider");
|
|
473
772
|
const agentRecord = {
|
|
474
|
-
...payloadAgentConfig,
|
|
773
|
+
...normalizeConnectorLocalAgentConfig(payloadAgentConfig),
|
|
475
774
|
dbKey: agentKey,
|
|
476
775
|
id: agentKey,
|
|
477
776
|
key: agentKey,
|
|
478
|
-
apiSource: typeof apiSourceRaw === "string" ? apiSourceRaw : "platform",
|
|
479
|
-
provider: typeof providerRaw === "string" ? providerRaw : typeof apiSourceRaw === "string" ? apiSourceRaw : "openai",
|
|
480
777
|
toolNames,
|
|
481
778
|
runScopedToolSurface: constrainedSurface,
|
|
482
779
|
...policy ? { runtimeToolPolicy: policy } : {}
|
|
@@ -500,32 +797,84 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
|
|
|
500
797
|
cwd: args.cwd,
|
|
501
798
|
...summarizeRuntimePolicyForLogs(policy)
|
|
502
799
|
});
|
|
503
|
-
|
|
800
|
+
if (args.dialogTurnLease && !args.sharedStore) {
|
|
801
|
+
throw new Error("Connector dialog turn lease requires a shared record store");
|
|
802
|
+
}
|
|
803
|
+
const leaseRef = args.dialogTurnLease?.dialogRef;
|
|
804
|
+
const leasedDialogKey = leaseRef && `dialog-${leaseRef.userId}-${leaseRef.dialogId}`;
|
|
805
|
+
const persistentStore = args.sharedStore ?? await getOrCreateSharedStore({
|
|
504
806
|
env,
|
|
505
807
|
cwd: args.cwd,
|
|
506
|
-
fetchImpl: args.fetchImpl ?? fetch
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
808
|
+
fetchImpl: args.fetchImpl ?? fetch
|
|
809
|
+
});
|
|
810
|
+
const isAgentOverrideKey = (key) => store.has(key) || key.startsWith("agent-");
|
|
811
|
+
const compositeStore = propagateLocalDialogTurnAuthority(persistentStore, {
|
|
812
|
+
read: async (key, options) => {
|
|
813
|
+
if (store.has(key)) return store.get(key) ?? null;
|
|
814
|
+
return persistentStore.read(key, key === leasedDialogKey ? { ...options, remote: false } : options);
|
|
815
|
+
},
|
|
816
|
+
write: async (key, value) => {
|
|
817
|
+
if (isAgentOverrideKey(key)) {
|
|
510
818
|
store.set(key, value);
|
|
511
819
|
return value;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
820
|
+
}
|
|
821
|
+
return persistentStore.write(key, value);
|
|
822
|
+
},
|
|
823
|
+
batch: async (ops) => {
|
|
824
|
+
const persistentOps = [];
|
|
825
|
+
for (const op of ops) {
|
|
826
|
+
if (op.type === "put" && isAgentOverrideKey(op.key)) {
|
|
827
|
+
store.set(op.key, op.value);
|
|
828
|
+
} else {
|
|
829
|
+
persistentOps.push(op);
|
|
516
830
|
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
831
|
+
}
|
|
832
|
+
if (persistentOps.length > 0) {
|
|
833
|
+
await persistentStore.batch(persistentOps);
|
|
834
|
+
}
|
|
835
|
+
},
|
|
836
|
+
iterator: async function* (options) {
|
|
837
|
+
const yielded = /* @__PURE__ */ new Set();
|
|
838
|
+
for await (const [key, value] of persistentStore.iterator(options)) {
|
|
839
|
+
yielded.add(key);
|
|
840
|
+
if (store.has(key)) {
|
|
524
841
|
yield [key, store.get(key)];
|
|
842
|
+
} else {
|
|
843
|
+
yield [key, value];
|
|
525
844
|
}
|
|
526
845
|
}
|
|
527
|
-
|
|
846
|
+
const keys = [...store.keys()].sort();
|
|
847
|
+
for (const key of keys) {
|
|
848
|
+
if (yielded.has(key)) continue;
|
|
849
|
+
if (key < options.gte) continue;
|
|
850
|
+
if (options.lte && key > options.lte) continue;
|
|
851
|
+
if (options.lt && key >= options.lt) continue;
|
|
852
|
+
yield [key, store.get(key)];
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
...typeof persistentStore.conditionalPut === "function" ? {
|
|
856
|
+
conditionalPut: (key, expectedRevision, value) => {
|
|
857
|
+
if (isAgentOverrideKey(key)) {
|
|
858
|
+
throw new Error("conditionalPut is not supported for agent override keys");
|
|
859
|
+
}
|
|
860
|
+
return persistentStore.conditionalPut(key, expectedRevision, value);
|
|
861
|
+
}
|
|
862
|
+
} : {}
|
|
528
863
|
});
|
|
864
|
+
const baseAdapter = createCliLocalRuntimeAdapter({
|
|
865
|
+
env,
|
|
866
|
+
cwd: args.cwd,
|
|
867
|
+
fetchImpl: args.fetchImpl ?? fetch,
|
|
868
|
+
store: compositeStore
|
|
869
|
+
});
|
|
870
|
+
const withStrictAdapter = strictNames ? { ...baseAdapter, executeTool: createStrictConnectorWorkspaceExecutor(args.cwd, env, toolNames) } : baseAdapter;
|
|
871
|
+
const adapter = args.dialogTurnLease ? {
|
|
872
|
+
...withStrictAdapter,
|
|
873
|
+
saveTurn: (input) => withStrictAdapter.saveTurn({
|
|
874
|
+
...input,
|
|
875
|
+
cliDialogTurn: args.dialogTurnLease
|
|
876
|
+
})
|
|
877
|
+
} : withStrictAdapter;
|
|
529
878
|
let toolCallCount = 0;
|
|
530
879
|
let toolResultCount = 0;
|
|
531
880
|
const lastToolNames = [];
|
|
@@ -540,14 +889,38 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
|
|
|
540
889
|
};
|
|
541
890
|
const userInputRaw = readField(payload, "userInput");
|
|
542
891
|
const continueDialogIdRaw = readField(payload, "continueDialogId");
|
|
892
|
+
const pending = /* @__PURE__ */ new Set();
|
|
893
|
+
const track = (operation) => {
|
|
894
|
+
const stopped2 = operation.then((value) => getExecutionStoppedPromise(value), (error) => getExecutionStoppedPromise(error) ?? Promise.resolve());
|
|
895
|
+
pending.add(stopped2);
|
|
896
|
+
void stopped2.then(() => pending.delete(stopped2), () => {
|
|
897
|
+
});
|
|
898
|
+
return operation;
|
|
899
|
+
};
|
|
900
|
+
const trackedAdapter = {
|
|
901
|
+
...adapter,
|
|
902
|
+
resolveProvider: async (...params) => {
|
|
903
|
+
const provider = await adapter.resolveProvider(...params);
|
|
904
|
+
if (args.blockLocalCli && provider.transport === "local-cli") {
|
|
905
|
+
throw new WindowsConnectorCliFencingUnsupportedError();
|
|
906
|
+
}
|
|
907
|
+
return { ...provider, complete: (...input) => track(provider.complete(...input)) };
|
|
908
|
+
},
|
|
909
|
+
executeTool: (...params) => track(adapter.executeTool(...params))
|
|
910
|
+
};
|
|
543
911
|
const result = await runLocalAgentTurn({
|
|
544
|
-
adapter,
|
|
912
|
+
adapter: trackedAdapter,
|
|
545
913
|
userLanguage: args.runtimeEnv.NOLO_LANG ?? null,
|
|
546
914
|
agentRef: agentKey,
|
|
547
915
|
input: typeof userInputRaw === "string" ? userInputRaw : "",
|
|
548
|
-
continueDialogId: typeof continueDialogIdRaw === "string" ? continueDialogIdRaw : void 0,
|
|
916
|
+
continueDialogId: typeof continueDialogIdRaw === "string" ? continueDialogIdRaw : args.onStreamEvent ? args.dialogTurnLease?.dialogRef.dialogId : void 0,
|
|
549
917
|
...args.abortSignal ? { abortSignal: args.abortSignal } : {},
|
|
918
|
+
...args.onStreamEvent ? {
|
|
919
|
+
onTextDelta: (content) => args.onStreamEvent?.({ type: "text", content }),
|
|
920
|
+
onReasoningDelta: (content) => args.onStreamEvent?.({ type: "reasoning", content })
|
|
921
|
+
} : {},
|
|
550
922
|
onToolEvent: (event) => {
|
|
923
|
+
args.onStreamEvent?.({ type: event.type, toolCallId: event.toolCallId, toolName: event.toolName });
|
|
551
924
|
if (event.type === "tool-call") toolCallCount += 1;
|
|
552
925
|
if (event.type === "tool-result") toolResultCount += 1;
|
|
553
926
|
noteToolName(event.toolName);
|
|
@@ -567,11 +940,24 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
|
|
|
567
940
|
updatedAt: Date.now()
|
|
568
941
|
});
|
|
569
942
|
}
|
|
943
|
+
}).catch((error) => {
|
|
944
|
+
if (!pending.size) throw error;
|
|
945
|
+
const stopped2 = Promise.all(pending).then(() => {
|
|
946
|
+
});
|
|
947
|
+
void stopped2.catch(() => {
|
|
948
|
+
});
|
|
949
|
+
throw attachExecutionStoppedPromise(error instanceof Error ? error : new Error(String(error)), stopped2);
|
|
570
950
|
});
|
|
571
|
-
|
|
951
|
+
const outcome = {
|
|
572
952
|
...result,
|
|
573
953
|
runtimeWorkspaceRoot: runtimeWorkspaceRootFromTrace(result.trace) ?? runtimeWorkspaceRoot
|
|
574
954
|
};
|
|
955
|
+
if (!pending.size) return outcome;
|
|
956
|
+
const stopped = Promise.all(pending).then(() => {
|
|
957
|
+
});
|
|
958
|
+
void stopped.catch(() => {
|
|
959
|
+
});
|
|
960
|
+
return attachExecutionStoppedPromise(outcome, stopped);
|
|
575
961
|
}
|
|
576
962
|
function normalizeConnectorRunTimeoutMs(value) {
|
|
577
963
|
const finite = asOptionalPositiveFiniteNumber(value);
|
|
@@ -621,14 +1007,14 @@ function extractMultimodalUserInput(userInput) {
|
|
|
621
1007
|
|
|
622
1008
|
// packages/cli/chatgptWebImageLocalJob.ts
|
|
623
1009
|
import {
|
|
624
|
-
mkdirSync as
|
|
625
|
-
readFileSync,
|
|
626
|
-
statSync,
|
|
627
|
-
unlinkSync,
|
|
628
|
-
writeFileSync as
|
|
1010
|
+
mkdirSync as mkdirSync3,
|
|
1011
|
+
readFileSync as readFileSync2,
|
|
1012
|
+
statSync as statSync3,
|
|
1013
|
+
unlinkSync as unlinkSync2,
|
|
1014
|
+
writeFileSync as writeFileSync3
|
|
629
1015
|
} from "node:fs";
|
|
630
|
-
import { homedir } from "node:os";
|
|
631
|
-
import { basename, dirname, join as
|
|
1016
|
+
import { homedir as homedir2 } from "node:os";
|
|
1017
|
+
import { basename, dirname, join as join3 } from "node:path";
|
|
632
1018
|
var CHATGPT_WEB_IMAGE_LOCAL_JOB = "chatgptWebImageGenerate";
|
|
633
1019
|
function readChatgptWebImageLocalJobMeta(payload) {
|
|
634
1020
|
if (!isRecord(payload)) return null;
|
|
@@ -644,15 +1030,15 @@ function readChatgptWebImageLocalJobMeta(payload) {
|
|
|
644
1030
|
};
|
|
645
1031
|
}
|
|
646
1032
|
function defaultLockPath(home) {
|
|
647
|
-
return
|
|
1033
|
+
return join3(home, ".nolo", "chatgpt-web-image.lock");
|
|
648
1034
|
}
|
|
649
1035
|
function defaultOutDir(home) {
|
|
650
|
-
return
|
|
1036
|
+
return join3(home, "nolo-image-lab", "out");
|
|
651
1037
|
}
|
|
652
1038
|
function acquireChatgptWebImageLock(lockPath) {
|
|
653
|
-
|
|
1039
|
+
mkdirSync3(dirname(lockPath), { recursive: true });
|
|
654
1040
|
try {
|
|
655
|
-
|
|
1041
|
+
writeFileSync3(lockPath, `${process.pid}
|
|
656
1042
|
${Date.now()}
|
|
657
1043
|
`, { flag: "wx" });
|
|
658
1044
|
} catch (error) {
|
|
@@ -664,7 +1050,7 @@ ${Date.now()}
|
|
|
664
1050
|
}
|
|
665
1051
|
return () => {
|
|
666
1052
|
try {
|
|
667
|
-
|
|
1053
|
+
unlinkSync2(lockPath);
|
|
668
1054
|
} catch {
|
|
669
1055
|
}
|
|
670
1056
|
};
|
|
@@ -708,7 +1094,7 @@ async function runOracleGenerateImage(args) {
|
|
|
708
1094
|
function assertOutputImage(outPath) {
|
|
709
1095
|
let st;
|
|
710
1096
|
try {
|
|
711
|
-
st =
|
|
1097
|
+
st = statSync3(outPath);
|
|
712
1098
|
} catch {
|
|
713
1099
|
throw new Error(t("chatgptWebImage.noOutputFile", outPath));
|
|
714
1100
|
}
|
|
@@ -717,7 +1103,7 @@ function assertOutputImage(outPath) {
|
|
|
717
1103
|
}
|
|
718
1104
|
}
|
|
719
1105
|
async function uploadPngToNoloFs(args) {
|
|
720
|
-
const bytes =
|
|
1106
|
+
const bytes = readFileSync2(args.outPath);
|
|
721
1107
|
const form = new FormData();
|
|
722
1108
|
const fileName = basename(args.outPath) || "chatgpt-web.png";
|
|
723
1109
|
form.append(
|
|
@@ -770,14 +1156,14 @@ async function runChatgptWebImageLocalJob(input, deps = {}) {
|
|
|
770
1156
|
if (!prompt) {
|
|
771
1157
|
throw new Error(t("chatgptWebImage.missingPrompt"));
|
|
772
1158
|
}
|
|
773
|
-
const home = (deps.homedir ??
|
|
1159
|
+
const home = (deps.homedir ?? homedir2)();
|
|
774
1160
|
const lockPath = deps.lockPath ?? defaultLockPath(home);
|
|
775
1161
|
const outDir = deps.outDir ?? defaultOutDir(home);
|
|
776
1162
|
const release = acquireChatgptWebImageLock(lockPath);
|
|
777
1163
|
try {
|
|
778
|
-
|
|
1164
|
+
mkdirSync3(outDir, { recursive: true });
|
|
779
1165
|
const stamp = (deps.now ?? Date.now)();
|
|
780
|
-
const outPath =
|
|
1166
|
+
const outPath = join3(outDir, `chatgpt-web-${stamp}.png`);
|
|
781
1167
|
await runOracleGenerateImage({
|
|
782
1168
|
prompt,
|
|
783
1169
|
outPath,
|
|
@@ -823,7 +1209,70 @@ async function runChatgptWebImageLocalJob(input, deps = {}) {
|
|
|
823
1209
|
|
|
824
1210
|
// packages/cli/machineWsRunDispatch.ts
|
|
825
1211
|
var activeRunAbortControllers = /* @__PURE__ */ new Map();
|
|
826
|
-
|
|
1212
|
+
var pendingLeaseReleases = /* @__PURE__ */ new Map();
|
|
1213
|
+
var maxPendingLeaseReleases = 1024;
|
|
1214
|
+
function __setConnectorLeaseRecoveryCapacityForTest(capacity) {
|
|
1215
|
+
maxPendingLeaseReleases = capacity;
|
|
1216
|
+
}
|
|
1217
|
+
var pendingLeaseReleaseCount = 0;
|
|
1218
|
+
var releaseKey = (file, { userId, dialogId }) => JSON.stringify([file, userId, dialogId]);
|
|
1219
|
+
function readPendingReleases(file) {
|
|
1220
|
+
let raw;
|
|
1221
|
+
try {
|
|
1222
|
+
raw = readFileSync3(file, "utf8");
|
|
1223
|
+
} catch (error) {
|
|
1224
|
+
if (error.code === "ENOENT") return [];
|
|
1225
|
+
throw error;
|
|
1226
|
+
}
|
|
1227
|
+
const value = JSON.parse(raw);
|
|
1228
|
+
if (!Array.isArray(value)) throw new Error("Invalid Connector pending lease release file");
|
|
1229
|
+
return value.filter((entry) => isRecord(entry) && isDialogTurnRef(entry.dialogRef) && typeof entry.runToken === "string" && entry.runToken.length > 0);
|
|
1230
|
+
}
|
|
1231
|
+
async function updatePendingReleases(file, update) {
|
|
1232
|
+
try {
|
|
1233
|
+
await withQueueLock(file, () => {
|
|
1234
|
+
const entries = readPendingReleases(file);
|
|
1235
|
+
const next = update(entries);
|
|
1236
|
+
if (entries === next || !entries.length && !next.length) return;
|
|
1237
|
+
const temp = `${file}.${randomUUID()}.tmp`;
|
|
1238
|
+
writeFileSync4(temp, JSON.stringify(next), { encoding: "utf8", mode: 384, flag: "wx" });
|
|
1239
|
+
renameSync2(temp, file);
|
|
1240
|
+
});
|
|
1241
|
+
} catch (error) {
|
|
1242
|
+
logConnectorRun("agent.run.recovery.file_error", { error: toErrorMessage(error) });
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
async function endConnectorTurn(authority, dialogRef, runToken, reason) {
|
|
1246
|
+
const { status } = await authority.endDialogTurn({ dialogRef, runToken, reason });
|
|
1247
|
+
if (status !== "ended" && status !== "already_idle" && status !== "token_mismatch") {
|
|
1248
|
+
throw new Error(`Connector turn release rejected (${status})`);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
async function recoverPendingLeaseReleases(authority, dialogRef, file) {
|
|
1252
|
+
const key = releaseKey(file, dialogRef);
|
|
1253
|
+
const cached = pendingLeaseReleases.get(key);
|
|
1254
|
+
const tokens = new Set(cached);
|
|
1255
|
+
try {
|
|
1256
|
+
for (const entry of readPendingReleases(file)) {
|
|
1257
|
+
if (releaseKey(file, entry.dialogRef) === key) tokens.add(entry.runToken);
|
|
1258
|
+
}
|
|
1259
|
+
} catch (error) {
|
|
1260
|
+
logConnectorRun("agent.run.recovery.file_error", { error: toErrorMessage(error) });
|
|
1261
|
+
}
|
|
1262
|
+
const cleared = /* @__PURE__ */ new Set();
|
|
1263
|
+
for (const token of tokens) {
|
|
1264
|
+
try {
|
|
1265
|
+
await endConnectorTurn(authority, dialogRef, token, "pending_release_recovery");
|
|
1266
|
+
cleared.add(token);
|
|
1267
|
+
if (cached?.delete(token)) pendingLeaseReleaseCount--;
|
|
1268
|
+
} catch {
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
if (cached && !cached.size && pendingLeaseReleases.get(key) === cached) pendingLeaseReleases.delete(key);
|
|
1272
|
+
if (cleared.size) await updatePendingReleases(file, (entries) => entries.filter((entry) => releaseKey(file, entry.dialogRef) !== key || !cleared.has(entry.runToken)));
|
|
1273
|
+
}
|
|
1274
|
+
async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv, fetchImpl, deps = {}, sessionSignal) {
|
|
1275
|
+
if (sessionSignal?.aborted) return;
|
|
827
1276
|
let parsed;
|
|
828
1277
|
try {
|
|
829
1278
|
parsed = JSON.parse(message);
|
|
@@ -833,17 +1282,21 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
833
1282
|
if (!isRecord(parsed) || typeof parsed.requestId !== "string") return;
|
|
834
1283
|
const requestId = parsed.requestId;
|
|
835
1284
|
if (parsed.type === "agent.run.cancel") {
|
|
836
|
-
const
|
|
837
|
-
if (
|
|
838
|
-
controller.abort(new Error("agent.run.cancel received from server"));
|
|
1285
|
+
const run = activeRunAbortControllers.get(requestId);
|
|
1286
|
+
if (run && run.sessionSignal === sessionSignal) {
|
|
1287
|
+
run.controller.abort(new Error("agent.run.cancel received from server"));
|
|
839
1288
|
}
|
|
840
1289
|
return;
|
|
841
1290
|
}
|
|
842
|
-
|
|
1291
|
+
const strictFrame = parsed.type === "agent.run.strict-workspace";
|
|
1292
|
+
if (parsed.type !== "agent.run" && !strictFrame) return;
|
|
843
1293
|
const payload = asRecordOrEmpty(parsed.payload);
|
|
844
1294
|
const agentConfig = asRecordOrEmpty(payload.agentConfig);
|
|
845
1295
|
const runAbortController = new AbortController();
|
|
846
|
-
|
|
1296
|
+
const activeRun = { controller: runAbortController, sessionSignal };
|
|
1297
|
+
activeRunAbortControllers.set(requestId, activeRun);
|
|
1298
|
+
const abortRunOnDisconnect = () => runAbortController.abort(sessionSignal?.reason);
|
|
1299
|
+
sessionSignal?.addEventListener("abort", abortRunOnDisconnect, { once: true });
|
|
847
1300
|
const sendProgress = (progress) => {
|
|
848
1301
|
send(JSON.stringify({
|
|
849
1302
|
type: "agent.run.progress",
|
|
@@ -860,9 +1313,49 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
860
1313
|
const readRuntimePromptPageMeta2 = deps.readRuntimePromptPageMeta ?? readRuntimePromptPageMeta;
|
|
861
1314
|
const runConnectorLocalRuntimeAgent = deps.runConnectorLocalRuntimeAgent ?? defaultRunConnectorLocalRuntimeAgent;
|
|
862
1315
|
const runChatgptWebImageLocalJob2 = deps.runChatgptWebImageLocalJob ?? runChatgptWebImageLocalJob;
|
|
1316
|
+
let pendingReleaseFile;
|
|
1317
|
+
let executionStopped;
|
|
1318
|
+
let connectorTurnAuthority;
|
|
1319
|
+
let connectorTurnLease;
|
|
1320
|
+
let connectorTurnHeartbeat;
|
|
1321
|
+
let terminalMessage;
|
|
1322
|
+
const stageTerminalResult = (body) => {
|
|
1323
|
+
terminalMessage = JSON.stringify({ type: "agent.run.result", requestId, ...body });
|
|
1324
|
+
};
|
|
1325
|
+
const releaseConnectorTurnLeaseWithRecovery = async (authority, { dialogRef, runToken }) => {
|
|
1326
|
+
const reason = runAbortController.signal.aborted ? "connector_aborted" : "connector_finally";
|
|
1327
|
+
for (let attempt = 1; ; attempt++) {
|
|
1328
|
+
try {
|
|
1329
|
+
await endConnectorTurn(authority, dialogRef, runToken, reason);
|
|
1330
|
+
return;
|
|
1331
|
+
} catch (error) {
|
|
1332
|
+
if (attempt === 3) {
|
|
1333
|
+
if (pendingReleaseFile) {
|
|
1334
|
+
const file = pendingReleaseFile;
|
|
1335
|
+
const key = releaseKey(file, dialogRef);
|
|
1336
|
+
const tokens = pendingLeaseReleases.get(key) ?? /* @__PURE__ */ new Set();
|
|
1337
|
+
if (!tokens.has(runToken) && pendingLeaseReleaseCount < maxPendingLeaseReleases) {
|
|
1338
|
+
tokens.add(runToken);
|
|
1339
|
+
pendingLeaseReleases.set(key, tokens);
|
|
1340
|
+
pendingLeaseReleaseCount++;
|
|
1341
|
+
}
|
|
1342
|
+
await updatePendingReleases(file, (entries) => entries.some((entry) => releaseKey(file, entry.dialogRef) === key && entry.runToken === runToken) ? entries : [...entries, { dialogRef, runToken }]);
|
|
1343
|
+
}
|
|
1344
|
+
throw error;
|
|
1345
|
+
}
|
|
1346
|
+
await new Promise((resolve3) => setTimeout(resolve3, 15 * attempt));
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
863
1350
|
try {
|
|
1351
|
+
const strictRequest = payload.workspaceRequest;
|
|
1352
|
+
if ((strictFrame || strictRequest !== void 0) && !isConnectorWorkspaceRequest(strictRequest)) {
|
|
1353
|
+
throw new ConnectorWorkspaceError("workspace_path_unauthorized", "Invalid strict workspace request.");
|
|
1354
|
+
}
|
|
1355
|
+
const workspaceRequest = isConnectorWorkspaceRequest(strictRequest) ? strictRequest : void 0;
|
|
864
1356
|
const chatgptWebImageJob = readChatgptWebImageLocalJobMeta(payload);
|
|
865
1357
|
if (chatgptWebImageJob) {
|
|
1358
|
+
if (workspaceRequest) throw new ConnectorWorkspaceError("workspace_execution_unsupported", "Local jobs cannot honor strict workspaces.");
|
|
866
1359
|
logConnectorRun("agent.run.local-job.start", {
|
|
867
1360
|
requestId,
|
|
868
1361
|
localJob: "chatgptWebImageGenerate",
|
|
@@ -876,9 +1369,7 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
876
1369
|
serverBase: chatgptWebImageJob.serverBase
|
|
877
1370
|
});
|
|
878
1371
|
const galleryRawData = jobResult.rawData;
|
|
879
|
-
|
|
880
|
-
type: "agent.run.result",
|
|
881
|
-
requestId,
|
|
1372
|
+
stageTerminalResult({
|
|
882
1373
|
result: {
|
|
883
1374
|
content: JSON.stringify(galleryRawData),
|
|
884
1375
|
model: "chatgpt-web",
|
|
@@ -889,7 +1380,7 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
889
1380
|
imageCount: galleryRawData.imageCount
|
|
890
1381
|
}
|
|
891
1382
|
}
|
|
892
|
-
})
|
|
1383
|
+
});
|
|
893
1384
|
return;
|
|
894
1385
|
}
|
|
895
1386
|
const machinePermissionPolicy = resolveMachineRunPermissionPolicy2(agentConfig);
|
|
@@ -898,7 +1389,98 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
898
1389
|
const userInput = extractedInput.text;
|
|
899
1390
|
const connectorImageUrls = extractedInput.imageUrls;
|
|
900
1391
|
const timeout = normalizeConnectorRunTimeoutMs(payload.timeoutMs);
|
|
901
|
-
|
|
1392
|
+
const hostRoot = runtimeEnv.NOLO_CONNECTOR_WORKDIR;
|
|
1393
|
+
const cwd = workspaceRequest ? resolveAuthorizedConnectorWorkspaceCwd(workspaceRequest.path, hostRoot ? [hostRoot] : machinePermissionPolicy.writableRoots) : resolveConnectorRunCwd2({ env: runtimeEnv, policy: machinePermissionPolicy });
|
|
1394
|
+
const strictPermission = workspaceRequest ? strictConnectorWorkspacePolicy(machinePermissionPolicy, runtimePolicy, cwd) : void 0;
|
|
1395
|
+
const effectiveRuntimeEnv = withForwardedUserAuthToken(runtimeEnv, parsed);
|
|
1396
|
+
const metaRecord = asRecordOrEmpty(readField2(payload, "meta"));
|
|
1397
|
+
const targetDialogId = asOptionalTrimmedString(readField2(payload, "continueDialogId")) ?? asOptionalTrimmedString(readField2(payload, "dialogId")) ?? asOptionalTrimmedString(readField2(metaRecord, "continueDialogId")) ?? asOptionalTrimmedString(readField2(metaRecord, "dialogId"));
|
|
1398
|
+
const targetUserId = resolveLocalUserId(effectiveRuntimeEnv);
|
|
1399
|
+
const dialogRef = { userId: targetUserId, dialogId: targetDialogId };
|
|
1400
|
+
const requiresLocalLease = isDialogTurnRef(dialogRef);
|
|
1401
|
+
const blockLocalCli = (deps.platform ?? process.platform) === "win32" && requiresLocalLease;
|
|
1402
|
+
if (blockLocalCli && isCliProviderAgentConfig(normalizeConnectorLocalAgentConfig(agentConfig))) {
|
|
1403
|
+
throw new WindowsConnectorCliFencingUnsupportedError();
|
|
1404
|
+
}
|
|
1405
|
+
if (strictPermission && (isCliProviderAgentConfig(agentConfig) || isCursorOAuthAgent({ apiKeyRef: asOptionalTrimmedString(agentConfig.apiKeyRef) }))) {
|
|
1406
|
+
throw new ConnectorWorkspaceError("workspace_execution_unsupported", "Provider cannot enforce strict workspace permissions.");
|
|
1407
|
+
}
|
|
1408
|
+
let connectorSharedStore = deps.sharedStore;
|
|
1409
|
+
const acquireConnectorTurnIfNeeded = async (keepTurnActive = false) => {
|
|
1410
|
+
if (!requiresLocalLease) {
|
|
1411
|
+
return true;
|
|
1412
|
+
}
|
|
1413
|
+
let authority = deps.dialogTurnAuthority;
|
|
1414
|
+
if (!authority && deps.getDialogTurnAuthority) {
|
|
1415
|
+
authority = await deps.getDialogTurnAuthority({ env: effectiveRuntimeEnv });
|
|
1416
|
+
}
|
|
1417
|
+
if (!authority) {
|
|
1418
|
+
connectorSharedStore ??= await getOrCreateSharedStore({
|
|
1419
|
+
env: effectiveRuntimeEnv,
|
|
1420
|
+
cwd,
|
|
1421
|
+
fetchImpl
|
|
1422
|
+
});
|
|
1423
|
+
authority = resolveLocalDialogTurnAuthority(connectorSharedStore);
|
|
1424
|
+
}
|
|
1425
|
+
connectorTurnAuthority = authority;
|
|
1426
|
+
const runId = sanitizeDialogTurnIdentifier(
|
|
1427
|
+
asOptionalTrimmedString(readField2(payload, "runId")) ?? `conn-${requestId}`,
|
|
1428
|
+
"conn"
|
|
1429
|
+
);
|
|
1430
|
+
pendingReleaseFile = resolve2(deps.pendingLeaseReleaseFilePath ?? join4(
|
|
1431
|
+
resolveConnectorStateDir({ noloHome: effectiveRuntimeEnv.NOLO_HOME }),
|
|
1432
|
+
"connector-pending-lease-releases.json"
|
|
1433
|
+
));
|
|
1434
|
+
await recoverPendingLeaseReleases(authority, dialogRef, pendingReleaseFile);
|
|
1435
|
+
runAbortController.signal.throwIfAborted();
|
|
1436
|
+
const acquired = await acquireLocalDialogTurnLease({
|
|
1437
|
+
authority,
|
|
1438
|
+
dialogRef,
|
|
1439
|
+
runId,
|
|
1440
|
+
holder: `connector:${requestId}:${randomUUID()}`,
|
|
1441
|
+
holderKind: "connector",
|
|
1442
|
+
commandId: `commit-${runId}`
|
|
1443
|
+
});
|
|
1444
|
+
if (!acquired.ok) {
|
|
1445
|
+
if (acquired.status === "busy") {
|
|
1446
|
+
stageTerminalResult({
|
|
1447
|
+
error: `Dialog is busy (activeRunId=${acquired.activeTurn.runId})`,
|
|
1448
|
+
errorCode: "dialog_busy",
|
|
1449
|
+
activeRunId: acquired.activeTurn.runId,
|
|
1450
|
+
activeTurn: acquired.activeTurn,
|
|
1451
|
+
dialogBusy: {
|
|
1452
|
+
dialogRef,
|
|
1453
|
+
dialogRevision: acquired.dialogRevision,
|
|
1454
|
+
activeRunId: acquired.activeTurn.runId,
|
|
1455
|
+
activeTurn: acquired.activeTurn
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
throw new Error(`Dialog turn rejected (${acquired.status})`);
|
|
1461
|
+
}
|
|
1462
|
+
connectorTurnLease = acquired.lease;
|
|
1463
|
+
if (keepTurnActive) connectorTurnLease.keepTurnActive = true;
|
|
1464
|
+
connectorTurnHeartbeat = startDialogTurnHeartbeat({
|
|
1465
|
+
authority,
|
|
1466
|
+
dialogRef,
|
|
1467
|
+
runToken: acquired.lease.runToken,
|
|
1468
|
+
intervalMs: deps.dialogTurnHeartbeatIntervalMs,
|
|
1469
|
+
onLeaseLost: () => runAbortController.abort(new Error("Local Connector dialog turn lease lost"))
|
|
1470
|
+
});
|
|
1471
|
+
if (keepTurnActive && connectorSharedStore && resolveLocalDialogTurnAuthority(connectorSharedStore) === authority) {
|
|
1472
|
+
const dialogKey = `dialog-${targetUserId}-${targetDialogId}`;
|
|
1473
|
+
if (!await connectorSharedStore.read(dialogKey, { remote: false })) {
|
|
1474
|
+
await connectorSharedStore.read(dialogKey);
|
|
1475
|
+
const state = await authority.getDialogTurnState({ dialogRef });
|
|
1476
|
+
if (!("ok" in state && state.ok) || state.activeTurn?.runId !== acquired.activeTurn.runId || state.activeTurn.holder !== acquired.activeTurn.holder || state.activeTurn.startedAt !== acquired.activeTurn.startedAt) {
|
|
1477
|
+
throw new Error("Dialog turn lease lost during Connector header hydration");
|
|
1478
|
+
}
|
|
1479
|
+
connectorTurnLease.baseRevision = state.dialogRevision;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
return true;
|
|
1483
|
+
};
|
|
902
1484
|
let runContent = "";
|
|
903
1485
|
let runModel = (() => {
|
|
904
1486
|
const value = readField2(agentConfig, "model");
|
|
@@ -918,7 +1500,12 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
918
1500
|
cwd
|
|
919
1501
|
);
|
|
920
1502
|
assertMachineRunAllowed2(userInput, effectivePermissionPolicy);
|
|
1503
|
+
if (!await acquireConnectorTurnIfNeeded()) {
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1506
|
+
runAbortController.signal.throwIfAborted();
|
|
921
1507
|
baseSha = await readConnectorGitHead2(artifactCwd);
|
|
1508
|
+
runAbortController.signal.throwIfAborted();
|
|
922
1509
|
const providerRaw = readField2(agentConfig, "cliProvider");
|
|
923
1510
|
const fallbackProvider = readField2(agentConfig, "provider");
|
|
924
1511
|
const provider = asOptionalTrimmedString(providerRaw) ?? asOptionalTrimmedString(fallbackProvider) ?? "copilot";
|
|
@@ -973,26 +1560,28 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
973
1560
|
updatedAt: Date.now()
|
|
974
1561
|
});
|
|
975
1562
|
}, 15e3);
|
|
976
|
-
const
|
|
1563
|
+
const effectiveRuntimeEnv2 = withForwardedUserAuthToken(runtimeEnv, parsed);
|
|
977
1564
|
const reasoningEffortRaw = readField2(agentConfig, "reasoning_effort");
|
|
978
1565
|
const reasoningEffortFallback = readField2(agentConfig, "reasoningEffort");
|
|
979
1566
|
const reasoningEffort = typeof reasoningEffortRaw === "string" && reasoningEffortRaw || typeof reasoningEffortFallback === "string" && reasoningEffortFallback || void 0;
|
|
980
1567
|
const modelValue = readField2(agentConfig, "model");
|
|
981
1568
|
const result2 = await executeCli(finalProvider, materializedPrompt.prompt, {
|
|
1569
|
+
signal: runAbortController.signal,
|
|
982
1570
|
model: typeof modelValue === "string" ? modelValue : void 0,
|
|
983
1571
|
timeout,
|
|
984
1572
|
cwd,
|
|
985
1573
|
yolo: true,
|
|
986
1574
|
...reasoningEffort ? { reasoningEffort } : {},
|
|
987
1575
|
env: {
|
|
988
|
-
NOLO_SERVER:
|
|
989
|
-
NOLO_SERVER_URL:
|
|
990
|
-
BASE_URL:
|
|
991
|
-
AUTH_TOKEN:
|
|
992
|
-
NOLO_MACHINE_API_KEY:
|
|
1576
|
+
NOLO_SERVER: effectiveRuntimeEnv2.NOLO_SERVER || effectiveRuntimeEnv2.NOLO_SERVER_URL || effectiveRuntimeEnv2.BASE_URL,
|
|
1577
|
+
NOLO_SERVER_URL: effectiveRuntimeEnv2.NOLO_SERVER_URL || effectiveRuntimeEnv2.NOLO_SERVER || effectiveRuntimeEnv2.BASE_URL,
|
|
1578
|
+
BASE_URL: effectiveRuntimeEnv2.BASE_URL || effectiveRuntimeEnv2.NOLO_SERVER || effectiveRuntimeEnv2.NOLO_SERVER_URL,
|
|
1579
|
+
AUTH_TOKEN: effectiveRuntimeEnv2.AUTH_TOKEN || effectiveRuntimeEnv2.AUTH || effectiveRuntimeEnv2.NOLO_MACHINE_API_KEY,
|
|
1580
|
+
NOLO_MACHINE_API_KEY: effectiveRuntimeEnv2.NOLO_MACHINE_API_KEY || effectiveRuntimeEnv2.AUTH_TOKEN || effectiveRuntimeEnv2.AUTH
|
|
993
1581
|
},
|
|
994
1582
|
...connectorImageUrls.length > 0 ? { imageInputs: connectorImageUrls.map((url) => ({ source: url })) } : {}
|
|
995
1583
|
}).finally(() => clearInterval(heartbeat));
|
|
1584
|
+
executionStopped = getExecutionStoppedPromise(result2);
|
|
996
1585
|
logConnectorRun("agent.run.cli.result", {
|
|
997
1586
|
requestId,
|
|
998
1587
|
provider: finalProvider,
|
|
@@ -1015,19 +1604,17 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
1015
1604
|
workspaceKind: "current"
|
|
1016
1605
|
});
|
|
1017
1606
|
if (artifactProgress2) sendProgress(artifactProgress2);
|
|
1018
|
-
|
|
1019
|
-
type: "agent.run.result",
|
|
1020
|
-
requestId,
|
|
1607
|
+
stageTerminalResult({
|
|
1021
1608
|
result: {
|
|
1022
1609
|
content: runContent,
|
|
1023
1610
|
model: runModel,
|
|
1024
1611
|
trace: runTrace,
|
|
1025
1612
|
artifacts: artifacts2
|
|
1026
1613
|
}
|
|
1027
|
-
})
|
|
1614
|
+
});
|
|
1028
1615
|
return;
|
|
1029
1616
|
}
|
|
1030
|
-
if (!requestsLocalWorkspaceRuntime(runtimePolicy) && !isMachineBoundLocalCustomProvider(agentConfig)) {
|
|
1617
|
+
if (!strictPermission && !requestsLocalWorkspaceRuntime(runtimePolicy) && !isMachineBoundLocalCustomProvider(agentConfig)) {
|
|
1031
1618
|
throw new Error("Connector can only execute non-CLI agents when runtimeToolPolicySnapshot requests a local workspace runtime.");
|
|
1032
1619
|
}
|
|
1033
1620
|
logConnectorRun("agent.run.local-runtime.start", {
|
|
@@ -1039,34 +1626,57 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
1039
1626
|
runtimePolicy: Boolean(runtimePolicy),
|
|
1040
1627
|
...summarizeAgentConfigForLogs(agentConfig)
|
|
1041
1628
|
});
|
|
1042
|
-
|
|
1629
|
+
if (strictPermission || payload.stream === true) {
|
|
1630
|
+
assertMachineRunAllowed2(userInput, strictPermission ?? machinePermissionPolicy);
|
|
1631
|
+
}
|
|
1632
|
+
if (!await acquireConnectorTurnIfNeeded(true)) {
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1635
|
+
runAbortController.signal.throwIfAborted();
|
|
1636
|
+
const streamLease = payload.stream === true ? connectorTurnLease : void 0;
|
|
1637
|
+
if (streamLease) {
|
|
1638
|
+
send(JSON.stringify({ type: "agent.run.accepted", requestId, dialogId: streamLease.dialogRef.dialogId }));
|
|
1639
|
+
}
|
|
1640
|
+
if (!strictPermission || strictPermission.allowFilesystemRead) {
|
|
1641
|
+
baseSha = await readConnectorGitHead2(cwd, strictPermission ? { workspaceOnly: true } : void 0);
|
|
1642
|
+
}
|
|
1643
|
+
runAbortController.signal.throwIfAborted();
|
|
1043
1644
|
const result = await runConnectorLocalRuntimeAgent({
|
|
1044
1645
|
parsed,
|
|
1045
|
-
|
|
1646
|
+
blockLocalCli,
|
|
1647
|
+
runtimeEnv: effectiveRuntimeEnv,
|
|
1046
1648
|
cwd,
|
|
1047
1649
|
fetchImpl,
|
|
1650
|
+
...strictPermission ? { strictPermission } : {},
|
|
1651
|
+
...connectorTurnLease ? { dialogTurnLease: connectorTurnLease } : {},
|
|
1652
|
+
...connectorSharedStore ? { sharedStore: connectorSharedStore } : {},
|
|
1048
1653
|
onProgress: sendProgress,
|
|
1654
|
+
...streamLease ? { onStreamEvent: (event) => {
|
|
1655
|
+
if (!runAbortController.signal.aborted) {
|
|
1656
|
+
send(JSON.stringify({ type: "agent.run.delta", requestId, event }));
|
|
1657
|
+
}
|
|
1658
|
+
} } : {},
|
|
1049
1659
|
abortSignal: runAbortController.signal
|
|
1050
1660
|
});
|
|
1661
|
+
executionStopped = getExecutionStoppedPromise(result);
|
|
1051
1662
|
runContent = result.content;
|
|
1052
1663
|
runModel = result.model;
|
|
1053
1664
|
runTrace = result.trace ?? [];
|
|
1054
|
-
artifactCwd = result.runtimeWorkspaceRoot ?? cwd;
|
|
1055
|
-
const artifacts = await collectConnectorRunArtifact2({
|
|
1665
|
+
artifactCwd = strictPermission ? cwd : result.runtimeWorkspaceRoot ?? cwd;
|
|
1666
|
+
const artifacts = !strictPermission || strictPermission.allowFilesystemRead ? await collectConnectorRunArtifact2({
|
|
1056
1667
|
cwd: artifactCwd,
|
|
1057
1668
|
baseSha,
|
|
1058
|
-
exitStatus: "completed"
|
|
1059
|
-
|
|
1060
|
-
|
|
1669
|
+
exitStatus: "completed",
|
|
1670
|
+
...strictPermission ? { workspaceOnly: true } : {}
|
|
1671
|
+
}) : void 0;
|
|
1672
|
+
const artifactProgress = artifacts && buildArtifactProgress({
|
|
1061
1673
|
artifacts,
|
|
1062
1674
|
runtimePolicy,
|
|
1063
1675
|
workspaceRoot: artifactCwd,
|
|
1064
1676
|
workspaceKind: "current"
|
|
1065
1677
|
});
|
|
1066
1678
|
if (artifactProgress) sendProgress(artifactProgress);
|
|
1067
|
-
|
|
1068
|
-
type: "agent.run.result",
|
|
1069
|
-
requestId,
|
|
1679
|
+
stageTerminalResult({
|
|
1070
1680
|
result: {
|
|
1071
1681
|
content: runContent,
|
|
1072
1682
|
model: runModel,
|
|
@@ -1084,8 +1694,11 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
1084
1694
|
emptyAssistantFallbackReason: result.emptyAssistantFallbackReason,
|
|
1085
1695
|
usage: result.usage
|
|
1086
1696
|
}
|
|
1087
|
-
})
|
|
1697
|
+
});
|
|
1088
1698
|
} catch (error) {
|
|
1699
|
+
const errorStopped = getExecutionStoppedPromise(error);
|
|
1700
|
+
if (errorStopped) executionStopped = executionStopped ? Promise.all([executionStopped, errorStopped]).then(() => {
|
|
1701
|
+
}) : errorStopped;
|
|
1089
1702
|
logConnectorRun("agent.run.error", {
|
|
1090
1703
|
requestId,
|
|
1091
1704
|
agentKey: readField2(payload, "agentKey"),
|
|
@@ -1094,15 +1707,52 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
|
|
|
1094
1707
|
error: toErrorMessage(error)
|
|
1095
1708
|
});
|
|
1096
1709
|
const cancelled = runAbortController.signal.aborted;
|
|
1097
|
-
|
|
1098
|
-
type: "agent.run.result",
|
|
1099
|
-
requestId,
|
|
1710
|
+
stageTerminalResult({
|
|
1100
1711
|
error: toErrorMessage(error),
|
|
1712
|
+
...error instanceof ConnectorWorkspaceError ? { errorCode: error.code } : {},
|
|
1713
|
+
...error instanceof WindowsConnectorCliFencingUnsupportedError ? { ok: false, errorCode: error.code } : {},
|
|
1714
|
+
...error instanceof DialogTurnBusyError ? {
|
|
1715
|
+
errorCode: error.errorCode,
|
|
1716
|
+
activeRunId: error.activeTurn.runId,
|
|
1717
|
+
activeTurn: error.activeTurn,
|
|
1718
|
+
dialogBusy: {
|
|
1719
|
+
dialogRef: error.dialogRef,
|
|
1720
|
+
dialogRevision: error.dialogRevision,
|
|
1721
|
+
activeRunId: error.activeTurn.runId,
|
|
1722
|
+
activeTurn: error.activeTurn
|
|
1723
|
+
}
|
|
1724
|
+
} : {},
|
|
1101
1725
|
...cancelled ? { cancelled: true } : {}
|
|
1102
|
-
})
|
|
1726
|
+
});
|
|
1103
1727
|
} finally {
|
|
1104
|
-
|
|
1105
|
-
|
|
1728
|
+
try {
|
|
1729
|
+
connectorTurnHeartbeat?.stop();
|
|
1730
|
+
const authority = connectorTurnAuthority;
|
|
1731
|
+
const lease = connectorTurnLease;
|
|
1732
|
+
if (lease && authority) {
|
|
1733
|
+
const release = () => releaseConnectorTurnLeaseWithRecovery(authority, lease);
|
|
1734
|
+
const reportReleaseError = (error) => logConnectorRun("agent.run.settlement.error", { requestId, error: toErrorMessage(error) });
|
|
1735
|
+
if (executionStopped) {
|
|
1736
|
+
void executionStopped.then(release).catch(reportReleaseError);
|
|
1737
|
+
} else {
|
|
1738
|
+
try {
|
|
1739
|
+
await release();
|
|
1740
|
+
} catch (error) {
|
|
1741
|
+
reportReleaseError(error);
|
|
1742
|
+
stageTerminalResult({
|
|
1743
|
+
ok: false,
|
|
1744
|
+
error: "Failed to release the local Connector dialog turn lease after 3 attempts",
|
|
1745
|
+
errorCode: "connector_local_turn_release_failed"
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
if (terminalMessage !== void 0) send(terminalMessage);
|
|
1751
|
+
} finally {
|
|
1752
|
+
sessionSignal?.removeEventListener("abort", abortRunOnDisconnect);
|
|
1753
|
+
if (activeRunAbortControllers.get(requestId) === activeRun) {
|
|
1754
|
+
activeRunAbortControllers.delete(requestId);
|
|
1755
|
+
}
|
|
1106
1756
|
}
|
|
1107
1757
|
}
|
|
1108
1758
|
}
|
|
@@ -1115,6 +1765,10 @@ function readField2(record, key) {
|
|
|
1115
1765
|
}
|
|
1116
1766
|
|
|
1117
1767
|
export {
|
|
1768
|
+
CONNECTOR_LOCK_CORRUPT_RECLAIM_SECONDS,
|
|
1769
|
+
acquireConnectorInstanceLock,
|
|
1770
|
+
clearConnectorAlive,
|
|
1771
|
+
withConnectorAliveSignal,
|
|
1118
1772
|
resolveMachineRunPermissionPolicy,
|
|
1119
1773
|
buildMachinePermissionPromptBlock,
|
|
1120
1774
|
summarizeAgentConfigForLogs,
|
|
@@ -1128,5 +1782,6 @@ export {
|
|
|
1128
1782
|
buildArtifactProgress,
|
|
1129
1783
|
defaultRunConnectorLocalRuntimeAgent,
|
|
1130
1784
|
extractMultimodalUserInput,
|
|
1785
|
+
__setConnectorLeaseRecoveryCapacityForTest,
|
|
1131
1786
|
handleConnectorRunMessage
|
|
1132
1787
|
};
|