nolo-cli 0.16.0-alpha.2 → 0.16.0-alpha.21

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 (136) hide show
  1. package/{_executeModel-QAUS6B7J.js → _executeModel-GRCQXT5R.js} +51 -45
  2. package/{action-GUOZYYGN.js → action-LT7BRFLK.js} +10 -9
  3. package/{addContentAction-QDGHGUBH.js → addContentAction-PL3KKBDH.js} +9 -8
  4. package/{addDialogAgentAction-Z4YCYZIV.js → addDialogAgentAction-FCMSKYAF.js} +8 -7
  5. package/{agentDeleteCommand-365DMKHW.js → agentDeleteCommand-WNL3CNQX.js} +32 -29
  6. package/{agentEmailCommands-TQMXL36I.js → agentEmailCommands-MPEUMRAS.js} +63 -57
  7. package/{agentListCommands-6B5X4RC6.js → agentListCommands-YO4AOQMS.js} +31 -28
  8. package/{agentMachineCommands-LOEARB6V.js → agentMachineCommands-WYM6YRYJ.js} +30 -27
  9. package/{agentPullCommand-6HWUT3SW.js → agentPullCommand-ZZGU5KOY.js} +4 -4
  10. package/agentRecordCommands-BVWSHMIY.js +105 -0
  11. package/{agentRunCommand-SGMH67WT.js → agentRunCommand-E3ZI6RSF.js} +64 -55
  12. package/{agentRunControl-6ADXVYMR.js → agentRunControl-Y5AFH5PQ.js} +24 -1
  13. package/{agentRuntimeLocal-YSYZ33ER.js → agentRuntimeLocal-P4VGX6H6.js} +26 -25
  14. package/{agentSlice-IVE735EV.js → agentSlice-D33GU3JL.js} +9 -8
  15. package/{appDeleteCommands-6QYOO3JB.js → appDeleteCommands-VA4R2SWX.js} +29 -26
  16. package/{appDeployCommands-WTCT6XO6.js → appDeployCommands-JWMWQNG6.js} +29 -26
  17. package/{appDeployStatusCommands-CGWGZJKB.js → appDeployStatusCommands-KYXGLZSQ.js} +29 -26
  18. package/{appGetCommands-O4OCAMRW.js → appGetCommands-ELOO3JG6.js} +29 -26
  19. package/{appListCommands-UENFP4XY.js → appListCommands-SJUW4RLW.js} +29 -26
  20. package/{authCommand-YFTR3347.js → authCommand-WJZPOLSS.js} +16 -9
  21. package/{authCommands-YXGOXNBZ.js → authCommands-XTBV7OFZ.js} +6 -5
  22. package/{chunk-RKM3K52F.js → chunk-34WPV75U.js} +23 -2
  23. package/{chunk-VPTJB4HM.js → chunk-3ND52WIL.js} +2 -5
  24. package/{chunk-SOTZ6RDN.js → chunk-3Q7WHGCB.js} +1 -1
  25. package/{chunk-KKY4B2Q2.js → chunk-4PWB7JRR.js} +4 -1
  26. package/{chunk-U7LEGLEB.js → chunk-4T5F7YZQ.js} +1 -1
  27. package/{chunk-OQMPU2ML.js → chunk-5PGGCJGV.js} +6 -6
  28. package/chunk-7BUYEZ6U.js +671 -0
  29. package/{chunk-AS3ZQ3O2.js → chunk-7OBMZCRD.js} +1 -1
  30. package/{chunk-WA6KZL5V.js → chunk-AAODAAUQ.js} +23 -20
  31. package/{chunk-GRTFNYLR.js → chunk-AKVLLMOU.js} +3 -3
  32. package/{chunk-QLUFR47U.js → chunk-AL2V7U3E.js} +1 -1
  33. package/{chunk-MTU75CZ2.js → chunk-B5TOXZAK.js} +1 -1
  34. package/{chunk-QZVGMD5F.js → chunk-BE2GNT5E.js} +2 -8
  35. package/{chunk-JKWWVF2I.js → chunk-D3HVJJIA.js} +1 -1
  36. package/{chunk-B4KT7RN2.js → chunk-DKZFOK24.js} +18 -89
  37. package/chunk-DL6EPNIK.js +50 -0
  38. package/{chunk-YYIRR6QC.js → chunk-E5KQTMMJ.js} +212 -250
  39. package/{chunk-4QQFLN5C.js → chunk-EGPCU42M.js} +58 -8
  40. package/{chunk-XVP3C2KY.js → chunk-ELT65PZW.js} +2 -2
  41. package/{chunk-EMXI3N3Z.js → chunk-ENP2ELIL.js} +5 -5
  42. package/{chunk-6565R2TI.js → chunk-EXAEHRLI.js} +112 -191
  43. package/chunk-FQZZLA3C.js +223 -0
  44. package/{chunk-WPN6RMDF.js → chunk-GMZZ5EKJ.js} +3 -3
  45. package/{chunk-RSYUDGGZ.js → chunk-HQNPCMWL.js} +3 -3
  46. package/{chunk-OGGHETUE.js → chunk-HQPG2PIV.js} +62 -19
  47. package/{chunk-4NLUNENX.js → chunk-IQZ6TGVW.js} +10 -3
  48. package/{chunk-VE6XMVKG.js → chunk-J67FKTTY.js} +330 -213
  49. package/{chunk-G2MKOQCB.js → chunk-JFE7XW4D.js} +1 -1
  50. package/{setDialogExtraReferencesAction-2VLGWQKG.js → chunk-JLA4FXYC.js} +2 -17
  51. package/{chunk-OOIN7HSO.js → chunk-JP7REMYP.js} +19 -1
  52. package/chunk-KFEVY3ST.js +255 -0
  53. package/{chunk-I66RU7P7.js → chunk-KKWJ5VPZ.js} +1 -1
  54. package/{chunk-WRN5EQT7.js → chunk-L2RRMXNJ.js} +13 -4
  55. package/{chunk-ISYE6GZB.js → chunk-L6NVTGI7.js} +1 -1
  56. package/{chunk-HRQCKQA5.js → chunk-MUCU6ATG.js} +8 -257
  57. package/{chunk-BFRVXJJJ.js → chunk-MUIT5AAM.js} +112 -27
  58. package/{chunk-WNLPAOIT.js → chunk-MVQ4TBSD.js} +1 -1
  59. package/{chunk-O53CP2QR.js → chunk-N2HYIBLH.js} +6 -6
  60. package/{chunk-524BDL33.js → chunk-O6W2O2DA.js} +1 -15
  61. package/{chunk-YC3DJILJ.js → chunk-PUSK7HXJ.js} +64 -22
  62. package/{chunk-OOSFSFMA.js → chunk-R5V5G73M.js} +2 -0
  63. package/{chunk-4IJYA27C.js → chunk-RG2U2MTJ.js} +1 -1
  64. package/{chunk-Z24FGIU2.js → chunk-RIDWN7AP.js} +34 -15
  65. package/{chunk-IKXL2HZ3.js → chunk-RK5NYQEL.js} +1 -1
  66. package/{chunk-QLFCNUVQ.js → chunk-RUTSBLDM.js} +1629 -261
  67. package/{chunk-TTGAVETO.js → chunk-RVOUXDFU.js} +5 -5
  68. package/{chunk-JTINRTBT.js → chunk-SKDNBYZK.js} +2 -2
  69. package/{chunk-KMQPSTMJ.js → chunk-TRT4I4UD.js} +2 -2
  70. package/{chunk-EHLHSX7R.js → chunk-UB4RYYNQ.js} +9 -2
  71. package/{chunk-N5424GSW.js → chunk-UGUW3FHG.js} +4 -4
  72. package/{chunk-YNHQIXX5.js → chunk-UIOYWBU7.js} +395 -326
  73. package/chunk-V5R4NZP2.js +78 -0
  74. package/{chunk-MYMMNKYL.js → chunk-VNAEBGDK.js} +156 -6
  75. package/{chunk-J55UHASN.js → chunk-VST53WEL.js} +1 -1
  76. package/{chunk-6MHDWKOT.js → chunk-VVKQFITN.js} +25 -12
  77. package/{chunk-W4NVOSFF.js → chunk-WFHXMLHZ.js} +1 -1
  78. package/{chunk-H33743XH.js → chunk-WJRJDX2W.js} +1 -1
  79. package/chunk-X4Q4UZEY.js +26 -0
  80. package/{chunk-E237VE6U.js → chunk-XFYDGBXL.js} +4 -4
  81. package/{chunk-JS33TCQ3.js → chunk-XHG22OEX.js} +4 -4
  82. package/{chunk-DVRHHFEA.js → chunk-XMLRJUU5.js} +1 -1
  83. package/{chunk-V2J635L5.js → chunk-XOIF2TNF.js} +2 -2
  84. package/{chunk-SFXYKGK2.js → chunk-XRZJGPFI.js} +7 -7
  85. package/chunk-ZHXJ6M7T.js +27 -0
  86. package/chunk-ZZ2MH7LE.js +84 -0
  87. package/{cliExecutor-K3F7DMRO.js → cliExecutor-DNE7TCC4.js} +2 -2
  88. package/codingSkills-36KN5NQT.js +48 -0
  89. package/{createAgentAutomationAction-TS6NNZ4X.js → createAgentAutomationAction-ONKZ46XE.js} +22 -21
  90. package/{createDialogAction-5HVQ33EX.js → createDialogAction-7QWJEBKU.js} +24 -23
  91. package/{createPageAction-4F3ZGQJD.js → createPageAction-PB3KXZIA.js} +28 -27
  92. package/{dbSlice-OP6UPXKA.js → dbSlice-CGSRFJN3.js} +8 -7
  93. package/{deleteFile-WPWVZE4B.js → deleteFile-WDZ3VM7B.js} +3 -3
  94. package/{dialogCommands-ZL6L24BS.js → dialogCommands-YZFU4Q26.js} +30 -27
  95. package/{dialogSlice-FAWUQDJW.js → dialogSlice-53B5ISGQ.js} +22 -21
  96. package/{docCreateCommands-LYROQTFH.js → docCreateCommands-LOUC5PFB.js} +28 -25
  97. package/{docDeleteCommands-6TWGTZNR.js → docDeleteCommands-HHPGT4BR.js} +29 -26
  98. package/{docReadCommands-PRULNF26.js → docReadCommands-YPSN4HEF.js} +28 -25
  99. package/{docStore-2UHVWLTV.js → docStore-LJXXRB5W.js} +23 -22
  100. package/{docUpdateCommands-NNYYWJBI.js → docUpdateCommands-CJCZO54M.js} +28 -25
  101. package/{fetchMessages-KTNM7QAR.js → fetchMessages-BMGVZVSE.js} +4 -3
  102. package/{getPricing-UGDJHI7M.js → getPricing-RYY6OBA4.js} +4 -4
  103. package/handleSendMessageAction-ICGX4QCM.js +402 -0
  104. package/index.js +68 -68
  105. package/{localDialogRead-2VRI24F4.js → localDialogRead-HQZPVIE3.js} +1 -1
  106. package/{localRuntimeDb-LGDF6FQP.js → localRuntimeDb-THJZGAOJ.js} +1 -1
  107. package/{machineCommands-JQPEQFSE.js → machineCommands-YLDZXK4D.js} +64 -58
  108. package/{machineWsRunDispatch-FFFNWVEW.js → machineWsRunDispatch-LTQL3DRE.js} +56 -50
  109. package/{models-LSCRJJ6P.js → models-5K5G2CZI.js} +2 -2
  110. package/package.json +1 -1
  111. package/queryRunOverlay-O4LOMMPO.js +161 -0
  112. package/{read-HXHAZBKH.js → read-3FMPZPER.js} +3 -3
  113. package/{readDocTool-VPBDTO4G.js → readDocTool-VSYHKK3V.js} +1 -1
  114. package/{readlineWorkspace-QSXHSBHA.js → readlineWorkspace-OSPVWNAT.js} +699 -168
  115. package/{removeDialogAgentAction-HUFVN35S.js → removeDialogAgentAction-OAGA2G3U.js} +11 -10
  116. package/{runAgentClientLoop-A75BUU6D.js → runAgentClientLoop-76SUKKPX.js} +46 -40
  117. package/runOverlayPresentation-ZO4VCWEU.js +11 -0
  118. package/{runtimeDoctorCommands-THIHX2SY.js → runtimeDoctorCommands-E2OUORHK.js} +6 -6
  119. package/setDialogExtraReferencesAction-JZEXA5SL.js +27 -0
  120. package/{setPrimaryDialogAgentAction-VB4UV2CC.js → setPrimaryDialogAgentAction-4ZUQQKDG.js} +27 -18
  121. package/{settingSlice-7JYPQNAC.js → settingSlice-7MNKHZ6R.js} +9 -8
  122. package/{skillDiscovery-6M2BZUFN.js → skillDiscovery-KJWT7JBU.js} +3 -3
  123. package/{spaceCommands-4LE45GB7.js → spaceCommands-GIF7MKVD.js} +31 -28
  124. package/{spaceSlice-444MFUP6.js → spaceSlice-M4PVN5PO.js} +22 -21
  125. package/{streamAgentChatTurn-DJAE7USZ.js → streamAgentChatTurn-GCKTFSHQ.js} +96 -55
  126. package/{tableCommands-3P7MJ3PF.js → tableCommands-BEQAGE4I.js} +1 -1
  127. package/{tools-YB6LXSVN.js → tools-RJVFXOLR.js} +35 -30
  128. package/{tuiSummaryLlmCaller-QQL3JA5I.js → tuiSummaryLlmCaller-VUNVBRX3.js} +7 -6
  129. package/types-ZSTJ7MPR.js +7 -0
  130. package/{updateDialogTitleAction-6HGFBM64.js → updateDialogTitleAction-PSR67DLV.js} +25 -24
  131. package/agentRecordCommands-DCH2WBL2.js +0 -99
  132. package/chunk-BYXBJQAS.js +0 -0
  133. package/handleSendMessageAction-LJPUYNOH.js +0 -215
  134. package/{chunk-O4BU24WZ.js → chunk-6Y7A3OQQ.js} +3 -3
  135. package/{chunk-CMKUBIGW.js → chunk-X7W4TNB4.js} +3 -3
  136. package/{localRuntimeAuthority-TEGCOWX4.js → localRuntimeAuthority-4IXJCHZ7.js} +3 -3
@@ -1,27 +1,24 @@
1
1
  import {
2
2
  BUILTIN_SUMMARY_LLM_CONFIG,
3
3
  buildBuiltinSummaryContent
4
- } from "./chunk-V2J635L5.js";
5
- import {
6
- authRoutes
7
- } from "./chunk-MRC4Q34M.js";
4
+ } from "./chunk-XOIF2TNF.js";
8
5
  import {
9
6
  buildDialogAttachmentPlan,
10
7
  extractFileContentIds
11
- } from "./chunk-MTU75CZ2.js";
8
+ } from "./chunk-B5TOXZAK.js";
12
9
  import {
13
- getApproxPricePerImage
14
- } from "./chunk-CWMSB67P.js";
10
+ authRoutes
11
+ } from "./chunk-MRC4Q34M.js";
15
12
  import {
16
13
  deleteServerSyncedCredential,
17
14
  runLlm
18
- } from "./chunk-OQMPU2ML.js";
15
+ } from "./chunk-5PGGCJGV.js";
19
16
  import {
20
- cleanupCliSessionForDialog
21
- } from "./chunk-JS33TCQ3.js";
17
+ getApproxPricePerImage
18
+ } from "./chunk-CWMSB67P.js";
22
19
  import {
23
- fetchMessages
24
- } from "./chunk-SOTZ6RDN.js";
20
+ cleanupCliSessionForDialog
21
+ } from "./chunk-XHG22OEX.js";
25
22
  import {
26
23
  getDialogAgentIds,
27
24
  getPrimaryDialogAgentId
@@ -30,20 +27,36 @@ import {
30
27
  require_date_fns
31
28
  } from "./chunk-M76ECQRD.js";
32
29
  import {
30
+ fetchMessages
31
+ } from "./chunk-3Q7WHGCB.js";
32
+ import {
33
+ DEFAULT_AUTO_EXECUTION_PROFILE,
33
34
  DEFAULT_CONTEXT_WINDOW,
34
35
  getModelContextWindow,
35
36
  getModelInfo,
36
37
  normalizeAssistantContentBuffer,
37
38
  planCompression,
39
+ resolveAutoExecutionProfile,
38
40
  serializeMessageContent
39
- } from "./chunk-4QQFLN5C.js";
41
+ } from "./chunk-EGPCU42M.js";
42
+ import {
43
+ createFileCredentialBroker
44
+ } from "./chunk-5CS33IBL.js";
40
45
  import {
41
46
  findModelConfig,
42
47
  getModelConfig
43
- } from "./chunk-OGGHETUE.js";
48
+ } from "./chunk-HQPG2PIV.js";
44
49
  import {
45
- createFileCredentialBroker
46
- } from "./chunk-5CS33IBL.js";
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";
47
60
  import {
48
61
  extractCustomId,
49
62
  extractUserId
@@ -65,27 +78,16 @@ import {
65
78
  setActiveDialogKey,
66
79
  setDialogConfigError
67
80
  } from "./chunk-3ASDTTEI.js";
68
- import {
69
- toErrorMessage
70
- } from "./chunk-HNMXYYJR.js";
71
81
  import {
72
82
  isSystemAdmin,
73
83
  nolotusId,
74
84
  selectRemoteServer,
75
85
  selectRemoteServers,
76
86
  selectRemoteSyncServers
77
- } from "./chunk-TTGAVETO.js";
87
+ } from "./chunk-RVOUXDFU.js";
78
88
  import {
79
89
  asRecordOrEmpty
80
90
  } from "./chunk-KX6YBIHG.js";
81
- import {
82
- UNCATEGORIZED_ID,
83
- addContentAction,
84
- checkSpaceMembership,
85
- createSpaceKey,
86
- localSpaceAuthorityPatchStamp,
87
- normalizeSpaceId
88
- } from "./chunk-XVP3C2KY.js";
89
91
  import {
90
92
  patch,
91
93
  read,
@@ -98,7 +100,7 @@ import {
98
100
  uploadFileAction,
99
101
  upsertSSREntity,
100
102
  write
101
- } from "./chunk-SFXYKGK2.js";
103
+ } from "./chunk-XRZJGPFI.js";
102
104
  import {
103
105
  DB_PREFIX,
104
106
  SEPARATOR,
@@ -123,20 +125,20 @@ import {
123
125
  splitKey,
124
126
  toTrimmedString,
125
127
  ulid
126
- } from "./chunk-O4BU24WZ.js";
128
+ } from "./chunk-6Y7A3OQQ.js";
129
+ import {
130
+ asOptionalFiniteNumber
131
+ } from "./chunk-WWC7I6TA.js";
127
132
  import {
128
133
  asNonEmptyStringArray,
129
134
  asTrimmedNonEmptyStringArray
130
135
  } from "./chunk-I42VC5KR.js";
131
- import {
132
- asOptionalFiniteNumber
133
- } from "./chunk-WWC7I6TA.js";
134
136
  import {
135
137
  asTrimmedLowercaseString
136
138
  } from "./chunk-QSJ3HFEF.js";
137
139
  import {
138
140
  readAction
139
- } from "./chunk-VPTJB4HM.js";
141
+ } from "./chunk-3ND52WIL.js";
140
142
  import {
141
143
  DEVICE_LOCAL_OWNER_ID,
142
144
  asyncThunkCreator,
@@ -157,7 +159,7 @@ import {
157
159
  selectIdentityToken,
158
160
  selectIdentityUserId,
159
161
  selectRuntimeSnapshot
160
- } from "./chunk-DVRHHFEA.js";
162
+ } from "./chunk-XMLRJUU5.js";
161
163
  import {
162
164
  createClientLogger,
163
165
  fetchFromServer,
@@ -165,7 +167,7 @@ import {
165
167
  getAllServers,
166
168
  isAbortError,
167
169
  logger
168
- } from "./chunk-OOSFSFMA.js";
170
+ } from "./chunk-R5V5G73M.js";
169
171
  import {
170
172
  buildTombstoneRecord,
171
173
  isTombstoneRecord,
@@ -599,8 +601,8 @@ var require_react_dom = __commonJS({
599
601
  }
600
602
  try {
601
603
  __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
602
- } catch (err) {
603
- console.error(err);
604
+ } catch (err2) {
605
+ console.error(err2);
604
606
  }
605
607
  }
606
608
  if (process.env.NODE_ENV === "production") {
@@ -943,7 +945,7 @@ var require_core = __commonJS({
943
945
  if (!crypto && typeof __require === "function") {
944
946
  try {
945
947
  crypto = __require("crypto");
946
- } catch (err) {
948
+ } catch (err2) {
947
949
  }
948
950
  }
949
951
  var cryptoSecureRandomInt = function() {
@@ -951,13 +953,13 @@ var require_core = __commonJS({
951
953
  if (typeof crypto.getRandomValues === "function") {
952
954
  try {
953
955
  return crypto.getRandomValues(new Uint32Array(1))[0];
954
- } catch (err) {
956
+ } catch (err2) {
955
957
  }
956
958
  }
957
959
  if (typeof crypto.randomBytes === "function") {
958
960
  try {
959
961
  return crypto.randomBytes(4).readInt32LE();
960
- } catch (err) {
962
+ } catch (err2) {
961
963
  }
962
964
  }
963
965
  }
@@ -3257,11 +3259,11 @@ var fetchConvMsgs = async (server, token, {
3257
3259
 
3258
3260
  // packages/app/utils/async.ts
3259
3261
  function swallowNonAbortError(promise, fallback, signal) {
3260
- return promise.catch((err) => {
3261
- if (isAbortError(err) || signal?.aborted) {
3262
- throw err;
3262
+ return promise.catch((err2) => {
3263
+ if (isAbortError(err2) || signal?.aborted) {
3264
+ throw err2;
3263
3265
  }
3264
- console.error("Non-abort error in async op:", err);
3266
+ console.error("Non-abort error in async op:", err2);
3265
3267
  return fallback;
3266
3268
  });
3267
3269
  }
@@ -3565,8 +3567,8 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
3565
3567
  ).unwrap();
3566
3568
  console.log(`[ContextCompression] Compressed ${plan.compressCount} messages. New summary len: ${newSummary.length}`);
3567
3569
  }
3568
- } catch (err) {
3569
- console.error("[ContextCompression] Failed:", err);
3570
+ } catch (err2) {
3571
+ console.error("[ContextCompression] Failed:", err2);
3570
3572
  }
3571
3573
  } finally {
3572
3574
  summarizingDialogs.delete(dialogKey);
@@ -3625,7 +3627,7 @@ var normalizeAppRouteId = (contentKey) => isAppContentKey(contentKey) ? contentK
3625
3627
 
3626
3628
  // packages/ai/tools/uiAskChoiceTool.ts
3627
3629
  var uiAskChoiceFunctionSchema = {
3628
- name: "ui_ask_choice",
3630
+ name: "ask_user",
3629
3631
  description: [
3630
3632
  "\u8BA9\u7528\u6237\u5728 2\uFF5E5 \u4E2A\u4E92\u65A5\u9009\u9879\u4E4B\u95F4\u505A\u9009\u62E9\u7684\u901A\u7528\u201C\u51FA\u9009\u9879\u201D\u5DE5\u5177\u3002\u9002\u7528\u573A\u666F\uFF1A\u9700\u6C42\u6A21\u7CCA\u65F6\u7ED9\u65B9\u5411\u5019\u9009\u3001\u8BA1\u5212\u5206\u652F\u8282\u70B9\u51B3\u7B56\u3001\u51FA\u9898/\u95EE\u5377\u3001\u65B0\u4F1A\u8BDD\u529F\u80FD\u5BFC\u822A\u3002",
3631
3633
  "\u8C03\u7528\u524D\u987B\u5148\u5728\u666E\u901A\u56DE\u590D\u6587\u672C\u91CC\u89E3\u91CA\u80CC\u666F\u4E0E\u6743\u8861\uFF08\u5148\u89E3\u91CA\uFF0C\u518D\u8C03\u7528\uFF09\u3002",
@@ -3635,8 +3637,9 @@ var uiAskChoiceFunctionSchema = {
3635
3637
  "- \u6BCF\u4E2A question \u53EF\u4EE5\u8BBE\u7F6E multiSelect: true \u5141\u8BB8\u591A\u9009\u3002",
3636
3638
  "- \u6BCF\u4E2A question \u53EF\u4EE5\u8BBE\u7F6E allowOther: false \u9690\u85CF\u201C\u5176\u4ED6\u201D\u8F93\u5165\u6846\u3002",
3637
3639
  "- \u6BCF\u4E2A choice \u53EF\u4EE5\u52A0 detail \u5B57\u6BB5\u63D0\u4F9B\u66F4\u957F\u7684\u63CF\u8FF0\u3002",
3640
+ "- \u6BCF\u4E2A choice \u53EF\u4EE5\u52A0 recommended: true \u6807\u8BB0\u4F60\u7684\u63A8\u8350\u9879\uFF08\u6709\u660E\u786E\u63A8\u8350\u65F6\u7528\uFF09\u3002",
3638
3641
  "",
3639
- "\u4F55\u65F6\u8C03\u7528 / \u8C03\u7528\u89C4\u8303\u7684\u5B8C\u6574\u884C\u4E3A\u89C4\u5219\u7531\u7CFB\u7EDF\u63D0\u793A\u7684\u300C\u4EA4\u4E92\u8BF4\u660E\u300D\u5757\u6CE8\u5165\uFF0C\u4E0D\u5728\u6B64\u91CD\u590D\u3002"
3642
+ "\u4F55\u65F6\u8C03\u7528 / \u63A8\u8350\u4E0E\u6743\u8861 / \u8C03\u7528\u89C4\u8303\u7684\u5B8C\u6574\u884C\u4E3A\u89C4\u5219\u7531\u7CFB\u7EDF\u63D0\u793A\u7684\u300C\u4EA4\u4E92\u8BF4\u660E\u300D\u5757\u6CE8\u5165\uFF0C\u4E0D\u5728\u6B64\u91CD\u590D\u3002"
3640
3643
  ].join("\n"),
3641
3644
  parameters: {
3642
3645
  type: "object",
@@ -3663,6 +3666,13 @@ var uiAskChoiceFunctionSchema = {
3663
3666
  type: "string",
3664
3667
  description: "\u7B80\u77ED\u8865\u5145\uFF08\u5EFA\u8BAE\u4E00\u53E5\u8BDD\uFF09\uFF0C\u957F\u89E3\u91CA\u5199\u8FDB\u8C03\u7528\u524D\u7684\u56DE\u590D\u6587\u672C\u3002"
3665
3668
  },
3669
+ recommended: {
3670
+ type: "boolean",
3671
+ description: [
3672
+ "\u6807\u8BB0\u8FD9\u662F\u4F60\u7684\u63A8\u8350\u9879\u3002\u6709\u660E\u786E\u63A8\u8350\u65F6\u628A\u8BE5\u9009\u9879\u653E\u5728 choices \u7B2C\u4E00\u4F4D\u5E76\u7F6E true\u3002",
3673
+ "\u6CA1\u6709\u660E\u786E\u63A8\u8350\u65F6\u4E0D\u8981\u8BBE\u7F6E\uFF08\u9ED8\u8BA4 false\uFF09\uFF0C\u5E76\u5728\u8C03\u7528\u524D\u6587\u672C\u91CC\u8BF4\u660E\u5404\u9009\u9879\u4F18\u7F3A\u70B9\u3002"
3674
+ ].join(" ")
3675
+ },
3666
3676
  userMessage: {
3667
3677
  type: "string",
3668
3678
  description: [
@@ -3701,6 +3711,10 @@ var uiAskChoiceFunctionSchema = {
3701
3711
  type: "string",
3702
3712
  description: "\u7B80\u77ED\u8865\u5145\uFF08\u5EFA\u8BAE\u4E00\u53E5\u8BDD\uFF09\uFF0C\u957F\u89E3\u91CA\u5199\u8FDB\u8C03\u7528\u524D\u7684\u56DE\u590D\u6587\u672C\u3002"
3703
3713
  },
3714
+ recommended: {
3715
+ type: "boolean",
3716
+ description: "\u6807\u8BB0\u8FD9\u662F\u4F60\u7684\u63A8\u8350\u9879\uFF08\u6709\u660E\u786E\u63A8\u8350\u65F6\u7F6E true\uFF0C\u65E0\u5219\u7701\u7565\uFF09\u3002"
3717
+ },
3704
3718
  userMessage: { type: "string" }
3705
3719
  },
3706
3720
  required: ["id", "label"]
@@ -3743,7 +3757,7 @@ async function uiAskChoiceFunc(args, _thunkApi) {
3743
3757
  const firstQ = args.questions[0];
3744
3758
  return {
3745
3759
  rawData: {
3746
- type: "ui_ask_choice",
3760
+ type: "ask_user",
3747
3761
  question: firstQ?.question ?? "",
3748
3762
  choices: firstQ?.choices ?? [],
3749
3763
  blocking,
@@ -3755,11 +3769,11 @@ async function uiAskChoiceFunc(args, _thunkApi) {
3755
3769
  const question = String(args?.question ?? "").trim();
3756
3770
  const choices = Array.isArray(args?.choices) ? args.choices : [];
3757
3771
  if (!question || choices.length === 0) {
3758
- throw new Error("ui_ask_choice \u9700\u8981 question+choices \u6216 questions\u3002");
3772
+ throw new Error("ask_user \u9700\u8981 question+choices \u6216 questions\u3002");
3759
3773
  }
3760
3774
  return {
3761
3775
  rawData: {
3762
- type: "ui_ask_choice",
3776
+ type: "ask_user",
3763
3777
  question,
3764
3778
  choices,
3765
3779
  blocking
@@ -3776,14 +3790,14 @@ function parseUiAskChoiceContent(rawContent) {
3776
3790
  }
3777
3791
  })() : rawContent;
3778
3792
  if (!parsed || typeof parsed !== "object") return null;
3779
- if (parsed.type !== "ui_ask_choice") return null;
3793
+ if (parsed.type !== "ask_user") return null;
3780
3794
  return parsed;
3781
3795
  }
3782
3796
 
3783
3797
  // packages/ai/policy/personalizationDialog.ts
3784
3798
  var PERSONALIZATION_DIALOG_CATEGORY = "user-overlay-profile";
3785
3799
  var PERSONALIZATION_DIALOG_EXTRA_TOOLS = [
3786
- "ui_ask_choice",
3800
+ "ask_user",
3787
3801
  "updateUserPreferenceProfile"
3788
3802
  ];
3789
3803
  var buildPersonalizationRuntimeOptions = (runtimeOptions) => ({
@@ -3799,20 +3813,41 @@ var buildPersonalizationDialogPolicyContext = () => [
3799
3813
  "\u5F53\u524D\u5BF9\u8BDD\u662F\u201C\u7528\u6237\u4E2A\u6027\u5316\u8BBE\u7F6E\u201D\u6A21\u5F0F\uFF0C\u4E0D\u662F\u666E\u901A\u95F2\u804A\u3002",
3800
3814
  "\u4F60\u7684\u76EE\u6807\u662F\u7528\u7B80\u77ED\u5BF9\u8BDD\u5E2E\u52A9\u7528\u6237\u786E\u8BA4 tone\u3001knowledge_capture\u3001space_context \u8FD9\u4E09\u9879\u504F\u597D\u3002",
3801
3815
  "\u5982\u679C\u7528\u6237\u5148\u4ECB\u7ECD\u81EA\u5DF1\u3001\u5DE5\u4F5C\u65B9\u5F0F\u6216\u957F\u671F\u6C9F\u901A\u504F\u597D\uFF0C\u8BF7\u628A\u8FD9\u4E9B\u53EF\u590D\u7528\u4FE1\u606F\u6574\u7406\u6210\u7B80\u6D01\u7684 globalPrompt \u8349\u6848\uFF0C\u5E76\u5728\u7528\u6237\u786E\u8BA4\u540E\u901A\u8FC7 updateUserPreferenceProfile \u4FDD\u5B58\u3002",
3802
- "\u4F18\u5148\u4E00\u6B21\u53EA\u95EE\u4E00\u4E2A\u95EE\u9898\uFF1B\u5F53\u5B58\u5728\u6E05\u6670\u4E92\u65A5\u9009\u9879\u65F6\uFF0C\u4F18\u5148\u8C03\u7528 ui_ask_choice\u3002",
3816
+ "\u4F18\u5148\u4E00\u6B21\u53EA\u95EE\u4E00\u4E2A\u95EE\u9898\uFF1B\u5F53\u5B58\u5728\u6E05\u6670\u4E92\u65A5\u9009\u9879\u65F6\uFF0C\u4F18\u5148\u8C03\u7528 ask_user\u3002",
3803
3817
  "\u6536\u96C6\u5230\u8DB3\u591F\u4FE1\u606F\u540E\uFF0C\u8C03\u7528 updateUserPreferenceProfile \u4FDD\u5B58\u7ED3\u679C\uFF0C\u7136\u540E\u7528\u81EA\u7136\u8BED\u8A00\u603B\u7ED3\u5DF2\u4FDD\u5B58\u7684\u8BBE\u7F6E\u3002",
3804
3818
  "\u4FDD\u5B58\u5B8C\u6210\u540E\uFF0C\u8981\u63D0\u9192\u7528\u6237\uFF1A\u4EE5\u540E\u4E5F\u53EF\u4EE5\u5728\u8BBE\u7F6E\u91CC\u4FEE\u6539 globalPrompt \u548C\u8FD9\u4E9B\u504F\u597D\uFF0C\u6216\u8005\u518D\u6B21\u6253\u5F00\u8FD9\u4E2A\u5165\u53E3\u7EE7\u7EED\u8C03\u6574\u3002",
3805
3819
  "\u4E2A\u6027\u5316\u8BBE\u7F6E\u5B8C\u6210\u540E\uFF0C\u53EF\u987A\u624B\u5F15\u5BFC\u7528\u6237\u5C1D\u8BD5 1 \u5230 2 \u4E2A\u76F8\u5173\u529F\u80FD\uFF0C\u4F8B\u5982\u9996\u9875\u5FEB\u6377\u5BF9\u8BDD\u3001\u521B\u5EFA\u7B14\u8BB0\u3001\u521B\u5EFA AI\uFF0C\u4F46\u4E0D\u8981\u4E00\u6B21\u63A8\u8350\u592A\u591A\u3002",
3806
3820
  "\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"
3807
3821
  ].join("\n");
3808
3822
 
3823
+ // packages/chat/dialog/dialogAgentPolicy.ts
3824
+ var resolveDialogAgentMode = (dialog) => {
3825
+ if (dialog?.agentMode === "auto") return "auto";
3826
+ if (dialog?.agentMode === "fixed") return "fixed";
3827
+ return getPrimaryDialogAgentId(dialog) ? "fixed" : "auto";
3828
+ };
3829
+ var resolveDialogAutoTier = (dialog) => {
3830
+ const tier = asOptionalTrimmedString(dialog?.autoRoute?.stickyTier);
3831
+ return tier === "flash" || tier === "balanced" || tier === "quality" || tier === "image" ? tier : void 0;
3832
+ };
3833
+ var resolveDialogRuntimeAgentKey = (dialog, explicitAgentKey) => {
3834
+ const explicit = asOptionalTrimmedString(explicitAgentKey);
3835
+ if (explicit) return explicit;
3836
+ if (resolveDialogAgentMode(dialog) === "fixed") {
3837
+ const fixed = getPrimaryDialogAgentId(dialog);
3838
+ if (fixed) return fixed;
3839
+ }
3840
+ return resolveAutoExecutionProfile(
3841
+ resolveDialogAutoTier(dialog) ?? DEFAULT_AUTO_EXECUTION_PROFILE.tier
3842
+ ).legacyAgentKey;
3843
+ };
3844
+
3809
3845
  // packages/chat/dialog/actions/handleSendMessageResolver.ts
3810
3846
  function resolveHandleSendMessageContext(input) {
3811
3847
  const { dialogConfig, targetAgentKey, runtimeOptions } = input;
3812
- const defaultAgentKey = getPrimaryDialogAgentId(dialogConfig) ?? void 0;
3813
3848
  return {
3814
- agentKeyToUse: targetAgentKey || defaultAgentKey,
3815
- effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(runtimeOptions) : runtimeOptions
3849
+ agentKeyToUse: resolveDialogRuntimeAgentKey(dialogConfig, targetAgentKey),
3850
+ effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(runtimeOptions ?? {}) : runtimeOptions
3816
3851
  };
3817
3852
  }
3818
3853
 
@@ -4601,6 +4636,7 @@ async function captureUnderstandingFromCompletedUiTurn(input) {
4601
4636
  const token = typeof state3?.auth?.currentToken === "string" ? state3.auth.currentToken : null;
4602
4637
  const baseUrl = resolveMemoryCaptureBaseUrl(state3);
4603
4638
  if (!token || !baseUrl) return;
4639
+ const dialog = input.dialogKey ? selectById(state3, input.dialogKey) : void 0;
4604
4640
  try {
4605
4641
  await fetch(`${baseUrl}/api/memory/capture-turn`, {
4606
4642
  method: "POST",
@@ -4944,6 +4980,33 @@ var messageSlice = createSliceWithThunks({
4944
4980
  });
4945
4981
  }
4946
4982
  }),
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
+ }),
4947
5010
  prepareAndPersistMessage: create.asyncThunk(
4948
5011
  async (args, thunkApi) => {
4949
5012
  const { message, dialogConfig } = args;
@@ -4969,7 +5032,7 @@ var messageSlice = createSliceWithThunks({
4969
5032
  content: message.content,
4970
5033
  dialogKey
4971
5034
  })
4972
- ).catch((err) => console.error("Failed to add refs:", err));
5035
+ ).catch((err2) => console.error("Failed to add refs:", err2));
4973
5036
  dispatch(messageActions.addUserMessage({ ...fullMessage, dialogId }));
4974
5037
  const { controller, ...messageToWrite } = fullMessage;
4975
5038
  await dispatch(
@@ -5036,8 +5099,8 @@ var messageSlice = createSliceWithThunks({
5036
5099
  messages: finalMessages2.filter(isValidMessage)
5037
5100
  })
5038
5101
  );
5039
- }).catch((err) => {
5040
- console.error("[initMsgs] background remote revalidate failed:", err);
5102
+ }).catch((err2) => {
5103
+ console.error("[initMsgs] background remote revalidate failed:", err2);
5041
5104
  });
5042
5105
  return validLocalMessages;
5043
5106
  }
@@ -5054,7 +5117,7 @@ var messageSlice = createSliceWithThunks({
5054
5117
  updateDialogSummaryAction(
5055
5118
  { dialogKey: decision.dialogKey, preFetchedMessages: finalMessages },
5056
5119
  thunkApi
5057
- ).catch((err) => console.error("Resume summary failed:", err));
5120
+ ).catch((err2) => console.error("Resume summary failed:", err2));
5058
5121
  }
5059
5122
  } catch {
5060
5123
  console.error("[initMsgs] Failed to resume summary");
@@ -5360,12 +5423,12 @@ var messageSlice = createSliceWithThunks({
5360
5423
  reason: summaryReason
5361
5424
  },
5362
5425
  { dispatch, getState }
5363
- ).catch((err) => console.error("Summary update failed:", err));
5426
+ ).catch((err2) => console.error("Summary update failed:", err2));
5364
5427
  if (addRefs) {
5365
5428
  dispatch(addReferenceKeysAction({
5366
5429
  content: finalVisibleContent,
5367
5430
  dialogKey
5368
- })).catch((err) => console.error("Failed to add assistant refs:", err));
5431
+ })).catch((err2) => console.error("Failed to add assistant refs:", err2));
5369
5432
  }
5370
5433
  }
5371
5434
  captureUnderstandingFromCompletedUiTurn2({
@@ -5377,7 +5440,7 @@ var messageSlice = createSliceWithThunks({
5377
5440
  assistantText: textContent,
5378
5441
  toolCalls
5379
5442
  }).catch(
5380
- (err) => console.error("Understanding memory capture failed:", err)
5443
+ (err2) => console.error("Understanding memory capture failed:", err2)
5381
5444
  );
5382
5445
  return {
5383
5446
  id: messageId,
@@ -5529,7 +5592,7 @@ var messageSlice = createSliceWithThunks({
5529
5592
  runtimeOptions: args.runtimeOptions
5530
5593
  });
5531
5594
  if (agentKeyToUse) {
5532
- const { streamAgentChatTurn } = await import("./agentSlice-IVE735EV.js");
5595
+ const { streamAgentChatTurn } = await import("./agentSlice-D33GU3JL.js");
5533
5596
  await dispatch(
5534
5597
  streamAgentChatTurn({
5535
5598
  agentKey: agentKeyToUse,
@@ -5585,7 +5648,8 @@ var {
5585
5648
  editUserMessageAndReplay,
5586
5649
  addToolMessage,
5587
5650
  updateToolMessage,
5588
- removeMessagesByIds
5651
+ removeMessagesByIds,
5652
+ appendOverlayMessage
5589
5653
  } = messageSlice.actions;
5590
5654
  var messageSlice_default = messageSlice.reducer;
5591
5655
 
@@ -8000,7 +8064,7 @@ var saveTokenUsage = async (data, thunkApi) => {
8000
8064
  currentStats = await thunkApi.dispatch(read({
8001
8065
  dbKey: tokenDayStatsKey
8002
8066
  })).unwrap();
8003
- } catch (err) {
8067
+ } catch (err2) {
8004
8068
  logger3.warn({ tokenDayStatsKey }, "No existing stats found");
8005
8069
  }
8006
8070
  const updatedStats = await updateStats(
@@ -8187,7 +8251,7 @@ var deleteOwnedDialogAttachments = async (args) => {
8187
8251
  metadataReadFailures
8188
8252
  });
8189
8253
  if (!plan.deleteCandidates.length) return plan;
8190
- const { deleteFileAction } = await import("./deleteFile-WPWVZE4B.js");
8254
+ const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
8191
8255
  for (const candidate of plan.deleteCandidates) {
8192
8256
  if (candidate.fileDbKey) {
8193
8257
  await deleteFileAction(candidate.fileDbKey, args.thunkApi);
@@ -8249,7 +8313,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8249
8313
  }
8250
8314
  if (isCurrentDialog) {
8251
8315
  await thunkApi.dispatch(resetMsgs());
8252
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-FAWUQDJW.js");
8316
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-53B5ISGQ.js");
8253
8317
  dispatch(clearPendingAttachments2());
8254
8318
  clearWorkflow();
8255
8319
  }
@@ -8258,35 +8322,35 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8258
8322
 
8259
8323
  // packages/chat/dialog/dialogSlice.ts
8260
8324
  var runCreateDialogAction = async (args, thunkApi) => {
8261
- const { createDialogAction } = await import("./createDialogAction-5HVQ33EX.js");
8325
+ const { createDialogAction } = await import("./createDialogAction-7QWJEBKU.js");
8262
8326
  return createDialogAction(args, thunkApi);
8263
8327
  };
8264
8328
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
8265
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-TS6NNZ4X.js");
8329
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-ONKZ46XE.js");
8266
8330
  return createAgentAutomationAction(args, thunkApi);
8267
8331
  };
8268
8332
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
8269
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-6HGFBM64.js");
8333
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-PSR67DLV.js");
8270
8334
  return updateDialogTitleAction(args, thunkApi);
8271
8335
  };
8272
8336
  var runAddDialogAgentAction = async (args, thunkApi) => {
8273
- const { addDialogAgentAction } = await import("./addDialogAgentAction-Z4YCYZIV.js");
8337
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-FCMSKYAF.js");
8274
8338
  return addDialogAgentAction(args, thunkApi);
8275
8339
  };
8276
8340
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
8277
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-HUFVN35S.js");
8341
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-OAGA2G3U.js");
8278
8342
  return removeDialogAgentAction(args, thunkApi);
8279
8343
  };
8280
8344
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
8281
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-VB4UV2CC.js");
8345
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-4ZUQQKDG.js");
8282
8346
  return setPrimaryDialogAgentAction(args, thunkApi);
8283
8347
  };
8284
8348
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
8285
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-2VLGWQKG.js");
8349
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-JZEXA5SL.js");
8286
8350
  return setDialogExtraReferencesAction(args, thunkApi);
8287
8351
  };
8288
8352
  var runHandleSendMessageAction = async (args, thunkApi) => {
8289
- const { handleSendMessageAction } = await import("./handleSendMessageAction-LJPUYNOH.js");
8353
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-ICGX4QCM.js");
8290
8354
  return handleSendMessageAction(args, thunkApi);
8291
8355
  };
8292
8356
  function clearDialogState() {
@@ -8299,7 +8363,7 @@ var createPageAndAddReference = createAsyncThunk(
8299
8363
  async (payload, { dispatch, getState, rejectWithValue }) => {
8300
8364
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
8301
8365
  try {
8302
- const { createDocState } = await import("./docStore-2UHVWLTV.js");
8366
+ const { createDocState } = await import("./docStore-LJXXRB5W.js");
8303
8367
  const pageKey = await createDocState(
8304
8368
  { slateData, title },
8305
8369
  { dispatch, getState }
@@ -8354,12 +8418,12 @@ var initDialog = createAsyncThunk(
8354
8418
  })
8355
8419
  ).unwrap();
8356
8420
  } catch (error) {
8357
- const err = error;
8358
- const isAborted = isAbortError(err) || err?.message === "Aborted";
8421
+ const err2 = error;
8422
+ const isAborted = isAbortError(err2) || err2?.message === "Aborted";
8359
8423
  const isCurrentDialog = getActiveDialogKey() === id;
8360
8424
  if (!isAborted && isCurrentDialog) {
8361
- setDialogConfigError(err?.message || "Failed to load dialog");
8362
- console.info("Failed to load dialog config:", err?.message);
8425
+ setDialogConfigError(err2?.message || "Failed to load dialog");
8426
+ console.info("Failed to load dialog config:", err2?.message);
8363
8427
  }
8364
8428
  throw error;
8365
8429
  }
@@ -8527,9 +8591,9 @@ var fetchTableRowsFromServer = async (server, tenantId, tableId, headers) => {
8527
8591
  if (!res.ok) {
8528
8592
  let msg = `\u52A0\u8F7D\u8868 ${tableId} \u884C\u5931\u8D25\uFF08${res.status}\uFF09`;
8529
8593
  try {
8530
- const err = await res.json();
8531
- if (err && typeof err.message === "string") {
8532
- msg = err.message;
8594
+ const err2 = await res.json();
8595
+ if (err2 && typeof err2.message === "string") {
8596
+ msg = err2.message;
8533
8597
  }
8534
8598
  } catch {
8535
8599
  }
@@ -8654,6 +8718,140 @@ var fetchAndCacheTableRows = async ({
8654
8718
  return tableDeleted ? [] : mergedRows.filter((row) => !row?.deletedAt);
8655
8719
  };
8656
8720
 
8721
+ // packages/render/table/tableColumnCore.ts
8722
+ var ok = (value) => ({ ok: true, value });
8723
+ var err = (error) => ({ ok: false, error });
8724
+ var hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
8725
+ var buildMeta = (meta, columns, updatedAt) => ({
8726
+ meta: { ...meta, columns, updatedAt },
8727
+ metaChanges: { columns, updatedAt },
8728
+ noop: false
8729
+ });
8730
+ var reorderList = (list, from, to) => {
8731
+ const next = [...list];
8732
+ const [moved] = next.splice(from, 1);
8733
+ next.splice(to, 0, moved);
8734
+ return next;
8735
+ };
8736
+ function addColumnToMeta(meta, input, deps) {
8737
+ const { columnName } = input;
8738
+ if (!columnName.trim()) {
8739
+ return err("\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8740
+ }
8741
+ if (meta.columns.some((c) => c.name === columnName)) {
8742
+ return err(`\u5B57\u6BB5 ${columnName} \u5DF2\u5B58\u5728`);
8743
+ }
8744
+ const newColumn = {
8745
+ id: deps.id,
8746
+ name: columnName,
8747
+ label: columnName
8748
+ };
8749
+ return ok(buildMeta(meta, [...meta.columns, newColumn], deps.nowIso));
8750
+ }
8751
+ function deleteColumnFromMeta(meta, rows, input, deps) {
8752
+ const { columnName } = input;
8753
+ const { nowIso } = deps;
8754
+ if (!meta.columns.some((c) => c.name === columnName)) {
8755
+ return err(`\u5B57\u6BB5 ${columnName} \u4E0D\u5B58\u5728`);
8756
+ }
8757
+ const newColumns = meta.columns.filter((c) => c.name !== columnName);
8758
+ const rowPatches = rows.filter((row) => hasOwn(row, columnName)).map((row) => ({
8759
+ dbKey: row.dbKey,
8760
+ changes: { [columnName]: null, updatedAt: nowIso }
8761
+ }));
8762
+ const newRows = rows.map((row) => {
8763
+ if (!hasOwn(row, columnName)) {
8764
+ return row;
8765
+ }
8766
+ const { [columnName]: _removed, ...rest } = row;
8767
+ return { ...rest, updatedAt: nowIso };
8768
+ });
8769
+ return ok({
8770
+ ...buildMeta(meta, newColumns, nowIso),
8771
+ rows: newRows,
8772
+ rowPatches
8773
+ });
8774
+ }
8775
+ function reorderColumnInMeta(meta, input, deps) {
8776
+ const { fromIndex, toIndex } = input;
8777
+ const columnCount = meta.columns.length;
8778
+ if (fromIndex < 0 || fromIndex >= columnCount || toIndex < 0 || toIndex >= columnCount) {
8779
+ return err("\u5217\u7D22\u5F15\u8D85\u51FA\u8303\u56F4");
8780
+ }
8781
+ if (fromIndex === toIndex) {
8782
+ return ok({
8783
+ meta,
8784
+ metaChanges: { columns: meta.columns, updatedAt: meta.updatedAt },
8785
+ noop: true
8786
+ });
8787
+ }
8788
+ return ok(
8789
+ buildMeta(meta, reorderList(meta.columns, fromIndex, toIndex), deps.nowIso)
8790
+ );
8791
+ }
8792
+ function renameColumnInMeta(meta, rows, input, deps) {
8793
+ const { oldName } = input;
8794
+ const { nowIso } = deps;
8795
+ const newName = input.newName.trim();
8796
+ if (!newName) {
8797
+ return err("\u65B0\u7684\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8798
+ }
8799
+ if (!meta.columns.some((c) => c.name === oldName)) {
8800
+ return err(`\u5B57\u6BB5 ${oldName} \u4E0D\u5B58\u5728`);
8801
+ }
8802
+ if (meta.columns.some((c) => c.name === newName)) {
8803
+ return err(`\u5B57\u6BB5 ${newName} \u5DF2\u5B58\u5728`);
8804
+ }
8805
+ const newColumns = meta.columns.map(
8806
+ (c) => c.name === oldName ? { ...c, name: newName } : c
8807
+ );
8808
+ const rowPatches = rows.filter((row) => hasOwn(row, oldName)).map((row) => ({
8809
+ dbKey: row.dbKey,
8810
+ changes: {
8811
+ [newName]: row[oldName],
8812
+ [oldName]: null,
8813
+ updatedAt: nowIso
8814
+ }
8815
+ }));
8816
+ const newRows = rows.map((row) => {
8817
+ if (!hasOwn(row, oldName)) {
8818
+ return row;
8819
+ }
8820
+ const { [oldName]: oldValue, ...rest } = row;
8821
+ return { ...rest, [newName]: oldValue, updatedAt: nowIso };
8822
+ });
8823
+ return ok({
8824
+ ...buildMeta(meta, newColumns, nowIso),
8825
+ rows: newRows,
8826
+ rowPatches
8827
+ });
8828
+ }
8829
+ function renameColumnLabelInMeta(meta, input, deps) {
8830
+ const { columnId } = input;
8831
+ const label = input.label.trim();
8832
+ if (!label) {
8833
+ return err("\u5B57\u6BB5\u663E\u793A\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8834
+ }
8835
+ if (!meta.columns.some((c) => c.id === columnId)) {
8836
+ return err("\u8981\u91CD\u547D\u540D\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
8837
+ }
8838
+ const newColumns = meta.columns.map(
8839
+ (c) => c.id === columnId ? { ...c, label } : c
8840
+ );
8841
+ return ok(buildMeta(meta, newColumns, deps.nowIso));
8842
+ }
8843
+ function updateColumnWidthInMeta(meta, input, deps) {
8844
+ const { columnId, width } = input;
8845
+ if (!meta.columns.some((c) => c.id === columnId)) {
8846
+ return err("\u8981\u8C03\u6574\u5BBD\u5EA6\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
8847
+ }
8848
+ const normalizedWidth = typeof width === "number" && width > 0 ? Math.round(width) : void 0;
8849
+ const newColumns = meta.columns.map(
8850
+ (c) => c.id === columnId ? { ...c, width: normalizedWidth } : c
8851
+ );
8852
+ return ok(buildMeta(meta, newColumns, deps.nowIso));
8853
+ }
8854
+
8657
8855
  // packages/render/table/createTableAction.ts
8658
8856
  var import_date_fns2 = __toESM(require_date_fns(), 1);
8659
8857
  import { ulid as ulid4 } from "ulid";
@@ -9809,7 +10007,7 @@ var PluralResolver = class {
9809
10007
  });
9810
10008
  this.pluralRulesCache[cacheKey] = rule;
9811
10009
  return rule;
9812
- } catch (err) {
10010
+ } catch (err2) {
9813
10011
  return;
9814
10012
  }
9815
10013
  }
@@ -10287,23 +10485,23 @@ var Connector = class extends EventEmitter {
10287
10485
  toLoadNamespaces: Object.keys(toLoadNamespaces)
10288
10486
  };
10289
10487
  }
10290
- loaded(name, err, data) {
10488
+ loaded(name, err2, data) {
10291
10489
  const s = name.split("|");
10292
10490
  const lng = s[0];
10293
10491
  const ns = s[1];
10294
- if (err) this.emit("failedLoading", lng, ns, err);
10295
- if (!err && data) {
10492
+ if (err2) this.emit("failedLoading", lng, ns, err2);
10493
+ if (!err2 && data) {
10296
10494
  this.store.addResourceBundle(lng, ns, data, void 0, void 0, {
10297
10495
  skipCopy: true
10298
10496
  });
10299
10497
  }
10300
- this.state[name] = err ? -1 : 2;
10301
- if (err && data) this.state[name] = 0;
10498
+ this.state[name] = err2 ? -1 : 2;
10499
+ if (err2 && data) this.state[name] = 0;
10302
10500
  const loaded = {};
10303
10501
  this.queue.forEach((q) => {
10304
10502
  pushPath(q.loaded, [lng], ns);
10305
10503
  removePending(q, name);
10306
- if (err) q.errors.push(err);
10504
+ if (err2) q.errors.push(err2);
10307
10505
  if (q.pendingCount === 0 && !q.done) {
10308
10506
  Object.keys(q.loaded).forEach((l) => {
10309
10507
  if (!loaded[l]) loaded[l] = {};
@@ -10342,19 +10540,19 @@ var Connector = class extends EventEmitter {
10342
10540
  return;
10343
10541
  }
10344
10542
  this.readingCalls++;
10345
- const resolver = (err, data) => {
10543
+ const resolver = (err2, data) => {
10346
10544
  this.readingCalls--;
10347
10545
  if (this.waitingReads.length > 0) {
10348
10546
  const next = this.waitingReads.shift();
10349
10547
  this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
10350
10548
  }
10351
- if (err && data && tried < this.maxRetries) {
10549
+ if (err2 && data && tried < this.maxRetries) {
10352
10550
  setTimeout(() => {
10353
10551
  this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
10354
10552
  }, wait);
10355
10553
  return;
10356
10554
  }
10357
- callback(err, data);
10555
+ callback(err2, data);
10358
10556
  };
10359
10557
  const fc = this.backend[fcName].bind(this.backend);
10360
10558
  if (fc.length === 2) {
@@ -10365,8 +10563,8 @@ var Connector = class extends EventEmitter {
10365
10563
  } else {
10366
10564
  resolver(null, r);
10367
10565
  }
10368
- } catch (err) {
10369
- resolver(err);
10566
+ } catch (err2) {
10567
+ resolver(err2);
10370
10568
  }
10371
10569
  return;
10372
10570
  }
@@ -10403,10 +10601,10 @@ var Connector = class extends EventEmitter {
10403
10601
  const s = name.split("|");
10404
10602
  const lng = s[0];
10405
10603
  const ns = s[1];
10406
- this.read(lng, ns, "read", void 0, void 0, (err, data) => {
10407
- if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
10408
- if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
10409
- this.loaded(name, err, data);
10604
+ this.read(lng, ns, "read", void 0, void 0, (err2, data) => {
10605
+ if (err2) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err2);
10606
+ if (!err2 && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
10607
+ this.loaded(name, err2, data);
10410
10608
  });
10411
10609
  }
10412
10610
  saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
@@ -10437,8 +10635,8 @@ var Connector = class extends EventEmitter {
10437
10635
  } else {
10438
10636
  clb(null, r);
10439
10637
  }
10440
- } catch (err) {
10441
- clb(err);
10638
+ } catch (err2) {
10639
+ clb(err2);
10442
10640
  }
10443
10641
  } else {
10444
10642
  fc(languages, namespace, key, fallbackValue, clb, opts);
@@ -10670,14 +10868,14 @@ var I18n = class _I18n extends EventEmitter {
10670
10868
  });
10671
10869
  const deferred = defer();
10672
10870
  const load = () => {
10673
- const finish = (err, t2) => {
10871
+ const finish = (err2, t2) => {
10674
10872
  this.isInitializing = false;
10675
10873
  if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn("init: i18next is already initialized. You should call init just once!");
10676
10874
  this.isInitialized = true;
10677
10875
  if (!this.options.isClone) this.logger.log("initialized", this.options);
10678
10876
  this.emit("initialized", this.options);
10679
10877
  deferred.resolve(t2);
10680
- callback(err, t2);
10878
+ callback(err2, t2);
10681
10879
  };
10682
10880
  if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return finish(null, this.t.bind(this));
10683
10881
  this.changeLanguage(this.options.lng, finish);
@@ -10736,9 +10934,9 @@ var I18n = class _I18n extends EventEmitter {
10736
10934
  if (!lngs) lngs = this.languages;
10737
10935
  if (!ns) ns = this.options.ns;
10738
10936
  if (!callback) callback = noop;
10739
- this.services.backendConnector.reload(lngs, ns, (err) => {
10937
+ this.services.backendConnector.reload(lngs, ns, (err2) => {
10740
10938
  deferred.resolve();
10741
- callback(err);
10939
+ callback(err2);
10742
10940
  });
10743
10941
  return deferred;
10744
10942
  }
@@ -10791,7 +10989,7 @@ var I18n = class _I18n extends EventEmitter {
10791
10989
  this.resolvedLanguage = void 0;
10792
10990
  this.setResolvedLanguage(l);
10793
10991
  };
10794
- const done = (err, l) => {
10992
+ const done = (err2, l) => {
10795
10993
  if (l) {
10796
10994
  setLngProps(l);
10797
10995
  this.translator.changeLanguage(l);
@@ -10804,7 +11002,7 @@ var I18n = class _I18n extends EventEmitter {
10804
11002
  deferred.resolve(function() {
10805
11003
  return _this2.t(...arguments);
10806
11004
  });
10807
- if (callback) callback(err, function() {
11005
+ if (callback) callback(err2, function() {
10808
11006
  return _this2.t(...arguments);
10809
11007
  });
10810
11008
  };
@@ -10818,8 +11016,8 @@ var I18n = class _I18n extends EventEmitter {
10818
11016
  if (!this.translator.language) this.translator.changeLanguage(l);
10819
11017
  if (this.services.languageDetector && this.services.languageDetector.cacheUserLanguage) this.services.languageDetector.cacheUserLanguage(l);
10820
11018
  }
10821
- this.loadResources(l, (err) => {
10822
- done(err, l);
11019
+ this.loadResources(l, (err2) => {
11020
+ done(err2, l);
10823
11021
  });
10824
11022
  };
10825
11023
  if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
@@ -10917,9 +11115,9 @@ var I18n = class _I18n extends EventEmitter {
10917
11115
  ns.forEach((n) => {
10918
11116
  if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
10919
11117
  });
10920
- this.loadResources((err) => {
11118
+ this.loadResources((err2) => {
10921
11119
  deferred.resolve();
10922
- if (callback) callback(err);
11120
+ if (callback) callback(err2);
10923
11121
  });
10924
11122
  return deferred;
10925
11123
  }
@@ -10933,9 +11131,9 @@ var I18n = class _I18n extends EventEmitter {
10933
11131
  return Promise.resolve();
10934
11132
  }
10935
11133
  this.options.preload = preloaded.concat(newLngs);
10936
- this.loadResources((err) => {
11134
+ this.loadResources((err2) => {
10937
11135
  deferred.resolve();
10938
- if (callback) callback(err);
11136
+ if (callback) callback(err2);
10939
11137
  });
10940
11138
  return deferred;
10941
11139
  }
@@ -11432,12 +11630,6 @@ var initialState3 = {
11432
11630
  rows: [],
11433
11631
  focusContext: null
11434
11632
  };
11435
- var reorderList = (list, from, to) => {
11436
- const next = [...list];
11437
- const [moved] = next.splice(from, 1);
11438
- next.splice(to, 0, moved);
11439
- return next;
11440
- };
11441
11633
  var createSliceWithThunks3 = buildCreateSlice({
11442
11634
  creators: { asyncThunk: asyncThunkCreator }
11443
11635
  });
@@ -11651,41 +11843,27 @@ var tableSlice = createSliceWithThunks3({
11651
11843
  addColumn: create.asyncThunk(
11652
11844
  async (args, { dispatch, getState, rejectWithValue }) => {
11653
11845
  const { tenantId, tableId, columnName } = args;
11654
- if (!columnName.trim()) {
11655
- return rejectWithValue("\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
11656
- }
11657
11846
  const state3 = getState().table;
11658
11847
  const meta = state3.currentTable;
11659
11848
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11660
11849
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11661
11850
  }
11662
- if (meta.columns.some((c) => c.name === columnName)) {
11663
- return rejectWithValue(`\u5B57\u6BB5 ${columnName} \u5DF2\u5B58\u5728`);
11851
+ const result = addColumnToMeta(
11852
+ meta,
11853
+ { columnName },
11854
+ { id: ulid5(), nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11855
+ );
11856
+ if (!result.ok) {
11857
+ return rejectWithValue(result.error);
11664
11858
  }
11665
11859
  try {
11666
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11667
- const newColumn = {
11668
- id: ulid5(),
11669
- name: columnName,
11670
- // 默认显示名与机器名一致;之后用户可以单独改 label
11671
- label: columnName
11672
- };
11673
- const newColumns = [...meta.columns, newColumn];
11674
11860
  await dispatch(
11675
11861
  patch({
11676
11862
  dbKey: meta.dbKey,
11677
- changes: {
11678
- columns: newColumns,
11679
- updatedAt: nowIso
11680
- }
11863
+ changes: result.value.metaChanges
11681
11864
  })
11682
11865
  ).unwrap();
11683
- const nextMeta = {
11684
- ...meta,
11685
- columns: newColumns,
11686
- updatedAt: nowIso
11687
- };
11688
- return nextMeta;
11866
+ return result.value.meta;
11689
11867
  } catch (e) {
11690
11868
  return rejectWithValue(e.message || "\u6DFB\u52A0\u5B57\u6BB5\u5931\u8D25");
11691
11869
  }
@@ -11714,58 +11892,24 @@ var tableSlice = createSliceWithThunks3({
11714
11892
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11715
11893
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11716
11894
  }
11717
- if (!meta.columns.some((c) => c.name === columnName)) {
11718
- return rejectWithValue(`\u5B57\u6BB5 ${columnName} \u4E0D\u5B58\u5728`);
11719
- }
11720
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11721
- const newColumns = meta.columns.filter(
11722
- (c) => c.name !== columnName
11895
+ const result = deleteColumnFromMeta(
11896
+ meta,
11897
+ state3.rows,
11898
+ { columnName },
11899
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11723
11900
  );
11724
- const rows = state3.rows;
11901
+ if (!result.ok) {
11902
+ return rejectWithValue(result.error);
11903
+ }
11904
+ const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
11725
11905
  try {
11726
- const rowsWithField = rows.filter(
11727
- (row) => Object.prototype.hasOwnProperty.call(row, columnName)
11728
- );
11729
11906
  await Promise.all(
11730
- rowsWithField.map(
11731
- (row) => dispatch(
11732
- patch({
11733
- dbKey: row.dbKey,
11734
- changes: {
11735
- [columnName]: null,
11736
- updatedAt: nowIso
11737
- }
11738
- })
11739
- ).unwrap()
11740
- )
11907
+ rowPatches.map((p) => dispatch(patch(p)).unwrap())
11741
11908
  );
11742
11909
  await dispatch(
11743
- patch({
11744
- dbKey: meta.dbKey,
11745
- changes: {
11746
- columns: newColumns,
11747
- updatedAt: nowIso
11748
- }
11749
- })
11910
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11750
11911
  ).unwrap();
11751
- const newRows = rows.map((row) => {
11752
- if (!Object.prototype.hasOwnProperty.call(row, columnName)) {
11753
- return row;
11754
- }
11755
- const { [columnName]: _removed, ...rest } = row;
11756
- return {
11757
- ...rest,
11758
- updatedAt: nowIso
11759
- };
11760
- });
11761
- return {
11762
- meta: {
11763
- ...meta,
11764
- columns: newColumns,
11765
- updatedAt: nowIso
11766
- },
11767
- rows: newRows
11768
- };
11912
+ return { meta: nextMeta, rows: newRows };
11769
11913
  } catch (e) {
11770
11914
  return rejectWithValue(e.message || "\u5220\u9664\u5B57\u6BB5\u5931\u8D25");
11771
11915
  }
@@ -11795,30 +11939,22 @@ var tableSlice = createSliceWithThunks3({
11795
11939
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11796
11940
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11797
11941
  }
11798
- const columnCount = meta.columns.length;
11799
- if (fromIndex < 0 || fromIndex >= columnCount || toIndex < 0 || toIndex >= columnCount) {
11800
- return rejectWithValue("\u5217\u7D22\u5F15\u8D85\u51FA\u8303\u56F4");
11942
+ const result = reorderColumnInMeta(
11943
+ meta,
11944
+ { fromIndex, toIndex },
11945
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11946
+ );
11947
+ if (!result.ok) {
11948
+ return rejectWithValue(result.error);
11801
11949
  }
11802
- if (fromIndex === toIndex) {
11950
+ if (result.value.noop) {
11803
11951
  return meta;
11804
11952
  }
11805
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11806
- const newColumns = reorderList(meta.columns, fromIndex, toIndex);
11953
+ const { meta: nextMeta, metaChanges } = result.value;
11807
11954
  try {
11808
11955
  await dispatch(
11809
- patch({
11810
- dbKey: meta.dbKey,
11811
- changes: {
11812
- columns: newColumns,
11813
- updatedAt: nowIso
11814
- }
11815
- })
11956
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11816
11957
  ).unwrap();
11817
- const nextMeta = {
11818
- ...meta,
11819
- columns: newColumns,
11820
- updatedAt: nowIso
11821
- };
11822
11958
  return nextMeta;
11823
11959
  } catch (e) {
11824
11960
  return rejectWithValue(e.message || "\u8C03\u6574\u5217\u987A\u5E8F\u5931\u8D25");
@@ -11845,73 +11981,29 @@ var tableSlice = createSliceWithThunks3({
11845
11981
  renameColumn: create.asyncThunk(
11846
11982
  async (args, { dispatch, getState, rejectWithValue }) => {
11847
11983
  const { tenantId, tableId, oldName, newName } = args;
11848
- const trimmedNewName = newName.trim();
11849
- if (!trimmedNewName) {
11850
- return rejectWithValue("\u65B0\u7684\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
11851
- }
11852
11984
  const state3 = getState().table;
11853
11985
  const meta = state3.currentTable;
11854
11986
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11855
11987
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11856
11988
  }
11857
- if (!meta.columns.some((c) => c.name === oldName)) {
11858
- return rejectWithValue(`\u5B57\u6BB5 ${oldName} \u4E0D\u5B58\u5728`);
11859
- }
11860
- if (meta.columns.some((c) => c.name === trimmedNewName)) {
11861
- return rejectWithValue(`\u5B57\u6BB5 ${trimmedNewName} \u5DF2\u5B58\u5728`);
11862
- }
11863
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11864
- const rows = state3.rows;
11865
- const newColumns = meta.columns.map(
11866
- (c) => c.name === oldName ? { ...c, name: trimmedNewName } : c
11989
+ const result = renameColumnInMeta(
11990
+ meta,
11991
+ state3.rows,
11992
+ { oldName, newName },
11993
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11867
11994
  );
11995
+ if (!result.ok) {
11996
+ return rejectWithValue(result.error);
11997
+ }
11998
+ const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
11868
11999
  try {
11869
- const rowsWithOldField = rows.filter(
11870
- (row) => Object.prototype.hasOwnProperty.call(row, oldName)
11871
- );
11872
12000
  await Promise.all(
11873
- rowsWithOldField.map((row) => {
11874
- const changes = {
11875
- [trimmedNewName]: row[oldName],
11876
- [oldName]: null,
11877
- updatedAt: nowIso
11878
- };
11879
- return dispatch(
11880
- patch({
11881
- dbKey: row.dbKey,
11882
- changes
11883
- })
11884
- ).unwrap();
11885
- })
12001
+ rowPatches.map((p) => dispatch(patch(p)).unwrap())
11886
12002
  );
11887
12003
  await dispatch(
11888
- patch({
11889
- dbKey: meta.dbKey,
11890
- changes: {
11891
- columns: newColumns,
11892
- updatedAt: nowIso
11893
- }
11894
- })
12004
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11895
12005
  ).unwrap();
11896
- const newRows = rows.map((row) => {
11897
- if (!Object.prototype.hasOwnProperty.call(row, oldName)) {
11898
- return row;
11899
- }
11900
- const { [oldName]: oldValue, ...rest } = row;
11901
- return {
11902
- ...rest,
11903
- [trimmedNewName]: oldValue,
11904
- updatedAt: nowIso
11905
- };
11906
- });
11907
- return {
11908
- meta: {
11909
- ...meta,
11910
- columns: newColumns,
11911
- updatedAt: nowIso
11912
- },
11913
- rows: newRows
11914
- };
12006
+ return { meta: nextMeta, rows: newRows };
11915
12007
  } catch (e) {
11916
12008
  return rejectWithValue(e.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u5931\u8D25");
11917
12009
  }
@@ -11938,38 +12030,24 @@ var tableSlice = createSliceWithThunks3({
11938
12030
  renameColumnLabel: create.asyncThunk(
11939
12031
  async (args, { dispatch, getState, rejectWithValue }) => {
11940
12032
  const { tenantId, tableId, columnId, newLabel } = args;
11941
- const trimmedLabel = newLabel.trim();
11942
- if (!trimmedLabel) {
11943
- return rejectWithValue("\u5B57\u6BB5\u663E\u793A\u540D\u4E0D\u80FD\u4E3A\u7A7A");
11944
- }
11945
12033
  const state3 = getState().table;
11946
12034
  const meta = state3.currentTable;
11947
12035
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11948
12036
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11949
12037
  }
11950
- const column = meta.columns.find((c) => c.id === columnId);
11951
- if (!column) {
11952
- return rejectWithValue("\u8981\u91CD\u547D\u540D\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
11953
- }
11954
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11955
- const newColumns = meta.columns.map(
11956
- (c) => c.id === columnId ? { ...c, label: trimmedLabel } : c
12038
+ const result = renameColumnLabelInMeta(
12039
+ meta,
12040
+ { columnId, label: newLabel },
12041
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11957
12042
  );
12043
+ if (!result.ok) {
12044
+ return rejectWithValue(result.error);
12045
+ }
12046
+ const { meta: nextMeta, metaChanges } = result.value;
11958
12047
  try {
11959
12048
  await dispatch(
11960
- patch({
11961
- dbKey: meta.dbKey,
11962
- changes: {
11963
- columns: newColumns,
11964
- updatedAt: nowIso
11965
- }
11966
- })
12049
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11967
12050
  ).unwrap();
11968
- const nextMeta = {
11969
- ...meta,
11970
- columns: newColumns,
11971
- updatedAt: nowIso
11972
- };
11973
12051
  return nextMeta;
11974
12052
  } catch (e) {
11975
12053
  return rejectWithValue(e.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u663E\u793A\u540D\u5931\u8D25");
@@ -12000,30 +12078,19 @@ var tableSlice = createSliceWithThunks3({
12000
12078
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
12001
12079
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
12002
12080
  }
12003
- const column = meta.columns.find((c) => c.id === columnId);
12004
- if (!column) {
12005
- return rejectWithValue("\u8981\u8C03\u6574\u5BBD\u5EA6\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
12006
- }
12007
- const normalizedWidth = typeof width === "number" && width > 0 ? Math.round(width) : void 0;
12008
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
12009
- const newColumns = meta.columns.map(
12010
- (c) => c.id === columnId ? { ...c, width: normalizedWidth } : c
12081
+ const result = updateColumnWidthInMeta(
12082
+ meta,
12083
+ { columnId, width },
12084
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
12011
12085
  );
12086
+ if (!result.ok) {
12087
+ return rejectWithValue(result.error);
12088
+ }
12089
+ const { meta: nextMeta, metaChanges } = result.value;
12012
12090
  try {
12013
12091
  await dispatch(
12014
- patch({
12015
- dbKey: meta.dbKey,
12016
- changes: {
12017
- columns: newColumns,
12018
- updatedAt: nowIso
12019
- }
12020
- })
12092
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
12021
12093
  ).unwrap();
12022
- const nextMeta = {
12023
- ...meta,
12024
- columns: newColumns,
12025
- updatedAt: nowIso
12026
- };
12027
12094
  return nextMeta;
12028
12095
  } catch (e) {
12029
12096
  return rejectWithValue(e.message || "\u66F4\u65B0\u5B57\u6BB5\u5BBD\u5EA6\u5931\u8D25");
@@ -12256,11 +12323,11 @@ var ENTITY_DELETE_STRATEGIES = {
12256
12323
  await dispatch(deleteTable({ dbKey: key })).unwrap();
12257
12324
  },
12258
12325
  file: async (key, { thunkAPI }) => {
12259
- const { deleteFileAction } = await import("./deleteFile-WPWVZE4B.js");
12326
+ const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
12260
12327
  await deleteFileAction(key, thunkAPI);
12261
12328
  },
12262
12329
  image: async (key, { thunkAPI }) => {
12263
- const { deleteFileAction } = await import("./deleteFile-WPWVZE4B.js");
12330
+ const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
12264
12331
  await deleteFileAction(key, thunkAPI);
12265
12332
  },
12266
12333
  agent: async (key, { dispatch, userId, sourceServerOrigin }) => {
@@ -12343,9 +12410,9 @@ var deleteContentFromSpaceAction = async (input, thunkAPI) => {
12343
12410
  sourceServerOrigin
12344
12411
  });
12345
12412
  }
12346
- } catch (err) {
12347
- console.error(`[deleteContent] Failed to delete entity ${entityKey}:`, err);
12348
- entityRemoveError = err.message || "Unknown error";
12413
+ } catch (err2) {
12414
+ console.error(`[deleteContent] Failed to delete entity ${entityKey}:`, err2);
12415
+ entityRemoveError = err2.message || "Unknown error";
12349
12416
  }
12350
12417
  return {
12351
12418
  contentKey,
@@ -13666,8 +13733,8 @@ async function resolveMemberId(db, identifier) {
13666
13733
  matchCount++;
13667
13734
  }
13668
13735
  }
13669
- } catch (err) {
13670
- logger.warn({ err, identifier: trimmed }, "Failed to scan users by username");
13736
+ } catch (err2) {
13737
+ logger.warn({ err: err2, identifier: trimmed }, "Failed to scan users by username");
13671
13738
  }
13672
13739
  if (matchCount > 1) {
13673
13740
  throw new Error(
@@ -13853,8 +13920,8 @@ async function getUserDataOnce({
13853
13920
  const localResults = await fetchUserData(db, typeArray, effectiveUserId);
13854
13921
  const localData = Object.values(localResults).flat();
13855
13922
  return { data: localData };
13856
- } catch (err) {
13857
- const error = err instanceof Error ? err : new Error("Unknown error occurred");
13923
+ } catch (err2) {
13924
+ const error = err2 instanceof Error ? err2 : new Error("Unknown error occurred");
13858
13925
  return { data: [], error };
13859
13926
  }
13860
13927
  }
@@ -14203,8 +14270,8 @@ var deleteDbKey = (input, spaceId) => async (dispatch, getState) => {
14203
14270
  spaceId: spaceId2,
14204
14271
  ...preferredServerOrigin ? { sourceServerOrigin: preferredServerOrigin } : {}
14205
14272
  })
14206
- ).unwrap().catch((err) => {
14207
- console.warn("[deleteDbKey] space cleanup failed (entity already tombstoned):", err);
14273
+ ).unwrap().catch((err2) => {
14274
+ console.warn("[deleteDbKey] space cleanup failed (entity already tombstoned):", err2);
14208
14275
  })
14209
14276
  )
14210
14277
  );
@@ -14310,10 +14377,10 @@ var deleteLocalSpaceAuthority = async (spaceId, spaceData, dispatch) => {
14310
14377
  },
14311
14378
  dispatch
14312
14379
  );
14313
- } catch (err) {
14380
+ } catch (err2) {
14314
14381
  console.warn(
14315
14382
  `Failed to tombstone local membership ${memberId} for space ${spaceId}:`,
14316
- err
14383
+ err2
14317
14384
  );
14318
14385
  }
14319
14386
  }
@@ -14323,9 +14390,9 @@ var deleteAllMembers = async (spaceData, spaceId, dispatch) => {
14323
14390
  for (const memberId of spaceData.members) {
14324
14391
  const memberKey = createSpaceKey.member(memberId, spaceId);
14325
14392
  await dispatch(remove(memberKey)).unwrap().catch(
14326
- (err) => console.warn(
14393
+ (err2) => console.warn(
14327
14394
  `Failed to delete member ${memberId} for space ${spaceId}:`,
14328
- err
14395
+ err2
14329
14396
  )
14330
14397
  );
14331
14398
  }
@@ -14334,9 +14401,9 @@ var deleteAllMembers = async (spaceData, spaceId, dispatch) => {
14334
14401
  var deleteCurrentUserMember = async (userId, spaceId, dispatch) => {
14335
14402
  const currentUserMemberKey = createSpaceKey.member(userId, spaceId);
14336
14403
  await dispatch(remove(currentUserMemberKey)).unwrap().catch(
14337
- (err) => console.warn(
14404
+ (err2) => console.warn(
14338
14405
  `Failed to delete member key for user ${userId} in space ${spaceId}:`,
14339
- err
14406
+ err2
14340
14407
  )
14341
14408
  );
14342
14409
  };
@@ -14455,7 +14522,7 @@ var fetchSpaceAction = async (input, thunkAPI) => {
14455
14522
  const spaceKey = createSpaceKey.space(spaceId);
14456
14523
  const readSpace = async (dbKey) => {
14457
14524
  try {
14458
- const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-OP6UPXKA.js");
14525
+ const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-CGSRFJN3.js");
14459
14526
  if (fresh) {
14460
14527
  return await dispatch(readAndWait2(dbKey)).unwrap();
14461
14528
  }
@@ -15144,6 +15211,7 @@ export {
15144
15211
  parseUiAskChoiceContent,
15145
15212
  PERSONALIZATION_DIALOG_CATEGORY,
15146
15213
  buildPersonalizationDialogPolicyContext,
15214
+ resolveDialogRuntimeAgentKey,
15147
15215
  resolveHandleSendMessageContext,
15148
15216
  estimateMissingUsage,
15149
15217
  selectCurrentDialogId,
@@ -15158,6 +15226,7 @@ export {
15158
15226
  messageStreamEnd,
15159
15227
  addToolMessage,
15160
15228
  updateToolMessage,
15229
+ appendOverlayMessage,
15161
15230
  setWorkflow,
15162
15231
  updateStep,
15163
15232
  incrementStepsExecuted,