nolo-cli 0.227.0-alpha.1 → 0.228.0-alpha.2

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.
Files changed (199) hide show
  1. package/{_executeModel-JKQGZ3HU.js → _executeModel-VYCHHZVT.js} +78 -77
  2. package/{action-CK64LS6S.js → action-GDZDXPMB.js} +9 -9
  3. package/{addContentAction-CARFID6E.js → addContentAction-7RO4AMRI.js} +14 -14
  4. package/{addDialogAgentAction-APLZLFW5.js → addDialogAgentAction-EVYBGTXB.js} +16 -16
  5. package/{agentDeleteCommand-NVR2V2HH.js → agentDeleteCommand-QWQKT54A.js} +116 -115
  6. package/{agentEmailCommands-UCVOWD3S.js → agentEmailCommands-EISMBIRE.js} +119 -118
  7. package/{agentFavoriteCommands-4PDOP3GW.js → agentFavoriteCommands-7LOP3HUD.js} +6 -6
  8. package/{agentGrantCommands-FLCEXLUH.js → agentGrantCommands-L6O2HVJI.js} +7 -7
  9. package/{agentListCommands-C65UESYM.js → agentListCommands-4WLG32IW.js} +79 -470
  10. package/{agentMachineCommands-V3DGEJU4.js → agentMachineCommands-DC6NKWTU.js} +59 -57
  11. package/{agentProviderCommands-7QBFRFRK.js → agentProviderCommands-STI3DQ6A.js} +7 -7
  12. package/{agentPullCommand-E6JBGBVG.js → agentPullCommand-KHV4EELF.js} +6 -6
  13. package/{agentRecordCommands-6RCJS2EY.js → agentRecordCommands-IZYUVHME.js} +107 -106
  14. package/{agentRunCommand-P3GRKXKS.js → agentRunCommand-QM7ETUTX.js} +113 -112
  15. package/{agentRunControl-SNZZ5XP4.js → agentRunControl-MBG4U6SL.js} +23 -17
  16. package/{agentRuntimeLocal-GOX2DIY7.js → agentRuntimeLocal-HOXKWCYO.js} +46 -45
  17. package/{agentSlice-N7H2FRJA.js → agentSlice-UG76KEBH.js} +17 -17
  18. package/{appDeleteCommands-LZDN26FU.js → appDeleteCommands-WWCC6WA5.js} +54 -52
  19. package/{appDeployCommands-6IO6TTZH.js → appDeployCommands-AU4IUN33.js} +54 -52
  20. package/{appDeployStatusCommands-FG3LX24J.js → appDeployStatusCommands-STUW7WXL.js} +54 -52
  21. package/{appGetCommands-NAKVDVD4.js → appGetCommands-BGTLIQ4K.js} +54 -52
  22. package/{appListCommands-KL56RN73.js → appListCommands-CUCPRUXW.js} +54 -52
  23. package/{authCommand-AUN5MXV2.js → authCommand-OZ2KTP4Z.js} +30 -31
  24. package/{authCommands-D2IPS6ES.js → authCommands-55OGQGCR.js} +12 -13
  25. package/{builtinSkillRegistry-UQGLKRYP.js → builtinSkillRegistry-BAE2LDXF.js} +4 -4
  26. package/{chromeOpsCommands-UJWN5HWH.js → chromeOpsCommands-WAA45NCS.js} +8 -8
  27. package/{chunk-OB6DVWPF.js → chunk-262R3XNN.js} +16 -2
  28. package/{chunk-UN7HIYMH.js → chunk-2X7WFDT6.js} +1 -1
  29. package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
  30. package/{chunk-CVERLOJM.js → chunk-3QIYD3VM.js} +639 -513
  31. package/{chunk-RU6DULV4.js → chunk-3U44JB3O.js} +1 -1
  32. package/{chunk-IAJJYHIB.js → chunk-3VZLEKV2.js} +7 -7
  33. package/{chunk-JWXITTQB.js → chunk-42OKN2LI.js} +1 -1
  34. package/{chunk-UAPNPNSG.js → chunk-45CAVC35.js} +1072 -859
  35. package/{chunk-EUCFKKDM.js → chunk-4I2MXV5Q.js} +38 -10
  36. package/{chunk-SW6OD4KE.js → chunk-4QYJPWHH.js} +123 -12
  37. package/{chunk-PLPLH2XZ.js → chunk-4ZGPHFLE.js} +2 -2
  38. package/{chunk-NO3VBWTL.js → chunk-547ENH5T.js} +1 -1
  39. package/{chunk-CKT6QUE2.js → chunk-5YMA6DDZ.js} +1 -1
  40. package/chunk-5ZUOVCKT.js +32 -0
  41. package/{chunk-XZODOEKU.js → chunk-6QHKRARD.js} +2 -2
  42. package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
  43. package/{chunk-PVAWNHP5.js → chunk-7BCG67EI.js} +295 -102
  44. package/{chunk-VZW34YUL.js → chunk-7FEP5USX.js} +8 -5
  45. package/{chunk-VPAZ6BEN.js → chunk-7JGMNKKG.js} +18 -14
  46. package/{chunk-5HL4KC4A.js → chunk-ALAES342.js} +57 -86
  47. package/{chunk-VREDDN25.js → chunk-ATEKLSLR.js} +1 -1
  48. package/chunk-BIDSIRTS.js +307 -0
  49. package/chunk-BIWI5M4E.js +62 -0
  50. package/{chunk-UCFPVYP7.js → chunk-BP5ZJ6B4.js} +1 -1
  51. package/{chunk-2G3YSVO6.js → chunk-CBUZ6DKA.js} +3 -3
  52. package/{chunk-KYH7XW3K.js → chunk-CD3RU7XL.js} +16 -1
  53. package/{chunk-SFTTXGPM.js → chunk-CMMI3DAT.js} +16 -16
  54. package/{chunk-VIHDJ3FK.js → chunk-CNMY2XM6.js} +14 -14
  55. package/{chunk-UVUVQVZ6.js → chunk-DBUR22G5.js} +2 -2
  56. package/{chunk-G6HJUMST.js → chunk-DEA37IUY.js} +2 -2
  57. package/{chunk-5RKRXQ2H.js → chunk-DGYCDA6W.js} +2 -2
  58. package/{chunk-FKEZOMIF.js → chunk-DLXMMTGM.js} +523 -202
  59. package/{chunk-3HTP4WZQ.js → chunk-DUUDXSLX.js} +21 -7
  60. package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
  61. package/{chunk-TOKPHZ55.js → chunk-EEOOBRA7.js} +5 -5
  62. package/{chunk-ZI5SZ3MV.js → chunk-EGHP7KOY.js} +20 -20
  63. package/{chunk-OXA5GWHU.js → chunk-F6Z6ZCUV.js} +2 -2
  64. package/{chunk-X2KRQP7V.js → chunk-FJSNBZXR.js} +1 -1
  65. package/{chunk-3VFYQH3I.js → chunk-FPBJM2BW.js} +17 -39
  66. package/{chunk-KRRE4A7D.js → chunk-G7IUT2V3.js} +3 -2
  67. package/{chunk-LXTC53TN.js → chunk-GAYNXB6T.js} +184 -153
  68. package/{chunk-45LZIYXB.js → chunk-HBRDSQ3M.js} +1 -1
  69. package/{chunk-GRXSJR2Z.js → chunk-HF7BLF3F.js} +21 -21
  70. package/{chunk-T5N6NHAT.js → chunk-HHFGE2WF.js} +3 -3
  71. package/{chunk-IX2BXN2K.js → chunk-HSSBDZLD.js} +3 -3
  72. package/{chunk-TINJKQSO.js → chunk-HXB4VDGK.js} +20 -20
  73. package/{chunk-MWHOH4RJ.js → chunk-HYLRQDEE.js} +4 -4
  74. package/{chunk-L5I543VB.js → chunk-JQZRSXS5.js} +23 -23
  75. package/{chunk-T2BEPTAG.js → chunk-L32W3PRP.js} +47 -17
  76. package/{chunk-LA7JYAKF.js → chunk-LYD6C7OU.js} +3 -3
  77. package/{chunk-PHOSZT3E.js → chunk-M3OZRQNH.js} +1 -1
  78. package/{chunk-M3Y4IBIR.js → chunk-M4SFKP5L.js} +4 -4
  79. package/{chunk-7Z3WUZ4Q.js → chunk-MJI3UAXN.js} +52 -28
  80. package/{chunk-YOT437BH.js → chunk-MNEZUL5S.js} +137 -118
  81. package/{chunk-GOLPOTG5.js → chunk-MZG5CETE.js} +3 -3
  82. package/{chunk-KJAAPGBE.js → chunk-OBIC6EG7.js} +6 -6
  83. package/{chunk-CLCXHIBS.js → chunk-OJ45MEEI.js} +1 -1
  84. package/{chunk-AXYH4734.js → chunk-OOJNQK6V.js} +13 -13
  85. package/{chunk-2SKTCNWO.js → chunk-OTKSESZR.js} +2 -2
  86. package/{chunk-XIEYGCN6.js → chunk-OWKNSIXL.js} +149 -48
  87. package/{chunk-6XIE5ZGI.js → chunk-PDCV7P5W.js} +1 -1
  88. package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
  89. package/{chunk-YQETUZ5V.js → chunk-QRGDJA4B.js} +11 -11
  90. package/{chunk-ULAQPRHX.js → chunk-QYB23WUH.js} +1 -1
  91. package/{chunk-CSW7IPVD.js → chunk-R6Z5S5GA.js} +11 -11
  92. package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
  93. package/{chunk-GUVXQSFZ.js → chunk-RBPUNSG5.js} +1 -1
  94. package/{chunk-GOQ6ZVTN.js → chunk-RG2DGNL6.js} +3 -3
  95. package/{chunk-F5AY2UZL.js → chunk-RRDRQOEC.js} +515 -9
  96. package/{chunk-6EDAMVG6.js → chunk-RTHFJZ6M.js} +10 -10
  97. package/{chunk-WJP4TH6U.js → chunk-S6FDXXZV.js} +1 -1
  98. package/{chunk-LJSNEV7M.js → chunk-SRCCSTIM.js} +7 -7
  99. package/{chunk-KMRKZNGT.js → chunk-TCZ2VJZQ.js} +13 -12
  100. package/{chunk-AK5O76CC.js → chunk-TI2EPRHE.js} +2 -2
  101. package/{chunk-5LQDHFBN.js → chunk-TQEKUOTI.js} +14 -11
  102. package/{chunk-SRG5CNLC.js → chunk-TSPMLCWI.js} +6 -6
  103. package/{chunk-YGILMZ7N.js → chunk-TUSTONB3.js} +1 -1
  104. package/{chunk-YPPKC6FL.js → chunk-U2HBB7RS.js} +17 -17
  105. package/{chunk-HVUDBOQG.js → chunk-VMJVAJ6W.js} +9 -6
  106. package/{chunk-CQVGR3MX.js → chunk-VQ5N5GSV.js} +8 -8
  107. package/{chunk-ABGULE7H.js → chunk-WCFFRBL5.js} +12 -12
  108. package/{chunk-NAOO4PVX.js → chunk-WFDNADFX.js} +16 -16
  109. package/chunk-WFGNWWJI.js +326 -0
  110. package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
  111. package/{chunk-JHF6VLVL.js → chunk-X3E6EHJW.js} +32 -31
  112. package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
  113. package/{chunk-C2B7M567.js → chunk-XAG3FWBE.js} +15 -4
  114. package/{chunk-4OKTPFNX.js → chunk-XFXFPUO7.js} +105 -37
  115. package/{chunk-HYKGIXNO.js → chunk-XSW4EXQV.js} +85 -21
  116. package/{chunk-ZADGPNTV.js → chunk-XTJKU3Z4.js} +29 -29
  117. package/{chunk-T43K75CK.js → chunk-YKY4OVOX.js} +15 -15
  118. package/{chunk-ZYA2YDB6.js → chunk-YVFH2MFB.js} +16 -16
  119. package/{chunk-L42CBKBZ.js → chunk-ZEVQHCLM.js} +3 -3
  120. package/{chunk-5RKUPJYL.js → chunk-ZH3KXFHS.js} +11 -3
  121. package/chunk-ZOHO6MOF.js +376 -0
  122. package/{chunk-PXKF5CV4.js → chunk-ZXF6D3I6.js} +10 -8
  123. package/{cliAgentConfigHelpers-QVSQYTKC.js → cliAgentConfigHelpers-BTRHMPW2.js} +14 -14
  124. package/{cliEnvHelpers-D6HMC46Z.js → cliEnvHelpers-CNMP3RDX.js} +2 -2
  125. package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
  126. package/{cliLocalAgentRecordReader-SPKAJYME.js → cliLocalAgentRecordReader-H3HYQRRR.js} +48 -47
  127. package/{commandRegistry-TKR6OWXP.js → commandRegistry-FVYPE2IN.js} +93 -93
  128. package/{contentThunks-BQWRPCTM.js → contentThunks-GNFPG32S.js} +36 -35
  129. package/{cooldownCommands-FZYQOWI5.js → cooldownCommands-YB5H5BBK.js} +3 -3
  130. package/{createAgentAutomationAction-GFI6SJZV.js → createAgentAutomationAction-PB4QIFQ4.js} +36 -35
  131. package/{createDialogAction-MMBIHFFU.js → createDialogAction-EVTOPY7A.js} +37 -37
  132. package/{createPageAction-EEYUE5FB.js → createPageAction-2UYF2IDZ.js} +39 -38
  133. package/{db-CS4ZJQKV.js → db-M7FU2GNK.js} +9 -6
  134. package/{dbSlice-X4Z4E4QU.js → dbSlice-XRUZOGSU.js} +13 -13
  135. package/{deleteFile-QOOP2UK7.js → deleteFile-6URDHYRB.js} +9 -9
  136. package/{dialogCommands-OXBQ73DD.js → dialogCommands-6SZD4TYP.js} +58 -57
  137. package/{dialogNotifyCommand-VWS5G4OO.js → dialogNotifyCommand-SHGPCU22.js} +17 -17
  138. package/{dialogSlice-KGYIABDY.js → dialogSlice-5EQ2A6LY.js} +34 -33
  139. package/{dialogUsageCommand-FEWCN7IA.js → dialogUsageCommand-W2WCSGKF.js} +6 -6
  140. package/{docCreateCommands-LS32VKY3.js → docCreateCommands-25E6PGN3.js} +53 -51
  141. package/{docDeleteCommands-JTYR5RPH.js → docDeleteCommands-F7ZVGEHW.js} +55 -53
  142. package/{docReadCommands-E5LTVKWN.js → docReadCommands-JY2E5XEN.js} +53 -51
  143. package/{docStore-TVS2FNER.js → docStore-OKKIKLT3.js} +15 -15
  144. package/{docUpdateCommands-I3J3JDZ2.js → docUpdateCommands-OZ4CUSIQ.js} +53 -51
  145. package/{fetchMessages-Q3INLN5F.js → fetchMessages-TQEUZD7H.js} +3 -3
  146. package/{getPricing-VNGFM4PN.js → getPricing-LF5C4XSI.js} +6 -6
  147. package/{handleSendMessageAction-SSON36TJ.js → handleSendMessageAction-LNT7SZND.js} +68 -67
  148. package/{hostCredentialCreate-WTW4THJF.js → hostCredentialCreate-XUU2CSHI.js} +107 -106
  149. package/index.js +54 -16
  150. package/keys-RWF7UCB4.js +1 -1
  151. package/{localDialogRead-V36DX2Q2.js → localDialogRead-CCOCVGAP.js} +2 -2
  152. package/{localRuntimeAdapter-MI2JGXSF.js → localRuntimeAdapter-IBSTMSX7.js} +114 -113
  153. package/{machineCommands-3LROJZDK.js → machineCommands-HSQHDHOT.js} +135 -119
  154. package/{machineWsRunDispatch-BUUJRUUB.js → machineWsRunDispatch-L6H7J66T.js} +105 -104
  155. package/{memberThunks-CFEPHAND.js → memberThunks-7Y3OYSJQ.js} +17 -17
  156. package/{memoryCommands-JQMEJO7J.js → memoryCommands-BC6REPQB.js} +6 -6
  157. package/{overlay-THLKYIWY.js → overlay-BBQZXGYI.js} +5 -3
  158. package/package.json +1 -1
  159. package/{projectArchive-3X54XFVN.js → projectArchive-FQO654Z3.js} +44 -43
  160. package/{providerPresetApply-FO36N5TX.js → providerPresetApply-WHAMP2D5.js} +9 -9
  161. package/{providerRegistry-U2BSFE6K.js → providerRegistry-ZI2KORJ7.js} +9 -9
  162. package/{read-KA3L2V7O.js → read-TYMBGEXO.js} +9 -9
  163. package/{readDocTool-AMAZAPAW.js → readDocTool-SKQVHBLO.js} +1 -1
  164. package/{readlineWorkspace-Z3YUH4SX.js → readlineWorkspace-7U272DSA.js} +4398 -4165
  165. package/{removeDialogAgentAction-JQOJSUM7.js → removeDialogAgentAction-F5QE2O2B.js} +19 -19
  166. package/{runAgentClientLoop-4FCFLMDJ.js → runAgentClientLoop-AF4JQIJ7.js} +72 -71
  167. package/{runtimeDoctorCommands-CXOCVDPU.js → runtimeDoctorCommands-RRKPBGVO.js} +16 -16
  168. package/{secretCommands-GGUAWAE7.js → secretCommands-KZWBZIYS.js} +2 -2
  169. package/{setDialogExtraReferencesAction-YXQTGXIN.js → setDialogExtraReferencesAction-72L27ERM.js} +15 -15
  170. package/{setPrimaryDialogAgentAction-YNLB66WE.js → setPrimaryDialogAgentAction-GJJDUSGJ.js} +19 -19
  171. package/{settingThunks-E6N7RSSS.js → settingThunks-ZRGWVGZD.js} +18 -18
  172. package/{skillDiscovery-B5V23AXP.js → skillDiscovery-BHHPCUHZ.js} +3 -3
  173. package/{spaceCommands-DB5DKC2J.js → spaceCommands-5VNWMDBE.js} +55 -53
  174. package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
  175. package/{streamAgentChatTurn-FCBGMD4D.js → streamAgentChatTurn-YSPEFY4K.js} +97 -95
  176. package/{switchDialogAgentAction-LAHLUECU.js → switchDialogAgentAction-IIJBPND3.js} +16 -16
  177. package/{tableCommands-VNSXHAMG.js → tableCommands-FTAOCBTX.js} +12 -12
  178. package/{tools-6JD36D6K.js → tools-M35PTIFB.js} +61 -60
  179. package/tuiRestart-2IL37YIB.js +41 -0
  180. package/{tuiSummaryLlmCaller-UHZIPGAX.js → tuiSummaryLlmCaller-W2QN4VAC.js} +21 -21
  181. package/{updateCommands-KZ54HCU5.js → updateCommands-CPATDG6J.js} +8 -6
  182. package/{updateDialogTitleAction-RV3EUEN3.js → updateDialogTitleAction-IMIRJRQQ.js} +36 -35
  183. package/{usageCommand-KFVV6UL3.js → usageCommand-2BF74MKF.js} +2 -2
  184. package/{usageRebuildCommand-HHFSNK46.js → usageRebuildCommand-UHB55BQM.js} +3 -3
  185. package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-ZFD6J5HF.js} +2 -2
  186. package/chunk-2WZXXAQD.js +0 -57
  187. package/chunk-BJF2MHJ3.js +0 -118
  188. package/chunk-KEPOVMF4.js +0 -91
  189. package/chunk-PMDVQBGA.js +0 -100
  190. package/chunk-WACI5I6V.js +0 -147
  191. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +4 -4
  192. package/{chunk-AGP3YSEC.js → chunk-4N6G2CKP.js} +3 -3
  193. package/{chunk-VXL2FZTP.js → chunk-HXER7YJF.js} +3 -3
  194. package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
  195. package/{chunk-SSGTV4FC.js → chunk-USGHJSGO.js} +5 -5
  196. package/{chunk-IC2I373Q.js → chunk-VS276URX.js} +3 -3
  197. package/{chunk-AETZ7AD6.js → chunk-W6RFEDN4.js} +3 -3
  198. package/{offlineMarxistsAgentCommand-AGA2X5E4.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +5 -5
  199. package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-HFJIN5IZ.js} +8 -8
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  resolveCliAgentKeyInput
3
3
  } from "./chunk-BR3GT6MR.js";
4
- import {
5
- toErrorMessage
6
- } from "./chunk-HNMXYYJR.js";
7
4
  import "./chunk-M2EJHDJP.js";
8
- import "./chunk-QSJ3HFEF.js";
9
5
  import {
10
6
  parseUserIdFromAuthToken,
11
7
  readOption,
12
8
  resolveAuthToken,
13
9
  resolveServerUrl
14
- } from "./chunk-WACI5I6V.js";
10
+ } from "./chunk-BIDSIRTS.js";
15
11
  import "./chunk-OLZBQWZU.js";
16
12
  import "./chunk-LCBAMY2M.js";
17
- import "./chunk-4SN6J65J.js";
18
- import "./chunk-CF7PE763.js";
13
+ import {
14
+ toErrorMessage
15
+ } from "./chunk-HNMXYYJR.js";
19
16
  import {
20
17
  asOptionalTrimmedString
21
18
  } from "./chunk-G3SUCT4W.js";
19
+ import "./chunk-4SN6J65J.js";
20
+ import "./chunk-CF7PE763.js";
21
+ import "./chunk-QSJ3HFEF.js";
22
22
  import "./chunk-U67V476Y.js";
23
23
 
24
24
  // packages/cli/agentGrantCommands.ts
@@ -1,6 +1,3 @@
1
- import {
2
- resolveObservedSpeed
3
- } from "./chunk-AMWMV56B.js";
4
1
  import {
5
2
  decorateAgentsWithPublicStatusAcrossServers,
6
3
  listFavoriteAgentIdsAcrossServers,
@@ -10,17 +7,10 @@ import {
10
7
  listRemotePublicAgents,
11
8
  normalizeListedAgent,
12
9
  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";
10
+ } from "./chunk-7FEP5USX.js";
21
11
  import {
22
12
  refreshSubscriptionQuotas
23
- } from "./chunk-YGILMZ7N.js";
13
+ } from "./chunk-TUSTONB3.js";
24
14
  import {
25
15
  getReadableCliDb
26
16
  } from "./chunk-YFLVRVYK.js";
@@ -29,44 +19,56 @@ import {
29
19
  clearCredentialAvailabilityIfMarkedAt,
30
20
  readCredentialAvailability,
31
21
  readEffectiveCredentialEntry
32
- } from "./chunk-FIYSMXHY.js";
33
- import {
34
- queryUserRecords,
35
- readDbRecord
36
- } from "./chunk-5LQDHFBN.js";
22
+ } from "./chunk-WWTSEBDF.js";
37
23
  import {
38
24
  buildAgentDiscoveryResult,
25
+ injectSpeedContextIntoListAgentsResult,
39
26
  matchesAgentQuery,
40
27
  resolvePaginationArgs,
41
28
  summarizeCredentialGroups,
42
29
  toDiscoverySafeAgentSummary
43
- } from "./chunk-F5AY2UZL.js";
30
+ } from "./chunk-RRDRQOEC.js";
31
+ import "./chunk-AMWMV56B.js";
44
32
  import {
45
- listRunRecords
46
- } from "./chunk-XIEYGCN6.js";
47
- import "./chunk-UN7HIYMH.js";
48
- import "./chunk-AXYH4734.js";
49
- import "./chunk-GBWGPTA7.js";
33
+ buildSpaceLookup,
34
+ getSpaceContentKeys
35
+ } from "./chunk-ID4G2MAR.js";
36
+ import {
37
+ readLiveDbRecordAfterTombstoneMerge
38
+ } from "./chunk-M3OZRQNH.js";
39
+ import {
40
+ queryUserRecords,
41
+ readDbRecord
42
+ } from "./chunk-TQEKUOTI.js";
43
+ import "./chunk-5ZUOVCKT.js";
50
44
  import "./chunk-UEILX4EV.js";
45
+ import "./chunk-GBWGPTA7.js";
46
+ import {
47
+ listRunRecords
48
+ } from "./chunk-OWKNSIXL.js";
49
+ import "./chunk-2X7WFDT6.js";
50
+ import "./chunk-OOJNQK6V.js";
51
51
  import "./chunk-BV3FLP2L.js";
52
- import "./chunk-CLCXHIBS.js";
52
+ import "./chunk-OJ45MEEI.js";
53
53
  import "./chunk-BR3GT6MR.js";
54
- import "./chunk-CVERLOJM.js";
54
+ import "./chunk-3QIYD3VM.js";
55
55
  import "./chunk-ZNFJWEN4.js";
56
- import "./chunk-YPPKC6FL.js";
57
- import "./chunk-CHOZJMJS.js";
56
+ import "./chunk-U2HBB7RS.js";
58
57
  import "./chunk-PWTNI4N7.js";
59
58
  import "./chunk-AL3TYDIF.js";
60
- import "./chunk-IX2BXN2K.js";
59
+ import "./chunk-HSSBDZLD.js";
61
60
  import "./chunk-HNUWUO75.js";
61
+ import "./chunk-CHOZJMJS.js";
62
+ import "./chunk-XAG3FWBE.js";
62
63
  import "./chunk-LKA64WH4.js";
63
- import "./chunk-C2B7M567.js";
64
- import "./chunk-2WZXXAQD.js";
65
- import "./chunk-3HTP4WZQ.js";
66
- import "./chunk-ULAQPRHX.js";
64
+ import "./chunk-BYXBJQAS.js";
65
+ import "./chunk-DUUDXSLX.js";
66
+ import "./chunk-QYB23WUH.js";
67
67
  import "./chunk-56GBUMO5.js";
68
- import "./chunk-3VFYQH3I.js";
69
- import "./chunk-YOT437BH.js";
68
+ import "./chunk-FPBJM2BW.js";
69
+ import "./chunk-EEOOBRA7.js";
70
+ import "./chunk-X4O7FJF5.js";
71
+ import "./chunk-MNEZUL5S.js";
70
72
  import {
71
73
  DEFAULT_PROVIDER_RETRY_MS,
72
74
  formatQuotaSummary,
@@ -75,49 +77,43 @@ import {
75
77
  resolveCredentialCandidateKeys,
76
78
  resolveCredentialKeyWithFallback,
77
79
  shouldClearCooldownFromQuota
78
- } from "./chunk-HOCHUZQ7.js";
79
- import "./chunk-IC2I373Q.js";
80
- import "./chunk-TOKPHZ55.js";
81
- import "./chunk-E2BESSAW.js";
80
+ } from "./chunk-QJTZ76CP.js";
81
+ import "./chunk-VS276URX.js";
82
82
  import "./chunk-TLE77UJ5.js";
83
- import "./chunk-X2KRQP7V.js";
84
- import "./chunk-KJAAPGBE.js";
83
+ import "./chunk-OBIC6EG7.js";
84
+ import "./chunk-WFGNWWJI.js";
85
+ import "./chunk-FJSNBZXR.js";
85
86
  import "./chunk-2MBTWINN.js";
86
- import "./chunk-YQETUZ5V.js";
87
+ import "./chunk-QRGDJA4B.js";
87
88
  import "./chunk-5ZUL4CUO.js";
88
- import "./chunk-T2BEPTAG.js";
89
+ import "./chunk-L32W3PRP.js";
89
90
  import "./chunk-H57T64RA.js";
90
91
  import "./chunk-UKZX3NHN.js";
91
92
  import "./chunk-5MMAK75Q.js";
92
- import "./chunk-SSGTV4FC.js";
93
+ import "./chunk-USGHJSGO.js";
93
94
  import "./chunk-KX6YBIHG.js";
94
95
  import "./chunk-OQHIVPG4.js";
95
96
  import "./chunk-DWLEOOGR.js";
96
- import "./chunk-HVUDBOQG.js";
97
+ import "./chunk-7DPNBQSV.js";
98
+ import "./chunk-OW765XBU.js";
99
+ import "./chunk-VMJVAJ6W.js";
97
100
  import "./chunk-EWQ3HGNZ.js";
98
101
  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";
102
+ import "./chunk-G7Y4GXTY.js";
103
+ import "./chunk-6UBGXX2W.js";
104
+ import "./chunk-G7IUT2V3.js";
109
105
  import "./chunk-6OVNSQHN.js";
110
- import "./chunk-AETZ7AD6.js";
106
+ import "./chunk-W6RFEDN4.js";
111
107
  import "./chunk-EVGU5P4U.js";
112
108
  import "./chunk-ILHQ2AXT.js";
113
109
  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";
110
+ import "./chunk-SYTHYBMI.js";
111
+ import "./chunk-OJKUU3LP.js";
112
+ import "./chunk-YZMNK53S.js";
113
+ import "./chunk-I42VC5KR.js";
114
+ import "./chunk-U6VC4MU4.js";
115
+ import "./chunk-42OKN2LI.js";
116
+ import "./chunk-JQZRSXS5.js";
121
117
  import "./chunk-KHCLMKZZ.js";
122
118
  import {
123
119
  parseUserIdFromAuthToken,
@@ -125,424 +121,32 @@ import {
125
121
  resolveAuthToken,
126
122
  resolveServerCandidates,
127
123
  resolveServerUrl
128
- } from "./chunk-WACI5I6V.js";
124
+ } from "./chunk-BIDSIRTS.js";
129
125
  import "./chunk-OLZBQWZU.js";
130
126
  import "./chunk-LCBAMY2M.js";
131
- import "./chunk-4SN6J65J.js";
132
- import "./chunk-CF7PE763.js";
133
127
  import "./chunk-4O22PGNQ.js";
134
128
  import {
135
129
  t
136
- } from "./chunk-OB6DVWPF.js";
137
- import "./chunk-G7Y4GXTY.js";
138
- import "./chunk-6UBGXX2W.js";
130
+ } from "./chunk-262R3XNN.js";
131
+ import "./chunk-62HXNQVV.js";
132
+ import "./chunk-7JGMNKKG.js";
133
+ import "./chunk-RTHFJZ6M.js";
134
+ import "./chunk-HBRDSQ3M.js";
139
135
  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";
136
+ toErrorMessage
137
+ } from "./chunk-HNMXYYJR.js";
146
138
  import "./chunk-3EUW3WEO.js";
147
- import "./chunk-U6VC4MU4.js";
139
+ import "./chunk-CD3RU7XL.js";
140
+ import "./chunk-JRTNUU5Z.js";
141
+ import "./chunk-KUG52IAP.js";
148
142
  import "./chunk-WWC7I6TA.js";
149
143
  import "./chunk-G3SUCT4W.js";
144
+ import "./chunk-4SN6J65J.js";
145
+ import "./chunk-CF7PE763.js";
146
+ import "./chunk-OBSEKCVK.js";
147
+ import "./chunk-QSJ3HFEF.js";
150
148
  import "./chunk-U67V476Y.js";
151
149
 
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
150
  // packages/ai/agent/dispatchSpeedProvenance.ts
547
151
  var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
548
152
  function isServerDispatchSpeedSource(value, dialogId, userId) {
@@ -596,7 +200,7 @@ async function runAgentListCommand(args, deps = {}) {
596
200
  } catch {
597
201
  }
598
202
  const output = deps.output ?? process.stdout;
599
- const { wantJson, wantSafe, publicOnly, scope: requestedScope, idsOnly, showUnavailable, verbose, compact, limit, offset, query } = parseAgentListArgs(args);
203
+ const { wantJson, wantSafe, publicOnly, scope: requestedScope, idsOnly, showUnavailable, verbose, compact, limit, offset, query, fragmentOffset, fragmentAgentKey, fragmentDigest } = parseAgentListArgs(args);
600
204
  if (requestedScope && !["preferred", "public", "all"].includes(requestedScope)) {
601
205
  throw new Error(`Invalid scope '${requestedScope}'`);
602
206
  }
@@ -887,6 +491,7 @@ async function runAgentListCommand(args, deps = {}) {
887
491
  ...typeof discovery.limit === "number" ? { limit: discovery.limit } : {},
888
492
  ...discovery.truncated ? { truncated: true } : {},
889
493
  unavailableCount: discovery.unavailableCount,
494
+ availableCount: discovery.availableCount,
890
495
  // agents 在最前:host 截断长输出时保头保尾,派发所需的 agentKey
891
496
  // 必须落在头部;凭证分组是说明性大块,放最后。
892
497
  // 限流 agent 已合入 agents(带 availabilityStatus / nextAvailableAt
@@ -896,6 +501,10 @@ async function runAgentListCommand(args, deps = {}) {
896
501
  }, null, 2);
897
502
  const cliNoloHome = env.NOLO_HOME?.trim() || (env.HOME?.trim() ? `${env.HOME.trim()}/.nolo` : "");
898
503
  const speedAwareListResult = await injectSpeedContextIntoListAgentsResult(listResult, {
504
+ compactPage: compact === true && verbose !== true,
505
+ fragmentOffset,
506
+ fragmentAgentKey,
507
+ fragmentDigest,
899
508
  db: createCliDispatchSampleDb(deps.db ?? await getReadableCliDb(output), userId, env),
900
509
  userId,
901
510
  ...cliNoloHome ? { diskCache: { cachePath: `${cliNoloHome}/cache/speed-samples-${userId}.json` } } : {}