nolo-cli 0.219.0 → 0.220.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 (201) hide show
  1. package/{_executeModel-WW57SJN4.js → _executeModel-BNEMFCAO.js} +74 -74
  2. package/{action-CK64LS6S.js → action-GDZDXPMB.js} +7 -7
  3. package/{addContentAction-EQXMFNPR.js → addContentAction-7RO4AMRI.js} +12 -12
  4. package/{addDialogAgentAction-RSDZDASD.js → addDialogAgentAction-EVYBGTXB.js} +14 -14
  5. package/{agentDeleteCommand-X2VWEKUA.js → agentDeleteCommand-7QTQNFCO.js} +114 -115
  6. package/{agentEmailCommands-6IE773VW.js → agentEmailCommands-I7SHOSD6.js} +115 -116
  7. package/{agentFavoriteCommands-2LKGKSUD.js → agentFavoriteCommands-7LOP3HUD.js} +5 -5
  8. package/{agentGrantCommands-QQV4N4JW.js → agentGrantCommands-L6O2HVJI.js} +5 -5
  9. package/{agentListCommands-5UNM7CGG.js → agentListCommands-GUGMORTK.js} +84 -70
  10. package/{agentMachineCommands-EVWFKK6Q.js → agentMachineCommands-UMDKILU3.js} +56 -55
  11. package/{agentProviderCommands-ZCH37KAL.js → agentProviderCommands-STI3DQ6A.js} +6 -6
  12. package/{agentPullCommand-XN6ZPBUW.js → agentPullCommand-KHV4EELF.js} +5 -5
  13. package/{agentRecordCommands-DX2WE6BH.js → agentRecordCommands-YTAMTHOY.js} +102 -103
  14. package/{agentRunCommand-KGOT2AFB.js → agentRunCommand-DBM6YNO6.js} +113 -112
  15. package/{agentRunControl-QDFW5P2T.js → agentRunControl-MBG4U6SL.js} +20 -14
  16. package/{agentRuntimeLocal-SD7U2EGY.js → agentRuntimeLocal-TU4LA353.js} +39 -39
  17. package/{agentSlice-ACZGTZVW.js → agentSlice-DPG7Q7IA.js} +16 -16
  18. package/{appDeleteCommands-NE3NQQJL.js → appDeleteCommands-JWP3XPUA.js} +50 -49
  19. package/{appDeployCommands-2BAHY522.js → appDeployCommands-6E4TQCWI.js} +50 -49
  20. package/{appDeployStatusCommands-JTW6LZNC.js → appDeployStatusCommands-ALU4SADG.js} +50 -49
  21. package/{appGetCommands-WKFEJO6A.js → appGetCommands-JEY4L6L4.js} +50 -49
  22. package/{appListCommands-HNAZZLFX.js → appListCommands-PCAVHU7M.js} +50 -49
  23. package/{authCommand-4FDPL7WG.js → authCommand-CGRIIOOV.js} +26 -23
  24. package/{authCommands-GAJ3NIXO.js → authCommands-55OGQGCR.js} +9 -6
  25. package/{builtinSkillRegistry-PXH7EGQB.js → builtinSkillRegistry-BAE2LDXF.js} +4 -4
  26. package/{chromeOpsCommands-YKX2QX3A.js → chromeOpsCommands-WAA45NCS.js} +6 -6
  27. package/{chunk-OB6DVWPF.js → chunk-262R3XNN.js} +16 -2
  28. package/{chunk-5OZC7R7Y.js → chunk-2MCB7CD7.js} +13 -12
  29. package/{chunk-IWH5SOU4.js → chunk-2NPD3FTX.js} +3 -3
  30. package/{chunk-OGHP3CTL.js → chunk-2X7WFDT6.js} +1 -1
  31. package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
  32. package/{chunk-QWYFFHCJ.js → chunk-3NNXR7EH.js} +10 -10
  33. package/{chunk-JWXITTQB.js → chunk-3P54D2E4.js} +1 -1
  34. package/{chunk-EGXPAWLG.js → chunk-3U44JB3O.js} +1 -1
  35. package/{chunk-KAVGK4ES.js → chunk-44J7Z5AQ.js} +18 -18
  36. package/{chunk-YL3EFYL3.js → chunk-4D4QD7FT.js} +3 -1
  37. package/{chunk-EUCFKKDM.js → chunk-4I2MXV5Q.js} +38 -10
  38. package/{chunk-C4WTX5TU.js → chunk-4ZGPHFLE.js} +2 -2
  39. package/{chunk-FVZW66K4.js → chunk-53MFERZ3.js} +177 -94
  40. package/{chunk-MOMR7NMG.js → chunk-547ENH5T.js} +1 -1
  41. package/{chunk-N7HVLYOY.js → chunk-5WKDR7HS.js} +3 -3
  42. package/chunk-5ZUOVCKT.js +32 -0
  43. package/{chunk-TRWT3EE3.js → chunk-62HXNQVV.js} +1 -1
  44. package/{chunk-KOXKKHFE.js → chunk-6QHKRARD.js} +2 -2
  45. package/{chunk-N3J4VDGV.js → chunk-6RDBLXVQ.js} +15 -15
  46. package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
  47. package/{chunk-JC5XLWZK.js → chunk-7JGMNKKG.js} +19 -15
  48. package/{chunk-FRSBYNWI.js → chunk-AGYPUBFW.js} +31 -205
  49. package/{chunk-UYOICCYG.js → chunk-ALAES342.js} +59 -88
  50. package/{chunk-VREDDN25.js → chunk-ATEKLSLR.js} +1 -1
  51. package/{chunk-6NKA6RKF.js → chunk-AUAJTAFM.js} +8 -8
  52. package/{chunk-7UH3DGV6.js → chunk-AWIL6EHN.js} +7 -7
  53. package/chunk-BIDSIRTS.js +307 -0
  54. package/chunk-BIWI5M4E.js +62 -0
  55. package/{chunk-L5I543VB.js → chunk-BNMPUQW6.js} +1 -1
  56. package/{chunk-BGGHA5DV.js → chunk-BP5ZJ6B4.js} +1 -1
  57. package/{chunk-Q6HOUF4O.js → chunk-CBUZ6DKA.js} +3 -3
  58. package/{chunk-LE6LGAJE.js → chunk-CD3RU7XL.js} +17 -2
  59. package/{chunk-AVHRSJUH.js → chunk-CMMI3DAT.js} +13 -13
  60. package/{chunk-H7R3365N.js → chunk-CYWNWA77.js} +5 -5
  61. package/{chunk-6D7NVU66.js → chunk-D6YNCNM6.js} +17 -14
  62. package/{chunk-6RQFZCKH.js → chunk-DBUR22G5.js} +6 -6
  63. package/{chunk-PVZY6P3S.js → chunk-DEA37IUY.js} +2 -2
  64. package/{chunk-QLFCTYRH.js → chunk-DGYCDA6W.js} +3 -3
  65. package/{chunk-SRL56PI2.js → chunk-DUUDXSLX.js} +21 -7
  66. package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
  67. package/{chunk-PFJNLBRU.js → chunk-EEOOBRA7.js} +6 -6
  68. package/{chunk-KN3HEZIQ.js → chunk-EVGU5P4U.js} +1 -1
  69. package/{chunk-CXDPIPZ4.js → chunk-F6Z6ZCUV.js} +2 -2
  70. package/{chunk-EOWLBDY6.js → chunk-FJSNBZXR.js} +1 -1
  71. package/{chunk-GNHMRBYZ.js → chunk-G7IUT2V3.js} +4 -3
  72. package/{chunk-4NMHE7CX.js → chunk-GPOV42YM.js} +14 -14
  73. package/{chunk-SASHAZ67.js → chunk-GUXZK7SE.js} +2 -2
  74. package/{chunk-65XXHYZ5.js → chunk-GV6PRJBU.js} +3 -3
  75. package/{chunk-G2EJ7NL4.js → chunk-HBRDSQ3M.js} +2 -2
  76. package/{chunk-OOF7XDZF.js → chunk-HHFGE2WF.js} +6 -6
  77. package/{chunk-DJSTBAOU.js → chunk-HSSBDZLD.js} +4 -4
  78. package/{chunk-GIABSSWQ.js → chunk-HYLRQDEE.js} +4 -4
  79. package/{chunk-UJKTI5PG.js → chunk-ILHQ2AXT.js} +0 -1
  80. package/{chunk-S7SB7L2I.js → chunk-JJMR2EA3.js} +19 -19
  81. package/{chunk-3ESU44FG.js → chunk-JLAMNSBC.js} +3 -3
  82. package/{chunk-TVFRV3UQ.js → chunk-JUSHVFNF.js} +238 -185
  83. package/{chunk-MKQ2UTTX.js → chunk-KHVFJSVE.js} +22 -19
  84. package/{chunk-7WPAI5JJ.js → chunk-KRI6N5QZ.js} +14 -14
  85. package/{chunk-HCJFGH6Y.js → chunk-L32W3PRP.js} +46 -16
  86. package/{chunk-3N4ASIP6.js → chunk-LMRRCEDE.js} +11 -11
  87. package/{chunk-2KTUDBG7.js → chunk-M4SFKP5L.js} +1 -1
  88. package/{chunk-VHPAA6MT.js → chunk-MSMHU36U.js} +6 -6
  89. package/{chunk-F3TQURKK.js → chunk-MXKWTPUM.js} +19 -19
  90. package/{chunk-XFJ4ZPFC.js → chunk-MXRUXMZ3.js} +25 -25
  91. package/{chunk-OXKUPBAQ.js → chunk-NHY322ZU.js} +151 -10
  92. package/{chunk-UMRI2IRY.js → chunk-OBIC6EG7.js} +6 -6
  93. package/{chunk-VALBGPM6.js → chunk-OBSEKCVK.js} +17 -20
  94. package/{chunk-SYQR7FQS.js → chunk-OG6MQOQG.js} +96 -28
  95. package/{chunk-AMEOV5VZ.js → chunk-OOJNQK6V.js} +33 -33
  96. package/{chunk-K5FNYHZC.js → chunk-OWKNSIXL.js} +149 -54
  97. package/{chunk-CKT6QUE2.js → chunk-Q3IVPFVO.js} +1 -1
  98. package/{chunk-AFHOCBSP.js → chunk-QBZCGP34.js} +1 -1
  99. package/{chunk-2ZKFCIJJ.js → chunk-QCB42576.js} +1 -1
  100. package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
  101. package/{chunk-XWGDCWXY.js → chunk-QRGDJA4B.js} +9 -9
  102. package/{chunk-4A2JIXR2.js → chunk-QYB23WUH.js} +1 -1
  103. package/{chunk-652XYZGP.js → chunk-R44TU3MZ.js} +8 -3
  104. package/{chunk-2VUZSVAS.js → chunk-R6Z5S5GA.js} +7 -7
  105. package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
  106. package/{chunk-GGKNJ42M.js → chunk-RBPUNSG5.js} +2 -2
  107. package/{chunk-GVGOEMNV.js → chunk-RG2DGNL6.js} +3 -3
  108. package/{chunk-2OLYKYNY.js → chunk-RTHFJZ6M.js} +8 -8
  109. package/{chunk-C4VAR65S.js → chunk-RYOLWYBK.js} +120 -116
  110. package/{chunk-T3O6BLYU.js → chunk-S5NA3C52.js} +147 -115
  111. package/{chunk-D726I5AZ.js → chunk-S6FDXXZV.js} +2 -2
  112. package/{chunk-JVRQ6YVK.js → chunk-S6K5F3KP.js} +1 -1
  113. package/{chunk-IWQAOW2X.js → chunk-SRCCSTIM.js} +8 -8
  114. package/{chunk-KO63FPG3.js → chunk-SZVMASJ2.js} +750 -2523
  115. package/{chunk-Q7WP5RPC.js → chunk-TGNIKIHR.js} +5 -5
  116. package/{chunk-AK5O76CC.js → chunk-TI2EPRHE.js} +2 -2
  117. package/{chunk-5R63B62U.js → chunk-TSPMLCWI.js} +7 -7
  118. package/{chunk-QVBXJNZ2.js → chunk-TUSTONB3.js} +1 -1
  119. package/{chunk-KEN3N2TN.js → chunk-VMJVAJ6W.js} +13 -10
  120. package/{chunk-SOF4OWDM.js → chunk-VS276URX.js} +0 -2
  121. package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
  122. package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
  123. package/{chunk-J6T25AJ6.js → chunk-XSW4EXQV.js} +82 -18
  124. package/{chunk-O2CYENYJ.js → chunk-XTETTSKN.js} +2107 -1092
  125. package/{chunk-DVQH4BTR.js → chunk-YKY4OVOX.js} +14 -10
  126. package/{chunk-5RKUPJYL.js → chunk-ZH3KXFHS.js} +11 -3
  127. package/chunk-ZOHO6MOF.js +376 -0
  128. package/{cliAgentConfigHelpers-PO3MVDME.js → cliAgentConfigHelpers-BTRHMPW2.js} +12 -12
  129. package/{cliEnvHelpers-VPSJ4XWC.js → cliEnvHelpers-CNMP3RDX.js} +1 -1
  130. package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
  131. package/{cliLocalAgentRecordReader-Z7CH4K4R.js → cliLocalAgentRecordReader-M3F76NIP.js} +45 -45
  132. package/{commandRegistry-SDSYBKMC.js → commandRegistry-T3UBK6OA.js} +93 -93
  133. package/{contentThunks-G3TRPEAU.js → contentThunks-YEPZAHXU.js} +36 -35
  134. package/{cooldownCommands-X7P5M2V5.js → cooldownCommands-YB5H5BBK.js} +4 -4
  135. package/{createAgentAutomationAction-KHA4MXUJ.js → createAgentAutomationAction-TBIIO5WT.js} +36 -35
  136. package/{createDialogAction-KWSBNAPJ.js → createDialogAction-KBKMYFTQ.js} +37 -36
  137. package/{createPageAction-HXKJ7OFG.js → createPageAction-3FGAPLJO.js} +37 -36
  138. package/{db-CS4ZJQKV.js → db-M7FU2GNK.js} +9 -6
  139. package/{dbSlice-ZJPDIFER.js → dbSlice-XRUZOGSU.js} +11 -11
  140. package/{deleteFile-Q3YDB4ML.js → deleteFile-6URDHYRB.js} +7 -7
  141. package/{dialogCommands-6KQEBHSG.js → dialogCommands-NRLCOPJR.js} +52 -52
  142. package/{dialogNotifyCommand-WIZFFEY3.js → dialogNotifyCommand-SHGPCU22.js} +13 -13
  143. package/{dialogSlice-HXPKFGRL.js → dialogSlice-DP2WTMNO.js} +34 -33
  144. package/{dialogUsageCommand-HTVPR2CX.js → dialogUsageCommand-W2WCSGKF.js} +1 -1
  145. package/{docCreateCommands-XZOLWBRC.js → docCreateCommands-YJRDA3RX.js} +48 -47
  146. package/{docDeleteCommands-ZSO4LGWE.js → docDeleteCommands-A5QIHZNF.js} +50 -49
  147. package/{docReadCommands-TTMXCDER.js → docReadCommands-CF2LTMYH.js} +48 -47
  148. package/{docStore-A2B3GH33.js → docStore-NDY3K3PK.js} +12 -12
  149. package/{docUpdateCommands-PRG6WOXL.js → docUpdateCommands-QRKV4ZXE.js} +48 -47
  150. package/fetchMessages-TQEUZD7H.js +1 -1
  151. package/{getPricing-YH3VMSVU.js → getPricing-LF5C4XSI.js} +5 -5
  152. package/{handleSendMessageAction-NWYG3Q72.js → handleSendMessageAction-IUGVVJ43.js} +65 -65
  153. package/{hostCredentialCreate-WS6D3EHT.js → hostCredentialCreate-X2ZFRXDR.js} +102 -103
  154. package/index.js +56 -18
  155. package/keys-RWF7UCB4.js +1 -1
  156. package/{localDialogRead-SVTPA5GY.js → localDialogRead-CCOCVGAP.js} +1 -1
  157. package/{localRecall-2J6QPOK2.js → localRecall-BDYKXB46.js} +3 -1
  158. package/{localRuntimeAdapter-TFYOA6YE.js → localRuntimeAdapter-KAG3T4LF.js} +109 -110
  159. package/{machineCommands-WFWV25IR.js → machineCommands-6NIQJE2A.js} +111 -112
  160. package/{machineWsRunDispatch-ZGXC3F2R.js → machineWsRunDispatch-RA5NOSGG.js} +100 -101
  161. package/{memberThunks-JRYNONYV.js → memberThunks-7Y3OYSJQ.js} +15 -15
  162. package/{memoryCommands-5WC3T66U.js → memoryCommands-BC6REPQB.js} +4 -4
  163. package/{models-CXINDUJA.js → models-H5NNZRLH.js} +2 -2
  164. package/{overlay-THLKYIWY.js → overlay-BBQZXGYI.js} +5 -3
  165. package/package.json +1 -1
  166. package/{projectArchive-ULJDLUA6.js → projectArchive-OIUP63MV.js} +42 -41
  167. package/{providerPresetApply-SHT2SUVB.js → providerPresetApply-WHAMP2D5.js} +6 -6
  168. package/{providerRegistry-TA7EGCVZ.js → providerRegistry-ZI2KORJ7.js} +6 -6
  169. package/{read-Q7GOHGNP.js → read-TYMBGEXO.js} +8 -8
  170. package/{readDocTool-Z5OQ6422.js → readDocTool-SKQVHBLO.js} +1 -1
  171. package/{readlineWorkspace-LTCV2BFW.js → readlineWorkspace-ZGC4KSXG.js} +3946 -4393
  172. package/{removeDialogAgentAction-U3F2MNAY.js → removeDialogAgentAction-F5QE2O2B.js} +16 -16
  173. package/{runAgentClientLoop-BVIEQUB3.js → runAgentClientLoop-NKUW2DSJ.js} +71 -67
  174. package/{runtimeDoctorCommands-I47JN4HS.js → runtimeDoctorCommands-RRKPBGVO.js} +14 -14
  175. package/{secretCommands-LJXOOYA7.js → secretCommands-KZWBZIYS.js} +4 -4
  176. package/{setDialogExtraReferencesAction-G3WSJ7EM.js → setDialogExtraReferencesAction-72L27ERM.js} +13 -13
  177. package/{setPrimaryDialogAgentAction-6FHAHZBB.js → setPrimaryDialogAgentAction-GJJDUSGJ.js} +16 -16
  178. package/{settingThunks-AXTBX3Q5.js → settingThunks-ZRGWVGZD.js} +15 -15
  179. package/{skillDiscovery-B5V23AXP.js → skillDiscovery-I37M5KJC.js} +3 -3
  180. package/{spaceCommands-IB6FKWIC.js → spaceCommands-MEH3HJBC.js} +53 -52
  181. package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
  182. package/{streamAgentChatTurn-DNYFHBJM.js → streamAgentChatTurn-FJTUUXHJ.js} +89 -128
  183. package/{switchDialogAgentAction-UOFIAGPL.js → switchDialogAgentAction-IIJBPND3.js} +14 -14
  184. package/{tableCommands-HITDSLHS.js → tableCommands-FTAOCBTX.js} +11 -11
  185. package/{tools-JVOJ5HC4.js → tools-ZXHIAOSP.js} +58 -58
  186. package/tuiRestart-2IL37YIB.js +41 -0
  187. package/{tuiSummaryLlmCaller-7LWYTHLM.js → tuiSummaryLlmCaller-W2QN4VAC.js} +18 -18
  188. package/{updateCommands-RJVCRSBP.js → updateCommands-CPATDG6J.js} +8 -6
  189. package/{updateDialogTitleAction-Q57BOSXG.js → updateDialogTitleAction-JMKLKL4P.js} +36 -35
  190. package/{usageCommand-RVKHEPLU.js → usageCommand-2BF74MKF.js} +2 -2
  191. package/{usageRebuildCommand-GRAFOZF2.js → usageRebuildCommand-UHB55BQM.js} +3 -3
  192. package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-ZFD6J5HF.js} +2 -2
  193. package/chunk-2THCNKE4.js +0 -147
  194. package/chunk-KEPOVMF4.js +0 -91
  195. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +3 -3
  196. package/{chunk-AGP3YSEC.js → chunk-4N6G2CKP.js} +3 -3
  197. package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
  198. package/{chunk-SNBZZPYH.js → chunk-OQHIVPG4.js} +3 -3
  199. package/{chunk-47ITIXO7.js → chunk-USGHJSGO.js} +3 -3
  200. package/{offlineMarxistsAgentCommand-4IC3Y4C6.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +3 -3
  201. package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-HFJIN5IZ.js} +8 -8
@@ -4,28 +4,85 @@ import {
4
4
  import {
5
5
  compareAgentSelection,
6
6
  resolveModelTier
7
- } from "./chunk-C4VAR65S.js";
7
+ } from "./chunk-RYOLWYBK.js";
8
8
  import {
9
9
  DEFAULT_PROVIDER_RETRY_MS,
10
10
  isAgentUnavailableNow,
11
11
  resolveAgentAvailability
12
- } from "./chunk-HOCHUZQ7.js";
12
+ } from "./chunk-QJTZ76CP.js";
13
13
  import {
14
14
  isOAuthApiKeyRef
15
15
  } from "./chunk-UKZX3NHN.js";
16
+ import {
17
+ isOwnedAgentKey,
18
+ ownedAgentKey,
19
+ publicAgentKey
20
+ } from "./chunk-M2EJHDJP.js";
16
21
  import {
17
22
  getModelAbility
18
- } from "./chunk-TRWT3EE3.js";
23
+ } from "./chunk-62HXNQVV.js";
19
24
  import {
20
25
  isAntigravityOAuthAgent,
21
26
  isSubscriptionEndpoint,
22
27
  isSubscriptionOAuthCredential
23
- } from "./chunk-JC5XLWZK.js";
28
+ } from "./chunk-7JGMNKKG.js";
24
29
  import {
25
- isOwnedAgentKey,
26
- ownedAgentKey,
27
- publicAgentKey
28
- } from "./chunk-M2EJHDJP.js";
30
+ asTrimmedLowercaseString
31
+ } from "./chunk-QSJ3HFEF.js";
32
+
33
+ // packages/core/gptProTier.ts
34
+ var GPT_PRO_REQUIRED_RECHARGE_AMOUNT = 199;
35
+ var SUPPORTED_TIER_PROVIDERS = /* @__PURE__ */ new Set([
36
+ "nolo",
37
+ "openai",
38
+ "deepinfra"
39
+ ]);
40
+ var CLAUDE_PREMIUM_RE = /^(?:anthropic\/)?claude-(opus|fable)(?:-\d+(?:[.-]\d+)*(?:-[a-z0-9]+)*)?$/i;
41
+ var GPT_PRO_RE = /^(?:openai\/)?gpt-[a-z0-9.-]+-pro(?:-[a-z0-9]+(?:[.-][a-z0-9]+)*)?$/i;
42
+ var GPT_SOL_RE = /^(?:openai\/)?gpt-\d+(?:\.\d+)*-sol(?:-[a-z0-9]+(?:[.-][a-z0-9]+)*)?$/i;
43
+ var GPT_ASTRA_RE = /^(?:openai\/)?gpt-\d+(?:\.\d+)*-astra(?:-[a-z0-9]+(?:[.-][a-z0-9]+)*)?$/i;
44
+ var KIMI_K3_MODELS = /* @__PURE__ */ new Set([
45
+ "kimi-k3",
46
+ "moonshotai/kimi-k3"
47
+ ]);
48
+ function classifyPremiumModel(model) {
49
+ const normalizedModel = asTrimmedLowercaseString(model);
50
+ if (!normalizedModel) return void 0;
51
+ const claudeMatch = CLAUDE_PREMIUM_RE.exec(normalizedModel);
52
+ if (claudeMatch) {
53
+ return claudeMatch[1].toLowerCase() === "opus" ? "claude-opus" : "claude-fable";
54
+ }
55
+ if (GPT_PRO_RE.test(normalizedModel)) {
56
+ return "gpt-pro";
57
+ }
58
+ if (GPT_SOL_RE.test(normalizedModel)) {
59
+ return "gpt-sol";
60
+ }
61
+ if (GPT_ASTRA_RE.test(normalizedModel)) {
62
+ return "gpt-astra";
63
+ }
64
+ if (KIMI_K3_MODELS.has(normalizedModel)) {
65
+ return "kimi-k3";
66
+ }
67
+ return void 0;
68
+ }
69
+ function isGptProModel(provider, model) {
70
+ const normalizedProvider = asTrimmedLowercaseString(provider);
71
+ if (!SUPPORTED_TIER_PROVIDERS.has(normalizedProvider)) {
72
+ return false;
73
+ }
74
+ return classifyPremiumModel(model) !== void 0;
75
+ }
76
+ var GPT_PRO_BLOCKED_MESSAGE = `GPT Pro / Kimi K3 \u7B49\u9AD8\u7EA7\u6A21\u578B\u9700\u8981\u5148\u5F00\u901A ${GPT_PRO_REQUIRED_RECHARGE_AMOUNT} \u79EF\u5206\u6863\u4F4D\u3002`;
77
+ function shouldBlockForGptPro(input) {
78
+ if (input?.premium !== true || input?.platformPaid !== true) {
79
+ return { blocked: false };
80
+ }
81
+ if (asTrimmedLowercaseString(input.gptProStatus) === "active") {
82
+ return { blocked: false };
83
+ }
84
+ return { blocked: true, message: GPT_PRO_BLOCKED_MESSAGE };
85
+ }
29
86
 
30
87
  // packages/ai/agent/agentBilling.ts
31
88
  function resolveBillingSource(candidate) {
@@ -451,6 +508,14 @@ function toSafeAgentSummary(record, options) {
451
508
  isFavorite: favStatus.isFavorite,
452
509
  favoritedAt: favStatus.favoritedAt,
453
510
  isPublic,
511
+ // 复用 platformPaidCall.ts 的唯一判据(该文件头明确它是「谁出钱」的真源):
512
+ // 自己写 billingSource === "platform_credits" 会与 199 门槛口径分叉——
513
+ // 例如 apiSource==="cli" 的本地 CLI Agent 在 resolveBillingSource 里会落到
514
+ // platform_credits,但 isPlatformPaidAgentCall 显式短路为「非平台垫付」。
515
+ requiresPaidApproval: isPlatformPaidAgentCall({
516
+ agentConfig: record ?? void 0,
517
+ callerUserId: currentUserId ?? void 0
518
+ }),
454
519
  ...economics ? { economics } : {},
455
520
  isOwned,
456
521
  isOAuth,
@@ -478,6 +543,10 @@ var COMPACT_AGENT_SUMMARY_FIELDS = [
478
543
  "model",
479
544
  "modelTier",
480
545
  "billingSource",
546
+ // 扣费授权判据:listAgents 默认走 compact 投影,缺了它模型在默认派发
547
+ // 流程里读不到「派它之前要先问用户」(2026-11-15 事故成因)。
548
+ // 与 ULTRA_COMPACT 白名单必须同时保留——两处任何一处缺失都等于该字段不存在。
549
+ "requiresPaidApproval",
481
550
  "availabilityStatus",
482
551
  "credentialGroup",
483
552
  "isFavorite",
@@ -528,6 +597,9 @@ var ULTRA_COMPACT_AGENT_SUMMARY_FIELDS = [
528
597
  "model",
529
598
  "modelTier",
530
599
  "billingSource",
600
+ // 扣费授权判据必须随投影一起走:精简投影里没有它,模型就看不到
601
+ // 「派它之前要先问用户」,等于该字段不存在(2026-11-15 事故的直接成因)。
602
+ "requiresPaidApproval",
531
603
  "availabilityStatus",
532
604
  "credentialGroup",
533
605
  "isFavorite",
@@ -555,6 +627,39 @@ function toUltraCompactAgentSummary(summary) {
555
627
  return compact;
556
628
  }
557
629
 
630
+ // packages/ai/agent/platformPaidCall.ts
631
+ var asTrimmed = (value) => typeof value === "string" ? value.trim() : "";
632
+ var hasOAuthCredentialShape = (agentConfig) => isOAuthApiKeyRef(agentConfig?.apiKeyRef) || isAntigravityOAuthAgent({
633
+ key: "platform-paid-call-probe",
634
+ apiKeyRef: agentConfig?.apiKeyRef ?? void 0,
635
+ provider: agentConfig?.provider ?? void 0,
636
+ customProviderUrl: agentConfig?.customProviderUrl ?? void 0
637
+ });
638
+ function isPlatformPaidAgentCall(probe) {
639
+ const agentConfig = probe?.agentConfig ?? {};
640
+ const authKind = asTrimmed(probe?.authKind);
641
+ if (authKind) return authKind === "platform-key";
642
+ if (asTrimmed(agentConfig.apiSource) === "cli") return false;
643
+ return resolveBillingSource({
644
+ local: agentConfig.local,
645
+ isLocal: agentConfig.isLocal,
646
+ cliProvider: agentConfig.cliProvider,
647
+ apiSource: agentConfig.apiSource,
648
+ provider: agentConfig.provider,
649
+ billingSource: agentConfig.billingSource,
650
+ // 形态证明而非记录自声明(见文件头):自声明 isOAuth 不足以证明 OAuth 通道归属。
651
+ isOAuth: hasOAuthCredentialShape(agentConfig),
652
+ apiKeyRef: agentConfig.apiKeyRef,
653
+ customProviderUrl: agentConfig.customProviderUrl,
654
+ isOwned: isOwnedAgentRecord(
655
+ agentConfig,
656
+ asTrimmed(probe?.callerUserId) || void 0
657
+ ),
658
+ userId: agentConfig.userId,
659
+ ownerId: agentConfig.ownerId
660
+ }) === "platform_credits";
661
+ }
662
+
558
663
  // packages/ai/agent/agentDiscovery.ts
559
664
  function isPreferredAgent(agent) {
560
665
  return agent.isFavorite === true || agent.isOwned === true || agent.isOAuth === true || agent.billingSource === "user_subscription" || agent.billingSource === "user_api" || agent.billingSource === "local";
@@ -616,6 +721,36 @@ function filterAgentsByScope(agents, scope) {
616
721
  if (scope === "public") return unique.filter((agent) => isPublicDiscoveryAgent(agent));
617
722
  return unique.filter((agent) => isPreferredAgent(agent) || agent.isPublic === true);
618
723
  }
724
+ function recommendPlanning(agents, caller, poolComplete) {
725
+ const callerKey = typeof caller?.agentKey === "string" && caller.agentKey.trim() ? caller.agentKey : void 0;
726
+ const current = callerKey ? agents.find((a) => a.agentKey === callerKey) : void 0;
727
+ const currentTier = callerKey ? resolveModelTier(caller?.effectiveModel ?? current?.model) : "unknown";
728
+ const base = {
729
+ condition: "when_planning_needed_and_candidate_suitable",
730
+ action: "self",
731
+ currentTier,
732
+ poolComplete,
733
+ requiresPaidApproval: false
734
+ };
735
+ if (caller?.runKind === "subtask") return { ...base, reason: "bounded_subtask" };
736
+ if (!callerKey) return { ...base, reason: "caller_unknown" };
737
+ if (currentTier === "unknown") return { ...base, reason: "caller_tier_unknown" };
738
+ if (!poolComplete) return { ...base, reason: "pool_incomplete" };
739
+ const ranks = { easy: 0, normal: 1, complex: 2, extreme: 3 };
740
+ const higher = agents.filter((a) => a.agentKey && a.agentKey !== callerKey && a.modelTier !== "unknown" && ranks[a.modelTier] > ranks[currentTier]);
741
+ const free = higher.filter((a) => a.requiresPaidApproval === false);
742
+ free.sort((a, b) => ranks[b.modelTier] - ranks[a.modelTier]);
743
+ const best = free[0];
744
+ if (best) return {
745
+ ...base,
746
+ action: "delegate",
747
+ reason: "higher_suitable_agent",
748
+ agentKey: best.agentKey,
749
+ recommendedTier: best.modelTier
750
+ };
751
+ if (higher.length) return { ...base, reason: "paid_approval_required", requiresPaidApproval: true };
752
+ return { ...base, reason: "no_higher_suitable_agent" };
753
+ }
619
754
  function resolvePaginationArgs(args) {
620
755
  let limit;
621
756
  let offset;
@@ -754,6 +889,11 @@ function buildAgentDiscoveryResult(options) {
754
889
  ...isTruncated ? { truncated: true } : {},
755
890
  unavailableCount,
756
891
  agents: projectedAgents,
892
+ planningRecommendation: recommendPlanning(
893
+ sortedAgents,
894
+ options.caller,
895
+ !isTruncated && scope === "all" && !hasQuery && !options.poolRestricted
896
+ ),
757
897
  credentialGroups
758
898
  };
759
899
  }
@@ -763,11 +903,12 @@ function toDiscoverySafeAgentSummary(record, options) {
763
903
  }
764
904
 
765
905
  export {
766
- resolveBillingSource,
906
+ isGptProModel,
907
+ shouldBlockForGptPro,
908
+ isPlatformPaidAgentCall,
767
909
  deriveCredentialGroup,
768
910
  deriveCustomProviderCredentialGroup,
769
911
  summarizeCredentialGroups,
770
- isOwnedAgentRecord,
771
912
  resolveDiscoveryScope,
772
913
  resolvePaginationArgs,
773
914
  matchesAgentQuery,
@@ -5,21 +5,21 @@ import {
5
5
  ANTIGRAVITY_CLOUD_CODE_BASE_URL,
6
6
  isAntigravityCloudCodeBaseUrl,
7
7
  isAntigravityOAuthAgent
8
- } from "./chunk-JC5XLWZK.js";
8
+ } from "./chunk-7JGMNKKG.js";
9
9
  import {
10
10
  isOpenAiResponsesModel,
11
11
  resolvePlatformChatCompletionsEndpoint,
12
12
  resolvePlatformResponsesEndpoint
13
- } from "./chunk-G2EJ7NL4.js";
13
+ } from "./chunk-HBRDSQ3M.js";
14
14
  import {
15
15
  findModelConfig
16
- } from "./chunk-LE6LGAJE.js";
17
- import {
18
- asTrimmedLowercaseString
19
- } from "./chunk-QSJ3HFEF.js";
16
+ } from "./chunk-CD3RU7XL.js";
20
17
  import {
21
18
  asOptionalTrimmedString
22
19
  } from "./chunk-G3SUCT4W.js";
20
+ import {
21
+ asTrimmedLowercaseString
22
+ } from "./chunk-QSJ3HFEF.js";
23
23
 
24
24
  // packages/agent-runtime/agentCallPlan.ts
25
25
  var CODEX_RESPONSES_URL = "https://chatgpt.com/backend-api/codex/responses";
@@ -92,11 +92,10 @@ var PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL = "deepseek-flash";
92
92
  var PLATFORM_HOSTED_DEEPSEEK_FLASH_VISION_EXP_MODEL = "deepseek-v4-flash-vision-exp";
93
93
  var PLATFORM_HOSTED_DEEPSEEK_PRO_MODEL = "deepseek-v4-pro";
94
94
  var PLATFORM_HOSTED_LEGACY_DEEPSEEK_V4_FLASH_MODEL = "deepseek-v4-flash";
95
- var CLOUDFLARE_GPT_6_ASTRA_UPSTREAM_MODEL_ID = "openai/gpt-6-astra";
96
- var CLOUDFLARE_GPT_6_LUNA_UPSTREAM_MODEL_ID = "openai/gpt-6-luna";
97
- var CLOUDFLARE_GPT_6_1_TERRA_UPSTREAM_MODEL_ID = "openai/gpt-6.1-terra";
95
+ var OPENAI_GPT_6_ASTRA_UPSTREAM_MODEL_ID = "gpt-6-astra";
96
+ var OPENAI_GPT_6_LUNA_UPSTREAM_MODEL_ID = "gpt-6-luna";
98
97
  var OPENAI_GPT_6_1_SOL_UPSTREAM_MODEL_ID = "gpt-6.1-sol";
99
- var CLOUDFLARE_AI_RESPONSES_ENDPOINT_TEMPLATE = "https://api.cloudflare.com/client/v4/accounts/{account}/ai/v1/responses";
98
+ var OPENAI_GPT_6_1_TERRA_UPSTREAM_MODEL_ID = "gpt-6.1-terra";
100
99
  var PLATFORM_HOSTED_KIMI_K3_MIN_CLIENT_VERSION = "0.38.0-alpha.4";
101
100
  var PLATFORM_HOSTED_GLM_53_FLASH_MIN_CLIENT_VERSION = "0.33.0-alpha.1";
102
101
  var PLATFORM_HOSTED_ROUTING_TABLE = {
@@ -329,19 +328,19 @@ var PLATFORM_HOSTED_ROUTING_TABLE = {
329
328
  // 集成块(2026-10-13)已为 server agentRun 加专用 wire 分支:这 6 条(含兼容别名 id)
330
329
  // 的 agentRunHosted 翻为 true,专用分支按该开关放行、token/账号缺一在任何 fetch 前显式失败;
331
330
  [PLATFORM_HOSTED_GPT_6_ASTRA_MODEL]: {
332
- endpoint: CLOUDFLARE_AI_RESPONSES_ENDPOINT_TEMPLATE,
333
- usageProvider: "cloudflare",
334
- keyName: "cloudflare",
335
- upstreamModelId: CLOUDFLARE_GPT_6_ASTRA_UPSTREAM_MODEL_ID,
331
+ endpoint: "https://api.openai.com/v1/responses",
332
+ usageProvider: "openai",
333
+ keyName: "openai",
334
+ upstreamModelId: OPENAI_GPT_6_ASTRA_UPSTREAM_MODEL_ID,
336
335
  wire: "responses",
337
336
  agentRunHosted: true
338
337
  },
339
- // GPT-6 Luna(2026-09-22 随 GPT-6 Sol/Luna 上线):CF catalog id `openai/gpt-6-luna`。
338
+ // GPT-6 Luna(2026-09-22 随 GPT-6 Sol/Luna 上线):官方直连 Responses 线。
340
339
  [PLATFORM_HOSTED_GPT_6_LUNA_MODEL]: {
341
- endpoint: CLOUDFLARE_AI_RESPONSES_ENDPOINT_TEMPLATE,
342
- usageProvider: "cloudflare",
343
- keyName: "cloudflare",
344
- upstreamModelId: CLOUDFLARE_GPT_6_LUNA_UPSTREAM_MODEL_ID,
340
+ endpoint: "https://api.openai.com/v1/responses",
341
+ usageProvider: "openai",
342
+ keyName: "openai",
343
+ upstreamModelId: OPENAI_GPT_6_LUNA_UPSTREAM_MODEL_ID,
345
344
  wire: "responses",
346
345
  agentRunHosted: true
347
346
  },
@@ -358,14 +357,12 @@ var PLATFORM_HOSTED_ROUTING_TABLE = {
358
357
  wire: "responses",
359
358
  agentRunHosted: true
360
359
  },
361
- // GPT-6.1 Terra(2026-11-01 新增):与 6.1 Sol 同一条 Responses 线(CF 官方页同样
362
- // 只声明「Responses, Chat Completions」与 reasoning.effort);上游是独立 catalog id,
363
- // 不得与 sol 混用。不是任何模型的别名 —— gpt-5.6-terra 仍指它自己的 5.6 上游。
360
+ // GPT-6.1 Terra(2026-11-01 新增):官方直连 Responses 线。
364
361
  [PLATFORM_HOSTED_GPT_6_1_TERRA_MODEL]: {
365
- endpoint: CLOUDFLARE_AI_RESPONSES_ENDPOINT_TEMPLATE,
366
- usageProvider: "cloudflare",
367
- keyName: "cloudflare",
368
- upstreamModelId: CLOUDFLARE_GPT_6_1_TERRA_UPSTREAM_MODEL_ID,
362
+ endpoint: "https://api.openai.com/v1/responses",
363
+ usageProvider: "openai",
364
+ keyName: "openai",
365
+ upstreamModelId: OPENAI_GPT_6_1_TERRA_UPSTREAM_MODEL_ID,
369
366
  wire: "responses",
370
367
  agentRunHosted: true
371
368
  },
@@ -7,21 +7,22 @@ import {
7
7
  listUserRecordsFromServers,
8
8
  readDbRecordFromServers,
9
9
  readLiveDbRecordAfterTombstoneMerge
10
- } from "./chunk-AFHOCBSP.js";
10
+ } from "./chunk-QBZCGP34.js";
11
11
  import {
12
12
  parsePositiveFiniteNumberOrFallback
13
13
  } from "./chunk-Y5GCAMGP.js";
14
14
  import {
15
+ buildDialogAttachmentPlan,
16
+ extractFileContentIds,
15
17
  fetchWithTransientRetry
16
- } from "./chunk-KFHREHUQ.js";
18
+ } from "./chunk-DXWGFL2Z.js";
17
19
  import {
18
20
  DRAIN_EXHAUSTED_USER_MESSAGE,
19
21
  isDrainExhaustedResponse
20
22
  } from "./chunk-3L2WKC3W.js";
21
23
  import {
22
- buildDialogAttachmentPlan,
23
- extractFileContentIds
24
- } from "./chunk-KEPOVMF4.js";
24
+ createClientLogger
25
+ } from "./chunk-QQ56R7KS.js";
25
26
  import {
26
27
  getDefaultCliLocalRuntimeDb
27
28
  } from "./chunk-P2ZLUIW2.js";
@@ -34,13 +35,13 @@ import {
34
35
  resolveServerDbPath
35
36
  } from "./chunk-GLKOYSRU.js";
36
37
  import {
37
- createClientLogger
38
- } from "./chunk-QQ56R7KS.js";
38
+ resolveRunsDir
39
+ } from "./chunk-OWKNSIXL.js";
39
40
  import {
40
41
  boundSummaryText,
41
42
  buildDialogReadEnvelope,
42
43
  projectDialogReadForAgent
43
- } from "./chunk-C4VAR65S.js";
44
+ } from "./chunk-RYOLWYBK.js";
44
45
  import {
45
46
  asRecordOrEmpty
46
47
  } from "./chunk-KX6YBIHG.js";
@@ -58,11 +59,16 @@ import {
58
59
  asTrimmedNonEmptyStringArray
59
60
  } from "./chunk-I42VC5KR.js";
60
61
  import {
61
- t
62
- } from "./chunk-OB6DVWPF.js";
62
+ parseUserIdFromAuthToken,
63
+ readOption,
64
+ resolveAuthToken,
65
+ resolveDeleteServerCandidates,
66
+ resolveServerCandidates,
67
+ resolveServerUrl
68
+ } from "./chunk-BIDSIRTS.js";
63
69
  import {
64
- resolveRunsDir
65
- } from "./chunk-K5FNYHZC.js";
70
+ t
71
+ } from "./chunk-262R3XNN.js";
66
72
  import {
67
73
  toErrorMessage
68
74
  } from "./chunk-HNMXYYJR.js";
@@ -72,14 +78,6 @@ import {
72
78
  import {
73
79
  isRecord
74
80
  } from "./chunk-KUG52IAP.js";
75
- import {
76
- parseUserIdFromAuthToken,
77
- readOption,
78
- resolveAuthToken,
79
- resolveDeleteServerCandidates,
80
- resolveServerCandidates,
81
- resolveServerUrl
82
- } from "./chunk-2THCNKE4.js";
83
81
  import {
84
82
  asOptionalTrimmedString
85
83
  } from "./chunk-G3SUCT4W.js";
@@ -87,6 +85,10 @@ import {
87
85
  DEFAULT_LOCAL_API_ORIGIN
88
86
  } from "./chunk-4SN6J65J.js";
89
87
 
88
+ // packages/cli/dialogCommands.ts
89
+ import { write as writeFd } from "node:fs";
90
+ import { Writable } from "node:stream";
91
+
90
92
  // packages/cli/dialogAttachmentCleanup.ts
91
93
  function asText(value) {
92
94
  return asOptionalTrimmedString(value) ?? null;
@@ -344,6 +346,73 @@ ${indented}`);
344
346
  output.write(`${JSON.stringify(value, null, 2)}
345
347
  `);
346
348
  }
349
+ async function writeDialogReadJson(output, json) {
350
+ const text = `${json}
351
+ `;
352
+ if (output === process.stdout) {
353
+ const bytes = Buffer.from(text, "utf8");
354
+ let offset = 0;
355
+ while (offset < bytes.length) {
356
+ const written = await new Promise((resolve, reject) => {
357
+ const attempt = () => writeFd(1, bytes, offset, Math.min(16384, bytes.length - offset), null, (error, count) => {
358
+ if (error?.code === "EAGAIN" || error?.code === "EWOULDBLOCK") {
359
+ setTimeout(attempt, 1);
360
+ } else if (error) reject(error);
361
+ else resolve(count);
362
+ });
363
+ attempt();
364
+ });
365
+ if (written <= 0) throw new Error("stdout write made no progress");
366
+ offset += written;
367
+ }
368
+ } else if (output instanceof Writable) {
369
+ await new Promise((resolve, reject) => {
370
+ let settled = false;
371
+ let writeStarted = false;
372
+ let stateCheck;
373
+ const cleanup = () => {
374
+ clearInterval(stateCheck);
375
+ output.off("error", onError);
376
+ output.off("close", checkState);
377
+ output.off("finish", checkState);
378
+ };
379
+ const settle = (error) => {
380
+ if (settled) return;
381
+ settled = true;
382
+ if (error) setTimeout(() => {
383
+ cleanup();
384
+ reject(error);
385
+ }, 0);
386
+ else {
387
+ cleanup();
388
+ resolve();
389
+ }
390
+ };
391
+ const onError = (error) => settle(error);
392
+ const checkState = () => {
393
+ if (output.errored) settle(output.errored);
394
+ else if (output.destroyed || output.closed || output.writableFinished || !writeStarted && output.writableEnded) {
395
+ settle(new Error("stdout Writable closed before write completion"));
396
+ }
397
+ };
398
+ output.on("error", onError);
399
+ output.on("close", checkState);
400
+ output.on("finish", checkState);
401
+ checkState();
402
+ if (settled) return;
403
+ stateCheck = setInterval(checkState, 10);
404
+ try {
405
+ writeStarted = true;
406
+ output.write(text, (error) => settle(error));
407
+ checkState();
408
+ } catch (error) {
409
+ settle(error instanceof Error ? error : new Error(String(error)));
410
+ }
411
+ });
412
+ } else {
413
+ output.write(text);
414
+ }
415
+ }
347
416
  function writeJsonlStream(output, items) {
348
417
  for (const item of items) {
349
418
  output.write(`${JSON.stringify(item)}
@@ -782,7 +851,7 @@ function isExplicitDialogIdMismatch(meta, dialogId) {
782
851
  return meta && typeof meta === "object" && "id" in meta && meta.id != null && String(meta.id) !== dialogId;
783
852
  }
784
853
  async function readDialogFromLocalDb(dialogKey, dialogId, limit, readLocalDialog) {
785
- const reader = readLocalDialog ?? (await import("./localDialogRead-SVTPA5GY.js")).readDialogFromLocalDb;
854
+ const reader = readLocalDialog ?? (await import("./localDialogRead-CCOCVGAP.js")).readDialogFromLocalDb;
786
855
  const result = await reader({ dialogKey, dialogId, limit });
787
856
  return {
788
857
  ...result,
@@ -797,7 +866,7 @@ async function readLocalDialogAtDbPathDefault(args) {
797
866
  );
798
867
  }
799
868
  const db = await getDefaultCliLocalRuntimeDb();
800
- const { readDialogFromLocalDb: reader } = await import("./localDialogRead-SVTPA5GY.js");
869
+ const { readDialogFromLocalDb: reader } = await import("./localDialogRead-CCOCVGAP.js");
801
870
  return reader({ ...args, db });
802
871
  }
803
872
  async function readDialogFromLocalDbWithFallback(args) {
@@ -1355,11 +1424,10 @@ async function runDialogReadCommand(args, deps = {}) {
1355
1424
  },
1356
1425
  options: { maxResponseChars: agentMaxResponseChars }
1357
1426
  });
1358
- output.write(built.serialized);
1359
- output.write("\n");
1427
+ await writeDialogReadJson(output, built.serialized);
1360
1428
  return 0;
1361
1429
  }
1362
- output.write(JSON.stringify({
1430
+ await writeDialogReadJson(output, JSON.stringify({
1363
1431
  source: read.source,
1364
1432
  base: read.resolvedBase,
1365
1433
  triedBases: read.candidateBases,
@@ -1408,11 +1476,11 @@ async function runDialogReadCommand(args, deps = {}) {
1408
1476
  lastAssistantMessage,
1409
1477
  messages: outputMsgs
1410
1478
  }, null, 2));
1411
- output.write("\n");
1412
1479
  return 0;
1413
1480
  } catch (error) {
1414
- output.write(`${formatDialogReadFailure(error, target.dialogId)}
1415
- `);
1481
+ const diagnostic = `${formatDialogReadFailure(error, target.dialogId)}
1482
+ `;
1483
+ (deps.error ?? (output instanceof Writable ? process.stderr : output)).write(diagnostic);
1416
1484
  return 1;
1417
1485
  }
1418
1486
  }
@@ -2,33 +2,6 @@ import {
2
2
  estimateTokenCount
3
3
  } from "./chunk-PSCNXBYA.js";
4
4
 
5
- // packages/ai/tools/agent/agentRunName.ts
6
- async function resolveAgentRunName(agentKey, candidates, readAgent) {
7
- for (const candidate of candidates) {
8
- if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
9
- }
10
- try {
11
- const record = await readAgent?.(agentKey);
12
- if (!record?.deletedAt && !record?.deleted && !record?.isDeleted && typeof record?.name === "string" && record.name.trim()) {
13
- return record.name.trim();
14
- }
15
- } catch {
16
- }
17
- return shortAgentKey(agentKey);
18
- }
19
- function shortAgentKey(agentKey) {
20
- return agentKey.trim().slice(-24) || "unknown-agent";
21
- }
22
-
23
- // packages/ai/tools/agent/runTitle.ts
24
- var RUN_TITLE_MAX = 60;
25
- function normalizeRunTitle(value) {
26
- if (typeof value !== "string") return void 0;
27
- const cleaned = value.replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").replace(/\s+/g, " ").trim();
28
- if (!cleaned) return void 0;
29
- return cleaned.length > RUN_TITLE_MAX ? `${cleaned.slice(0, RUN_TITLE_MAX - 1)}\u2026` : cleaned;
30
- }
31
-
32
5
  // packages/ai/tools/agent/agentRunDisplayHelpers.ts
33
6
  function buildDelegatedTaskContent(task, input) {
34
7
  if (input === void 0 || input === null) {
@@ -381,7 +354,7 @@ function formatAgentListCard(agents, maxDisplay = 8, now = /* @__PURE__ */ new D
381
354
  const model = agent.model || "\u2014";
382
355
  const source = agent.apiSource || agent.provider || agent.cliProvider || "\u2014";
383
356
  const key = agent.agentKey || "(agentKey unavailable)";
384
- lines.push(`${star}${own} ${name} ${model} ${source}${includeKeys ? ` ${key}` : ""}`);
357
+ lines.push(`${star} ${own} ${name} ${model} ${source}${includeKeys ? ` ${key}` : ""}`);
385
358
  if (agent.availabilityStatus === "rate_limited" || agent.availabilityStatus === "quota_exhausted") {
386
359
  const until = typeof agent.nextAvailableAt === "number" ? formatLocalClockUntil(agent.nextAvailableAt, now) : void 0;
387
360
  lines.push(
@@ -403,11 +376,34 @@ function formatLocalClockUntil(atMs, now) {
403
376
  return sameDay ? time : `${pad(at.getMonth() + 1)}-${pad(at.getDate())} ${time}`;
404
377
  }
405
378
 
379
+ // packages/ai/tools/agent/agentRunName.ts
380
+ async function resolveAgentRunName(agentKey, candidates, readAgent) {
381
+ for (const candidate of candidates) {
382
+ if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
383
+ }
384
+ try {
385
+ const record = await readAgent?.(agentKey);
386
+ if (!record?.deletedAt && !record?.deleted && !record?.isDeleted && typeof record?.name === "string" && record.name.trim()) {
387
+ return record.name.trim();
388
+ }
389
+ } catch {
390
+ }
391
+ return shortAgentKey(agentKey);
392
+ }
393
+ function shortAgentKey(agentKey) {
394
+ return agentKey.trim().slice(-24) || "unknown-agent";
395
+ }
396
+
397
+ // packages/ai/tools/agent/runTitle.ts
398
+ var RUN_TITLE_MAX = 60;
399
+ function normalizeRunTitle(value) {
400
+ if (typeof value !== "string") return void 0;
401
+ const cleaned = value.replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").replace(/\s+/g, " ").trim();
402
+ if (!cleaned) return void 0;
403
+ return cleaned.length > RUN_TITLE_MAX ? `${cleaned.slice(0, RUN_TITLE_MAX - 1)}\u2026` : cleaned;
404
+ }
405
+
406
406
  export {
407
- resolveAgentRunName,
408
- shortAgentKey,
409
- RUN_TITLE_MAX,
410
- normalizeRunTitle,
411
407
  buildDelegatedTaskContent,
412
408
  calculateDelegatedPayloadMetrics,
413
409
  getAgentRunStatusIcon,
@@ -427,5 +423,9 @@ export {
427
423
  formatListRunsCard,
428
424
  formatNotFoundRunCard,
429
425
  isAgentRunTerminalStatus,
430
- formatAgentListCard
426
+ formatAgentListCard,
427
+ resolveAgentRunName,
428
+ shortAgentKey,
429
+ RUN_TITLE_MAX,
430
+ normalizeRunTitle
431
431
  };