nolo-cli 0.106.0-alpha.1 → 0.106.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 (210) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-C5ZUOC7O.js → _executeModel-EP6HAX3W.js} +77 -69
  3. package/action-GVA5ARSJ.js +20 -0
  4. package/{addContentAction-O7R66HEX.js → addContentAction-NZZNAVCB.js} +13 -12
  5. package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-5HVGEIXI.js} +19 -20
  6. package/{agentDeleteCommand-YB3S2LPY.js → agentDeleteCommand-M25A6UGB.js} +118 -43
  7. package/{agentEmailCommands-YBCBTG6X.js → agentEmailCommands-RUL4NL64.js} +99 -89
  8. package/agentListCommands-KSPFKHFO.js +741 -0
  9. package/{agentMachineCommands-QHYLBTVW.js → agentMachineCommands-IHBB6PHD.js} +48 -44
  10. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-ND4S2Q6Q.js} +97 -2
  11. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
  12. package/agentRecordCommands-7OKIBN6H.js +138 -0
  13. package/agentRunCommand-GBKJTQQU.js +167 -0
  14. package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
  15. package/{agentRuntimeLocal-FRUE5P2V.js → agentRuntimeLocal-E5HXZNXZ.js} +44 -40
  16. package/{agentSlice-7OEXULAY.js → agentSlice-7T3ZLYET.js} +15 -14
  17. package/{appDeleteCommands-JPWTSFID.js → appDeleteCommands-TTJUYTQN.js} +46 -42
  18. package/{appDeployCommands-YCVY2UYO.js → appDeployCommands-65WYK2TQ.js} +46 -42
  19. package/{appDeployStatusCommands-JMCEIKTI.js → appDeployStatusCommands-U4XESYYG.js} +46 -42
  20. package/{appGetCommands-EXWT3QAE.js → appGetCommands-VNHZZC4D.js} +46 -42
  21. package/{appListCommands-PKRLSWRE.js → appListCommands-O667ZEU6.js} +46 -42
  22. package/{authCommand-F4EFRRX6.js → authCommand-SUHHTVHA.js} +118 -24
  23. package/{authCommands-RGOGCPP6.js → authCommands-5RTUDYZW.js} +7 -5
  24. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-PUGT65WS.js} +11 -9
  25. package/{chromeCommands-FZYAU75D.js → chromeCommands-AU5ZJXBG.js} +289 -37
  26. package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-ZYTCMNHG.js} +156 -22
  27. package/{chunk-ZNV445LB.js → chunk-2NGKYC3L.js} +29 -9
  28. package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
  29. package/{chunk-HVURBGF3.js → chunk-2U3NHADM.js} +6 -6
  30. package/{chunk-XA2FJW4L.js → chunk-3SXZ6SUC.js} +11 -9
  31. package/{chunk-UKZDAFYT.js → chunk-3VKDWQMJ.js} +6 -10
  32. package/chunk-4LCOCOR5.js +50 -0
  33. package/{chunk-JPGCXHNM.js → chunk-4LKMZ3RR.js} +1 -1
  34. package/{chunk-PQFHGD77.js → chunk-4VDS344D.js} +161 -14
  35. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  36. package/{chunk-6D6VBVEW.js → chunk-4W24JM32.js} +80 -14
  37. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  38. package/{chunk-GQBOR3G6.js → chunk-5F7UKMLN.js} +8 -4
  39. package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
  40. package/chunk-5MMAK75Q.js +15 -0
  41. package/{chunk-7S4YWN7P.js → chunk-5UUIGN6I.js} +4 -4
  42. package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
  43. package/{chunk-YCJN2RA3.js → chunk-6AIURTE7.js} +20 -11
  44. package/{chunk-VLTIYV3X.js → chunk-7I25CBT5.js} +34 -8
  45. package/chunk-AGIM7IMJ.js +147 -0
  46. package/{chunk-S4VLC46A.js → chunk-AM4G3LDJ.js} +66 -54
  47. package/{chunk-5UTFL4QJ.js → chunk-AOTBKDRK.js} +7 -0
  48. package/{chunk-TJGWNDGO.js → chunk-AZB6HR4I.js} +846 -276
  49. package/{chunk-L5UXH3B2.js → chunk-BIH7KCDJ.js} +58 -9
  50. package/{chunk-UZGQNTVW.js → chunk-BPLIXNC6.js} +8 -6
  51. package/chunk-CEQ75WPL.js +915 -0
  52. package/chunk-CHOZJMJS.js +78 -0
  53. package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
  54. package/{chunk-GPCZ7UXG.js → chunk-DBKRC5O2.js} +1 -1
  55. package/chunk-DJ3JABG5.js +7990 -0
  56. package/{chunk-Q554LLSI.js → chunk-DMXLXZKL.js} +1 -1
  57. package/{chunk-UOBDA2JS.js → chunk-DSXRVBTA.js} +118 -90
  58. package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
  59. package/{chunk-HJUYAD4A.js → chunk-EBS4FKW4.js} +5 -5
  60. package/{chunk-LC43IGO4.js → chunk-EHGIEGLI.js} +834 -962
  61. package/{chunk-ABQYVJBJ.js → chunk-EV235ILT.js} +5 -5
  62. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  63. package/{chunk-TOP2VXOR.js → chunk-FJKZSR5P.js} +5 -5
  64. package/{chunk-2F7RJC6L.js → chunk-FOXQ7BAB.js} +1 -1
  65. package/{chunk-SH43IESU.js → chunk-GGC55Q32.js} +199 -29
  66. package/{chunk-ZCYXJSTU.js → chunk-GMP3NBAA.js} +65 -95
  67. package/chunk-GMZLP5DV.js +82 -0
  68. package/{chunk-OIVSQH2O.js → chunk-GU7DC2TD.js} +300 -5
  69. package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
  70. package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
  71. package/{chunk-QOKAKDPE.js → chunk-HIM3FCLF.js} +0 -1
  72. package/{chunk-RJXZDT2P.js → chunk-HNA5KV37.js} +23 -28
  73. package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
  74. package/{chunk-ACTMNVHM.js → chunk-I5YMDACN.js} +1 -1
  75. package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
  76. package/{chunk-QDSINZM3.js → chunk-IXH3HKY2.js} +1 -22
  77. package/{chunk-Q67DOFOO.js → chunk-IYIXAIEB.js} +199 -92
  78. package/{chunk-BP4XNZRM.js → chunk-JIXGJTBU.js} +4 -4
  79. package/{chunk-OEVAY4J6.js → chunk-JWNBEIME.js} +18 -20
  80. package/{chunk-Z77CRGTW.js → chunk-KA5O5KQL.js} +1 -1
  81. package/{chunk-JZL6EHZR.js → chunk-LGWABBTZ.js} +47 -67
  82. package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
  83. package/{chunk-GEPUP7OO.js → chunk-LOPP5VT6.js} +3 -3
  84. package/{chunk-DHDMC6FO.js → chunk-LUBFABMJ.js} +15 -14
  85. package/chunk-LWLNLZC5.js +265 -0
  86. package/{chunk-BNGW5ASC.js → chunk-LYLO5U3H.js} +15 -2
  87. package/{chunk-4OEFYTWL.js → chunk-MJ3CRU77.js} +85 -50
  88. package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
  89. package/{chunk-NA35QHCF.js → chunk-NTNKA5VL.js} +1 -1
  90. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  91. package/chunk-NWENLDMM.js +42 -0
  92. package/chunk-O7SVKKLY.js +875 -0
  93. package/{chunk-FM2YTE6D.js → chunk-OAXBDMT7.js} +1 -1
  94. package/chunk-OCZKATRC.js +129 -0
  95. package/{chunk-EYAQT56M.js → chunk-ODTBO4W6.js} +9 -6
  96. package/{chunk-VMFTFOWF.js → chunk-OKGVNZTL.js} +35 -8
  97. package/{chunk-EEGDMATE.js → chunk-OQ5IVGCV.js} +86 -81
  98. package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
  99. package/{chunk-KQ4ONNQD.js → chunk-OYTWDOQV.js} +155 -8
  100. package/{chunk-JRQFUXY7.js → chunk-OZ2IIIRP.js} +99 -22
  101. package/{chunk-WV42OMV7.js → chunk-PFLF4R4E.js} +8 -8
  102. package/{chunk-J4MOO56S.js → chunk-QDH32WF5.js} +10 -2
  103. package/{chunk-3DII57IT.js → chunk-QVAWUJAJ.js} +1 -1
  104. package/{chunk-3BMYXEUW.js → chunk-R5AJODNI.js} +1 -1
  105. package/{chunk-6OZ36FXI.js → chunk-SJ7CUF65.js} +22 -4
  106. package/{chunk-IIVGDG4I.js → chunk-SJKULPGX.js} +13 -7
  107. package/{chunk-ETI2NYVF.js → chunk-SYEBIZOF.js} +4 -4
  108. package/{chunk-J3WULTWA.js → chunk-TLKXNTQJ.js} +19 -17
  109. package/chunk-TLYSGGPG.js +15 -0
  110. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  111. package/chunk-TY3TIUJK.js +89 -0
  112. package/{chunk-I3TQJXQ7.js → chunk-U3C3IA32.js} +9 -2
  113. package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
  114. package/chunk-UM7TA3K4.js +1008 -0
  115. package/{chunk-6YTOJY35.js → chunk-VBG7GWWR.js} +253 -8
  116. package/chunk-VBQGO5NX.js +164 -0
  117. package/chunk-VIWDGTDA.js +8 -0
  118. package/chunk-VJVNU77E.js +83 -0
  119. package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
  120. package/chunk-VYKXIHRP.js +13692 -0
  121. package/chunk-VZLO4XJD.js +17 -0
  122. package/{chunk-DNCEALKX.js → chunk-WMWYWYK2.js} +22 -29
  123. package/{chunk-H56FOERC.js → chunk-XDQ7PHU3.js} +567 -684
  124. package/{chunk-AEOE4Z6Q.js → chunk-XGOHDYM2.js} +39 -15
  125. package/{chunk-53HEEOTT.js → chunk-XLWMNFBZ.js} +83 -16
  126. package/{chunk-V4MJDUSR.js → chunk-YFU5EELM.js} +2 -2
  127. package/{chunk-IUTWFZOX.js → chunk-YQFLBS6A.js} +68 -46
  128. package/chunk-YV25TM3R.js +780 -0
  129. package/chunk-ZRAU6T47.js +56 -0
  130. package/{chunk-5H7KJX7J.js → chunk-ZVGXD7UJ.js} +5 -5
  131. package/{chunk-H62HCIUP.js → chunk-ZYM73IHG.js} +36 -22
  132. package/commandRegistry-6QIAUQDS.js +833 -0
  133. package/{contentThunks-AZVYDLM4.js → contentThunks-5DDMUQ7B.js} +39 -36
  134. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
  135. package/{createAgentAutomationAction-V55DNYCE.js → createAgentAutomationAction-NQ6AZM42.js} +40 -37
  136. package/createDialogAction-QZ6X4A7O.js +70 -0
  137. package/{createPageAction-I3HH23O3.js → createPageAction-NCGEJBVK.js} +47 -43
  138. package/{chunk-GDNQO3QR.js → cursorProvider-YGGNMVWX.js} +2751 -10172
  139. package/{dbSlice-XVWBAGYN.js → dbSlice-RCZ7NRAF.js} +12 -11
  140. package/{deleteFile-YG6QMJLU.js → deleteFile-KESP65GC.js} +7 -6
  141. package/{dialogCommands-YVMHDEOX.js → dialogCommands-OGQLEF63.js} +49 -46
  142. package/{dialogSlice-LVJ67QWE.js → dialogSlice-GIKNUHNW.js} +57 -37
  143. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  144. package/{docCreateCommands-7UTWDYJU.js → docCreateCommands-RW6LNYT6.js} +48 -44
  145. package/{docDeleteCommands-GG6BJ4PS.js → docDeleteCommands-Z742TRNY.js} +49 -45
  146. package/{docReadCommands-QHMQVSLP.js → docReadCommands-5DIGA42Y.js} +47 -43
  147. package/{docStore-UJNL6SBT.js → docStore-6GUOZH52.js} +17 -13
  148. package/{docUpdateCommands-QPL6IVUK.js → docUpdateCommands-ZFZ2QEVK.js} +48 -44
  149. package/{fetchMessages-EIU7UFFK.js → fetchMessages-3PXAHKCR.js} +5 -5
  150. package/{getPricing-LUSEABA6.js → getPricing-QVSNUFZ6.js} +4 -4
  151. package/{handleSendMessageAction-CCL7ETCL.js → handleSendMessageAction-B2VXOLMM.js} +109 -42
  152. package/index.js +87 -884
  153. package/{lib-FRRS27KN.js → lib-PU2G2MSO.js} +523 -191
  154. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-UYCKO7YZ.js} +2 -2
  155. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-TU6OBC76.js} +9 -6
  156. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-VKWVOPPI.js} +1 -1
  157. package/{machineCommands-2QNINBNI.js → machineCommands-AI3N7JHQ.js} +93 -83
  158. package/machineWsRunDispatch-RPF2D6VV.js +154 -0
  159. package/{memberThunks-QGFLFVCI.js → memberThunks-YICJI4IS.js} +20 -18
  160. package/{models-T3SG6MJ5.js → models-FTNFVO3D.js} +2 -2
  161. package/oauthTokenStore-ITEB663N.js +23 -0
  162. package/package.json +1 -1
  163. package/pdf-U6KSUEZZ.js +26435 -0
  164. package/processSpawn-SOAV3FEV.js +11 -0
  165. package/profileConfig-ZGOFORWV.js +43 -0
  166. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-OJJXQ7NM.js} +7 -7
  167. package/{providerRegistry-757OWH3O.js → providerRegistry-DXFBDCGQ.js} +11 -7
  168. package/{read-COE3ZYR6.js → read-XMBM52Y4.js} +8 -7
  169. package/{readDocTool-5USN4A6V.js → readDocTool-LAQHKCVT.js} +5 -3
  170. package/{readlineWorkspace-4GULS23D.js → readlineWorkspace-EPUCVZ73.js} +2594 -2030
  171. package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-HDUI2MU3.js} +22 -26
  172. package/{runAgentClientLoop-MUMLW2SA.js → runAgentClientLoop-OXQMDGAN.js} +78 -71
  173. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
  174. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  175. package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-ADBVOP4O.js} +16 -14
  176. package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-PXVXQJ62.js} +23 -27
  177. package/{chunk-AFUORTY4.js → settingThunks-G2MJRKUE.js} +226 -940
  178. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
  179. package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
  180. package/{spaceCommands-BMXKR7H6.js → spaceCommands-Z662QYY6.js} +51 -47
  181. package/{streamAgentChatTurn-6EOS5PNG.js → streamAgentChatTurn-YJYEJHP7.js} +214 -114
  182. package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-Z3RZACGF.js} +19 -20
  183. package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
  184. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-AD7CXTA4.js} +4 -3
  185. package/tools-GHI3WBEI.js +117 -0
  186. package/{tuiSummaryLlmCaller-WFRWERGK.js → tuiSummaryLlmCaller-WTC6GCQC.js} +25 -23
  187. package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
  188. package/{updateDialogTitleAction-4YUVCBDU.js → updateDialogTitleAction-GJCNWTPY.js} +84 -45
  189. package/action-YVYQEAAV.js +0 -31
  190. package/agentListCommands-3GWH4E4G.js +0 -410
  191. package/agentRecordCommands-P76DPWKV.js +0 -128
  192. package/agentRunCommand-EQPL4F4K.js +0 -156
  193. package/browser-image-compression-MFDTD7K6.js +0 -1763
  194. package/chatQueueReduxAdapter-ZBDDI2E5.js +0 -186
  195. package/chunk-CQ3WA2NE.js +0 -299
  196. package/chunk-M76ECQRD.js +0 -13658
  197. package/chunk-MEYIRKDN.js +0 -8967
  198. package/chunk-PUOC4YRO.js +0 -394
  199. package/chunk-Q5FJJ6XI.js +0 -103
  200. package/chunk-S7Z2HMCN.js +0 -25
  201. package/chunk-WC6UUQ2C.js +0 -20923
  202. package/chunk-Y5GCAMGP.js +0 -9
  203. package/chunk-YPREESF4.js +0 -225
  204. package/createDialogAction-H6URYLIZ.js +0 -65
  205. package/machineWsRunDispatch-S3XXOKR7.js +0 -144
  206. package/settingSlice-ZQZVUPKK.js +0 -204
  207. package/syncMapping-N6RGXGBW.js +0 -437
  208. package/tools-4AJZHAK3.js +0 -110
  209. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  210. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-IUTWFZOX.js";
4
+ } from "./chunk-YQFLBS6A.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -0,0 +1,129 @@
1
+ // packages/ai/chat/parseApiError.ts
2
+ var CONTEXT_OVERFLOW_ACTIONS = [
3
+ "compact-and-retry",
4
+ "new-dialog",
5
+ "switch-model",
6
+ "retry"
7
+ ];
8
+ var CONTEXT_TOO_LARGE_ACTIONS = [
9
+ "new-dialog",
10
+ "switch-model",
11
+ "retry"
12
+ ];
13
+ var truncateErrorMessage = (message, maxChars = 320) => message.length <= maxChars ? message : `${message.slice(0, maxChars)}\u2026`;
14
+ var isContextOverflowText = (message) => /maximum context|context (length|window|overflow|limit)|context_length_exceed\w*|requested about .*tokens|too many tokens|prompt is too long|exceeds? (the )?(model|max)/i.test(
15
+ message
16
+ );
17
+ function classifyApiError(input) {
18
+ const { status, message, body, code } = input;
19
+ const errorMessage = message;
20
+ let defaultMessage = `\u72B6\u6001\u7801 ${status} ${input.statusText ?? ""}`;
21
+ switch (status) {
22
+ case 400:
23
+ if (isContextOverflowText(errorMessage) || isContextOverflowText(body) || code === "UPSTREAM_400") {
24
+ return {
25
+ kind: "context_overflow",
26
+ message: "\u4E0A\u4E0B\u6587\u8FC7\u957F\uFF1A\u672C\u8F6E\u6D88\u606F\u6216\u5DE5\u5177\u7ED3\u679C\u592A\u5927\u3002\u8BF7\u7F29\u5C0F\u8303\u56F4\uFF0C\u6216\u5148\u8BFB\u53D6\u66F4\u5C0F\u7247\u6BB5\u540E\u518D\u7EE7\u7EED\u3002",
27
+ code,
28
+ status,
29
+ retryable: true,
30
+ actions: [...CONTEXT_OVERFLOW_ACTIONS]
31
+ };
32
+ }
33
+ if (code === "MISSING_PROVIDER_API_KEY") {
34
+ return {
35
+ kind: "generic",
36
+ message: truncateErrorMessage(errorMessage),
37
+ code,
38
+ status,
39
+ retryable: false
40
+ };
41
+ }
42
+ if (errorMessage && errorMessage !== defaultMessage) {
43
+ return {
44
+ kind: "generic",
45
+ message: `\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}`,
46
+ code,
47
+ status,
48
+ retryable: false
49
+ };
50
+ }
51
+ return { kind: "generic", message: "\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165", code, status, retryable: false };
52
+ case 413:
53
+ return {
54
+ kind: "context_too_large",
55
+ message: "\u8BF7\u6C42\u5185\u5BB9\u8FC7\u5927\uFF1A\u8BF7\u51CF\u5C11\u4E00\u6B21\u53D1\u9001\u7684\u6D88\u606F\u3001\u6587\u4EF6\u6216\u5DE5\u5177\u7ED3\u679C\u3002",
56
+ code,
57
+ status,
58
+ retryable: true,
59
+ actions: [...CONTEXT_TOO_LARGE_ACTIONS]
60
+ };
61
+ case 401:
62
+ return {
63
+ kind: "auth",
64
+ message: code === "AUTH_TOKEN_EXPIRED" ? "\u767B\u5F55\u72B6\u6001\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_ACCOUNT_INVALID" ? "\u8D26\u6237\u65E0\u6548\u6216\u5DF2\u88AB\u505C\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458" : code === "AUTH_NO_TOKEN" ? "\u672A\u68C0\u6D4B\u5230\u767B\u5F55\u72B6\u6001\uFF0C\u8BF7\u5148\u767B\u5F55" : code === "AUTH_INVALID_TOKEN" ? "\u767B\u5F55\u51ED\u8BC1\u65E0\u6548\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_TOKEN_NOT_ACTIVE" ? "\u4EE4\u724C\u5C1A\u672A\u751F\u6548\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5" : errorMessage && errorMessage !== `\u72B6\u6001\u7801 401 Unauthorized` ? `\u8BA4\u8BC1\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}` : "\u8EAB\u4EFD\u9A8C\u8BC1\u5931\u8D25\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55",
65
+ code,
66
+ status,
67
+ retryable: true,
68
+ actions: ["retry"]
69
+ };
70
+ case 503:
71
+ return {
72
+ kind: "server",
73
+ message: errorMessage && errorMessage !== `\u72B6\u6001\u7801 503 Service Unavailable` ? truncateErrorMessage(errorMessage) : "\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
74
+ code,
75
+ status,
76
+ retryable: true,
77
+ actions: ["retry"]
78
+ };
79
+ case 504:
80
+ return {
81
+ kind: "timeout",
82
+ message: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
83
+ code,
84
+ status,
85
+ retryable: true,
86
+ actions: ["retry"]
87
+ };
88
+ default:
89
+ return {
90
+ kind: "generic",
91
+ message: `API\u8BF7\u6C42\u5931\u8D25: ${truncateErrorMessage(errorMessage)}`,
92
+ code,
93
+ status,
94
+ retryable: true,
95
+ actions: ["retry"]
96
+ };
97
+ }
98
+ }
99
+ async function parseApiErrorInfo(response) {
100
+ const errorBody = await response.text();
101
+ let errorMessage = `\u72B6\u6001\u7801 ${response.status} ${response.statusText}`;
102
+ let errorCode = `E${response.status}`;
103
+ try {
104
+ const errorJson = JSON.parse(errorBody);
105
+ errorMessage = errorJson?.error?.message || errorJson?.message || errorJson?.msg || errorBody || errorMessage;
106
+ errorCode = errorJson?.error?.code || errorJson?.code || errorCode;
107
+ } catch (_e) {
108
+ if (errorBody) {
109
+ errorMessage = errorBody;
110
+ }
111
+ }
112
+ return classifyApiError({
113
+ status: response.status,
114
+ statusText: response.statusText,
115
+ message: errorMessage,
116
+ body: errorBody,
117
+ code: errorCode
118
+ });
119
+ }
120
+ async function parseApiError(response) {
121
+ return (await parseApiErrorInfo(response)).message;
122
+ }
123
+
124
+ export {
125
+ CONTEXT_OVERFLOW_ACTIONS,
126
+ CONTEXT_TOO_LARGE_ACTIONS,
127
+ isContextOverflowText,
128
+ parseApiError
129
+ };
@@ -6,10 +6,12 @@ import {
6
6
  } from "./chunk-AGGIDPCZ.js";
7
7
  import {
8
8
  getModelConfig
9
- } from "./chunk-OIVSQH2O.js";
9
+ } from "./chunk-GU7DC2TD.js";
10
10
  import {
11
- isPlatformHostedImageModel
12
- } from "./chunk-Q67DOFOO.js";
11
+ isPlatformHostedImageModel,
12
+ isPlatformManagedProvider,
13
+ resolvePlatformEffectiveModel
14
+ } from "./chunk-IYIXAIEB.js";
13
15
  import {
14
16
  asOptionalFiniteNumber
15
17
  } from "./chunk-WWC7I6TA.js";
@@ -19,15 +21,16 @@ import {
19
21
 
20
22
  // packages/ai/llm/getPricing.ts
21
23
  var MAX_OUTPUT_TOKENS = 8192;
22
- var getModelPricing = (provider, modelName, _requestedServiceTier) => {
24
+ var getModelPricing = (provider, modelName, _requestedServiceTier, isPlatformBilled) => {
25
+ const pricedModel = isPlatformBilled === true && isPlatformManagedProvider(provider, modelName) ? resolvePlatformEffectiveModel(modelName) ?? modelName : modelName;
23
26
  let model;
24
27
  try {
25
- model = getModelConfig(provider, modelName);
28
+ model = getModelConfig(provider, pricedModel);
26
29
  } catch {
27
30
  return null;
28
31
  }
29
32
  if (!model?.price) return null;
30
- return getModelPricingForModel(provider, modelName, model);
33
+ return getModelPricingForModel(provider, pricedModel, model);
31
34
  };
32
35
  var getModelPricingForModel = (provider, modelName, model) => {
33
36
  if (!model.price) return null;
@@ -2390,6 +2390,11 @@ var require_rambda = __commonJS({
2390
2390
  }
2391
2391
  });
2392
2392
 
2393
+ // packages/core/toTrimmedString.ts
2394
+ function toTrimmedString(value) {
2395
+ return typeof value === "string" ? value.trim() : value == null ? "" : String(value).trim();
2396
+ }
2397
+
2393
2398
  // packages/core/stringArray.ts
2394
2399
  function asNonEmptyStringArray(value) {
2395
2400
  if (!Array.isArray(value)) return [];
@@ -2401,11 +2406,6 @@ function asTrimmedNonEmptyStringArray(value) {
2401
2406
  return asNonEmptyStringArray(value).map((item) => item.trim());
2402
2407
  }
2403
2408
 
2404
- // packages/core/toTrimmedString.ts
2405
- function toTrimmedString(value) {
2406
- return typeof value === "string" ? value.trim() : value == null ? "" : String(value).trim();
2407
- }
2408
-
2409
2409
  // packages/database/utils/ulid.ts
2410
2410
  import { monotonicFactory } from "ulid";
2411
2411
  var prng = () => Math.random();
@@ -2717,8 +2717,9 @@ var metaKey = Object.assign(
2717
2717
  var DB_PREFIX = {
2718
2718
  USER: "user:"
2719
2719
  };
2720
+ var USER_SETTINGS_KEY_SUFFIX = `${SEPARATOR2}settings`;
2720
2721
  var createUserKey = {
2721
- settings: (userId) => createKey(userId, "settings"),
2722
+ settings: (userId) => `${userId}${USER_SETTINGS_KEY_SUFFIX}`,
2722
2723
  profile: (userId) => createKey(userId, "profile")
2723
2724
  };
2724
2725
  var createUserPreferenceKey = {
@@ -2763,6 +2764,22 @@ var createTokenKey = {
2763
2764
  record: (0, import_rambda.curry)(
2764
2765
  (userId, timestamp) => createKey("token", userId, timestamp.toString())
2765
2766
  ),
2767
+ /**
2768
+ * 单次计费记录:`token/<user>/<timestamp>/<chargeId>`。
2769
+ *
2770
+ * 与 `record` 的唯一区别是把「本次计费自己的唯一 id」作为额外一段拼在末尾
2771
+ * —— 同一用户同一毫秒内的两笔合法计费因此各占一个 key,不再互相覆盖,
2772
+ * 也不会共用同一个账本 txId / 幂等键(`token-<tokenKey>` / `token:<tokenKey>`)
2773
+ * 而被账本判为 duplicate 静默漏扣。
2774
+ *
2775
+ * 兼容性:timestamp 仍是第二段且保持首位排序,因此
2776
+ * - `rangeOfUser(userId)`(usage/统计等读取路径用的全前缀范围)照常覆盖;
2777
+ * - `range(userId, ts)` 的 `token/<user>/<ts>` … `token/<user>/<ts+1d>`
2778
+ * 区间同样覆盖新 key(`<ts>-xxx` > `<ts>` 且 < `<ts+1>`),历史数据
2779
+ * 与新数据可以在同一区间里混扫。
2780
+ * 幂等键的稳定性由调用方决定:需要「重试同一笔」时传稳定的 chargeId。
2781
+ */
2782
+ recordForCharge: (userId, timestamp, chargeId) => createKey("token", userId, timestamp.toString(), encodeURIComponent(chargeId)),
2766
2783
  /** Server provider-call record: retry-stable even when the retry clock changes. */
2767
2784
  recordForStableCall: (userId, callId) => createKey("token", userId, "call", encodeURIComponent(callId)),
2768
2785
  /** Server provider-call failure audit record: preserved separately from retry success in a collision-free namespace. */
@@ -2787,6 +2804,16 @@ var createTokenStatsKey = Object.assign(
2787
2804
  })
2788
2805
  }
2789
2806
  );
2807
+ var createTokenStatsAppliedKey = Object.assign(
2808
+ (userId, chargeKey) => createKey("token", "charge-stats", userId, encodeURIComponent(chargeKey)),
2809
+ {
2810
+ /** 某个用户的全部计费幂等标记范围:token-charge-stats-<userId>-* */
2811
+ rangeOfUser: (userId) => ({
2812
+ start: createKey("token", "charge-stats", userId, ""),
2813
+ end: createKey("token", "charge-stats", userId, "\uFFFF")
2814
+ })
2815
+ }
2816
+ );
2790
2817
  var DIALOG_AGENT_LIST_INDEX_PREFIX = "dialogidx";
2791
2818
  var DIALOG_LIST_TIMESTAMP_MAX = 9999999999999;
2792
2819
  function parseDialogUpdatedAtMs(value) {
@@ -3177,10 +3204,10 @@ var sanitizeShareData = (data) => {
3177
3204
  };
3178
3205
 
3179
3206
  export {
3180
- asNonEmptyStringArray,
3181
- asTrimmedNonEmptyStringArray,
3182
3207
  ulid,
3183
3208
  toTrimmedString,
3209
+ asNonEmptyStringArray,
3210
+ asTrimmedNonEmptyStringArray,
3184
3211
  toNonEmptyString,
3185
3212
  extractAgentInfo,
3186
3213
  extractCoverImage,
@@ -1,87 +1,21 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-GEPUP7OO.js";
4
+ } from "./chunk-LOPP5VT6.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-AEOE4Z6Q.js";
7
+ } from "./chunk-XGOHDYM2.js";
8
8
  import {
9
- deriveCredentialGroup,
10
- toSafeAgentSummary
11
- } from "./chunk-PQFHGD77.js";
9
+ deriveCredentialGroup
10
+ } from "./chunk-4VDS344D.js";
12
11
  import {
13
12
  PUBLIC_AGENT_KEY_PREFIX,
14
- isOwnedAgentKey,
15
13
  ownedAgentKey,
16
14
  ownedAgentKeyPrefix,
17
15
  parseOwnedAgentId,
18
16
  publicAgentKey
19
17
  } from "./chunk-M2EJHDJP.js";
20
18
 
21
- // packages/ai/agent/quotaSnapshot.ts
22
- function findTightestQuotaWindow(quota, now = Date.now()) {
23
- if (!quota || !Array.isArray(quota.windows) || quota.windows.length === 0) {
24
- return void 0;
25
- }
26
- let best;
27
- let bestScore = -Infinity;
28
- for (const w of quota.windows) {
29
- let score = 0;
30
- if (typeof w.utilization === "number" && w.utilization >= 0) {
31
- score = 500 + Math.min(w.utilization, 1) * 500;
32
- } else if (typeof w.remaining === "number" && typeof w.limit === "number" && w.limit > 0) {
33
- const util = Math.max(0, 1 - w.remaining / w.limit);
34
- score = 500 + util * 500;
35
- } else if (typeof w.resetAt === "number" && w.resetAt > now) {
36
- score = 200;
37
- } else if (typeof w.remaining === "number") {
38
- score = 100;
39
- }
40
- if (score > bestScore) {
41
- bestScore = score;
42
- best = w;
43
- }
44
- }
45
- return best ?? quota.windows[0];
46
- }
47
- function formatQuotaSummary(quota, now = Date.now(), options) {
48
- const tightest = findTightestQuotaWindow(quota, now);
49
- if (!tightest) return void 0;
50
- const compact = options?.compact === true;
51
- const parts = [];
52
- if (typeof tightest.utilization === "number") {
53
- const pct = Math.round(tightest.utilization * 100);
54
- parts.push(`${pct}%\u5DF2\u7528`);
55
- } else if (typeof tightest.remaining === "number") {
56
- if (typeof tightest.limit === "number") {
57
- parts.push(`${tightest.remaining}/${tightest.limit}${tightest.unit ? ` ${tightest.unit}` : ""}`);
58
- } else {
59
- parts.push(`\u4F59${tightest.remaining}${tightest.unit ? ` ${tightest.unit}` : ""}`);
60
- }
61
- }
62
- if (compact) return parts.length > 0 ? parts[0] : void 0;
63
- if (tightest.scope && tightest.scope !== "user" && tightest.scope !== "project" && tightest.scope !== tightest.unit) {
64
- parts.push(tightest.scope);
65
- }
66
- if (typeof tightest.resetAt === "number" && tightest.resetAt > now) {
67
- const diffSec = Math.round((tightest.resetAt - now) / 1e3);
68
- if (diffSec < 60) {
69
- parts.push(`${diffSec}s\u540E\u91CD\u7F6E`);
70
- } else if (diffSec < 3600) {
71
- parts.push(`${Math.round(diffSec / 60)}m\u540E\u91CD\u7F6E`);
72
- } else if (diffSec < 86400) {
73
- const hours = (diffSec / 3600).toFixed(1).replace(/\.0$/, "");
74
- parts.push(`${hours}h\u540E\u91CD\u7F6E`);
75
- } else {
76
- const days = (diffSec / 86400).toFixed(1).replace(/\.0$/, "");
77
- parts.push(`${days}d\u540E\u91CD\u7F6E`);
78
- }
79
- }
80
- if (parts.length === 0) return void 0;
81
- if (parts.length === 1 && parts[0] === tightest.scope) return void 0;
82
- return parts.join(" \xB7 ");
83
- }
84
-
85
19
  // packages/cli/agentListHelpers.ts
86
20
  function parseAgentRecordId(privateKey, explicitId) {
87
21
  if (explicitId) return explicitId;
@@ -117,6 +51,9 @@ function normalizeListedAgent(record) {
117
51
  ...typeof record?.handle === "string" && record.handle ? { handle: record.handle } : {},
118
52
  ...typeof record?.introduction === "string" && record.introduction ? { introduction: record.introduction } : typeof record?.description === "string" && record.description ? { introduction: record.description } : {},
119
53
  ...typeof record?.provider === "string" && record.provider ? { provider: record.provider } : {},
54
+ // 仅供 resolveBillingSource 判定订阅端点(Step Plan / OpenCode Go 等),
55
+ // safe 投影不输出它。缺了它本地 agent list 会把订阅端点全报成 user_api。
56
+ ...typeof record?.customProviderUrl === "string" && record.customProviderUrl ? { customProviderUrl: record.customProviderUrl } : {},
120
57
  ...typeof record?.inputPrice === "number" && Number.isFinite(record.inputPrice) ? { inputPrice: record.inputPrice } : {},
121
58
  ...typeof record?.outputPrice === "number" && Number.isFinite(record.outputPrice) ? { outputPrice: record.outputPrice } : {},
122
59
  updatedAt: typeof record?.updatedAt === "string" || typeof record?.updatedAt === "number" ? record.updatedAt : typeof record?.createdAt === "string" || typeof record?.createdAt === "number" ? record.createdAt : typeof record?.created === "string" || typeof record?.created === "number" ? record.created : null,
@@ -135,13 +72,6 @@ function normalizeListedAgent(record) {
135
72
  ...record?.quota && typeof record.quota === "object" && Array.isArray(record.quota.windows) ? { quota: record.quota } : {}
136
73
  };
137
74
  }
138
- function toSafeListedAgentSummary(agent, options) {
139
- const summary = toSafeAgentSummary(agent, options);
140
- if (agent.publicRecordExists === false) {
141
- delete summary.publicKey;
142
- }
143
- return summary;
144
- }
145
75
  function sortListedAgents(agents) {
146
76
  agents.sort((a, b) => {
147
77
  const ta = a.updatedAt == null ? 0 : new Date(a.updatedAt).getTime();
@@ -162,6 +92,7 @@ function parseAgentListArgs(args) {
162
92
  publicOnly: args.includes("--public-only"),
163
93
  idsOnly: args.includes("--ids-only"),
164
94
  scope: readArgValue(args, "--scope"),
95
+ query: readArgValue(args, "--query"),
165
96
  showUnavailable: args.includes("--show-unavailable"),
166
97
  // --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
167
98
  // --verbose 拿回完整字段集排障。
@@ -175,7 +106,7 @@ async function listLocalCachedAgents(args) {
175
106
  for (const prefix of [ownedPrefix, PUBLIC_AGENT_KEY_PREFIX]) {
176
107
  for await (const [key, value] of args.db.iterator({ gte: prefix, lte: `${prefix}\uFFFF` })) {
177
108
  if (typeof key !== "string" || !value || typeof value !== "object") continue;
178
- if (isOwnedAgentKey(key, args.userId)) {
109
+ if (key.startsWith(ownedPrefix)) {
179
110
  privateRecords.set(key, { ...value, dbKey: key });
180
111
  continue;
181
112
  }
@@ -302,15 +233,89 @@ async function decorateAgentsWithPublicStatusAcrossServers(args) {
302
233
  return args.agents;
303
234
  }
304
235
 
236
+ // packages/ai/agent/quotaSnapshot.ts
237
+ function findTightestQuotaWindow(quota, now = Date.now()) {
238
+ if (!quota || !Array.isArray(quota.windows) || quota.windows.length === 0) {
239
+ return void 0;
240
+ }
241
+ let best;
242
+ let bestScore = -Infinity;
243
+ for (const w of quota.windows) {
244
+ let score = 0;
245
+ if (typeof w.utilization === "number" && w.utilization >= 0) {
246
+ score = 500 + Math.min(w.utilization, 1) * 500;
247
+ } else if (typeof w.remaining === "number" && typeof w.limit === "number" && w.limit > 0) {
248
+ const util = Math.max(0, 1 - w.remaining / w.limit);
249
+ score = 500 + util * 500;
250
+ } else if (typeof w.resetAt === "number" && w.resetAt > now) {
251
+ score = 200;
252
+ } else if (typeof w.remaining === "number") {
253
+ score = 100;
254
+ }
255
+ if (score > bestScore) {
256
+ bestScore = score;
257
+ best = w;
258
+ }
259
+ }
260
+ return best ?? quota.windows[0];
261
+ }
262
+ function formatQuotaSummary(quota, now = Date.now(), options) {
263
+ const compact = options?.compact === true;
264
+ const planText = formatPlanLabel(quota?.plan);
265
+ const planName = typeof quota?.plan?.name === "string" ? quota.plan.name.trim() : "";
266
+ const tightest = findTightestQuotaWindow(quota, now);
267
+ if (!tightest) return compact ? planName || void 0 : planText;
268
+ const parts = [];
269
+ if (typeof tightest.utilization === "number") {
270
+ const pct = Math.round(tightest.utilization * 100);
271
+ parts.push(`${pct}%\u5DF2\u7528`);
272
+ } else if (typeof tightest.remaining === "number") {
273
+ if (typeof tightest.limit === "number") {
274
+ parts.push(`${tightest.remaining}/${tightest.limit}${tightest.unit ? ` ${tightest.unit}` : ""}`);
275
+ } else {
276
+ parts.push(`\u4F59${tightest.remaining}${tightest.unit ? ` ${tightest.unit}` : ""}`);
277
+ }
278
+ }
279
+ if (compact) {
280
+ const head = parts.length > 0 ? parts[0] : void 0;
281
+ return [planName || void 0, head].filter(Boolean).join(" \xB7 ") || void 0;
282
+ }
283
+ if (tightest.scope && tightest.scope !== "user" && tightest.scope !== "project" && tightest.scope !== tightest.unit) {
284
+ parts.push(tightest.scope);
285
+ }
286
+ if (typeof tightest.resetAt === "number" && tightest.resetAt > now) {
287
+ const diffSec = Math.round((tightest.resetAt - now) / 1e3);
288
+ if (diffSec < 60) {
289
+ parts.push(`${diffSec}s\u540E\u91CD\u7F6E`);
290
+ } else if (diffSec < 3600) {
291
+ parts.push(`${Math.round(diffSec / 60)}m\u540E\u91CD\u7F6E`);
292
+ } else if (diffSec < 86400) {
293
+ const hours = (diffSec / 3600).toFixed(1).replace(/\.0$/, "");
294
+ parts.push(`${hours}h\u540E\u91CD\u7F6E`);
295
+ } else {
296
+ const days = (diffSec / 86400).toFixed(1).replace(/\.0$/, "");
297
+ parts.push(`${days}d\u540E\u91CD\u7F6E`);
298
+ }
299
+ }
300
+ const onlyScope = parts.length === 0 || parts.length === 1 && parts[0] === tightest.scope;
301
+ if (onlyScope) return planText;
302
+ return [planText, ...parts].filter(Boolean).join(" \xB7 ");
303
+ }
304
+ function formatPlanLabel(plan) {
305
+ const name = typeof plan?.name === "string" ? plan.name.trim() : "";
306
+ if (!name) return void 0;
307
+ const credits = typeof plan?.monthlyCreditsUsd === "number" && Number.isFinite(plan.monthlyCreditsUsd) && plan.monthlyCreditsUsd > 0 ? `\u6708\u5EA6\u989D\u5EA6 $${plan.monthlyCreditsUsd}` : void 0;
308
+ return [`${name} \u5957\u9910`, credits].filter(Boolean).join(" \xB7 ");
309
+ }
310
+
305
311
  export {
306
- formatQuotaSummary,
307
312
  normalizeListedAgent,
308
- toSafeListedAgentSummary,
309
313
  parseAgentListArgs,
310
314
  listLocalCachedAgents,
311
315
  listRemotePublicAgents,
312
316
  listRemoteAgents,
313
317
  listRemoteAgentsAcrossServers,
314
318
  listFavoriteAgentIdsAcrossServers,
315
- decorateAgentsWithPublicStatusAcrossServers
319
+ decorateAgentsWithPublicStatusAcrossServers,
320
+ formatQuotaSummary
316
321
  };
@@ -2,7 +2,7 @@ import {
2
2
  getRecordTimestamp,
3
3
  isTombstoneRecord,
4
4
  shouldReplaceWithNextRecord
5
- } from "./chunk-GBRG75BQ.js";
5
+ } from "./chunk-D2MDMY2M.js";
6
6
 
7
7
  // packages/database/userDataMerge.ts
8
8
  var getUserDataItemTimestamp = (dataItem) => getRecordTimestamp(dataItem);