nolo-cli 0.98.0-alpha.3 → 0.98.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.
Files changed (205) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-MA3D2J4W.js → _executeModel-GJK4ZVU6.js} +74 -67
  3. package/action-PNPQLJHG.js +20 -0
  4. package/{addContentAction-O7R66HEX.js → addContentAction-RBOUD7SJ.js} +12 -11
  5. package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-IODCR6TB.js} +18 -19
  6. package/{agentDeleteCommand-FHUJH5X4.js → agentDeleteCommand-GHRF6CH5.js} +47 -42
  7. package/{agentEmailCommands-KNYBWNMA.js → agentEmailCommands-O5BTHYZK.js} +97 -87
  8. package/agentListCommands-3REEM63V.js +742 -0
  9. package/{agentMachineCommands-N62I3D5Q.js → agentMachineCommands-2GW3CV7Q.js} +48 -43
  10. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-IRNZXVGE.js} +1 -1
  11. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
  12. package/agentRecordCommands-WYQODWZE.js +138 -0
  13. package/agentRunCommand-KAN65WPY.js +167 -0
  14. package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
  15. package/{agentRuntimeLocal-VXZSDIGT.js → agentRuntimeLocal-IOFBNVIL.js} +48 -39
  16. package/{agentSlice-65ETD734.js → agentSlice-I45M32KO.js} +14 -13
  17. package/{appDeleteCommands-PDZ7HQYH.js → appDeleteCommands-SFS6IZEM.js} +46 -41
  18. package/{appDeployCommands-KLLW32YA.js → appDeployCommands-YZQESVRQ.js} +46 -41
  19. package/{appDeployStatusCommands-IPNJ445T.js → appDeployStatusCommands-FKUUDCKP.js} +46 -41
  20. package/{appGetCommands-QA57XGXS.js → appGetCommands-QUE7OQZC.js} +46 -41
  21. package/{appListCommands-YBTAUFZS.js → appListCommands-QEETFKMH.js} +46 -41
  22. package/{authCommand-F4EFRRX6.js → authCommand-NHDLY3IB.js} +118 -24
  23. package/{authCommands-RGOGCPP6.js → authCommands-UDBJVSZU.js} +7 -5
  24. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-MAR5LPAC.js} +10 -8
  25. package/{chromeCommands-FZYAU75D.js → chromeCommands-K27J4OVZ.js} +124 -28
  26. package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-IXRLN57H.js} +4 -3
  27. package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
  28. package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
  29. package/{chunk-53HEEOTT.js → chunk-2WJ57RJA.js} +83 -16
  30. package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
  31. package/{chunk-ABQYVJBJ.js → chunk-46Y5D2BZ.js} +5 -5
  32. package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
  33. package/{chunk-H62HCIUP.js → chunk-4FFUDT6D.js} +24 -21
  34. package/chunk-4LCOCOR5.js +50 -0
  35. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  36. package/{chunk-IIVGDG4I.js → chunk-4YSOUKUR.js} +13 -7
  37. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  38. package/{chunk-FSX24MR3.js → chunk-5AUJB66Z.js} +550 -515
  39. package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
  40. package/chunk-5J3PYNUP.js +255 -0
  41. package/chunk-5MMAK75Q.js +15 -0
  42. package/{chunk-JPGCXHNM.js → chunk-5OA5HMTL.js} +1 -1
  43. package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
  44. package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
  45. package/{chunk-D2QT5FW4.js → chunk-6XDD7N7P.js} +47 -67
  46. package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
  47. package/{chunk-DNCEALKX.js → chunk-7MMSLEPA.js} +22 -29
  48. package/chunk-A4SQRTZ6.js +15 -0
  49. package/{chunk-7S4YWN7P.js → chunk-ADBZWMFB.js} +4 -4
  50. package/chunk-AGIM7IMJ.js +147 -0
  51. package/{chunk-5UTFL4QJ.js → chunk-AOTBKDRK.js} +7 -0
  52. package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
  53. package/{chunk-GZBATRJA.js → chunk-B2DEZY6J.js} +20 -11
  54. package/chunk-BMQ2MJUK.js +153 -0
  55. package/{chunk-6YTOJY35.js → chunk-BZ7NPA6G.js} +35 -2
  56. package/chunk-C4DVDM72.js +13536 -0
  57. package/chunk-CHOZJMJS.js +78 -0
  58. package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
  59. package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
  60. package/chunk-DZ7R5V3Y.js +164 -0
  61. package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
  62. package/{chunk-V4MJDUSR.js → chunk-E73ON47R.js} +2 -2
  63. package/{chunk-UY2NBS4V.js → chunk-EIFYNGU4.js} +24 -5
  64. package/{chunk-KQ4ONNQD.js → chunk-EKPKW6RM.js} +155 -8
  65. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  66. package/{chunk-HJUYAD4A.js → chunk-FJ5BGMNM.js} +5 -5
  67. package/{chunk-2F7RJC6L.js → chunk-FOXQ7BAB.js} +1 -1
  68. package/{chunk-TDRTS7QW.js → chunk-FY7DCYW7.js} +88 -17
  69. package/{chunk-J4MOO56S.js → chunk-GARACBQB.js} +10 -2
  70. package/{chunk-6VFARHZW.js → chunk-GDFA73QZ.js} +934 -1091
  71. package/chunk-GMZLP5DV.js +82 -0
  72. package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
  73. package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
  74. package/{chunk-QOKAKDPE.js → chunk-HIM3FCLF.js} +0 -1
  75. package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
  76. package/{chunk-VLTIYV3X.js → chunk-HP57OUJO.js} +4 -4
  77. package/{chunk-AD2L6YCC.js → chunk-I76SDF7A.js} +10 -10
  78. package/{chunk-PELKTR62.js → chunk-I7BCBNWZ.js} +24 -77
  79. package/{chunk-GPCZ7UXG.js → chunk-K6U4NKFJ.js} +1 -1
  80. package/{chunk-4OEFYTWL.js → chunk-LDCAFLXD.js} +64 -48
  81. package/{chunk-SNPMM7H3.js → chunk-LNVJHIGA.js} +18 -20
  82. package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
  83. package/{chunk-5H7KJX7J.js → chunk-LQ4PDQCI.js} +5 -5
  84. package/{chunk-GABFWSOQ.js → chunk-M33GWZIZ.js} +67 -45
  85. package/{chunk-PUOC4YRO.js → chunk-M7VLQGQP.js} +11 -0
  86. package/chunk-NHDMQZJM.js +7881 -0
  87. package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
  88. package/{chunk-L5UXH3B2.js → chunk-NNCYNBYV.js} +22 -6
  89. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  90. package/chunk-NWENLDMM.js +42 -0
  91. package/{chunk-76WEAXJB.js → chunk-NZWAO6LH.js} +20 -17
  92. package/chunk-OCZKATRC.js +129 -0
  93. package/{chunk-N2WELJE7.js → chunk-OU36O6OR.js} +23 -28
  94. package/chunk-OW4APERY.js +870 -0
  95. package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
  96. package/{chunk-TVYSVSA2.js → chunk-P5L7VVMT.js} +11 -9
  97. package/{chunk-TOP2VXOR.js → chunk-PCF3QU5Q.js} +5 -5
  98. package/{chunk-WV42OMV7.js → chunk-PTDYOADJ.js} +8 -8
  99. package/{chunk-6D6VBVEW.js → chunk-SNMQMOD2.js} +80 -14
  100. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  101. package/{chunk-Z77CRGTW.js → chunk-TVCAR26G.js} +1 -1
  102. package/chunk-TY3TIUJK.js +89 -0
  103. package/{chunk-I3TQJXQ7.js → chunk-U3C3IA32.js} +9 -2
  104. package/{chunk-RG6JBBX5.js → chunk-U7XXEI5R.js} +166 -13
  105. package/{chunk-UZGQNTVW.js → chunk-UA324D4O.js} +8 -6
  106. package/chunk-UJXNKP5V.js +760 -0
  107. package/{chunk-UKZDAFYT.js → chunk-UM4PH574.js} +6 -10
  108. package/{chunk-BLJWCTRL.js → chunk-UVKDJUTL.js} +3 -3
  109. package/{chunk-ZCYXJSTU.js → chunk-V5OWQOJZ.js} +19 -88
  110. package/{chunk-YQTQQX2H.js → chunk-V7Y6KRAH.js} +1 -1
  111. package/{chunk-3DII57IT.js → chunk-VCAQFMVN.js} +1 -1
  112. package/{chunk-JRQFUXY7.js → chunk-VEYL5MO5.js} +99 -22
  113. package/chunk-VIWDGTDA.js +8 -0
  114. package/chunk-VJVNU77E.js +83 -0
  115. package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
  116. package/{chunk-2FA3ITSX.js → chunk-W3RFFFFF.js} +873 -227
  117. package/{chunk-BP4XNZRM.js → chunk-W72ISAKC.js} +4 -4
  118. package/{chunk-DHDMC6FO.js → chunk-WCGC6S77.js} +14 -9
  119. package/{chunk-QDSINZM3.js → chunk-WJ3B6FX6.js} +1 -14
  120. package/{chunk-V4I3A7DR.js → chunk-WXHAOL7Y.js} +19 -17
  121. package/{chunk-FUUHG5LT.js → chunk-X2B2C4XD.js} +1 -1
  122. package/{chunk-HVURBGF3.js → chunk-XFUBXRVI.js} +6 -6
  123. package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
  124. package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
  125. package/{chunk-QIAVMDHY.js → chunk-YPOPJAKN.js} +4 -4
  126. package/{chunk-SH43IESU.js → chunk-YUNJN43V.js} +44 -9
  127. package/chunk-YV25TM3R.js +780 -0
  128. package/chunk-ZRAU6T47.js +56 -0
  129. package/commandRegistry-RZNZ37BN.js +833 -0
  130. package/{contentThunks-Y6FA2TCW.js → contentThunks-DF7ZNCAG.js} +36 -34
  131. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
  132. package/{createAgentAutomationAction-JXAFQO5V.js → createAgentAutomationAction-KPMOZ53Y.js} +38 -36
  133. package/createDialogAction-I2UDVAXN.js +69 -0
  134. package/{createPageAction-GUQDPKO5.js → createPageAction-IF5JXNKV.js} +45 -42
  135. package/{chunk-ZMD2CQFC.js → cursorProvider-YGGNMVWX.js} +2496 -9897
  136. package/{dbSlice-XVWBAGYN.js → dbSlice-Q25STFGJ.js} +11 -10
  137. package/{deleteFile-YG6QMJLU.js → deleteFile-AJ2EZMHT.js} +7 -6
  138. package/{dialogCommands-JJDASFIL.js → dialogCommands-LWHIIUQD.js} +49 -45
  139. package/{dialogSlice-J2YJNE6E.js → dialogSlice-74DFPFRV.js} +40 -33
  140. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  141. package/{docCreateCommands-OB3X3EQM.js → docCreateCommands-LVXQ6TNZ.js} +48 -43
  142. package/{docDeleteCommands-WMHRGF22.js → docDeleteCommands-7TVIGCLP.js} +49 -44
  143. package/{docReadCommands-NWGGLIAZ.js → docReadCommands-KYAXFLQ5.js} +47 -42
  144. package/{docStore-6KKYKAGQ.js → docStore-2JDRAYXJ.js} +16 -12
  145. package/{docUpdateCommands-3DDSOLPS.js → docUpdateCommands-TVC5KWPK.js} +48 -43
  146. package/{fetchMessages-EIU7UFFK.js → fetchMessages-I5ICDDHM.js} +5 -5
  147. package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +4 -4
  148. package/{handleSendMessageAction-A4XLEEPU.js → handleSendMessageAction-54GY3XOH.js} +110 -86
  149. package/index.js +87 -884
  150. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-ZHZ3KXDM.js} +2 -2
  151. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-TU6OBC76.js} +9 -6
  152. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-VKWVOPPI.js} +1 -1
  153. package/{machineCommands-Y64KAIRW.js → machineCommands-54RNLVJE.js} +91 -81
  154. package/machineWsRunDispatch-WE3VTD57.js +154 -0
  155. package/{memberThunks-QGFLFVCI.js → memberThunks-R75S3RWP.js} +20 -18
  156. package/{models-T3SG6MJ5.js → models-ZPU5EDF4.js} +2 -2
  157. package/oauthTokenStore-ITEB663N.js +23 -0
  158. package/package.json +1 -1
  159. package/pdf-U6KSUEZZ.js +26435 -0
  160. package/processSpawn-SOAV3FEV.js +11 -0
  161. package/profileConfig-ZGOFORWV.js +43 -0
  162. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-TEBH7FDX.js} +7 -7
  163. package/{providerRegistry-757OWH3O.js → providerRegistry-CBJLNCET.js} +11 -7
  164. package/{read-COE3ZYR6.js → read-SRQMNO26.js} +7 -6
  165. package/{readDocTool-5USN4A6V.js → readDocTool-RC3JUNJ2.js} +5 -3
  166. package/{readlineWorkspace-45XNHFXU.js → readlineWorkspace-UK5M5CJI.js} +2704 -2060
  167. package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-46XQV5Q7.js} +21 -25
  168. package/{runAgentClientLoop-ADZRHNG6.js → runAgentClientLoop-MTI5OU2W.js} +75 -69
  169. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
  170. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  171. package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-J4V5ADQF.js} +15 -13
  172. package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-UHHV2QZW.js} +22 -26
  173. package/{chunk-AFUORTY4.js → settingThunks-PPZZZOWN.js} +226 -940
  174. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
  175. package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
  176. package/{spaceCommands-E7MQ4VU2.js → spaceCommands-446WWA73.js} +51 -46
  177. package/{streamAgentChatTurn-TUP7YO3H.js → streamAgentChatTurn-IANOWAKR.js} +199 -104
  178. package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-A2TMVGAE.js} +18 -19
  179. package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
  180. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-EJT6TMFG.js} +3 -3
  181. package/tools-WZZYTUNF.js +116 -0
  182. package/{tuiSummaryLlmCaller-WFRWERGK.js → tuiSummaryLlmCaller-Q65IBDGO.js} +24 -21
  183. package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
  184. package/{updateDialogTitleAction-KSWXWWFT.js → updateDialogTitleAction-Z2JTYLXD.js} +82 -44
  185. package/action-YVYQEAAV.js +0 -31
  186. package/agentListCommands-GATRXEMT.js +0 -406
  187. package/agentRecordCommands-GOC5K27T.js +0 -128
  188. package/agentRunCommand-JP2U3MQF.js +0 -155
  189. package/browser-image-compression-MFDTD7K6.js +0 -1763
  190. package/chatQueueReduxAdapter-5QOW43T4.js +0 -186
  191. package/chunk-DHDVZFNC.js +0 -18885
  192. package/chunk-M76ECQRD.js +0 -13658
  193. package/chunk-MEYIRKDN.js +0 -8967
  194. package/chunk-Q5FJJ6XI.js +0 -103
  195. package/chunk-S7Z2HMCN.js +0 -25
  196. package/chunk-Y5GCAMGP.js +0 -9
  197. package/chunk-YPREESF4.js +0 -225
  198. package/createDialogAction-O2QABXZF.js +0 -65
  199. package/machineWsRunDispatch-M366L2LJ.js +0 -144
  200. package/settingSlice-ZQZVUPKK.js +0 -204
  201. package/syncMapping-N6RGXGBW.js +0 -437
  202. package/tools-2VDNDFET.js +0 -110
  203. package/{chunk-VMFTFOWF.js → chunk-3AH7LNUB.js} +7 -7
  204. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  205. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
@@ -0,0 +1,742 @@
1
+ import {
2
+ decorateAgentsWithPublicStatusAcrossServers,
3
+ formatQuotaSummary,
4
+ listFavoriteAgentIdsAcrossServers,
5
+ listLocalCachedAgents,
6
+ listRemoteAgents,
7
+ listRemoteAgentsAcrossServers,
8
+ listRemotePublicAgents,
9
+ normalizeListedAgent,
10
+ parseAgentListArgs
11
+ } from "./chunk-FY7DCYW7.js";
12
+ import {
13
+ buildSpaceLookup,
14
+ getSpaceContentKeys
15
+ } from "./chunk-ID4G2MAR.js";
16
+ import {
17
+ readLiveDbRecordAfterTombstoneMerge
18
+ } from "./chunk-UVKDJUTL.js";
19
+ import {
20
+ applyCredentialAvailability,
21
+ readCredentialAvailability
22
+ } from "./chunk-62IL3KQV.js";
23
+ import {
24
+ getReadableCliDb
25
+ } from "./chunk-LOCNXNOU.js";
26
+ import {
27
+ queryUserRecords,
28
+ readDbRecord
29
+ } from "./chunk-NZWAO6LH.js";
30
+ import "./chunk-TVCAR26G.js";
31
+ import "./chunk-SV5IJK6K.js";
32
+ import {
33
+ buildAgentDiscoveryResult,
34
+ matchesAgentQuery,
35
+ summarizeCredentialGroups,
36
+ toDiscoverySafeAgentSummary
37
+ } from "./chunk-U7XXEI5R.js";
38
+ import "./chunk-OXME3PEE.js";
39
+ import {
40
+ resolveNoloHome
41
+ } from "./chunk-GLKOYSRU.js";
42
+ import "./chunk-YYLHWIW6.js";
43
+ import "./chunk-GDFA73QZ.js";
44
+ import "./chunk-OW4APERY.js";
45
+ import "./chunk-ZNFJWEN4.js";
46
+ import "./chunk-V5OWQOJZ.js";
47
+ import "./chunk-GMZLP5DV.js";
48
+ import "./chunk-CHOZJMJS.js";
49
+ import "./chunk-LQ4PDQCI.js";
50
+ import "./chunk-5ZUL4CUO.js";
51
+ import "./chunk-CQ3WA2NE.js";
52
+ import "./chunk-N7J63Q6C.js";
53
+ import "./chunk-NNCYNBYV.js";
54
+ import "./chunk-M7VLQGQP.js";
55
+ import "./chunk-4YSOUKUR.js";
56
+ import {
57
+ isAgentUnavailableNow
58
+ } from "./chunk-H6A6X4EK.js";
59
+ import "./chunk-2MBTWINN.js";
60
+ import "./chunk-LDCAFLXD.js";
61
+ import {
62
+ normalizeTimingMs
63
+ } from "./chunk-7MMSLEPA.js";
64
+ import "./chunk-5MMAK75Q.js";
65
+ import "./chunk-BYXBJQAS.js";
66
+ import "./chunk-DWLEOOGR.js";
67
+ import "./chunk-XFUBXRVI.js";
68
+ import "./chunk-KX6YBIHG.js";
69
+ import "./chunk-PSCNXBYA.js";
70
+ import "./chunk-E73ON47R.js";
71
+ import "./chunk-UAD2WT54.js";
72
+ import "./chunk-4FFUDT6D.js";
73
+ import "./chunk-46Y5D2BZ.js";
74
+ import "./chunk-HNGRBWYF.js";
75
+ import "./chunk-HDLLCBRF.js";
76
+ import "./chunk-4VJAC32I.js";
77
+ import "./chunk-XUWRURDF.js";
78
+ import "./chunk-5J3PYNUP.js";
79
+ import "./chunk-EKPKW6RM.js";
80
+ import "./chunk-UA324D4O.js";
81
+ import "./chunk-27ONFIEY.js";
82
+ import "./chunk-7KVZ5LDQ.js";
83
+ import "./chunk-3BXNTXYI.js";
84
+ import "./chunk-W7XHHYWM.js";
85
+ import {
86
+ toErrorMessage
87
+ } from "./chunk-HNMXYYJR.js";
88
+ import {
89
+ parseUserIdFromAuthToken,
90
+ readOption,
91
+ resolveAuthToken,
92
+ resolveServerCandidates,
93
+ resolveServerUrl
94
+ } from "./chunk-A7GB5UGH.js";
95
+ import "./chunk-OLZBQWZU.js";
96
+ import "./chunk-Y6ROFCZO.js";
97
+ import {
98
+ getModelAbility
99
+ } from "./chunk-CYSYR67N.js";
100
+ import "./chunk-Y3PMXGLH.js";
101
+ import "./chunk-QSJ3HFEF.js";
102
+ import "./chunk-PTDYOADJ.js";
103
+ import "./chunk-UJXNKP5V.js";
104
+ import "./chunk-D2MDMY2M.js";
105
+ import "./chunk-BNGW5ASC.js";
106
+ import "./chunk-M2EJHDJP.js";
107
+ import "./chunk-KUG52IAP.js";
108
+ import {
109
+ createKey,
110
+ createTokenKey
111
+ } from "./chunk-3AH7LNUB.js";
112
+ import "./chunk-WWC7I6TA.js";
113
+ import "./chunk-VY6VFGKR.js";
114
+ import "./chunk-HIM3FCLF.js";
115
+ import "./chunk-OW765XBU.js";
116
+ import "./chunk-SEJ5OS6F.js";
117
+ import "./chunk-U6VC4MU4.js";
118
+ import "./chunk-3EUW3WEO.js";
119
+ import "./chunk-LCBAMY2M.js";
120
+ import "./chunk-4SN6J65J.js";
121
+ import "./chunk-CF7PE763.js";
122
+ import "./chunk-G3SUCT4W.js";
123
+ import "./chunk-4VNS5WPM.js";
124
+
125
+ // packages/ai/agent/speedSampleCache.ts
126
+ var SPEED_SAMPLE_DISK_CACHE_TTL_MS = 10 * 6e4;
127
+ var SPEED_SAMPLE_SCAN_BUDGET_MS = 8e3;
128
+ var SPEED_SAMPLE_CACHE_VERSION = 1;
129
+ var isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
130
+ var sanitizeSample = (value) => {
131
+ if (!value || typeof value !== "object") return null;
132
+ const sample = value;
133
+ const clean = {};
134
+ if (isFiniteNumber(sample.firstOutputMs)) clean.firstOutputMs = sample.firstOutputMs;
135
+ if (isFiniteNumber(sample.callDurationMs)) clean.callDurationMs = sample.callDurationMs;
136
+ if (isFiniteNumber(sample.output_tokens)) clean.output_tokens = sample.output_tokens;
137
+ return clean.firstOutputMs === void 0 && clean.callDurationMs === void 0 ? null : clean;
138
+ };
139
+ async function readSpeedSamplesCache(cachePath, options) {
140
+ const ttlMs = isFiniteNumber(options.ttlMs) ? options.ttlMs : SPEED_SAMPLE_DISK_CACHE_TTL_MS;
141
+ try {
142
+ const fs = await import("node:fs/promises");
143
+ const raw = await fs.readFile(cachePath, "utf8");
144
+ const parsed = JSON.parse(raw);
145
+ if (!parsed || typeof parsed !== "object") return null;
146
+ if (parsed.version !== SPEED_SAMPLE_CACHE_VERSION) return null;
147
+ if (parsed.userId !== options.userId) return null;
148
+ if (!isFiniteNumber(parsed.at)) return null;
149
+ const age = options.now - parsed.at;
150
+ if (age < 0 || age >= ttlMs) return null;
151
+ const samples = /* @__PURE__ */ new Map();
152
+ const source = parsed.samples;
153
+ if (!source || typeof source !== "object") return null;
154
+ for (const [model, list] of Object.entries(source)) {
155
+ if (!model || !Array.isArray(list)) continue;
156
+ const cleaned = [];
157
+ for (const entry of list) {
158
+ const sample = sanitizeSample(entry);
159
+ if (sample) cleaned.push(sample);
160
+ }
161
+ samples.set(model, cleaned);
162
+ }
163
+ return samples;
164
+ } catch {
165
+ return null;
166
+ }
167
+ }
168
+ async function writeSpeedSamplesCache(cachePath, payload) {
169
+ try {
170
+ const fs = await import("node:fs/promises");
171
+ const path2 = await import("node:path");
172
+ await fs.mkdir(path2.dirname(cachePath), { recursive: true });
173
+ await fs.writeFile(cachePath, JSON.stringify(payload), "utf8");
174
+ } catch {
175
+ }
176
+ }
177
+
178
+ // packages/ai/token/observedSpeedResolver.ts
179
+ var DEFAULT_OBSERVED_SPEED_SAMPLE_SIZE = 20;
180
+ var MIN_THROUGHPUT_WINDOW_MS = 200;
181
+ var MAX_PLAUSIBLE_OUTPUT_TPS = 3e3;
182
+ var isFiniteNumber2 = (value) => typeof value === "number" && Number.isFinite(value);
183
+ var medianOf = (values) => {
184
+ if (values.length === 0) return void 0;
185
+ const sorted = [...values].sort((a, b) => a - b);
186
+ const middle = Math.floor(sorted.length / 2);
187
+ return sorted.length % 2 === 1 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
188
+ };
189
+ function resolveObservedSpeed(records, options = {}) {
190
+ const limit = isFiniteNumber2(options.limit) ? Math.max(0, Math.floor(options.limit)) : DEFAULT_OBSERVED_SPEED_SAMPLE_SIZE;
191
+ const sample = Array.isArray(records) ? records.slice(0, limit) : [];
192
+ const firstOutputSamples = [];
193
+ const tpsSamples = [];
194
+ for (const record of sample) {
195
+ if (!record || typeof record !== "object") continue;
196
+ const { firstOutputMs, callDurationMs, output_tokens: outputTokens } = record;
197
+ const firstOutput = normalizeTimingMs(firstOutputMs);
198
+ const callDuration = normalizeTimingMs(callDurationMs);
199
+ if (firstOutput !== void 0) {
200
+ firstOutputSamples.push(firstOutput);
201
+ }
202
+ if (firstOutput !== void 0 && callDuration !== void 0 && callDuration - firstOutput >= MIN_THROUGHPUT_WINDOW_MS && isFiniteNumber2(outputTokens) && outputTokens > 0) {
203
+ const seconds = (callDuration - firstOutput) / 1e3;
204
+ const tokensPerSecond = outputTokens / seconds;
205
+ if (isFiniteNumber2(tokensPerSecond) && tokensPerSecond <= MAX_PLAUSIBLE_OUTPUT_TPS) {
206
+ tpsSamples.push(tokensPerSecond);
207
+ }
208
+ }
209
+ }
210
+ const medianFirstOutputMs = medianOf(firstOutputSamples);
211
+ const medianTps = medianOf(tpsSamples);
212
+ return {
213
+ firstOutputSampleCount: firstOutputSamples.length,
214
+ throughputSampleCount: tpsSamples.length,
215
+ ...medianFirstOutputMs !== void 0 ? { medianFirstOutputMs: Math.round(medianFirstOutputMs) } : {},
216
+ ...medianTps !== void 0 ? { medianOutputTokensPerSecond: Math.round(medianTps * 100) / 100 } : {}
217
+ };
218
+ }
219
+
220
+ // packages/ai/agent/candidateSpeedContext.ts
221
+ var OBSERVED_SPEED_WINDOW = 50;
222
+ var MIN_OBSERVED_FIRST_OUTPUT_SAMPLES = 5;
223
+ var SPEED_SAMPLES_CACHE_TTL_MS = 5 * 6e4;
224
+ var SPEED_SAMPLES_CACHE_MAX_ENTRIES = 500;
225
+ var MAX_PLAUSIBLE_AA_FIRST_ANSWER_S = 60;
226
+ function normalizeSpeedModelName(raw) {
227
+ const name = raw.trim().toLowerCase();
228
+ const slash = name.lastIndexOf("/");
229
+ return slash === -1 ? name : name.slice(slash + 1);
230
+ }
231
+ var isFiniteNumber3 = (value) => typeof value === "number" && Number.isFinite(value);
232
+ var REASONING_EFFORT_SUFFIXES = ["minimal", "low", "medium", "high", "xhigh"];
233
+ var REASONING_EFFORT_SUFFIX_RE = new RegExp(`-(?:${REASONING_EFFORT_SUFFIXES.join("|")})$`);
234
+ function stripReasoningEffortSuffix(model) {
235
+ const base = model.replace(REASONING_EFFORT_SUFFIX_RE, "");
236
+ return base && base !== model ? base : null;
237
+ }
238
+ function resolveOneBare(model, samplesByModel) {
239
+ const observed = resolveObservedSpeed(samplesByModel.get(model) ?? [], {
240
+ limit: OBSERVED_SPEED_WINDOW
241
+ });
242
+ if (observed.firstOutputSampleCount >= MIN_OBSERVED_FIRST_OUTPUT_SAMPLES && observed.medianFirstOutputMs !== void 0) {
243
+ return {
244
+ source: "observed",
245
+ firstOutputMs: observed.medianFirstOutputMs,
246
+ ...observed.medianOutputTokensPerSecond !== void 0 ? { outputTps: observed.medianOutputTokensPerSecond } : {},
247
+ firstOutputSamples: observed.firstOutputSampleCount,
248
+ tpsSamples: observed.throughputSampleCount
249
+ };
250
+ }
251
+ const aa = getModelAbility(model)?.aaSnapshot;
252
+ if (!aa) return null;
253
+ const firstAnswerTokenS = isFiniteNumber3(aa.firstAnswerTokenS) && aa.firstAnswerTokenS <= MAX_PLAUSIBLE_AA_FIRST_ANSWER_S ? aa.firstAnswerTokenS : void 0;
254
+ if (!isFiniteNumber3(aa.outputSpeedTps) && firstAnswerTokenS === void 0) {
255
+ return null;
256
+ }
257
+ return {
258
+ source: "aa",
259
+ ...firstAnswerTokenS !== void 0 ? { firstAnswerTokenS } : {},
260
+ ...isFiniteNumber3(aa.outputSpeedTps) ? { outputTps: aa.outputSpeedTps } : {},
261
+ measuredAt: aa.measuredAt
262
+ };
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\u6700\u8FD1\u8C03\u7528\u4E2D\u4F4D\u6570, firstOutput \u542B\u63A8\u7406\u8F93\u51FA; aa=Artificial Analysis \u5FEB\u7167, firstAnswer \u542B\u601D\u8003\u65F6\u95F4, \u4E24\u6E90\u4E0D\u53EF\u76F4\u63A5\u6BD4\u8F83; tps=n/a \u8868\u793A\u65E0\u53EF\u4FE1\u541E\u5410\u6837\u672C):";
283
+ function formatCandidateSpeedFacts(facts) {
284
+ if (facts.length === 0) return null;
285
+ const lines = facts.map((fact) => {
286
+ if (fact.source === "observed") {
287
+ const tps = fact.outputTps !== void 0 ? formatTps(fact.outputTps) : "n/a";
288
+ return ` ${fact.model}: firstOutput=${formatSeconds(fact.firstOutputMs ?? 0)} tps=${tps} [observed n=${fact.firstOutputSamples ?? 0} tpsN=${fact.tpsSamples ?? 0}]`;
289
+ }
290
+ const parts = [];
291
+ if (fact.firstAnswerTokenS !== void 0) parts.push(`firstAnswer=${fact.firstAnswerTokenS.toFixed(1)}s`);
292
+ parts.push(`tps=${fact.outputTps !== void 0 ? formatTps(fact.outputTps) : "n/a"}`);
293
+ return ` ${fact.model}: ${parts.join(" ")} [aa measuredAt=${fact.measuredAt}]`;
294
+ });
295
+ return `${SPEED_CONTEXT_HEADER}
296
+ ${lines.join("\n")}`;
297
+ }
298
+ function buildCandidateSpeedContext(models, samplesByModel) {
299
+ return formatCandidateSpeedFacts(resolveCandidateSpeedFacts(models, samplesByModel));
300
+ }
301
+ var SPEED_SAMPLE_PAGE_SIZE = 2e3;
302
+ var eventTime = (value) => {
303
+ if (isFiniteNumber3(value.timestamp)) return value.timestamp;
304
+ if (isFiniteNumber3(value.createdAt)) return value.createdAt;
305
+ return 0;
306
+ };
307
+ function collectSample(collected, value) {
308
+ if (typeof value.model !== "string") return;
309
+ if (!isFiniteNumber3(value.firstOutputMs) && !isFiniteNumber3(value.callDurationMs)) return;
310
+ const model = normalizeSpeedModelName(value.model);
311
+ if (!model) return;
312
+ const list = collected.get(model) ?? [];
313
+ list.push({
314
+ t: eventTime(value),
315
+ firstOutputMs: value.firstOutputMs,
316
+ callDurationMs: value.callDurationMs,
317
+ output_tokens: value.output_tokens
318
+ });
319
+ collected.set(model, list);
320
+ }
321
+ function finalizeSamples(collected) {
322
+ const result = /* @__PURE__ */ new Map();
323
+ for (const [model, list] of collected) {
324
+ list.sort((a, b) => b.t - a.t);
325
+ result.set(
326
+ model,
327
+ list.slice(0, OBSERVED_SPEED_WINDOW).map(({ t: _t, ...sample }) => sample)
328
+ );
329
+ }
330
+ return result;
331
+ }
332
+ async function collectRecentSpeedSamples(db, userId, options = {}) {
333
+ const pageSize = isFiniteNumber3(options.pageSize) && options.pageSize > 0 ? Math.floor(options.pageSize) : SPEED_SAMPLE_PAGE_SIZE;
334
+ const budgetMs = isFiniteNumber3(options.budgetMs) ? options.budgetMs : Number.POSITIVE_INFINITY;
335
+ const { start, end } = createTokenKey.rangeOfUser(userId);
336
+ const failedPrefix = createKey("token", userId, "failed-call", "");
337
+ const collected = /* @__PURE__ */ new Map();
338
+ const startedAt = Date.now();
339
+ let lastKey;
340
+ let budgetExhausted = false;
341
+ while (true) {
342
+ if (Date.now() - startedAt >= budgetMs) {
343
+ budgetExhausted = true;
344
+ break;
345
+ }
346
+ const pageOptions = {
347
+ ...lastKey === void 0 ? { gte: start } : { gt: lastKey },
348
+ lte: end,
349
+ limit: pageSize
350
+ };
351
+ let accepted = 0;
352
+ let newestKey = lastKey;
353
+ for await (const [key, raw] of db.iterator(pageOptions)) {
354
+ if (typeof key !== "string") continue;
355
+ if (lastKey !== void 0 && key <= lastKey) continue;
356
+ accepted += 1;
357
+ newestKey = key;
358
+ if (key.startsWith(failedPrefix)) continue;
359
+ if (!raw || typeof raw !== "object") continue;
360
+ collectSample(collected, raw);
361
+ }
362
+ if (accepted === 0 || accepted < pageSize) break;
363
+ lastKey = newestKey;
364
+ }
365
+ return { samples: finalizeSamples(collected), budgetExhausted };
366
+ }
367
+ async function loadRecentSpeedSamples(db, userId, options = {}) {
368
+ const { samples } = await collectRecentSpeedSamples(db, userId, options);
369
+ return samples;
370
+ }
371
+ async function loadSpeedSamplesWithDiskCache(db, userId, now, cache) {
372
+ try {
373
+ const ttlMs = isFiniteNumber3(cache.ttlMs) ? cache.ttlMs : SPEED_SAMPLE_DISK_CACHE_TTL_MS;
374
+ const cached = await readSpeedSamplesCache(cache.cachePath, { userId, now, ttlMs });
375
+ if (cached) return cached;
376
+ const { samples, budgetExhausted } = await collectRecentSpeedSamples(db, userId, {
377
+ pageSize: cache.pageSize,
378
+ budgetMs: isFiniteNumber3(cache.budgetMs) ? cache.budgetMs : SPEED_SAMPLE_SCAN_BUDGET_MS
379
+ });
380
+ if (budgetExhausted) return /* @__PURE__ */ new Map();
381
+ await writeSpeedSamplesCache(cache.cachePath, {
382
+ version: SPEED_SAMPLE_CACHE_VERSION,
383
+ userId,
384
+ at: now,
385
+ samples: Object.fromEntries(samples)
386
+ });
387
+ return samples;
388
+ } catch {
389
+ return /* @__PURE__ */ new Map();
390
+ }
391
+ }
392
+ var samplesCache = /* @__PURE__ */ new Map();
393
+ function writeSamplesCache(userId, now, samples) {
394
+ for (const [key, entry] of samplesCache) {
395
+ if (now - entry.at >= SPEED_SAMPLES_CACHE_TTL_MS) samplesCache.delete(key);
396
+ }
397
+ samplesCache.delete(userId);
398
+ samplesCache.set(userId, { at: now, samples });
399
+ while (samplesCache.size > SPEED_SAMPLES_CACHE_MAX_ENTRIES) {
400
+ const oldest = samplesCache.keys().next().value;
401
+ if (oldest === void 0) break;
402
+ samplesCache.delete(oldest);
403
+ }
404
+ }
405
+ async function loadCachedSpeedSamples(db, userId, now) {
406
+ const hit = samplesCache.get(userId);
407
+ if (hit && now - hit.at < SPEED_SAMPLES_CACHE_TTL_MS) return hit.samples;
408
+ const samples = await loadRecentSpeedSamples(db, userId);
409
+ writeSamplesCache(userId, now, samples);
410
+ return samples;
411
+ }
412
+ async function injectSpeedContextIntoListAgentsResult(result, options = {}) {
413
+ try {
414
+ let parsed;
415
+ try {
416
+ parsed = JSON.parse(result);
417
+ } catch {
418
+ return result;
419
+ }
420
+ if (!parsed || typeof parsed !== "object" || !Array.isArray(parsed.agents)) return result;
421
+ const models = parsed.agents.map((agent) => agent?.model).filter((model) => typeof model === "string");
422
+ if (models.length === 0) return result;
423
+ const now = options.now ?? Date.now();
424
+ let samples = /* @__PURE__ */ new Map();
425
+ const userId = typeof options.userId === "string" ? options.userId.trim() : "";
426
+ if (options.db && userId) {
427
+ try {
428
+ samples = options.diskCache ? await loadSpeedSamplesWithDiskCache(options.db, userId, now, options.diskCache) : await loadCachedSpeedSamples(options.db, userId, now);
429
+ } catch {
430
+ samples = /* @__PURE__ */ new Map();
431
+ }
432
+ }
433
+ const speedContext = buildCandidateSpeedContext(models, samples);
434
+ return speedContext ? JSON.stringify({ ...parsed, speedContext }) : result;
435
+ } catch {
436
+ return result;
437
+ }
438
+ }
439
+
440
+ // packages/cli/agentListCommands.ts
441
+ import path from "node:path";
442
+ var discardOutput = { write: () => void 0 };
443
+ function resolveSpeedSamplesCachePath(env, userId) {
444
+ const safeUserId = userId.replace(/[^A-Za-z0-9._-]/g, "_");
445
+ const mergedEnv = { ...process.env, ...env };
446
+ return path.join(resolveNoloHome({ env: mergedEnv }), "cache", `speed-samples-${safeUserId}.json`);
447
+ }
448
+ async function runAgentListCommand(args, deps = {}) {
449
+ const env = deps.env ?? process.env;
450
+ const output = deps.output ?? process.stdout;
451
+ const { wantJson, wantSafe, publicOnly, scope: requestedScope, idsOnly, showUnavailable, verbose, query } = parseAgentListArgs(args);
452
+ if (requestedScope && !["preferred", "public", "all"].includes(requestedScope)) {
453
+ throw new Error(`Invalid scope '${requestedScope}'`);
454
+ }
455
+ if (requestedScope && publicOnly && requestedScope !== "public") {
456
+ throw new Error(`Conflicting arguments: scope='${requestedScope}' conflicts with publicOnly=true.`);
457
+ }
458
+ const scope = requestedScope ?? "preferred";
459
+ const spaceInput = readOption(args, "--space") ?? readOption(args, "--space-id");
460
+ const authToken = resolveAuthToken(args, env);
461
+ if (!authToken) {
462
+ output.write("[nolo] agent list requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
463
+ return 1;
464
+ }
465
+ const userId = parseUserIdFromAuthToken(authToken);
466
+ if (!userId) {
467
+ output.write("[nolo] agent list could not read userId from AUTH_TOKEN.\n");
468
+ return 1;
469
+ }
470
+ const fetchImpl = deps.fetchImpl ?? fetch;
471
+ const fallbackFetchImpl = deps.fallbackFetchImpl;
472
+ const serverUrl = resolveServerUrl(args, env);
473
+ const serverUrls = resolveServerCandidates(args, env, serverUrl);
474
+ try {
475
+ let agents;
476
+ let source;
477
+ let serverFailures = [];
478
+ try {
479
+ const remoteResult = await listRemoteAgentsAcrossServers({
480
+ authToken,
481
+ fallbackFetchImpl,
482
+ fetchImpl,
483
+ serverUrls,
484
+ userId
485
+ });
486
+ agents = remoteResult.agents;
487
+ serverFailures = remoteResult.failures;
488
+ source = "global-cache";
489
+ } catch {
490
+ try {
491
+ const db = deps.db ?? await getReadableCliDb(output);
492
+ agents = await listLocalCachedAgents({ db, userId });
493
+ source = "local-cache";
494
+ } catch {
495
+ agents = await listRemoteAgents({
496
+ authToken,
497
+ fallbackFetchImpl,
498
+ fetchImpl,
499
+ serverUrl,
500
+ userId,
501
+ queryUserRecords,
502
+ readDbRecord
503
+ });
504
+ source = "remote-cache";
505
+ }
506
+ }
507
+ if (scope !== "preferred") {
508
+ const publicAgents = await Promise.all(serverUrls.map((url) => listRemotePublicAgents({
509
+ authToken,
510
+ fetchImpl,
511
+ serverUrl: url,
512
+ limit: 500
513
+ })));
514
+ agents = publicAgents.flat();
515
+ if (scope === "all") {
516
+ const preferred = await listRemoteAgentsAcrossServers({
517
+ authToken,
518
+ fallbackFetchImpl,
519
+ fetchImpl,
520
+ serverUrls,
521
+ userId
522
+ });
523
+ agents = [...preferred.agents, ...agents];
524
+ }
525
+ }
526
+ agents = agents.filter((agent) => agent.privateKey.startsWith("agent-"));
527
+ let resolvedSpaceId = null;
528
+ let spaceContentKeys = null;
529
+ if (spaceInput) {
530
+ const { spaceId, spaceKey } = buildSpaceLookup(spaceInput);
531
+ resolvedSpaceId = spaceId;
532
+ const spaceRead = await readLiveDbRecordAfterTombstoneMerge({
533
+ authToken,
534
+ dbKey: spaceKey,
535
+ fallbackFetchImpl,
536
+ fetchImpl,
537
+ serverUrls
538
+ });
539
+ serverFailures = [...serverFailures, ...spaceRead.failures];
540
+ const spaceRecord = spaceRead.record;
541
+ const currentSpaceContentKeys = getSpaceContentKeys(spaceRecord);
542
+ spaceContentKeys = currentSpaceContentKeys;
543
+ agents = agents.filter(
544
+ (agent) => currentSpaceContentKeys.has(agent.privateKey) || currentSpaceContentKeys.has(agent.publicKey) || currentSpaceContentKeys.has(agent.id)
545
+ );
546
+ }
547
+ if (source === "global-cache") {
548
+ await decorateAgentsWithPublicStatusAcrossServers({
549
+ agents,
550
+ authToken,
551
+ fallbackFetchImpl,
552
+ fetchImpl,
553
+ serverUrls
554
+ });
555
+ }
556
+ if (publicOnly) {
557
+ agents = agents.filter((agent) => agent.publicRecordExists);
558
+ }
559
+ agents = applyCredentialAvailability(
560
+ agents,
561
+ await readCredentialAvailability(env).catch(() => ({}))
562
+ );
563
+ const unavailableCount = agents.filter((agent) => isAgentUnavailableNow(agent)).length;
564
+ let agentsForOutput = showUnavailable ? agents : agents.filter((agent) => !isAgentUnavailableNow(agent));
565
+ if (query && typeof query === "string" && query.trim()) {
566
+ agentsForOutput = agentsForOutput.filter((agent) => matchesAgentQuery(agent, query));
567
+ }
568
+ if (idsOnly) {
569
+ output.write(`${agentsForOutput.map((agent) => agent.id).join("\n")}
570
+ `);
571
+ return 0;
572
+ }
573
+ if (wantSafe) {
574
+ const favoritesMap = await listFavoriteAgentIdsAcrossServers({
575
+ authToken,
576
+ fetchImpl,
577
+ serverUrls
578
+ }).catch(() => ({}));
579
+ const existingKeys = /* @__PURE__ */ new Set();
580
+ for (const agent of agents) {
581
+ existingKeys.add(agent.privateKey);
582
+ existingKeys.add(agent.publicKey);
583
+ existingKeys.add(agent.id);
584
+ }
585
+ const extraFavoriteRecords = [];
586
+ const hydratedFavoriteAgents = [];
587
+ for (const favKey of Object.keys(favoritesMap)) {
588
+ if (existingKeys.has(favKey)) continue;
589
+ try {
590
+ const favRead = await readLiveDbRecordAfterTombstoneMerge({
591
+ authToken,
592
+ dbKey: favKey,
593
+ fallbackFetchImpl,
594
+ fetchImpl,
595
+ serverUrls
596
+ });
597
+ const record = favRead.record;
598
+ if (!record || record.type && record.type !== "agent") continue;
599
+ const norm = normalizeListedAgent(record);
600
+ const candidateKeys = [record.dbKey, record.publicKey, record.id].filter((key) => typeof key === "string" && key.length > 0);
601
+ if (spaceContentKeys && !candidateKeys.some((key) => spaceContentKeys?.has(key))) {
602
+ continue;
603
+ }
604
+ if (norm) {
605
+ if (!favKey.startsWith("agent-pub-")) {
606
+ norm.verifiedAgentKey = favKey;
607
+ if (typeof record.userId === "string" && record.userId) {
608
+ norm.ownerId = record.userId;
609
+ }
610
+ }
611
+ agents.push(norm);
612
+ hydratedFavoriteAgents.push(norm);
613
+ existingKeys.add(norm.privateKey);
614
+ existingKeys.add(norm.publicKey);
615
+ existingKeys.add(norm.id);
616
+ } else {
617
+ extraFavoriteRecords.push(record);
618
+ for (const key of candidateKeys) existingKeys.add(key);
619
+ }
620
+ } catch {
621
+ }
622
+ }
623
+ if (source === "global-cache" && hydratedFavoriteAgents.length > 0) {
624
+ await decorateAgentsWithPublicStatusAcrossServers({
625
+ agents: hydratedFavoriteAgents,
626
+ authToken,
627
+ fallbackFetchImpl,
628
+ fetchImpl,
629
+ serverUrls
630
+ });
631
+ }
632
+ const safeRecords = [...agents, ...extraFavoriteRecords].map((record) => toDiscoverySafeAgentSummary(record, { favoritesMap, userId })).filter((agent) => publicOnly ? agent.isPublic === true : true);
633
+ const discovery = buildAgentDiscoveryResult({
634
+ agents: safeRecords,
635
+ scope: "all",
636
+ query,
637
+ showUnavailable,
638
+ verbose
639
+ });
640
+ const listResult = JSON.stringify({
641
+ success: true,
642
+ userId,
643
+ ...resolvedSpaceId ? { spaceId: resolvedSpaceId } : {},
644
+ total: discovery.total,
645
+ unavailableCount: discovery.unavailableCount,
646
+ unavailableAgents: discovery.unavailableAgents,
647
+ credentialGroups: discovery.credentialGroups,
648
+ agents: discovery.agents
649
+ }, null, 2);
650
+ const withSpeedContext = await injectSpeedContextIntoListAgentsResult(listResult, {
651
+ db: deps.db ?? await getReadableCliDb(discardOutput),
652
+ userId,
653
+ diskCache: { cachePath: resolveSpeedSamplesCachePath(env, userId) }
654
+ });
655
+ output.write(withSpeedContext);
656
+ output.write("\n");
657
+ return 0;
658
+ }
659
+ if (wantJson) {
660
+ const credentialGroups = summarizeCredentialGroups(agentsForOutput);
661
+ output.write(JSON.stringify({
662
+ userId,
663
+ ...resolvedSpaceId ? { spaceId: resolvedSpaceId } : {},
664
+ targetServers: serverUrls,
665
+ ...serverFailures.length ? { serverFailures } : {},
666
+ total: agentsForOutput.length,
667
+ publicCount: agentsForOutput.filter((agent) => agent.publicRecordExists).length,
668
+ unavailableCount,
669
+ credentialGroups,
670
+ source,
671
+ agents: agentsForOutput
672
+ }, null, 2));
673
+ output.write("\n");
674
+ return 0;
675
+ }
676
+ output.write(`userId: ${userId}
677
+ `);
678
+ if (resolvedSpaceId) {
679
+ output.write(`spaceId: ${resolvedSpaceId}
680
+ `);
681
+ }
682
+ output.write(`targetServers: ${serverUrls.join(", ")}
683
+ `);
684
+ if (serverFailures.length) {
685
+ output.write(`serverFailures: ${serverFailures.length}
686
+ `);
687
+ }
688
+ output.write(`total agents: ${agentsForOutput.length}
689
+ `);
690
+ output.write(`public agents: ${agentsForOutput.filter((agent) => agent.publicRecordExists).length}
691
+ `);
692
+ if (unavailableCount > 0 && !showUnavailable) {
693
+ output.write(`\u26D4 ${unavailableCount} agent(s) temporarily unavailable (429) hidden. Use --show-unavailable to list them.
694
+ `);
695
+ }
696
+ output.write(`source: ${source}
697
+ `);
698
+ if (agentsForOutput.length === 0) {
699
+ output.write("\n(no agents found)\n");
700
+ return 0;
701
+ }
702
+ for (const agent of agentsForOutput) {
703
+ const status = agent.publicRecordExists ? "public" : "private";
704
+ const flagMismatch = agent.isPublicFlag !== agent.publicRecordExists ? ` flag=${agent.isPublicFlag}` : "";
705
+ const credentialLine = agent.credentialConfigured ? `credentialConfigured=true${agent.credentialRef ? ` credentialRef=${agent.credentialRef}` : ""}${agent.apiKeyRef ? ` apiKeyRef=${agent.apiKeyRef}` : ""}` : "credentialConfigured=false";
706
+ const availabilityLine = typeof agent.nextAvailableAt === "number" && agent.nextAvailableAt > Date.now() ? `nextAvailableAt=${new Date(agent.nextAvailableAt).toISOString()}` : "nextAvailableAt=now";
707
+ const quotaSummary = formatQuotaSummary(agent.quota);
708
+ const quotaLine = `quota=${quotaSummary ?? "-"}`;
709
+ output.write(
710
+ [
711
+ `
712
+ [${status}] ${agent.name}`,
713
+ `id=${agent.id}`,
714
+ `type=${agent.type ?? "-"}`,
715
+ `model=${agent.model}`,
716
+ `updatedAt=${agent.updatedAt ?? "-"}`,
717
+ // 不输出 privateKey(dbKey 属敏感标识,与 web 端 listAgentsFunc 降权
718
+ // 对齐;需要完整记录请用 --json)。
719
+ // 私有 agent(publicRecordExists=false)的公开记录不存在,输出 "-" 而非
720
+ // 一个库里不存在的 agent-pub-<id>,避免误导调用方拿它去 readAgent。
721
+ `publicKey=${agent.publicRecordExists ? agent.publicKey : "-"}${flagMismatch}`,
722
+ `tools=${agent.tools.join(", ") || "-"}`,
723
+ credentialLine,
724
+ availabilityLine,
725
+ quotaLine
726
+ ].join("\n")
727
+ );
728
+ output.write("\n");
729
+ }
730
+ return 0;
731
+ } catch (error) {
732
+ output.write(
733
+ `[nolo] agent list failed: ${toErrorMessage(error)}
734
+ `
735
+ );
736
+ return 1;
737
+ }
738
+ }
739
+ export {
740
+ resolveSpeedSamplesCachePath,
741
+ runAgentListCommand
742
+ };