nolo-cli 0.32.0 → 0.33.0-alpha.3

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-LTMSIBS4.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-D3MYZK6E.js → agentDeleteCommand-KU2RXQPP.js} +42 -59
  7. package/{agentEmailCommands-6BXS574I.js → agentEmailCommands-MPCMDENS.js} +89 -80
  8. package/{agentGrantCommands-E7ZZFRHK.js → agentGrantCommands-2LEZDADN.js} +2 -2
  9. package/{agentListCommands-SF3HEUTT.js → agentListCommands-EPD4N6FX.js} +73 -78
  10. package/{agentMachineCommands-YARVXRR6.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-ATGJY6WC.js → agentRuntimeLocal-JX34G47Z.js} +35 -50
  15. package/{agentSlice-4XWW344Y.js → agentSlice-TNMFQQOV.js} +15 -13
  16. package/{appDeleteCommands-63JO7RXS.js → appDeleteCommands-43K5VXQB.js} +38 -55
  17. package/{appDeployCommands-Y7EWYUGM.js → appDeployCommands-FEEJSVDZ.js} +38 -55
  18. package/{appDeployStatusCommands-ZBEY3DWB.js → appDeployStatusCommands-H76CG45R.js} +38 -55
  19. package/{appGetCommands-QSSOSEYL.js → appGetCommands-MDZYFTYZ.js} +38 -55
  20. package/{appListCommands-PH3XWNDX.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-TEYN42N3.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-O3JR45Q2.js → chunk-3VAQHAXT.js} +44 -44
  31. package/{chunk-O5OMJPPF.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-3UGKATZQ.js → chunk-5SBK2MTI.js} +8 -369
  35. package/chunk-6PO2SYCS.js +1800 -0
  36. package/{chunk-TA6EA2A3.js → chunk-6SXC35F4.js} +182 -20
  37. package/{chunk-MXFQHRSS.js → chunk-6XIE5ZGI.js} +1 -1
  38. package/{chunk-3GZT3L6F.js → chunk-73GINUCW.js} +326 -481
  39. package/{chunk-VMWR7VNI.js → chunk-7E72JMBB.js} +7 -7
  40. package/{chunk-4PNU7W7K.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-2ZRP5RUG.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-RH53LMEJ.js → chunk-FSSX3XRY.js} +2 -4
  56. package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
  57. package/{chunk-EEF23OOK.js → chunk-GMXWYXAF.js} +7 -7
  58. package/{chunk-SFWZUTCI.js → chunk-GTYM4HKV.js} +1 -1
  59. package/{chunk-MITD7CON.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-Q76I4SXI.js → chunk-IHEC7VBF.js} +1 -1
  65. package/{chunk-OWHNFZNW.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-2HXKAPH7.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-DLWCWUNW.js → chunk-LOD75GOS.js} +336 -32
  75. package/{chunk-UOJRKY5J.js → chunk-M2YMQOLC.js} +44 -53
  76. package/chunk-M3JEW6N6.js +193 -0
  77. package/{chunk-XDHHF73Q.js → chunk-M4NC7NF6.js} +95 -95
  78. package/{chunk-3FCNXC2J.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-GAF5X6B7.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-RXVX5LFR.js → chunk-VH2F7ZB6.js} +1 -1
  95. package/chunk-VIDPVFP3.js +20 -0
  96. package/{chunk-W367V5CH.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-VVEH6XUE.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-V42OE5HT.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-ODS2MVMU.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-WLRNE7C4.js → createAgentAutomationAction-INQT23LX.js} +40 -31
  113. package/createDialogAction-LDCPDI73.js +60 -0
  114. package/{createPageAction-7YROVZ3W.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-N4HPG6HM.js → dialogSlice-DOWKOILN.js} +36 -29
  120. package/{docCreateCommands-GRA5BHSA.js → docCreateCommands-OVZARUFX.js} +40 -55
  121. package/{docDeleteCommands-ONIJM5MD.js → docDeleteCommands-E2XJ62LD.js} +42 -57
  122. package/{docReadCommands-H55VQ2US.js → docReadCommands-I7OSREPJ.js} +40 -55
  123. package/{docStore-B5AHDNW5.js → docStore-UAWSKZ2Y.js} +39 -30
  124. package/{docUpdateCommands-ZQIQVGC2.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-IN5XX5U7.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-H3UMKE76.js → machineCommands-BUOIYJAD.js} +93 -84
  134. package/{machineWsRunDispatch-HONRUK3R.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-XVJZDCSC.js → readlineWorkspace-ZDWEASJV.js} +265 -428
  141. package/{removeDialogAgentAction-NEKVAMSH.js → removeDialogAgentAction-E7H557UO.js} +19 -17
  142. package/{runAgentClientLoop-H7U53QB6.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-7VVKJBDV.js → spaceCommands-GEWZXGHM.js} +43 -240
  150. package/{spaceSlice-T6YK6D34.js → spaceSlice-B6MOVY4N.js} +38 -61
  151. package/{streamAgentChatTurn-RQ63QFQ7.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-BBDSWHNG.js → updateDialogTitleAction-XPJZRJEL.js} +48 -38
  159. package/agentRecordCommands-JFZRQJQ4.js +0 -103
  160. package/agentRunCommand-NOX5FLKO.js +0 -121
  161. package/chunk-AYMOSAHE.js +0 -3158
  162. package/chunk-D2BPX6DQ.js +0 -1707
  163. package/chunk-DCDL3GC4.js +0 -171
  164. package/chunk-F3MP7CP6.js +0 -73
  165. package/chunk-WZSRQNQG.js +0 -2587
  166. package/createDialogAction-Y6YV64QB.js +0 -52
  167. package/dialogCommands-XLO5CAHZ.js +0 -95
  168. package/tools-KYZX3BGO.js +0 -90
  169. package/{chunk-Z5MXSEOJ.js → chunk-RQSOAMPJ.js} +2 -2
  170. package/{chunk-JDSUTNYY.js → chunk-SAQQLJZ5.js} +3 -3
@@ -1,19 +1,25 @@
1
1
  import {
2
2
  getModelConfig
3
- } from "./chunk-2K4NDPT5.js";
3
+ } from "./chunk-DFUPZE6V.js";
4
4
  import {
5
+ PLATFORM_HOSTED_KIMI_K3_MODEL,
5
6
  isPlatformHostedClaudeModel,
6
- isPlatformHostedGrokModel
7
- } from "./chunk-CAENRKNJ.js";
7
+ isPlatformHostedDeepseekModel,
8
+ isPlatformHostedGeminiModel,
9
+ isPlatformHostedGlmModel,
10
+ isPlatformHostedGrokModel,
11
+ isPlatformHostedKimiK26Model,
12
+ isPlatformHostedQwen37FlashModel
13
+ } from "./chunk-OR2HNLVO.js";
8
14
  import {
9
15
  asTrimmedLowercaseString
10
16
  } from "./chunk-QSJ3HFEF.js";
11
- import {
12
- normalizeServerOrigin
13
- } from "./chunk-CF7PE763.js";
14
17
  import {
15
18
  asTrimmedString
16
19
  } from "./chunk-3EUW3WEO.js";
20
+ import {
21
+ normalizeServerOrigin
22
+ } from "./chunk-CF7PE763.js";
17
23
  import {
18
24
  asOptionalTrimmedString
19
25
  } from "./chunk-G3SUCT4W.js";
@@ -44,30 +50,33 @@ var PLATFORM_CHAT_COMPLETIONS_ENDPOINTS = {
44
50
  qwen: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
45
51
  // Moonshot AI(月之暗面)开放平台 OpenAI 兼容模式(按量计费)
46
52
  moonshot: "https://api.moonshot.cn/v1/chat/completions",
47
- // Non-DeepSeek hosted models use Ollama Cloud. DeepSeek Flash is routed
48
- // separately to the official DeepSeek Responses endpoint.
49
- nolo: "https://ollama.com/v1/chat/completions"
53
+ // 平台托管 Kimi K3 的实际上游
54
+ crof: "https://crof.ai/v1/chat/completions"
55
+ // 无 nolo 默认上游:平台托管模型全部显式分流,未识别模型返回 undefined
50
56
  };
51
57
  function isOpenAiResponsesModel(args) {
52
58
  const provider = asTrimmedLowercaseString(args.provider);
53
- if (provider === "nolo" || provider === "deepseek") {
54
- const model = args.model?.trim().toLowerCase();
55
- return model === "deepseek-v4-flash" || model === "deepseek-v4-pro";
59
+ if (provider === "openai") {
60
+ if (args.endpointKey === "responses") return true;
61
+ if (!args.model) return false;
62
+ try {
63
+ return getModelConfig("openai", args.model).endpointKey === "responses";
64
+ } catch {
65
+ return false;
66
+ }
56
67
  }
57
- if (provider !== "openai") return false;
58
- if (args.endpointKey === "responses") return true;
59
- if (!args.model) return false;
60
- try {
61
- return getModelConfig("openai", args.model).endpointKey === "responses";
62
- } catch {
63
- return false;
68
+ if (provider === "deepseek" || provider === "nolo" || provider === "ollama-cloud") {
69
+ if (isPlatformHostedDeepseekModel(args.model)) return true;
64
70
  }
71
+ return false;
65
72
  }
66
- function resolvePlatformResponsesEndpoint(provider) {
73
+ function resolvePlatformResponsesEndpoint(provider, model) {
67
74
  const normalized = asTrimmedLowercaseString(provider);
68
75
  if (normalized === "openai") return OPENAI_RESPONSES_ENDPOINT;
69
- if (normalized === "nolo" || normalized === "deepseek") {
70
- return DEEPSEEK_RESPONSES_ENDPOINT;
76
+ if (normalized === "deepseek" || normalized === "nolo" || normalized === "ollama-cloud") {
77
+ if (!model || isPlatformHostedDeepseekModel(model)) {
78
+ return DEEPSEEK_RESPONSES_ENDPOINT;
79
+ }
71
80
  }
72
81
  return void 0;
73
82
  }
@@ -85,13 +94,28 @@ function resolvePlatformChatCompletionsEndpoint(provider, model) {
85
94
  if (aliased === "nolo" && isPlatformHostedGrokModel(model)) {
86
95
  return XAI_CHAT_COMPLETIONS_ENDPOINT;
87
96
  }
97
+ if (aliased === "nolo" && (isPlatformHostedKimiK26Model(model) || isPlatformHostedGlmModel(model))) {
98
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.openrouter;
99
+ }
100
+ if (aliased === "nolo" && asTrimmedLowercaseString(model) === PLATFORM_HOSTED_KIMI_K3_MODEL) {
101
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.crof;
102
+ }
103
+ if (aliased === "nolo" && (isPlatformHostedGeminiModel(model) || isPlatformHostedQwen37FlashModel(model))) {
104
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.google;
105
+ }
106
+ if (aliased === "nolo" && isPlatformHostedDeepseekModel(model)) {
107
+ return void 0;
108
+ }
109
+ if (aliased === "nolo") {
110
+ return void 0;
111
+ }
88
112
  return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS[aliased];
89
113
  }
90
114
 
91
115
  // packages/agent-runtime/providerResolution.ts
92
116
  function resolvePlatformProviderEndpoint(agentConfig) {
93
117
  const customProviderUrl = agentConfig.customProviderUrl?.trim();
94
- if (customProviderUrl) return resolveChatCompletionsEndpoint(customProviderUrl);
118
+ if (customProviderUrl) return resolveCustomProviderEndpoint(customProviderUrl);
95
119
  const provider = asTrimmedLowercaseString(
96
120
  agentConfig.provider ?? agentConfig.apiSource ?? "openai"
97
121
  );
@@ -132,6 +156,14 @@ function resolveChatCompletionsEndpoint(value) {
132
156
  const trimmed = trimTrailingSlash(value);
133
157
  return trimmed.endsWith("/chat/completions") ? trimmed : `${trimmed}/chat/completions`;
134
158
  }
159
+ function resolveCustomProviderEndpoint(value) {
160
+ const trimmed = trimTrailingSlash(value);
161
+ if (!trimmed) return "";
162
+ if (/\/responses$/i.test(trimmed) || /\/chat\/completions$/i.test(trimmed)) {
163
+ return trimmed;
164
+ }
165
+ return `${trimmed}/chat/completions`;
166
+ }
135
167
  function resolveOpenAiCompatibleBaseUrl(env) {
136
168
  return env.NOLO_LOCAL_OPENAI_BASE_URL || env.OPENAI_BASE_URL || "https://api.openai.com/v1";
137
169
  }
@@ -232,7 +264,7 @@ async function buildProviderExecutionPlan(args) {
232
264
  };
233
265
  }
234
266
  if (mode === "custom") {
235
- const endpoint2 = resolveChatCompletionsEndpoint(agentConfig.customProviderUrl || resolveOpenAiCompatibleBaseUrl(env));
267
+ const endpoint2 = resolveCustomProviderEndpoint(agentConfig.customProviderUrl || resolveOpenAiCompatibleBaseUrl(env));
236
268
  let apiKey2 = "";
237
269
  const credentialRef2 = agentConfig.credentialRef?.trim();
238
270
  const apiKeyRef = agentConfig.apiKeyRef?.trim();
@@ -263,6 +295,20 @@ async function buildProviderExecutionPlan(args) {
263
295
  apiKey2 = trimmed;
264
296
  }
265
297
  }
298
+ if (!apiKey2 && apiKeyRef && apiKeyRef.startsWith("provider-key:") && args.syncFetcher) {
299
+ try {
300
+ const shared = await args.syncFetcher(apiKeyRef);
301
+ const trimmed = asTrimmedString(shared);
302
+ if (trimmed) {
303
+ try {
304
+ await args.credentialBroker?.put(apiKeyRef, trimmed);
305
+ } catch {
306
+ }
307
+ apiKey2 = trimmed;
308
+ }
309
+ } catch {
310
+ }
311
+ }
266
312
  if (!apiKey2 && apiKeyRef && args.apiKeyRefResolver) {
267
313
  const resolved = await args.apiKeyRefResolver(apiKeyRef);
268
314
  if (resolved) {
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-DWLEOOGR.js";
4
4
  import {
5
5
  addContentAction
6
- } from "./chunk-V54H24CQ.js";
6
+ } from "./chunk-JTSGWTYZ.js";
7
7
  import {
8
8
  upload
9
- } from "./chunk-LAXMH7JY.js";
9
+ } from "./chunk-57QJXIB6.js";
10
10
  import {
11
11
  getRuntimeServerContext
12
- } from "./chunk-2IJAKBK2.js";
12
+ } from "./chunk-X664KVEV.js";
13
13
  import {
14
14
  API_ENDPOINTS
15
15
  } from "./chunk-LCBAMY2M.js";
@@ -25,30 +25,6 @@ var estimateTokenCount = (text) => {
25
25
  return Math.ceil(chineseChars * 1.5 + otherChars * 0.25);
26
26
  };
27
27
 
28
- // packages/chat/dialog/actions/builtinDialogLlm.ts
29
- var BASE_BUILTIN_DIALOG_LLM_CONFIG = {
30
- apiSource: "platform",
31
- useServerProxy: true
32
- };
33
- var BUILTIN_TITLE_LLM_CONFIG = {
34
- ...BASE_BUILTIN_DIALOG_LLM_CONFIG,
35
- provider: "nolo",
36
- id: "builtin-dialog-title-llm",
37
- name: "Builtin Dialog Title LLM",
38
- model: "deepseek-v4-flash",
39
- prompt: "You are a title generator for chat history. \u4F60\u53EA\u505A\u4E00\u4EF6\u4E8B\uFF1A\u6839\u636E\u5BF9\u8BDD\u5185\u5BB9\u8F93\u51FA\u6700\u7EC8\u6807\u9898\u3002\u786C\u6027\u89C4\u5219\uFF1A1) \u53EA\u8F93\u51FA\u6807\u9898\u8FD9\u4E00\u884C\uFF1B\u4E25\u7981\u8F93\u51FA\u63A8\u7406\u3001\u5206\u6790\u3001\u6B65\u9AA4\u3001\u89E3\u91CA\u3001\u524D\u8A00\u3001\u540E\u8BB0\u3001\u7FFB\u8BD1\u3001\u81F4\u6B49\u6216\u4EFB\u4F55\u989D\u5916\u8BF4\u660E\u30022) \u4E0D\u8981\u56DE\u7B54\u7528\u6237\u8BF7\u6C42\uFF0C\u4E0D\u8981\u5199\u6458\u8981\uFF0C\u53EA\u7ED9\u6807\u9898\u7ED3\u679C\u30023) \u6807\u9898\u5C3D\u91CF\u77ED\uFF1A\u901A\u5E38 2-5 \u4E2A\u8BCD\uFF0C\u82F1\u6587\u4E0D\u8D85\u8FC7 6 \u4E2A\u8BCD\u30024) \u4F7F\u7528\u5BF9\u8BDD\u4E3B\u8BED\u8A00\uFF1B\u6DF7\u5408\u8BED\u8A00\u65F6\u4F18\u5148\u7528\u6237\u4E3B\u8981\u8BED\u8A00\u30025) \u4F18\u5148\u590D\u7528\u5BF9\u8BDD\u4E2D\u7684\u5177\u4F53\u4E3B\u9898\u8BCD\uFF0C\u907F\u514D issue\u3001help\u3001discussion\u3001analysis\u3001update \u8FD9\u7C7B\u7A7A\u6CDB\u8BCD\u30026) \u5FFD\u7565 tool JSON\u3001\u51FD\u6570\u540D\u3001branch label\u3001agent \u540D\u3001\u7CFB\u7EDF\u6307\u4EE4\u548C\u7F16\u6392\u75D5\u8FF9\uFF08\u5982 GPT\u3001Claude\u3001Gemini\uFF09\uFF1B\u6807\u9898\u8981\u843D\u5728\u7528\u6237\u771F\u6B63\u8BA8\u8BBA\u7684\u5BF9\u8C61\u6216\u51B3\u7B56\u4E0A\u30027) \u66F4\u504F\u597D\u201C\u5BF9\u8C61 + \u52A8\u4F5C/\u5224\u65AD\u201D\u7684\u77ED\u6807\u9898\uFF0C\u4F8B\u5982\u201CAI \u90AE\u4EF6\u52A9\u624B\u53D6\u820D\u201D\u201C\u4E1C\u4EAC\u56DB\u65E5\u6162\u65C5\u884C\u201D\u201C\u91CD\u590D\u6263\u8D39\u9000\u6B3E\u201D\u30028) \u7EAF\u6587\u672C\uFF0C\u4E0D\u8981\u9879\u76EE\u7B26\u53F7\u3001\u7F16\u53F7\u3001markdown\u3001emoji\u3002\u6700\u7EC8\u53EA\u8FD4\u56DE\u6807\u9898\u6587\u672C\u3002 Output only the title text."
40
- };
41
- var BUILTIN_SUMMARY_LLM_CONFIG = {
42
- ...BASE_BUILTIN_DIALOG_LLM_CONFIG,
43
- provider: "nolo",
44
- id: "builtin-dialog-summary-llm",
45
- name: "Builtin Dialog Summary LLM",
46
- model: "deepseek-v4-flash",
47
- // @deprecated 用 COMPACTION_SUMMARY_SYSTEM_PROMPT(packages/ai/context/compactionShared.ts)。
48
- // 生产代码已全部迁移;此旧两段式 prompt 仅被 scripts/probes/dialog 探针脚本使用,待探针迁移后删除。
49
- prompt: "\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684\u5BF9\u8BDD\u8BB0\u5FC6\u52A9\u7406\u3002\u8BF7\u57FA\u4E8E\u3010\u73B0\u6709\u8BB0\u5FC6\u3011\u548C\u3010\u65B0\u589E\u5BF9\u8BDD\u3011\uFF0C\u8F93\u51FA\u4E00\u4EFD\u66F4\u65B0\u540E\u7684\u5BF9\u8BDD\u8BB0\u5FC6\u6863\u6848\u3002\u4E25\u683C\u53EA\u8F93\u51FA\u4E0B\u9762\u4E24\u90E8\u5206\uFF0C\u6807\u9898\u5FC5\u987B\u5B8C\u5168\u4E00\u81F4\uFF1A\n\u5173\u952E\u4E8B\u5B9E\u6863\u6848\n- ...\n\u5BF9\u8BDD\u5267\u60C5\u6458\u8981\n- ...\n\u8981\u6C42\uFF1A1) \u4F7F\u7528\u5BF9\u8BDD\u4E3B\u8BED\u8A00\uFF1B\u6DF7\u5408\u8BED\u8A00\u65F6\u4F18\u5148\u8DDF\u968F\u7528\u6237\u4E3B\u8981\u8BED\u8A00\uFF0C\u4E13\u6709\u540D\u8BCD\u4FDD\u7559\u539F\u6587\u30022) \u5173\u952E\u4E8B\u5B9E\u6863\u6848\u53EA\u4FDD\u7559\u4E4B\u540E\u7EE7\u7EED\u5BF9\u8BDD\u4ECD\u6709\u4EF7\u503C\u7684\u4FE1\u606F\uFF0C\u4F8B\u5982\u7528\u6237\u504F\u597D\u3001\u76EE\u6807\u3001\u7EA6\u675F\u3001\u6280\u672F\u6808\u3001\u786E\u5B9A\u7684\u6587\u4EF6\u540D/\u53D8\u91CF\u540D\u3001\u6838\u5FC3\u51B3\u7B56\u3001\u5F85\u529E\u4E8B\u9879\u30023) \u5BF9\u8BDD\u5267\u60C5\u6458\u8981\u5148\u6781\u7B80\u6982\u62EC\u65E7\u4E0A\u4E0B\u6587\uFF0C\u518D\u66F4\u8BE6\u7EC6\u8BB0\u5F55\u6700\u8FD1\u65B0\u589E\u7684\u8FDB\u5C55\u3001\u5206\u6B67\u3001\u7ED3\u8BBA\u548C\u4E0B\u4E00\u6B65\u30024) \u5FFD\u7565\u5BD2\u6684\u3001\u91CD\u590D\u5C1D\u8BD5\u3001\u5DF2\u653E\u5F03\u65B9\u6848\u548C\u65E0\u4EF7\u503C\u5E9F\u8BDD\u30025) \u4E0D\u8981\u7F16\u9020\u672A\u51FA\u73B0\u7684\u4FE1\u606F\uFF0C\u4E0D\u8981\u8F93\u51FA\u5F00\u573A\u767D\u3001\u7ED3\u675F\u8BED\u3001markdown \u4EE3\u7801\u5757\u6216\u989D\u5916\u7AE0\u8282\u3002"
50
- };
51
-
52
28
  // packages/core/chat/messageContentSerialize.ts
53
29
  var serializeMessageContent = (content, imagePlaceholder = "[\u56FE\u7247]") => {
54
30
  if (typeof content === "string") {
@@ -685,13 +661,11 @@ function clipCompactText(value, max, ellipsis = "...") {
685
661
 
686
662
  export {
687
663
  clipCompactText,
664
+ planContextUsage,
688
665
  estimateTokenCount,
689
666
  buildDatabaseFileContentUrl,
690
- BUILTIN_TITLE_LLM_CONFIG,
691
- BUILTIN_SUMMARY_LLM_CONFIG,
692
667
  serializeMessageContent,
693
668
  normalizeAssistantContentBuffer,
694
- planContextUsage,
695
669
  planCompression,
696
670
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
697
671
  buildCompactionUserContent,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-GAF5X6B7.js";
5
- import {
6
- runLocalAgentTurn
7
- } from "./chunk-AYMOSAHE.js";
4
+ } from "./chunk-O6GEBMIY.js";
8
5
  import {
9
6
  clipMultilineText
10
- } from "./chunk-D2BPX6DQ.js";
7
+ } from "./chunk-HDKRSRYU.js";
8
+ import {
9
+ runLocalAgentTurn
10
+ } from "./chunk-6PO2SYCS.js";
11
11
  import {
12
12
  resolveLocalRuntimeEnvFromPolicy
13
- } from "./chunk-ODS2MVMU.js";
13
+ } from "./chunk-5CS33IBL.js";
14
14
  import {
15
15
  toErrorMessage
16
16
  } from "./chunk-HNMXYYJR.js";
@@ -28,20 +28,20 @@ import {
28
28
  asRecordOrEmpty
29
29
  } from "./chunk-KX6YBIHG.js";
30
30
  import {
31
- ownedAgentKey
32
- } from "./chunk-TOW4E763.js";
31
+ asTrimmedNonEmptyStringArray
32
+ } from "./chunk-I42VC5KR.js";
33
33
  import {
34
34
  asTrimmedString
35
35
  } from "./chunk-3EUW3WEO.js";
36
36
  import {
37
37
  asOptionalPositiveFiniteNumber
38
38
  } from "./chunk-U6VC4MU4.js";
39
+ import {
40
+ ownedAgentKey
41
+ } from "./chunk-BJIRLHJR.js";
39
42
  import {
40
43
  isRecord
41
44
  } from "./chunk-KUG52IAP.js";
42
- import {
43
- asTrimmedNonEmptyStringArray
44
- } from "./chunk-I42VC5KR.js";
45
45
  import {
46
46
  asOptionalTrimmedString
47
47
  } from "./chunk-G3SUCT4W.js";
@@ -510,6 +510,7 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
510
510
  const continueDialogIdRaw = readField(payload, "continueDialogId");
511
511
  const result = await runLocalAgentTurn({
512
512
  adapter,
513
+ userLanguage: args.runtimeEnv.NOLO_LANG ?? null,
513
514
  agentRef: agentKey,
514
515
  input: typeof userInputRaw === "string" ? userInputRaw : "",
515
516
  continueDialogId: typeof continueDialogIdRaw === "string" ? continueDialogIdRaw : void 0,
@@ -1,15 +1,15 @@
1
+ import {
2
+ getActiveDialogKey
3
+ } from "./chunk-MRWGHF56.js";
1
4
  import {
2
5
  compactWhitespace
3
6
  } from "./chunk-DWLEOOGR.js";
4
- import {
5
- getActiveDialogKey
6
- } from "./chunk-3ASDTTEI.js";
7
7
  import {
8
8
  asTrimmedLowercaseString
9
9
  } from "./chunk-QSJ3HFEF.js";
10
10
  import {
11
11
  extractCustomId
12
- } from "./chunk-TOW4E763.js";
12
+ } from "./chunk-BJIRLHJR.js";
13
13
  import {
14
14
  isRecord
15
15
  } from "./chunk-KUG52IAP.js";
@@ -25,6 +25,7 @@ var extractCustomId = (key) => {
25
25
  };
26
26
  var PUBLIC_AGENT_KEY_PREFIX = "agent-pub-";
27
27
  var publicAgentKey = (id) => `${PUBLIC_AGENT_KEY_PREFIX}${id}`;
28
+ var parsePublicAgentId = (key) => key.startsWith(PUBLIC_AGENT_KEY_PREFIX) ? key.slice(PUBLIC_AGENT_KEY_PREFIX.length) : null;
28
29
  var ownedAgentKeyPrefix = (userId) => `agent-${userId}-`;
29
30
  var ownedAgentKey = (userId, id) => id.startsWith(ownedAgentKeyPrefix(userId)) ? id : `${ownedAgentKeyPrefix(userId)}${id}`;
30
31
  var isOwnedAgentKey = (key, userId) => typeof key === "string" && key.startsWith(ownedAgentKeyPrefix(userId));
@@ -35,6 +36,7 @@ export {
35
36
  extractCustomId,
36
37
  PUBLIC_AGENT_KEY_PREFIX,
37
38
  publicAgentKey,
39
+ parsePublicAgentId,
38
40
  ownedAgentKey,
39
41
  isOwnedAgentKey,
40
42
  parseOwnedAgentId
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getRuntimeServerContext,
3
3
  scheduleDeleteReplication
4
- } from "./chunk-2IJAKBK2.js";
4
+ } from "./chunk-X664KVEV.js";
5
5
  import {
6
6
  fetchFromClientDb
7
- } from "./chunk-5RDLGLAP.js";
7
+ } from "./chunk-WJSW43QZ.js";
8
8
  import {
9
9
  buildTombstoneRecord
10
10
  } from "./chunk-GBRG75BQ.js";
@@ -1,19 +1,30 @@
1
+ import {
2
+ parsePositiveFiniteNumberOrFallback
3
+ } from "./chunk-Y5GCAMGP.js";
1
4
  import {
2
5
  asRecordOrEmpty
3
6
  } from "./chunk-KX6YBIHG.js";
7
+ import {
8
+ DEFAULT_SYSTEM_AGENT_CAPABILITIES
9
+ } from "./chunk-UZ6XXCVR.js";
4
10
  import {
5
11
  patch,
6
12
  readAndWait,
7
13
  toTimestampMs,
8
14
  upsert,
9
15
  write
10
- } from "./chunk-LAXMH7JY.js";
16
+ } from "./chunk-57QJXIB6.js";
17
+ import {
18
+ createUserKey,
19
+ createUserPreferenceKey,
20
+ ulid
21
+ } from "./chunk-KMSZPTM6.js";
11
22
  import {
12
23
  asTrimmedLowercaseString
13
24
  } from "./chunk-QSJ3HFEF.js";
14
25
  import {
15
26
  BUILTIN_NOLO_AGENT_KEY
16
- } from "./chunk-ZJH3LKEW.js";
27
+ } from "./chunk-UK5JGQVU.js";
17
28
  import {
18
29
  asyncThunkCreator,
19
30
  buildCreateSlice,
@@ -21,12 +32,12 @@ import {
21
32
  createAsyncThunk,
22
33
  createSelector,
23
34
  selectIdentityUserId
24
- } from "./chunk-2IJAKBK2.js";
35
+ } from "./chunk-X664KVEV.js";
25
36
  import {
26
37
  getAllServers,
27
38
  getIsDesktopApp,
28
39
  isProduction
29
- } from "./chunk-5RDLGLAP.js";
40
+ } from "./chunk-WJSW43QZ.js";
30
41
  import {
31
42
  SERVERS
32
43
  } from "./chunk-LCBAMY2M.js";
@@ -36,14 +47,6 @@ import {
36
47
  import {
37
48
  normalizeServerOrigin
38
49
  } from "./chunk-CF7PE763.js";
39
- import {
40
- createUserKey,
41
- createUserPreferenceKey,
42
- ulid
43
- } from "./chunk-WHLVPK32.js";
44
- import {
45
- DEFAULT_SYSTEM_AGENT_CAPABILITIES
46
- } from "./chunk-UZ6XXCVR.js";
47
50
 
48
51
  // packages/ai/policy/types.ts
49
52
  var DEFAULT_AGENT_BASE_POLICY = {
@@ -1313,12 +1316,6 @@ var selectRemoteServers = createSelector(
1313
1316
  (currentServer, syncServers) => getAllServers(currentServer, syncServers)
1314
1317
  );
1315
1318
 
1316
- // packages/core/positiveFiniteNumberOrFallback.ts
1317
- function parsePositiveFiniteNumberOrFallback(value, fallback) {
1318
- const parsed = Number(value);
1319
- return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
1320
- }
1321
-
1322
1319
  // packages/app/settings/fieldSelectors.ts
1323
1320
  var selectPreferredAnimationSet = (state) => state.settings.preferredAnimationSet ?? 0;
1324
1321
  var selectShowThinking = (state) => state.settings.showThinking;
@@ -2013,7 +2010,6 @@ export {
2013
2010
  selectRemoteServer,
2014
2011
  selectRemoteSyncServers,
2015
2012
  selectRemoteServers,
2016
- parsePositiveFiniteNumberOrFallback,
2017
2013
  selectPreferredAnimationSet,
2018
2014
  selectShowThinking,
2019
2015
  selectMaxCost,
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  GMI_CHAT_COMPLETIONS_URL,
3
- PLATFORM_HOSTED_CHAT_COMPLETIONS_URL,
4
- PLATFORM_HOSTED_KIMI_K26_MODEL,
3
+ PLATFORM_HOSTED_DEEPSEEK_FLASH_VISION_EXP_MODEL,
5
4
  PLATFORM_HOSTED_KIMI_PROVIDER,
6
5
  cloudflareModels,
7
6
  deepinfraModels,
@@ -14,7 +13,7 @@ import {
14
13
  platformHostedModels,
15
14
  xaiModels,
16
15
  zaiModels
17
- } from "./chunk-CAENRKNJ.js";
16
+ } from "./chunk-OR2HNLVO.js";
18
17
 
19
18
  // packages/integrations/anthropic/anthropicModels.ts
20
19
  var anthropicModels = [
@@ -1207,6 +1206,7 @@ var referenceItemSchema = pipe(
1207
1206
  // packages/ai/llm/reasoningModels.ts
1208
1207
  var REASONING_MODEL_NAMES = /* @__PURE__ */ new Set([
1209
1208
  "deepseek-v4-flash",
1209
+ "deepseek-v4-flash-vision-exp",
1210
1210
  "deepseek-v4-pro",
1211
1211
  "gemini-3.7-flash",
1212
1212
  "gemini-3.6-flash",
@@ -1219,6 +1219,7 @@ var REASONING_MODEL_NAMES = /* @__PURE__ */ new Set([
1219
1219
  "gpt-5.6-sol",
1220
1220
  "gpt-5.6-terra",
1221
1221
  "gpt-5.6-luna",
1222
+ "glm-5.3",
1222
1223
  "glm-5.2",
1223
1224
  "kimi-k3",
1224
1225
  // Legacy OpenAI catalog ids — still support reasoning UI for agents that
@@ -1316,10 +1317,13 @@ var ANTHROPIC_MODEL_ALIASES = {
1316
1317
  "claude-sonnet-4.6": "claude-3-7-sonnet-latest",
1317
1318
  "claude-sonnet-4.5": "claude-3-5-sonnet-latest"
1318
1319
  };
1320
+ var NOLO_MODEL_ALIASES = {
1321
+ "glm-5.2": "glm-5.3"
1322
+ };
1319
1323
  var normalizeLookupProvider = (provider) => {
1320
1324
  if (!provider) return null;
1321
1325
  const normalized = provider.toLowerCase();
1322
- if (normalized === "ollama-cloud") {
1326
+ if (normalized === "ollama-cloud" || normalized === "deepseek") {
1323
1327
  return "nolo";
1324
1328
  }
1325
1329
  if (normalized in MODEL_LOOKUP_MAP) {
@@ -1331,6 +1335,9 @@ var normalizeLookupModelName = (provider, name) => {
1331
1335
  if (provider === "anthropic") {
1332
1336
  return ANTHROPIC_MODEL_ALIASES[name] ?? name;
1333
1337
  }
1338
+ if (provider === "nolo") {
1339
+ return NOLO_MODEL_ALIASES[name] ?? name;
1340
+ }
1334
1341
  return name;
1335
1342
  };
1336
1343
  var toModel = (candidate) => ({
@@ -1339,6 +1346,8 @@ var toModel = (candidate) => ({
1339
1346
  hasVision: typeof candidate.hasVision === "boolean" ? candidate.hasVision : !!candidate.supportVision,
1340
1347
  contextWindow: candidate.contextWindow,
1341
1348
  price: candidate.price ?? candidate.pricing ?? { input: 0, output: 0 },
1349
+ peakPrice: candidate.peakPrice,
1350
+ offPeakPrice: candidate.offPeakPrice,
1342
1351
  pricingStrategy: candidate.pricingStrategy,
1343
1352
  serviceTierPriceMultipliers: candidate.serviceTierPriceMultipliers,
1344
1353
  maxOutputTokens: candidate.maxOutputTokens ?? candidate.maxTokens,
@@ -1413,13 +1422,9 @@ var API_ENDPOINTS = {
1413
1422
  fireworks: {
1414
1423
  default: "https://api.fireworks.ai/inference/v1/chat/completions"
1415
1424
  },
1416
- nolo: {
1417
- default: PLATFORM_HOSTED_CHAT_COMPLETIONS_URL
1418
- },
1419
- // Legacy agent records may still store provider=ollama-cloud
1420
- "ollama-cloud": {
1421
- default: PLATFORM_HOSTED_CHAT_COMPLETIONS_URL
1422
- },
1425
+ /* 平台托管 provider(nolo / legacy ollama-cloud / deepseek)不放本地默认端点:
1426
+ * 直连语义已移除(历史 ollama.com 兜底废弃),端点由服务端按模型决议;
1427
+ * getApiEndpoint 对它们直接返回 ""。 */
1423
1428
  cloudflare: {
1424
1429
  default: "__cloudflare_workers_ai_chat_completions__"
1425
1430
  },
@@ -1452,7 +1457,7 @@ function getProviderByModelName(modelName) {
1452
1457
  }
1453
1458
  var DEFAULT_MODEL = {
1454
1459
  provider: PLATFORM_HOSTED_KIMI_PROVIDER,
1455
- name: PLATFORM_HOSTED_KIMI_K26_MODEL
1460
+ name: PLATFORM_HOSTED_DEEPSEEK_FLASH_VISION_EXP_MODEL
1456
1461
  };
1457
1462
  function getApiEndpoint(agent) {
1458
1463
  const { provider, customProviderUrl, endpointKey, model } = agent;
@@ -1477,6 +1482,9 @@ function getApiEndpoint(agent) {
1477
1482
  "claude",
1478
1483
  "cursor"
1479
1484
  ]);
1485
+ if (effectiveProvider === "nolo" || effectiveProvider === "ollama-cloud" || effectiveProvider === "deepseek") {
1486
+ return "";
1487
+ }
1480
1488
  if (!effectiveProvider || effectiveProvider.toLowerCase() === "custom" || agent.apiSource === "custom") {
1481
1489
  if (agent.useServerProxy) {
1482
1490
  return "";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-UDA3ZYLW.js";
3
+ } from "./chunk-AFV4FOT2.js";
4
4
  import {
5
5
  toErrorMessage
6
6
  } from "./chunk-HNMXYYJR.js";
7
- import {
8
- asTrimmedLowercaseString
9
- } from "./chunk-QSJ3HFEF.js";
10
7
  import {
11
8
  asOptionalFiniteNumber
12
9
  } from "./chunk-WWC7I6TA.js";
10
+ import {
11
+ asTrimmedLowercaseString
12
+ } from "./chunk-QSJ3HFEF.js";
13
13
  import {
14
14
  asOptionalTrimmedString
15
15
  } from "./chunk-G3SUCT4W.js";
@@ -0,0 +1,91 @@
1
+ import {
2
+ dialogMessageKey
3
+ } from "./chunk-KMSZPTM6.js";
4
+ import {
5
+ asOptionalFiniteNumber
6
+ } from "./chunk-WWC7I6TA.js";
7
+ import {
8
+ asOptionalTrimmedString
9
+ } from "./chunk-G3SUCT4W.js";
10
+
11
+ // packages/core/chat/dialogAttachmentCleanup.ts
12
+ var FILE_CONTENT_RE = /(?:https?:\/\/[^/"'\s]+)?\/api\/v1\/db\/file\/content\/([^?#"'\s)]+)/g;
13
+ function extractFileContentIds(value) {
14
+ const ids = /* @__PURE__ */ new Set();
15
+ const visit = (input) => {
16
+ if (typeof input === "string") {
17
+ for (const match of input.matchAll(FILE_CONTENT_RE)) {
18
+ const fileId = decodeURIComponent(match[1] ?? "").trim();
19
+ if (fileId) ids.add(fileId);
20
+ }
21
+ return;
22
+ }
23
+ if (Array.isArray(input)) {
24
+ for (const item of input) visit(item);
25
+ return;
26
+ }
27
+ if (input && typeof input === "object") {
28
+ for (const item of Object.values(input)) visit(item);
29
+ }
30
+ };
31
+ visit(value);
32
+ return [...ids];
33
+ }
34
+ function messageDbKey(dialogId, message) {
35
+ const dbKey = asOptionalTrimmedString(message.dbKey);
36
+ if (dbKey) return dbKey;
37
+ const id = asOptionalTrimmedString(message.id);
38
+ if (id) return dialogMessageKey(dialogId, id);
39
+ return null;
40
+ }
41
+ function asText(value) {
42
+ return asOptionalTrimmedString(value) ?? null;
43
+ }
44
+ function buildDialogAttachmentPlan(args) {
45
+ const messageKeys = new Set(
46
+ args.messages.map((message) => messageDbKey(args.dialogId, message)).filter((key) => Boolean(key))
47
+ );
48
+ const referencedFileIds = [
49
+ ...new Set(args.messages.flatMap((message) => extractFileContentIds(message)))
50
+ ];
51
+ const candidates = referencedFileIds.map((fileId) => {
52
+ const metadata = args.metadataByFileId[fileId];
53
+ const ownerType = asText(metadata?.ownerType);
54
+ const ownerId = asText(metadata?.ownerId);
55
+ const ownerDbKey = asText(metadata?.ownerDbKey);
56
+ const fileDbKey = asText(metadata?.dbKey);
57
+ const source = asText(metadata?.source);
58
+ const ownedByDialog = ownerType === "dialog" && ownerId === args.dialogId;
59
+ const ownedByMessage = Boolean(ownerDbKey && messageKeys.has(ownerDbKey));
60
+ const userOwnedReferenced = args.includeUserOwnedReferenced === true && Boolean(args.ownerId) && ownerType === "user" && ownerId === args.ownerId;
61
+ const canDelete = Boolean(fileDbKey && (ownedByDialog || ownedByMessage || userOwnedReferenced));
62
+ return {
63
+ fileId,
64
+ fileDbKey,
65
+ size: asOptionalFiniteNumber(metadata?.size) ?? null,
66
+ ownerType,
67
+ ownerId,
68
+ ownerDbKey,
69
+ source,
70
+ status: canDelete ? "delete" : "retain",
71
+ 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"
72
+ };
73
+ });
74
+ const deleteCandidates = candidates.filter((candidate) => candidate.status === "delete");
75
+ const retainedCandidates = candidates.filter((candidate) => candidate.status === "retain");
76
+ return {
77
+ dialogId: args.dialogId,
78
+ messageCount: args.messages.length,
79
+ referencedFileIds,
80
+ candidates,
81
+ deleteCandidates,
82
+ retainedCandidates,
83
+ bytesToDelete: deleteCandidates.reduce((sum, candidate) => sum + (candidate.size ?? 0), 0),
84
+ metadataReadFailures: args.metadataReadFailures ?? []
85
+ };
86
+ }
87
+
88
+ export {
89
+ extractFileContentIds,
90
+ buildDialogAttachmentPlan
91
+ };
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  ownedAgentKey,
6
6
  publicAgentKey
7
- } from "./chunk-TOW4E763.js";
7
+ } from "./chunk-BJIRLHJR.js";
8
8
 
9
9
  // packages/cli/agentAliases.ts
10
10
  var CURRENT_OPERATOR_USER_ID = "0e95801d90";