nolo-cli 0.227.0-alpha.1 → 0.227.0
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 +3 -5
- package/{_executeModel-JKQGZ3HU.js → _executeModel-CXOFYVHC.js} +93 -87
- package/{action-CK64LS6S.js → action-R2EIXR7I.js} +11 -8
- package/{addContentAction-CARFID6E.js → addContentAction-W6JVLQ6H.js} +17 -16
- package/{addDialogAgentAction-APLZLFW5.js → addDialogAgentAction-LVNKMXKZ.js} +20 -19
- package/{agentDeleteCommand-NVR2V2HH.js → agentDeleteCommand-VFSZPEQ5.js} +145 -137
- package/{agentEmailCommands-UCVOWD3S.js → agentEmailCommands-KRUIF4EH.js} +149 -137
- package/{agentFavoriteCommands-4PDOP3GW.js → agentFavoriteCommands-7LOP3HUD.js} +6 -6
- package/{agentGrantCommands-FLCEXLUH.js → agentGrantCommands-L6O2HVJI.js} +7 -7
- package/agentListCommands-TDFOLWN3.js +644 -0
- package/{agentMachineCommands-V3DGEJU4.js → agentMachineCommands-PSH7Q5PF.js} +76 -67
- package/{agentProviderCommands-7QBFRFRK.js → agentProviderCommands-C5T7C5KZ.js} +7 -7
- package/{agentPullCommand-E6JBGBVG.js → agentPullCommand-QQQZSC6S.js} +7 -7
- package/agentRecordCommands-KCKCW2QU.js +188 -0
- package/agentRunCommand-EF2T2QWD.js +223 -0
- package/{agentRunControl-SNZZ5XP4.js → agentRunControl-CSMSJFFB.js} +25 -17
- package/{agentRuntimeLocal-GOX2DIY7.js → agentRuntimeLocal-6QXQS3TS.js} +64 -50
- package/{agentSlice-N7H2FRJA.js → agentSlice-IZ5ANAF7.js} +19 -18
- package/{appDeleteCommands-LZDN26FU.js → appDeleteCommands-4M7ETEEG.js} +68 -59
- package/{appDeployCommands-6IO6TTZH.js → appDeployCommands-2VJ2NDW5.js} +68 -59
- package/{appDeployStatusCommands-FG3LX24J.js → appDeployStatusCommands-LDFSWOPQ.js} +68 -59
- package/{appGetCommands-NAKVDVD4.js → appGetCommands-RHVNOPT4.js} +68 -59
- package/{appListCommands-KL56RN73.js → appListCommands-U3XEVTL4.js} +68 -59
- package/{authCommand-AUN5MXV2.js → authCommand-PVZ45QRO.js} +36 -31
- package/{authCommands-D2IPS6ES.js → authCommands-6AUYO65N.js} +18 -13
- package/{builtinSkillRegistry-UQGLKRYP.js → builtinSkillRegistry-LRVAQCPW.js} +6 -6
- package/{chromeCommands-G5UDKVSV.js → chromeCommands-S7AW3AOD.js} +383 -6
- package/{chromeOpsCommands-UJWN5HWH.js → chromeOpsCommands-TBPM6MR4.js} +8 -8
- package/{chunk-ABGULE7H.js → chunk-22YUCKMK.js} +16 -16
- package/{chunk-P2ZLUIW2.js → chunk-2BSLGODA.js} +350 -25
- package/{chunk-GOLPOTG5.js → chunk-2COM7SAH.js} +4 -4
- package/{chunk-ULAQPRHX.js → chunk-2FK2KZSL.js} +1 -1
- package/{chunk-PLPLH2XZ.js → chunk-2IPR4PBB.js} +2 -2
- package/chunk-2SXN7LAY.js +15 -0
- package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
- package/{chunk-7Z3WUZ4Q.js → chunk-3YYFU6H7.js} +74 -46
- package/{chunk-C2B7M567.js → chunk-4OXPN3WC.js} +17 -6
- package/chunk-4TVOZGOS.js +62 -0
- package/chunk-4ZCTKB27.js +31 -0
- package/chunk-53AEDFBL.js +33394 -0
- package/chunk-53W5BXLN.js +340 -0
- package/{chunk-OXA5GWHU.js → chunk-56O2J2Y4.js} +3 -3
- package/{chunk-IAJJYHIB.js → chunk-56PB7FEN.js} +8 -8
- package/{chunk-JWXITTQB.js → chunk-5HUO7SEX.js} +9 -107
- package/{chunk-AGP3YSEC.js → chunk-5PASH2MB.js} +46 -1
- package/{chunk-PHOSZT3E.js → chunk-5UAKGCQG.js} +1 -1
- package/{chunk-5RKRXQ2H.js → chunk-5VVP7DW3.js} +20 -13
- package/chunk-6ASGEP5D.js +21 -0
- package/chunk-6PXFEPHL.js +103 -0
- package/chunk-6RSNVJGO.js +279 -0
- package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
- package/{chunk-KMRKZNGT.js → chunk-6YYTTLJV.js} +14 -13
- package/{chunk-VREDDN25.js → chunk-76HAJUOJ.js} +14 -9
- package/{chunk-FKEZOMIF.js → chunk-7DXFOL5B.js} +1410 -768
- package/{chunk-LA7JYAKF.js → chunk-AKPKOI5Z.js} +6 -6
- package/{chunk-PWTNI4N7.js → chunk-ANUP75N2.js} +22 -0
- package/{chunk-F5AY2UZL.js → chunk-AO6T7U62.js} +592 -68
- package/{chunk-LJSNEV7M.js → chunk-AS6L5KSD.js} +8 -8
- package/{chunk-GOQ6ZVTN.js → chunk-AVSZ6PBM.js} +5 -5
- package/chunk-BIDSIRTS.js +307 -0
- package/chunk-C5A54QS7.js +108 -0
- package/{chunk-KYH7XW3K.js → chunk-CD2DK5JA.js} +135 -14
- package/{chunk-G6HJUMST.js → chunk-CJQBWHNM.js} +2 -2
- package/{chunk-EVGU5P4U.js → chunk-CO6E7YK6.js} +1 -1
- package/{chunk-ZYA2YDB6.js → chunk-CT5JXREL.js} +17 -17
- package/{chunk-VPAZ6BEN.js → chunk-CTWCZKNS.js} +42 -17
- package/{chunk-4OKTPFNX.js → chunk-CX2LYFZQ.js} +107 -66
- package/{chunk-YFLVRVYK.js → chunk-DLT2DN4M.js} +1 -1
- package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
- package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
- package/{chunk-OQHIVPG4.js → chunk-E6A5NHDH.js} +4 -1
- package/{chunk-IX2BXN2K.js → chunk-EDT65EUE.js} +6 -6
- package/{chunk-VP3BINY7.js → chunk-EQZZASCD.js} +31 -1
- package/{chunk-45LZIYXB.js → chunk-ESN4WNWU.js} +3 -2
- package/{chunk-M3JEW6N6.js → chunk-F26GAEH3.js} +10 -0
- package/{chunk-CVERLOJM.js → chunk-F4XIS5DL.js} +1215 -1431
- package/chunk-FDZ2GBWO.js +166 -0
- package/chunk-FGHEF6WI.js +34 -0
- package/{chunk-CSW7IPVD.js → chunk-FMYNIAI6.js} +61 -24
- package/{chunk-VIHDJ3FK.js → chunk-FNT5VENS.js} +15 -15
- package/{chunk-PMDVQBGA.js → chunk-GAHJLSDO.js} +14 -7
- package/{chunk-GRXSJR2Z.js → chunk-GVTFSLNI.js} +112 -109
- package/{chunk-UN7HIYMH.js → chunk-GX6DITLQ.js} +1 -1
- package/{chunk-3VFYQH3I.js → chunk-HIDVLMZC.js} +203 -156
- package/{chunk-5LQDHFBN.js → chunk-IDFGIROZ.js} +20 -17
- package/{chunk-UCFPVYP7.js → chunk-IFWXH7LH.js} +1 -1
- package/{chunk-LXTC53TN.js → chunk-J45ACAOQ.js} +815 -361
- package/{chunk-S6K5F3KP.js → chunk-JP2BH4NC.js} +1 -1
- package/{chunk-X2KRQP7V.js → chunk-JV5FHHF7.js} +1 -1
- package/{chunk-6EDAMVG6.js → chunk-K26XPZRB.js} +11 -11
- package/{chunk-RU6DULV4.js → chunk-KB5RQRSJ.js} +1 -1
- package/{chunk-T43K75CK.js → chunk-KC2QVCI7.js} +24 -178
- package/chunk-KK3FCYZM.js +647 -0
- package/{chunk-XZODOEKU.js → chunk-KMDHRVS7.js} +29 -5
- package/{chunk-4JVNURX4.js → chunk-KQHEGELM.js} +68 -16
- package/{chunk-UAPNPNSG.js → chunk-KW72WVHO.js} +2085 -1046
- package/{chunk-ILHQ2AXT.js → chunk-KZAT2M2V.js} +14 -8
- package/{chunk-L42CBKBZ.js → chunk-KZKMH374.js} +3 -3
- package/{chunk-ZI5SZ3MV.js → chunk-L6BLA6BT.js} +40 -31
- package/{chunk-AK5O76CC.js → chunk-LC5CVWP2.js} +3 -3
- package/{chunk-N5Z2V73W.js → chunk-LELADM5Q.js} +1 -1
- package/chunk-LHCGKAFO.js +739 -0
- package/{chunk-YOT437BH.js → chunk-LOF2EFUE.js} +203 -123
- package/{chunk-YQETUZ5V.js → chunk-LTVEOOZL.js} +29 -16
- package/{chunk-T2BEPTAG.js → chunk-MAA42MMV.js} +272 -26
- package/{chunk-NAOO4PVX.js → chunk-MECW2HJG.js} +16 -16
- package/{chunk-5HL4KC4A.js → chunk-MEDPR36J.js} +62 -87
- package/chunk-MVOZ22RZ.js +26 -0
- package/{chunk-YPPKC6FL.js → chunk-MYYNZG2M.js} +140 -40
- package/{chunk-UVUVQVZ6.js → chunk-MZVCFV3T.js} +19 -15
- package/{chunk-CQVGR3MX.js → chunk-N7MXFYLU.js} +7 -7
- package/{chunk-IC2I373Q.js → chunk-NEG5LYK5.js} +4 -4
- package/chunk-NJJK3PDA.js +133 -0
- package/{chunk-OB6DVWPF.js → chunk-OGZE6BZG.js} +331 -99
- package/{chunk-M3Y4IBIR.js → chunk-OHUYN3YU.js} +6 -6
- package/chunk-P27E22MA.js +203 -0
- package/{chunk-SFTTXGPM.js → chunk-PDAXMBLW.js} +35 -28
- package/{chunk-OBSEKCVK.js → chunk-PQ63BDV3.js} +210 -51
- package/{chunk-EUCFKKDM.js → chunk-PVFYPUIM.js} +40 -10
- package/{chunk-SRG5CNLC.js → chunk-QIVE5WJE.js} +8 -8
- package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
- package/{chunk-5RKUPJYL.js → chunk-QLUYDJST.js} +11 -3
- package/{chunk-7Z6EW7AH.js → chunk-QOURTDZL.js} +97 -11
- package/{chunk-VZW34YUL.js → chunk-QWSH3UAQ.js} +8 -5
- package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
- package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
- package/{chunk-SW6OD4KE.js → chunk-RDPAIR67.js} +351 -18
- package/{chunk-NO3VBWTL.js → chunk-RXTZB2DH.js} +4 -4
- package/{chunk-AXYH4734.js → chunk-S25VJYXV.js} +21 -15
- package/{chunk-MWHOH4RJ.js → chunk-SESKIWB4.js} +6 -6
- package/{chunk-GUVXQSFZ.js → chunk-SF4GMDZO.js} +18 -108
- package/{chunk-TINJKQSO.js → chunk-SQRKAYQW.js} +25 -25
- package/chunk-SR4FE5VD.js +9 -0
- package/{chunk-3HTP4WZQ.js → chunk-SX6AWTNK.js} +46 -8
- package/{chunk-4WVJLODK.js → chunk-T23G6PXQ.js} +8 -3
- package/{chunk-CLCXHIBS.js → chunk-T4QY3HZ5.js} +1 -1
- package/{chunk-HVUDBOQG.js → chunk-TB5KTLNB.js} +9 -6
- package/{chunk-KRRE4A7D.js → chunk-TKE4OJ4B.js} +280 -56
- package/{chunk-S2NTVGA2.js → chunk-U35UUM5K.js} +2 -1
- package/{chunk-PPJYZRSQ.js → chunk-U5LOKQ2R.js} +30 -14
- package/{chunk-CKT6QUE2.js → chunk-UHW6SCVK.js} +1 -1
- package/{chunk-T5N6NHAT.js → chunk-UPOW5HTG.js} +6 -6
- package/{chunk-WJP4TH6U.js → chunk-VEVLLBFK.js} +2 -2
- package/{chunk-HGDKT2D6.js → chunk-VTHWBTRE.js} +177 -1
- package/{chunk-KJAAPGBE.js → chunk-VUHKG4KS.js} +6 -6
- package/{chunk-TOKPHZ55.js → chunk-W3HSD32M.js} +17 -10
- package/{chunk-2SKTCNWO.js → chunk-W5OJBZLZ.js} +4 -4
- package/chunk-WBSJAIZP.js +170 -0
- package/chunk-WDWZPASX.js +29 -0
- package/chunk-WFGNWWJI.js +326 -0
- package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
- package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
- package/{chunk-HYKGIXNO.js → chunk-XGWRH3OF.js} +114 -29
- package/{chunk-XIEYGCN6.js → chunk-XKV53E4E.js} +460 -117
- package/{chunk-JHF6VLVL.js → chunk-XYRTC2Y3.js} +155 -170
- package/{chunk-L5I543VB.js → chunk-YGDYYFRX.js} +20 -24
- package/{chunk-ZADGPNTV.js → chunk-YHWMKGOX.js} +77 -103
- package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
- package/chunk-Z6YTCDU4.js +24 -0
- package/{chunk-PVAWNHP5.js → chunk-ZP26NIZE.js} +647 -387
- package/{chunk-2G3YSVO6.js → chunk-ZQ6K57FJ.js} +3 -3
- package/{cliAgentConfigHelpers-QVSQYTKC.js → cliAgentConfigHelpers-37ZNEY5Y.js} +16 -16
- package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
- package/{cliEnvHelpers-D6HMC46Z.js → cliEnvHelpers-CNMP3RDX.js} +2 -2
- package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
- package/cliLocalAgentRecordReader-53773JID.js +102 -0
- package/{commandRegistry-TKR6OWXP.js → commandRegistry-RJUO2VOD.js} +113 -101
- package/{contentThunks-BQWRPCTM.js → contentThunks-4EFHLUTB.js} +44 -41
- package/{cooldownCommands-FZYQOWI5.js → cooldownCommands-QL6DWGVU.js} +3 -3
- package/{createAgentAutomationAction-GFI6SJZV.js → createAgentAutomationAction-ZFFGJ7CZ.js} +44 -41
- package/{createDialogAction-MMBIHFFU.js → createDialogAction-SDUGVTPS.js} +45 -43
- package/{createPageAction-EEYUE5FB.js → createPageAction-NNM3OFLY.js} +49 -46
- package/{db-CS4ZJQKV.js → db-6NRZLEW2.js} +10 -7
- package/{dbSlice-X4Z4E4QU.js → dbSlice-5MQ3ELID.js} +16 -15
- package/{deleteFile-QOOP2UK7.js → deleteFile-VCCHS72Y.js} +12 -9
- package/{dialogCommands-OXBQ73DD.js → dialogCommands-SJK5KWXU.js} +73 -66
- package/dialogMessageRecord-OAV77LT7.js +7 -0
- package/{dialogNotifyCommand-VWS5G4OO.js → dialogNotifyCommand-PST75COP.js} +19 -19
- package/{dialogSlice-KGYIABDY.js → dialogSlice-2KLMHECR.js} +44 -41
- package/{dialogUsageCommand-FEWCN7IA.js → dialogUsageCommand-BZPKR3DW.js} +8 -8
- package/{docCreateCommands-LS32VKY3.js → docCreateCommands-K7CDL2HY.js} +66 -57
- package/{docDeleteCommands-JTYR5RPH.js → docDeleteCommands-ZEY5YCSP.js} +69 -60
- package/{docReadCommands-E5LTVKWN.js → docReadCommands-A4ROLIQG.js} +66 -57
- package/{docStore-TVS2FNER.js → docStore-A4O6YJAM.js} +19 -18
- package/{docUpdateCommands-I3J3JDZ2.js → docUpdateCommands-6HTFQY4O.js} +66 -57
- package/{fetchMessages-Q3INLN5F.js → fetchMessages-TQEUZD7H.js} +3 -3
- package/{getPricing-VNGFM4PN.js → getPricing-FCHYVRJU.js} +6 -6
- package/{handleSendMessageAction-SSON36TJ.js → handleSendMessageAction-6WEFYBUC.js} +87 -82
- package/{hostCredentialCreate-WTW4THJF.js → hostCredentialCreate-WOWCNOYM.js} +136 -123
- package/index.js +54 -16
- package/keys-RWF7UCB4.js +1 -1
- package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
- package/{localDialogRead-V36DX2Q2.js → localDialogRead-3T2KMCRC.js} +2 -2
- package/{localRuntimeAdapter-MI2JGXSF.js → localRuntimeAdapter-7EDBDRYW.js} +147 -133
- package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-7DKIT7UH.js} +4 -2
- package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-5WZ4RJJO.js} +1 -1
- package/{machineCommands-3LROJZDK.js → machineCommands-XRPC67LL.js} +290 -354
- package/machineWsRunDispatch-SOGFW472.js +203 -0
- package/markdownToSlate-KIYM7B3P.js +8 -0
- package/mcpLocalAuthorizeCommand-VOJARP3M.js +106 -0
- package/{memberThunks-CFEPHAND.js → memberThunks-KC3WJGL3.js} +26 -21
- package/{memoryCommands-JQMEJO7J.js → memoryCommands-BC6REPQB.js} +6 -6
- package/{models-H5NNZRLH.js → models-EP7VG6N2.js} +2 -2
- package/{overlay-THLKYIWY.js → overlay-JA3SPVUS.js} +7 -3
- package/package.json +1 -1
- package/{projectArchive-3X54XFVN.js → projectArchive-GDVPIZX2.js} +50 -47
- package/{providerPresetApply-FO36N5TX.js → providerPresetApply-4H7YP5D7.js} +9 -9
- package/{providerRegistry-U2BSFE6K.js → providerRegistry-F3UPOTIY.js} +9 -9
- package/{read-KA3L2V7O.js → read-T7VU2IMO.js} +11 -10
- package/{readDocTool-AMAZAPAW.js → readDocTool-BPQ3QJSD.js} +1 -1
- package/{readlineWorkspace-Z3YUH4SX.js → readlineWorkspace-OWQIIUGH.js} +9406 -6791
- package/rememberExplicit-CPAPONSI.js +15 -0
- package/{removeDialogAgentAction-JQOJSUM7.js → removeDialogAgentAction-FEUUVMYC.js} +23 -22
- package/{runAgentClientLoop-4FCFLMDJ.js → runAgentClientLoop-SJREK2B7.js} +107 -86
- package/{runtimeDoctorCommands-CXOCVDPU.js → runtimeDoctorCommands-XQD4MN4I.js} +19 -19
- package/{secretCommands-GGUAWAE7.js → secretCommands-LH7QTJO2.js} +3 -3
- package/{setDialogExtraReferencesAction-YXQTGXIN.js → setDialogExtraReferencesAction-JSTQJPXL.js} +19 -18
- package/{setPrimaryDialogAgentAction-YNLB66WE.js → setPrimaryDialogAgentAction-Z2BQE3IY.js} +23 -22
- package/{settingThunks-E6N7RSSS.js → settingThunks-C2YWCNYI.js} +186 -67
- package/{skillDiscovery-B5V23AXP.js → skillDiscovery-MDDKPTW3.js} +4 -3
- package/{spaceCommands-DB5DKC2J.js → spaceCommands-YRBQ52PG.js} +71 -62
- package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
- package/{streamAgentChatTurn-FCBGMD4D.js → streamAgentChatTurn-NCA4BKDZ.js} +244 -185
- package/{switchDialogAgentAction-LAHLUECU.js → switchDialogAgentAction-G7XVAOGH.js} +20 -19
- package/{tableCommands-VNSXHAMG.js → tableCommands-UHEA5QNL.js} +14 -11
- package/{toolApiClient-OGQEBQVX.js → toolApiClient-N5PYW2R3.js} +8 -6
- package/{tools-6JD36D6K.js → tools-6WQVUGKV.js} +74 -70
- package/tuiRestart-3J7LRMPR.js +41 -0
- package/{tuiSummaryLlmCaller-UHZIPGAX.js → tuiSummaryLlmCaller-2J6NG53N.js} +24 -23
- package/{updateCommands-KZ54HCU5.js → updateCommands-5OYND6EF.js} +8 -6
- package/{updateDialogTitleAction-RV3EUEN3.js → updateDialogTitleAction-QCSN3RYO.js} +46 -43
- package/{usageCommand-KFVV6UL3.js → usageCommand-SK7JTEPC.js} +3 -3
- package/{usageRebuildCommand-HHFSNK46.js → usageRebuildCommand-DF3HUP6F.js} +4 -4
- package/webapi-QVV65DQF.js +2487 -0
- package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-HIYNL3VR.js} +2 -2
- package/workContext-Y3ADAPZU.js +14 -0
- package/workContextAccess-UZHDLBUR.js +11 -0
- package/workContextWriteNotice-YCSSMHN4.js +7 -0
- package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-ZCSQCHG3.js} +9 -9
- package/agentListCommands-C65UESYM.js +0 -1004
- package/agentRecordCommands-6RCJS2EY.js +0 -176
- package/agentRunCommand-P3GRKXKS.js +0 -208
- package/chunk-2WZXXAQD.js +0 -57
- package/chunk-5ZMIIR23.js +0 -265
- package/chunk-62HXNQVV.js +0 -134
- package/chunk-BJF2MHJ3.js +0 -118
- package/chunk-KEPOVMF4.js +0 -91
- package/chunk-PXKF5CV4.js +0 -357
- package/chunk-WACI5I6V.js +0 -147
- package/chunk-YGILMZ7N.js +0 -81
- package/cliLocalAgentRecordReader-SPKAJYME.js +0 -90
- package/machineWsRunDispatch-BUUJRUUB.js +0 -191
- package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +4 -4
- package/{chunk-VXL2FZTP.js → chunk-HXER7YJF.js} +3 -3
- package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
- package/{chunk-SSGTV4FC.js → chunk-USGHJSGO.js} +5 -5
- package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
- package/{offlineMarxistsAgentCommand-AGA2X5E4.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +5 -5
|
@@ -1,1004 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveObservedSpeed
|
|
3
|
-
} from "./chunk-AMWMV56B.js";
|
|
4
|
-
import {
|
|
5
|
-
decorateAgentsWithPublicStatusAcrossServers,
|
|
6
|
-
listFavoriteAgentIdsAcrossServers,
|
|
7
|
-
listLocalCachedAgents,
|
|
8
|
-
listRemoteAgents,
|
|
9
|
-
listRemoteAgentsAcrossServers,
|
|
10
|
-
listRemotePublicAgents,
|
|
11
|
-
normalizeListedAgent,
|
|
12
|
-
parseAgentListArgs
|
|
13
|
-
} from "./chunk-VZW34YUL.js";
|
|
14
|
-
import {
|
|
15
|
-
buildSpaceLookup,
|
|
16
|
-
getSpaceContentKeys
|
|
17
|
-
} from "./chunk-ID4G2MAR.js";
|
|
18
|
-
import {
|
|
19
|
-
readLiveDbRecordAfterTombstoneMerge
|
|
20
|
-
} from "./chunk-PHOSZT3E.js";
|
|
21
|
-
import {
|
|
22
|
-
refreshSubscriptionQuotas
|
|
23
|
-
} from "./chunk-YGILMZ7N.js";
|
|
24
|
-
import {
|
|
25
|
-
getReadableCliDb
|
|
26
|
-
} from "./chunk-YFLVRVYK.js";
|
|
27
|
-
import {
|
|
28
|
-
applyCredentialAvailability,
|
|
29
|
-
clearCredentialAvailabilityIfMarkedAt,
|
|
30
|
-
readCredentialAvailability,
|
|
31
|
-
readEffectiveCredentialEntry
|
|
32
|
-
} from "./chunk-FIYSMXHY.js";
|
|
33
|
-
import {
|
|
34
|
-
queryUserRecords,
|
|
35
|
-
readDbRecord
|
|
36
|
-
} from "./chunk-5LQDHFBN.js";
|
|
37
|
-
import {
|
|
38
|
-
buildAgentDiscoveryResult,
|
|
39
|
-
matchesAgentQuery,
|
|
40
|
-
resolvePaginationArgs,
|
|
41
|
-
summarizeCredentialGroups,
|
|
42
|
-
toDiscoverySafeAgentSummary
|
|
43
|
-
} from "./chunk-F5AY2UZL.js";
|
|
44
|
-
import {
|
|
45
|
-
listRunRecords
|
|
46
|
-
} from "./chunk-XIEYGCN6.js";
|
|
47
|
-
import "./chunk-UN7HIYMH.js";
|
|
48
|
-
import "./chunk-AXYH4734.js";
|
|
49
|
-
import "./chunk-GBWGPTA7.js";
|
|
50
|
-
import "./chunk-UEILX4EV.js";
|
|
51
|
-
import "./chunk-BV3FLP2L.js";
|
|
52
|
-
import "./chunk-CLCXHIBS.js";
|
|
53
|
-
import "./chunk-BR3GT6MR.js";
|
|
54
|
-
import "./chunk-CVERLOJM.js";
|
|
55
|
-
import "./chunk-ZNFJWEN4.js";
|
|
56
|
-
import "./chunk-YPPKC6FL.js";
|
|
57
|
-
import "./chunk-CHOZJMJS.js";
|
|
58
|
-
import "./chunk-PWTNI4N7.js";
|
|
59
|
-
import "./chunk-AL3TYDIF.js";
|
|
60
|
-
import "./chunk-IX2BXN2K.js";
|
|
61
|
-
import "./chunk-HNUWUO75.js";
|
|
62
|
-
import "./chunk-LKA64WH4.js";
|
|
63
|
-
import "./chunk-C2B7M567.js";
|
|
64
|
-
import "./chunk-2WZXXAQD.js";
|
|
65
|
-
import "./chunk-3HTP4WZQ.js";
|
|
66
|
-
import "./chunk-ULAQPRHX.js";
|
|
67
|
-
import "./chunk-56GBUMO5.js";
|
|
68
|
-
import "./chunk-3VFYQH3I.js";
|
|
69
|
-
import "./chunk-YOT437BH.js";
|
|
70
|
-
import {
|
|
71
|
-
DEFAULT_PROVIDER_RETRY_MS,
|
|
72
|
-
formatQuotaSummary,
|
|
73
|
-
isAgentUnavailableNow,
|
|
74
|
-
resolveAgentAvailability,
|
|
75
|
-
resolveCredentialCandidateKeys,
|
|
76
|
-
resolveCredentialKeyWithFallback,
|
|
77
|
-
shouldClearCooldownFromQuota
|
|
78
|
-
} from "./chunk-HOCHUZQ7.js";
|
|
79
|
-
import "./chunk-IC2I373Q.js";
|
|
80
|
-
import "./chunk-TOKPHZ55.js";
|
|
81
|
-
import "./chunk-E2BESSAW.js";
|
|
82
|
-
import "./chunk-TLE77UJ5.js";
|
|
83
|
-
import "./chunk-X2KRQP7V.js";
|
|
84
|
-
import "./chunk-KJAAPGBE.js";
|
|
85
|
-
import "./chunk-2MBTWINN.js";
|
|
86
|
-
import "./chunk-YQETUZ5V.js";
|
|
87
|
-
import "./chunk-5ZUL4CUO.js";
|
|
88
|
-
import "./chunk-T2BEPTAG.js";
|
|
89
|
-
import "./chunk-H57T64RA.js";
|
|
90
|
-
import "./chunk-UKZX3NHN.js";
|
|
91
|
-
import "./chunk-5MMAK75Q.js";
|
|
92
|
-
import "./chunk-SSGTV4FC.js";
|
|
93
|
-
import "./chunk-KX6YBIHG.js";
|
|
94
|
-
import "./chunk-OQHIVPG4.js";
|
|
95
|
-
import "./chunk-DWLEOOGR.js";
|
|
96
|
-
import "./chunk-HVUDBOQG.js";
|
|
97
|
-
import "./chunk-EWQ3HGNZ.js";
|
|
98
|
-
import "./chunk-PSCNXBYA.js";
|
|
99
|
-
import "./chunk-OW765XBU.js";
|
|
100
|
-
import "./chunk-7DPNBQSV.js";
|
|
101
|
-
import "./chunk-62HXNQVV.js";
|
|
102
|
-
import "./chunk-VPAZ6BEN.js";
|
|
103
|
-
import "./chunk-6EDAMVG6.js";
|
|
104
|
-
import "./chunk-45LZIYXB.js";
|
|
105
|
-
import {
|
|
106
|
-
toErrorMessage
|
|
107
|
-
} from "./chunk-HNMXYYJR.js";
|
|
108
|
-
import "./chunk-KRRE4A7D.js";
|
|
109
|
-
import "./chunk-6OVNSQHN.js";
|
|
110
|
-
import "./chunk-AETZ7AD6.js";
|
|
111
|
-
import "./chunk-EVGU5P4U.js";
|
|
112
|
-
import "./chunk-ILHQ2AXT.js";
|
|
113
|
-
import "./chunk-M2EJHDJP.js";
|
|
114
|
-
import "./chunk-KYH7XW3K.js";
|
|
115
|
-
import "./chunk-JRTNUU5Z.js";
|
|
116
|
-
import "./chunk-KUG52IAP.js";
|
|
117
|
-
import "./chunk-OBSEKCVK.js";
|
|
118
|
-
import "./chunk-QSJ3HFEF.js";
|
|
119
|
-
import "./chunk-JWXITTQB.js";
|
|
120
|
-
import "./chunk-L5I543VB.js";
|
|
121
|
-
import "./chunk-KHCLMKZZ.js";
|
|
122
|
-
import {
|
|
123
|
-
parseUserIdFromAuthToken,
|
|
124
|
-
readOption,
|
|
125
|
-
resolveAuthToken,
|
|
126
|
-
resolveServerCandidates,
|
|
127
|
-
resolveServerUrl
|
|
128
|
-
} from "./chunk-WACI5I6V.js";
|
|
129
|
-
import "./chunk-OLZBQWZU.js";
|
|
130
|
-
import "./chunk-LCBAMY2M.js";
|
|
131
|
-
import "./chunk-4SN6J65J.js";
|
|
132
|
-
import "./chunk-CF7PE763.js";
|
|
133
|
-
import "./chunk-4O22PGNQ.js";
|
|
134
|
-
import {
|
|
135
|
-
t
|
|
136
|
-
} from "./chunk-OB6DVWPF.js";
|
|
137
|
-
import "./chunk-G7Y4GXTY.js";
|
|
138
|
-
import "./chunk-6UBGXX2W.js";
|
|
139
|
-
import {
|
|
140
|
-
createKey,
|
|
141
|
-
createTokenKey
|
|
142
|
-
} from "./chunk-SYTHYBMI.js";
|
|
143
|
-
import "./chunk-OJKUU3LP.js";
|
|
144
|
-
import "./chunk-YZMNK53S.js";
|
|
145
|
-
import "./chunk-I42VC5KR.js";
|
|
146
|
-
import "./chunk-3EUW3WEO.js";
|
|
147
|
-
import "./chunk-U6VC4MU4.js";
|
|
148
|
-
import "./chunk-WWC7I6TA.js";
|
|
149
|
-
import "./chunk-G3SUCT4W.js";
|
|
150
|
-
import "./chunk-U67V476Y.js";
|
|
151
|
-
|
|
152
|
-
// packages/ai/agent/speedSampleCache.ts
|
|
153
|
-
var SPEED_SAMPLE_DISK_CACHE_TTL_MS = 10 * 6e4;
|
|
154
|
-
var SPEED_SAMPLE_SCAN_BUDGET_MS = 2500;
|
|
155
|
-
var SPEED_SAMPLE_CACHE_VERSION = 4;
|
|
156
|
-
var isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
157
|
-
var sanitizeSample = (value) => {
|
|
158
|
-
if (!value || typeof value !== "object") return null;
|
|
159
|
-
const sample = value;
|
|
160
|
-
const clean = {};
|
|
161
|
-
if (isFiniteNumber(sample.firstOutputMs)) clean.firstOutputMs = sample.firstOutputMs;
|
|
162
|
-
if (isFiniteNumber(sample.callDurationMs)) clean.callDurationMs = sample.callDurationMs;
|
|
163
|
-
if (isFiniteNumber(sample.output_tokens)) clean.output_tokens = sample.output_tokens;
|
|
164
|
-
if (isFiniteNumber(sample.t)) clean.t = sample.t;
|
|
165
|
-
return clean.firstOutputMs === void 0 && clean.callDurationMs === void 0 ? null : clean;
|
|
166
|
-
};
|
|
167
|
-
var SPEED_SAMPLE_STALE_SNAPSHOT_MAX_MS = 7 * 24 * 60 * 6e4;
|
|
168
|
-
async function parseCacheFile(cachePath, userId) {
|
|
169
|
-
try {
|
|
170
|
-
const fs = await import("node:fs/promises");
|
|
171
|
-
const raw = await fs.readFile(cachePath, "utf8");
|
|
172
|
-
const parsed = JSON.parse(raw);
|
|
173
|
-
if (!parsed || typeof parsed !== "object") return null;
|
|
174
|
-
const version = parsed.version;
|
|
175
|
-
if (version !== SPEED_SAMPLE_CACHE_VERSION) {
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
if (parsed.userId !== userId) return null;
|
|
179
|
-
if (!isFiniteNumber(parsed.at)) return null;
|
|
180
|
-
const source = parsed.samples;
|
|
181
|
-
if (!source || typeof source !== "object") return null;
|
|
182
|
-
const samples = /* @__PURE__ */ new Map();
|
|
183
|
-
for (const [model, list] of Object.entries(source)) {
|
|
184
|
-
if (!model || !Array.isArray(list)) continue;
|
|
185
|
-
const cleaned = [];
|
|
186
|
-
for (const entry of list) {
|
|
187
|
-
const sample = sanitizeSample(entry);
|
|
188
|
-
if (sample) cleaned.push(sample);
|
|
189
|
-
}
|
|
190
|
-
samples.set(model, cleaned);
|
|
191
|
-
}
|
|
192
|
-
const complete = parsed.complete === true;
|
|
193
|
-
const cursor = typeof parsed.cursor === "string" && parsed.cursor.length > 0 ? parsed.cursor : void 0;
|
|
194
|
-
return { samples, at: parsed.at, complete, cursor: complete ? void 0 : cursor };
|
|
195
|
-
} catch {
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
async function readSpeedSamplesSnapshot(cachePath, options) {
|
|
200
|
-
const maxAgeMs = isFiniteNumber(options.maxAgeMs) ? options.maxAgeMs : SPEED_SAMPLE_STALE_SNAPSHOT_MAX_MS;
|
|
201
|
-
const parsed = await parseCacheFile(cachePath, options.userId);
|
|
202
|
-
if (!parsed || !parsed.complete) return null;
|
|
203
|
-
const age = options.now - parsed.at;
|
|
204
|
-
if (age < 0 || age >= maxAgeMs) return null;
|
|
205
|
-
return { samples: parsed.samples, ageMs: age };
|
|
206
|
-
}
|
|
207
|
-
async function readSpeedSamplesProgress(cachePath, userId) {
|
|
208
|
-
const parsed = await parseCacheFile(cachePath, userId);
|
|
209
|
-
if (!parsed) return null;
|
|
210
|
-
return {
|
|
211
|
-
samples: parsed.samples,
|
|
212
|
-
at: parsed.at,
|
|
213
|
-
complete: parsed.complete,
|
|
214
|
-
...parsed.cursor === void 0 ? {} : { cursor: parsed.cursor }
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
function resolveSpeedSamplesProgressPath(cachePath) {
|
|
218
|
-
return `${cachePath}.progress`;
|
|
219
|
-
}
|
|
220
|
-
async function writeSpeedSamplesCache(cachePath, payload) {
|
|
221
|
-
try {
|
|
222
|
-
const fs = await import("node:fs/promises");
|
|
223
|
-
const path = await import("node:path");
|
|
224
|
-
await fs.mkdir(path.dirname(cachePath), { recursive: true });
|
|
225
|
-
const tmpPath = `${cachePath}.tmp-${process.pid}-${Math.random().toString(36).slice(2, 8)}`;
|
|
226
|
-
await fs.writeFile(tmpPath, JSON.stringify(payload), "utf8");
|
|
227
|
-
await fs.rename(tmpPath, cachePath);
|
|
228
|
-
} catch {
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// packages/ai/agent/candidateSpeedContext.ts
|
|
233
|
-
var OBSERVED_SPEED_WINDOW = 50;
|
|
234
|
-
var MIN_OBSERVED_FIRST_OUTPUT_SAMPLES = 5;
|
|
235
|
-
var SPEED_SAMPLES_CACHE_TTL_MS = 5 * 6e4;
|
|
236
|
-
var SPEED_SAMPLES_CACHE_MAX_ENTRIES = 500;
|
|
237
|
-
function normalizeSpeedModelName(raw) {
|
|
238
|
-
const name = raw.trim().toLowerCase();
|
|
239
|
-
const slash = name.lastIndexOf("/");
|
|
240
|
-
return slash === -1 ? name : name.slice(slash + 1);
|
|
241
|
-
}
|
|
242
|
-
var isFiniteNumber2 = (value) => typeof value === "number" && Number.isFinite(value);
|
|
243
|
-
var REASONING_EFFORT_SUFFIXES = ["minimal", "low", "medium", "high", "xhigh"];
|
|
244
|
-
var REASONING_EFFORT_SUFFIX_RE = new RegExp(`-(?:${REASONING_EFFORT_SUFFIXES.join("|")})$`);
|
|
245
|
-
function stripReasoningEffortSuffix(model) {
|
|
246
|
-
const base = model.replace(REASONING_EFFORT_SUFFIX_RE, "");
|
|
247
|
-
return base && base !== model ? base : null;
|
|
248
|
-
}
|
|
249
|
-
function resolveOneBare(model, samplesByModel) {
|
|
250
|
-
const observed = resolveObservedSpeed(samplesByModel.get(model) ?? [], {
|
|
251
|
-
limit: OBSERVED_SPEED_WINDOW
|
|
252
|
-
});
|
|
253
|
-
if (observed.firstOutputSampleCount >= MIN_OBSERVED_FIRST_OUTPUT_SAMPLES && observed.medianFirstOutputMs !== void 0) {
|
|
254
|
-
return {
|
|
255
|
-
source: "observed",
|
|
256
|
-
firstOutputMs: observed.medianFirstOutputMs,
|
|
257
|
-
...observed.medianOutputTokensPerSecond !== void 0 ? { outputTps: observed.medianOutputTokensPerSecond } : {},
|
|
258
|
-
firstOutputSamples: observed.firstOutputSampleCount,
|
|
259
|
-
tpsSamples: observed.throughputSampleCount
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
function resolveOne(model, samplesByModel) {
|
|
265
|
-
const direct = resolveOneBare(model, samplesByModel);
|
|
266
|
-
if (direct) return { model, ...direct };
|
|
267
|
-
const base = stripReasoningEffortSuffix(model);
|
|
268
|
-
if (!base) return null;
|
|
269
|
-
const stripped = resolveOneBare(base, samplesByModel);
|
|
270
|
-
return stripped ? { model, ...stripped } : null;
|
|
271
|
-
}
|
|
272
|
-
function resolveCandidateSpeedFacts(models, samplesByModel) {
|
|
273
|
-
const unique = [
|
|
274
|
-
...new Set(
|
|
275
|
-
models.filter((model) => typeof model === "string").map(normalizeSpeedModelName).filter(Boolean)
|
|
276
|
-
)
|
|
277
|
-
];
|
|
278
|
-
return unique.map((model) => resolveOne(model, samplesByModel)).filter((fact) => fact !== null);
|
|
279
|
-
}
|
|
280
|
-
var formatSeconds = (ms) => `${(ms / 1e3).toFixed(1)}s`;
|
|
281
|
-
var formatTps = (tps) => String(Math.round(tps));
|
|
282
|
-
var SPEED_CONTEXT_HEADER = "speed (observed=\u672C\u7528\u6237\u5B9E\u6D4B\u8C03\u7528\u4E2D\u4F4D\u6570, firstOutput \u542B\u63A8\u7406\u8F93\u51FA; tps=generation\uFF08\u4E0D\u542B\u7AEF\u5230\u7AEF\u53E3\u5F84\uFF09, tps=n/a \u8868\u793A\u65E0\u53EF\u4FE1\u541E\u5410\u6837\u672C\u3002\u672A\u5217\u51FA\u7684 model \u8868\u793A\u6CA1\u6709\u5B9E\u6D4B\u6837\u672C\uFF0C\u4E0D\u4EE3\u8868\u6162):";
|
|
283
|
-
function formatSnapshotAge(ageMs) {
|
|
284
|
-
const minutes = Math.floor(ageMs / 6e4);
|
|
285
|
-
if (minutes < 1) return "<1min";
|
|
286
|
-
if (minutes < 60) return `${minutes}min`;
|
|
287
|
-
const hours = Math.floor(minutes / 60);
|
|
288
|
-
if (hours < 24) return `${hours}h`;
|
|
289
|
-
return `${Math.floor(hours / 24)}d`;
|
|
290
|
-
}
|
|
291
|
-
function formatCandidateSpeedFacts(facts, options = {}) {
|
|
292
|
-
if (facts.length === 0) return null;
|
|
293
|
-
const lines = facts.map((fact) => {
|
|
294
|
-
const tps = fact.outputTps !== void 0 ? formatTps(fact.outputTps) : "n/a";
|
|
295
|
-
return ` ${fact.model}: firstOutput=${formatSeconds(fact.firstOutputMs ?? 0)} tps=${tps} [observed n=${fact.firstOutputSamples ?? 0} tpsN=${fact.tpsSamples ?? 0}]`;
|
|
296
|
-
});
|
|
297
|
-
const age = options.snapshotAgeMs;
|
|
298
|
-
const note = typeof age === "number" && age > 0 ? ` (snapshot=${formatSnapshotAge(age)}\u524D\u91C7\u96C6\u7684\u5B8C\u6574\u7A97\u53E3, \u975E\u672C\u6B21\u5B9E\u65F6\u626B\u63CF)` : "";
|
|
299
|
-
return `${SPEED_CONTEXT_HEADER}${note}
|
|
300
|
-
${lines.join("\n")}`;
|
|
301
|
-
}
|
|
302
|
-
function buildCandidateSpeedContext(models, samplesByModel, options = {}) {
|
|
303
|
-
return formatCandidateSpeedFacts(resolveCandidateSpeedFacts(models, samplesByModel), options);
|
|
304
|
-
}
|
|
305
|
-
var SPEED_SAMPLE_PAGE_SIZE = 2e3;
|
|
306
|
-
var DISPATCH_ENTRY_PATH = "agent-run";
|
|
307
|
-
var eventTime = (value) => {
|
|
308
|
-
if (isFiniteNumber2(value.timestamp)) return value.timestamp;
|
|
309
|
-
if (isFiniteNumber2(value.createdAt)) return value.createdAt;
|
|
310
|
-
return 0;
|
|
311
|
-
};
|
|
312
|
-
function collectSample(collected, value) {
|
|
313
|
-
if (typeof value.model !== "string") return;
|
|
314
|
-
if (!isFiniteNumber2(value.firstOutputMs) && !isFiniteNumber2(value.callDurationMs)) return;
|
|
315
|
-
const model = normalizeSpeedModelName(value.model);
|
|
316
|
-
if (!model) return;
|
|
317
|
-
const list = collected.get(model) ?? [];
|
|
318
|
-
list.push({
|
|
319
|
-
t: eventTime(value),
|
|
320
|
-
firstOutputMs: value.firstOutputMs,
|
|
321
|
-
callDurationMs: value.callDurationMs,
|
|
322
|
-
output_tokens: value.output_tokens
|
|
323
|
-
});
|
|
324
|
-
collected.set(model, list);
|
|
325
|
-
}
|
|
326
|
-
function finalizeSamples(collected, keepTime = false) {
|
|
327
|
-
const result = /* @__PURE__ */ new Map();
|
|
328
|
-
for (const [model, list] of collected) {
|
|
329
|
-
list.sort((a, b) => b.t - a.t);
|
|
330
|
-
const window = list.slice(0, OBSERVED_SPEED_WINDOW);
|
|
331
|
-
result.set(
|
|
332
|
-
model,
|
|
333
|
-
keepTime ? window : window.map(({ t: _t, ...sample }) => sample)
|
|
334
|
-
);
|
|
335
|
-
}
|
|
336
|
-
return result;
|
|
337
|
-
}
|
|
338
|
-
async function collectRecentSpeedSamples(db, userId, options = {}) {
|
|
339
|
-
const pageSize = isFiniteNumber2(options.pageSize) && options.pageSize > 0 ? Math.floor(options.pageSize) : SPEED_SAMPLE_PAGE_SIZE;
|
|
340
|
-
const budgetMs = isFiniteNumber2(options.budgetMs) ? options.budgetMs : Number.POSITIVE_INFINITY;
|
|
341
|
-
const { start, end } = createTokenKey.rangeOfUser(userId);
|
|
342
|
-
const failedPrefix = createKey("token", userId, "failed-call", "");
|
|
343
|
-
const dispatchRunCache = /* @__PURE__ */ new Map();
|
|
344
|
-
const isDispatchSampleRecord = async (record2, resolver, cache) => {
|
|
345
|
-
if (record2.entry_path !== DISPATCH_ENTRY_PATH && record2.entry_path !== "cli-local") return false;
|
|
346
|
-
const runId = typeof record2.dialogId === "string" ? record2.dialogId.trim() : "";
|
|
347
|
-
if (!runId) return false;
|
|
348
|
-
const cacheKey = `${record2.entry_path}:${runId}`;
|
|
349
|
-
const cached = cache.get(cacheKey);
|
|
350
|
-
if (cached !== void 0) return cached;
|
|
351
|
-
let dispatch = false;
|
|
352
|
-
if (resolver) {
|
|
353
|
-
try {
|
|
354
|
-
dispatch = await resolver(runId, record2.entry_path) === true;
|
|
355
|
-
} catch {
|
|
356
|
-
dispatch = false;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
cache.set(cacheKey, dispatch);
|
|
360
|
-
return dispatch;
|
|
361
|
-
};
|
|
362
|
-
const collected = /* @__PURE__ */ new Map();
|
|
363
|
-
const startedAt = Date.now();
|
|
364
|
-
let lastKey = options.startAfter;
|
|
365
|
-
let budgetExhausted = false;
|
|
366
|
-
let scanned = 0;
|
|
367
|
-
while (true) {
|
|
368
|
-
if (Date.now() - startedAt >= budgetMs) {
|
|
369
|
-
budgetExhausted = true;
|
|
370
|
-
break;
|
|
371
|
-
}
|
|
372
|
-
const pageOptions = {
|
|
373
|
-
...lastKey === void 0 ? { gte: start } : { gt: lastKey },
|
|
374
|
-
lte: end,
|
|
375
|
-
limit: pageSize
|
|
376
|
-
};
|
|
377
|
-
let accepted = 0;
|
|
378
|
-
let newestKey = lastKey;
|
|
379
|
-
for await (const [key, raw] of db.iterator(pageOptions)) {
|
|
380
|
-
if (typeof key !== "string") continue;
|
|
381
|
-
if (lastKey !== void 0 && key <= lastKey) continue;
|
|
382
|
-
accepted += 1;
|
|
383
|
-
scanned += 1;
|
|
384
|
-
newestKey = key;
|
|
385
|
-
if (key.startsWith(failedPrefix)) continue;
|
|
386
|
-
if (!raw || typeof raw !== "object") continue;
|
|
387
|
-
const record2 = raw;
|
|
388
|
-
const resolver = options.isDispatchRun ?? db.isDispatchRun;
|
|
389
|
-
if (!await isDispatchSampleRecord(
|
|
390
|
-
record2,
|
|
391
|
-
resolver ? (runId, entryPath) => resolver.call(db, runId, entryPath) : void 0,
|
|
392
|
-
dispatchRunCache
|
|
393
|
-
))
|
|
394
|
-
continue;
|
|
395
|
-
collectSample(collected, record2);
|
|
396
|
-
}
|
|
397
|
-
if (accepted === 0 || accepted < pageSize) break;
|
|
398
|
-
lastKey = newestKey;
|
|
399
|
-
}
|
|
400
|
-
return {
|
|
401
|
-
samples: finalizeSamples(collected, options.keepTime === true),
|
|
402
|
-
budgetExhausted,
|
|
403
|
-
scanned,
|
|
404
|
-
...budgetExhausted && lastKey !== void 0 ? { nextCursor: lastKey } : {}
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
function mergeNewestSamples(into, from) {
|
|
408
|
-
for (const [model, list] of from) {
|
|
409
|
-
const merged = [...into.get(model) ?? [], ...list];
|
|
410
|
-
merged.sort(
|
|
411
|
-
(a, b) => (b.t ?? 0) - (a.t ?? 0)
|
|
412
|
-
);
|
|
413
|
-
into.set(model, merged.slice(0, OBSERVED_SPEED_WINDOW));
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
async function loadSpeedSamplesWithDiskCache(db, userId, now, cache) {
|
|
417
|
-
try {
|
|
418
|
-
const ttlMs = isFiniteNumber2(cache.ttlMs) ? cache.ttlMs : SPEED_SAMPLE_DISK_CACHE_TTL_MS;
|
|
419
|
-
const snapshot = await readSpeedSamplesSnapshot(cache.cachePath, { userId, now });
|
|
420
|
-
if (snapshot && snapshot.ageMs < ttlMs) return { samples: snapshot.samples };
|
|
421
|
-
const progressPath = resolveSpeedSamplesProgressPath(cache.cachePath);
|
|
422
|
-
const progress = await readSpeedSamplesProgress(progressPath, userId);
|
|
423
|
-
const resumable = progress && !progress.complete && progress.cursor ? progress : void 0;
|
|
424
|
-
const collected = new Map(resumable?.samples ?? []);
|
|
425
|
-
let step;
|
|
426
|
-
try {
|
|
427
|
-
step = await collectRecentSpeedSamples(db, userId, {
|
|
428
|
-
pageSize: cache.pageSize,
|
|
429
|
-
budgetMs: isFiniteNumber2(cache.budgetMs) ? cache.budgetMs : SPEED_SAMPLE_SCAN_BUDGET_MS,
|
|
430
|
-
keepTime: true,
|
|
431
|
-
...resumable?.cursor ? { startAfter: resumable.cursor } : {}
|
|
432
|
-
});
|
|
433
|
-
} catch {
|
|
434
|
-
return snapshot ? { samples: snapshot.samples, snapshotAgeMs: snapshot.ageMs } : { samples: /* @__PURE__ */ new Map() };
|
|
435
|
-
}
|
|
436
|
-
if (!resumable && step.scanned === 0 && !step.budgetExhausted) {
|
|
437
|
-
return snapshot ? { samples: snapshot.samples, snapshotAgeMs: snapshot.ageMs } : { samples: /* @__PURE__ */ new Map() };
|
|
438
|
-
}
|
|
439
|
-
mergeNewestSamples(collected, step.samples);
|
|
440
|
-
if (!step.budgetExhausted) {
|
|
441
|
-
await writeSpeedSamplesCache(cache.cachePath, {
|
|
442
|
-
version: SPEED_SAMPLE_CACHE_VERSION,
|
|
443
|
-
userId,
|
|
444
|
-
at: now,
|
|
445
|
-
complete: true,
|
|
446
|
-
samples: Object.fromEntries(collected)
|
|
447
|
-
});
|
|
448
|
-
await writeSpeedSamplesCache(progressPath, {
|
|
449
|
-
version: SPEED_SAMPLE_CACHE_VERSION,
|
|
450
|
-
userId,
|
|
451
|
-
at: now,
|
|
452
|
-
complete: true,
|
|
453
|
-
samples: {}
|
|
454
|
-
});
|
|
455
|
-
return { samples: collected };
|
|
456
|
-
}
|
|
457
|
-
await writeSpeedSamplesCache(progressPath, {
|
|
458
|
-
version: SPEED_SAMPLE_CACHE_VERSION,
|
|
459
|
-
userId,
|
|
460
|
-
// Progress keeps the cycle's collection start so a later stale label stays honest.
|
|
461
|
-
at: resumable?.at ?? now,
|
|
462
|
-
complete: false,
|
|
463
|
-
samples: Object.fromEntries(collected),
|
|
464
|
-
...step.nextCursor ? { cursor: step.nextCursor } : {}
|
|
465
|
-
});
|
|
466
|
-
return snapshot ? { samples: snapshot.samples, snapshotAgeMs: snapshot.ageMs } : { samples: /* @__PURE__ */ new Map() };
|
|
467
|
-
} catch {
|
|
468
|
-
return { samples: /* @__PURE__ */ new Map() };
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
var samplesCache = /* @__PURE__ */ new Map();
|
|
472
|
-
function writeSamplesCache(userId, now, samples) {
|
|
473
|
-
for (const [key, entry] of samplesCache) {
|
|
474
|
-
if (now - entry.at >= SPEED_SAMPLES_CACHE_TTL_MS) samplesCache.delete(key);
|
|
475
|
-
}
|
|
476
|
-
samplesCache.delete(userId);
|
|
477
|
-
samplesCache.set(userId, { at: now, samples });
|
|
478
|
-
while (samplesCache.size > SPEED_SAMPLES_CACHE_MAX_ENTRIES) {
|
|
479
|
-
const oldest = samplesCache.keys().next().value;
|
|
480
|
-
if (oldest === void 0) break;
|
|
481
|
-
samplesCache.delete(oldest);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
var SPEED_SAMPLE_REFRESH_BUDGET_MS = 6e4;
|
|
485
|
-
var snapshotRefreshes = /* @__PURE__ */ new Map();
|
|
486
|
-
function startSpeedSnapshotRefresh(db, userId, now = Date.now()) {
|
|
487
|
-
const inFlight = snapshotRefreshes.get(userId);
|
|
488
|
-
if (inFlight) return inFlight;
|
|
489
|
-
const job = (async () => {
|
|
490
|
-
try {
|
|
491
|
-
const { samples, budgetExhausted } = await collectRecentSpeedSamples(db, userId, {
|
|
492
|
-
budgetMs: SPEED_SAMPLE_REFRESH_BUDGET_MS
|
|
493
|
-
});
|
|
494
|
-
if (!budgetExhausted) writeSamplesCache(userId, now, samples);
|
|
495
|
-
} catch {
|
|
496
|
-
}
|
|
497
|
-
})().finally(() => {
|
|
498
|
-
snapshotRefreshes.delete(userId);
|
|
499
|
-
});
|
|
500
|
-
snapshotRefreshes.set(userId, job);
|
|
501
|
-
return job;
|
|
502
|
-
}
|
|
503
|
-
async function loadCachedSpeedSamples(db, userId, now) {
|
|
504
|
-
const hit = samplesCache.get(userId);
|
|
505
|
-
if (hit) {
|
|
506
|
-
const age = now - hit.at;
|
|
507
|
-
if (age >= 0 && age < SPEED_SAMPLE_STALE_SNAPSHOT_MAX_MS) {
|
|
508
|
-
if (age >= SPEED_SAMPLES_CACHE_TTL_MS) void startSpeedSnapshotRefresh(db, userId);
|
|
509
|
-
return age >= SPEED_SAMPLES_CACHE_TTL_MS ? { samples: hit.samples, snapshotAgeMs: age } : { samples: hit.samples };
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
void startSpeedSnapshotRefresh(db, userId);
|
|
513
|
-
return { samples: /* @__PURE__ */ new Map() };
|
|
514
|
-
}
|
|
515
|
-
async function injectSpeedContextIntoListAgentsResult(result, options = {}) {
|
|
516
|
-
try {
|
|
517
|
-
let parsed;
|
|
518
|
-
try {
|
|
519
|
-
parsed = JSON.parse(result);
|
|
520
|
-
} catch {
|
|
521
|
-
return result;
|
|
522
|
-
}
|
|
523
|
-
if (!parsed || typeof parsed !== "object" || !Array.isArray(parsed.agents)) return result;
|
|
524
|
-
const models = parsed.agents.map((agent) => agent?.model).filter((model) => typeof model === "string");
|
|
525
|
-
if (models.length === 0) return result;
|
|
526
|
-
const now = options.now ?? Date.now();
|
|
527
|
-
let samples = /* @__PURE__ */ new Map();
|
|
528
|
-
let snapshotAgeMs;
|
|
529
|
-
const userId = typeof options.userId === "string" ? options.userId.trim() : "";
|
|
530
|
-
if (options.db && userId) {
|
|
531
|
-
try {
|
|
532
|
-
const loaded = options.diskCache ? await loadSpeedSamplesWithDiskCache(options.db, userId, now, options.diskCache) : await loadCachedSpeedSamples(options.db, userId, now);
|
|
533
|
-
samples = loaded.samples;
|
|
534
|
-
snapshotAgeMs = loaded.snapshotAgeMs;
|
|
535
|
-
} catch {
|
|
536
|
-
samples = /* @__PURE__ */ new Map();
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
const speedContext = buildCandidateSpeedContext(models, samples, { snapshotAgeMs });
|
|
540
|
-
return speedContext ? JSON.stringify({ ...parsed, speedContext }) : result;
|
|
541
|
-
} catch {
|
|
542
|
-
return result;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
// packages/ai/agent/dispatchSpeedProvenance.ts
|
|
547
|
-
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
548
|
-
function isServerDispatchSpeedSource(value, dialogId, userId) {
|
|
549
|
-
const dialog = record(value);
|
|
550
|
-
const proof = record(dialog.dispatchSpeedProvenance);
|
|
551
|
-
return proof.version === 1 && proof.source === "server-startAgentRun" && proof.userId === userId && record(dialog.runtimeBinding).tenantUserId === userId && dialog.id === dialogId;
|
|
552
|
-
}
|
|
553
|
-
function isLocalDispatchSpeedSource(value, dialogId, userId) {
|
|
554
|
-
const run = record(value);
|
|
555
|
-
const proof = record(run.dispatchSpeedProvenance);
|
|
556
|
-
return proof.version === 1 && proof.source === "cli-startAgentRun" && proof.userId === userId && typeof run.runId === "string" && run.runId.length > 0 && run.dialogId === dialogId && run.ephemeral !== true;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
// packages/cli/agentListCommands.ts
|
|
560
|
-
var createCliDispatchSampleDb = (db, userId, env) => {
|
|
561
|
-
let localDialogs;
|
|
562
|
-
return {
|
|
563
|
-
iterator: (options) => db.iterator(options),
|
|
564
|
-
isDispatchRun: async (dialogId, entryPath) => {
|
|
565
|
-
if (entryPath === "cli-local") {
|
|
566
|
-
localDialogs ??= new Set(listRunRecords({ env }).filter(
|
|
567
|
-
(run) => typeof run.dialogId === "string" && isLocalDispatchSpeedSource(run, run.dialogId, userId)
|
|
568
|
-
).map((run) => run.dialogId));
|
|
569
|
-
return localDialogs.has(dialogId);
|
|
570
|
-
}
|
|
571
|
-
if (entryPath !== "agent-run") return false;
|
|
572
|
-
try {
|
|
573
|
-
return isServerDispatchSpeedSource(await db.get(`dialog-${userId}-${dialogId}`), dialogId, userId);
|
|
574
|
-
} catch {
|
|
575
|
-
return false;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
};
|
|
580
|
-
function formatCooldownUntilLocal(at, now = /* @__PURE__ */ new Date()) {
|
|
581
|
-
const pad = (value) => String(value).padStart(2, "0");
|
|
582
|
-
const time = `${pad(at.getHours())}:${pad(at.getMinutes())}`;
|
|
583
|
-
const sameDay = at.getFullYear() === now.getFullYear() && at.getMonth() === now.getMonth() && at.getDate() === now.getDate();
|
|
584
|
-
return sameDay ? time : `${pad(at.getMonth() + 1)}-${pad(at.getDate())} ${time}`;
|
|
585
|
-
}
|
|
586
|
-
async function runAgentListCommand(args, deps = {}) {
|
|
587
|
-
const env = deps.env ?? process.env;
|
|
588
|
-
let planningCaller;
|
|
589
|
-
try {
|
|
590
|
-
const raw = JSON.parse(env.NOLO_PLANNING_CALLER ?? "null");
|
|
591
|
-
if (raw && typeof raw === "object") planningCaller = {
|
|
592
|
-
agentKey: typeof raw.agentKey === "string" ? raw.agentKey : void 0,
|
|
593
|
-
effectiveModel: typeof raw.effectiveModel === "string" ? raw.effectiveModel : void 0,
|
|
594
|
-
runKind: raw.runKind === "subtask" ? "subtask" : "interactive"
|
|
595
|
-
};
|
|
596
|
-
} catch {
|
|
597
|
-
}
|
|
598
|
-
const output = deps.output ?? process.stdout;
|
|
599
|
-
const { wantJson, wantSafe, publicOnly, scope: requestedScope, idsOnly, showUnavailable, verbose, compact, limit, offset, query } = parseAgentListArgs(args);
|
|
600
|
-
if (requestedScope && !["preferred", "public", "all"].includes(requestedScope)) {
|
|
601
|
-
throw new Error(`Invalid scope '${requestedScope}'`);
|
|
602
|
-
}
|
|
603
|
-
if (requestedScope && publicOnly && requestedScope !== "public") {
|
|
604
|
-
throw new Error(`Conflicting arguments: scope='${requestedScope}' conflicts with publicOnly=true.`);
|
|
605
|
-
}
|
|
606
|
-
const scope = requestedScope ?? "all";
|
|
607
|
-
const spaceInput = readOption(args, "--space") ?? readOption(args, "--space-id");
|
|
608
|
-
const authToken = resolveAuthToken(args, env);
|
|
609
|
-
if (!authToken) {
|
|
610
|
-
output.write("[nolo] agent list requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
|
|
611
|
-
return 1;
|
|
612
|
-
}
|
|
613
|
-
const userId = parseUserIdFromAuthToken(authToken);
|
|
614
|
-
if (!userId) {
|
|
615
|
-
output.write("[nolo] agent list could not read userId from AUTH_TOKEN.\n");
|
|
616
|
-
return 1;
|
|
617
|
-
}
|
|
618
|
-
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
619
|
-
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
620
|
-
const serverUrl = resolveServerUrl(args, env);
|
|
621
|
-
const serverUrls = resolveServerCandidates(args, env, serverUrl);
|
|
622
|
-
try {
|
|
623
|
-
let agents;
|
|
624
|
-
let source;
|
|
625
|
-
let serverFailures = [];
|
|
626
|
-
try {
|
|
627
|
-
const remoteResult = await listRemoteAgentsAcrossServers({
|
|
628
|
-
authToken,
|
|
629
|
-
fallbackFetchImpl,
|
|
630
|
-
fetchImpl,
|
|
631
|
-
serverUrls,
|
|
632
|
-
userId
|
|
633
|
-
});
|
|
634
|
-
agents = remoteResult.agents;
|
|
635
|
-
serverFailures = remoteResult.failures;
|
|
636
|
-
source = "global-cache";
|
|
637
|
-
} catch {
|
|
638
|
-
try {
|
|
639
|
-
const db = deps.db ?? await getReadableCliDb(output);
|
|
640
|
-
agents = await listLocalCachedAgents({ db, userId });
|
|
641
|
-
source = "local-cache";
|
|
642
|
-
} catch {
|
|
643
|
-
agents = await listRemoteAgents({
|
|
644
|
-
authToken,
|
|
645
|
-
fallbackFetchImpl,
|
|
646
|
-
fetchImpl,
|
|
647
|
-
serverUrl,
|
|
648
|
-
userId,
|
|
649
|
-
queryUserRecords,
|
|
650
|
-
readDbRecord
|
|
651
|
-
});
|
|
652
|
-
source = "remote-cache";
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
const pagination = resolvePaginationArgs({ limit, offset });
|
|
656
|
-
const hasQuery = Boolean(query && typeof query === "string" && query.trim());
|
|
657
|
-
const MAX_UPSTREAM_CEILING = 2e3;
|
|
658
|
-
const upstreamLimit = Math.min(
|
|
659
|
-
MAX_UPSTREAM_CEILING,
|
|
660
|
-
hasQuery ? MAX_UPSTREAM_CEILING : Math.max(500, (pagination.offset ?? 0) + (pagination.limit ?? 100))
|
|
661
|
-
);
|
|
662
|
-
let cliUpstreamTruncated = false;
|
|
663
|
-
let cliUpstreamTotal;
|
|
664
|
-
if (scope !== "preferred") {
|
|
665
|
-
const publicResults = await Promise.all(serverUrls.map((url) => listRemotePublicAgents({
|
|
666
|
-
authToken,
|
|
667
|
-
fetchImpl,
|
|
668
|
-
serverUrl: url,
|
|
669
|
-
limit: upstreamLimit,
|
|
670
|
-
query: hasQuery ? query : void 0
|
|
671
|
-
})));
|
|
672
|
-
const publicAgents = publicResults.flatMap((r) => r.agents);
|
|
673
|
-
for (const r of publicResults) {
|
|
674
|
-
if (r.truncated) cliUpstreamTruncated = true;
|
|
675
|
-
if (typeof r.total === "number") {
|
|
676
|
-
cliUpstreamTotal = Math.max(cliUpstreamTotal ?? 0, r.total);
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
if (scope === "all") {
|
|
680
|
-
const seenPublicKeys = /* @__PURE__ */ new Set();
|
|
681
|
-
for (const agent of agents) {
|
|
682
|
-
if (agent.publicKey) seenPublicKeys.add(agent.publicKey);
|
|
683
|
-
}
|
|
684
|
-
agents = [
|
|
685
|
-
...agents,
|
|
686
|
-
...publicAgents.filter((agent) => {
|
|
687
|
-
if (!agent.publicKey) return true;
|
|
688
|
-
if (seenPublicKeys.has(agent.publicKey)) return false;
|
|
689
|
-
seenPublicKeys.add(agent.publicKey);
|
|
690
|
-
return true;
|
|
691
|
-
})
|
|
692
|
-
];
|
|
693
|
-
} else {
|
|
694
|
-
agents = publicAgents;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
agents = agents.filter((agent) => agent.privateKey.startsWith("agent-"));
|
|
698
|
-
let resolvedSpaceId = null;
|
|
699
|
-
let spaceContentKeys = null;
|
|
700
|
-
if (spaceInput) {
|
|
701
|
-
const { spaceId, spaceKey } = buildSpaceLookup(spaceInput);
|
|
702
|
-
resolvedSpaceId = spaceId;
|
|
703
|
-
const spaceRead = await readLiveDbRecordAfterTombstoneMerge({
|
|
704
|
-
authToken,
|
|
705
|
-
dbKey: spaceKey,
|
|
706
|
-
fallbackFetchImpl,
|
|
707
|
-
fetchImpl,
|
|
708
|
-
serverUrls
|
|
709
|
-
});
|
|
710
|
-
serverFailures = [...serverFailures, ...spaceRead.failures];
|
|
711
|
-
const spaceRecord = spaceRead.record;
|
|
712
|
-
const currentSpaceContentKeys = getSpaceContentKeys(spaceRecord);
|
|
713
|
-
spaceContentKeys = currentSpaceContentKeys;
|
|
714
|
-
agents = agents.filter(
|
|
715
|
-
(agent) => currentSpaceContentKeys.has(agent.privateKey) || currentSpaceContentKeys.has(agent.publicKey) || currentSpaceContentKeys.has(agent.id)
|
|
716
|
-
);
|
|
717
|
-
}
|
|
718
|
-
if (source === "global-cache") {
|
|
719
|
-
await decorateAgentsWithPublicStatusAcrossServers({
|
|
720
|
-
agents,
|
|
721
|
-
authToken,
|
|
722
|
-
fallbackFetchImpl,
|
|
723
|
-
fetchImpl,
|
|
724
|
-
serverUrls
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
if (publicOnly) {
|
|
728
|
-
agents = agents.filter((agent) => agent.publicRecordExists);
|
|
729
|
-
}
|
|
730
|
-
const originalAgentDeadlines = new Map(agents.map((agent) => [agent.privateKey, agent.nextAvailableAt]));
|
|
731
|
-
agents = applyCredentialAvailability(
|
|
732
|
-
agents,
|
|
733
|
-
await readCredentialAvailability(env).catch(() => ({}))
|
|
734
|
-
);
|
|
735
|
-
let unavailableCount = agents.filter((agent) => isAgentUnavailableNow(agent)).length;
|
|
736
|
-
let agentsForOutput = agents;
|
|
737
|
-
if (query && typeof query === "string" && query.trim()) {
|
|
738
|
-
agentsForOutput = agentsForOutput.filter((agent) => matchesAgentQuery(agent, query));
|
|
739
|
-
}
|
|
740
|
-
const refreshCandidates = !idsOnly ? [.../* @__PURE__ */ new Set([...agentsForOutput, ...agents.filter(
|
|
741
|
-
(agent) => !agentsForOutput.includes(agent) && isAgentUnavailableNow(agent) && agent.credentialConfigured === true && (!query || !String(query).trim() || matchesAgentQuery(agent, query))
|
|
742
|
-
)])] : agentsForOutput;
|
|
743
|
-
if (!idsOnly) {
|
|
744
|
-
const fresh = await refreshSubscriptionQuotas({
|
|
745
|
-
entries: refreshCandidates.map((agent) => ({
|
|
746
|
-
key: agent.privateKey,
|
|
747
|
-
...agent.quota ? { quota: agent.quota } : {},
|
|
748
|
-
probeable: agent.credentialConfigured === true
|
|
749
|
-
})),
|
|
750
|
-
env,
|
|
751
|
-
cliArgs: args,
|
|
752
|
-
fetchImpl
|
|
753
|
-
});
|
|
754
|
-
const now = Date.now();
|
|
755
|
-
for (const agent of refreshCandidates) {
|
|
756
|
-
const quota = fresh[agent.privateKey];
|
|
757
|
-
if (!quota) continue;
|
|
758
|
-
agent.quota = quota;
|
|
759
|
-
try {
|
|
760
|
-
const key = resolveCredentialKeyWithFallback(agent);
|
|
761
|
-
if (!key) continue;
|
|
762
|
-
const entry = await readEffectiveCredentialEntry(key, env);
|
|
763
|
-
if (entry && shouldClearCooldownFromQuota(entry, quota, now, { model: agent.model })) {
|
|
764
|
-
const candidatesToClear = entry.candidates && entry.candidates.length > 0 ? entry.candidates : resolveCredentialCandidateKeys(key).map((candKey) => ({
|
|
765
|
-
key: candKey,
|
|
766
|
-
markedAt: entry.markedAt
|
|
767
|
-
}));
|
|
768
|
-
for (const cand of candidatesToClear) {
|
|
769
|
-
if (typeof cand.markedAt === "number") {
|
|
770
|
-
await clearCredentialAvailabilityIfMarkedAt(cand.key, cand.markedAt, env);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
const remainingAvailability = await readCredentialAvailability(env).catch(() => ({}));
|
|
774
|
-
for (const sibling of agents) {
|
|
775
|
-
if (resolveCredentialKeyWithFallback(sibling) !== key) continue;
|
|
776
|
-
const originalDeadline = originalAgentDeadlines.get(sibling.privateKey);
|
|
777
|
-
if (typeof originalDeadline === "number") sibling.nextAvailableAt = originalDeadline;
|
|
778
|
-
else delete sibling.nextAvailableAt;
|
|
779
|
-
Object.assign(sibling, applyCredentialAvailability([sibling], remainingAvailability)[0]);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
} catch {
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
for (const agent of agents) {
|
|
786
|
-
const decision = resolveAgentAvailability(agent, now);
|
|
787
|
-
if (decision.status === "quota_exhausted") {
|
|
788
|
-
const resetAt = decision.resetAt ?? now + DEFAULT_PROVIDER_RETRY_MS;
|
|
789
|
-
if (typeof agent.nextAvailableAt !== "number" || agent.nextAvailableAt < resetAt) {
|
|
790
|
-
agent.nextAvailableAt = resetAt;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
unavailableCount = agents.filter((agent) => isAgentUnavailableNow(agent)).length;
|
|
795
|
-
}
|
|
796
|
-
const totalCount = agentsForOutput.length;
|
|
797
|
-
const pagedAgents = typeof pagination.limit === "number" || typeof pagination.offset === "number" ? agentsForOutput.slice(
|
|
798
|
-
pagination.offset ?? 0,
|
|
799
|
-
(pagination.offset ?? 0) + (pagination.limit ?? agentsForOutput.length)
|
|
800
|
-
) : agentsForOutput;
|
|
801
|
-
if (idsOnly) {
|
|
802
|
-
output.write(`${pagedAgents.map((agent) => agent.id).join("\n")}
|
|
803
|
-
`);
|
|
804
|
-
return 0;
|
|
805
|
-
}
|
|
806
|
-
if (wantSafe) {
|
|
807
|
-
const favoritesMap = await listFavoriteAgentIdsAcrossServers({
|
|
808
|
-
authToken,
|
|
809
|
-
fetchImpl,
|
|
810
|
-
serverUrls
|
|
811
|
-
}).catch(() => ({}));
|
|
812
|
-
const existingKeys = /* @__PURE__ */ new Set();
|
|
813
|
-
for (const agent of agents) {
|
|
814
|
-
existingKeys.add(agent.privateKey);
|
|
815
|
-
existingKeys.add(agent.publicKey);
|
|
816
|
-
existingKeys.add(agent.id);
|
|
817
|
-
}
|
|
818
|
-
const extraFavoriteRecords = [];
|
|
819
|
-
const hydratedFavoriteAgents = [];
|
|
820
|
-
for (const favKey of Object.keys(favoritesMap)) {
|
|
821
|
-
if (existingKeys.has(favKey)) continue;
|
|
822
|
-
try {
|
|
823
|
-
const favRead = await readLiveDbRecordAfterTombstoneMerge({
|
|
824
|
-
authToken,
|
|
825
|
-
dbKey: favKey,
|
|
826
|
-
fallbackFetchImpl,
|
|
827
|
-
fetchImpl,
|
|
828
|
-
serverUrls
|
|
829
|
-
});
|
|
830
|
-
const record2 = favRead.record;
|
|
831
|
-
if (!record2 || record2.type && record2.type !== "agent") continue;
|
|
832
|
-
const norm = normalizeListedAgent(record2);
|
|
833
|
-
const candidateKeys = [record2.dbKey, record2.publicKey, record2.id].filter((key) => typeof key === "string" && key.length > 0);
|
|
834
|
-
if (spaceContentKeys && !candidateKeys.some((key) => spaceContentKeys?.has(key))) {
|
|
835
|
-
continue;
|
|
836
|
-
}
|
|
837
|
-
if (norm) {
|
|
838
|
-
if (!favKey.startsWith("agent-pub-")) {
|
|
839
|
-
norm.verifiedAgentKey = favKey;
|
|
840
|
-
if (typeof record2.userId === "string" && record2.userId) {
|
|
841
|
-
norm.ownerId = record2.userId;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
agents.push(norm);
|
|
845
|
-
hydratedFavoriteAgents.push(norm);
|
|
846
|
-
existingKeys.add(norm.privateKey);
|
|
847
|
-
existingKeys.add(norm.publicKey);
|
|
848
|
-
existingKeys.add(norm.id);
|
|
849
|
-
} else {
|
|
850
|
-
extraFavoriteRecords.push(record2);
|
|
851
|
-
for (const key of candidateKeys) existingKeys.add(key);
|
|
852
|
-
}
|
|
853
|
-
} catch {
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
if (source === "global-cache" && hydratedFavoriteAgents.length > 0) {
|
|
857
|
-
await decorateAgentsWithPublicStatusAcrossServers({
|
|
858
|
-
agents: hydratedFavoriteAgents,
|
|
859
|
-
authToken,
|
|
860
|
-
fallbackFetchImpl,
|
|
861
|
-
fetchImpl,
|
|
862
|
-
serverUrls
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
const safeRecords = [...agents, ...extraFavoriteRecords].map((record2) => toDiscoverySafeAgentSummary(record2, { favoritesMap, userId })).filter((agent) => publicOnly ? agent.isPublic === true : true);
|
|
866
|
-
const discovery = buildAgentDiscoveryResult({
|
|
867
|
-
agents: safeRecords,
|
|
868
|
-
caller: planningCaller,
|
|
869
|
-
poolRestricted: Boolean(resolvedSpaceId) || serverFailures.length > 0 || source !== "global-cache",
|
|
870
|
-
scope: requestedScope ?? (publicOnly ? "public" : "all"),
|
|
871
|
-
query,
|
|
872
|
-
showUnavailable,
|
|
873
|
-
verbose,
|
|
874
|
-
compact,
|
|
875
|
-
limit,
|
|
876
|
-
offset,
|
|
877
|
-
upstreamTruncated: cliUpstreamTruncated,
|
|
878
|
-
upstreamTotal: cliUpstreamTotal
|
|
879
|
-
});
|
|
880
|
-
const listResult = JSON.stringify({
|
|
881
|
-
success: true,
|
|
882
|
-
userId,
|
|
883
|
-
...resolvedSpaceId ? { spaceId: resolvedSpaceId } : {},
|
|
884
|
-
planningRecommendation: discovery.planningRecommendation,
|
|
885
|
-
total: discovery.total,
|
|
886
|
-
...typeof discovery.offset === "number" ? { offset: discovery.offset } : {},
|
|
887
|
-
...typeof discovery.limit === "number" ? { limit: discovery.limit } : {},
|
|
888
|
-
...discovery.truncated ? { truncated: true } : {},
|
|
889
|
-
unavailableCount: discovery.unavailableCount,
|
|
890
|
-
// agents 在最前:host 截断长输出时保头保尾,派发所需的 agentKey
|
|
891
|
-
// 必须落在头部;凭证分组是说明性大块,放最后。
|
|
892
|
-
// 限流 agent 已合入 agents(带 availabilityStatus / nextAvailableAt
|
|
893
|
-
// 参考标注),不再单列 unavailableAgents,避免两套真相。
|
|
894
|
-
agents: discovery.agents,
|
|
895
|
-
credentialGroups: discovery.credentialGroups
|
|
896
|
-
}, null, 2);
|
|
897
|
-
const cliNoloHome = env.NOLO_HOME?.trim() || (env.HOME?.trim() ? `${env.HOME.trim()}/.nolo` : "");
|
|
898
|
-
const speedAwareListResult = await injectSpeedContextIntoListAgentsResult(listResult, {
|
|
899
|
-
db: createCliDispatchSampleDb(deps.db ?? await getReadableCliDb(output), userId, env),
|
|
900
|
-
userId,
|
|
901
|
-
...cliNoloHome ? { diskCache: { cachePath: `${cliNoloHome}/cache/speed-samples-${userId}.json` } } : {}
|
|
902
|
-
});
|
|
903
|
-
output.write(speedAwareListResult);
|
|
904
|
-
output.write("\n");
|
|
905
|
-
return 0;
|
|
906
|
-
}
|
|
907
|
-
if (wantJson) {
|
|
908
|
-
const credentialGroups = summarizeCredentialGroups(pagedAgents);
|
|
909
|
-
output.write(JSON.stringify({
|
|
910
|
-
userId,
|
|
911
|
-
...resolvedSpaceId ? { spaceId: resolvedSpaceId } : {},
|
|
912
|
-
targetServers: serverUrls,
|
|
913
|
-
...serverFailures.length ? { serverFailures } : {},
|
|
914
|
-
total: totalCount,
|
|
915
|
-
...typeof pagination.offset === "number" ? { offset: pagination.offset } : {},
|
|
916
|
-
...typeof pagination.limit === "number" ? { limit: pagination.limit } : {},
|
|
917
|
-
publicCount: agentsForOutput.filter((agent) => agent.publicRecordExists).length,
|
|
918
|
-
unavailableCount,
|
|
919
|
-
agents: pagedAgents,
|
|
920
|
-
source,
|
|
921
|
-
credentialGroups
|
|
922
|
-
}, null, 2));
|
|
923
|
-
output.write("\n");
|
|
924
|
-
return 0;
|
|
925
|
-
}
|
|
926
|
-
output.write(`userId: ${userId}
|
|
927
|
-
`);
|
|
928
|
-
if (resolvedSpaceId) {
|
|
929
|
-
output.write(`spaceId: ${resolvedSpaceId}
|
|
930
|
-
`);
|
|
931
|
-
}
|
|
932
|
-
output.write(`targetServers: ${serverUrls.join(", ")}
|
|
933
|
-
`);
|
|
934
|
-
if (serverFailures.length) {
|
|
935
|
-
output.write(`serverFailures: ${serverFailures.length}
|
|
936
|
-
`);
|
|
937
|
-
}
|
|
938
|
-
output.write(`total agents: ${totalCount}
|
|
939
|
-
`);
|
|
940
|
-
output.write(`public agents: ${agentsForOutput.filter((agent) => agent.publicRecordExists).length}
|
|
941
|
-
`);
|
|
942
|
-
if (unavailableCount > 0) {
|
|
943
|
-
output.write(t("agent.rateLimitedSummary", String(unavailableCount)));
|
|
944
|
-
}
|
|
945
|
-
output.write(`source: ${source}
|
|
946
|
-
`);
|
|
947
|
-
if (pagedAgents.length === 0) {
|
|
948
|
-
output.write("\n(no agents found)\n");
|
|
949
|
-
return 0;
|
|
950
|
-
}
|
|
951
|
-
for (const agent of pagedAgents) {
|
|
952
|
-
const status = agent.publicRecordExists ? "public" : "private";
|
|
953
|
-
const flagMismatch = agent.isPublicFlag !== agent.publicRecordExists ? ` flag=${agent.isPublicFlag}` : "";
|
|
954
|
-
const credentialLine = agent.credentialConfigured ? `credentialConfigured=true${agent.credentialRef ? ` credentialRef=${agent.credentialRef}` : ""}${agent.apiKeyRef ? ` apiKeyRef=${agent.apiKeyRef}` : ""}` : "credentialConfigured=false";
|
|
955
|
-
const availDecision = resolveAgentAvailability(agent);
|
|
956
|
-
const availabilityStatusLine = `availability=${availDecision.status} (${availDecision.reason})`;
|
|
957
|
-
const availabilityLine = typeof agent.nextAvailableAt === "number" && agent.nextAvailableAt > Date.now() ? `nextAvailableAt=${new Date(agent.nextAvailableAt).toISOString()} (reference info, not a dispatch gate)` : "nextAvailableAt=now";
|
|
958
|
-
const quotaSummary = formatQuotaSummary(agent.quota, Date.now(), { model: agent.model });
|
|
959
|
-
const quotaLine = `quota=${quotaSummary ?? "-"}`;
|
|
960
|
-
if (isAgentUnavailableNow(agent)) {
|
|
961
|
-
const recoveryAt = agent.nextAvailableAt;
|
|
962
|
-
output.write(t(
|
|
963
|
-
"agent.rateLimitedRecovery",
|
|
964
|
-
agent.name,
|
|
965
|
-
agent.id,
|
|
966
|
-
String(typeof recoveryAt === "number" ? Math.max(0, Math.ceil((recoveryAt - Date.now()) / 1e3)) : 0),
|
|
967
|
-
quotaSummary ? ` quota=${quotaSummary}` : "",
|
|
968
|
-
typeof recoveryAt === "number" ? formatCooldownUntilLocal(new Date(recoveryAt)) : "-"
|
|
969
|
-
));
|
|
970
|
-
}
|
|
971
|
-
output.write(
|
|
972
|
-
[
|
|
973
|
-
`
|
|
974
|
-
[${status}] ${agent.name}`,
|
|
975
|
-
`id=${agent.id}`,
|
|
976
|
-
`type=${agent.type ?? "-"}`,
|
|
977
|
-
`model=${agent.model}`,
|
|
978
|
-
`updatedAt=${agent.updatedAt ?? "-"}`,
|
|
979
|
-
// 不输出 privateKey(dbKey 属敏感标识,与 web 端 listAgentsFunc 降权
|
|
980
|
-
// 对齐;需要完整记录请用 --json)。
|
|
981
|
-
// 私有 agent(publicRecordExists=false)的公开记录不存在,输出 "-" 而非
|
|
982
|
-
// 一个库里不存在的 agent-pub-<id>,避免误导调用方拿它去 readAgent。
|
|
983
|
-
`publicKey=${agent.publicRecordExists ? agent.publicKey : "-"}${flagMismatch}`,
|
|
984
|
-
`tools=${agent.tools.join(", ") || "-"}`,
|
|
985
|
-
credentialLine,
|
|
986
|
-
availabilityStatusLine,
|
|
987
|
-
availabilityLine,
|
|
988
|
-
quotaLine
|
|
989
|
-
].join("\n")
|
|
990
|
-
);
|
|
991
|
-
output.write("\n");
|
|
992
|
-
}
|
|
993
|
-
return 0;
|
|
994
|
-
} catch (error) {
|
|
995
|
-
output.write(
|
|
996
|
-
`[nolo] agent list failed: ${toErrorMessage(error)}
|
|
997
|
-
`
|
|
998
|
-
);
|
|
999
|
-
return 1;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
export {
|
|
1003
|
-
runAgentListCommand
|
|
1004
|
-
};
|