nolo-cli 0.16.0-alpha.15 → 0.16.0-alpha.17

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 (99) hide show
  1. package/{_executeModel-UU2JO5OB.js → _executeModel-GP2DXECM.js} +34 -30
  2. package/{action-F5JACQBG.js → action-TK62YXTY.js} +6 -5
  3. package/{addContentAction-AQXEYRBE.js → addContentAction-IEEBATAA.js} +5 -4
  4. package/{addDialogAgentAction-EJHHJZWW.js → addDialogAgentAction-XUZNC36X.js} +4 -3
  5. package/{agentDeleteCommand-L6JRXPYK.js → agentDeleteCommand-6C77LXAA.js} +23 -21
  6. package/{agentEmailCommands-FE3GY3T5.js → agentEmailCommands-7KZPAGIW.js} +45 -41
  7. package/{agentListCommands-ZWSAIC4W.js → agentListCommands-EFFASIR2.js} +21 -19
  8. package/{agentMachineCommands-VWQ2GZBY.js → agentMachineCommands-XHLRGCLP.js} +21 -19
  9. package/{agentPullCommand-6HWUT3SW.js → agentPullCommand-ZZGU5KOY.js} +4 -4
  10. package/{agentRecordCommands-PYVZMRZM.js → agentRecordCommands-ITBT7MPU.js} +40 -36
  11. package/{agentRunCommand-3ADJ2J5U.js → agentRunCommand-HEBSX6ER.js} +41 -37
  12. package/{agentRuntimeLocal-LXTR6SAU.js → agentRuntimeLocal-KV6MQJQS.js} +14 -12
  13. package/{agentSlice-TI6ECUGN.js → agentSlice-HOLDB2UY.js} +5 -4
  14. package/{appDeleteCommands-QIS37SXE.js → appDeleteCommands-ROPKN6PL.js} +18 -16
  15. package/{appDeployCommands-WBHB7T5B.js → appDeployCommands-65E4ARQN.js} +18 -16
  16. package/{appDeployStatusCommands-A3OUV6GO.js → appDeployStatusCommands-RFWMQDSJ.js} +18 -16
  17. package/{appGetCommands-LCVYIH63.js → appGetCommands-LDO2HNAL.js} +18 -16
  18. package/{appListCommands-PC7QOBUO.js → appListCommands-S4MBG4KD.js} +18 -16
  19. package/{authCommand-MSSBXCQ6.js → authCommand-WJZPOLSS.js} +9 -8
  20. package/{authCommands-YXGOXNBZ.js → authCommands-XTBV7OFZ.js} +6 -5
  21. package/{chunk-IWLUTMYX.js → chunk-27MGYWLZ.js} +1 -1
  22. package/{chunk-ECGTEOC2.js → chunk-3J6QER3H.js} +5 -5
  23. package/{chunk-SOTZ6RDN.js → chunk-3Q7WHGCB.js} +1 -1
  24. package/{chunk-MTU75CZ2.js → chunk-B5TOXZAK.js} +1 -1
  25. package/{chunk-W6OKITU6.js → chunk-CIF5XTPN.js} +38 -41
  26. package/{chunk-W63ZTRQU.js → chunk-DS2YYH6W.js} +3 -3
  27. package/{chunk-ZDDHKIWB.js → chunk-DXOUTEQC.js} +7 -7
  28. package/{chunk-BOBNE3XT.js → chunk-ETXKHE7J.js} +5 -5
  29. package/{chunk-PFW2ZEON.js → chunk-EWLAMUG5.js} +4 -6
  30. package/{chunk-2OK7P5XF.js → chunk-HETVWFFQ.js} +363 -331
  31. package/{chunk-6IGLIDDE.js → chunk-HRLDQJW7.js} +39 -157
  32. package/{chunk-FTNTMGXT.js → chunk-IG3SA64O.js} +4 -4
  33. package/{chunk-SOW2GCA5.js → chunk-IOOMJJ4Z.js} +1 -1
  34. package/{chunk-5QJFYG2N.js → chunk-JJPANCH2.js} +10 -8
  35. package/{chunk-YJKXGHJ6.js → chunk-JKUL77KQ.js} +2 -2
  36. package/{chunk-GFPESFS6.js → chunk-JQOWVDDX.js} +6 -6
  37. package/{chunk-YZXEEGKV.js → chunk-KF27FHVT.js} +1 -1
  38. package/{chunk-EABWT43X.js → chunk-L2DKNKL4.js} +2 -2
  39. package/{chunk-TUWPYUVR.js → chunk-LD6DKWMF.js} +14 -14
  40. package/{chunk-Q6B6XJBG.js → chunk-LFTQYP3K.js} +15 -9
  41. package/{chunk-GM37ZF7R.js → chunk-MT2DOPXQ.js} +2 -2
  42. package/{chunk-UUDRNDC7.js → chunk-N3IKVYLL.js} +1 -1
  43. package/{chunk-NZBK3ZET.js → chunk-N77EBDJJ.js} +2 -2
  44. package/{chunk-HGDFFA6T.js → chunk-NJYEXLKX.js} +2 -2
  45. package/{chunk-3S2VOMIF.js → chunk-NLQBLZUO.js} +2 -2
  46. package/{chunk-URVWRKFU.js → chunk-PH7SXF5R.js} +134 -57
  47. package/{chunk-KMQPSTMJ.js → chunk-TRT4I4UD.js} +2 -2
  48. package/{chunk-64IEIMN4.js → chunk-V3A3PXQQ.js} +3 -3
  49. package/{chunk-2ZLEOGS5.js → chunk-VE7PIZFT.js} +1 -1
  50. package/{chunk-W4NVOSFF.js → chunk-WFHXMLHZ.js} +1 -1
  51. package/{chunk-H33743XH.js → chunk-WJRJDX2W.js} +1 -1
  52. package/{setDialogExtraReferencesAction-LR6MSIXO.js → chunk-WVQXRCCZ.js} +2 -17
  53. package/{chunk-U3DCTSPN.js → chunk-WWWIRXLT.js} +39 -49
  54. package/chunk-X4Q4UZEY.js +26 -0
  55. package/{chunk-KFHN5NGJ.js → chunk-XGJRT3IK.js} +1 -1
  56. package/{chunk-OSIJVBXP.js → chunk-XV5I4HHL.js} +14 -85
  57. package/{chunk-XG7CSGP3.js → chunk-Y3GNPBAB.js} +1 -1
  58. package/{chunk-RPDGJO4D.js → chunk-YPAO6HUT.js} +2 -2
  59. package/chunk-YZ2PZFC6.js +671 -0
  60. package/chunk-ZZ2MH7LE.js +84 -0
  61. package/{cliExecutor-K3F7DMRO.js → cliExecutor-DNE7TCC4.js} +2 -2
  62. package/codingSkills-3RK4CIL2.js +48 -0
  63. package/{createAgentAutomationAction-N4ZB7VX2.js → createAgentAutomationAction-63XOK7PE.js} +14 -13
  64. package/{createDialogAction-KF6HXCCZ.js → createDialogAction-NBFEO4SU.js} +16 -15
  65. package/{createPageAction-FXWSJONZ.js → createPageAction-JYVUSH57.js} +20 -19
  66. package/{dbSlice-7KQH6GOU.js → dbSlice-CJJKYYXK.js} +4 -3
  67. package/{dialogCommands-ULS6HV5V.js → dialogCommands-JO7YCVND.js} +19 -17
  68. package/{dialogSlice-K32QLYS7.js → dialogSlice-6SOMUMGM.js} +14 -13
  69. package/{docCreateCommands-RZTRTRU4.js → docCreateCommands-H7KQ345X.js} +17 -15
  70. package/{docDeleteCommands-FU36A663.js → docDeleteCommands-OSEFFFJ5.js} +18 -16
  71. package/{docReadCommands-IX4JXD4X.js → docReadCommands-7A5PGQ7J.js} +17 -15
  72. package/{docStore-L6HBNJ3R.js → docStore-K2SEQBBX.js} +15 -14
  73. package/{docUpdateCommands-W4OCR55Z.js → docUpdateCommands-3COEELBB.js} +17 -15
  74. package/{fetchMessages-KTNM7QAR.js → fetchMessages-BMGVZVSE.js} +4 -3
  75. package/{handleSendMessageAction-MFKKZXV7.js → handleSendMessageAction-L6NJXNIP.js} +15 -14
  76. package/index.js +51 -51
  77. package/{localDialogRead-2VRI24F4.js → localDialogRead-HQZPVIE3.js} +1 -1
  78. package/{localRuntimeDb-LGDF6FQP.js → localRuntimeDb-THJZGAOJ.js} +1 -1
  79. package/{machineCommands-4MFLZERH.js → machineCommands-DGDX3GHH.js} +47 -43
  80. package/{machineWsRunDispatch-AAHRNKIR.js → machineWsRunDispatch-ZV6BHKXA.js} +38 -34
  81. package/package.json +1 -1
  82. package/queryRunOverlay-KQDJBH32.js +203 -0
  83. package/{readlineWorkspace-7OPITHTN.js → readlineWorkspace-BUSQQXPY.js} +62 -64
  84. package/{removeDialogAgentAction-YDHBFEGI.js → removeDialogAgentAction-XRTUVGAN.js} +6 -5
  85. package/{runAgentClientLoop-HRWV7KE2.js → runAgentClientLoop-2YPEUG3Q.js} +30 -26
  86. package/runOverlayPresentation-BHD5POEM.js +79 -0
  87. package/{runtimeDoctorCommands-THIHX2SY.js → runtimeDoctorCommands-E2OUORHK.js} +6 -6
  88. package/setDialogExtraReferencesAction-WNZINFOX.js +27 -0
  89. package/{setPrimaryDialogAgentAction-57GRIGX5.js → setPrimaryDialogAgentAction-ECVV6DJ3.js} +6 -5
  90. package/{settingSlice-O23YDK2O.js → settingSlice-UVDEFVMQ.js} +5 -4
  91. package/{spaceCommands-GMMQTMHK.js → spaceCommands-XPHOVJTB.js} +20 -18
  92. package/{spaceSlice-V2P5TTQU.js → spaceSlice-EGOJICFM.js} +14 -13
  93. package/{streamAgentChatTurn-ZANOYOUR.js → streamAgentChatTurn-LAFUD4KS.js} +88 -66
  94. package/{tools-YHZP6NXU.js → tools-O6DVCZ3R.js} +24 -20
  95. package/types-ZSTJ7MPR.js +7 -0
  96. package/{updateDialogTitleAction-IKTPGPPE.js → updateDialogTitleAction-DVQFOG64.js} +17 -16
  97. package/{chunk-O4BU24WZ.js → chunk-6Y7A3OQQ.js} +3 -3
  98. package/{chunk-CMKUBIGW.js → chunk-X7W4TNB4.js} +3 -3
  99. 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-ECGTEOC2.js";
15
+ } from "./chunk-3J6QER3H.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-YPAO6HUT.js";
25
22
  import {
26
23
  getDialogAgentIds,
27
24
  getPrimaryDialogAgentId
@@ -30,7 +27,9 @@ import {
30
27
  require_date_fns
31
28
  } from "./chunk-M76ECQRD.js";
32
29
  import {
33
- AUTO_ASSISTANT_MEMORY_SUBJECT_ID,
30
+ fetchMessages
31
+ } from "./chunk-3Q7WHGCB.js";
32
+ import {
34
33
  DEFAULT_AUTO_EXECUTION_PROFILE,
35
34
  DEFAULT_CONTEXT_WINDOW,
36
35
  getModelContextWindow,
@@ -39,14 +38,25 @@ import {
39
38
  planCompression,
40
39
  resolveAutoExecutionProfile,
41
40
  serializeMessageContent
42
- } from "./chunk-PFW2ZEON.js";
41
+ } from "./chunk-EWLAMUG5.js";
42
+ import {
43
+ createFileCredentialBroker
44
+ } from "./chunk-5CS33IBL.js";
43
45
  import {
44
46
  findModelConfig,
45
47
  getModelConfig
46
48
  } from "./chunk-HQPG2PIV.js";
47
49
  import {
48
- createFileCredentialBroker
49
- } 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-27MGYWLZ.js";
50
60
  import {
51
61
  extractCustomId,
52
62
  extractUserId
@@ -68,27 +78,16 @@ import {
68
78
  setActiveDialogKey,
69
79
  setDialogConfigError
70
80
  } from "./chunk-3ASDTTEI.js";
71
- import {
72
- toErrorMessage
73
- } from "./chunk-HNMXYYJR.js";
74
81
  import {
75
82
  isSystemAdmin,
76
83
  nolotusId,
77
84
  selectRemoteServer,
78
85
  selectRemoteServers,
79
86
  selectRemoteSyncServers
80
- } from "./chunk-EABWT43X.js";
87
+ } from "./chunk-L2DKNKL4.js";
81
88
  import {
82
89
  asRecordOrEmpty
83
90
  } from "./chunk-KX6YBIHG.js";
84
- import {
85
- UNCATEGORIZED_ID,
86
- addContentAction,
87
- checkSpaceMembership,
88
- createSpaceKey,
89
- localSpaceAuthorityPatchStamp,
90
- normalizeSpaceId
91
- } from "./chunk-IWLUTMYX.js";
92
91
  import {
93
92
  patch,
94
93
  read,
@@ -101,7 +100,7 @@ import {
101
100
  uploadFileAction,
102
101
  upsertSSREntity,
103
102
  write
104
- } from "./chunk-3S2VOMIF.js";
103
+ } from "./chunk-NLQBLZUO.js";
105
104
  import {
106
105
  DB_PREFIX,
107
106
  SEPARATOR,
@@ -126,14 +125,14 @@ import {
126
125
  splitKey,
127
126
  toTrimmedString,
128
127
  ulid
129
- } from "./chunk-O4BU24WZ.js";
128
+ } from "./chunk-6Y7A3OQQ.js";
129
+ import {
130
+ asOptionalFiniteNumber
131
+ } from "./chunk-WWC7I6TA.js";
130
132
  import {
131
133
  asNonEmptyStringArray,
132
134
  asTrimmedNonEmptyStringArray
133
135
  } from "./chunk-I42VC5KR.js";
134
- import {
135
- asOptionalFiniteNumber
136
- } from "./chunk-WWC7I6TA.js";
137
136
  import {
138
137
  asTrimmedLowercaseString
139
138
  } from "./chunk-QSJ3HFEF.js";
@@ -602,8 +601,8 @@ var require_react_dom = __commonJS({
602
601
  }
603
602
  try {
604
603
  __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
605
- } catch (err) {
606
- console.error(err);
604
+ } catch (err2) {
605
+ console.error(err2);
607
606
  }
608
607
  }
609
608
  if (process.env.NODE_ENV === "production") {
@@ -946,7 +945,7 @@ var require_core = __commonJS({
946
945
  if (!crypto && typeof __require === "function") {
947
946
  try {
948
947
  crypto = __require("crypto");
949
- } catch (err) {
948
+ } catch (err2) {
950
949
  }
951
950
  }
952
951
  var cryptoSecureRandomInt = function() {
@@ -954,13 +953,13 @@ var require_core = __commonJS({
954
953
  if (typeof crypto.getRandomValues === "function") {
955
954
  try {
956
955
  return crypto.getRandomValues(new Uint32Array(1))[0];
957
- } catch (err) {
956
+ } catch (err2) {
958
957
  }
959
958
  }
960
959
  if (typeof crypto.randomBytes === "function") {
961
960
  try {
962
961
  return crypto.randomBytes(4).readInt32LE();
963
- } catch (err) {
962
+ } catch (err2) {
964
963
  }
965
964
  }
966
965
  }
@@ -3260,11 +3259,11 @@ var fetchConvMsgs = async (server, token, {
3260
3259
 
3261
3260
  // packages/app/utils/async.ts
3262
3261
  function swallowNonAbortError(promise, fallback, signal) {
3263
- return promise.catch((err) => {
3264
- if (isAbortError(err) || signal?.aborted) {
3265
- throw err;
3262
+ return promise.catch((err2) => {
3263
+ if (isAbortError(err2) || signal?.aborted) {
3264
+ throw err2;
3266
3265
  }
3267
- console.error("Non-abort error in async op:", err);
3266
+ console.error("Non-abort error in async op:", err2);
3268
3267
  return fallback;
3269
3268
  });
3270
3269
  }
@@ -3568,8 +3567,8 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
3568
3567
  ).unwrap();
3569
3568
  console.log(`[ContextCompression] Compressed ${plan.compressCount} messages. New summary len: ${newSummary.length}`);
3570
3569
  }
3571
- } catch (err) {
3572
- console.error("[ContextCompression] Failed:", err);
3570
+ } catch (err2) {
3571
+ console.error("[ContextCompression] Failed:", err2);
3573
3572
  }
3574
3573
  } finally {
3575
3574
  summarizingDialogs.delete(dialogKey);
@@ -3628,7 +3627,7 @@ var normalizeAppRouteId = (contentKey) => isAppContentKey(contentKey) ? contentK
3628
3627
 
3629
3628
  // packages/ai/tools/uiAskChoiceTool.ts
3630
3629
  var uiAskChoiceFunctionSchema = {
3631
- name: "ui_ask_choice",
3630
+ name: "ask_user",
3632
3631
  description: [
3633
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",
3634
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",
@@ -3638,6 +3637,11 @@ var uiAskChoiceFunctionSchema = {
3638
3637
  "- \u6BCF\u4E2A question \u53EF\u4EE5\u8BBE\u7F6E multiSelect: true \u5141\u8BB8\u591A\u9009\u3002",
3639
3638
  "- \u6BCF\u4E2A question \u53EF\u4EE5\u8BBE\u7F6E allowOther: false \u9690\u85CF\u201C\u5176\u4ED6\u201D\u8F93\u5165\u6846\u3002",
3640
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",
3641
3645
  "",
3642
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"
3643
3647
  ].join("\n"),
@@ -3666,6 +3670,13 @@ var uiAskChoiceFunctionSchema = {
3666
3670
  type: "string",
3667
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"
3668
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
+ },
3669
3680
  userMessage: {
3670
3681
  type: "string",
3671
3682
  description: [
@@ -3704,6 +3715,10 @@ var uiAskChoiceFunctionSchema = {
3704
3715
  type: "string",
3705
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"
3706
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
+ },
3707
3722
  userMessage: { type: "string" }
3708
3723
  },
3709
3724
  required: ["id", "label"]
@@ -3746,7 +3761,7 @@ async function uiAskChoiceFunc(args, _thunkApi) {
3746
3761
  const firstQ = args.questions[0];
3747
3762
  return {
3748
3763
  rawData: {
3749
- type: "ui_ask_choice",
3764
+ type: "ask_user",
3750
3765
  question: firstQ?.question ?? "",
3751
3766
  choices: firstQ?.choices ?? [],
3752
3767
  blocking,
@@ -3758,11 +3773,11 @@ async function uiAskChoiceFunc(args, _thunkApi) {
3758
3773
  const question = String(args?.question ?? "").trim();
3759
3774
  const choices = Array.isArray(args?.choices) ? args.choices : [];
3760
3775
  if (!question || choices.length === 0) {
3761
- 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");
3762
3777
  }
3763
3778
  return {
3764
3779
  rawData: {
3765
- type: "ui_ask_choice",
3780
+ type: "ask_user",
3766
3781
  question,
3767
3782
  choices,
3768
3783
  blocking
@@ -3779,14 +3794,14 @@ function parseUiAskChoiceContent(rawContent) {
3779
3794
  }
3780
3795
  })() : rawContent;
3781
3796
  if (!parsed || typeof parsed !== "object") return null;
3782
- if (parsed.type !== "ui_ask_choice") return null;
3797
+ if (parsed.type !== "ask_user") return null;
3783
3798
  return parsed;
3784
3799
  }
3785
3800
 
3786
3801
  // packages/ai/policy/personalizationDialog.ts
3787
3802
  var PERSONALIZATION_DIALOG_CATEGORY = "user-overlay-profile";
3788
3803
  var PERSONALIZATION_DIALOG_EXTRA_TOOLS = [
3789
- "ui_ask_choice",
3804
+ "ask_user",
3790
3805
  "updateUserPreferenceProfile"
3791
3806
  ];
3792
3807
  var buildPersonalizationRuntimeOptions = (runtimeOptions) => ({
@@ -3802,7 +3817,7 @@ var buildPersonalizationDialogPolicyContext = () => [
3802
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",
3803
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",
3804
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",
3805
- "\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",
3806
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",
3807
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",
3808
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",
@@ -3819,15 +3834,6 @@ var resolveDialogAutoTier = (dialog) => {
3819
3834
  const tier = asOptionalTrimmedString(dialog?.autoRoute?.stickyTier);
3820
3835
  return tier === "flash" || tier === "balanced" || tier === "quality" || tier === "image" ? tier : void 0;
3821
3836
  };
3822
- var resolveDialogMemorySubjectId = (dialog, explicitAgentKey) => {
3823
- const explicit = asOptionalTrimmedString(explicitAgentKey);
3824
- if (explicit) return explicit;
3825
- if (resolveDialogAgentMode(dialog) === "fixed") {
3826
- const fixed = getPrimaryDialogAgentId(dialog);
3827
- if (fixed) return fixed;
3828
- }
3829
- return AUTO_ASSISTANT_MEMORY_SUBJECT_ID;
3830
- };
3831
3837
  var resolveDialogRuntimeAgentKey = (dialog, explicitAgentKey) => {
3832
3838
  const explicit = asOptionalTrimmedString(explicitAgentKey);
3833
3839
  if (explicit) return explicit;
@@ -3843,13 +3849,9 @@ var resolveDialogRuntimeAgentKey = (dialog, explicitAgentKey) => {
3843
3849
  // packages/chat/dialog/actions/handleSendMessageResolver.ts
3844
3850
  function resolveHandleSendMessageContext(input) {
3845
3851
  const { dialogConfig, targetAgentKey, runtimeOptions } = input;
3846
- const memoryRuntimeOptions = {
3847
- ...runtimeOptions ?? {},
3848
- memorySubjectId: resolveDialogMemorySubjectId(dialogConfig, targetAgentKey)
3849
- };
3850
3852
  return {
3851
3853
  agentKeyToUse: resolveDialogRuntimeAgentKey(dialogConfig, targetAgentKey),
3852
- effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(memoryRuntimeOptions) : memoryRuntimeOptions
3854
+ effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(runtimeOptions ?? {}) : runtimeOptions
3853
3855
  };
3854
3856
  }
3855
3857
 
@@ -4648,7 +4650,6 @@ async function captureUnderstandingFromCompletedUiTurn(input) {
4648
4650
  },
4649
4651
  body: JSON.stringify({
4650
4652
  agentKey: input.agentKey,
4651
- memorySubjectId: resolveDialogMemorySubjectId(dialog),
4652
4653
  dialogId: input.dialogId,
4653
4654
  userInput: latestUserInput,
4654
4655
  assistantText: input.assistantText,
@@ -4983,6 +4984,33 @@ var messageSlice = createSliceWithThunks({
4983
4984
  });
4984
4985
  }
4985
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
+ }),
4986
5014
  prepareAndPersistMessage: create.asyncThunk(
4987
5015
  async (args, thunkApi) => {
4988
5016
  const { message, dialogConfig } = args;
@@ -5008,7 +5036,7 @@ var messageSlice = createSliceWithThunks({
5008
5036
  content: message.content,
5009
5037
  dialogKey
5010
5038
  })
5011
- ).catch((err) => console.error("Failed to add refs:", err));
5039
+ ).catch((err2) => console.error("Failed to add refs:", err2));
5012
5040
  dispatch(messageActions.addUserMessage({ ...fullMessage, dialogId }));
5013
5041
  const { controller, ...messageToWrite } = fullMessage;
5014
5042
  await dispatch(
@@ -5075,8 +5103,8 @@ var messageSlice = createSliceWithThunks({
5075
5103
  messages: finalMessages2.filter(isValidMessage)
5076
5104
  })
5077
5105
  );
5078
- }).catch((err) => {
5079
- console.error("[initMsgs] background remote revalidate failed:", err);
5106
+ }).catch((err2) => {
5107
+ console.error("[initMsgs] background remote revalidate failed:", err2);
5080
5108
  });
5081
5109
  return validLocalMessages;
5082
5110
  }
@@ -5093,7 +5121,7 @@ var messageSlice = createSliceWithThunks({
5093
5121
  updateDialogSummaryAction(
5094
5122
  { dialogKey: decision.dialogKey, preFetchedMessages: finalMessages },
5095
5123
  thunkApi
5096
- ).catch((err) => console.error("Resume summary failed:", err));
5124
+ ).catch((err2) => console.error("Resume summary failed:", err2));
5097
5125
  }
5098
5126
  } catch {
5099
5127
  console.error("[initMsgs] Failed to resume summary");
@@ -5399,12 +5427,12 @@ var messageSlice = createSliceWithThunks({
5399
5427
  reason: summaryReason
5400
5428
  },
5401
5429
  { dispatch, getState }
5402
- ).catch((err) => console.error("Summary update failed:", err));
5430
+ ).catch((err2) => console.error("Summary update failed:", err2));
5403
5431
  if (addRefs) {
5404
5432
  dispatch(addReferenceKeysAction({
5405
5433
  content: finalVisibleContent,
5406
5434
  dialogKey
5407
- })).catch((err) => console.error("Failed to add assistant refs:", err));
5435
+ })).catch((err2) => console.error("Failed to add assistant refs:", err2));
5408
5436
  }
5409
5437
  }
5410
5438
  captureUnderstandingFromCompletedUiTurn2({
@@ -5416,7 +5444,7 @@ var messageSlice = createSliceWithThunks({
5416
5444
  assistantText: textContent,
5417
5445
  toolCalls
5418
5446
  }).catch(
5419
- (err) => console.error("Understanding memory capture failed:", err)
5447
+ (err2) => console.error("Understanding memory capture failed:", err2)
5420
5448
  );
5421
5449
  return {
5422
5450
  id: messageId,
@@ -5568,7 +5596,7 @@ var messageSlice = createSliceWithThunks({
5568
5596
  runtimeOptions: args.runtimeOptions
5569
5597
  });
5570
5598
  if (agentKeyToUse) {
5571
- const { streamAgentChatTurn } = await import("./agentSlice-TI6ECUGN.js");
5599
+ const { streamAgentChatTurn } = await import("./agentSlice-HOLDB2UY.js");
5572
5600
  await dispatch(
5573
5601
  streamAgentChatTurn({
5574
5602
  agentKey: agentKeyToUse,
@@ -5624,7 +5652,8 @@ var {
5624
5652
  editUserMessageAndReplay,
5625
5653
  addToolMessage,
5626
5654
  updateToolMessage,
5627
- removeMessagesByIds
5655
+ removeMessagesByIds,
5656
+ appendOverlayMessage
5628
5657
  } = messageSlice.actions;
5629
5658
  var messageSlice_default = messageSlice.reducer;
5630
5659
 
@@ -8039,7 +8068,7 @@ var saveTokenUsage = async (data, thunkApi) => {
8039
8068
  currentStats = await thunkApi.dispatch(read({
8040
8069
  dbKey: tokenDayStatsKey
8041
8070
  })).unwrap();
8042
- } catch (err) {
8071
+ } catch (err2) {
8043
8072
  logger3.warn({ tokenDayStatsKey }, "No existing stats found");
8044
8073
  }
8045
8074
  const updatedStats = await updateStats(
@@ -8288,7 +8317,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8288
8317
  }
8289
8318
  if (isCurrentDialog) {
8290
8319
  await thunkApi.dispatch(resetMsgs());
8291
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-K32QLYS7.js");
8320
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-6SOMUMGM.js");
8292
8321
  dispatch(clearPendingAttachments2());
8293
8322
  clearWorkflow();
8294
8323
  }
@@ -8297,35 +8326,35 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8297
8326
 
8298
8327
  // packages/chat/dialog/dialogSlice.ts
8299
8328
  var runCreateDialogAction = async (args, thunkApi) => {
8300
- const { createDialogAction } = await import("./createDialogAction-KF6HXCCZ.js");
8329
+ const { createDialogAction } = await import("./createDialogAction-NBFEO4SU.js");
8301
8330
  return createDialogAction(args, thunkApi);
8302
8331
  };
8303
8332
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
8304
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-N4ZB7VX2.js");
8333
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-63XOK7PE.js");
8305
8334
  return createAgentAutomationAction(args, thunkApi);
8306
8335
  };
8307
8336
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
8308
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-IKTPGPPE.js");
8337
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-DVQFOG64.js");
8309
8338
  return updateDialogTitleAction(args, thunkApi);
8310
8339
  };
8311
8340
  var runAddDialogAgentAction = async (args, thunkApi) => {
8312
- const { addDialogAgentAction } = await import("./addDialogAgentAction-EJHHJZWW.js");
8341
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-XUZNC36X.js");
8313
8342
  return addDialogAgentAction(args, thunkApi);
8314
8343
  };
8315
8344
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
8316
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-YDHBFEGI.js");
8345
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-XRTUVGAN.js");
8317
8346
  return removeDialogAgentAction(args, thunkApi);
8318
8347
  };
8319
8348
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
8320
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-57GRIGX5.js");
8349
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-ECVV6DJ3.js");
8321
8350
  return setPrimaryDialogAgentAction(args, thunkApi);
8322
8351
  };
8323
8352
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
8324
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-LR6MSIXO.js");
8353
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-WNZINFOX.js");
8325
8354
  return setDialogExtraReferencesAction(args, thunkApi);
8326
8355
  };
8327
8356
  var runHandleSendMessageAction = async (args, thunkApi) => {
8328
- const { handleSendMessageAction } = await import("./handleSendMessageAction-MFKKZXV7.js");
8357
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-L6NJXNIP.js");
8329
8358
  return handleSendMessageAction(args, thunkApi);
8330
8359
  };
8331
8360
  function clearDialogState() {
@@ -8338,7 +8367,7 @@ var createPageAndAddReference = createAsyncThunk(
8338
8367
  async (payload, { dispatch, getState, rejectWithValue }) => {
8339
8368
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
8340
8369
  try {
8341
- const { createDocState } = await import("./docStore-L6HBNJ3R.js");
8370
+ const { createDocState } = await import("./docStore-K2SEQBBX.js");
8342
8371
  const pageKey = await createDocState(
8343
8372
  { slateData, title },
8344
8373
  { dispatch, getState }
@@ -8393,12 +8422,12 @@ var initDialog = createAsyncThunk(
8393
8422
  })
8394
8423
  ).unwrap();
8395
8424
  } catch (error) {
8396
- const err = error;
8397
- const isAborted = isAbortError(err) || err?.message === "Aborted";
8425
+ const err2 = error;
8426
+ const isAborted = isAbortError(err2) || err2?.message === "Aborted";
8398
8427
  const isCurrentDialog = getActiveDialogKey() === id;
8399
8428
  if (!isAborted && isCurrentDialog) {
8400
- setDialogConfigError(err?.message || "Failed to load dialog");
8401
- 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);
8402
8431
  }
8403
8432
  throw error;
8404
8433
  }
@@ -8566,9 +8595,9 @@ var fetchTableRowsFromServer = async (server, tenantId, tableId, headers) => {
8566
8595
  if (!res.ok) {
8567
8596
  let msg = `\u52A0\u8F7D\u8868 ${tableId} \u884C\u5931\u8D25\uFF08${res.status}\uFF09`;
8568
8597
  try {
8569
- const err = await res.json();
8570
- if (err && typeof err.message === "string") {
8571
- msg = err.message;
8598
+ const err2 = await res.json();
8599
+ if (err2 && typeof err2.message === "string") {
8600
+ msg = err2.message;
8572
8601
  }
8573
8602
  } catch {
8574
8603
  }
@@ -8693,6 +8722,140 @@ var fetchAndCacheTableRows = async ({
8693
8722
  return tableDeleted ? [] : mergedRows.filter((row) => !row?.deletedAt);
8694
8723
  };
8695
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
+
8696
8859
  // packages/render/table/createTableAction.ts
8697
8860
  var import_date_fns2 = __toESM(require_date_fns(), 1);
8698
8861
  import { ulid as ulid4 } from "ulid";
@@ -9848,7 +10011,7 @@ var PluralResolver = class {
9848
10011
  });
9849
10012
  this.pluralRulesCache[cacheKey] = rule;
9850
10013
  return rule;
9851
- } catch (err) {
10014
+ } catch (err2) {
9852
10015
  return;
9853
10016
  }
9854
10017
  }
@@ -10326,23 +10489,23 @@ var Connector = class extends EventEmitter {
10326
10489
  toLoadNamespaces: Object.keys(toLoadNamespaces)
10327
10490
  };
10328
10491
  }
10329
- loaded(name, err, data) {
10492
+ loaded(name, err2, data) {
10330
10493
  const s = name.split("|");
10331
10494
  const lng = s[0];
10332
10495
  const ns = s[1];
10333
- if (err) this.emit("failedLoading", lng, ns, err);
10334
- if (!err && data) {
10496
+ if (err2) this.emit("failedLoading", lng, ns, err2);
10497
+ if (!err2 && data) {
10335
10498
  this.store.addResourceBundle(lng, ns, data, void 0, void 0, {
10336
10499
  skipCopy: true
10337
10500
  });
10338
10501
  }
10339
- this.state[name] = err ? -1 : 2;
10340
- if (err && data) this.state[name] = 0;
10502
+ this.state[name] = err2 ? -1 : 2;
10503
+ if (err2 && data) this.state[name] = 0;
10341
10504
  const loaded = {};
10342
10505
  this.queue.forEach((q) => {
10343
10506
  pushPath(q.loaded, [lng], ns);
10344
10507
  removePending(q, name);
10345
- if (err) q.errors.push(err);
10508
+ if (err2) q.errors.push(err2);
10346
10509
  if (q.pendingCount === 0 && !q.done) {
10347
10510
  Object.keys(q.loaded).forEach((l) => {
10348
10511
  if (!loaded[l]) loaded[l] = {};
@@ -10381,19 +10544,19 @@ var Connector = class extends EventEmitter {
10381
10544
  return;
10382
10545
  }
10383
10546
  this.readingCalls++;
10384
- const resolver = (err, data) => {
10547
+ const resolver = (err2, data) => {
10385
10548
  this.readingCalls--;
10386
10549
  if (this.waitingReads.length > 0) {
10387
10550
  const next = this.waitingReads.shift();
10388
10551
  this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
10389
10552
  }
10390
- if (err && data && tried < this.maxRetries) {
10553
+ if (err2 && data && tried < this.maxRetries) {
10391
10554
  setTimeout(() => {
10392
10555
  this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
10393
10556
  }, wait);
10394
10557
  return;
10395
10558
  }
10396
- callback(err, data);
10559
+ callback(err2, data);
10397
10560
  };
10398
10561
  const fc = this.backend[fcName].bind(this.backend);
10399
10562
  if (fc.length === 2) {
@@ -10404,8 +10567,8 @@ var Connector = class extends EventEmitter {
10404
10567
  } else {
10405
10568
  resolver(null, r);
10406
10569
  }
10407
- } catch (err) {
10408
- resolver(err);
10570
+ } catch (err2) {
10571
+ resolver(err2);
10409
10572
  }
10410
10573
  return;
10411
10574
  }
@@ -10442,10 +10605,10 @@ var Connector = class extends EventEmitter {
10442
10605
  const s = name.split("|");
10443
10606
  const lng = s[0];
10444
10607
  const ns = s[1];
10445
- this.read(lng, ns, "read", void 0, void 0, (err, data) => {
10446
- if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
10447
- if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
10448
- 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);
10449
10612
  });
10450
10613
  }
10451
10614
  saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
@@ -10476,8 +10639,8 @@ var Connector = class extends EventEmitter {
10476
10639
  } else {
10477
10640
  clb(null, r);
10478
10641
  }
10479
- } catch (err) {
10480
- clb(err);
10642
+ } catch (err2) {
10643
+ clb(err2);
10481
10644
  }
10482
10645
  } else {
10483
10646
  fc(languages, namespace, key, fallbackValue, clb, opts);
@@ -10709,14 +10872,14 @@ var I18n = class _I18n extends EventEmitter {
10709
10872
  });
10710
10873
  const deferred = defer();
10711
10874
  const load = () => {
10712
- const finish = (err, t2) => {
10875
+ const finish = (err2, t2) => {
10713
10876
  this.isInitializing = false;
10714
10877
  if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn("init: i18next is already initialized. You should call init just once!");
10715
10878
  this.isInitialized = true;
10716
10879
  if (!this.options.isClone) this.logger.log("initialized", this.options);
10717
10880
  this.emit("initialized", this.options);
10718
10881
  deferred.resolve(t2);
10719
- callback(err, t2);
10882
+ callback(err2, t2);
10720
10883
  };
10721
10884
  if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return finish(null, this.t.bind(this));
10722
10885
  this.changeLanguage(this.options.lng, finish);
@@ -10775,9 +10938,9 @@ var I18n = class _I18n extends EventEmitter {
10775
10938
  if (!lngs) lngs = this.languages;
10776
10939
  if (!ns) ns = this.options.ns;
10777
10940
  if (!callback) callback = noop;
10778
- this.services.backendConnector.reload(lngs, ns, (err) => {
10941
+ this.services.backendConnector.reload(lngs, ns, (err2) => {
10779
10942
  deferred.resolve();
10780
- callback(err);
10943
+ callback(err2);
10781
10944
  });
10782
10945
  return deferred;
10783
10946
  }
@@ -10830,7 +10993,7 @@ var I18n = class _I18n extends EventEmitter {
10830
10993
  this.resolvedLanguage = void 0;
10831
10994
  this.setResolvedLanguage(l);
10832
10995
  };
10833
- const done = (err, l) => {
10996
+ const done = (err2, l) => {
10834
10997
  if (l) {
10835
10998
  setLngProps(l);
10836
10999
  this.translator.changeLanguage(l);
@@ -10843,7 +11006,7 @@ var I18n = class _I18n extends EventEmitter {
10843
11006
  deferred.resolve(function() {
10844
11007
  return _this2.t(...arguments);
10845
11008
  });
10846
- if (callback) callback(err, function() {
11009
+ if (callback) callback(err2, function() {
10847
11010
  return _this2.t(...arguments);
10848
11011
  });
10849
11012
  };
@@ -10857,8 +11020,8 @@ var I18n = class _I18n extends EventEmitter {
10857
11020
  if (!this.translator.language) this.translator.changeLanguage(l);
10858
11021
  if (this.services.languageDetector && this.services.languageDetector.cacheUserLanguage) this.services.languageDetector.cacheUserLanguage(l);
10859
11022
  }
10860
- this.loadResources(l, (err) => {
10861
- done(err, l);
11023
+ this.loadResources(l, (err2) => {
11024
+ done(err2, l);
10862
11025
  });
10863
11026
  };
10864
11027
  if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
@@ -10956,9 +11119,9 @@ var I18n = class _I18n extends EventEmitter {
10956
11119
  ns.forEach((n) => {
10957
11120
  if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
10958
11121
  });
10959
- this.loadResources((err) => {
11122
+ this.loadResources((err2) => {
10960
11123
  deferred.resolve();
10961
- if (callback) callback(err);
11124
+ if (callback) callback(err2);
10962
11125
  });
10963
11126
  return deferred;
10964
11127
  }
@@ -10972,9 +11135,9 @@ var I18n = class _I18n extends EventEmitter {
10972
11135
  return Promise.resolve();
10973
11136
  }
10974
11137
  this.options.preload = preloaded.concat(newLngs);
10975
- this.loadResources((err) => {
11138
+ this.loadResources((err2) => {
10976
11139
  deferred.resolve();
10977
- if (callback) callback(err);
11140
+ if (callback) callback(err2);
10978
11141
  });
10979
11142
  return deferred;
10980
11143
  }
@@ -11471,12 +11634,6 @@ var initialState3 = {
11471
11634
  rows: [],
11472
11635
  focusContext: null
11473
11636
  };
11474
- var reorderList = (list, from, to) => {
11475
- const next = [...list];
11476
- const [moved] = next.splice(from, 1);
11477
- next.splice(to, 0, moved);
11478
- return next;
11479
- };
11480
11637
  var createSliceWithThunks3 = buildCreateSlice({
11481
11638
  creators: { asyncThunk: asyncThunkCreator }
11482
11639
  });
@@ -11690,41 +11847,27 @@ var tableSlice = createSliceWithThunks3({
11690
11847
  addColumn: create.asyncThunk(
11691
11848
  async (args, { dispatch, getState, rejectWithValue }) => {
11692
11849
  const { tenantId, tableId, columnName } = args;
11693
- if (!columnName.trim()) {
11694
- return rejectWithValue("\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
11695
- }
11696
11850
  const state3 = getState().table;
11697
11851
  const meta = state3.currentTable;
11698
11852
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11699
11853
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11700
11854
  }
11701
- if (meta.columns.some((c) => c.name === columnName)) {
11702
- 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);
11703
11862
  }
11704
11863
  try {
11705
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11706
- const newColumn = {
11707
- id: ulid5(),
11708
- name: columnName,
11709
- // 默认显示名与机器名一致;之后用户可以单独改 label
11710
- label: columnName
11711
- };
11712
- const newColumns = [...meta.columns, newColumn];
11713
11864
  await dispatch(
11714
11865
  patch({
11715
11866
  dbKey: meta.dbKey,
11716
- changes: {
11717
- columns: newColumns,
11718
- updatedAt: nowIso
11719
- }
11867
+ changes: result.value.metaChanges
11720
11868
  })
11721
11869
  ).unwrap();
11722
- const nextMeta = {
11723
- ...meta,
11724
- columns: newColumns,
11725
- updatedAt: nowIso
11726
- };
11727
- return nextMeta;
11870
+ return result.value.meta;
11728
11871
  } catch (e) {
11729
11872
  return rejectWithValue(e.message || "\u6DFB\u52A0\u5B57\u6BB5\u5931\u8D25");
11730
11873
  }
@@ -11753,58 +11896,24 @@ var tableSlice = createSliceWithThunks3({
11753
11896
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11754
11897
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11755
11898
  }
11756
- if (!meta.columns.some((c) => c.name === columnName)) {
11757
- return rejectWithValue(`\u5B57\u6BB5 ${columnName} \u4E0D\u5B58\u5728`);
11758
- }
11759
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11760
- const newColumns = meta.columns.filter(
11761
- (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()) }
11762
11904
  );
11763
- const rows = state3.rows;
11905
+ if (!result.ok) {
11906
+ return rejectWithValue(result.error);
11907
+ }
11908
+ const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
11764
11909
  try {
11765
- const rowsWithField = rows.filter(
11766
- (row) => Object.prototype.hasOwnProperty.call(row, columnName)
11767
- );
11768
11910
  await Promise.all(
11769
- rowsWithField.map(
11770
- (row) => dispatch(
11771
- patch({
11772
- dbKey: row.dbKey,
11773
- changes: {
11774
- [columnName]: null,
11775
- updatedAt: nowIso
11776
- }
11777
- })
11778
- ).unwrap()
11779
- )
11911
+ rowPatches.map((p) => dispatch(patch(p)).unwrap())
11780
11912
  );
11781
11913
  await dispatch(
11782
- patch({
11783
- dbKey: meta.dbKey,
11784
- changes: {
11785
- columns: newColumns,
11786
- updatedAt: nowIso
11787
- }
11788
- })
11914
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11789
11915
  ).unwrap();
11790
- const newRows = rows.map((row) => {
11791
- if (!Object.prototype.hasOwnProperty.call(row, columnName)) {
11792
- return row;
11793
- }
11794
- const { [columnName]: _removed, ...rest } = row;
11795
- return {
11796
- ...rest,
11797
- updatedAt: nowIso
11798
- };
11799
- });
11800
- return {
11801
- meta: {
11802
- ...meta,
11803
- columns: newColumns,
11804
- updatedAt: nowIso
11805
- },
11806
- rows: newRows
11807
- };
11916
+ return { meta: nextMeta, rows: newRows };
11808
11917
  } catch (e) {
11809
11918
  return rejectWithValue(e.message || "\u5220\u9664\u5B57\u6BB5\u5931\u8D25");
11810
11919
  }
@@ -11834,30 +11943,22 @@ var tableSlice = createSliceWithThunks3({
11834
11943
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11835
11944
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11836
11945
  }
11837
- const columnCount = meta.columns.length;
11838
- if (fromIndex < 0 || fromIndex >= columnCount || toIndex < 0 || toIndex >= columnCount) {
11839
- 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);
11840
11953
  }
11841
- if (fromIndex === toIndex) {
11954
+ if (result.value.noop) {
11842
11955
  return meta;
11843
11956
  }
11844
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11845
- const newColumns = reorderList(meta.columns, fromIndex, toIndex);
11957
+ const { meta: nextMeta, metaChanges } = result.value;
11846
11958
  try {
11847
11959
  await dispatch(
11848
- patch({
11849
- dbKey: meta.dbKey,
11850
- changes: {
11851
- columns: newColumns,
11852
- updatedAt: nowIso
11853
- }
11854
- })
11960
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11855
11961
  ).unwrap();
11856
- const nextMeta = {
11857
- ...meta,
11858
- columns: newColumns,
11859
- updatedAt: nowIso
11860
- };
11861
11962
  return nextMeta;
11862
11963
  } catch (e) {
11863
11964
  return rejectWithValue(e.message || "\u8C03\u6574\u5217\u987A\u5E8F\u5931\u8D25");
@@ -11884,73 +11985,29 @@ var tableSlice = createSliceWithThunks3({
11884
11985
  renameColumn: create.asyncThunk(
11885
11986
  async (args, { dispatch, getState, rejectWithValue }) => {
11886
11987
  const { tenantId, tableId, oldName, newName } = args;
11887
- const trimmedNewName = newName.trim();
11888
- if (!trimmedNewName) {
11889
- return rejectWithValue("\u65B0\u7684\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
11890
- }
11891
11988
  const state3 = getState().table;
11892
11989
  const meta = state3.currentTable;
11893
11990
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11894
11991
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11895
11992
  }
11896
- if (!meta.columns.some((c) => c.name === oldName)) {
11897
- return rejectWithValue(`\u5B57\u6BB5 ${oldName} \u4E0D\u5B58\u5728`);
11898
- }
11899
- if (meta.columns.some((c) => c.name === trimmedNewName)) {
11900
- return rejectWithValue(`\u5B57\u6BB5 ${trimmedNewName} \u5DF2\u5B58\u5728`);
11901
- }
11902
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11903
- const rows = state3.rows;
11904
- const newColumns = meta.columns.map(
11905
- (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()) }
11906
11998
  );
11999
+ if (!result.ok) {
12000
+ return rejectWithValue(result.error);
12001
+ }
12002
+ const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
11907
12003
  try {
11908
- const rowsWithOldField = rows.filter(
11909
- (row) => Object.prototype.hasOwnProperty.call(row, oldName)
11910
- );
11911
12004
  await Promise.all(
11912
- rowsWithOldField.map((row) => {
11913
- const changes = {
11914
- [trimmedNewName]: row[oldName],
11915
- [oldName]: null,
11916
- updatedAt: nowIso
11917
- };
11918
- return dispatch(
11919
- patch({
11920
- dbKey: row.dbKey,
11921
- changes
11922
- })
11923
- ).unwrap();
11924
- })
12005
+ rowPatches.map((p) => dispatch(patch(p)).unwrap())
11925
12006
  );
11926
12007
  await dispatch(
11927
- patch({
11928
- dbKey: meta.dbKey,
11929
- changes: {
11930
- columns: newColumns,
11931
- updatedAt: nowIso
11932
- }
11933
- })
12008
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11934
12009
  ).unwrap();
11935
- const newRows = rows.map((row) => {
11936
- if (!Object.prototype.hasOwnProperty.call(row, oldName)) {
11937
- return row;
11938
- }
11939
- const { [oldName]: oldValue, ...rest } = row;
11940
- return {
11941
- ...rest,
11942
- [trimmedNewName]: oldValue,
11943
- updatedAt: nowIso
11944
- };
11945
- });
11946
- return {
11947
- meta: {
11948
- ...meta,
11949
- columns: newColumns,
11950
- updatedAt: nowIso
11951
- },
11952
- rows: newRows
11953
- };
12010
+ return { meta: nextMeta, rows: newRows };
11954
12011
  } catch (e) {
11955
12012
  return rejectWithValue(e.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u5931\u8D25");
11956
12013
  }
@@ -11977,38 +12034,24 @@ var tableSlice = createSliceWithThunks3({
11977
12034
  renameColumnLabel: create.asyncThunk(
11978
12035
  async (args, { dispatch, getState, rejectWithValue }) => {
11979
12036
  const { tenantId, tableId, columnId, newLabel } = args;
11980
- const trimmedLabel = newLabel.trim();
11981
- if (!trimmedLabel) {
11982
- return rejectWithValue("\u5B57\u6BB5\u663E\u793A\u540D\u4E0D\u80FD\u4E3A\u7A7A");
11983
- }
11984
12037
  const state3 = getState().table;
11985
12038
  const meta = state3.currentTable;
11986
12039
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11987
12040
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11988
12041
  }
11989
- const column = meta.columns.find((c) => c.id === columnId);
11990
- if (!column) {
11991
- return rejectWithValue("\u8981\u91CD\u547D\u540D\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
11992
- }
11993
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11994
- const newColumns = meta.columns.map(
11995
- (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()) }
11996
12046
  );
12047
+ if (!result.ok) {
12048
+ return rejectWithValue(result.error);
12049
+ }
12050
+ const { meta: nextMeta, metaChanges } = result.value;
11997
12051
  try {
11998
12052
  await dispatch(
11999
- patch({
12000
- dbKey: meta.dbKey,
12001
- changes: {
12002
- columns: newColumns,
12003
- updatedAt: nowIso
12004
- }
12005
- })
12053
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
12006
12054
  ).unwrap();
12007
- const nextMeta = {
12008
- ...meta,
12009
- columns: newColumns,
12010
- updatedAt: nowIso
12011
- };
12012
12055
  return nextMeta;
12013
12056
  } catch (e) {
12014
12057
  return rejectWithValue(e.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u663E\u793A\u540D\u5931\u8D25");
@@ -12039,30 +12082,19 @@ var tableSlice = createSliceWithThunks3({
12039
12082
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
12040
12083
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
12041
12084
  }
12042
- const column = meta.columns.find((c) => c.id === columnId);
12043
- if (!column) {
12044
- return rejectWithValue("\u8981\u8C03\u6574\u5BBD\u5EA6\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
12045
- }
12046
- const normalizedWidth = typeof width === "number" && width > 0 ? Math.round(width) : void 0;
12047
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
12048
- const newColumns = meta.columns.map(
12049
- (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()) }
12050
12089
  );
12090
+ if (!result.ok) {
12091
+ return rejectWithValue(result.error);
12092
+ }
12093
+ const { meta: nextMeta, metaChanges } = result.value;
12051
12094
  try {
12052
12095
  await dispatch(
12053
- patch({
12054
- dbKey: meta.dbKey,
12055
- changes: {
12056
- columns: newColumns,
12057
- updatedAt: nowIso
12058
- }
12059
- })
12096
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
12060
12097
  ).unwrap();
12061
- const nextMeta = {
12062
- ...meta,
12063
- columns: newColumns,
12064
- updatedAt: nowIso
12065
- };
12066
12098
  return nextMeta;
12067
12099
  } catch (e) {
12068
12100
  return rejectWithValue(e.message || "\u66F4\u65B0\u5B57\u6BB5\u5BBD\u5EA6\u5931\u8D25");
@@ -12382,9 +12414,9 @@ var deleteContentFromSpaceAction = async (input, thunkAPI) => {
12382
12414
  sourceServerOrigin
12383
12415
  });
12384
12416
  }
12385
- } catch (err) {
12386
- console.error(`[deleteContent] Failed to delete entity ${entityKey}:`, err);
12387
- entityRemoveError = err.message || "Unknown error";
12417
+ } catch (err2) {
12418
+ console.error(`[deleteContent] Failed to delete entity ${entityKey}:`, err2);
12419
+ entityRemoveError = err2.message || "Unknown error";
12388
12420
  }
12389
12421
  return {
12390
12422
  contentKey,
@@ -13705,8 +13737,8 @@ async function resolveMemberId(db, identifier) {
13705
13737
  matchCount++;
13706
13738
  }
13707
13739
  }
13708
- } catch (err) {
13709
- 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");
13710
13742
  }
13711
13743
  if (matchCount > 1) {
13712
13744
  throw new Error(
@@ -13892,8 +13924,8 @@ async function getUserDataOnce({
13892
13924
  const localResults = await fetchUserData(db, typeArray, effectiveUserId);
13893
13925
  const localData = Object.values(localResults).flat();
13894
13926
  return { data: localData };
13895
- } catch (err) {
13896
- 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");
13897
13929
  return { data: [], error };
13898
13930
  }
13899
13931
  }
@@ -14242,8 +14274,8 @@ var deleteDbKey = (input, spaceId) => async (dispatch, getState) => {
14242
14274
  spaceId: spaceId2,
14243
14275
  ...preferredServerOrigin ? { sourceServerOrigin: preferredServerOrigin } : {}
14244
14276
  })
14245
- ).unwrap().catch((err) => {
14246
- 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);
14247
14279
  })
14248
14280
  )
14249
14281
  );
@@ -14349,10 +14381,10 @@ var deleteLocalSpaceAuthority = async (spaceId, spaceData, dispatch) => {
14349
14381
  },
14350
14382
  dispatch
14351
14383
  );
14352
- } catch (err) {
14384
+ } catch (err2) {
14353
14385
  console.warn(
14354
14386
  `Failed to tombstone local membership ${memberId} for space ${spaceId}:`,
14355
- err
14387
+ err2
14356
14388
  );
14357
14389
  }
14358
14390
  }
@@ -14362,9 +14394,9 @@ var deleteAllMembers = async (spaceData, spaceId, dispatch) => {
14362
14394
  for (const memberId of spaceData.members) {
14363
14395
  const memberKey = createSpaceKey.member(memberId, spaceId);
14364
14396
  await dispatch(remove(memberKey)).unwrap().catch(
14365
- (err) => console.warn(
14397
+ (err2) => console.warn(
14366
14398
  `Failed to delete member ${memberId} for space ${spaceId}:`,
14367
- err
14399
+ err2
14368
14400
  )
14369
14401
  );
14370
14402
  }
@@ -14373,9 +14405,9 @@ var deleteAllMembers = async (spaceData, spaceId, dispatch) => {
14373
14405
  var deleteCurrentUserMember = async (userId, spaceId, dispatch) => {
14374
14406
  const currentUserMemberKey = createSpaceKey.member(userId, spaceId);
14375
14407
  await dispatch(remove(currentUserMemberKey)).unwrap().catch(
14376
- (err) => console.warn(
14408
+ (err2) => console.warn(
14377
14409
  `Failed to delete member key for user ${userId} in space ${spaceId}:`,
14378
- err
14410
+ err2
14379
14411
  )
14380
14412
  );
14381
14413
  };
@@ -14494,7 +14526,7 @@ var fetchSpaceAction = async (input, thunkAPI) => {
14494
14526
  const spaceKey = createSpaceKey.space(spaceId);
14495
14527
  const readSpace = async (dbKey) => {
14496
14528
  try {
14497
- const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-7KQH6GOU.js");
14529
+ const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-CJJKYYXK.js");
14498
14530
  if (fresh) {
14499
14531
  return await dispatch(readAndWait2(dbKey)).unwrap();
14500
14532
  }
@@ -15183,7 +15215,6 @@ export {
15183
15215
  parseUiAskChoiceContent,
15184
15216
  PERSONALIZATION_DIALOG_CATEGORY,
15185
15217
  buildPersonalizationDialogPolicyContext,
15186
- resolveDialogMemorySubjectId,
15187
15218
  resolveDialogRuntimeAgentKey,
15188
15219
  resolveHandleSendMessageContext,
15189
15220
  estimateMissingUsage,
@@ -15199,6 +15230,7 @@ export {
15199
15230
  messageStreamEnd,
15200
15231
  addToolMessage,
15201
15232
  updateToolMessage,
15233
+ appendOverlayMessage,
15202
15234
  setWorkflow,
15203
15235
  updateStep,
15204
15236
  incrementStepsExecuted,