nolo-cli 0.228.0 → 0.228.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/{_executeModel-GIFVXKDT.js → _executeModel-AKCTHGMP.js} +62 -61
  2. package/{action-WZTKEF5H.js → action-C6IQAKN4.js} +6 -6
  3. package/{addContentAction-MLI6GOBV.js → addContentAction-53364YDW.js} +10 -10
  4. package/{addDialogAgentAction-ARGQM22H.js → addDialogAgentAction-U5DD5EN5.js} +9 -9
  5. package/{agentDeleteCommand-UF7XVELS.js → agentDeleteCommand-2E5FAGUO.js} +99 -93
  6. package/{agentEmailCommands-SFHRPQYC.js → agentEmailCommands-UGZZAH7E.js} +99 -93
  7. package/{agentListCommands-IXKBP3W5.js → agentListCommands-JCTW3J2K.js} +240 -52
  8. package/{agentMachineCommands-7NX6PWQ6.js → agentMachineCommands-QPG5ZXF4.js} +45 -41
  9. package/{agentProviderCommands-C5T7C5KZ.js → agentProviderCommands-QLTABYR7.js} +2 -2
  10. package/{agentPullCommand-4EQZYHU4.js → agentPullCommand-2EYJ5ENC.js} +1 -1
  11. package/{agentRecordCommands-IUNX6XD6.js → agentRecordCommands-4NTVR6MZ.js} +98 -92
  12. package/{agentRunCommand-LCR4XADM.js → agentRunCommand-VHF34PYC.js} +103 -94
  13. package/{agentRunControl-RN2P6AOD.js → agentRunControl-QYTXUQGY.js} +10 -7
  14. package/{agentRuntimeLocal-LVXPQ7QA.js → agentRuntimeLocal-U54AKHXH.js} +38 -36
  15. package/{agentSlice-ZGMOH6TE.js → agentSlice-4JGDEXWK.js} +10 -10
  16. package/{appDeleteCommands-BESCJOQM.js → appDeleteCommands-XBE5QJ6P.js} +46 -42
  17. package/{appDeployCommands-LPTR6IOX.js → appDeployCommands-QIYLXXGA.js} +46 -42
  18. package/{appDeployStatusCommands-BZ7KZ5RD.js → appDeployStatusCommands-JXS6ZQZZ.js} +46 -42
  19. package/{appGetCommands-EDWGJV4S.js → appGetCommands-SZS7SJPK.js} +46 -42
  20. package/{appListCommands-OPRWYPM6.js → appListCommands-B3GBJSNV.js} +46 -42
  21. package/{authCommand-3C3RN4OU.js → authCommand-V6EOMZX6.js} +15 -15
  22. package/{authCommands-ZMVEDCQD.js → authCommands-T5FODCEG.js} +2 -2
  23. package/{builtinSkillRegistry-VRCMQ77Q.js → builtinSkillRegistry-ZQC3IIO2.js} +4 -3
  24. package/{chromeOpsCommands-NZITLHWO.js → chromeOpsCommands-OFX7ZGKP.js} +2 -2
  25. package/{chunk-MZVCFV3T.js → chunk-223KZUJ6.js} +4 -4
  26. package/{chunk-UF6J7NXV.js → chunk-2C5VN7NH.js} +1 -1
  27. package/{chunk-MAA42MMV.js → chunk-2FZVXOFX.js} +4 -4
  28. package/{chunk-ESN4WNWU.js → chunk-2JHGUL5K.js} +2 -2
  29. package/chunk-3A5NNQCN.js +64 -0
  30. package/chunk-3F2FRLIO.js +372 -0
  31. package/{chunk-V4IYI3SB.js → chunk-46FETNLF.js} +2 -2
  32. package/{chunk-RR3MB26M.js → chunk-4GYVS4PM.js} +8 -6
  33. package/{chunk-ZQ6K57FJ.js → chunk-4YPH5KRA.js} +1 -1
  34. package/{chunk-Y4NPF2UN.js → chunk-5AYP5QBB.js} +5 -5
  35. package/{chunk-4OXPN3WC.js → chunk-5ISNPTQH.js} +4 -4
  36. package/{chunk-CO6E7YK6.js → chunk-5P3PPQVP.js} +1 -1
  37. package/{chunk-6TVYUQRM.js → chunk-6BMTKYAO.js} +2 -2
  38. package/{chunk-KLAMJNKQ.js → chunk-6PAHSSD2.js} +15 -8
  39. package/{chunk-CTWCZKNS.js → chunk-6SOWMEAY.js} +4 -4
  40. package/{chunk-ARFCL53U.js → chunk-6VEO7Z3Y.js} +5 -5
  41. package/{chunk-ZM5AZTQG.js → chunk-7BIJFGKS.js} +20 -8
  42. package/{chunk-BAH3BAUZ.js → chunk-7OVOZRZF.js} +5 -5
  43. package/{chunk-N74XL3NI.js → chunk-7PON4LBY.js} +42 -24
  44. package/{chunk-LTVEOOZL.js → chunk-7WHCIA5V.js} +16 -3
  45. package/{chunk-HZDK56EK.js → chunk-ADYWV732.js} +34 -12
  46. package/{chunk-2FK2KZSL.js → chunk-AIFQKNPP.js} +1 -1
  47. package/{chunk-VTHWBTRE.js → chunk-BPB3T5EU.js} +5 -8
  48. package/{chunk-SX6AWTNK.js → chunk-BZLGPM5B.js} +3 -3
  49. package/{chunk-MTM4LRVG.js → chunk-BZMDWGQQ.js} +2 -2
  50. package/{chunk-JP2BH4NC.js → chunk-CEKRIR22.js} +1 -1
  51. package/{chunk-5HUO7SEX.js → chunk-D634SL2Y.js} +1 -1
  52. package/{chunk-SCMYAGQE.js → chunk-DHRPLRIR.js} +294 -159
  53. package/{chunk-VUHKG4KS.js → chunk-DNNPARJK.js} +9 -5
  54. package/{chunk-X22AUZKL.js → chunk-E3LSO6EI.js} +189 -88
  55. package/{chunk-LHCGKAFO.js → chunk-EHFBP6IK.js} +100 -48
  56. package/{chunk-6ASGEP5D.js → chunk-EJQE5HB7.js} +1 -1
  57. package/{chunk-2BKNICGK.js → chunk-EL5NRJHI.js} +1 -1
  58. package/chunk-EUGTFFO6.js +42 -0
  59. package/{chunk-YFW4H6DL.js → chunk-EVHTYVD2.js} +821 -131
  60. package/{chunk-6XRPBZRS.js → chunk-EYLGAEB4.js} +0 -134
  61. package/{chunk-E5RYFR7E.js → chunk-FEIVARWR.js} +49 -15
  62. package/{chunk-3DJJ4CFG.js → chunk-FLBJ7IJI.js} +9 -9
  63. package/{chunk-W3HSD32M.js → chunk-FXEPZKNJ.js} +2 -2
  64. package/{chunk-VKCPKCSS.js → chunk-FYAMUU55.js} +625 -62
  65. package/{chunk-JEWMQR6J.js → chunk-FZANZZ63.js} +1 -1
  66. package/{chunk-WWTSEBDF.js → chunk-GIXWVN2W.js} +1 -1
  67. package/{chunk-YHNUDTU4.js → chunk-HDKMVYNJ.js} +4 -4
  68. package/chunk-HEVRQGGH.js +106 -0
  69. package/{chunk-PBPXXMWZ.js → chunk-HFHJPHFK.js} +1 -1
  70. package/{chunk-WQDTSK5U.js → chunk-HPDLPEUG.js} +11 -5
  71. package/{chunk-SPU3L3OR.js → chunk-HQUGB2HM.js} +3 -3
  72. package/chunk-IVK2KT3H.js +209 -0
  73. package/{chunk-73PZD7JZ.js → chunk-IYLUK67R.js} +2 -2
  74. package/{chunk-BFKJ2RS3.js → chunk-J55F3IEZ.js} +1 -1
  75. package/{chunk-ADOOL3PG.js → chunk-J7JRCOIW.js} +1 -1
  76. package/{chunk-AEZBAFC6.js → chunk-JAKRY74O.js} +138 -8
  77. package/{chunk-NEG5LYK5.js → chunk-JCQ3WCQ3.js} +3 -1
  78. package/{chunk-W6T4FNZP.js → chunk-JLZJL3WC.js} +219 -351
  79. package/{chunk-PQ63BDV3.js → chunk-JPXACKSW.js} +9 -1
  80. package/{chunk-IIOSZAJX.js → chunk-KDBDOXOM.js} +137 -53
  81. package/{chunk-CIGCTSBF.js → chunk-KDDHQMSH.js} +1 -1
  82. package/{chunk-OAZP4TSA.js → chunk-KG27JIG4.js} +2 -2
  83. package/{chunk-RHBD22LV.js → chunk-KHYSFS3W.js} +80 -4
  84. package/{chunk-7UVVLYKC.js → chunk-KKIQAVDR.js} +5 -5
  85. package/{chunk-HS7MLR74.js → chunk-KZ4A7EIV.js} +3 -5
  86. package/{chunk-OLGFIQN2.js → chunk-LLUBUHNT.js} +1 -1
  87. package/{chunk-QJTZ76CP.js → chunk-LS5KAVFQ.js} +1 -0
  88. package/{chunk-K26XPZRB.js → chunk-LVZVSLKO.js} +29 -9
  89. package/{chunk-XJSEST7D.js → chunk-MNFUKRRU.js} +3 -3
  90. package/{chunk-R5NRFXGD.js → chunk-O3A2CHAL.js} +5 -5
  91. package/{chunk-4IQN6FWY.js → chunk-OB4FBZXJ.js} +4 -4
  92. package/{chunk-J2VIGDJN.js → chunk-OJSJJKHF.js} +3 -3
  93. package/{chunk-OHUYN3YU.js → chunk-OKAXQFON.js} +1 -1
  94. package/{chunk-CD2DK5JA.js → chunk-OKH74FML.js} +2 -1
  95. package/{chunk-MYYNZG2M.js → chunk-OOV5JN25.js} +4 -4
  96. package/{chunk-TMRJGSK2.js → chunk-OOVOAG4Q.js} +1 -1
  97. package/chunk-OQFOE4SJ.js +405 -0
  98. package/{chunk-AS6L5KSD.js → chunk-P4R5KXU7.js} +2 -2
  99. package/{chunk-VIYVRPMJ.js → chunk-PHREU2KZ.js} +5 -3
  100. package/{chunk-EDT65EUE.js → chunk-PIVTQRX6.js} +45 -15
  101. package/{chunk-QMNVV3YM.js → chunk-PJL7OJRC.js} +12 -11
  102. package/{chunk-XCA4WHX5.js → chunk-PNLDLUMO.js} +315 -360
  103. package/{chunk-UPOW5HTG.js → chunk-QGFLVQ6E.js} +3 -3
  104. package/{chunk-JU7VN4LF.js → chunk-QONAOHVW.js} +6 -6
  105. package/{chunk-UOUMPHS5.js → chunk-R3FZHW4Q.js} +13 -13
  106. package/{chunk-K7VIXYTZ.js → chunk-R3MV2GII.js} +1 -45
  107. package/{chunk-FE7G6DSP.js → chunk-R72QWIFO.js} +14 -4
  108. package/{chunk-KZAT2M2V.js → chunk-RIWKZT7E.js} +22 -0
  109. package/{chunk-RMWDKLBE.js → chunk-S7H4KTMB.js} +1099 -71
  110. package/{chunk-IJZC2KIJ.js → chunk-SA356NGW.js} +1 -1
  111. package/{chunk-BVEDT6DM.js → chunk-SCAC3NM5.js} +3 -3
  112. package/{chunk-EQZQUQ33.js → chunk-SLUN7W6S.js} +5 -5
  113. package/{chunk-KK3FCYZM.js → chunk-SQL7YNED.js} +7 -4
  114. package/{chunk-LMGFVH65.js → chunk-SSOR2EDT.js} +10 -10
  115. package/chunk-TRRXYFTR.js +46 -0
  116. package/{chunk-XNTZD4AE.js → chunk-TUOHSUK5.js} +19367 -17503
  117. package/chunk-TYJCIA2O.js +835 -0
  118. package/{chunk-FTWAOKFU.js → chunk-U3BUWDUP.js} +415 -1962
  119. package/{chunk-CD64YXRB.js → chunk-U6QNVOR5.js} +1 -1
  120. package/chunk-UAF5VQCE.js +77 -0
  121. package/{chunk-CIUZXD5D.js → chunk-UFGUJ2IH.js} +5 -5
  122. package/{chunk-CTIEJRTP.js → chunk-UP7KBWLE.js} +81 -29
  123. package/{chunk-GX6DITLQ.js → chunk-UUCYUN6Y.js} +1 -1
  124. package/{chunk-UHW6SCVK.js → chunk-UZKBVQUX.js} +1 -1
  125. package/{chunk-XSRSAU3O.js → chunk-V5TI7HJH.js} +3 -3
  126. package/{chunk-WFGNWWJI.js → chunk-VH7UO6E5.js} +252 -114
  127. package/{chunk-ITBX27W6.js → chunk-VJFDG3ZG.js} +30 -122
  128. package/{chunk-6MTVACLN.js → chunk-WC3J5SL2.js} +277 -293
  129. package/{chunk-HCCQEMTK.js → chunk-WD5547ZF.js} +15 -12
  130. package/{chunk-X3OZ655T.js → chunk-WS36XPJD.js} +2 -2
  131. package/{chunk-JFRJEPFI.js → chunk-WSLL7VV4.js} +2 -2
  132. package/chunk-XRGBJHZX.js +136 -0
  133. package/{chunk-KZ5OD2MO.js → chunk-Y2KWJTOZ.js} +3 -3
  134. package/{dialogUsageCommand-6RW2FY6K.js → chunk-Y2TCTNUD.js} +24 -17
  135. package/{chunk-FFFKAOJN.js → chunk-YN23INFZ.js} +1 -1
  136. package/{chunk-ODBYGVO2.js → chunk-YXK3GJF5.js} +5 -5
  137. package/{chunk-6CXQ3YNJ.js → chunk-Z2OWAYMI.js} +53 -31
  138. package/{chunk-6XVPMGXK.js → chunk-ZTHAJU3O.js} +10 -4
  139. package/{chunk-D25ONVOH.js → chunk-ZYPXOQS2.js} +1 -1
  140. package/{cliAgentConfigHelpers-37ZNEY5Y.js → cliAgentConfigHelpers-BXHQ3PXP.js} +8 -8
  141. package/{cliAuthorityBrokerClient-SFPC3WVK.js → cliAuthorityBrokerClient-TFNXJLXL.js} +1 -1
  142. package/cliAuthorityBrokerProcess-5ZFBTHLB.js +22 -0
  143. package/{cliLocalAgentRecordReader-MCQVRWBR.js → cliLocalAgentRecordReader-47PXMHPH.js} +43 -41
  144. package/{commandRegistry-NTH5IAN5.js → commandRegistry-CTMPAQH2.js} +93 -156
  145. package/{contentThunks-SPXTX5U2.js → contentThunks-CAHIIZO5.js} +25 -25
  146. package/{cooldownCommands-TIFCHCUN.js → cooldownCommands-WDOI5VD7.js} +3 -3
  147. package/{createAgentAutomationAction-KUQKCOXB.js → createAgentAutomationAction-M25XZSPD.js} +25 -25
  148. package/{createDialogAction-HJN5U3XS.js → createDialogAction-4SN7FKI7.js} +26 -26
  149. package/{createPageAction-ZAHRDOAU.js → createPageAction-N7QPDN3M.js} +28 -28
  150. package/{db-CMUTP3W5.js → db-VR74ADGC.js} +7 -2
  151. package/{dbSlice-656PMWR2.js → dbSlice-RWPSVHBC.js} +9 -9
  152. package/{deleteFile-ZCQESEEQ.js → deleteFile-ECU6FU5C.js} +12 -7
  153. package/{dialogCommands-KZTZLWPZ.js → dialogCommands-BBHWCKDP.js} +57 -47
  154. package/{dialogNotifyCommand-PST75COP.js → dialogNotifyCommand-IASQGEMW.js} +9 -9
  155. package/{dialogSlice-BXIERQHO.js → dialogSlice-JI3J22RV.js} +23 -23
  156. package/dialogTraceCommand-EW2KK6A4.js +961 -0
  157. package/dialogUsageCommand-WJ3U6KZU.js +27 -0
  158. package/{docCreateCommands-26HJ5NAY.js → docCreateCommands-QSX3X5U4.js} +45 -41
  159. package/{docDeleteCommands-UAOHH5XK.js → docDeleteCommands-63JBG2HQ.js} +46 -42
  160. package/{docReadCommands-4ADG7YE6.js → docReadCommands-CQFKRQUI.js} +45 -41
  161. package/{docStore-FZ75HWP2.js → docStore-XLBKGGNM.js} +10 -10
  162. package/{docUpdateCommands-OGFJZENF.js → docUpdateCommands-534LUK25.js} +45 -41
  163. package/ebookDownloaderAgentCommand-DYSKF5ZY.js +677 -0
  164. package/{getPricing-FCHYVRJU.js → getPricing-5BLZRPTM.js} +3 -3
  165. package/{handleSendMessageAction-KP6GGBFY.js → handleSendMessageAction-Q2VMEVOR.js} +90 -48
  166. package/{hostCredentialCreate-23TX56G7.js → hostCredentialCreate-C57T7YPE.js} +99 -93
  167. package/index.js +23 -11
  168. package/{localDialogRead-CIOTQM5T.js → localDialogRead-BJJT3TF5.js} +1 -1
  169. package/{localRuntimeAdapter-MTUWOYPN.js → localRuntimeAdapter-OALZPFZU.js} +96 -90
  170. package/{localRuntimeAuthority-TYHQCTZN.js → localRuntimeAuthority-UF2DAQ3F.js} +13 -3
  171. package/{localRuntimeDb-BO7IVWAZ.js → localRuntimeDb-ZJFGNHML.js} +1 -1
  172. package/{machineCommands-4WJUJQHW.js → machineCommands-N6IVWRZT.js} +109 -92
  173. package/{machineWsRunDispatch-V3U4JM67.js → machineWsRunDispatch-PDWYB33B.js} +97 -91
  174. package/{markdownToSlate-KIYM7B3P.js → markdownToSlate-PXYAIBVL.js} +1 -1
  175. package/{mcpLocalAuthorizeCommand-TI656UWC.js → mcpLocalAuthorizeCommand-KYI4EGF5.js} +17 -13
  176. package/{memberThunks-JFYC4Z5L.js → memberThunks-43B7UYC5.js} +11 -11
  177. package/{models-EP7VG6N2.js → models-ZX2BYIMB.js} +2 -2
  178. package/package.json +2 -1
  179. package/{projectArchive-NU2Z5HOR.js → projectArchive-TJNW5DLM.js} +28 -28
  180. package/{providerPresetApply-4H7YP5D7.js → providerPresetApply-NTJUINI6.js} +35 -16
  181. package/{providerRegistry-F3UPOTIY.js → providerRegistry-W45SLUV6.js} +5 -5
  182. package/{read-BRZHXUJ6.js → read-KG6INYUT.js} +12 -7
  183. package/{readDocTool-N7RVFQEE.js → readDocTool-N3GA52JR.js} +1 -1
  184. package/{readlineWorkspace-T56MRMS5.js → readlineWorkspace-PJZJVGA5.js} +1296 -1056
  185. package/{removeDialogAgentAction-J7XU7OUX.js → removeDialogAgentAction-EEVSOQOJ.js} +11 -11
  186. package/{runAgentClientLoop-O2GRCGRZ.js → runAgentClientLoop-3VC5TCDW.js} +69 -58
  187. package/{runtimeDoctorCommands-RDRJXMXC.js → runtimeDoctorCommands-V3M3JTUV.js} +14 -11
  188. package/{secretCommands-2FEMRUFM.js → secretCommands-KVVZS7A6.js} +2 -2
  189. package/{setDialogExtraReferencesAction-Q4V2ZZW2.js → setDialogExtraReferencesAction-DNO5POHA.js} +10 -10
  190. package/{setPrimaryDialogAgentAction-742H5S6T.js → setPrimaryDialogAgentAction-QABBEO4C.js} +11 -11
  191. package/{settingThunks-T4FXSV6M.js → settingThunks-DVKG4X4S.js} +13 -17
  192. package/{skillDiscovery-MDDKPTW3.js → skillDiscovery-ZMJH36AK.js} +3 -3
  193. package/{spaceCommands-W5TAVFDT.js → spaceCommands-AGGZXPY3.js} +218 -77
  194. package/{streamAgentChatTurn-OWDJMU5E.js → streamAgentChatTurn-4GTLL2OF.js} +111 -95
  195. package/{switchDialogAgentAction-HLDLHRRA.js → switchDialogAgentAction-KYWJSGOO.js} +9 -9
  196. package/{tableCommands-44GC4N6J.js → tableCommands-EFA754RE.js} +3 -3
  197. package/{tools-O7SGGVA3.js → tools-5AGPOPLW.js} +48 -47
  198. package/{tuiRestart-EOGC2BYY.js → tuiRestart-77E7PL4R.js} +9 -8
  199. package/{tuiSummaryLlmCaller-TM5BU73J.js → tuiSummaryLlmCaller-HROLGN4F.js} +12 -12
  200. package/{updateCommands-FBYA5WVG.js → updateCommands-GJGRS6JK.js} +3 -3
  201. package/{updateDialogTitleAction-EXSZGTLL.js → updateDialogTitleAction-5OSEDGRK.js} +25 -25
  202. package/{usageCommand-L4OFWXEU.js → usageCommand-WI6SQOPB.js} +2 -2
  203. package/{usageRebuildCommand-7JR33UHS.js → usageRebuildCommand-WQRLLZAT.js} +3 -3
  204. package/{windowsSelfUpdate-M4V77OUB.js → windowsSelfUpdate-C7LGVWYX.js} +2 -2
  205. package/{workloadLifecycle-ZCSQCHG3.js → workloadLifecycle-P2SJVV3S.js} +2 -2
  206. package/chunk-FGHEF6WI.js +0 -34
  207. package/chunk-U5LOKQ2R.js +0 -176
  208. package/chunk-YDRRGVT5.js +0 -142
  209. package/chunk-YGDYYFRX.js +0 -86
  210. package/chunk-Z7KE4K3H.js +0 -758
  211. package/lib-62SWPXNF.js +0 -21042
  212. /package/{chunk-ANUP75N2.js → chunk-2E4BYAUE.js} +0 -0
@@ -5,22 +5,22 @@ import {
5
5
  fnv1a32Hex
6
6
  } from "./chunk-UEILX4EV.js";
7
7
  import {
8
- compareAgentSelection,
9
- resolveModelTier
10
- } from "./chunk-ITBX27W6.js";
8
+ compareAgentSelection
9
+ } from "./chunk-VJFDG3ZG.js";
11
10
  import {
12
- DEFAULT_PROVIDER_RETRY_MS,
13
- isAgentUnavailableNow,
14
11
  resolveAgentAvailability
15
- } from "./chunk-QJTZ76CP.js";
12
+ } from "./chunk-LS5KAVFQ.js";
16
13
  import {
17
14
  LIST_AGENTS_PAGE_BUDGET,
18
15
  sanitizeToolOutputText,
19
16
  scrubSecrets
20
- } from "./chunk-WFGNWWJI.js";
17
+ } from "./chunk-VH7UO6E5.js";
21
18
  import {
22
19
  isOAuthApiKeyRef
23
20
  } from "./chunk-UKZX3NHN.js";
21
+ import {
22
+ resolveModelTier
23
+ } from "./chunk-HEVRQGGH.js";
24
24
  import {
25
25
  createKey,
26
26
  createTokenKey
@@ -34,7 +34,11 @@ import {
34
34
  isAntigravityOAuthAgent,
35
35
  isSubscriptionEndpoint,
36
36
  isSubscriptionOAuthCredential
37
- } from "./chunk-CTWCZKNS.js";
37
+ } from "./chunk-6SOWMEAY.js";
38
+ import {
39
+ REASONING_EFFORT_OPTIONS,
40
+ resolveModelReasoningCapability
41
+ } from "./chunk-OKH74FML.js";
38
42
  import {
39
43
  asTrimmedLowercaseString
40
44
  } from "./chunk-QSJ3HFEF.js";
@@ -367,17 +371,17 @@ function parseAgentRecordId(privateKey, explicitId) {
367
371
  }
368
372
  return null;
369
373
  }
370
- function resolveFavoriteStatus(record2, options) {
374
+ function resolveFavoriteStatus(record, options) {
371
375
  if (options?.isFavorite !== void 0) {
372
376
  return {
373
377
  isFavorite: !!options.isFavorite,
374
378
  favoritedAt: safeTimestamp(options.favoritedAt)
375
379
  };
376
380
  }
377
- if (record2?.isFavorite === true) {
381
+ if (record?.isFavorite === true) {
378
382
  return {
379
383
  isFavorite: true,
380
- favoritedAt: safeTimestamp(record2?.favoritedAt)
384
+ favoritedAt: safeTimestamp(record?.favoritedAt)
381
385
  };
382
386
  }
383
387
  const favoritesMap = options?.favoritesMap;
@@ -385,17 +389,17 @@ function resolveFavoriteStatus(record2, options) {
385
389
  return { isFavorite: false, favoritedAt: null };
386
390
  }
387
391
  const candidateKeys = [];
388
- if (typeof record2?.dbKey === "string" && record2.dbKey) candidateKeys.push(record2.dbKey);
389
- if (typeof record2?.privateKey === "string" && record2.privateKey) candidateKeys.push(record2.privateKey);
390
- if (typeof record2?.publicKey === "string" && record2.publicKey) candidateKeys.push(record2.publicKey);
391
- if (typeof record2?.verifiedAgentKey === "string" && record2.verifiedAgentKey) {
392
- candidateKeys.push(record2.verifiedAgentKey);
392
+ if (typeof record?.dbKey === "string" && record.dbKey) candidateKeys.push(record.dbKey);
393
+ if (typeof record?.privateKey === "string" && record.privateKey) candidateKeys.push(record.privateKey);
394
+ if (typeof record?.publicKey === "string" && record.publicKey) candidateKeys.push(record.publicKey);
395
+ if (typeof record?.verifiedAgentKey === "string" && record.verifiedAgentKey) {
396
+ candidateKeys.push(record.verifiedAgentKey);
393
397
  }
394
- if (typeof record2?.id === "string" && record2.id) {
395
- candidateKeys.push(record2.id);
396
- candidateKeys.push(publicAgentKey(record2.id));
398
+ if (typeof record?.id === "string" && record.id) {
399
+ candidateKeys.push(record.id);
400
+ candidateKeys.push(publicAgentKey(record.id));
397
401
  if (options?.userId) {
398
- candidateKeys.push(ownedAgentKey(options.userId, record2.id));
402
+ candidateKeys.push(ownedAgentKey(options.userId, record.id));
399
403
  }
400
404
  }
401
405
  let matched = false;
@@ -422,54 +426,63 @@ function resolveFavoriteStatus(record2, options) {
422
426
  }
423
427
  return { isFavorite: false, favoritedAt: null };
424
428
  }
425
- function isOwnedAgentRecord(record2, userId) {
429
+ function isOwnedAgentRecord(record, userId) {
426
430
  if (!userId) return false;
427
- if (typeof record2?.userId === "string" && record2.userId === userId || typeof record2?.ownerId === "string" && record2.ownerId === userId) {
431
+ if (typeof record?.userId === "string" && record.userId === userId || typeof record?.ownerId === "string" && record.ownerId === userId) {
428
432
  return true;
429
433
  }
430
- return [record2?.dbKey, record2?.privateKey].some(
434
+ return [record?.dbKey, record?.privateKey].some(
431
435
  (key) => isOwnedAgentKey(key, userId)
432
436
  );
433
437
  }
434
- function toSafeAgentSummary(record2, options) {
438
+ function subscriptionQuotaChannel(source) {
439
+ if (typeof source !== "string") return void 0;
440
+ const id = source.toLowerCase();
441
+ if (id.includes("fetchavailablemodels:pool:")) return "antigravity";
442
+ const probe = id.match(/(?:^|[^a-z0-9-])(antigravity|codex|anthropic|claude|cursor|devin|xai)-oauth(?=$|[^a-z0-9-])/)?.[1];
443
+ if (probe === "codex") return "chatgpt";
444
+ if (probe === "anthropic") return "claude";
445
+ return probe;
446
+ }
447
+ function toSafeAgentSummary(record, options) {
435
448
  const rawId = parseAgentRecordId(
436
- typeof record2?.privateKey === "string" ? record2.privateKey : record2?.dbKey,
437
- typeof record2?.id === "string" ? record2.id : void 0
449
+ typeof record?.privateKey === "string" ? record.privateKey : record?.dbKey,
450
+ typeof record?.id === "string" ? record.id : void 0
438
451
  );
439
- const id = rawId ?? (typeof record2?.id === "string" ? record2.id : null);
440
- const publicRecordDenied = record2?.publicRecordExists === false || options?.publicRecordExists === false;
441
- const publicRecordConfirmed = record2?.publicRecordExists === true || options?.publicRecordExists === true;
452
+ const id = rawId ?? (typeof record?.id === "string" ? record.id : null);
453
+ const publicRecordDenied = record?.publicRecordExists === false || options?.publicRecordExists === false;
454
+ const publicRecordConfirmed = record?.publicRecordExists === true || options?.publicRecordExists === true;
442
455
  let publicKey;
443
- if (typeof record2?.publicKey === "string" && record2.publicKey && !publicRecordDenied) {
444
- publicKey = record2.publicKey;
456
+ if (typeof record?.publicKey === "string" && record.publicKey && !publicRecordDenied) {
457
+ publicKey = record.publicKey;
445
458
  } else if (publicRecordConfirmed && id) {
446
459
  publicKey = publicAgentKey(id);
447
460
  }
448
- const name = typeof record2?.name === "string" && record2.name ? record2.name : "(unnamed)";
449
- const handle = typeof record2?.handle === "string" && record2.handle ? record2.handle : null;
450
- const introduction = typeof record2?.introduction === "string" && record2.introduction ? record2.introduction : typeof record2?.description === "string" && record2.description ? record2.description : null;
451
- const model = typeof record2?.model === "string" && record2.model ? record2.model : null;
452
- const provider = typeof record2?.provider === "string" && record2.provider ? record2.provider : typeof record2?.apiSource === "string" && record2.apiSource ? record2.apiSource : null;
453
- const apiSource = typeof record2?.apiSource === "string" && record2.apiSource ? record2.apiSource : null;
454
- const cliProvider = typeof record2?.cliProvider === "string" && record2.cliProvider ? record2.cliProvider : null;
455
- const tools = Array.isArray(record2?.tools) ? record2.tools.filter((t) => typeof t === "string") : [];
456
- const inputPrice = typeof record2?.inputPrice === "number" && Number.isFinite(record2.inputPrice) ? record2.inputPrice : null;
457
- const outputPrice = typeof record2?.outputPrice === "number" && Number.isFinite(record2.outputPrice) ? record2.outputPrice : null;
458
- const favStatus = resolveFavoriteStatus(record2, options);
459
- const isPublic = record2?.isPublic === true || record2?.isPublicFlag === true || record2?.publicRecordExists === true;
460
- const updatedAt = safeTimestamp(record2?.updatedAt ?? record2?.createdAt ?? record2?.created);
461
- const nextAvailableAt = typeof record2?.nextAvailableAt === "number" && Number.isFinite(record2.nextAvailableAt) ? record2.nextAvailableAt : void 0;
462
- const quotaExhaustion = record2?.quotaExhaustion && typeof record2.quotaExhaustion.observedAt === "number" && Number.isFinite(record2.quotaExhaustion.observedAt) ? { observedAt: record2.quotaExhaustion.observedAt } : void 0;
463
- const rawQuota = record2?.quota;
464
- const quota = rawQuota && typeof rawQuota === "object" && Array.isArray(rawQuota.windows) && typeof rawQuota.observedAt === "number" && Number.isFinite(rawQuota.observedAt) ? rawQuota : void 0;
461
+ const name = typeof record?.name === "string" && record.name ? record.name : "(unnamed)";
462
+ const handle = typeof record?.handle === "string" && record.handle ? record.handle : null;
463
+ const introduction = typeof record?.introduction === "string" && record.introduction ? record.introduction : typeof record?.description === "string" && record.description ? record.description : null;
464
+ const roleText = typeof record?.introduction === "string" ? record.introduction.trim().replace(/\s+/g, " ") : "";
465
+ const roleChars = Array.from(roleText);
466
+ const roleHint = roleChars.length > 60 ? `${roleChars.slice(0, 59).join("")}\u2026` : roleText;
467
+ const model = typeof record?.model === "string" && record.model ? record.model : null;
468
+ const provider = typeof record?.provider === "string" && record.provider ? record.provider : typeof record?.apiSource === "string" && record.apiSource ? record.apiSource : null;
469
+ const apiSource = typeof record?.apiSource === "string" && record.apiSource ? record.apiSource : null;
470
+ const cliProvider = typeof record?.cliProvider === "string" && record.cliProvider ? record.cliProvider : null;
471
+ const tools = Array.isArray(record?.tools) ? record.tools.filter((t) => typeof t === "string") : [];
472
+ const inputPrice = typeof record?.inputPrice === "number" && Number.isFinite(record.inputPrice) ? record.inputPrice : null;
473
+ const outputPrice = typeof record?.outputPrice === "number" && Number.isFinite(record.outputPrice) ? record.outputPrice : null;
474
+ const favStatus = resolveFavoriteStatus(record, options);
475
+ const isPublic = record?.isPublic === true || record?.isPublicFlag === true || record?.publicRecordExists === true;
476
+ const updatedAt = safeTimestamp(record?.updatedAt ?? record?.createdAt ?? record?.created);
477
+ const nextAvailableAt = typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? record.nextAvailableAt : void 0;
465
478
  const currentUserId = options?.userId;
466
- const ownedKey = currentUserId ? [record2?.dbKey, record2?.privateKey].find(
479
+ const ownedKey = currentUserId ? [record?.dbKey, record?.privateKey].find(
467
480
  (key) => isOwnedAgentKey(key, currentUserId)
468
481
  ) : void 0;
469
- const isOwned = isOwnedAgentRecord(record2, currentUserId);
470
- const isOAuth = isOAuthApiKeyRef(record2?.apiKeyRef);
482
+ const isOwned = isOwnedAgentRecord(record, currentUserId);
483
+ const isOAuth = isOAuthApiKeyRef(record?.apiKeyRef);
471
484
  const billingSource = resolveBillingSource({
472
- ...record2,
485
+ ...record,
473
486
  isOAuth,
474
487
  isOwned,
475
488
  apiSource,
@@ -481,11 +494,11 @@ function toSafeAgentSummary(record2, options) {
481
494
  {
482
495
  provider,
483
496
  apiSource,
484
- customProviderUrl: typeof record2?.customProviderUrl === "string" ? record2.customProviderUrl : null
497
+ customProviderUrl: typeof record?.customProviderUrl === "string" ? record.customProviderUrl : null
485
498
  },
486
499
  options?.now ?? Date.now()
487
500
  );
488
- const verifiedSharedKey = typeof record2?.verifiedAgentKey === "string" && record2.verifiedAgentKey ? record2.verifiedAgentKey : void 0;
501
+ const verifiedSharedKey = typeof record?.verifiedAgentKey === "string" && record.verifiedAgentKey ? record.verifiedAgentKey : void 0;
489
502
  let agentKey;
490
503
  if (currentUserId) {
491
504
  if (isOwned) {
@@ -496,12 +509,28 @@ function toSafeAgentSummary(record2, options) {
496
509
  agentKey = verifiedSharedKey;
497
510
  }
498
511
  }
499
- const rawCredRef = (typeof record2?.apiKeyRef === "string" && record2.apiKeyRef ? record2.apiKeyRef : void 0) ?? (typeof record2?.credentialRef === "string" && record2.credentialRef ? record2.credentialRef : void 0);
500
- const credInfo = deriveCredentialGroup(record2?.credentialGroup ?? rawCredRef);
501
- const credentialGroup = record2?.credentialGroup ?? credInfo?.credentialGroup;
502
- const credentialKind = record2?.credentialKind ?? credInfo?.credentialKind;
512
+ const rawCredRef = (typeof record?.apiKeyRef === "string" && record.apiKeyRef ? record.apiKeyRef : void 0) ?? (typeof record?.credentialRef === "string" && record.credentialRef ? record.credentialRef : void 0);
513
+ const credInfo = deriveCredentialGroup(record?.credentialGroup ?? rawCredRef);
514
+ const credentialGroup = record?.credentialGroup ?? credInfo?.credentialGroup;
515
+ const credentialKind = record?.credentialKind ?? credInfo?.credentialKind;
516
+ const rawQuota = record?.quota;
517
+ const snapshot = rawQuota && Array.isArray(rawQuota.windows) && Number.isFinite(rawQuota.observedAt) ? rawQuota : void 0;
518
+ const ref = typeof rawCredRef === "string" ? rawCredRef.trim().toLowerCase() : void 0;
519
+ const group = typeof credentialGroup === "string" ? credentialGroup.trim().toLowerCase() : void 0;
520
+ const oauthChannel = isOAuthApiKeyRef(ref) ? ref : isOAuthApiKeyRef(group) ? group : void 0;
521
+ const providerId = provider?.trim().toLowerCase();
522
+ const channel = oauthChannel ?? (providerId === "google-antigravity" ? "antigravity" : providerId);
523
+ const platformChannel = apiSource === "platform" || providerId === "nolo" && !oauthChannel && apiSource !== "custom";
524
+ const windows = snapshot?.windows.filter((window) => {
525
+ const origin = subscriptionQuotaChannel(window?.source);
526
+ return !origin || !platformChannel && (!channel || origin === channel);
527
+ });
528
+ const foreignOnly = Boolean(snapshot?.windows.length && windows?.length === 0);
529
+ const quota = snapshot && windows && !foreignOnly ? { ...snapshot, windows } : void 0;
530
+ const observedAt = record?.quotaExhaustion?.observedAt;
531
+ const quotaExhaustion = !foreignOnly && typeof observedAt === "number" && Number.isFinite(observedAt) ? { observedAt } : void 0;
503
532
  const availability = resolveAgentAvailability(
504
- { nextAvailableAt, quota, quotaExhaustion },
533
+ { nextAvailableAt, quota, quotaExhaustion, model },
505
534
  options?.now ?? Date.now()
506
535
  );
507
536
  return {
@@ -511,6 +540,7 @@ function toSafeAgentSummary(record2, options) {
511
540
  name,
512
541
  handle,
513
542
  introduction,
543
+ ...roleHint ? { roleHint } : {},
514
544
  model,
515
545
  modelTier: resolveModelTier(model),
516
546
  provider,
@@ -528,7 +558,7 @@ function toSafeAgentSummary(record2, options) {
528
558
  // 例如 apiSource==="cli" 的本地 CLI Agent 在 resolveBillingSource 里会落到
529
559
  // platform_credits,但 isPlatformPaidAgentCall 显式短路为「非平台垫付」。
530
560
  requiresPaidApproval: isPlatformPaidAgentCall({
531
- agentConfig: record2 ?? void 0,
561
+ agentConfig: record ?? void 0,
532
562
  callerUserId: currentUserId ?? void 0
533
563
  }),
534
564
  ...economics ? { economics } : {},
@@ -550,7 +580,7 @@ function toSafeAgentSummary(record2, options) {
550
580
  function sortSafeAgentSummaries(agents) {
551
581
  return [...agents].sort(compareAgentSelection);
552
582
  }
553
- var COMPACT_AGENT_SUMMARY_FIELDS = [
583
+ var AGENT_SUMMARY_FIELDS = [
554
584
  // —— 派发决策必需(短字段,必须排最前)——
555
585
  // agentKey 是唯一不可推导、必须逐字复制的字段;截断时它首先被保住。
556
586
  "agentKey",
@@ -560,7 +590,6 @@ var COMPACT_AGENT_SUMMARY_FIELDS = [
560
590
  "billingSource",
561
591
  // 扣费授权判据:listAgents 默认走 compact 投影,缺了它模型在默认派发
562
592
  // 流程里读不到「派它之前要先问用户」(2026-11-15 事故成因)。
563
- // 与 ULTRA_COMPACT 白名单必须同时保留——两处任何一处缺失都等于该字段不存在。
564
593
  "requiresPaidApproval",
565
594
  "availabilityStatus",
566
595
  "credentialGroup",
@@ -581,11 +610,18 @@ var COMPACT_AGENT_SUMMARY_FIELDS = [
581
610
  // —— 体积大的说明性字段(排在每条记录最后,截断时先牺牲它们)——
582
611
  // Phase 2A economics 快照(period/multipliers/changesAt 等小对象)。
583
612
  // 只对 DeepSeek API / BigModel GLM Coding Plan 存在;不含完整 policy/windows。
584
- "economics",
613
+ "economics"
614
+ ];
615
+ var AGENT_SUMMARY_TRAILING_FIELDS = [
585
616
  "tools",
586
617
  // 额度快照(windows 数组,体积最大):只有上游真上报过窗口的 agent 才带。
587
618
  "quota"
588
619
  ];
620
+ var COMPACT_AGENT_SUMMARY_FIELDS = [
621
+ ...AGENT_SUMMARY_FIELDS,
622
+ "roleHint",
623
+ ...AGENT_SUMMARY_TRAILING_FIELDS
624
+ ];
589
625
  function omitNullishAgentSummaryFields(summary) {
590
626
  const result = {};
591
627
  for (const [key, value] of Object.entries(summary)) {
@@ -595,6 +631,105 @@ function omitNullishAgentSummaryFields(summary) {
595
631
  }
596
632
  return result;
597
633
  }
634
+ function finiteOptionalNumber(value) {
635
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
636
+ }
637
+ function compactQuotaForSummary(quota) {
638
+ if (!quota || !Array.isArray(quota.windows)) return void 0;
639
+ const observedAt = finiteOptionalNumber(quota.observedAt);
640
+ if (observedAt === void 0) return void 0;
641
+ const windows = [];
642
+ for (const window of quota.windows) {
643
+ if (!window || typeof window.scope !== "string" || !window.scope) continue;
644
+ const utilization = finiteOptionalNumber(window.utilization);
645
+ const remaining = finiteOptionalNumber(window.remaining);
646
+ const limit = finiteOptionalNumber(window.limit);
647
+ const resetAt = finiteOptionalNumber(window.resetAt);
648
+ const unit = typeof window.unit === "string" && window.unit ? window.unit : void 0;
649
+ windows.push({
650
+ scope: window.scope,
651
+ ...utilization !== void 0 ? { utilization } : {},
652
+ ...remaining !== void 0 ? { remaining } : {},
653
+ ...limit !== void 0 ? { limit } : {},
654
+ ...unit !== void 0 ? { unit } : {},
655
+ ...resetAt !== void 0 ? { resetAt } : {}
656
+ });
657
+ }
658
+ const rawPlan = quota.plan;
659
+ const planName = rawPlan && typeof rawPlan.name === "string" && rawPlan.name ? rawPlan.name : void 0;
660
+ const monthlyCreditsUsd = finiteOptionalNumber(rawPlan?.monthlyCreditsUsd);
661
+ const plan = planName ? { name: planName, ...monthlyCreditsUsd !== void 0 ? { monthlyCreditsUsd } : {} } : void 0;
662
+ return {
663
+ observedAt,
664
+ windows,
665
+ ...plan ? { plan } : {}
666
+ };
667
+ }
668
+ function promoteSharedCredentialGroupQuota(agents, groups) {
669
+ if (!agents.length || !groups.length) return { agents, groups };
670
+ const groupByName = new Map(groups.map((group) => [group.credentialGroup, group]));
671
+ const restored = agents.map((agent) => {
672
+ const ref = agent.quotaRef;
673
+ if (typeof ref !== "string") return agent;
674
+ const fromGroup = groupByName.get(ref)?.quota;
675
+ const rest = { ...agent };
676
+ delete rest.quotaRef;
677
+ if (fromGroup) rest.quota = fromGroup;
678
+ return rest;
679
+ });
680
+ const bareGroups = groups.map(({ quota: _dropped, ...rest }) => rest);
681
+ const slimQuota = restored.map((agent) => compactQuotaForSummary(agent.quota));
682
+ const byGroup = /* @__PURE__ */ new Map();
683
+ slimQuota.forEach((quota, index) => {
684
+ const agent = restored[index];
685
+ const groupKey = agent.credentialGroup;
686
+ if (!quota || quota.windows.length === 0) return;
687
+ if (agent.isOwned !== true) return;
688
+ if (typeof groupKey !== "string" || !groupKey) return;
689
+ if (!groupByName.has(groupKey)) return;
690
+ const clusters = byGroup.get(groupKey) ?? /* @__PURE__ */ new Map();
691
+ const signature = JSON.stringify([
692
+ quota.windows,
693
+ quota.plan ?? null,
694
+ quota.observedAt ?? null
695
+ ]);
696
+ const indices = clusters.get(signature) ?? [];
697
+ indices.push(index);
698
+ clusters.set(signature, indices);
699
+ byGroup.set(groupKey, clusters);
700
+ });
701
+ const promoted = /* @__PURE__ */ new Map();
702
+ const refFor = /* @__PURE__ */ new Map();
703
+ for (const [groupKey, clusters] of byGroup) {
704
+ let best;
705
+ for (const indices of clusters.values()) {
706
+ if (indices.length < 2) continue;
707
+ if (!best || indices.length > best.length) best = indices;
708
+ }
709
+ if (!best) continue;
710
+ const observedAt = slimQuota[best[0]].observedAt;
711
+ const { plan } = slimQuota[best[0]];
712
+ promoted.set(groupKey, {
713
+ observedAt,
714
+ windows: slimQuota[best[0]].windows,
715
+ ...plan ? { plan } : {}
716
+ });
717
+ for (const index of best) refFor.set(index, groupKey);
718
+ }
719
+ const nextAgents = restored.map((agent, index) => {
720
+ const ref = refFor.get(index);
721
+ if (!ref) return agent;
722
+ const rest = { ...agent };
723
+ delete rest.quota;
724
+ rest.quotaRef = ref;
725
+ return rest;
726
+ });
727
+ const nextGroups = bareGroups.map((group) => {
728
+ const quota = promoted.get(group.credentialGroup);
729
+ return quota ? { ...group, quota } : group;
730
+ });
731
+ return { agents: nextAgents, groups: nextGroups };
732
+ }
598
733
  function toCompactAgentSummary(summary) {
599
734
  const compact = {};
600
735
  for (const field of COMPACT_AGENT_SUMMARY_FIELDS) {
@@ -606,30 +741,8 @@ function toCompactAgentSummary(summary) {
606
741
  return compact;
607
742
  }
608
743
  var ULTRA_COMPACT_AGENT_SUMMARY_FIELDS = [
609
- // —— 派发决策与关键准入语义(必须保留,不能宣称安全但丢证据)——
610
- "agentKey",
611
- "name",
612
- "model",
613
- "modelTier",
614
- "billingSource",
615
- // 扣费授权判据必须随投影一起走:精简投影里没有它,模型就看不到
616
- // 「派它之前要先问用户」,等于该字段不存在(2026-11-15 事故的直接成因)。
617
- "requiresPaidApproval",
618
- "availabilityStatus",
619
- "credentialGroup",
620
- "isFavorite",
621
- "isOAuth",
622
- "isOwned",
623
- "isPublic",
624
- "provider",
625
- "apiSource",
626
- "credentialKind",
627
- "credentialed",
628
- "nextAvailableAt",
629
- "availabilityReason",
630
- "economics",
631
- "tools",
632
- "quota"
744
+ ...AGENT_SUMMARY_FIELDS,
745
+ ...AGENT_SUMMARY_TRAILING_FIELDS
633
746
  ];
634
747
  function toUltraCompactAgentSummary(summary) {
635
748
  const compact = {};
@@ -639,6 +752,14 @@ function toUltraCompactAgentSummary(summary) {
639
752
  compact[field] = value;
640
753
  }
641
754
  }
755
+ if (compact.quota !== void 0) {
756
+ const quota = compactQuotaForSummary(compact.quota);
757
+ if (quota) {
758
+ compact.quota = quota;
759
+ } else {
760
+ delete compact.quota;
761
+ }
762
+ }
642
763
  return compact;
643
764
  }
644
765
 
@@ -675,249 +796,6 @@ function isPlatformPaidAgentCall(probe) {
675
796
  }) === "platform_credits";
676
797
  }
677
798
 
678
- // packages/ai/agent/agentDiscovery.ts
679
- function isPreferredAgent(agent) {
680
- return agent.isFavorite === true || agent.isOwned === true || agent.isOAuth === true || agent.billingSource === "user_subscription" || agent.billingSource === "user_api" || agent.billingSource === "local";
681
- }
682
- function isPublicDiscoveryAgent(agent) {
683
- return agent.isPublic === true && !isPreferredAgent(agent);
684
- }
685
- function resolveDiscoveryScope(args) {
686
- const rawScope = typeof args?.scope === "string" ? args.scope.trim().toLowerCase() : void 0;
687
- const hasScope = rawScope !== void 0 && rawScope !== "";
688
- const hasPublicOnly = typeof args?.publicOnly === "boolean";
689
- const publicOnly = args?.publicOnly === true;
690
- if (hasScope) {
691
- if (rawScope !== "preferred" && rawScope !== "public" && rawScope !== "all") {
692
- throw new Error(`Invalid scope '${args?.scope}': must be 'preferred', 'public', or 'all'.`);
693
- }
694
- const scope = rawScope;
695
- if (hasPublicOnly) {
696
- if (publicOnly && scope !== "public") {
697
- throw new Error(
698
- `Conflicting arguments: scope='${args?.scope}' conflicts with publicOnly=true.`
699
- );
700
- }
701
- if (!publicOnly && scope === "public") {
702
- throw new Error(
703
- `Conflicting arguments: scope='${args?.scope}' conflicts with publicOnly=false.`
704
- );
705
- }
706
- }
707
- return scope;
708
- }
709
- if (hasPublicOnly && publicOnly) {
710
- return "public";
711
- }
712
- return "all";
713
- }
714
- function agentIdentityKeys(agent) {
715
- return [agent.agentKey, agent.publicKey, agent.id].filter(
716
- (key) => typeof key === "string" && key.length > 0
717
- );
718
- }
719
- function deduplicateAgentSummaries(agents) {
720
- const byIdentity = /* @__PURE__ */ new Map();
721
- for (const agent of agents) {
722
- const keys = agentIdentityKeys(agent);
723
- const existing = keys.map((key) => byIdentity.get(key)).find(Boolean);
724
- if (!existing) {
725
- for (const key of keys) byIdentity.set(key, agent);
726
- continue;
727
- }
728
- const winner = isPreferredAgent(agent) && !isPreferredAgent(existing) ? agent : existing;
729
- for (const key of /* @__PURE__ */ new Set([...agentIdentityKeys(existing), ...keys])) byIdentity.set(key, winner);
730
- }
731
- return [...new Set(byIdentity.values())];
732
- }
733
- function filterAgentsByScope(agents, scope) {
734
- const unique = deduplicateAgentSummaries(agents);
735
- if (scope === "preferred") return unique.filter((agent) => isPreferredAgent(agent));
736
- if (scope === "public") return unique.filter((agent) => isPublicDiscoveryAgent(agent));
737
- return unique.filter((agent) => isPreferredAgent(agent) || agent.isPublic === true);
738
- }
739
- function recommendPlanning(agents, caller, poolComplete) {
740
- const callerKey = typeof caller?.agentKey === "string" && caller.agentKey.trim() ? caller.agentKey : void 0;
741
- const current = callerKey ? agents.find((a) => a.agentKey === callerKey) : void 0;
742
- const currentTier = callerKey ? resolveModelTier(caller?.effectiveModel ?? current?.model) : "unknown";
743
- const base = {
744
- condition: "when_planning_needed_and_candidate_suitable",
745
- action: "self",
746
- currentTier,
747
- poolComplete,
748
- requiresPaidApproval: false
749
- };
750
- if (caller?.runKind === "subtask") return { ...base, reason: "bounded_subtask" };
751
- if (!callerKey) return { ...base, reason: "caller_unknown" };
752
- if (currentTier === "unknown") return { ...base, reason: "caller_tier_unknown" };
753
- if (!poolComplete) return { ...base, reason: "pool_incomplete" };
754
- const ranks = { easy: 0, normal: 1, complex: 2, extreme: 3 };
755
- const higher = agents.filter((a) => a.agentKey && a.agentKey !== callerKey && a.modelTier !== "unknown" && ranks[a.modelTier] > ranks[currentTier]);
756
- const free = higher.filter((a) => a.requiresPaidApproval === false);
757
- free.sort((a, b) => ranks[b.modelTier] - ranks[a.modelTier]);
758
- const best = free[0];
759
- if (best) return {
760
- ...base,
761
- action: "delegate",
762
- reason: "higher_suitable_agent",
763
- agentKey: best.agentKey,
764
- recommendedTier: best.modelTier
765
- };
766
- if (higher.length) return { ...base, reason: "paid_approval_required", requiresPaidApproval: true };
767
- return { ...base, reason: "no_higher_suitable_agent" };
768
- }
769
- function resolvePaginationArgs(args) {
770
- let limit;
771
- let offset;
772
- if (args?.limit !== void 0 && args?.limit !== null) {
773
- const raw = args.limit;
774
- if (typeof raw === "boolean") {
775
- throw new Error(`Invalid limit '${raw}': must be a positive integer.`);
776
- }
777
- if (typeof raw === "number") {
778
- if (!Number.isInteger(raw) || raw <= 0) {
779
- throw new Error(`Invalid limit '${raw}': must be a positive integer.`);
780
- }
781
- limit = Math.min(raw, 500);
782
- } else if (typeof raw === "string") {
783
- if (raw.trim() !== "") {
784
- if (!/^\d+$/.test(raw.trim())) {
785
- throw new Error(`Invalid limit '${raw}': must be a positive integer.`);
786
- }
787
- const parsed = Number(raw.trim());
788
- if (!Number.isInteger(parsed) || parsed <= 0) {
789
- throw new Error(`Invalid limit '${raw}': must be a positive integer.`);
790
- }
791
- limit = Math.min(parsed, 500);
792
- }
793
- } else {
794
- throw new Error(`Invalid limit '${String(raw)}': must be a positive integer.`);
795
- }
796
- }
797
- if (args?.offset !== void 0 && args?.offset !== null) {
798
- const raw = args.offset;
799
- if (typeof raw === "boolean") {
800
- throw new Error(`Invalid offset '${raw}': must be a non-negative integer.`);
801
- }
802
- if (typeof raw === "number") {
803
- if (!Number.isInteger(raw) || raw < 0) {
804
- throw new Error(`Invalid offset '${raw}': must be a non-negative integer.`);
805
- }
806
- offset = raw;
807
- } else if (typeof raw === "string") {
808
- if (raw.trim() !== "") {
809
- if (!/^\d+$/.test(raw.trim())) {
810
- throw new Error(`Invalid offset '${raw}': must be a non-negative integer.`);
811
- }
812
- const parsed = Number(raw.trim());
813
- if (!Number.isInteger(parsed) || parsed < 0) {
814
- throw new Error(`Invalid offset '${raw}': must be a non-negative integer.`);
815
- }
816
- offset = parsed;
817
- }
818
- } else {
819
- throw new Error(`Invalid offset '${String(raw)}': must be a non-negative integer.`);
820
- }
821
- }
822
- return { limit, offset };
823
- }
824
- function matchesAgentQuery(agent, query) {
825
- if (!query || typeof query !== "string") return true;
826
- const q = query.trim().toLowerCase();
827
- if (!q) return true;
828
- const candidates = [
829
- agent.name,
830
- agent.model,
831
- agent.provider,
832
- agent.handle,
833
- agent.agentKey,
834
- agent.publicKey,
835
- agent.id
836
- ];
837
- return candidates.some((text) => typeof text === "string" && text.toLowerCase().includes(q));
838
- }
839
- function buildAgentDiscoveryResult(options) {
840
- const scope = resolveDiscoveryScope({
841
- scope: options.scope,
842
- publicOnly: options.publicOnly
843
- });
844
- const now = options.now ?? Date.now();
845
- let scopedAgents = filterAgentsByScope(options.agents, scope);
846
- if (options.query && typeof options.query === "string" && options.query.trim()) {
847
- scopedAgents = scopedAgents.filter((a) => matchesAgentQuery(a, options.query));
848
- }
849
- scopedAgents = scopedAgents.map((agent) => {
850
- const decision = resolveAgentAvailability(agent, now);
851
- if (decision.status === "quota_exhausted") {
852
- const resetAt = decision.resetAt ?? now + DEFAULT_PROVIDER_RETRY_MS;
853
- const nextAvailableAt = typeof agent.nextAvailableAt === "number" && agent.nextAvailableAt > resetAt ? agent.nextAvailableAt : resetAt;
854
- return {
855
- ...agent,
856
- nextAvailableAt,
857
- availableAt: nextAvailableAt,
858
- availabilityStatus: decision.status,
859
- availabilityReason: decision.reason
860
- };
861
- }
862
- return {
863
- ...agent,
864
- availabilityStatus: decision.status,
865
- availabilityReason: decision.reason
866
- };
867
- });
868
- const unavailableCount = scopedAgents.filter((a) => isAgentUnavailableNow(a, now)).length;
869
- const credentialGroups = summarizeCredentialGroups(scopedAgents, now);
870
- const pagination = resolvePaginationArgs({
871
- limit: options.limit,
872
- offset: options.offset
873
- });
874
- const offset = pagination.offset;
875
- const limit = pagination.limit;
876
- const sortedAgents = sortSafeAgentSummaries(scopedAgents);
877
- const hasQuery = Boolean(options.query && typeof options.query === "string" && options.query.trim());
878
- const hasFilteredCandidates = sortedAgents.length < options.agents.length;
879
- let total;
880
- if (hasQuery) {
881
- total = sortedAgents.length;
882
- } else if (hasFilteredCandidates) {
883
- total = sortedAgents.length;
884
- } else if (scope === "public") {
885
- total = typeof options.upstreamTotal === "number" && options.upstreamTotal > sortedAgents.length ? options.upstreamTotal : sortedAgents.length;
886
- } else if (scope === "all") {
887
- const privateOnlyCount = scopedAgents.filter((a) => isPreferredAgent(a) && a.isPublic !== true).length;
888
- const publicPulledCount = scopedAgents.filter((a) => a.isPublic === true).length;
889
- const effectivePublicTotal = typeof options.upstreamTotal === "number" && options.upstreamTotal > publicPulledCount ? options.upstreamTotal : publicPulledCount;
890
- total = options.upstreamTruncated === true ? privateOnlyCount + effectivePublicTotal : sortedAgents.length;
891
- } else {
892
- total = typeof options.upstreamTotal === "number" && options.upstreamTotal > sortedAgents.length ? options.upstreamTotal : sortedAgents.length;
893
- }
894
- const isTruncated = options.upstreamTruncated === true || !hasQuery && !hasFilteredCandidates && typeof options.upstreamTotal === "number" && options.upstreamTotal > sortedAgents.length;
895
- const pagedAgents = typeof limit === "number" || typeof offset === "number" ? sortedAgents.slice(
896
- offset ?? 0,
897
- (offset ?? 0) + (limit ?? sortedAgents.length)
898
- ) : sortedAgents;
899
- const projectedAgents = options.verbose === true ? pagedAgents.map(omitNullishAgentSummaryFields) : options.compact === true ? pagedAgents.map(toUltraCompactAgentSummary) : pagedAgents.map(toCompactAgentSummary);
900
- return {
901
- total,
902
- ...typeof offset === "number" ? { offset } : {},
903
- ...typeof limit === "number" ? { limit } : {},
904
- ...isTruncated ? { truncated: true } : {},
905
- unavailableCount,
906
- availableCount: sortedAgents.length,
907
- agents: projectedAgents,
908
- planningRecommendation: recommendPlanning(
909
- sortedAgents,
910
- options.caller,
911
- !isTruncated && scope === "all" && !hasQuery && !options.poolRestricted
912
- ),
913
- credentialGroups
914
- };
915
- }
916
- function toDiscoverySafeAgentSummary(record2, options) {
917
- const mergedOptions = record2?.publicRecordExists === true ? { ...options, publicRecordExists: true } : options;
918
- return toSafeAgentSummary(record2, mergedOptions);
919
- }
920
-
921
799
  // packages/ai/agent/speedSampleCache.ts
922
800
  var SPEED_SAMPLE_DISK_CACHE_TTL_MS = 10 * 6e4;
923
801
  var SPEED_SAMPLE_SCAN_BUDGET_MS = 2500;
@@ -1110,17 +988,17 @@ async function collectRecentSpeedSamples(db, userId, options = {}) {
1110
988
  const { start, end } = createTokenKey.rangeOfUser(userId);
1111
989
  const failedPrefix = createKey("token", userId, "failed-call", "");
1112
990
  const dispatchRunCache = /* @__PURE__ */ new Map();
1113
- const isDispatchSampleRecord = async (record2, resolver, cache) => {
1114
- if (record2.entry_path !== DISPATCH_ENTRY_PATH && record2.entry_path !== "cli-local") return false;
1115
- const runId = typeof record2.dialogId === "string" ? record2.dialogId.trim() : "";
991
+ const isDispatchSampleRecord = async (record, resolver, cache) => {
992
+ if (record.entry_path !== DISPATCH_ENTRY_PATH && record.entry_path !== "cli-local") return false;
993
+ const runId = typeof record.dialogId === "string" ? record.dialogId.trim() : "";
1116
994
  if (!runId) return false;
1117
- const cacheKey = `${record2.entry_path}:${runId}`;
995
+ const cacheKey = `${record.entry_path}:${runId}`;
1118
996
  const cached = cache.get(cacheKey);
1119
997
  if (cached !== void 0) return cached;
1120
998
  let dispatch = false;
1121
999
  if (resolver) {
1122
1000
  try {
1123
- dispatch = await resolver(runId, record2.entry_path) === true;
1001
+ dispatch = await resolver(runId, record.entry_path) === true;
1124
1002
  } catch {
1125
1003
  dispatch = false;
1126
1004
  }
@@ -1153,15 +1031,15 @@ async function collectRecentSpeedSamples(db, userId, options = {}) {
1153
1031
  newestKey = key;
1154
1032
  if (key.startsWith(failedPrefix)) continue;
1155
1033
  if (!raw || typeof raw !== "object") continue;
1156
- const record2 = raw;
1034
+ const record = raw;
1157
1035
  const resolver = options.isDispatchRun ?? db.isDispatchRun;
1158
1036
  if (!await isDispatchSampleRecord(
1159
- record2,
1037
+ record,
1160
1038
  resolver ? (runId, entryPath) => resolver.call(db, runId, entryPath) : void 0,
1161
1039
  dispatchRunCache
1162
1040
  ))
1163
1041
  continue;
1164
- collectSample(collected, record2);
1042
+ collectSample(collected, record);
1165
1043
  }
1166
1044
  if (accepted === 0 || accepted < pageSize) break;
1167
1045
  lastKey = newestKey;
@@ -1330,7 +1208,11 @@ async function serializeCompactAgentPage(parsed, samples, snapshotAgeMs, options
1330
1208
  }
1331
1209
  const agent = candidates[0];
1332
1210
  const speedContext = buildCandidateSpeedContext(typeof agent.model === "string" ? [agent.model] : [], samples, { snapshotAgeMs });
1333
- const payload = { agent, credentialGroups: groups.filter((group) => group.credentialGroup === agent.credentialGroup) };
1211
+ const singleScoped = promoteSharedCredentialGroupQuota(
1212
+ [agent],
1213
+ groups.filter((group) => group.credentialGroup === agent.credentialGroup)
1214
+ );
1215
+ const payload = { agent: singleScoped.agents[0], credentialGroups: singleScoped.groups };
1334
1216
  let keyCollision = false;
1335
1217
  const cleanText = (value) => scrubSecrets(sanitizeToolOutputText(value)).cleaned;
1336
1218
  const sanitize = (value) => {
@@ -1367,8 +1249,13 @@ async function serializeCompactAgentPage(parsed, samples, snapshotAgeMs, options
1367
1249
  return fits(result) ? result : JSON.stringify({ success: false, error: "LIST_AGENTS_FRAGMENT_METADATA_TOO_LARGE", offset });
1368
1250
  }
1369
1251
  const makePage = (count) => {
1370
- const agents = candidates.slice(0, count);
1371
- const groupKeys = new Set(agents.map((agent) => agent.credentialGroup).filter(Boolean));
1252
+ const scoped = candidates.slice(0, count);
1253
+ const groupKeys = new Set(scoped.map((agent) => agent.credentialGroup).filter(Boolean));
1254
+ const promoted = promoteSharedCredentialGroupQuota(
1255
+ scoped,
1256
+ groups.filter((group) => groupKeys.has(group.credentialGroup))
1257
+ );
1258
+ const agents = promoted.agents;
1372
1259
  const speedContext = buildCandidateSpeedContext(agents.map((agent) => agent.model).filter((model) => typeof model === "string"), samples, { snapshotAgeMs });
1373
1260
  const nextOffset = offset + count;
1374
1261
  const hasMore = nextOffset < availableCount;
@@ -1376,7 +1263,7 @@ async function serializeCompactAgentPage(parsed, samples, snapshotAgeMs, options
1376
1263
  ...parsed,
1377
1264
  offset,
1378
1265
  agents,
1379
- credentialGroups: groups.filter((group) => groupKeys.has(group.credentialGroup)),
1266
+ credentialGroups: promoted.groups,
1380
1267
  hasMore,
1381
1268
  ...hasMore ? { nextOffset } : {},
1382
1269
  ...speedContext ? { speedContext } : {}
@@ -1410,17 +1297,82 @@ async function serializeCompactAgentPage(parsed, samples, snapshotAgeMs, options
1410
1297
  return fits(encoded) ? encoded : JSON.stringify({ success: false, error: "LIST_AGENTS_RECOVERY_ID_TOO_LARGE", offset });
1411
1298
  }
1412
1299
 
1413
- // packages/ai/agent/dispatchSpeedProvenance.ts
1414
- var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
1415
- function isServerDispatchSpeedSource(value, dialogId, userId) {
1416
- const dialog = record(value);
1417
- const proof = record(dialog.dispatchSpeedProvenance);
1418
- return proof.version === 1 && proof.source === "server-startAgentRun" && proof.userId === userId && record(dialog.runtimeBinding).tenantUserId === userId && dialog.id === dialogId;
1419
- }
1420
- function isLocalDispatchSpeedSource(value, dialogId, userId) {
1421
- const run = record(value);
1422
- const proof = record(run.dispatchSpeedProvenance);
1423
- 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;
1300
+ // packages/ai/agent/defaultReasoningEffort.ts
1301
+ var defaults = {
1302
+ "gpt-6.2-sol": "medium",
1303
+ "gpt-6.2-astra": "high",
1304
+ "gpt-6.1-sol": "medium",
1305
+ "gpt-6.1-terra": "medium",
1306
+ "gpt-6-luna": "medium",
1307
+ "gpt-6-astra": "high",
1308
+ "claude-opus-5-5": "medium",
1309
+ "claude-sonnet-5-5": "high",
1310
+ "deepseek-flash": "high",
1311
+ "deepseek-v4-flash": "high",
1312
+ "deepseek-v4.1-flash": "high"
1313
+ };
1314
+ var deepseekChannels = /* @__PURE__ */ new Set(["opendesign", "ollama-cloud", "lithosai"]);
1315
+ var providers = /* @__PURE__ */ new Set(["nolo", "openai", "openrouter", "anthropic", "deepseek", "commandcode", "opencode-go", "stepfun"]);
1316
+ function resolveDefaultReasoningEffort(input) {
1317
+ const provider = (input.provider ?? "").toLowerCase();
1318
+ const model = (input.model ?? "").toLowerCase().split("/").pop() ?? "";
1319
+ const isDeepseekFlash = ["deepseek-flash", "deepseek-v4-flash", "deepseek-v4.1-flash"].includes(model);
1320
+ const effort = providers.has(provider) || deepseekChannels.has(provider) && isDeepseekFlash ? defaults[model] : void 0;
1321
+ if (!effort) return input.fallback;
1322
+ if (provider === "nolo" && model.startsWith("claude-") && input.model?.startsWith("anthropic/")) return effort;
1323
+ if (provider === "anthropic" && model.startsWith("claude-")) return effort;
1324
+ return resolveModelReasoningCapability(provider, input.model).efforts.includes(effort) ? effort : input.fallback;
1325
+ }
1326
+ function confirmedReasoningEfforts(provider, model) {
1327
+ const capability = resolveModelReasoningCapability(provider, model);
1328
+ if (capability.source === "provider-fallback") return void 0;
1329
+ if (capability.efforts.length === 0) return void 0;
1330
+ return capability.efforts;
1331
+ }
1332
+ var DISPATCH_EFFORT_PREFERENCES = {
1333
+ easy: ["low", "minimal", "medium"],
1334
+ normal: ["medium", "low", "high"],
1335
+ complex: ["high", "medium"],
1336
+ extreme: ["xhigh", "max", "high"]
1337
+ };
1338
+ var DISPATCH_DIFFICULTIES = /* @__PURE__ */ new Set(["easy", "normal", "complex", "extreme"]);
1339
+ function normalizeDifficulty(difficulty) {
1340
+ const normalized = (difficulty ?? "").trim().toLowerCase();
1341
+ return DISPATCH_DIFFICULTIES.has(normalized) ? normalized : "normal";
1342
+ }
1343
+ function asValidAgentEffort(raw) {
1344
+ const normalized = (raw ?? "").trim().toLowerCase();
1345
+ return REASONING_EFFORT_OPTIONS.includes(normalized) ? normalized : void 0;
1346
+ }
1347
+ function hasReasoningEffortSuffix(model) {
1348
+ const normalized = (model ?? "").trim().toLowerCase().split("/").pop() ?? "";
1349
+ return REASONING_EFFORT_SUFFIXES.some((suffix) => normalized.endsWith(`-${suffix}`));
1350
+ }
1351
+ function resolveDispatchReasoningEffort(input) {
1352
+ if (asValidAgentEffort(input.agentReasoningEffort)) return void 0;
1353
+ if (hasReasoningEffortSuffix(input.model)) return void 0;
1354
+ if (!(input.provider ?? "").trim() || !(input.model ?? "").trim()) return void 0;
1355
+ const efforts = confirmedReasoningEfforts(input.provider, input.model);
1356
+ if (!efforts) return void 0;
1357
+ const preferences = DISPATCH_EFFORT_PREFERENCES[normalizeDifficulty(input.difficulty)];
1358
+ return preferences.find((effort) => efforts.includes(effort));
1359
+ }
1360
+ function resolveEffectiveReasoningEffortOverride(input) {
1361
+ const override = asValidAgentEffort(input.override);
1362
+ if (!override) return void 0;
1363
+ if (asValidAgentEffort(input.recordReasoningEffort)) return void 0;
1364
+ if (hasReasoningEffortSuffix(input.model)) return void 0;
1365
+ if (!(input.provider ?? "").trim() || !(input.model ?? "").trim()) return void 0;
1366
+ const efforts = confirmedReasoningEfforts(input.provider, input.model);
1367
+ return efforts?.includes(override) ? override : void 0;
1368
+ }
1369
+ function withReasoningEffortOverride(config, effort) {
1370
+ if (!effort) return config;
1371
+ return {
1372
+ ...config,
1373
+ reasoning_effort: effort,
1374
+ ...config.rawRecord ? { rawRecord: { ...config.rawRecord, reasoning_effort: effort } } : {}
1375
+ };
1424
1376
  }
1425
1377
 
1426
1378
  export {
@@ -1430,12 +1382,15 @@ export {
1430
1382
  deriveCredentialGroup,
1431
1383
  deriveCustomProviderCredentialGroup,
1432
1384
  summarizeCredentialGroups,
1433
- resolveDiscoveryScope,
1434
- resolvePaginationArgs,
1435
- matchesAgentQuery,
1436
- buildAgentDiscoveryResult,
1437
- toDiscoverySafeAgentSummary,
1385
+ toSafeAgentSummary,
1386
+ sortSafeAgentSummaries,
1387
+ omitNullishAgentSummaryFields,
1388
+ promoteSharedCredentialGroupQuota,
1389
+ toCompactAgentSummary,
1390
+ toUltraCompactAgentSummary,
1438
1391
  injectSpeedContextIntoListAgentsResult,
1439
- isServerDispatchSpeedSource,
1440
- isLocalDispatchSpeedSource
1392
+ resolveDefaultReasoningEffort,
1393
+ resolveDispatchReasoningEffort,
1394
+ resolveEffectiveReasoningEffortOverride,
1395
+ withReasoningEffortOverride
1441
1396
  };