nolo-cli 0.16.0 → 0.17.0

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 (132) hide show
  1. package/{_executeModel-AVCA2NAV.js → _executeModel-WPNX5DH4.js} +49 -43
  2. package/{action-F5JACQBG.js → action-LT7BRFLK.js} +10 -9
  3. package/{addContentAction-AQXEYRBE.js → addContentAction-PL3KKBDH.js} +9 -8
  4. package/{addDialogAgentAction-EJHHJZWW.js → addDialogAgentAction-FCMSKYAF.js} +8 -7
  5. package/{agentDeleteCommand-QW5PUMDQ.js → agentDeleteCommand-L3357EFL.js} +31 -28
  6. package/{agentEmailCommands-4ORVLGVQ.js → agentEmailCommands-N65AVLEI.js} +61 -55
  7. package/{agentListCommands-YWBYRTYC.js → agentListCommands-CH27FTI2.js} +30 -27
  8. package/{agentMachineCommands-JSQW4FOA.js → agentMachineCommands-PPK5HJZB.js} +29 -26
  9. package/{agentPullCommand-6HWUT3SW.js → agentPullCommand-ZZGU5KOY.js} +4 -4
  10. package/{agentRecordCommands-AASIWOBT.js → agentRecordCommands-HTVXD4TT.js} +56 -50
  11. package/{agentRunCommand-TB5BHXUH.js → agentRunCommand-MGLVJUA5.js} +62 -53
  12. package/{agentRunControl-6ADXVYMR.js → agentRunControl-P75VPTGS.js} +24 -1
  13. package/{agentRuntimeLocal-QNPNJRVH.js → agentRuntimeLocal-QUTBSY3I.js} +24 -21
  14. package/{agentSlice-RUNXC62Y.js → agentSlice-DOGRCMWK.js} +9 -8
  15. package/appDeleteCommands-FEEVXUBG.js +127 -0
  16. package/appDeployCommands-C4HCGC4B.js +166 -0
  17. package/appDeployStatusCommands-IR5ZUZBQ.js +147 -0
  18. package/appGetCommands-6RJGZ66Z.js +122 -0
  19. package/appListCommands-VMTF5YZF.js +125 -0
  20. package/{authCommand-YFTR3347.js → authCommand-WJZPOLSS.js} +16 -9
  21. package/{authCommands-YXGOXNBZ.js → authCommands-XTBV7OFZ.js} +6 -5
  22. package/{chunk-XPC5C7BK.js → chunk-3ND52WIL.js} +2 -2
  23. package/{chunk-SOTZ6RDN.js → chunk-3Q7WHGCB.js} +1 -1
  24. package/{chunk-M43KDE25.js → chunk-45BY7RLP.js} +2 -8
  25. package/{chunk-KKY4B2Q2.js → chunk-4PWB7JRR.js} +4 -1
  26. package/{chunk-6N4KODMN.js → chunk-4T5F7YZQ.js} +1 -1
  27. package/chunk-7BUYEZ6U.js +671 -0
  28. package/{chunk-AS3ZQ3O2.js → chunk-7OBMZCRD.js} +1 -1
  29. package/{chunk-AVVZUXXC.js → chunk-AAODAAUQ.js} +34 -13
  30. package/{chunk-QLUFR47U.js → chunk-AL2V7U3E.js} +1 -1
  31. package/{chunk-MTU75CZ2.js → chunk-B5TOXZAK.js} +1 -1
  32. package/{chunk-AUURUT6L.js → chunk-BT6K76S7.js} +238 -424
  33. package/chunk-CEFXYF66.js +107 -0
  34. package/{chunk-RLCXU7A5.js → chunk-D3HVJJIA.js} +1 -1
  35. package/{chunk-JTMNCCWF.js → chunk-DKZFOK24.js} +16 -87
  36. package/chunk-DL6EPNIK.js +50 -0
  37. package/{chunk-4L2OJPCU.js → chunk-EGPCU42M.js} +58 -8
  38. package/{chunk-IWLUTMYX.js → chunk-ELT65PZW.js} +2 -2
  39. package/chunk-FKXFCYVO.js +221 -0
  40. package/{chunk-4FX6NVDW.js → chunk-FPKLD4KB.js} +3 -136
  41. package/{chunk-PCTUYVUM.js → chunk-FVIPEIVX.js} +10 -3
  42. package/chunk-GFUIQ4RY.js +136 -0
  43. package/{chunk-66X4VSRC.js → chunk-HQPG2PIV.js} +41 -1
  44. package/{chunk-IGXREZW2.js → chunk-HV2A3B4W.js} +1 -1
  45. package/{chunk-LPEUV5RE.js → chunk-IOOMJJ4Z.js} +2 -2
  46. package/{setDialogExtraReferencesAction-LR6MSIXO.js → chunk-JLA4FXYC.js} +2 -17
  47. package/{chunk-3OIRVWXA.js → chunk-JP7REMYP.js} +10 -1
  48. package/chunk-KFEVY3ST.js +255 -0
  49. package/{chunk-P3RIAYGG.js → chunk-L2MLZQXU.js} +3 -3
  50. package/{chunk-55NSNCFM.js → chunk-L6NVTGI7.js} +1 -1
  51. package/{chunk-3WGLLTK4.js → chunk-LSFAWXKC.js} +100 -3
  52. package/{chunk-S2LXHNHG.js → chunk-MD3V54DA.js} +6 -6
  53. package/{chunk-6EVITP2G.js → chunk-MUCU6ATG.js} +2 -251
  54. package/{chunk-KFHN5NGJ.js → chunk-MVQ4TBSD.js} +1 -1
  55. package/{chunk-ZQBL7LIC.js → chunk-NEKFSXOP.js} +310 -211
  56. package/{chunk-NSCHQQPU.js → chunk-NVB267BZ.js} +397 -324
  57. package/{chunk-Z5JQNBNY.js → chunk-NYUXSXLY.js} +33 -14
  58. package/{chunk-FRV6A633.js → chunk-PZCBZO4J.js} +2 -2
  59. package/{chunk-GSINCD4P.js → chunk-QCJITMYO.js} +21 -11
  60. package/{chunk-OOSFSFMA.js → chunk-R5V5G73M.js} +2 -0
  61. package/{chunk-4IJYA27C.js → chunk-RG2U2MTJ.js} +1 -1
  62. package/{chunk-BEBNFWDU.js → chunk-RRGVDPH3.js} +3 -3
  63. package/{chunk-EABWT43X.js → chunk-RVOUXDFU.js} +5 -5
  64. package/{chunk-JTINRTBT.js → chunk-SKDNBYZK.js} +2 -2
  65. package/{chunk-3663CXZN.js → chunk-SNZV4QCE.js} +65 -22
  66. package/{chunk-KMQPSTMJ.js → chunk-TRT4I4UD.js} +2 -2
  67. package/{chunk-MYMMNKYL.js → chunk-TSIYZBTH.js} +156 -6
  68. package/{chunk-EHLHSX7R.js → chunk-UB4RYYNQ.js} +9 -2
  69. package/{chunk-YJKXGHJ6.js → chunk-UGUW3FHG.js} +4 -4
  70. package/{chunk-DPAB4FQ7.js → chunk-UZY4BEBR.js} +1579 -212
  71. package/chunk-V5R4NZP2.js +78 -0
  72. package/{chunk-MR6ISAGB.js → chunk-VDNQF5VI.js} +6 -6
  73. package/{chunk-33BJUVK4.js → chunk-VGMJ6PDJ.js} +5 -5
  74. package/{chunk-W4NVOSFF.js → chunk-WFHXMLHZ.js} +1 -1
  75. package/{chunk-H33743XH.js → chunk-WJRJDX2W.js} +1 -1
  76. package/chunk-X4Q4UZEY.js +26 -0
  77. package/{chunk-RPDGJO4D.js → chunk-XHG22OEX.js} +4 -4
  78. package/{chunk-DVRHHFEA.js → chunk-XMLRJUU5.js} +1 -1
  79. package/{chunk-3S2VOMIF.js → chunk-XRZJGPFI.js} +7 -7
  80. package/{chunk-7UKFVQ5W.js → chunk-YLRTBX4Y.js} +105 -36
  81. package/{chunk-DGEYDWEZ.js → chunk-YXTRNO5W.js} +3 -3
  82. package/{chunk-FY233ZFU.js → chunk-ZJZCMKOR.js} +107 -177
  83. package/{chunk-NVEWUJVX.js → chunk-ZVOZH2HW.js} +1 -1
  84. package/chunk-ZZ2MH7LE.js +84 -0
  85. package/{cliExecutor-K3F7DMRO.js → cliExecutor-DNE7TCC4.js} +2 -2
  86. package/codingSkills-36KN5NQT.js +48 -0
  87. package/{createAgentAutomationAction-FNHPSKKO.js → createAgentAutomationAction-PMOLEPGJ.js} +19 -18
  88. package/{createDialogAction-TZCVQ3NU.js → createDialogAction-DPRTYNAK.js} +21 -20
  89. package/{createPageAction-EIGZ3BKT.js → createPageAction-JGZK3WAM.js} +25 -24
  90. package/{dbSlice-7KQH6GOU.js → dbSlice-CGSRFJN3.js} +8 -7
  91. package/{deleteFile-WPWVZE4B.js → deleteFile-WDZ3VM7B.js} +3 -3
  92. package/{dialogCommands-FO77J5DQ.js → dialogCommands-XED6DKLV.js} +29 -26
  93. package/{dialogSlice-MM5U4KE2.js → dialogSlice-KO4NRNKC.js} +19 -18
  94. package/{docCreateCommands-I3BS3AZI.js → docCreateCommands-P6DYWHH3.js} +32 -27
  95. package/{docDeleteCommands-Q2OPV52P.js → docDeleteCommands-KUWXAMSN.js} +31 -26
  96. package/{docReadCommands-YOOFACYZ.js → docReadCommands-ECW55TKB.js} +30 -25
  97. package/{docStore-NGYQ2JTR.js → docStore-6KMERNUY.js} +20 -19
  98. package/{docUpdateCommands-2B32ITHN.js → docUpdateCommands-5J4BTJQN.js} +31 -26
  99. package/{fetchMessages-KTNM7QAR.js → fetchMessages-BMGVZVSE.js} +4 -3
  100. package/{getPricing-P4XRJRZB.js → getPricing-RYY6OBA4.js} +2 -2
  101. package/{handleSendMessageAction-JRZWWBKP.js → handleSendMessageAction-R3ZHTVU4.js} +20 -19
  102. package/index.js +95 -64
  103. package/{localDialogRead-2VRI24F4.js → localDialogRead-HQZPVIE3.js} +1 -1
  104. package/{localRuntimeDb-LGDF6FQP.js → localRuntimeDb-THJZGAOJ.js} +1 -1
  105. package/{machineCommands-WRWF2ICZ.js → machineCommands-JF2YL34J.js} +62 -56
  106. package/{machineWsRunDispatch-ZX7Q3TWZ.js → machineWsRunDispatch-ON4AEOJL.js} +54 -48
  107. package/{models-WQ5N4OJM.js → models-5K5G2CZI.js} +1 -1
  108. package/package.json +1 -1
  109. package/queryRunOverlay-O4LOMMPO.js +161 -0
  110. package/{read-CN3TNXIP.js → read-3FMPZPER.js} +3 -3
  111. package/{readDocTool-WF3675ED.js → readDocTool-VSYHKK3V.js} +1 -1
  112. package/{readlineWorkspace-ZTGRGW46.js → readlineWorkspace-SUCINTL7.js} +354 -185
  113. package/{removeDialogAgentAction-YDHBFEGI.js → removeDialogAgentAction-OAGA2G3U.js} +10 -9
  114. package/{runAgentClientLoop-JZCOP7LG.js → runAgentClientLoop-OBD2AVEL.js} +43 -37
  115. package/runOverlayPresentation-ZO4VCWEU.js +11 -0
  116. package/{runtimeDoctorCommands-THIHX2SY.js → runtimeDoctorCommands-E2OUORHK.js} +6 -6
  117. package/setDialogExtraReferencesAction-JZEXA5SL.js +27 -0
  118. package/{setPrimaryDialogAgentAction-IIVDCY5C.js → setPrimaryDialogAgentAction-4ZUQQKDG.js} +26 -17
  119. package/{settingSlice-O23YDK2O.js → settingSlice-7MNKHZ6R.js} +9 -8
  120. package/{skillDiscovery-6M2BZUFN.js → skillDiscovery-KJWT7JBU.js} +3 -3
  121. package/{spaceCommands-VV4GTPQK.js → spaceCommands-32NTNLHS.js} +30 -27
  122. package/{spaceSlice-DRWWZJP7.js → spaceSlice-P7VOXLY6.js} +19 -18
  123. package/{streamAgentChatTurn-Y6WGATQR.js → streamAgentChatTurn-UHEMNI3X.js} +97 -56
  124. package/{tableCommands-3P7MJ3PF.js → tableCommands-BEQAGE4I.js} +1 -1
  125. package/{tools-PUNBY3AH.js → tools-BMXIXHMB.js} +32 -27
  126. package/{tuiSummaryLlmCaller-F64WLSAF.js → tuiSummaryLlmCaller-VUNVBRX3.js} +5 -4
  127. package/types-ZSTJ7MPR.js +7 -0
  128. package/{updateDialogTitleAction-YSR4TCMB.js → updateDialogTitleAction-LJBDYZLH.js} +22 -21
  129. package/{chunk-O4BU24WZ.js → chunk-6Y7A3OQQ.js} +3 -3
  130. package/{chunk-XBS2WYJ2.js → chunk-RK5NYQEL.js} +0 -0
  131. package/{chunk-CMKUBIGW.js → chunk-X7W4TNB4.js} +3 -3
  132. package/{localRuntimeAuthority-TEGCOWX4.js → localRuntimeAuthority-4IXJCHZ7.js} +3 -3
@@ -2,26 +2,23 @@ import {
2
2
  BUILTIN_SUMMARY_LLM_CONFIG,
3
3
  buildBuiltinSummaryContent
4
4
  } from "./chunk-XOIF2TNF.js";
5
- import {
6
- authRoutes
7
- } from "./chunk-MRC4Q34M.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-S2LXHNHG.js";
15
+ } from "./chunk-MD3V54DA.js";
19
16
  import {
20
- cleanupCliSessionForDialog
21
- } from "./chunk-RPDGJO4D.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-4L2OJPCU.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-66X4VSRC.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-EABWT43X.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-IWLUTMYX.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-3S2VOMIF.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-XPC5C7BK.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,6 +3637,11 @@ 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",
3641
+ "",
3642
+ "\u63A8\u8350 & \u6743\u8861\u8BF4\u660E\uFF1A",
3643
+ "- \u82E5\u6709\u660E\u786E\u63A8\u8350\u65B9\u5411\uFF0C\u628A\u5B83\u653E\u5728 choices \u7684\u7B2C\u4E00\u4F4D\uFF0C\u5E76\u7ED9\u8BE5\u9009\u9879\u6807 recommended: true\u3002",
3644
+ "- \u82E5\u6CA1\u6709\u660E\u786E\u63A8\u8350\u9879\uFF0C\u5219\u5728\u8C03\u7528\u524D\u7684\u666E\u901A\u56DE\u590D\u6587\u672C\u91CC\u7B80\u8981\u8BF4\u660E\u6BCF\u4E2A\u9009\u9879\u7684\u4F18\u7F3A\u70B9\uFF08\u6216\u5404\u9009\u9879\u7684\u5173\u952E\u5DEE\u5F02\uFF09\uFF0C\u5E2E\u52A9\u7528\u6237\u6743\u8861\uFF0C\u800C\u4E0D\u662F\u5217\u51FA\u9009\u9879\u5C31\u5B8C\u4E8B\u3002",
3638
3645
  "",
3639
3646
  "\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"
3640
3647
  ].join("\n"),
@@ -3663,6 +3670,13 @@ var uiAskChoiceFunctionSchema = {
3663
3670
  type: "string",
3664
3671
  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
3672
  },
3673
+ recommended: {
3674
+ type: "boolean",
3675
+ description: [
3676
+ "\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",
3677
+ "\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"
3678
+ ].join(" ")
3679
+ },
3666
3680
  userMessage: {
3667
3681
  type: "string",
3668
3682
  description: [
@@ -3701,6 +3715,10 @@ var uiAskChoiceFunctionSchema = {
3701
3715
  type: "string",
3702
3716
  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
3717
  },
3718
+ recommended: {
3719
+ type: "boolean",
3720
+ 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"
3721
+ },
3704
3722
  userMessage: { type: "string" }
3705
3723
  },
3706
3724
  required: ["id", "label"]
@@ -3743,7 +3761,7 @@ async function uiAskChoiceFunc(args, _thunkApi) {
3743
3761
  const firstQ = args.questions[0];
3744
3762
  return {
3745
3763
  rawData: {
3746
- type: "ui_ask_choice",
3764
+ type: "ask_user",
3747
3765
  question: firstQ?.question ?? "",
3748
3766
  choices: firstQ?.choices ?? [],
3749
3767
  blocking,
@@ -3755,11 +3773,11 @@ async function uiAskChoiceFunc(args, _thunkApi) {
3755
3773
  const question = String(args?.question ?? "").trim();
3756
3774
  const choices = Array.isArray(args?.choices) ? args.choices : [];
3757
3775
  if (!question || choices.length === 0) {
3758
- throw new Error("ui_ask_choice \u9700\u8981 question+choices \u6216 questions\u3002");
3776
+ throw new Error("ask_user \u9700\u8981 question+choices \u6216 questions\u3002");
3759
3777
  }
3760
3778
  return {
3761
3779
  rawData: {
3762
- type: "ui_ask_choice",
3780
+ type: "ask_user",
3763
3781
  question,
3764
3782
  choices,
3765
3783
  blocking
@@ -3776,14 +3794,14 @@ function parseUiAskChoiceContent(rawContent) {
3776
3794
  }
3777
3795
  })() : rawContent;
3778
3796
  if (!parsed || typeof parsed !== "object") return null;
3779
- if (parsed.type !== "ui_ask_choice") return null;
3797
+ if (parsed.type !== "ask_user") return null;
3780
3798
  return parsed;
3781
3799
  }
3782
3800
 
3783
3801
  // packages/ai/policy/personalizationDialog.ts
3784
3802
  var PERSONALIZATION_DIALOG_CATEGORY = "user-overlay-profile";
3785
3803
  var PERSONALIZATION_DIALOG_EXTRA_TOOLS = [
3786
- "ui_ask_choice",
3804
+ "ask_user",
3787
3805
  "updateUserPreferenceProfile"
3788
3806
  ];
3789
3807
  var buildPersonalizationRuntimeOptions = (runtimeOptions) => ({
@@ -3799,20 +3817,41 @@ var buildPersonalizationDialogPolicyContext = () => [
3799
3817
  "\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
3818
  "\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
3819
  "\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",
3820
+ "\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
3821
  "\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
3822
  "\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
3823
  "\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
3824
  "\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
3825
  ].join("\n");
3808
3826
 
3827
+ // packages/chat/dialog/dialogAgentPolicy.ts
3828
+ var resolveDialogAgentMode = (dialog) => {
3829
+ if (dialog?.agentMode === "auto") return "auto";
3830
+ if (dialog?.agentMode === "fixed") return "fixed";
3831
+ return getPrimaryDialogAgentId(dialog) ? "fixed" : "auto";
3832
+ };
3833
+ var resolveDialogAutoTier = (dialog) => {
3834
+ const tier = asOptionalTrimmedString(dialog?.autoRoute?.stickyTier);
3835
+ return tier === "flash" || tier === "balanced" || tier === "quality" || tier === "image" ? tier : void 0;
3836
+ };
3837
+ var resolveDialogRuntimeAgentKey = (dialog, explicitAgentKey) => {
3838
+ const explicit = asOptionalTrimmedString(explicitAgentKey);
3839
+ if (explicit) return explicit;
3840
+ if (resolveDialogAgentMode(dialog) === "fixed") {
3841
+ const fixed = getPrimaryDialogAgentId(dialog);
3842
+ if (fixed) return fixed;
3843
+ }
3844
+ return resolveAutoExecutionProfile(
3845
+ resolveDialogAutoTier(dialog) ?? DEFAULT_AUTO_EXECUTION_PROFILE.tier
3846
+ ).legacyAgentKey;
3847
+ };
3848
+
3809
3849
  // packages/chat/dialog/actions/handleSendMessageResolver.ts
3810
3850
  function resolveHandleSendMessageContext(input) {
3811
3851
  const { dialogConfig, targetAgentKey, runtimeOptions } = input;
3812
- const defaultAgentKey = getPrimaryDialogAgentId(dialogConfig) ?? void 0;
3813
3852
  return {
3814
- agentKeyToUse: targetAgentKey || defaultAgentKey,
3815
- effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(runtimeOptions) : runtimeOptions
3853
+ agentKeyToUse: resolveDialogRuntimeAgentKey(dialogConfig, targetAgentKey),
3854
+ effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(runtimeOptions ?? {}) : runtimeOptions
3816
3855
  };
3817
3856
  }
3818
3857
 
@@ -4601,6 +4640,7 @@ async function captureUnderstandingFromCompletedUiTurn(input) {
4601
4640
  const token = typeof state3?.auth?.currentToken === "string" ? state3.auth.currentToken : null;
4602
4641
  const baseUrl = resolveMemoryCaptureBaseUrl(state3);
4603
4642
  if (!token || !baseUrl) return;
4643
+ const dialog = input.dialogKey ? selectById(state3, input.dialogKey) : void 0;
4604
4644
  try {
4605
4645
  await fetch(`${baseUrl}/api/memory/capture-turn`, {
4606
4646
  method: "POST",
@@ -4944,6 +4984,33 @@ var messageSlice = createSliceWithThunks({
4944
4984
  });
4945
4985
  }
4946
4986
  }),
4987
+ /**
4988
+ * Append a run-overlay presentation as a non-streaming assistant message.
4989
+ *
4990
+ * This is a pure UI presentation action — it does NOT trigger a new agent
4991
+ * turn, does NOT call the LLM, and is therefore not billed. The message
4992
+ * is upserted into the dialog's message list so the user sees the run
4993
+ * status snapshot at turn-end. A fresh message id/dbKey are minted from
4994
+ * the dialog id so repeated overlays across turns don't collide.
4995
+ *
4996
+ * The message is marked role:"assistant" with isStreaming:false. Callers
4997
+ * that want to keep it out of the LLM context can post-filter by the
4998
+ * `metadata.overlayMessage` flag set here.
4999
+ */
5000
+ appendOverlayMessage: create.reducer((state3, action2) => {
5001
+ const dialogId = extractCustomId(action2.payload.dialogKey);
5002
+ if (!dialogId) return;
5003
+ const dialogState = ensureMessageDialogState(state3, dialogId);
5004
+ const { key: msgKey, messageId } = createDialogMessageKeyAndId(dialogId);
5005
+ upsertOneMessage(dialogState, {
5006
+ id: messageId,
5007
+ dbKey: msgKey,
5008
+ role: "assistant",
5009
+ content: action2.payload.text,
5010
+ isStreaming: false,
5011
+ metadata: { overlayMessage: true }
5012
+ });
5013
+ }),
4947
5014
  prepareAndPersistMessage: create.asyncThunk(
4948
5015
  async (args, thunkApi) => {
4949
5016
  const { message, dialogConfig } = args;
@@ -4969,7 +5036,7 @@ var messageSlice = createSliceWithThunks({
4969
5036
  content: message.content,
4970
5037
  dialogKey
4971
5038
  })
4972
- ).catch((err) => console.error("Failed to add refs:", err));
5039
+ ).catch((err2) => console.error("Failed to add refs:", err2));
4973
5040
  dispatch(messageActions.addUserMessage({ ...fullMessage, dialogId }));
4974
5041
  const { controller, ...messageToWrite } = fullMessage;
4975
5042
  await dispatch(
@@ -5036,8 +5103,8 @@ var messageSlice = createSliceWithThunks({
5036
5103
  messages: finalMessages2.filter(isValidMessage)
5037
5104
  })
5038
5105
  );
5039
- }).catch((err) => {
5040
- console.error("[initMsgs] background remote revalidate failed:", err);
5106
+ }).catch((err2) => {
5107
+ console.error("[initMsgs] background remote revalidate failed:", err2);
5041
5108
  });
5042
5109
  return validLocalMessages;
5043
5110
  }
@@ -5054,7 +5121,7 @@ var messageSlice = createSliceWithThunks({
5054
5121
  updateDialogSummaryAction(
5055
5122
  { dialogKey: decision.dialogKey, preFetchedMessages: finalMessages },
5056
5123
  thunkApi
5057
- ).catch((err) => console.error("Resume summary failed:", err));
5124
+ ).catch((err2) => console.error("Resume summary failed:", err2));
5058
5125
  }
5059
5126
  } catch {
5060
5127
  console.error("[initMsgs] Failed to resume summary");
@@ -5360,12 +5427,12 @@ var messageSlice = createSliceWithThunks({
5360
5427
  reason: summaryReason
5361
5428
  },
5362
5429
  { dispatch, getState }
5363
- ).catch((err) => console.error("Summary update failed:", err));
5430
+ ).catch((err2) => console.error("Summary update failed:", err2));
5364
5431
  if (addRefs) {
5365
5432
  dispatch(addReferenceKeysAction({
5366
5433
  content: finalVisibleContent,
5367
5434
  dialogKey
5368
- })).catch((err) => console.error("Failed to add assistant refs:", err));
5435
+ })).catch((err2) => console.error("Failed to add assistant refs:", err2));
5369
5436
  }
5370
5437
  }
5371
5438
  captureUnderstandingFromCompletedUiTurn2({
@@ -5377,7 +5444,7 @@ var messageSlice = createSliceWithThunks({
5377
5444
  assistantText: textContent,
5378
5445
  toolCalls
5379
5446
  }).catch(
5380
- (err) => console.error("Understanding memory capture failed:", err)
5447
+ (err2) => console.error("Understanding memory capture failed:", err2)
5381
5448
  );
5382
5449
  return {
5383
5450
  id: messageId,
@@ -5529,7 +5596,7 @@ var messageSlice = createSliceWithThunks({
5529
5596
  runtimeOptions: args.runtimeOptions
5530
5597
  });
5531
5598
  if (agentKeyToUse) {
5532
- const { streamAgentChatTurn } = await import("./agentSlice-RUNXC62Y.js");
5599
+ const { streamAgentChatTurn } = await import("./agentSlice-DOGRCMWK.js");
5533
5600
  await dispatch(
5534
5601
  streamAgentChatTurn({
5535
5602
  agentKey: agentKeyToUse,
@@ -5585,7 +5652,8 @@ var {
5585
5652
  editUserMessageAndReplay,
5586
5653
  addToolMessage,
5587
5654
  updateToolMessage,
5588
- removeMessagesByIds
5655
+ removeMessagesByIds,
5656
+ appendOverlayMessage
5589
5657
  } = messageSlice.actions;
5590
5658
  var messageSlice_default = messageSlice.reducer;
5591
5659
 
@@ -8000,7 +8068,7 @@ var saveTokenUsage = async (data, thunkApi) => {
8000
8068
  currentStats = await thunkApi.dispatch(read({
8001
8069
  dbKey: tokenDayStatsKey
8002
8070
  })).unwrap();
8003
- } catch (err) {
8071
+ } catch (err2) {
8004
8072
  logger3.warn({ tokenDayStatsKey }, "No existing stats found");
8005
8073
  }
8006
8074
  const updatedStats = await updateStats(
@@ -8187,7 +8255,7 @@ var deleteOwnedDialogAttachments = async (args) => {
8187
8255
  metadataReadFailures
8188
8256
  });
8189
8257
  if (!plan.deleteCandidates.length) return plan;
8190
- const { deleteFileAction } = await import("./deleteFile-WPWVZE4B.js");
8258
+ const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
8191
8259
  for (const candidate of plan.deleteCandidates) {
8192
8260
  if (candidate.fileDbKey) {
8193
8261
  await deleteFileAction(candidate.fileDbKey, args.thunkApi);
@@ -8249,7 +8317,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8249
8317
  }
8250
8318
  if (isCurrentDialog) {
8251
8319
  await thunkApi.dispatch(resetMsgs());
8252
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-MM5U4KE2.js");
8320
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-KO4NRNKC.js");
8253
8321
  dispatch(clearPendingAttachments2());
8254
8322
  clearWorkflow();
8255
8323
  }
@@ -8258,35 +8326,35 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8258
8326
 
8259
8327
  // packages/chat/dialog/dialogSlice.ts
8260
8328
  var runCreateDialogAction = async (args, thunkApi) => {
8261
- const { createDialogAction } = await import("./createDialogAction-TZCVQ3NU.js");
8329
+ const { createDialogAction } = await import("./createDialogAction-DPRTYNAK.js");
8262
8330
  return createDialogAction(args, thunkApi);
8263
8331
  };
8264
8332
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
8265
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-FNHPSKKO.js");
8333
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-PMOLEPGJ.js");
8266
8334
  return createAgentAutomationAction(args, thunkApi);
8267
8335
  };
8268
8336
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
8269
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-YSR4TCMB.js");
8337
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-LJBDYZLH.js");
8270
8338
  return updateDialogTitleAction(args, thunkApi);
8271
8339
  };
8272
8340
  var runAddDialogAgentAction = async (args, thunkApi) => {
8273
- const { addDialogAgentAction } = await import("./addDialogAgentAction-EJHHJZWW.js");
8341
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-FCMSKYAF.js");
8274
8342
  return addDialogAgentAction(args, thunkApi);
8275
8343
  };
8276
8344
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
8277
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-YDHBFEGI.js");
8345
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-OAGA2G3U.js");
8278
8346
  return removeDialogAgentAction(args, thunkApi);
8279
8347
  };
8280
8348
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
8281
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-IIVDCY5C.js");
8349
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-4ZUQQKDG.js");
8282
8350
  return setPrimaryDialogAgentAction(args, thunkApi);
8283
8351
  };
8284
8352
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
8285
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-LR6MSIXO.js");
8353
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-JZEXA5SL.js");
8286
8354
  return setDialogExtraReferencesAction(args, thunkApi);
8287
8355
  };
8288
8356
  var runHandleSendMessageAction = async (args, thunkApi) => {
8289
- const { handleSendMessageAction } = await import("./handleSendMessageAction-JRZWWBKP.js");
8357
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-R3ZHTVU4.js");
8290
8358
  return handleSendMessageAction(args, thunkApi);
8291
8359
  };
8292
8360
  function clearDialogState() {
@@ -8299,7 +8367,7 @@ var createPageAndAddReference = createAsyncThunk(
8299
8367
  async (payload, { dispatch, getState, rejectWithValue }) => {
8300
8368
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
8301
8369
  try {
8302
- const { createDocState } = await import("./docStore-NGYQ2JTR.js");
8370
+ const { createDocState } = await import("./docStore-6KMERNUY.js");
8303
8371
  const pageKey = await createDocState(
8304
8372
  { slateData, title },
8305
8373
  { dispatch, getState }
@@ -8354,12 +8422,12 @@ var initDialog = createAsyncThunk(
8354
8422
  })
8355
8423
  ).unwrap();
8356
8424
  } catch (error) {
8357
- const err = error;
8358
- const isAborted = isAbortError(err) || err?.message === "Aborted";
8425
+ const err2 = error;
8426
+ const isAborted = isAbortError(err2) || err2?.message === "Aborted";
8359
8427
  const isCurrentDialog = getActiveDialogKey() === id;
8360
8428
  if (!isAborted && isCurrentDialog) {
8361
- setDialogConfigError(err?.message || "Failed to load dialog");
8362
- console.info("Failed to load dialog config:", err?.message);
8429
+ setDialogConfigError(err2?.message || "Failed to load dialog");
8430
+ console.info("Failed to load dialog config:", err2?.message);
8363
8431
  }
8364
8432
  throw error;
8365
8433
  }
@@ -8527,9 +8595,9 @@ var fetchTableRowsFromServer = async (server, tenantId, tableId, headers) => {
8527
8595
  if (!res.ok) {
8528
8596
  let msg = `\u52A0\u8F7D\u8868 ${tableId} \u884C\u5931\u8D25\uFF08${res.status}\uFF09`;
8529
8597
  try {
8530
- const err = await res.json();
8531
- if (err && typeof err.message === "string") {
8532
- msg = err.message;
8598
+ const err2 = await res.json();
8599
+ if (err2 && typeof err2.message === "string") {
8600
+ msg = err2.message;
8533
8601
  }
8534
8602
  } catch {
8535
8603
  }
@@ -8654,6 +8722,140 @@ var fetchAndCacheTableRows = async ({
8654
8722
  return tableDeleted ? [] : mergedRows.filter((row) => !row?.deletedAt);
8655
8723
  };
8656
8724
 
8725
+ // packages/render/table/tableColumnCore.ts
8726
+ var ok = (value) => ({ ok: true, value });
8727
+ var err = (error) => ({ ok: false, error });
8728
+ var hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
8729
+ var buildMeta = (meta, columns, updatedAt) => ({
8730
+ meta: { ...meta, columns, updatedAt },
8731
+ metaChanges: { columns, updatedAt },
8732
+ noop: false
8733
+ });
8734
+ var reorderList = (list, from, to) => {
8735
+ const next = [...list];
8736
+ const [moved] = next.splice(from, 1);
8737
+ next.splice(to, 0, moved);
8738
+ return next;
8739
+ };
8740
+ function addColumnToMeta(meta, input, deps) {
8741
+ const { columnName } = input;
8742
+ if (!columnName.trim()) {
8743
+ return err("\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8744
+ }
8745
+ if (meta.columns.some((c) => c.name === columnName)) {
8746
+ return err(`\u5B57\u6BB5 ${columnName} \u5DF2\u5B58\u5728`);
8747
+ }
8748
+ const newColumn = {
8749
+ id: deps.id,
8750
+ name: columnName,
8751
+ label: columnName
8752
+ };
8753
+ return ok(buildMeta(meta, [...meta.columns, newColumn], deps.nowIso));
8754
+ }
8755
+ function deleteColumnFromMeta(meta, rows, input, deps) {
8756
+ const { columnName } = input;
8757
+ const { nowIso } = deps;
8758
+ if (!meta.columns.some((c) => c.name === columnName)) {
8759
+ return err(`\u5B57\u6BB5 ${columnName} \u4E0D\u5B58\u5728`);
8760
+ }
8761
+ const newColumns = meta.columns.filter((c) => c.name !== columnName);
8762
+ const rowPatches = rows.filter((row) => hasOwn(row, columnName)).map((row) => ({
8763
+ dbKey: row.dbKey,
8764
+ changes: { [columnName]: null, updatedAt: nowIso }
8765
+ }));
8766
+ const newRows = rows.map((row) => {
8767
+ if (!hasOwn(row, columnName)) {
8768
+ return row;
8769
+ }
8770
+ const { [columnName]: _removed, ...rest } = row;
8771
+ return { ...rest, updatedAt: nowIso };
8772
+ });
8773
+ return ok({
8774
+ ...buildMeta(meta, newColumns, nowIso),
8775
+ rows: newRows,
8776
+ rowPatches
8777
+ });
8778
+ }
8779
+ function reorderColumnInMeta(meta, input, deps) {
8780
+ const { fromIndex, toIndex } = input;
8781
+ const columnCount = meta.columns.length;
8782
+ if (fromIndex < 0 || fromIndex >= columnCount || toIndex < 0 || toIndex >= columnCount) {
8783
+ return err("\u5217\u7D22\u5F15\u8D85\u51FA\u8303\u56F4");
8784
+ }
8785
+ if (fromIndex === toIndex) {
8786
+ return ok({
8787
+ meta,
8788
+ metaChanges: { columns: meta.columns, updatedAt: meta.updatedAt },
8789
+ noop: true
8790
+ });
8791
+ }
8792
+ return ok(
8793
+ buildMeta(meta, reorderList(meta.columns, fromIndex, toIndex), deps.nowIso)
8794
+ );
8795
+ }
8796
+ function renameColumnInMeta(meta, rows, input, deps) {
8797
+ const { oldName } = input;
8798
+ const { nowIso } = deps;
8799
+ const newName = input.newName.trim();
8800
+ if (!newName) {
8801
+ return err("\u65B0\u7684\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8802
+ }
8803
+ if (!meta.columns.some((c) => c.name === oldName)) {
8804
+ return err(`\u5B57\u6BB5 ${oldName} \u4E0D\u5B58\u5728`);
8805
+ }
8806
+ if (meta.columns.some((c) => c.name === newName)) {
8807
+ return err(`\u5B57\u6BB5 ${newName} \u5DF2\u5B58\u5728`);
8808
+ }
8809
+ const newColumns = meta.columns.map(
8810
+ (c) => c.name === oldName ? { ...c, name: newName } : c
8811
+ );
8812
+ const rowPatches = rows.filter((row) => hasOwn(row, oldName)).map((row) => ({
8813
+ dbKey: row.dbKey,
8814
+ changes: {
8815
+ [newName]: row[oldName],
8816
+ [oldName]: null,
8817
+ updatedAt: nowIso
8818
+ }
8819
+ }));
8820
+ const newRows = rows.map((row) => {
8821
+ if (!hasOwn(row, oldName)) {
8822
+ return row;
8823
+ }
8824
+ const { [oldName]: oldValue, ...rest } = row;
8825
+ return { ...rest, [newName]: oldValue, updatedAt: nowIso };
8826
+ });
8827
+ return ok({
8828
+ ...buildMeta(meta, newColumns, nowIso),
8829
+ rows: newRows,
8830
+ rowPatches
8831
+ });
8832
+ }
8833
+ function renameColumnLabelInMeta(meta, input, deps) {
8834
+ const { columnId } = input;
8835
+ const label = input.label.trim();
8836
+ if (!label) {
8837
+ return err("\u5B57\u6BB5\u663E\u793A\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8838
+ }
8839
+ if (!meta.columns.some((c) => c.id === columnId)) {
8840
+ return err("\u8981\u91CD\u547D\u540D\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
8841
+ }
8842
+ const newColumns = meta.columns.map(
8843
+ (c) => c.id === columnId ? { ...c, label } : c
8844
+ );
8845
+ return ok(buildMeta(meta, newColumns, deps.nowIso));
8846
+ }
8847
+ function updateColumnWidthInMeta(meta, input, deps) {
8848
+ const { columnId, width } = input;
8849
+ if (!meta.columns.some((c) => c.id === columnId)) {
8850
+ return err("\u8981\u8C03\u6574\u5BBD\u5EA6\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
8851
+ }
8852
+ const normalizedWidth = typeof width === "number" && width > 0 ? Math.round(width) : void 0;
8853
+ const newColumns = meta.columns.map(
8854
+ (c) => c.id === columnId ? { ...c, width: normalizedWidth } : c
8855
+ );
8856
+ return ok(buildMeta(meta, newColumns, deps.nowIso));
8857
+ }
8858
+
8657
8859
  // packages/render/table/createTableAction.ts
8658
8860
  var import_date_fns2 = __toESM(require_date_fns(), 1);
8659
8861
  import { ulid as ulid4 } from "ulid";
@@ -9809,7 +10011,7 @@ var PluralResolver = class {
9809
10011
  });
9810
10012
  this.pluralRulesCache[cacheKey] = rule;
9811
10013
  return rule;
9812
- } catch (err) {
10014
+ } catch (err2) {
9813
10015
  return;
9814
10016
  }
9815
10017
  }
@@ -10287,23 +10489,23 @@ var Connector = class extends EventEmitter {
10287
10489
  toLoadNamespaces: Object.keys(toLoadNamespaces)
10288
10490
  };
10289
10491
  }
10290
- loaded(name, err, data) {
10492
+ loaded(name, err2, data) {
10291
10493
  const s = name.split("|");
10292
10494
  const lng = s[0];
10293
10495
  const ns = s[1];
10294
- if (err) this.emit("failedLoading", lng, ns, err);
10295
- if (!err && data) {
10496
+ if (err2) this.emit("failedLoading", lng, ns, err2);
10497
+ if (!err2 && data) {
10296
10498
  this.store.addResourceBundle(lng, ns, data, void 0, void 0, {
10297
10499
  skipCopy: true
10298
10500
  });
10299
10501
  }
10300
- this.state[name] = err ? -1 : 2;
10301
- if (err && data) this.state[name] = 0;
10502
+ this.state[name] = err2 ? -1 : 2;
10503
+ if (err2 && data) this.state[name] = 0;
10302
10504
  const loaded = {};
10303
10505
  this.queue.forEach((q) => {
10304
10506
  pushPath(q.loaded, [lng], ns);
10305
10507
  removePending(q, name);
10306
- if (err) q.errors.push(err);
10508
+ if (err2) q.errors.push(err2);
10307
10509
  if (q.pendingCount === 0 && !q.done) {
10308
10510
  Object.keys(q.loaded).forEach((l) => {
10309
10511
  if (!loaded[l]) loaded[l] = {};
@@ -10342,19 +10544,19 @@ var Connector = class extends EventEmitter {
10342
10544
  return;
10343
10545
  }
10344
10546
  this.readingCalls++;
10345
- const resolver = (err, data) => {
10547
+ const resolver = (err2, data) => {
10346
10548
  this.readingCalls--;
10347
10549
  if (this.waitingReads.length > 0) {
10348
10550
  const next = this.waitingReads.shift();
10349
10551
  this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
10350
10552
  }
10351
- if (err && data && tried < this.maxRetries) {
10553
+ if (err2 && data && tried < this.maxRetries) {
10352
10554
  setTimeout(() => {
10353
10555
  this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
10354
10556
  }, wait);
10355
10557
  return;
10356
10558
  }
10357
- callback(err, data);
10559
+ callback(err2, data);
10358
10560
  };
10359
10561
  const fc = this.backend[fcName].bind(this.backend);
10360
10562
  if (fc.length === 2) {
@@ -10365,8 +10567,8 @@ var Connector = class extends EventEmitter {
10365
10567
  } else {
10366
10568
  resolver(null, r);
10367
10569
  }
10368
- } catch (err) {
10369
- resolver(err);
10570
+ } catch (err2) {
10571
+ resolver(err2);
10370
10572
  }
10371
10573
  return;
10372
10574
  }
@@ -10403,10 +10605,10 @@ var Connector = class extends EventEmitter {
10403
10605
  const s = name.split("|");
10404
10606
  const lng = s[0];
10405
10607
  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);
10608
+ this.read(lng, ns, "read", void 0, void 0, (err2, data) => {
10609
+ if (err2) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err2);
10610
+ if (!err2 && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
10611
+ this.loaded(name, err2, data);
10410
10612
  });
10411
10613
  }
10412
10614
  saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
@@ -10437,8 +10639,8 @@ var Connector = class extends EventEmitter {
10437
10639
  } else {
10438
10640
  clb(null, r);
10439
10641
  }
10440
- } catch (err) {
10441
- clb(err);
10642
+ } catch (err2) {
10643
+ clb(err2);
10442
10644
  }
10443
10645
  } else {
10444
10646
  fc(languages, namespace, key, fallbackValue, clb, opts);
@@ -10670,14 +10872,14 @@ var I18n = class _I18n extends EventEmitter {
10670
10872
  });
10671
10873
  const deferred = defer();
10672
10874
  const load = () => {
10673
- const finish = (err, t2) => {
10875
+ const finish = (err2, t2) => {
10674
10876
  this.isInitializing = false;
10675
10877
  if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn("init: i18next is already initialized. You should call init just once!");
10676
10878
  this.isInitialized = true;
10677
10879
  if (!this.options.isClone) this.logger.log("initialized", this.options);
10678
10880
  this.emit("initialized", this.options);
10679
10881
  deferred.resolve(t2);
10680
- callback(err, t2);
10882
+ callback(err2, t2);
10681
10883
  };
10682
10884
  if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return finish(null, this.t.bind(this));
10683
10885
  this.changeLanguage(this.options.lng, finish);
@@ -10736,9 +10938,9 @@ var I18n = class _I18n extends EventEmitter {
10736
10938
  if (!lngs) lngs = this.languages;
10737
10939
  if (!ns) ns = this.options.ns;
10738
10940
  if (!callback) callback = noop;
10739
- this.services.backendConnector.reload(lngs, ns, (err) => {
10941
+ this.services.backendConnector.reload(lngs, ns, (err2) => {
10740
10942
  deferred.resolve();
10741
- callback(err);
10943
+ callback(err2);
10742
10944
  });
10743
10945
  return deferred;
10744
10946
  }
@@ -10791,7 +10993,7 @@ var I18n = class _I18n extends EventEmitter {
10791
10993
  this.resolvedLanguage = void 0;
10792
10994
  this.setResolvedLanguage(l);
10793
10995
  };
10794
- const done = (err, l) => {
10996
+ const done = (err2, l) => {
10795
10997
  if (l) {
10796
10998
  setLngProps(l);
10797
10999
  this.translator.changeLanguage(l);
@@ -10804,7 +11006,7 @@ var I18n = class _I18n extends EventEmitter {
10804
11006
  deferred.resolve(function() {
10805
11007
  return _this2.t(...arguments);
10806
11008
  });
10807
- if (callback) callback(err, function() {
11009
+ if (callback) callback(err2, function() {
10808
11010
  return _this2.t(...arguments);
10809
11011
  });
10810
11012
  };
@@ -10818,8 +11020,8 @@ var I18n = class _I18n extends EventEmitter {
10818
11020
  if (!this.translator.language) this.translator.changeLanguage(l);
10819
11021
  if (this.services.languageDetector && this.services.languageDetector.cacheUserLanguage) this.services.languageDetector.cacheUserLanguage(l);
10820
11022
  }
10821
- this.loadResources(l, (err) => {
10822
- done(err, l);
11023
+ this.loadResources(l, (err2) => {
11024
+ done(err2, l);
10823
11025
  });
10824
11026
  };
10825
11027
  if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
@@ -10917,9 +11119,9 @@ var I18n = class _I18n extends EventEmitter {
10917
11119
  ns.forEach((n) => {
10918
11120
  if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
10919
11121
  });
10920
- this.loadResources((err) => {
11122
+ this.loadResources((err2) => {
10921
11123
  deferred.resolve();
10922
- if (callback) callback(err);
11124
+ if (callback) callback(err2);
10923
11125
  });
10924
11126
  return deferred;
10925
11127
  }
@@ -10933,9 +11135,9 @@ var I18n = class _I18n extends EventEmitter {
10933
11135
  return Promise.resolve();
10934
11136
  }
10935
11137
  this.options.preload = preloaded.concat(newLngs);
10936
- this.loadResources((err) => {
11138
+ this.loadResources((err2) => {
10937
11139
  deferred.resolve();
10938
- if (callback) callback(err);
11140
+ if (callback) callback(err2);
10939
11141
  });
10940
11142
  return deferred;
10941
11143
  }
@@ -11432,12 +11634,6 @@ var initialState3 = {
11432
11634
  rows: [],
11433
11635
  focusContext: null
11434
11636
  };
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
11637
  var createSliceWithThunks3 = buildCreateSlice({
11442
11638
  creators: { asyncThunk: asyncThunkCreator }
11443
11639
  });
@@ -11651,41 +11847,27 @@ var tableSlice = createSliceWithThunks3({
11651
11847
  addColumn: create.asyncThunk(
11652
11848
  async (args, { dispatch, getState, rejectWithValue }) => {
11653
11849
  const { tenantId, tableId, columnName } = args;
11654
- if (!columnName.trim()) {
11655
- return rejectWithValue("\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
11656
- }
11657
11850
  const state3 = getState().table;
11658
11851
  const meta = state3.currentTable;
11659
11852
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11660
11853
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11661
11854
  }
11662
- if (meta.columns.some((c) => c.name === columnName)) {
11663
- return rejectWithValue(`\u5B57\u6BB5 ${columnName} \u5DF2\u5B58\u5728`);
11855
+ const result = addColumnToMeta(
11856
+ meta,
11857
+ { columnName },
11858
+ { id: ulid5(), nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11859
+ );
11860
+ if (!result.ok) {
11861
+ return rejectWithValue(result.error);
11664
11862
  }
11665
11863
  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
11864
  await dispatch(
11675
11865
  patch({
11676
11866
  dbKey: meta.dbKey,
11677
- changes: {
11678
- columns: newColumns,
11679
- updatedAt: nowIso
11680
- }
11867
+ changes: result.value.metaChanges
11681
11868
  })
11682
11869
  ).unwrap();
11683
- const nextMeta = {
11684
- ...meta,
11685
- columns: newColumns,
11686
- updatedAt: nowIso
11687
- };
11688
- return nextMeta;
11870
+ return result.value.meta;
11689
11871
  } catch (e) {
11690
11872
  return rejectWithValue(e.message || "\u6DFB\u52A0\u5B57\u6BB5\u5931\u8D25");
11691
11873
  }
@@ -11714,58 +11896,24 @@ var tableSlice = createSliceWithThunks3({
11714
11896
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11715
11897
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11716
11898
  }
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
11899
+ const result = deleteColumnFromMeta(
11900
+ meta,
11901
+ state3.rows,
11902
+ { columnName },
11903
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11723
11904
  );
11724
- const rows = state3.rows;
11905
+ if (!result.ok) {
11906
+ return rejectWithValue(result.error);
11907
+ }
11908
+ const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
11725
11909
  try {
11726
- const rowsWithField = rows.filter(
11727
- (row) => Object.prototype.hasOwnProperty.call(row, columnName)
11728
- );
11729
11910
  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
- )
11911
+ rowPatches.map((p) => dispatch(patch(p)).unwrap())
11741
11912
  );
11742
11913
  await dispatch(
11743
- patch({
11744
- dbKey: meta.dbKey,
11745
- changes: {
11746
- columns: newColumns,
11747
- updatedAt: nowIso
11748
- }
11749
- })
11914
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11750
11915
  ).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
- };
11916
+ return { meta: nextMeta, rows: newRows };
11769
11917
  } catch (e) {
11770
11918
  return rejectWithValue(e.message || "\u5220\u9664\u5B57\u6BB5\u5931\u8D25");
11771
11919
  }
@@ -11795,30 +11943,22 @@ var tableSlice = createSliceWithThunks3({
11795
11943
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11796
11944
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11797
11945
  }
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");
11946
+ const result = reorderColumnInMeta(
11947
+ meta,
11948
+ { fromIndex, toIndex },
11949
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11950
+ );
11951
+ if (!result.ok) {
11952
+ return rejectWithValue(result.error);
11801
11953
  }
11802
- if (fromIndex === toIndex) {
11954
+ if (result.value.noop) {
11803
11955
  return meta;
11804
11956
  }
11805
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11806
- const newColumns = reorderList(meta.columns, fromIndex, toIndex);
11957
+ const { meta: nextMeta, metaChanges } = result.value;
11807
11958
  try {
11808
11959
  await dispatch(
11809
- patch({
11810
- dbKey: meta.dbKey,
11811
- changes: {
11812
- columns: newColumns,
11813
- updatedAt: nowIso
11814
- }
11815
- })
11960
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11816
11961
  ).unwrap();
11817
- const nextMeta = {
11818
- ...meta,
11819
- columns: newColumns,
11820
- updatedAt: nowIso
11821
- };
11822
11962
  return nextMeta;
11823
11963
  } catch (e) {
11824
11964
  return rejectWithValue(e.message || "\u8C03\u6574\u5217\u987A\u5E8F\u5931\u8D25");
@@ -11845,73 +11985,29 @@ var tableSlice = createSliceWithThunks3({
11845
11985
  renameColumn: create.asyncThunk(
11846
11986
  async (args, { dispatch, getState, rejectWithValue }) => {
11847
11987
  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
11988
  const state3 = getState().table;
11853
11989
  const meta = state3.currentTable;
11854
11990
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11855
11991
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11856
11992
  }
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
11993
+ const result = renameColumnInMeta(
11994
+ meta,
11995
+ state3.rows,
11996
+ { oldName, newName },
11997
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11867
11998
  );
11999
+ if (!result.ok) {
12000
+ return rejectWithValue(result.error);
12001
+ }
12002
+ const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
11868
12003
  try {
11869
- const rowsWithOldField = rows.filter(
11870
- (row) => Object.prototype.hasOwnProperty.call(row, oldName)
11871
- );
11872
12004
  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
- })
12005
+ rowPatches.map((p) => dispatch(patch(p)).unwrap())
11886
12006
  );
11887
12007
  await dispatch(
11888
- patch({
11889
- dbKey: meta.dbKey,
11890
- changes: {
11891
- columns: newColumns,
11892
- updatedAt: nowIso
11893
- }
11894
- })
12008
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11895
12009
  ).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
- };
12010
+ return { meta: nextMeta, rows: newRows };
11915
12011
  } catch (e) {
11916
12012
  return rejectWithValue(e.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u5931\u8D25");
11917
12013
  }
@@ -11938,38 +12034,24 @@ var tableSlice = createSliceWithThunks3({
11938
12034
  renameColumnLabel: create.asyncThunk(
11939
12035
  async (args, { dispatch, getState, rejectWithValue }) => {
11940
12036
  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
12037
  const state3 = getState().table;
11946
12038
  const meta = state3.currentTable;
11947
12039
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11948
12040
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11949
12041
  }
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
12042
+ const result = renameColumnLabelInMeta(
12043
+ meta,
12044
+ { columnId, label: newLabel },
12045
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11957
12046
  );
12047
+ if (!result.ok) {
12048
+ return rejectWithValue(result.error);
12049
+ }
12050
+ const { meta: nextMeta, metaChanges } = result.value;
11958
12051
  try {
11959
12052
  await dispatch(
11960
- patch({
11961
- dbKey: meta.dbKey,
11962
- changes: {
11963
- columns: newColumns,
11964
- updatedAt: nowIso
11965
- }
11966
- })
12053
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11967
12054
  ).unwrap();
11968
- const nextMeta = {
11969
- ...meta,
11970
- columns: newColumns,
11971
- updatedAt: nowIso
11972
- };
11973
12055
  return nextMeta;
11974
12056
  } catch (e) {
11975
12057
  return rejectWithValue(e.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u663E\u793A\u540D\u5931\u8D25");
@@ -12000,30 +12082,19 @@ var tableSlice = createSliceWithThunks3({
12000
12082
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
12001
12083
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
12002
12084
  }
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
12085
+ const result = updateColumnWidthInMeta(
12086
+ meta,
12087
+ { columnId, width },
12088
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
12011
12089
  );
12090
+ if (!result.ok) {
12091
+ return rejectWithValue(result.error);
12092
+ }
12093
+ const { meta: nextMeta, metaChanges } = result.value;
12012
12094
  try {
12013
12095
  await dispatch(
12014
- patch({
12015
- dbKey: meta.dbKey,
12016
- changes: {
12017
- columns: newColumns,
12018
- updatedAt: nowIso
12019
- }
12020
- })
12096
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
12021
12097
  ).unwrap();
12022
- const nextMeta = {
12023
- ...meta,
12024
- columns: newColumns,
12025
- updatedAt: nowIso
12026
- };
12027
12098
  return nextMeta;
12028
12099
  } catch (e) {
12029
12100
  return rejectWithValue(e.message || "\u66F4\u65B0\u5B57\u6BB5\u5BBD\u5EA6\u5931\u8D25");
@@ -12256,11 +12327,11 @@ var ENTITY_DELETE_STRATEGIES = {
12256
12327
  await dispatch(deleteTable({ dbKey: key })).unwrap();
12257
12328
  },
12258
12329
  file: async (key, { thunkAPI }) => {
12259
- const { deleteFileAction } = await import("./deleteFile-WPWVZE4B.js");
12330
+ const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
12260
12331
  await deleteFileAction(key, thunkAPI);
12261
12332
  },
12262
12333
  image: async (key, { thunkAPI }) => {
12263
- const { deleteFileAction } = await import("./deleteFile-WPWVZE4B.js");
12334
+ const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
12264
12335
  await deleteFileAction(key, thunkAPI);
12265
12336
  },
12266
12337
  agent: async (key, { dispatch, userId, sourceServerOrigin }) => {
@@ -12343,9 +12414,9 @@ var deleteContentFromSpaceAction = async (input, thunkAPI) => {
12343
12414
  sourceServerOrigin
12344
12415
  });
12345
12416
  }
12346
- } catch (err) {
12347
- console.error(`[deleteContent] Failed to delete entity ${entityKey}:`, err);
12348
- entityRemoveError = err.message || "Unknown error";
12417
+ } catch (err2) {
12418
+ console.error(`[deleteContent] Failed to delete entity ${entityKey}:`, err2);
12419
+ entityRemoveError = err2.message || "Unknown error";
12349
12420
  }
12350
12421
  return {
12351
12422
  contentKey,
@@ -13666,8 +13737,8 @@ async function resolveMemberId(db, identifier) {
13666
13737
  matchCount++;
13667
13738
  }
13668
13739
  }
13669
- } catch (err) {
13670
- logger.warn({ err, identifier: trimmed }, "Failed to scan users by username");
13740
+ } catch (err2) {
13741
+ logger.warn({ err: err2, identifier: trimmed }, "Failed to scan users by username");
13671
13742
  }
13672
13743
  if (matchCount > 1) {
13673
13744
  throw new Error(
@@ -13853,8 +13924,8 @@ async function getUserDataOnce({
13853
13924
  const localResults = await fetchUserData(db, typeArray, effectiveUserId);
13854
13925
  const localData = Object.values(localResults).flat();
13855
13926
  return { data: localData };
13856
- } catch (err) {
13857
- const error = err instanceof Error ? err : new Error("Unknown error occurred");
13927
+ } catch (err2) {
13928
+ const error = err2 instanceof Error ? err2 : new Error("Unknown error occurred");
13858
13929
  return { data: [], error };
13859
13930
  }
13860
13931
  }
@@ -14203,8 +14274,8 @@ var deleteDbKey = (input, spaceId) => async (dispatch, getState) => {
14203
14274
  spaceId: spaceId2,
14204
14275
  ...preferredServerOrigin ? { sourceServerOrigin: preferredServerOrigin } : {}
14205
14276
  })
14206
- ).unwrap().catch((err) => {
14207
- console.warn("[deleteDbKey] space cleanup failed (entity already tombstoned):", err);
14277
+ ).unwrap().catch((err2) => {
14278
+ console.warn("[deleteDbKey] space cleanup failed (entity already tombstoned):", err2);
14208
14279
  })
14209
14280
  )
14210
14281
  );
@@ -14310,10 +14381,10 @@ var deleteLocalSpaceAuthority = async (spaceId, spaceData, dispatch) => {
14310
14381
  },
14311
14382
  dispatch
14312
14383
  );
14313
- } catch (err) {
14384
+ } catch (err2) {
14314
14385
  console.warn(
14315
14386
  `Failed to tombstone local membership ${memberId} for space ${spaceId}:`,
14316
- err
14387
+ err2
14317
14388
  );
14318
14389
  }
14319
14390
  }
@@ -14323,9 +14394,9 @@ var deleteAllMembers = async (spaceData, spaceId, dispatch) => {
14323
14394
  for (const memberId of spaceData.members) {
14324
14395
  const memberKey = createSpaceKey.member(memberId, spaceId);
14325
14396
  await dispatch(remove(memberKey)).unwrap().catch(
14326
- (err) => console.warn(
14397
+ (err2) => console.warn(
14327
14398
  `Failed to delete member ${memberId} for space ${spaceId}:`,
14328
- err
14399
+ err2
14329
14400
  )
14330
14401
  );
14331
14402
  }
@@ -14334,9 +14405,9 @@ var deleteAllMembers = async (spaceData, spaceId, dispatch) => {
14334
14405
  var deleteCurrentUserMember = async (userId, spaceId, dispatch) => {
14335
14406
  const currentUserMemberKey = createSpaceKey.member(userId, spaceId);
14336
14407
  await dispatch(remove(currentUserMemberKey)).unwrap().catch(
14337
- (err) => console.warn(
14408
+ (err2) => console.warn(
14338
14409
  `Failed to delete member key for user ${userId} in space ${spaceId}:`,
14339
- err
14410
+ err2
14340
14411
  )
14341
14412
  );
14342
14413
  };
@@ -14455,7 +14526,7 @@ var fetchSpaceAction = async (input, thunkAPI) => {
14455
14526
  const spaceKey = createSpaceKey.space(spaceId);
14456
14527
  const readSpace = async (dbKey) => {
14457
14528
  try {
14458
- const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-7KQH6GOU.js");
14529
+ const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-CGSRFJN3.js");
14459
14530
  if (fresh) {
14460
14531
  return await dispatch(readAndWait2(dbKey)).unwrap();
14461
14532
  }
@@ -15144,6 +15215,7 @@ export {
15144
15215
  parseUiAskChoiceContent,
15145
15216
  PERSONALIZATION_DIALOG_CATEGORY,
15146
15217
  buildPersonalizationDialogPolicyContext,
15218
+ resolveDialogRuntimeAgentKey,
15147
15219
  resolveHandleSendMessageContext,
15148
15220
  estimateMissingUsage,
15149
15221
  selectCurrentDialogId,
@@ -15158,6 +15230,7 @@ export {
15158
15230
  messageStreamEnd,
15159
15231
  addToolMessage,
15160
15232
  updateToolMessage,
15233
+ appendOverlayMessage,
15161
15234
  setWorkflow,
15162
15235
  updateStep,
15163
15236
  incrementStepsExecuted,