nolo-cli 0.18.0 → 0.24.0-alpha.6

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 (133) hide show
  1. package/{_executeModel-X5PCIZN6.js → _executeModel-ARCMGGMY.js} +46 -44
  2. package/{action-LT7BRFLK.js → action-5MNAXR5B.js} +7 -6
  3. package/{addContentAction-PL3KKBDH.js → addContentAction-UNSYTVTB.js} +5 -5
  4. package/{addDialogAgentAction-FCMSKYAF.js → addDialogAgentAction-LJGNP2AO.js} +5 -5
  5. package/{agentDeleteCommand-2BZDQV36.js → agentDeleteCommand-C5PIEBMZ.js} +27 -26
  6. package/{agentEmailCommands-2QJDGRMB.js → agentEmailCommands-QTGQ3ZAD.js} +57 -55
  7. package/{agentListCommands-6VEPTKBI.js → agentListCommands-LRHBS3A5.js} +30 -26
  8. package/{agentMachineCommands-NVVHNWYI.js → agentMachineCommands-4PXIT4BP.js} +25 -24
  9. package/{agentRecordCommands-4GGRDMD4.js → agentRecordCommands-ZZPTYTYR.js} +52 -50
  10. package/{agentRunCommand-XOLQNKBZ.js → agentRunCommand-7ZTPZNUX.js} +55 -54
  11. package/{agentRunControl-Y5AFH5PQ.js → agentRunControl-SNUKXN6J.js} +6 -2
  12. package/{agentRuntimeLocal-7WYWCGL4.js → agentRuntimeLocal-QOYY5UV2.js} +19 -18
  13. package/{agentSlice-EAXPGEYV.js → agentSlice-J3W3RX2I.js} +5 -5
  14. package/{appDeleteCommands-77KR2RJ4.js → appDeleteCommands-7NS46XDH.js} +23 -22
  15. package/{appDeployCommands-K7CAHGBI.js → appDeployCommands-RSRNQ67U.js} +23 -22
  16. package/{appDeployStatusCommands-4OEKLTBT.js → appDeployStatusCommands-EF4RSGC6.js} +23 -22
  17. package/{appGetCommands-VM2WDLAZ.js → appGetCommands-YA7JWYUX.js} +23 -22
  18. package/{appListCommands-GX6BBA6U.js → appListCommands-WM2ON6JW.js} +23 -22
  19. package/{authCommand-DY6UUL6O.js → authCommand-HJP7FURK.js} +12 -13
  20. package/{authCommands-XTBV7OFZ.js → authCommands-NYZM2B2I.js} +4 -5
  21. package/{chunk-MKA6QE5E.js → chunk-2IPEVBUO.js} +126 -68
  22. package/{chunk-OWOHNGCN.js → chunk-2MBTWINN.js} +42 -3
  23. package/{chunk-K6EUAOW3.js → chunk-35RYGII3.js} +1 -1
  24. package/{chunk-TRT4I4UD.js → chunk-4POUK2BV.js} +2 -2
  25. package/{chunk-LLWKHDG4.js → chunk-4ULSC37S.js} +1 -3
  26. package/{chunk-EDV7EBOI.js → chunk-4ZH6GUJF.js} +2151 -1500
  27. package/{chunk-MVQ4TBSD.js → chunk-54VHTARN.js} +1 -1
  28. package/{chunk-L4F3I4SR.js → chunk-5HQQ4LUU.js} +4 -6
  29. package/{chunk-Z4NR32XR.js → chunk-5RGU3J7P.js} +13 -0
  30. package/{chunk-7BUYEZ6U.js → chunk-7H3UTGPM.js} +12 -72
  31. package/{chunk-RQN4SEKL.js → chunk-7W6GFNJL.js} +1 -1
  32. package/{chunk-HEGV7BH3.js → chunk-AQZCWJOG.js} +1 -1
  33. package/{chunk-3ND52WIL.js → chunk-ATWUOTJP.js} +180 -24
  34. package/chunk-CF7S2RYZ.js +376 -0
  35. package/{chunk-I2ZJKTG5.js → chunk-CGVRC2TB.js} +7 -7
  36. package/{chunk-UAIVG4J6.js → chunk-CHSCAUZN.js} +1 -8
  37. package/{chunk-KFEVY3ST.js → chunk-D34RI6NI.js} +18 -8
  38. package/{chunk-ROWQEJRP.js → chunk-DXJS7VSG.js} +3 -2
  39. package/{chunk-MHSGJW4Z.js → chunk-EHOYZRTI.js} +44 -14
  40. package/{chunk-XRZJGPFI.js → chunk-FON47ACC.js} +4 -4
  41. package/{chunk-SCTYAHYK.js → chunk-H2NAWOLH.js} +217 -141
  42. package/{chunk-MPVYDS7I.js → chunk-H6ODMJR3.js} +3 -3
  43. package/{chunk-R35XMF6F.js → chunk-H73ZV2GL.js} +352 -30
  44. package/{chunk-4T5F7YZQ.js → chunk-I6RJGORZ.js} +1 -1
  45. package/{chunk-OK6YSWLH.js → chunk-IICW77GI.js} +1 -1
  46. package/{chunk-VDXCXCXH.js → chunk-IUDMBCXC.js} +1 -1
  47. package/{chunk-AHCY2S2I.js → chunk-JADNODCQ.js} +1 -1
  48. package/{chunk-DFCFMCY6.js → chunk-JBLY6HQP.js} +2 -2
  49. package/{chunk-UGUW3FHG.js → chunk-JMSCXQUG.js} +2 -2
  50. package/{chunk-N54HIJVJ.js → chunk-KFUCLS7Z.js} +101 -9
  51. package/{chunk-FQZZLA3C.js → chunk-KXKQO4Q6.js} +17 -0
  52. package/{chunk-3Q7WHGCB.js → chunk-L65QKSVJ.js} +1 -1
  53. package/{chunk-3ZX7PERL.js → chunk-LALVWNE4.js} +20 -7
  54. package/{chunk-PJSV3IZ5.js → chunk-M3TMVJKG.js} +1 -1
  55. package/{chunk-REA4JLBH.js → chunk-M5OZCOBV.js} +7 -6
  56. package/{chunk-JLA4FXYC.js → chunk-MALVZUYL.js} +1 -1
  57. package/{chunk-GFUIQ4RY.js → chunk-MXFQHRSS.js} +1 -1
  58. package/{chunk-LSFAWXKC.js → chunk-N7J63Q6C.js} +1 -0
  59. package/{chunk-6Y7A3OQQ.js → chunk-NRY4GCKJ.js} +2 -0
  60. package/{chunk-G5U6LDLG.js → chunk-NVHPMDSZ.js} +6 -6
  61. package/{chunk-23FZYPLC.js → chunk-OJFYT3ZQ.js} +842 -1060
  62. package/{chunk-ELT65PZW.js → chunk-OXLLFZNF.js} +1 -1
  63. package/{chunk-CZ6NYQTV.js → chunk-P4QWLZGU.js} +2 -2
  64. package/{chunk-5MIDPSSK.js → chunk-PB7G5MAM.js} +3 -3
  65. package/{chunk-HWW2M4SN.js → chunk-QLVWFXZQ.js} +5 -4
  66. package/{chunk-VYHDJEQD.js → chunk-QNLLGS37.js} +136 -78
  67. package/{chunk-XHG22OEX.js → chunk-ROJI6DRT.js} +2 -2
  68. package/{chunk-BV4VEE3W.js → chunk-ROYOKSX4.js} +243 -354
  69. package/{chunk-VNAEBGDK.js → chunk-RZNYL4LW.js} +123 -26
  70. package/{chunk-RVOUXDFU.js → chunk-S6KVFOUG.js} +6 -34
  71. package/{chunk-V3ED5AWK.js → chunk-S77SCVBU.js} +27 -16
  72. package/{chunk-UBHAWFQ6.js → chunk-S7RWIPDI.js} +42 -19
  73. package/{chunk-B5TOXZAK.js → chunk-SIZQB7BD.js} +1 -1
  74. package/{chunk-DFFIZ25G.js → chunk-SLOGKB7M.js} +4 -1
  75. package/{chunk-FXUSIQC2.js → chunk-SROR5TSM.js} +1 -1
  76. package/{chunk-PIZYJVHQ.js → chunk-TN4YHAI3.js} +4 -4
  77. package/{chunk-IYEXFJPC.js → chunk-TW35GDNW.js} +64 -57
  78. package/chunk-UZ6XXCVR.js +50 -0
  79. package/{chunk-DKZFOK24.js → chunk-UZH44DWK.js} +7 -288
  80. package/{chunk-YGW4G5W5.js → chunk-X546QUDT.js} +61 -12
  81. package/chunk-YYLHWIW6.js +48 -0
  82. package/{chunk-SWDPIPOY.js → chunk-ZGVW7MSZ.js} +1 -1
  83. package/{chunk-34WPV75U.js → chunk-ZUXIXYJI.js} +1 -1
  84. package/{chunk-VC6OZXO5.js → chunk-ZWJOGMKH.js} +2 -26
  85. package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
  86. package/{codingSkills-36KN5NQT.js → codingSkills-EN6Z6G6U.js} +4 -4
  87. package/{createAgentAutomationAction-GNFF524X.js → createAgentAutomationAction-MKQWN4VQ.js} +19 -18
  88. package/{createDialogAction-RB55KCLO.js → createDialogAction-YWIZPLFS.js} +22 -20
  89. package/{createPageAction-Y7343GLU.js → createPageAction-74TTEIPC.js} +20 -19
  90. package/{db-W3O47YGF.js → db-W5UHK4P3.js} +150 -0
  91. package/{dbSlice-CGSRFJN3.js → dbSlice-5BKDURDL.js} +4 -4
  92. package/{dialogCommands-IAZK6YHQ.js → dialogCommands-MJIP32FL.js} +24 -23
  93. package/{dialogSlice-UQAXF23P.js → dialogSlice-KLLVH4WI.js} +24 -18
  94. package/{docCreateCommands-I2EWZGCI.js → docCreateCommands-5DN472U6.js} +24 -27
  95. package/{docDeleteCommands-IZ45UZKG.js → docDeleteCommands-HE76LBN4.js} +25 -24
  96. package/{docReadCommands-R6Z4QJYU.js → docReadCommands-XVGZSCBS.js} +24 -23
  97. package/{docStore-5HOJ4D7D.js → docStore-SPH3D6BT.js} +20 -19
  98. package/{docUpdateCommands-2LRBKQPY.js → docUpdateCommands-P7IAWUAD.js} +24 -27
  99. package/{fetchMessages-BMGVZVSE.js → fetchMessages-W4IKHPCS.js} +2 -3
  100. package/{getPricing-G7DLAST6.js → getPricing-WENPBVWH.js} +3 -3
  101. package/{handleSendMessageAction-Q4HY35WX.js → handleSendMessageAction-ZU6WJVL7.js} +23 -20
  102. package/index.js +74 -74
  103. package/{localDialogRead-4H3QJFLW.js → localDialogRead-JXTAHW2E.js} +2 -2
  104. package/{machineCommands-PKBPQKTY.js → machineCommands-NI76PVHK.js} +59 -57
  105. package/{machineWsRunDispatch-UZAW4OXJ.js → machineWsRunDispatch-W3G6NJVQ.js} +51 -49
  106. package/{models-DJFSJ7SW.js → models-DB27UAE3.js} +2 -2
  107. package/package.json +1 -1
  108. package/{read-3FMPZPER.js → read-F3L3T2WJ.js} +2 -1
  109. package/{readDocTool-VSYHKK3V.js → readDocTool-FOHWVA4R.js} +1 -1
  110. package/{readlineWorkspace-Y2RDOFZG.js → readlineWorkspace-BDH4G477.js} +880 -425
  111. package/{removeDialogAgentAction-OAGA2G3U.js → removeDialogAgentAction-QCFGIUIH.js} +8 -7
  112. package/{runAgentClientLoop-NBPIKJ6J.js → runAgentClientLoop-ZPKMXCM5.js} +45 -38
  113. package/{setDialogExtraReferencesAction-JZEXA5SL.js → setDialogExtraReferencesAction-DK4CKERU.js} +5 -5
  114. package/{setPrimaryDialogAgentAction-4ZUQQKDG.js → setPrimaryDialogAgentAction-SJSO6N27.js} +8 -7
  115. package/{settingSlice-7MNKHZ6R.js → settingSlice-XNM5AFPU.js} +6 -5
  116. package/{spaceCommands-DHCZ7J5I.js → spaceCommands-3GGBJRQR.js} +25 -24
  117. package/{spaceSlice-ZXLLG3CR.js → spaceSlice-47Z6XLFQ.js} +21 -18
  118. package/{streamAgentChatTurn-L3YW6LSB.js → streamAgentChatTurn-VT5K5JSD.js} +140 -98
  119. package/switchDialogAgentAction-4OAC6QRN.js +61 -0
  120. package/{tableCommands-BEQAGE4I.js → tableCommands-HEQYT2KP.js} +1 -1
  121. package/{toolApiClient-QI3YBNWB.js → toolApiClient-ISM4ZQX4.js} +2 -2
  122. package/{tools-ECGXR5QF.js → tools-L7RCHAPT.js} +36 -33
  123. package/{tuiSummaryLlmCaller-OMSCNHXA.js → tuiSummaryLlmCaller-3DYOLTVN.js} +6 -6
  124. package/{updateCommands-XTW55TOT.js → updateCommands-HTCOBXCA.js} +2 -2
  125. package/{updateDialogTitleAction-HQ2EUDFT.js → updateDialogTitleAction-KMPVPQ4A.js} +28 -27
  126. package/chunk-DL6EPNIK.js +0 -50
  127. package/chunk-V5R4NZP2.js +0 -78
  128. package/chunk-X4Q4UZEY.js +0 -26
  129. package/queryRunOverlay-O4LOMMPO.js +0 -161
  130. package/runOverlayPresentation-ZO4VCWEU.js +0 -11
  131. package/types-ZSTJ7MPR.js +0 -7
  132. package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
  133. package/{runtimeDoctorCommands-E2OUORHK.js → runtimeDoctorCommands-HSU632DY.js} +3 -3
@@ -2,33 +2,37 @@ import {
2
2
  BUILTIN_SUMMARY_LLM_CONFIG,
3
3
  buildBuiltinSummaryContent
4
4
  } from "./chunk-XOIF2TNF.js";
5
- import {
6
- buildDialogAttachmentPlan,
7
- extractFileContentIds
8
- } from "./chunk-B5TOXZAK.js";
9
5
  import {
10
6
  authRoutes
11
7
  } from "./chunk-MRC4Q34M.js";
8
+ import {
9
+ buildDialogAttachmentPlan,
10
+ extractFileContentIds
11
+ } from "./chunk-SIZQB7BD.js";
12
12
  import {
13
13
  deleteServerSyncedCredential,
14
14
  runLlm
15
- } from "./chunk-REA4JLBH.js";
15
+ } from "./chunk-M5OZCOBV.js";
16
+ import {
17
+ isOAuthApiKeyRef
18
+ } from "./chunk-YYLHWIW6.js";
16
19
  import {
17
20
  getApproxPricePerImage
18
21
  } from "./chunk-CWMSB67P.js";
19
22
  import {
20
23
  cleanupCliSessionForDialog
21
- } from "./chunk-XHG22OEX.js";
24
+ } from "./chunk-ROJI6DRT.js";
22
25
  import {
26
+ getActiveDialogAgentId,
23
27
  getDialogAgentIds,
24
28
  getPrimaryDialogAgentId
25
- } from "./chunk-Z4NR32XR.js";
29
+ } from "./chunk-5RGU3J7P.js";
26
30
  import {
27
31
  require_date_fns
28
32
  } from "./chunk-M76ECQRD.js";
29
33
  import {
30
34
  fetchMessages
31
- } from "./chunk-3Q7WHGCB.js";
35
+ } from "./chunk-L65QKSVJ.js";
32
36
  import {
33
37
  DEFAULT_AUTO_EXECUTION_PROFILE,
34
38
  DEFAULT_CONTEXT_WINDOW,
@@ -38,29 +42,14 @@ import {
38
42
  planCompression,
39
43
  resolveAutoExecutionProfile,
40
44
  serializeMessageContent
41
- } from "./chunk-I2ZJKTG5.js";
45
+ } from "./chunk-CGVRC2TB.js";
42
46
  import {
43
47
  createFileCredentialBroker
44
48
  } from "./chunk-5CS33IBL.js";
45
49
  import {
46
50
  findModelConfig,
47
51
  getModelConfig
48
- } from "./chunk-UAIVG4J6.js";
49
- import {
50
- toErrorMessage
51
- } from "./chunk-HNMXYYJR.js";
52
- import {
53
- UNCATEGORIZED_ID,
54
- addContentAction,
55
- checkSpaceMembership,
56
- createSpaceKey,
57
- localSpaceAuthorityPatchStamp,
58
- normalizeSpaceId
59
- } from "./chunk-ELT65PZW.js";
60
- import {
61
- extractCustomId,
62
- extractUserId
63
- } from "./chunk-DFFIZ25G.js";
52
+ } from "./chunk-CHSCAUZN.js";
64
53
  import {
65
54
  abortActiveControllers,
66
55
  addPageReferenceToRuntime,
@@ -78,16 +67,31 @@ import {
78
67
  setActiveDialogKey,
79
68
  setDialogConfigError
80
69
  } from "./chunk-3ASDTTEI.js";
70
+ import {
71
+ toErrorMessage
72
+ } from "./chunk-HNMXYYJR.js";
73
+ import {
74
+ getPlatformHostedDeepSeekV4Price,
75
+ isPlatformHostedDeepSeekV4Model
76
+ } from "./chunk-2IPEVBUO.js";
81
77
  import {
82
78
  isSystemAdmin,
83
79
  nolotusId,
84
80
  selectRemoteServer,
85
81
  selectRemoteServers,
86
82
  selectRemoteSyncServers
87
- } from "./chunk-RVOUXDFU.js";
83
+ } from "./chunk-S6KVFOUG.js";
88
84
  import {
89
85
  asRecordOrEmpty
90
86
  } from "./chunk-KX6YBIHG.js";
87
+ import {
88
+ UNCATEGORIZED_ID,
89
+ addContentAction,
90
+ checkSpaceMembership,
91
+ createSpaceKey,
92
+ localSpaceAuthorityPatchStamp,
93
+ normalizeSpaceId
94
+ } from "./chunk-OXLLFZNF.js";
91
95
  import {
92
96
  patch,
93
97
  read,
@@ -100,7 +104,7 @@ import {
100
104
  uploadFileAction,
101
105
  upsertSSREntity,
102
106
  write
103
- } from "./chunk-XRZJGPFI.js";
107
+ } from "./chunk-FON47ACC.js";
104
108
  import {
105
109
  DB_PREFIX,
106
110
  SEPARATOR,
@@ -125,7 +129,7 @@ import {
125
129
  splitKey,
126
130
  toTrimmedString,
127
131
  ulid
128
- } from "./chunk-6Y7A3OQQ.js";
132
+ } from "./chunk-NRY4GCKJ.js";
129
133
  import {
130
134
  asOptionalFiniteNumber
131
135
  } from "./chunk-WWC7I6TA.js";
@@ -137,8 +141,9 @@ import {
137
141
  asTrimmedLowercaseString
138
142
  } from "./chunk-QSJ3HFEF.js";
139
143
  import {
144
+ builtinRuntimeFallbackEntries,
140
145
  readAction
141
- } from "./chunk-3ND52WIL.js";
146
+ } from "./chunk-ATWUOTJP.js";
142
147
  import {
143
148
  DEVICE_LOCAL_OWNER_ID,
144
149
  asyncThunkCreator,
@@ -179,6 +184,11 @@ import {
179
184
  import {
180
185
  asOptionalPositiveFiniteNumber
181
186
  } from "./chunk-U6VC4MU4.js";
187
+ import {
188
+ extractCustomId,
189
+ extractUserId,
190
+ publicAgentKey
191
+ } from "./chunk-SLOGKB7M.js";
182
192
  import {
183
193
  isRecord
184
194
  } from "./chunk-KUG52IAP.js";
@@ -3820,12 +3830,54 @@ var buildPersonalizationDialogPolicyContext = () => [
3820
3830
  "\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"
3821
3831
  ].join("\n");
3822
3832
 
3833
+ // packages/agent-runtime/builtinPlatformAgentConfigs.ts
3834
+ function buildConfig(e) {
3835
+ const key = publicAgentKey(e.id);
3836
+ const rawRecord = {
3837
+ dbKey: key,
3838
+ isPublic: true,
3839
+ provider: e.provider,
3840
+ model: e.model,
3841
+ apiSource: e.apiSource ?? "platform",
3842
+ useServerProxy: e.useServerProxy ?? true
3843
+ };
3844
+ if (e.hasImageOutput) rawRecord.hasImageOutput = true;
3845
+ if (e.imageModel) rawRecord.imageModel = e.imageModel;
3846
+ if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
3847
+ if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
3848
+ return {
3849
+ key,
3850
+ name: e.name,
3851
+ provider: e.provider,
3852
+ model: e.model,
3853
+ apiSource: e.apiSource ?? "platform",
3854
+ useServerProxy: e.useServerProxy ?? true,
3855
+ rawRecord
3856
+ };
3857
+ }
3858
+ var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
3859
+ builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
3860
+ );
3861
+ function resolveBuiltinPlatformAgentConfig(agentRef) {
3862
+ return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
3863
+ }
3864
+ function resolveBuiltinPlatformAgentRecord(agentRef) {
3865
+ const config = resolveBuiltinPlatformAgentConfig(agentRef);
3866
+ if (!config) return null;
3867
+ return {
3868
+ ...config.rawRecord,
3869
+ dbKey: agentRef,
3870
+ ...config.name ? { name: config.name } : {}
3871
+ };
3872
+ }
3873
+
3823
3874
  // packages/chat/dialog/dialogAgentPolicy.ts
3824
3875
  var resolveDialogAgentMode = (dialog) => {
3825
3876
  if (dialog?.agentMode === "auto") return "auto";
3826
3877
  if (dialog?.agentMode === "fixed") return "fixed";
3827
- return getPrimaryDialogAgentId(dialog) ? "fixed" : "auto";
3878
+ return getActiveDialogAgentId(dialog) ? "fixed" : "auto";
3828
3879
  };
3880
+ var isAutoDialog = (dialog) => resolveDialogAgentMode(dialog) === "auto";
3829
3881
  var resolveDialogAutoTier = (dialog) => {
3830
3882
  const tier = asOptionalTrimmedString(dialog?.autoRoute?.stickyTier);
3831
3883
  return tier === "flash" || tier === "balanced" || tier === "quality" || tier === "image" ? tier : void 0;
@@ -3834,19 +3886,25 @@ var resolveDialogRuntimeAgentKey = (dialog, explicitAgentKey) => {
3834
3886
  const explicit = asOptionalTrimmedString(explicitAgentKey);
3835
3887
  if (explicit) return explicit;
3836
3888
  if (resolveDialogAgentMode(dialog) === "fixed") {
3837
- const fixed = getPrimaryDialogAgentId(dialog);
3889
+ const fixed = getActiveDialogAgentId(dialog);
3838
3890
  if (fixed) return fixed;
3839
3891
  }
3840
3892
  return resolveAutoExecutionProfile(
3841
3893
  resolveDialogAutoTier(dialog) ?? DEFAULT_AUTO_EXECUTION_PROFILE.tier
3842
3894
  ).legacyAgentKey;
3843
3895
  };
3896
+ var resolveDialogRuntimeAgentConfig = (dialog, explicitAgentKey) => {
3897
+ if (!isAutoDialog(dialog)) return null;
3898
+ const key = resolveDialogRuntimeAgentKey(dialog, explicitAgentKey);
3899
+ return resolveBuiltinPlatformAgentRecord(key) ?? null;
3900
+ };
3844
3901
 
3845
3902
  // packages/chat/dialog/actions/handleSendMessageResolver.ts
3846
3903
  function resolveHandleSendMessageContext(input) {
3847
3904
  const { dialogConfig, targetAgentKey, runtimeOptions } = input;
3848
3905
  return {
3849
3906
  agentKeyToUse: resolveDialogRuntimeAgentKey(dialogConfig, targetAgentKey),
3907
+ agentConfigToUse: resolveDialogRuntimeAgentConfig(dialogConfig, targetAgentKey) ?? void 0,
3850
3908
  effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(runtimeOptions ?? {}) : runtimeOptions
3851
3909
  };
3852
3910
  }
@@ -4980,33 +5038,6 @@ var messageSlice = createSliceWithThunks({
4980
5038
  });
4981
5039
  }
4982
5040
  }),
4983
- /**
4984
- * Append a run-overlay presentation as a non-streaming assistant message.
4985
- *
4986
- * This is a pure UI presentation action — it does NOT trigger a new agent
4987
- * turn, does NOT call the LLM, and is therefore not billed. The message
4988
- * is upserted into the dialog's message list so the user sees the run
4989
- * status snapshot at turn-end. A fresh message id/dbKey are minted from
4990
- * the dialog id so repeated overlays across turns don't collide.
4991
- *
4992
- * The message is marked role:"assistant" with isStreaming:false. Callers
4993
- * that want to keep it out of the LLM context can post-filter by the
4994
- * `metadata.overlayMessage` flag set here.
4995
- */
4996
- appendOverlayMessage: create.reducer((state3, action2) => {
4997
- const dialogId = extractCustomId(action2.payload.dialogKey);
4998
- if (!dialogId) return;
4999
- const dialogState = ensureMessageDialogState(state3, dialogId);
5000
- const { key: msgKey, messageId } = createDialogMessageKeyAndId(dialogId);
5001
- upsertOneMessage(dialogState, {
5002
- id: messageId,
5003
- dbKey: msgKey,
5004
- role: "assistant",
5005
- content: action2.payload.text,
5006
- isStreaming: false,
5007
- metadata: { overlayMessage: true }
5008
- });
5009
- }),
5010
5041
  prepareAndPersistMessage: create.asyncThunk(
5011
5042
  async (args, thunkApi) => {
5012
5043
  const { message, dialogConfig } = args;
@@ -5282,6 +5313,7 @@ var messageSlice = createSliceWithThunks({
5282
5313
  const {
5283
5314
  finalContentBuffer,
5284
5315
  totalUsage,
5316
+ billingUsageRecords,
5285
5317
  msgKey,
5286
5318
  agentConfig,
5287
5319
  dialogId,
@@ -5382,23 +5414,26 @@ var messageSlice = createSliceWithThunks({
5382
5414
  toolCalls
5383
5415
  });
5384
5416
  if (billingMode === "reported") {
5385
- dispatch(
5386
- updateTokens({
5387
- dialogId,
5388
- dialogKey,
5389
- usage: billedUsage,
5390
- agentConfig
5391
- })
5392
- );
5417
+ const usageRecords = billingUsageRecords?.length ? billingUsageRecords : [{ callId: void 0, usage: billedUsage }];
5418
+ for (const usageRecord of usageRecords) {
5419
+ await dispatch(
5420
+ updateTokens({
5421
+ dialogId,
5422
+ dialogKey,
5423
+ usageRecord,
5424
+ agentConfig
5425
+ })
5426
+ ).unwrap();
5427
+ }
5393
5428
  } else if (billingMode === "estimated") {
5394
- dispatch(
5429
+ await dispatch(
5395
5430
  updateTokens({
5396
5431
  dialogId,
5397
5432
  dialogKey,
5398
5433
  usage: billedEstimatedUsage,
5399
5434
  agentConfig
5400
5435
  })
5401
- );
5436
+ ).unwrap();
5402
5437
  console.warn("[billing] Missing usage at messageStreamEnd; using estimated token update", {
5403
5438
  dialogId,
5404
5439
  dialogKey,
@@ -5586,16 +5621,17 @@ var messageSlice = createSliceWithThunks({
5586
5621
  (m) => m?.dbKey ? dispatch(remove(m.dbKey)).unwrap() : Promise.resolve()
5587
5622
  )
5588
5623
  );
5589
- const { agentKeyToUse, effectiveRuntimeOptions } = resolveHandleSendMessageContext({
5624
+ const { agentKeyToUse, agentConfigToUse, effectiveRuntimeOptions } = resolveHandleSendMessageContext({
5590
5625
  dialogConfig,
5591
5626
  targetAgentKey: args.targetAgentKey,
5592
5627
  runtimeOptions: args.runtimeOptions
5593
5628
  });
5594
5629
  if (agentKeyToUse) {
5595
- const { streamAgentChatTurn } = await import("./agentSlice-EAXPGEYV.js");
5630
+ const { streamAgentChatTurn } = await import("./agentSlice-J3W3RX2I.js");
5596
5631
  await dispatch(
5597
5632
  streamAgentChatTurn({
5598
5633
  agentKey: agentKeyToUse,
5634
+ ...agentConfigToUse ? { agentConfig: agentConfigToUse } : {},
5599
5635
  userInput: nextContent,
5600
5636
  dialogKey,
5601
5637
  parentMessageId: void 0,
@@ -5648,8 +5684,7 @@ var {
5648
5684
  editUserMessageAndReplay,
5649
5685
  addToolMessage,
5650
5686
  updateToolMessage,
5651
- removeMessagesByIds,
5652
- appendOverlayMessage
5687
+ removeMessagesByIds
5653
5688
  } = messageSlice.actions;
5654
5689
  var messageSlice_default = messageSlice.reducer;
5655
5690
 
@@ -5722,10 +5757,10 @@ var createTokenRecord = (data, { cost, inputPrice, outputPrice } = {}) => ({
5722
5757
  inputPrice,
5723
5758
  outputPrice
5724
5759
  });
5725
- var saveTokenRecord = async (tokenData, record, thunkApi) => {
5760
+ var saveTokenRecord = async (tokenData, record, thunkApi, callId) => {
5726
5761
  const ownerUserId = tokenData.userId || record.userId;
5727
5762
  const eventTime = tokenData.timestamp ?? record.createdAt ?? Date.now();
5728
- const key = createTokenKey.record(ownerUserId, eventTime);
5763
+ const key = callId ? createTokenKey.recordForStableCall(ownerUserId, callId) : createTokenKey.record(ownerUserId, eventTime);
5729
5764
  try {
5730
5765
  await thunkApi.dispatch(
5731
5766
  write({
@@ -7476,9 +7511,13 @@ var resolveEffectiveModelPrice = ({
7476
7511
  model,
7477
7512
  usage,
7478
7513
  provider,
7479
- billingServiceTier
7514
+ billingServiceTier,
7515
+ nowMs
7480
7516
  }) => {
7481
7517
  const resolvedPrice = resolveModelPrice(model, usage);
7518
+ if ((provider === "nolo" || provider === "deepseek") && isPlatformHostedDeepSeekV4Model(model.name)) {
7519
+ return getPlatformHostedDeepSeekV4Price(model.name, nowMs);
7520
+ }
7482
7521
  if (provider === "google") {
7483
7522
  return resolveGoogleServiceTierPrice(model, resolvedPrice, billingServiceTier);
7484
7523
  }
@@ -7603,7 +7642,7 @@ var resolveOpenAIBuiltInImageSurcharge = (model, usage) => {
7603
7642
  if (imageGenerationCount <= 0 || pricePerImage <= 0) return 0;
7604
7643
  return imageGenerationCount * pricePerImage;
7605
7644
  };
7606
- var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceTier) => {
7645
+ var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceTier, nowMs) => {
7607
7646
  if (!usage || typeof usage.input_tokens !== "number") {
7608
7647
  throw new Error("Invalid usage data");
7609
7648
  }
@@ -7611,7 +7650,8 @@ var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceT
7611
7650
  model,
7612
7651
  usage,
7613
7652
  provider,
7614
- billingServiceTier
7653
+ billingServiceTier,
7654
+ nowMs
7615
7655
  });
7616
7656
  switch (provider) {
7617
7657
  case "deepseek":
@@ -7688,12 +7728,26 @@ var calculatePrice = ({
7688
7728
  // 不设默认值,undefined 表示 custom/未知 provider,走 zeroCostModel 路径
7689
7729
  provider,
7690
7730
  billingServiceTier,
7731
+ nowMs,
7691
7732
  sharingLevel = "default"
7692
7733
  }) => {
7693
7734
  let model;
7694
7735
  try {
7695
7736
  model = getModelConfig(provider, modelName);
7696
7737
  } catch {
7738
+ if ((provider === "nolo" || provider === "deepseek") && isPlatformHostedDeepSeekV4Model(modelName)) {
7739
+ const hostedModel = getModelConfig("nolo", modelName);
7740
+ const costs3 = calculateBasicCost(
7741
+ hostedModel,
7742
+ usage,
7743
+ provider,
7744
+ externalPrice,
7745
+ billingServiceTier,
7746
+ nowMs
7747
+ );
7748
+ const pay3 = calculatePayDistribution(costs3, externalPrice, sharingLevel);
7749
+ return { cost: sanitizeCost(costs3.charge), pay: pay3 };
7750
+ }
7697
7751
  const zeroCostModel = {
7698
7752
  name: modelName,
7699
7753
  hasVision: false,
@@ -7704,7 +7758,8 @@ var calculatePrice = ({
7704
7758
  usage,
7705
7759
  "custom",
7706
7760
  externalPrice,
7707
- billingServiceTier
7761
+ billingServiceTier,
7762
+ nowMs
7708
7763
  );
7709
7764
  const pay2 = calculatePayDistribution(costs2, externalPrice, sharingLevel);
7710
7765
  return { cost: sanitizeCost(costs2.charge), pay: pay2 };
@@ -7714,7 +7769,8 @@ var calculatePrice = ({
7714
7769
  usage,
7715
7770
  provider || "custom",
7716
7771
  externalPrice,
7717
- billingServiceTier
7772
+ billingServiceTier,
7773
+ nowMs
7718
7774
  );
7719
7775
  const openAIImageSurcharge = provider === "openai" ? resolveOpenAIBuiltInImageSurcharge(model, usage) : 0;
7720
7776
  const adjustedCosts = openAIImageSurcharge > 0 ? {
@@ -7777,6 +7833,8 @@ var normalizeUsage = (usage) => {
7777
7833
  const billingModel = asOptionalTrimmedString(usage.billing_model);
7778
7834
  const billingServiceTier = asOptionalTrimmedString(usage.billing_service_tier);
7779
7835
  const billingEstimated = "billing_estimated" in usage && usage.billing_estimated === true;
7836
+ const serverBilled = "server_billed" in usage && usage.server_billed === true;
7837
+ const providerCallId = asOptionalTrimmedString(usage.provider_call_id);
7780
7838
  const imageGenerationCount = "image_generation_count" in usage ? asOptionalFiniteNumber(usage.image_generation_count) : void 0;
7781
7839
  const providerResponseIds = normalizeStringArray(
7782
7840
  usage.provider_response_ids
@@ -7797,6 +7855,8 @@ var normalizeUsage = (usage) => {
7797
7855
  ...billingModel ? { billing_model: billingModel } : {},
7798
7856
  ...billingServiceTier ? { billing_service_tier: billingServiceTier } : {},
7799
7857
  ...billingEstimated ? { billing_estimated: true } : {},
7858
+ ...serverBilled ? { server_billed: true } : {},
7859
+ ...providerCallId ? { provider_call_id: providerCallId } : {},
7800
7860
  ...xaiTicks !== void 0 ? { cost_in_usd_ticks: xaiTicks } : {}
7801
7861
  };
7802
7862
  };
@@ -7828,46 +7888,6 @@ var resolveBillingTarget = ({
7828
7888
  };
7829
7889
  };
7830
7890
 
7831
- // packages/agent-runtime/serverProxyPolicy.ts
7832
- var OAUTH_APIKEY_REFS = /* @__PURE__ */ new Set([
7833
- "antigravity",
7834
- "xai",
7835
- "chatgpt",
7836
- "claude",
7837
- "cursor"
7838
- ]);
7839
- function isGoogleFamilyProvider(provider) {
7840
- const normalized = asTrimmedLowercaseString(provider);
7841
- return normalized === "google" || normalized.startsWith("google-");
7842
- }
7843
- function isOAuthApiKeyRef(value) {
7844
- const ref = asTrimmedLowercaseString(value);
7845
- return ref.length > 0 && OAUTH_APIKEY_REFS.has(ref);
7846
- }
7847
- function shouldUseServerProxy(agentConfig, requestProvider) {
7848
- const effectiveProvider = (requestProvider || agentConfig.provider || "").toLowerCase();
7849
- if (isGoogleFamilyProvider(effectiveProvider)) {
7850
- return true;
7851
- }
7852
- if (isOAuthApiKeyRef(agentConfig.apiKeyRef)) {
7853
- return true;
7854
- }
7855
- if (agentConfig.apiSource === "custom" && isRemoteCustomEndpoint(agentConfig.customProviderUrl)) {
7856
- return true;
7857
- }
7858
- return !!agentConfig.useServerProxy;
7859
- }
7860
- var LOCAL_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "0.0.0.0"]);
7861
- function isRemoteCustomEndpoint(url) {
7862
- if (typeof url !== "string") return false;
7863
- try {
7864
- const host = new URL(url).hostname.toLowerCase();
7865
- return !LOCAL_HOSTS.has(host);
7866
- } catch {
7867
- return false;
7868
- }
7869
- }
7870
-
7871
7891
  // packages/ai/token/prepareTokenUsageData.ts
7872
7892
  function resolveBillable(input) {
7873
7893
  const uid = input.userId?.trim();
@@ -7921,7 +7941,8 @@ var prepareTokenUsageData = ({
7921
7941
  output: agentConfig.outputPrice ?? 0,
7922
7942
  creatorId: agentConfig.userId ?? (agentConfig.id ? extractUserId(agentConfig.id) : "")
7923
7943
  } : void 0,
7924
- sharingLevel: agentConfig.sharingLevel
7944
+ sharingLevel: agentConfig.sharingLevel,
7945
+ nowMs: timestamp
7925
7946
  });
7926
7947
  const billable = resolveBillable({
7927
7948
  usage,
@@ -8103,7 +8124,7 @@ var saveTokenUsage = async (data, thunkApi) => {
8103
8124
  }
8104
8125
  });
8105
8126
  };
8106
- var updateTokensAction = async ({ dialogId, dialogKey, usage: usageRaw, agentConfig }, thunkApi) => {
8127
+ var updateTokensAction = async ({ dialogId, dialogKey, usage: legacyUsage, usageRecord, agentConfig }, thunkApi) => {
8107
8128
  const state3 = thunkApi.getState();
8108
8129
  const { currentUser } = state3.auth;
8109
8130
  const dialogConfig = dialogKey ? selectById(state3, dialogKey) : null;
@@ -8114,9 +8135,17 @@ var updateTokensAction = async ({ dialogId, dialogKey, usage: usageRaw, agentCon
8114
8135
  currentAccountUserId: currentUser?.userId ?? null
8115
8136
  });
8116
8137
  const timestamp = Date.now();
8138
+ const callId = typeof usageRecord?.callId === "string" && usageRecord.callId ? usageRecord.callId : void 0;
8139
+ const usageRaw = usageRecord?.usage ?? legacyUsage;
8140
+ const usageWithStableCallId = callId && !usageRaw?.provider_call_id ? { ...usageRaw, provider_call_id: callId } : usageRaw;
8141
+ const callAgentConfig = {
8142
+ ...agentConfig,
8143
+ ...typeof usageRecord?.model === "string" ? { model: usageRecord.model } : {},
8144
+ ...typeof usageRecord?.provider === "string" ? { provider: usageRecord.provider } : {}
8145
+ };
8117
8146
  const prepared = prepareTokenUsageData({
8118
- rawUsage: usageRaw,
8119
- agentConfig,
8147
+ rawUsage: usageWithStableCallId,
8148
+ agentConfig: callAgentConfig,
8120
8149
  userId: ownerUserId,
8121
8150
  username: currentUser?.username,
8122
8151
  agentId: agentConfig.id,
@@ -8135,13 +8164,22 @@ var updateTokensAction = async ({ dialogId, dialogKey, usage: usageRaw, agentCon
8135
8164
  // undefined when a prepare helper omits timestamp.
8136
8165
  timestamp
8137
8166
  };
8167
+ const stableTokenKey = callId ? createTokenKey.recordForStableCall(ownerUserId, callId) : null;
8168
+ const accountingAlreadyProjected = stableTokenKey ? Boolean(selectById(state3, stableTokenKey)) : false;
8138
8169
  const billedCatalog = findModelConfig(recordProvider, billedModel)?.price;
8139
8170
  const record = createTokenRecord(persistedTokenData, {
8140
8171
  cost: result.cost,
8141
8172
  inputPrice: billedCatalog?.input ?? agentConfig.inputPrice,
8142
8173
  outputPrice: billedCatalog?.output ?? agentConfig.outputPrice
8143
8174
  });
8144
- await saveTokenRecord(persistedTokenData, record, thunkApi);
8175
+ await saveTokenRecord(persistedTokenData, record, thunkApi, callId);
8176
+ if (accountingAlreadyProjected) {
8177
+ return {
8178
+ input_tokens: usage.input_tokens,
8179
+ output_tokens: usage.output_tokens,
8180
+ cost: result.cost
8181
+ };
8182
+ }
8145
8183
  await saveTokenUsage(persistedTokenData, thunkApi);
8146
8184
  if (persistedTokenData.billable === true || persistedTokenData.billable === void 0 && result.cost > 0) {
8147
8185
  thunkApi.dispatch(deductBalance(result.cost));
@@ -8319,7 +8357,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8319
8357
  }
8320
8358
  if (isCurrentDialog) {
8321
8359
  await thunkApi.dispatch(resetMsgs());
8322
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-UQAXF23P.js");
8360
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-KLLVH4WI.js");
8323
8361
  dispatch(clearPendingAttachments2());
8324
8362
  clearWorkflow();
8325
8363
  }
@@ -8328,35 +8366,39 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8328
8366
 
8329
8367
  // packages/chat/dialog/dialogSlice.ts
8330
8368
  var runCreateDialogAction = async (args, thunkApi) => {
8331
- const { createDialogAction } = await import("./createDialogAction-RB55KCLO.js");
8369
+ const { createDialogAction } = await import("./createDialogAction-YWIZPLFS.js");
8332
8370
  return createDialogAction(args, thunkApi);
8333
8371
  };
8334
8372
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
8335
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-GNFF524X.js");
8373
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-MKQWN4VQ.js");
8336
8374
  return createAgentAutomationAction(args, thunkApi);
8337
8375
  };
8338
8376
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
8339
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-HQ2EUDFT.js");
8377
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-KMPVPQ4A.js");
8340
8378
  return updateDialogTitleAction(args, thunkApi);
8341
8379
  };
8342
8380
  var runAddDialogAgentAction = async (args, thunkApi) => {
8343
- const { addDialogAgentAction } = await import("./addDialogAgentAction-FCMSKYAF.js");
8381
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-LJGNP2AO.js");
8344
8382
  return addDialogAgentAction(args, thunkApi);
8345
8383
  };
8346
8384
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
8347
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-OAGA2G3U.js");
8385
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-QCFGIUIH.js");
8348
8386
  return removeDialogAgentAction(args, thunkApi);
8349
8387
  };
8350
8388
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
8351
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-4ZUQQKDG.js");
8389
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-SJSO6N27.js");
8352
8390
  return setPrimaryDialogAgentAction(args, thunkApi);
8353
8391
  };
8392
+ var runSwitchDialogAgentAction = async (args, thunkApi) => {
8393
+ const { switchDialogAgentAction } = await import("./switchDialogAgentAction-4OAC6QRN.js");
8394
+ return switchDialogAgentAction(args, thunkApi);
8395
+ };
8354
8396
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
8355
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-JZEXA5SL.js");
8397
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-DK4CKERU.js");
8356
8398
  return setDialogExtraReferencesAction(args, thunkApi);
8357
8399
  };
8358
8400
  var runHandleSendMessageAction = async (args, thunkApi) => {
8359
- const { handleSendMessageAction } = await import("./handleSendMessageAction-Q4HY35WX.js");
8401
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-ZU6WJVL7.js");
8360
8402
  return handleSendMessageAction(args, thunkApi);
8361
8403
  };
8362
8404
  function clearDialogState() {
@@ -8369,7 +8411,7 @@ var createPageAndAddReference = createAsyncThunk(
8369
8411
  async (payload, { dispatch, getState, rejectWithValue }) => {
8370
8412
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
8371
8413
  try {
8372
- const { createDocState } = await import("./docStore-5HOJ4D7D.js");
8414
+ const { createDocState } = await import("./docStore-SPH3D6BT.js");
8373
8415
  const pageKey = await createDocState(
8374
8416
  { slateData, title },
8375
8417
  { dispatch, getState }
@@ -8487,6 +8529,10 @@ var setPrimaryDialogAgent = createAsyncThunk(
8487
8529
  "dialog/setPrimaryDialogAgent",
8488
8530
  runSetPrimaryDialogAgentAction
8489
8531
  );
8532
+ var switchDialogAgent = createAsyncThunk(
8533
+ "dialog/switchDialogAgent",
8534
+ runSwitchDialogAgentAction
8535
+ );
8490
8536
  var setDialogExtraReferences = createAsyncThunk(
8491
8537
  "dialog/setDialogExtraReferences",
8492
8538
  runSetDialogExtraReferencesAction
@@ -13236,7 +13282,9 @@ var spaceListsUser = (spaceData, userId) => {
13236
13282
  return Array.isArray(spaceData.members) && spaceData.members.includes(userId);
13237
13283
  };
13238
13284
  var membershipBelongsToUser = (membership, userId) => !membership.userId || membership.userId === userId;
13239
- var fetchRemoteUserSpaceMemberships = async (server, token, userId, timeoutMs = 5e3) => {
13285
+ var membershipFetchCache = /* @__PURE__ */ new Map();
13286
+ var MEMBERSHIP_FETCH_CACHE_TTL_MS = 3e4;
13287
+ async function fetchMembershipsFromServer(server, token, userId, timeoutMs) {
13240
13288
  if (!token) return { ok: false, memberships: [] };
13241
13289
  const controller = new AbortController();
13242
13290
  const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
@@ -13268,6 +13316,22 @@ var fetchRemoteUserSpaceMemberships = async (server, token, userId, timeoutMs =
13268
13316
  console.error(`Error fetching memberships from ${server}:`, error);
13269
13317
  return { ok: false, memberships: [] };
13270
13318
  }
13319
+ }
13320
+ var fetchRemoteUserSpaceMemberships = (server, token, userId, timeoutMs = 5e3) => {
13321
+ const cacheKey = `${server}|${userId}`;
13322
+ const cached = membershipFetchCache.get(cacheKey);
13323
+ if (cached) return cached;
13324
+ const promise = fetchMembershipsFromServer(server, token, userId, timeoutMs);
13325
+ membershipFetchCache.set(cacheKey, promise);
13326
+ promise.catch(() => {
13327
+ }).finally(() => {
13328
+ setTimeout(() => {
13329
+ if (membershipFetchCache.get(cacheKey) === promise) {
13330
+ membershipFetchCache.delete(cacheKey);
13331
+ }
13332
+ }, MEMBERSHIP_FETCH_CACHE_TTL_MS);
13333
+ });
13334
+ return promise;
13271
13335
  };
13272
13336
  var fetchRemoteSpace = async (server, token, spaceId) => {
13273
13337
  try {
@@ -14598,7 +14662,7 @@ var fetchSpaceAction = async (input, thunkAPI) => {
14598
14662
  const spaceKey = createSpaceKey.space(spaceId);
14599
14663
  const readSpace = async (dbKey) => {
14600
14664
  try {
14601
- const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-CGSRFJN3.js");
14665
+ const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-5BKDURDL.js");
14602
14666
  if (fresh) {
14603
14667
  return await dispatch(readAndWait2(dbKey)).unwrap();
14604
14668
  }
@@ -15197,6 +15261,16 @@ var selectCurrentSpace = createSelector(
15197
15261
  return getSpaceUpdatedAt2(spaceEntity) > getSpaceUpdatedAt2(space.currentSpace) ? spaceEntity : space.currentSpace;
15198
15262
  }
15199
15263
  );
15264
+ var selectSpaceById = createSelector(
15265
+ [
15266
+ selectEntities,
15267
+ (_state, spaceId) => spaceId
15268
+ ],
15269
+ (entities, spaceId) => {
15270
+ if (!spaceId) return null;
15271
+ return entities[createSpaceKey.space(spaceId)] || null;
15272
+ }
15273
+ );
15200
15274
  var selectAllMemberSpaces = createSelector(
15201
15275
  selectSpaceState,
15202
15276
  (space) => {
@@ -15271,10 +15345,8 @@ var selectViewMode = createSelector(
15271
15345
  var spaceSlice_default = spaceSlice.reducer;
15272
15346
 
15273
15347
  export {
15274
- API_REPORTED_COST_MULTIPLIER,
15275
- normalizeUsage,
15276
- shouldUseServerProxy,
15277
- prepareTokenUsageData,
15348
+ resolveBuiltinPlatformAgentConfig,
15349
+ resolveBuiltinPlatformAgentRecord,
15278
15350
  instance,
15279
15351
  initReactI18next,
15280
15352
  i18nBaseConfig,
@@ -15302,7 +15374,6 @@ export {
15302
15374
  messageStreamEnd,
15303
15375
  addToolMessage,
15304
15376
  updateToolMessage,
15305
- appendOverlayMessage,
15306
15377
  setWorkflow,
15307
15378
  updateStep,
15308
15379
  incrementStepsExecuted,
@@ -15350,6 +15421,7 @@ export {
15350
15421
  appendRecoveredMemberships,
15351
15422
  selectCurrentSpaceId,
15352
15423
  selectCurrentSpace,
15424
+ selectSpaceById,
15353
15425
  selectAllMemberSpaces,
15354
15426
  selectOwnedMemberSpaces,
15355
15427
  selectSpaceLoading,
@@ -15370,6 +15442,9 @@ export {
15370
15442
  selectViewMode,
15371
15443
  spaceSlice_default,
15372
15444
  selectCurrentUserBalance,
15445
+ API_REPORTED_COST_MULTIPLIER,
15446
+ normalizeUsage,
15447
+ prepareTokenUsageData,
15373
15448
  updateTokensAction,
15374
15449
  clearDialogState,
15375
15450
  createPageAndAddReference,
@@ -15384,6 +15459,7 @@ export {
15384
15459
  addDialogAgent,
15385
15460
  removeDialogAgent,
15386
15461
  setPrimaryDialogAgent,
15462
+ switchDialogAgent,
15387
15463
  setDialogExtraReferences,
15388
15464
  selectCurrentDialogConfig,
15389
15465
  selectCurrentDialogAgentIds,