nolo-cli 0.32.0-alpha.4 → 0.33.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/README.md +6 -12
  2. package/{_executeModel-YXHDCXHF.js → _executeModel-RWPVI3YV.js} +76 -67
  3. package/{action-HI3VRQLP.js → action-SMLG6OTB.js} +17 -15
  4. package/{addContentAction-NCURJ6PK.js → addContentAction-SFO244QN.js} +14 -13
  5. package/{addDialogAgentAction-RCY4ECF4.js → addDialogAgentAction-W44ZCEHB.js} +14 -13
  6. package/{agentDeleteCommand-QWWT4EBM.js → agentDeleteCommand-KU2RXQPP.js} +42 -59
  7. package/{agentEmailCommands-T2WV6M3L.js → agentEmailCommands-MPCMDENS.js} +89 -80
  8. package/{agentGrantCommands-E7ZZFRHK.js → agentGrantCommands-2LEZDADN.js} +2 -2
  9. package/{agentListCommands-SQLSBSZX.js → agentListCommands-EPD4N6FX.js} +73 -78
  10. package/{agentMachineCommands-O7MZVQEL.js → agentMachineCommands-AF7C3YRT.js} +40 -57
  11. package/{agentPullCommand-ARSIDNVC.js → agentPullCommand-YH5GEBK4.js} +5 -5
  12. package/agentRecordCommands-EYE6MZZG.js +112 -0
  13. package/agentRunCommand-LL22SGTN.js +130 -0
  14. package/{agentRuntimeLocal-JPSR5BZ5.js → agentRuntimeLocal-JX34G47Z.js} +35 -50
  15. package/{agentSlice-QYJQOUVC.js → agentSlice-TNMFQQOV.js} +15 -13
  16. package/{appDeleteCommands-ZQLZ4R54.js → appDeleteCommands-43K5VXQB.js} +38 -55
  17. package/{appDeployCommands-A5ISQH7L.js → appDeployCommands-FEEJSVDZ.js} +38 -55
  18. package/{appDeployStatusCommands-PVIPXEJZ.js → appDeployStatusCommands-H76CG45R.js} +38 -55
  19. package/{appGetCommands-CTMVFLQF.js → appGetCommands-MDZYFTYZ.js} +38 -55
  20. package/{appListCommands-WXIHMKQQ.js → appListCommands-TUJJXPWG.js} +38 -55
  21. package/{authCommand-BBDHMSO6.js → authCommand-T7UK4CWS.js} +18 -18
  22. package/{authCommands-4UDEKRE6.js → authCommands-EAPFGNHN.js} +8 -8
  23. package/chatQueueReduxAdapter-LVQXC4ZY.js +180 -0
  24. package/chunk-2H3XIBY4.js +239 -0
  25. package/{chunk-IRZBFTQA.js → chunk-2IVEXF7P.js} +11 -4
  26. package/{chunk-WTGCTVJG.js → chunk-2QTEYCR7.js} +3 -6
  27. package/{chunk-DOISARTV.js → chunk-2UECQ7RE.js} +1 -1
  28. package/{chunk-SWYMCHM7.js → chunk-37V5LNEQ.js} +69 -1
  29. package/{chunk-E3APEOIM.js → chunk-3GZXL6FM.js} +4 -19
  30. package/{chunk-RMOJVZWX.js → chunk-3VAQHAXT.js} +44 -44
  31. package/{chunk-6VCKAMSL.js → chunk-3WXRAHCG.js} +6 -5
  32. package/{chunk-LAXMH7JY.js → chunk-57QJXIB6.js} +18 -15
  33. package/chunk-5CS33IBL.js +301 -0
  34. package/{chunk-MW4IK7L4.js → chunk-5SBK2MTI.js} +4 -365
  35. package/chunk-6PO2SYCS.js +1800 -0
  36. package/{chunk-7WEUX3P3.js → chunk-6SXC35F4.js} +182 -20
  37. package/{chunk-MXFQHRSS.js → chunk-6XIE5ZGI.js} +1 -1
  38. package/{chunk-Y7WMYFED.js → chunk-73GINUCW.js} +256 -451
  39. package/{chunk-VMWR7VNI.js → chunk-7E72JMBB.js} +7 -7
  40. package/{chunk-7YQOB4DH.js → chunk-AAGCMVFT.js} +106 -124
  41. package/chunk-ADLYMQB6.js +642 -0
  42. package/{chunk-ZWJOGMKH.js → chunk-AETZ7AD6.js} +1 -1
  43. package/{chunk-UDA3ZYLW.js → chunk-AFV4FOT2.js} +70 -24
  44. package/{chunk-BGTUGS3T.js → chunk-AOXVOC6D.js} +4 -30
  45. package/{chunk-3GX5X3X3.js → chunk-B2BSG6QQ.js} +12 -11
  46. package/{chunk-44HACRCK.js → chunk-BANYWEYY.js} +4 -4
  47. package/{chunk-TOW4E763.js → chunk-BJIRLHJR.js} +2 -0
  48. package/{chunk-ZJ2WITOO.js → chunk-BQXOGBFN.js} +2 -2
  49. package/{chunk-G5GVZAXF.js → chunk-CLP2K7U4.js} +15 -19
  50. package/{chunk-2K4NDPT5.js → chunk-DFUPZE6V.js} +20 -12
  51. package/{chunk-YHGHADBQ.js → chunk-DPMBNHOJ.js} +4 -4
  52. package/chunk-EGRJC4ZN.js +91 -0
  53. package/{chunk-K6QEHQZ3.js → chunk-EKLRRZIN.js} +1 -1
  54. package/{chunk-XFG3BAKN.js → chunk-FMEVI5TG.js} +65 -0
  55. package/{chunk-CHHN4XWM.js → chunk-FSSX3XRY.js} +2 -4
  56. package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
  57. package/{chunk-6AD7WQOJ.js → chunk-GMXWYXAF.js} +7 -7
  58. package/{chunk-SFWZUTCI.js → chunk-GTYM4HKV.js} +1 -1
  59. package/{chunk-NYBNI5MY.js → chunk-HDKRSRYU.js} +1461 -301
  60. package/chunk-HS7MLR74.js +38 -0
  61. package/{chunk-3AUWC6EM.js → chunk-HUCT7HID.js} +5 -84
  62. package/{chunk-PTHDLIRB.js → chunk-I6N2UVVY.js} +1 -1
  63. package/chunk-IDAU4UFS.js +437 -0
  64. package/{chunk-OF5JK63U.js → chunk-IHEC7VBF.js} +1 -1
  65. package/{chunk-NM3AVNMH.js → chunk-IL545V3E.js} +4 -4
  66. package/{chunk-3LY4F7SV.js → chunk-INZZJSQF.js} +348 -331
  67. package/{chunk-CF2WZF4N.js → chunk-J6WH4PYZ.js} +0 -8
  68. package/{chunk-VMRGMPNM.js → chunk-JMPYDFHY.js} +6 -6
  69. package/{chunk-V54H24CQ.js → chunk-JTSGWTYZ.js} +3 -3
  70. package/{chunk-ATK5WJOA.js → chunk-JZ5AMMXU.js} +4 -4
  71. package/chunk-KHCLMKZZ.js +3062 -0
  72. package/{chunk-WHLVPK32.js → chunk-KMSZPTM6.js} +27 -3
  73. package/{chunk-L3GCUVOH.js → chunk-KSRFVP36.js} +1 -1
  74. package/{chunk-33COESA5.js → chunk-LOD75GOS.js} +336 -32
  75. package/{chunk-C3POSH7K.js → chunk-M2YMQOLC.js} +44 -53
  76. package/chunk-M3JEW6N6.js +193 -0
  77. package/{chunk-MQFSFU3Y.js → chunk-M4NC7NF6.js} +95 -95
  78. package/{chunk-GVNRF276.js → chunk-MPZJVZDC.js} +3735 -1394
  79. package/{chunk-IXZX5CJK.js → chunk-MQRZ5QUH.js} +1 -1
  80. package/{chunk-3ASDTTEI.js → chunk-MRWGHF56.js} +2 -0
  81. package/{chunk-D34RI6NI.js → chunk-NNWHHCVP.js} +75 -1
  82. package/{chunk-6YABCOFU.js → chunk-NUO3QFWD.js} +1 -1
  83. package/{chunk-NSXTWXGH.js → chunk-O6GEBMIY.js} +269 -309
  84. package/{chunk-CAENRKNJ.js → chunk-OR2HNLVO.js} +126 -88
  85. package/chunk-OW765XBU.js +10 -0
  86. package/chunk-PREQU5QV.js +231 -0
  87. package/{chunk-Q3CSL43H.js → chunk-Q5ITEGIN.js} +1 -1
  88. package/{chunk-7S54ZGF6.js → chunk-RAZOLMJR.js} +256 -12
  89. package/chunk-RCFIB45Q.js +28 -0
  90. package/chunk-RY57GLGW.js +188 -0
  91. package/{chunk-KGEVMUMI.js → chunk-TFPUAELY.js} +11 -11
  92. package/{chunk-ZJH3LKEW.js → chunk-UK5JGQVU.js} +94 -15
  93. package/chunk-URMS4XY2.js +10 -0
  94. package/{chunk-POMSDOTR.js → chunk-VH2F7ZB6.js} +1 -1
  95. package/chunk-VIDPVFP3.js +20 -0
  96. package/{chunk-CBVEM475.js → chunk-WHD6BG7M.js} +400 -115
  97. package/{chunk-5RDLGLAP.js → chunk-WJSW43QZ.js} +4 -7
  98. package/{chunk-CF7S2RYZ.js → chunk-WLH5BAKX.js} +6 -6
  99. package/{chunk-2DQTFBJX.js → chunk-X2DAEZ3X.js} +1 -1
  100. package/{chunk-2IJAKBK2.js → chunk-X664KVEV.js} +426 -246
  101. package/{chunk-43EPBPZ2.js → chunk-XCCGU6QB.js} +2 -2
  102. package/chunk-Y5GCAMGP.js +9 -0
  103. package/{chunk-2VOSL35C.js → chunk-YDTYDA5W.js} +3 -3
  104. package/chunk-YYLHWIW6.js +48 -0
  105. package/{chunk-AOS5IN2I.js → chunk-ZHYK3N56.js} +1 -1
  106. package/{chunk-7MTP4AIU.js → chunk-ZJMME4DS.js} +19 -303
  107. package/{chunk-PJ2DDQQM.js → chunk-ZURFOV5J.js} +2 -2
  108. package/chunk-ZZ2MH7LE.js +84 -0
  109. package/{cliExecutor-BBUVQU4L.js → cliExecutor-DW3PHGEL.js} +2 -2
  110. package/{clipboardy-BVE3LVEH.js → clipboardy-MMBYVRLF.js} +166 -372
  111. package/{codingSkills-V35TRR4Y.js → codingSkills-DY5MINPG.js} +5 -4
  112. package/{createAgentAutomationAction-5I6ZMYIA.js → createAgentAutomationAction-INQT23LX.js} +40 -31
  113. package/createDialogAction-LDCPDI73.js +60 -0
  114. package/{createPageAction-M75JWNUP.js → createPageAction-5YXOG2M4.js} +56 -47
  115. package/{db-6DPSJ6WT.js → db-3H3JECGY.js} +45 -5
  116. package/{dbSlice-BBL3PEVW.js → dbSlice-3SD5L5H2.js} +13 -12
  117. package/{deleteFile-RJTEPOT4.js → deleteFile-XQXPBFFB.js} +7 -6
  118. package/dialogCommands-CHJO47AX.js +81 -0
  119. package/{dialogSlice-WDIOJW3W.js → dialogSlice-DOWKOILN.js} +36 -29
  120. package/{docCreateCommands-XU72LHUF.js → docCreateCommands-OVZARUFX.js} +40 -55
  121. package/{docDeleteCommands-EUN6IJ6O.js → docDeleteCommands-E2XJ62LD.js} +42 -57
  122. package/{docReadCommands-LKE4DVQI.js → docReadCommands-I7OSREPJ.js} +40 -55
  123. package/{docStore-BDOACT3C.js → docStore-UAWSKZ2Y.js} +39 -30
  124. package/{docUpdateCommands-SL6IUM52.js → docUpdateCommands-X4Z26VJM.js} +43 -58
  125. package/{fetchMessages-VPPQDDZ4.js → fetchMessages-7QRCCRYK.js} +3 -3
  126. package/{getPricing-QO5TYNCK.js → getPricing-L2ENXWHV.js} +7 -6
  127. package/{handleSendMessageAction-OUQ5QCMS.js → handleSendMessageAction-C3TSDWKH.js} +38 -31
  128. package/index.js +67 -67
  129. package/{lib-FYYBQIXS.js → lib-2ZTNRXR4.js} +432 -183
  130. package/{localDialogRead-3DBXVYXS.js → localDialogRead-SLMPV5SK.js} +2 -2
  131. package/{localRuntimeAuthority-NDUA2D7Y.js → localRuntimeAuthority-E3R24J4T.js} +4 -2
  132. package/{localRuntimeDb-GKYRBWLQ.js → localRuntimeDb-DDZCJFQZ.js} +1 -1
  133. package/{machineCommands-UUW4ZBMZ.js → machineCommands-BUOIYJAD.js} +93 -84
  134. package/{machineWsRunDispatch-HGYZ47ND.js → machineWsRunDispatch-7CRWAA6O.js} +83 -74
  135. package/{models-WDUTTYFS.js → models-OX2S5C6Q.js} +2 -2
  136. package/{offlineMarxistsAgentCommand-E6LUG63A.js → offlineMarxistsAgentCommand-GEH6SNNA.js} +1 -1
  137. package/package.json +1 -4
  138. package/{read-64OQDO3I.js → read-6G73BMEY.js} +8 -7
  139. package/{readDocTool-MXM3T6PE.js → readDocTool-DK4EI2GA.js} +1 -2
  140. package/{readlineWorkspace-IHXWZCWS.js → readlineWorkspace-ZDWEASJV.js} +265 -428
  141. package/{removeDialogAgentAction-NEKVAMSH.js → removeDialogAgentAction-E7H557UO.js} +19 -17
  142. package/{runAgentClientLoop-TBZZWCN6.js → runAgentClientLoop-U7HYA3O5.js} +72 -64
  143. package/{runtimeDoctorCommands-WI2YZUSJ.js → runtimeDoctorCommands-KIKM6BIO.js} +5 -5
  144. package/{setDialogExtraReferencesAction-WTOHQDIV.js → setDialogExtraReferencesAction-RMMGBR5F.js} +15 -14
  145. package/{setPrimaryDialogAgentAction-LDJOYC4F.js → setPrimaryDialogAgentAction-FWBKKLVA.js} +19 -17
  146. package/{settingSlice-4M37TN7V.js → settingSlice-73PV4KG4.js} +16 -14
  147. package/{skillDiscovery-5U6RYAHN.js → skillDiscovery-KLLKXPUO.js} +4 -4
  148. package/{slateUtils-2M7MUTWX.js → slateUtils-VO2FU36K.js} +1 -1
  149. package/{spaceCommands-B6SAUSGD.js → spaceCommands-GEWZXGHM.js} +43 -240
  150. package/{spaceSlice-Q6IMD5NX.js → spaceSlice-B6MOVY4N.js} +38 -61
  151. package/{streamAgentChatTurn-X4LGYPQX.js → streamAgentChatTurn-T527EQTT.js} +1261 -150
  152. package/{switchDialogAgentAction-XVWGKR2Z.js → switchDialogAgentAction-US6QNL3N.js} +14 -13
  153. package/syncMapping-RK2MANUX.js +43 -0
  154. package/{tableCommands-RJZ3V4TF.js → tableCommands-QE47K72R.js} +8 -7
  155. package/{toolApiClient-ARGFDJAG.js → toolApiClient-B2MFXMEG.js} +3 -3
  156. package/tools-XMWCVMPM.js +98 -0
  157. package/{tuiSummaryLlmCaller-SRZ4QQUP.js → tuiSummaryLlmCaller-NCAJSVSD.js} +24 -21
  158. package/{updateDialogTitleAction-HOYHEVOU.js → updateDialogTitleAction-XPJZRJEL.js} +48 -38
  159. package/agentRecordCommands-GFPAXOW5.js +0 -103
  160. package/agentRunCommand-IXI7BKCG.js +0 -121
  161. package/chunk-DCDL3GC4.js +0 -171
  162. package/chunk-F3MP7CP6.js +0 -73
  163. package/chunk-RPHGRXQM.js +0 -1707
  164. package/chunk-WI7I7UKC.js +0 -3158
  165. package/chunk-WZSRQNQG.js +0 -2587
  166. package/createDialogAction-WXVKBBRV.js +0 -52
  167. package/dialogCommands-7QDRPPWW.js +0 -95
  168. package/tools-44PI5ZON.js +0 -90
  169. package/{chunk-Z5MXSEOJ.js → chunk-RQSOAMPJ.js} +2 -2
  170. package/{chunk-JDSUTNYY.js → chunk-SAQQLJZ5.js} +3 -3
@@ -1,22 +1,22 @@
1
1
  import {
2
- BUILTIN_SUMMARY_LLM_CONFIG,
3
- COMPACTION_SUMMARY_SYSTEM_PROMPT,
4
- buildCompactionMetricsFromPlan,
5
- buildCompactionUserContent,
6
- estimateTokenCount,
7
- formatCompactionMetricsLog,
8
- formatFileOperationsFromMessages,
9
- formatMessagesForSummaryWithTruncation,
10
- normalizeAssistantContentBuffer,
11
- planCompression,
12
- serializeMessageContent
13
- } from "./chunk-BGTUGS3T.js";
2
+ BUILTIN_SUMMARY_LLM_CONFIG
3
+ } from "./chunk-RCFIB45Q.js";
14
4
  import {
15
- cleanupCliSessionForDialog
16
- } from "./chunk-ATK5WJOA.js";
5
+ buildDialogAttachmentPlan,
6
+ extractFileContentIds
7
+ } from "./chunk-EGRJC4ZN.js";
8
+ import {
9
+ isOAuthApiKeyRef
10
+ } from "./chunk-YYLHWIW6.js";
11
+ import {
12
+ getApproxPricePerImage
13
+ } from "./chunk-CWMSB67P.js";
17
14
  import {
18
15
  runLlm
19
- } from "./chunk-7MTP4AIU.js";
16
+ } from "./chunk-ZJMME4DS.js";
17
+ import {
18
+ cleanupCliSessionForDialog
19
+ } from "./chunk-JZ5AMMXU.js";
20
20
  import {
21
21
  getActiveDialogAgentId,
22
22
  getDialogAgentIds,
@@ -26,8 +26,32 @@ import {
26
26
  require_date_fns
27
27
  } from "./chunk-M76ECQRD.js";
28
28
  import {
29
- toErrorMessage
30
- } from "./chunk-HNMXYYJR.js";
29
+ fetchMessages
30
+ } from "./chunk-KSRFVP36.js";
31
+ import {
32
+ DEFAULT_AUTO_EXECUTION_PROFILE,
33
+ DEFAULT_CONTEXT_WINDOW,
34
+ getModelContextWindow,
35
+ getModelInfo,
36
+ resolveAutoExecutionProfile,
37
+ resolveBuiltinPlatformAgentRecord
38
+ } from "./chunk-2H3XIBY4.js";
39
+ import {
40
+ COMPACTION_SUMMARY_SYSTEM_PROMPT,
41
+ buildCompactionMetricsFromPlan,
42
+ buildCompactionUserContent,
43
+ estimateTokenCount,
44
+ formatCompactionMetricsLog,
45
+ formatFileOperationsFromMessages,
46
+ formatMessagesForSummaryWithTruncation,
47
+ normalizeAssistantContentBuffer,
48
+ planCompression,
49
+ serializeMessageContent
50
+ } from "./chunk-AOXVOC6D.js";
51
+ import {
52
+ findModelConfig,
53
+ getModelConfig
54
+ } from "./chunk-DFUPZE6V.js";
31
55
  import {
32
56
  abortActiveControllers,
33
57
  addPageReferenceToRuntime,
@@ -42,25 +66,17 @@ import {
42
66
  selectCurrentDialogKey,
43
67
  setActiveDialogKey,
44
68
  setDialogConfigError
45
- } from "./chunk-3ASDTTEI.js";
46
- import {
47
- ALL_MODELS
48
- } from "./chunk-WTGCTVJG.js";
49
- import {
50
- getApproxPricePerImage
51
- } from "./chunk-CWMSB67P.js";
69
+ } from "./chunk-MRWGHF56.js";
52
70
  import {
53
- MODEL_LOOKUP_MAP,
54
- findModelConfig,
55
- getModelConfig
56
- } from "./chunk-2K4NDPT5.js";
71
+ toErrorMessage
72
+ } from "./chunk-HNMXYYJR.js";
57
73
  import {
58
74
  getPlatformHostedDeepSeekV4Price,
59
75
  isPlatformHostedDeepSeekV4Model
60
- } from "./chunk-CAENRKNJ.js";
76
+ } from "./chunk-OR2HNLVO.js";
61
77
  import {
62
78
  nolotusId
63
- } from "./chunk-G5GVZAXF.js";
79
+ } from "./chunk-CLP2K7U4.js";
64
80
  import {
65
81
  asRecordOrEmpty
66
82
  } from "./chunk-KX6YBIHG.js";
@@ -70,19 +86,27 @@ import {
70
86
  remove,
71
87
  selectById,
72
88
  write
73
- } from "./chunk-LAXMH7JY.js";
89
+ } from "./chunk-57QJXIB6.js";
74
90
  import {
75
- asTrimmedLowercaseString
76
- } from "./chunk-QSJ3HFEF.js";
91
+ buildDialogAgentListIndexDeleteOps,
92
+ createDialogMessageKeyAndId,
93
+ createKey,
94
+ createTokenKey,
95
+ createTokenStatsKey,
96
+ dialogMessageKey,
97
+ isDialogRecordKey,
98
+ isPageKey,
99
+ isTableMetaKey
100
+ } from "./chunk-KMSZPTM6.js";
77
101
  import {
78
- PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
79
- builtinRuntimeFallbackEntries
80
- } from "./chunk-ZJH3LKEW.js";
102
+ asOptionalFiniteNumber
103
+ } from "./chunk-WWC7I6TA.js";
81
104
  import {
82
- extractCustomId,
83
- extractUserId,
84
- publicAgentKey
85
- } from "./chunk-TOW4E763.js";
105
+ asTrimmedNonEmptyStringArray
106
+ } from "./chunk-I42VC5KR.js";
107
+ import {
108
+ asTrimmedLowercaseString
109
+ } from "./chunk-QSJ3HFEF.js";
86
110
  import {
87
111
  asyncThunkCreator,
88
112
  buildCreateSlice,
@@ -93,28 +117,11 @@ import {
93
117
  parseOwnerUserIdFromDbKey,
94
118
  scheduleDeleteReplication,
95
119
  selectIdentityUserId
96
- } from "./chunk-2IJAKBK2.js";
120
+ } from "./chunk-X664KVEV.js";
97
121
  import {
98
122
  createClientLogger,
99
123
  isAbortError
100
- } from "./chunk-5RDLGLAP.js";
101
- import {
102
- fetchMessages
103
- } from "./chunk-L3GCUVOH.js";
104
- import {
105
- buildDialogAgentListIndexDeleteOps,
106
- createDialogMessageKeyAndId,
107
- createKey,
108
- createTokenKey,
109
- createTokenStatsKey,
110
- dialogMessageKey,
111
- isDialogRecordKey,
112
- isPageKey,
113
- isTableMetaKey
114
- } from "./chunk-WHLVPK32.js";
115
- import {
116
- asOptionalFiniteNumber
117
- } from "./chunk-WWC7I6TA.js";
124
+ } from "./chunk-WJSW43QZ.js";
118
125
  import {
119
126
  isTombstoneRecord,
120
127
  shouldReplaceWithNextRecord
@@ -122,12 +129,13 @@ import {
122
129
  import {
123
130
  asTrimmedString
124
131
  } from "./chunk-3EUW3WEO.js";
132
+ import {
133
+ extractCustomId,
134
+ extractUserId
135
+ } from "./chunk-BJIRLHJR.js";
125
136
  import {
126
137
  isRecord
127
138
  } from "./chunk-KUG52IAP.js";
128
- import {
129
- asTrimmedNonEmptyStringArray
130
- } from "./chunk-I42VC5KR.js";
131
139
  import {
132
140
  asOptionalTrimmedString
133
141
  } from "./chunk-G3SUCT4W.js";
@@ -1224,112 +1232,6 @@ var fetchAndCacheMessages = async (options) => {
1224
1232
  return remotePromise;
1225
1233
  };
1226
1234
 
1227
- // packages/ai/llm/getModelContextWindow.ts
1228
- var DEFAULT_CONTEXT_WINDOW = 256e3;
1229
- var QWEN_3_6_CONTEXT_WINDOW = 262144;
1230
- var GLM_5_2_CONTEXT_WINDOW = 1e6;
1231
- var ANTIGRAVITY_EFFORT_SUFFIXES = [
1232
- "-tiered",
1233
- "-extra-low",
1234
- "-low",
1235
- "-medium",
1236
- "-high"
1237
- ];
1238
- function stripEffortSuffix(model) {
1239
- for (const suffix of ANTIGRAVITY_EFFORT_SUFFIXES) {
1240
- if (model.endsWith(suffix) && model.length > suffix.length) {
1241
- return model.slice(0, -suffix.length);
1242
- }
1243
- }
1244
- return model;
1245
- }
1246
- function stripPreviewSuffix(model) {
1247
- const suffix = "-preview";
1248
- if (model.endsWith(suffix) && model.length > suffix.length) {
1249
- return model.slice(0, -suffix.length);
1250
- }
1251
- return model;
1252
- }
1253
- var fullModelMap = null;
1254
- var getFullModelMap = () => {
1255
- if (!fullModelMap) {
1256
- fullModelMap = /* @__PURE__ */ new Map();
1257
- for (const [provider, models] of Object.entries(MODEL_LOOKUP_MAP)) {
1258
- for (const model of models) {
1259
- const entry = { ...model, provider };
1260
- fullModelMap.set(model.name, entry);
1261
- if (model.displayName) {
1262
- fullModelMap.set(model.displayName.toLowerCase(), entry);
1263
- }
1264
- }
1265
- }
1266
- }
1267
- return fullModelMap;
1268
- };
1269
- var legacyModelMap = null;
1270
- var getLegacyModelMap = () => {
1271
- if (!legacyModelMap) {
1272
- legacyModelMap = /* @__PURE__ */ new Map();
1273
- for (const model of ALL_MODELS) {
1274
- legacyModelMap.set(model.name, model);
1275
- if (model.displayName) {
1276
- legacyModelMap.set(model.displayName.toLowerCase(), model);
1277
- }
1278
- }
1279
- }
1280
- return legacyModelMap;
1281
- };
1282
- function fuzzyContextWindow(normalizedName) {
1283
- if (normalizedName.includes("qwen-long") || normalizedName.includes("qwen3-long")) return 10485760;
1284
- if (normalizedName.includes("qwen-coder") || normalizedName.includes("qwen3-coder")) return 1048576;
1285
- if (normalizedName.includes("qwen3.8") || normalizedName.includes("qwen3p8")) return 1e6;
1286
- if (normalizedName.includes("minimax-m3") || normalizedName.includes("minimax_m3")) return 1e6;
1287
- if (normalizedName.includes("glm-5.2") || normalizedName.includes("glm5.2")) return GLM_5_2_CONTEXT_WINDOW;
1288
- if (normalizedName.includes("deepseek")) return 1e6;
1289
- if (normalizedName.includes("gpt-5") || normalizedName.includes("gpt-4.1")) return 1047576;
1290
- if (normalizedName.startsWith("cursor-grok-4.5")) return 1e6;
1291
- if (normalizedName.includes("claude-4.6")) return 1e6;
1292
- if (normalizedName.includes("gemini-3.1")) return 1e6;
1293
- if (normalizedName.includes("gemini")) return 1048576;
1294
- if (normalizedName.includes("qwen3.6") || normalizedName.includes("qwen3p6")) return QWEN_3_6_CONTEXT_WINDOW;
1295
- if (normalizedName.includes("qwen3.7") || normalizedName.includes("qwen3p7")) return 262144;
1296
- if (normalizedName.includes("minimax-m2") || normalizedName.includes("minimax_m2")) return 262144;
1297
- if (normalizedName.includes("claude")) return 2e5;
1298
- return void 0;
1299
- }
1300
- var getModelContextWindow = (modelName) => {
1301
- if (!modelName) return DEFAULT_CONTEXT_WINDOW;
1302
- const normalizedName = modelName.toLowerCase();
1303
- const map = getFullModelMap();
1304
- const candidates = [modelName, normalizedName];
1305
- const strippedEffort = stripEffortSuffix(modelName);
1306
- if (strippedEffort !== modelName) {
1307
- candidates.push(strippedEffort, strippedEffort.toLowerCase());
1308
- }
1309
- const strippedPreview = stripPreviewSuffix(modelName);
1310
- if (strippedPreview !== modelName) {
1311
- candidates.push(strippedPreview, strippedPreview.toLowerCase());
1312
- }
1313
- if (strippedEffort !== modelName) {
1314
- const strippedBoth = stripPreviewSuffix(strippedEffort);
1315
- if (strippedBoth !== strippedEffort) {
1316
- candidates.push(strippedBoth, strippedBoth.toLowerCase());
1317
- }
1318
- }
1319
- for (const candidate of candidates) {
1320
- const model = map.get(candidate);
1321
- if (model?.contextWindow) {
1322
- return typeof model.contextWindow === "number" ? model.contextWindow : DEFAULT_CONTEXT_WINDOW;
1323
- }
1324
- }
1325
- return fuzzyContextWindow(normalizedName) ?? DEFAULT_CONTEXT_WINDOW;
1326
- };
1327
- var getModelInfo = (modelName) => {
1328
- if (!modelName) return null;
1329
- const map = getLegacyModelMap();
1330
- return map.get(modelName) || map.get(modelName.toLowerCase()) || null;
1331
- };
1332
-
1333
1235
  // packages/chat/messages/parseJsonRecord.ts
1334
1236
  function asOptionalJsonRecord(value) {
1335
1237
  if (typeof value === "string") {
@@ -1741,84 +1643,6 @@ var buildPersonalizationDialogPolicyContext = () => [
1741
1643
  "\u9664\u975E\u7528\u6237\u660E\u786E\u8981\u6C42\uFF0C\u5426\u5219\u4E0D\u8981\u521B\u5EFA\u6587\u6863\uFF0C\u4E0D\u8981\u521B\u5EFA\u6216\u4FEE\u6539\u4EFB\u4F55 agent\u3002"
1742
1644
  ].join("\n");
1743
1645
 
1744
- // packages/agent-runtime/autoExecutionProfiles.ts
1745
- var createProfile = (input) => ({
1746
- id: input.id,
1747
- tier: input.tier,
1748
- legacyAgentKey: input.legacyAgentKey,
1749
- key: input.legacyAgentKey,
1750
- name: input.name,
1751
- provider: "nolo",
1752
- model: input.model,
1753
- apiSource: "platform",
1754
- useServerProxy: true,
1755
- rawRecord: {
1756
- dbKey: input.legacyAgentKey,
1757
- isPublic: true,
1758
- provider: "nolo",
1759
- model: input.model,
1760
- apiSource: "platform",
1761
- useServerProxy: true
1762
- }
1763
- });
1764
- var FLASH_PROFILE = createProfile({
1765
- id: "builtin:auto:deepseek-v4-flash",
1766
- tier: "flash",
1767
- legacyAgentKey: PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
1768
- name: "DeepSeek V4 Flash",
1769
- model: "deepseek-v4-flash"
1770
- });
1771
- var AUTO_EXECUTION_PROFILES = {
1772
- flash: FLASH_PROFILE,
1773
- balanced: { ...FLASH_PROFILE, tier: "balanced" },
1774
- quality: { ...FLASH_PROFILE, tier: "quality" },
1775
- image: { ...FLASH_PROFILE, tier: "image" }
1776
- };
1777
- var DEFAULT_AUTO_EXECUTION_TIER = "flash";
1778
- var DEFAULT_AUTO_EXECUTION_PROFILE = AUTO_EXECUTION_PROFILES[DEFAULT_AUTO_EXECUTION_TIER];
1779
- var resolveAutoExecutionProfile = (tier) => AUTO_EXECUTION_PROFILES[tier ?? DEFAULT_AUTO_EXECUTION_TIER] ?? DEFAULT_AUTO_EXECUTION_PROFILE;
1780
-
1781
- // packages/agent-runtime/builtinPlatformAgentConfigs.ts
1782
- function buildConfig(e) {
1783
- const key = publicAgentKey(e.id);
1784
- const rawRecord = {
1785
- dbKey: key,
1786
- isPublic: true,
1787
- provider: e.provider,
1788
- model: e.model,
1789
- apiSource: e.apiSource ?? "platform",
1790
- useServerProxy: e.useServerProxy ?? true
1791
- };
1792
- if (e.hasImageOutput) rawRecord.hasImageOutput = true;
1793
- if (e.imageModel) rawRecord.imageModel = e.imageModel;
1794
- if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
1795
- if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
1796
- return {
1797
- key,
1798
- name: e.name,
1799
- provider: e.provider,
1800
- model: e.model,
1801
- apiSource: e.apiSource ?? "platform",
1802
- useServerProxy: e.useServerProxy ?? true,
1803
- rawRecord
1804
- };
1805
- }
1806
- var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
1807
- builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
1808
- );
1809
- function resolveBuiltinPlatformAgentConfig(agentRef) {
1810
- return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
1811
- }
1812
- function resolveBuiltinPlatformAgentRecord(agentRef) {
1813
- const config = resolveBuiltinPlatformAgentConfig(agentRef);
1814
- if (!config) return null;
1815
- return {
1816
- ...config.rawRecord,
1817
- dbKey: agentRef,
1818
- ...config.name ? { name: config.name } : {}
1819
- };
1820
- }
1821
-
1822
1646
  // packages/chat/dialog/dialogAgentPolicy.ts
1823
1647
  var resolveDialogAgentMode = (dialog) => {
1824
1648
  if (dialog?.agentMode === "auto") return "auto";
@@ -1882,13 +1706,13 @@ function assemblePersistedUserMessage(input) {
1882
1706
  dialogKey,
1883
1707
  currentAccountUserId
1884
1708
  });
1885
- const { key: messageDbKey2, messageId } = createDialogMessageKeyAndId(
1709
+ const { key: messageDbKey, messageId } = createDialogMessageKeyAndId(
1886
1710
  dialogId
1887
1711
  );
1888
1712
  const fullMessage = {
1889
1713
  ...message,
1890
1714
  id: messageId,
1891
- dbKey: messageDbKey2,
1715
+ dbKey: messageDbKey,
1892
1716
  userId
1893
1717
  };
1894
1718
  return { fullMessage, dialogId, dialogKey };
@@ -3620,7 +3444,7 @@ var messageSlice = createSliceWithThunks({
3620
3444
  runtimeOptions: args.runtimeOptions
3621
3445
  });
3622
3446
  if (agentKeyToUse) {
3623
- const { streamAgentChatTurn } = await import("./agentSlice-QYJQOUVC.js");
3447
+ const { streamAgentChatTurn } = await import("./agentSlice-TNMFQQOV.js");
3624
3448
  await dispatch(
3625
3449
  streamAgentChatTurn({
3626
3450
  agentKey: agentKeyToUse,
@@ -4013,7 +3837,7 @@ var calculateOpenRouterFallbackCost = (resolvedPrice, usage, externalPrice) => {
4013
3837
  }
4014
3838
  return calculateSimpleCost(resolvedPrice, usage, externalPrice);
4015
3839
  };
4016
- var API_REPORTED_COST_MULTIPLIER = 7;
3840
+ var API_REPORTED_COST_MULTIPLIER = 8;
4017
3841
  var zeroCostBreakdown = () => ({
4018
3842
  regular: 0,
4019
3843
  charge: 0,
@@ -4063,8 +3887,10 @@ var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceT
4063
3887
  case "deepinfra":
4064
3888
  return calculateCacheBasedCost(resolvedPrice, usage, externalPrice);
4065
3889
  // nolo/crof: honor inputCacheHit only when the model defines it (K3 has
4066
- // inputCacheHit=2). Models without it (e.g. K2.6) keep simple full-price
4067
- // billing so cached tokens are not priced at 0.
3890
+ // inputCacheHit=2, K2.6 has 0.32 from its OpenRouter upstream). Models
3891
+ // without it keep simple full-price billing so cached tokens are not
3892
+ // priced at 0 — but a platform-hosted model用于 agentic 循环时必须补上
3893
+ // 这一项,否则每轮重放的上下文会被按 input 原价重复计费。
4068
3894
  case "nolo":
4069
3895
  case "crof":
4070
3896
  return typeof resolvedPrice.inputCacheHit === "number" ? calculateCacheBasedCost(resolvedPrice, usage, externalPrice) : calculateSimpleCost(resolvedPrice, usage, externalPrice);
@@ -4301,47 +4127,42 @@ var resolveBillingTarget = ({
4301
4127
  };
4302
4128
  };
4303
4129
 
4304
- // packages/agent-runtime/serverProxyPolicy.ts
4305
- var OAUTH_APIKEY_REFS = /* @__PURE__ */ new Set([
4306
- "antigravity",
4307
- "xai",
4308
- "chatgpt",
4309
- "claude",
4310
- "cursor"
4311
- ]);
4312
- function isGoogleFamilyProvider(provider) {
4313
- const normalized = asTrimmedLowercaseString(provider);
4314
- return normalized === "google" || normalized.startsWith("google-");
4315
- }
4316
- function isOAuthApiKeyRef(value) {
4317
- const ref = asTrimmedLowercaseString(value);
4318
- return ref.length > 0 && OAUTH_APIKEY_REFS.has(ref);
4319
- }
4320
- function shouldUseServerProxy(agentConfig, requestProvider) {
4321
- const effectiveProvider = (requestProvider || agentConfig.provider || "").toLowerCase();
4322
- if (isGoogleFamilyProvider(effectiveProvider)) {
4323
- return true;
4324
- }
4325
- if (isOAuthApiKeyRef(agentConfig.apiKeyRef)) {
4326
- return true;
4327
- }
4328
- if (agentConfig.apiSource === "custom" && isRemoteCustomEndpoint(agentConfig.customProviderUrl)) {
4329
- return true;
4330
- }
4331
- return !!agentConfig.useServerProxy;
4332
- }
4333
- var LOCAL_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "0.0.0.0"]);
4334
- function isRemoteCustomEndpoint(url) {
4335
- if (typeof url !== "string") return false;
4336
- try {
4337
- const host = new URL(url).hostname.toLowerCase();
4338
- return !LOCAL_HOSTS.has(host);
4339
- } catch {
4340
- return false;
4341
- }
4342
- }
4343
-
4344
4130
  // packages/ai/token/prepareTokenUsageData.ts
4131
+ function resolveTokenUsagePricing(args) {
4132
+ const { rawUsage, agentConfig, nowMs } = args;
4133
+ const usage = normalizeUsage(rawUsage);
4134
+ const billingTarget = resolveBillingTarget({
4135
+ usage,
4136
+ fallbackProvider: agentConfig.provider,
4137
+ fallbackModel: agentConfig.model
4138
+ });
4139
+ const billedProvider = billingTarget.provider;
4140
+ const billedModel = billingTarget.model;
4141
+ const billedServiceTier = billingTarget.serviceTier;
4142
+ const hasExternalPrice = agentConfig.inputPrice !== void 0 && agentConfig.inputPrice > 0 || agentConfig.outputPrice !== void 0 && agentConfig.outputPrice > 0;
4143
+ const { cost, pay } = calculatePrice({
4144
+ provider: billedProvider,
4145
+ modelName: billedModel,
4146
+ billingServiceTier: billedServiceTier,
4147
+ usage,
4148
+ externalPrice: hasExternalPrice ? {
4149
+ input: agentConfig.inputPrice ?? 0,
4150
+ output: agentConfig.outputPrice ?? 0,
4151
+ creatorId: agentConfig.userId ?? (agentConfig.id ? extractUserId(agentConfig.id) : "")
4152
+ } : void 0,
4153
+ sharingLevel: agentConfig.sharingLevel,
4154
+ nowMs
4155
+ });
4156
+ return {
4157
+ usage,
4158
+ billedProvider,
4159
+ billedModel,
4160
+ billedServiceTier,
4161
+ cost,
4162
+ pay,
4163
+ hasExternalPrice
4164
+ };
4165
+ }
4345
4166
  function resolveBillable(input) {
4346
4167
  const uid = input.userId?.trim();
4347
4168
  if (!uid || uid === "local") return false;
@@ -4354,6 +4175,18 @@ function resolveBillable(input) {
4354
4175
  if (apiSource == null || apiSource === "") return true;
4355
4176
  return false;
4356
4177
  }
4178
+ function resolveBillableForAgent(input) {
4179
+ const { usage, cost, userId, agentConfig } = input;
4180
+ const hasExternalPrice = input.hasExternalPrice ?? (agentConfig.inputPrice !== void 0 && agentConfig.inputPrice > 0 || agentConfig.outputPrice !== void 0 && agentConfig.outputPrice > 0);
4181
+ return resolveBillable({
4182
+ usage,
4183
+ userId,
4184
+ apiSource: agentConfig.apiSource,
4185
+ apiKeyRef: agentConfig.apiKeyRef,
4186
+ cost,
4187
+ hasExternalPrice
4188
+ });
4189
+ }
4357
4190
  var prepareTokenUsageData = ({
4358
4191
  rawUsage,
4359
4192
  agentConfig,
@@ -4373,36 +4206,17 @@ var prepareTokenUsageData = ({
4373
4206
  "prepareTokenUsageData requires a non-empty agentId or cybotId"
4374
4207
  );
4375
4208
  }
4376
- const usage = normalizeUsage(rawUsage);
4377
- const billingTarget = resolveBillingTarget({
4378
- usage,
4379
- fallbackProvider: agentConfig.provider,
4380
- fallbackModel: agentConfig.model
4381
- });
4382
- const billedProvider = billingTarget.provider;
4383
- const billedModel = billingTarget.model;
4384
- const billedServiceTier = billingTarget.serviceTier;
4385
- const recordProvider = billedProvider ?? agentConfig.provider ?? "unknown";
4386
- const hasExternalPrice = agentConfig.inputPrice !== void 0 && agentConfig.inputPrice > 0 || agentConfig.outputPrice !== void 0 && agentConfig.outputPrice > 0;
4387
- const { cost, pay } = calculatePrice({
4388
- provider: billedProvider,
4389
- modelName: billedModel,
4390
- billingServiceTier: billedServiceTier,
4391
- usage,
4392
- externalPrice: hasExternalPrice ? {
4393
- input: agentConfig.inputPrice ?? 0,
4394
- output: agentConfig.outputPrice ?? 0,
4395
- creatorId: agentConfig.userId ?? (agentConfig.id ? extractUserId(agentConfig.id) : "")
4396
- } : void 0,
4397
- sharingLevel: agentConfig.sharingLevel,
4209
+ const { usage, billedProvider, billedModel, billedServiceTier, cost, pay, hasExternalPrice } = resolveTokenUsagePricing({
4210
+ rawUsage,
4211
+ agentConfig,
4398
4212
  nowMs: timestamp
4399
4213
  });
4400
- const billable = resolveBillable({
4214
+ const recordProvider = billedProvider ?? agentConfig.provider ?? "unknown";
4215
+ const billable = resolveBillableForAgent({
4401
4216
  usage,
4402
- userId,
4403
- apiSource: agentConfig.apiSource,
4404
- apiKeyRef: agentConfig.apiKeyRef,
4405
4217
  cost,
4218
+ userId,
4219
+ agentConfig,
4406
4220
  hasExternalPrice
4407
4221
  });
4408
4222
  return {
@@ -4433,27 +4247,83 @@ var prepareTokenUsageData = ({
4433
4247
  };
4434
4248
 
4435
4249
  // packages/ai/token/applyTokenUsageToDayStats.ts
4436
- var ZERO_STATS = { count: 0, tokens: { input: 0, output: 0 }, cost: 0 };
4437
- function applyTokenUsageToDayStats(prev, delta) {
4438
- const base = prev ?? {
4439
- userId: delta.userId,
4440
- period: "day",
4441
- timeKey: delta.timeKey,
4442
- total: { ...ZERO_STATS },
4443
- models: {},
4444
- providers: {}
4445
- };
4446
- const modelName = delta.model || "unknown";
4447
- const providerName = delta.provider || "unknown";
4448
- const inc = (s) => ({
4449
- count: (s?.count ?? 0) + 1,
4250
+ var ZERO_STATS = {
4251
+ count: 0,
4252
+ tokens: { input: 0, output: 0, cacheRead: 0, cacheCreation: 0 },
4253
+ cost: 0,
4254
+ failedCount: 0
4255
+ };
4256
+ function normalizeStats(s) {
4257
+ if (!s) return { ...ZERO_STATS };
4258
+ const t = s.tokens;
4259
+ return {
4260
+ count: s.count ?? 0,
4450
4261
  tokens: {
4451
- input: (s?.tokens.input ?? 0) + delta.input_tokens,
4452
- output: (s?.tokens.output ?? 0) + delta.output_tokens
4262
+ input: t?.input ?? 0,
4263
+ output: t?.output ?? 0,
4264
+ cacheRead: t?.cacheRead ?? t?.cache_read ?? 0,
4265
+ cacheCreation: t?.cacheCreation ?? t?.cache_creation ?? 0
4453
4266
  },
4454
- cost: Number(((s?.cost ?? 0) + delta.cost).toFixed(6))
4455
- });
4267
+ cost: s.cost ?? 0,
4268
+ failedCount: s.failedCount ?? 0
4269
+ };
4270
+ }
4271
+ function normalizeDayStats(prev, userId, timeKey) {
4272
+ if (!prev) {
4273
+ return {
4274
+ userId,
4275
+ period: "day",
4276
+ timeKey,
4277
+ total: { ...ZERO_STATS },
4278
+ models: {},
4279
+ providers: {},
4280
+ agents: {},
4281
+ entryPaths: {}
4282
+ };
4283
+ }
4284
+ const normalizeMap = (m) => {
4285
+ if (!m) return {};
4286
+ const out = {};
4287
+ for (const [k, v] of Object.entries(m)) out[k] = normalizeStats(v);
4288
+ return out;
4289
+ };
4456
4290
  return {
4291
+ ...prev,
4292
+ total: normalizeStats(prev.total),
4293
+ models: normalizeMap(prev.models),
4294
+ providers: normalizeMap(prev.providers),
4295
+ agents: normalizeMap(prev.agents),
4296
+ entryPaths: normalizeMap(prev.entryPaths)
4297
+ };
4298
+ }
4299
+ function applyTokenUsageToDayStats(prev, delta) {
4300
+ const base = normalizeDayStats(prev, delta.userId, delta.timeKey);
4301
+ const modelName = delta.model || "unknown";
4302
+ const providerName = delta.provider || "unknown";
4303
+ const cacheRead = delta.cache_read_input_tokens ?? 0;
4304
+ const cacheCreation = delta.cache_creation_input_tokens ?? 0;
4305
+ const isFailed = delta.status === "failed";
4306
+ const inc = (s) => {
4307
+ const n = normalizeStats(s);
4308
+ if (isFailed) {
4309
+ return {
4310
+ ...n,
4311
+ failedCount: n.failedCount + 1
4312
+ };
4313
+ }
4314
+ return {
4315
+ count: n.count + 1,
4316
+ tokens: {
4317
+ input: n.tokens.input + delta.input_tokens,
4318
+ output: n.tokens.output + delta.output_tokens,
4319
+ cacheRead: n.tokens.cacheRead + cacheRead,
4320
+ cacheCreation: n.tokens.cacheCreation + cacheCreation
4321
+ },
4322
+ cost: Number((n.cost + delta.cost).toFixed(6)),
4323
+ failedCount: n.failedCount
4324
+ };
4325
+ };
4326
+ const result = {
4457
4327
  ...base,
4458
4328
  total: inc(base.total),
4459
4329
  models: {
@@ -4465,6 +4335,21 @@ function applyTokenUsageToDayStats(prev, delta) {
4465
4335
  [providerName]: inc(base.providers[providerName])
4466
4336
  }
4467
4337
  };
4338
+ if (delta.agentId !== void 0) {
4339
+ const agentKey = delta.agentId || "unknown";
4340
+ result.agents = {
4341
+ ...base.agents,
4342
+ [agentKey]: inc(base.agents[agentKey])
4343
+ };
4344
+ }
4345
+ if (delta.entry_path !== void 0) {
4346
+ const entryKey = delta.entry_path || "unknown";
4347
+ result.entryPaths = {
4348
+ ...base.entryPaths,
4349
+ [entryKey]: inc(base.entryPaths[entryKey])
4350
+ };
4351
+ }
4352
+ return result;
4468
4353
  }
4469
4354
 
4470
4355
  // packages/core/keyedTaskQueue.ts
@@ -4515,7 +4400,11 @@ var updateStats = async (data, existingStats, key, thunkApi) => {
4515
4400
  provider: data.provider || "unknown",
4516
4401
  input_tokens: data.input_tokens,
4517
4402
  output_tokens: data.output_tokens,
4518
- cost: data.cost
4403
+ cost: data.cost,
4404
+ cache_read_input_tokens: data.cache_read_input_tokens,
4405
+ cache_creation_input_tokens: data.cache_creation_input_tokens,
4406
+ agentId: data.agentId ?? data.cybotId,
4407
+ entry_path: data.entry_path
4519
4408
  });
4520
4409
  await thunkApi.dispatch(
4521
4410
  write({
@@ -4674,83 +4563,6 @@ var mergeDialogTokenStats = (dialogConfig, runtimeTokens) => ({
4674
4563
  totalCost: (dialogConfig?.totalCost ?? 0) + runtimeTokens.totalCost
4675
4564
  });
4676
4565
 
4677
- // packages/core/chat/dialogAttachmentCleanup.ts
4678
- var FILE_CONTENT_RE = /(?:https?:\/\/[^/"'\s]+)?\/api\/v1\/db\/file\/content\/([^?#"'\s)]+)/g;
4679
- function extractFileContentIds(value) {
4680
- const ids = /* @__PURE__ */ new Set();
4681
- const visit = (input) => {
4682
- if (typeof input === "string") {
4683
- for (const match of input.matchAll(FILE_CONTENT_RE)) {
4684
- const fileId = decodeURIComponent(match[1] ?? "").trim();
4685
- if (fileId) ids.add(fileId);
4686
- }
4687
- return;
4688
- }
4689
- if (Array.isArray(input)) {
4690
- for (const item of input) visit(item);
4691
- return;
4692
- }
4693
- if (input && typeof input === "object") {
4694
- for (const item of Object.values(input)) visit(item);
4695
- }
4696
- };
4697
- visit(value);
4698
- return [...ids];
4699
- }
4700
- function messageDbKey(dialogId, message) {
4701
- const dbKey = asOptionalTrimmedString(message.dbKey);
4702
- if (dbKey) return dbKey;
4703
- const id = asOptionalTrimmedString(message.id);
4704
- if (id) return dialogMessageKey(dialogId, id);
4705
- return null;
4706
- }
4707
- function asText(value) {
4708
- return asOptionalTrimmedString(value) ?? null;
4709
- }
4710
- function buildDialogAttachmentPlan(args) {
4711
- const messageKeys = new Set(
4712
- args.messages.map((message) => messageDbKey(args.dialogId, message)).filter((key) => Boolean(key))
4713
- );
4714
- const referencedFileIds = [
4715
- ...new Set(args.messages.flatMap((message) => extractFileContentIds(message)))
4716
- ];
4717
- const candidates = referencedFileIds.map((fileId) => {
4718
- const metadata = args.metadataByFileId[fileId];
4719
- const ownerType = asText(metadata?.ownerType);
4720
- const ownerId = asText(metadata?.ownerId);
4721
- const ownerDbKey = asText(metadata?.ownerDbKey);
4722
- const fileDbKey = asText(metadata?.dbKey);
4723
- const source = asText(metadata?.source);
4724
- const ownedByDialog = ownerType === "dialog" && ownerId === args.dialogId;
4725
- const ownedByMessage = Boolean(ownerDbKey && messageKeys.has(ownerDbKey));
4726
- const userOwnedReferenced = args.includeUserOwnedReferenced === true && Boolean(args.ownerId) && ownerType === "user" && ownerId === args.ownerId;
4727
- const canDelete = Boolean(fileDbKey && (ownedByDialog || ownedByMessage || userOwnedReferenced));
4728
- return {
4729
- fileId,
4730
- fileDbKey,
4731
- size: asOptionalFiniteNumber(metadata?.size) ?? null,
4732
- ownerType,
4733
- ownerId,
4734
- ownerDbKey,
4735
- source,
4736
- status: canDelete ? "delete" : "retain",
4737
- reason: canDelete ? ownedByMessage ? "ownerDbKey matches a message in this dialog" : userOwnedReferenced ? "user-owned file is referenced by this dialog and explicit referenced-attachment deletion is enabled" : "ownerType/ownerId matches this dialog" : fileDbKey ? "file ownership is not exclusive to this dialog" : "file metadata not found"
4738
- };
4739
- });
4740
- const deleteCandidates = candidates.filter((candidate) => candidate.status === "delete");
4741
- const retainedCandidates = candidates.filter((candidate) => candidate.status === "retain");
4742
- return {
4743
- dialogId: args.dialogId,
4744
- messageCount: args.messages.length,
4745
- referencedFileIds,
4746
- candidates,
4747
- deleteCandidates,
4748
- retainedCandidates,
4749
- bytesToDelete: deleteCandidates.reduce((sum, candidate) => sum + (candidate.size ?? 0), 0),
4750
- metadataReadFailures: args.metadataReadFailures ?? []
4751
- };
4752
- }
4753
-
4754
4566
  // packages/chat/dialog/deleteDialogOrchestration.ts
4755
4567
  var collectKeys = async (prefix, db) => {
4756
4568
  const keys = [];
@@ -4829,7 +4641,7 @@ var deleteOwnedDialogAttachments = async (args) => {
4829
4641
  metadataReadFailures
4830
4642
  });
4831
4643
  if (!plan.deleteCandidates.length) return plan;
4832
- const { deleteFileAction } = await import("./deleteFile-RJTEPOT4.js");
4644
+ const { deleteFileAction } = await import("./deleteFile-XQXPBFFB.js");
4833
4645
  for (const candidate of plan.deleteCandidates) {
4834
4646
  if (candidate.fileDbKey) {
4835
4647
  await deleteFileAction(candidate.fileDbKey, args.thunkApi);
@@ -4891,7 +4703,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
4891
4703
  }
4892
4704
  if (isCurrentDialog) {
4893
4705
  await thunkApi.dispatch(resetMsgs());
4894
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-WDIOJW3W.js");
4706
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-DOWKOILN.js");
4895
4707
  dispatch(clearPendingAttachments2());
4896
4708
  clearWorkflow();
4897
4709
  }
@@ -4900,39 +4712,39 @@ var deleteDialogThunk = async (payload, thunkApi) => {
4900
4712
 
4901
4713
  // packages/chat/dialog/dialogSlice.ts
4902
4714
  var runCreateDialogAction = async (args, thunkApi) => {
4903
- const { createDialogAction } = await import("./createDialogAction-WXVKBBRV.js");
4715
+ const { createDialogAction } = await import("./createDialogAction-LDCPDI73.js");
4904
4716
  return createDialogAction(args, thunkApi);
4905
4717
  };
4906
4718
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
4907
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-5I6ZMYIA.js");
4719
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-INQT23LX.js");
4908
4720
  return createAgentAutomationAction(args, thunkApi);
4909
4721
  };
4910
4722
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
4911
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-HOYHEVOU.js");
4723
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-XPJZRJEL.js");
4912
4724
  return updateDialogTitleAction(args, thunkApi);
4913
4725
  };
4914
4726
  var runAddDialogAgentAction = async (args, thunkApi) => {
4915
- const { addDialogAgentAction } = await import("./addDialogAgentAction-RCY4ECF4.js");
4727
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-W44ZCEHB.js");
4916
4728
  return addDialogAgentAction(args, thunkApi);
4917
4729
  };
4918
4730
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
4919
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-NEKVAMSH.js");
4731
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-E7H557UO.js");
4920
4732
  return removeDialogAgentAction(args, thunkApi);
4921
4733
  };
4922
4734
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
4923
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-LDJOYC4F.js");
4735
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-FWBKKLVA.js");
4924
4736
  return setPrimaryDialogAgentAction(args, thunkApi);
4925
4737
  };
4926
4738
  var runSwitchDialogAgentAction = async (args, thunkApi) => {
4927
- const { switchDialogAgentAction } = await import("./switchDialogAgentAction-XVWGKR2Z.js");
4739
+ const { switchDialogAgentAction } = await import("./switchDialogAgentAction-US6QNL3N.js");
4928
4740
  return switchDialogAgentAction(args, thunkApi);
4929
4741
  };
4930
4742
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
4931
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-WTOHQDIV.js");
4743
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-RMMGBR5F.js");
4932
4744
  return setDialogExtraReferencesAction(args, thunkApi);
4933
4745
  };
4934
4746
  var runHandleSendMessageAction = async (args, thunkApi) => {
4935
- const { handleSendMessageAction } = await import("./handleSendMessageAction-OUQ5QCMS.js");
4747
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-C3TSDWKH.js");
4936
4748
  return handleSendMessageAction(args, thunkApi);
4937
4749
  };
4938
4750
  function clearDialogState() {
@@ -4945,7 +4757,7 @@ var createPageAndAddReference = createAsyncThunk(
4945
4757
  async (payload, { dispatch, getState, rejectWithValue }) => {
4946
4758
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
4947
4759
  try {
4948
- const { createDocState } = await import("./docStore-BDOACT3C.js");
4760
+ const { createDocState } = await import("./docStore-UAWSKZ2Y.js");
4949
4761
  const pageKey = await createDocState(
4950
4762
  { slateData, title },
4951
4763
  { dispatch, getState }
@@ -5106,41 +4918,24 @@ var selectCurrentDialogTokens = createSelector(
5106
4918
  var selectTotalDialogTokens = selectCurrentDialogTokens;
5107
4919
 
5108
4920
  export {
5109
- resolveBuiltinPlatformAgentConfig,
5110
- resolveBuiltinPlatformAgentRecord,
5111
- fetchAndCacheMessages,
5112
4921
  isAssistantToolStub,
5113
- isOAuthApiKeyRef,
5114
- shouldUseServerProxy,
5115
- setWorkflow,
5116
- updateStep,
5117
- incrementStepsExecuted,
5118
- incrementFailedSteps,
5119
- toast,
4922
+ fetchAndCacheMessages,
4923
+ extractReferenceKeysFromMessage,
4924
+ normalizeAppRouteId,
5120
4925
  uiAskChoiceFunctionSchema,
5121
4926
  uiAskChoiceFunc,
5122
4927
  parseUiAskChoiceContent,
5123
- resolveDialogRuntimeAgentKey,
5124
- normalizeAppRouteId,
5125
- DEFAULT_CONTEXT_WINDOW,
5126
- getModelContextWindow,
5127
- getModelInfo,
5128
- API_REPORTED_COST_MULTIPLIER,
5129
- normalizeUsage,
5130
- prepareTokenUsageData,
5131
- applyTokenUsageToDayStats,
5132
- runKeyed,
5133
- updateTokensAction,
5134
- extractReferenceKeysFromMessage,
5135
- estimateMissingUsage,
5136
4928
  PERSONALIZATION_DIALOG_CATEGORY,
5137
4929
  buildPersonalizationDialogPolicyContext,
4930
+ resolveDialogRuntimeAgentKey,
5138
4931
  resolveHandleSendMessageContext,
4932
+ estimateMissingUsage,
5139
4933
  selectCurrentDialogId,
5140
4934
  selectAllMsgs,
5141
4935
  selectMsgById,
5142
4936
  addUserMessage,
5143
4937
  messageStreaming,
4938
+ resetMsgs,
5144
4939
  removeTransientMessage,
5145
4940
  finalizeTransientMessageOnError,
5146
4941
  prepareAndPersistMessage,
@@ -5148,8 +4943,18 @@ export {
5148
4943
  messageStreamEnd,
5149
4944
  addToolMessage,
5150
4945
  updateToolMessage,
5151
- extractFileContentIds,
5152
- buildDialogAttachmentPlan,
4946
+ setWorkflow,
4947
+ updateStep,
4948
+ incrementStepsExecuted,
4949
+ incrementFailedSteps,
4950
+ clearWorkflow,
4951
+ toast,
4952
+ API_REPORTED_COST_MULTIPLIER,
4953
+ normalizeUsage,
4954
+ prepareTokenUsageData,
4955
+ applyTokenUsageToDayStats,
4956
+ runKeyed,
4957
+ updateTokensAction,
5153
4958
  clearDialogState,
5154
4959
  createPageAndAddReference,
5155
4960
  deleteDialog,