nolo-cli 0.16.0 → 0.18.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 (134) hide show
  1. package/{_executeModel-AVCA2NAV.js → _executeModel-X5PCIZN6.js} +50 -44
  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-2BZDQV36.js} +32 -29
  6. package/{agentEmailCommands-4ORVLGVQ.js → agentEmailCommands-2QJDGRMB.js} +62 -56
  7. package/{agentListCommands-YWBYRTYC.js → agentListCommands-6VEPTKBI.js} +31 -28
  8. package/{agentMachineCommands-JSQW4FOA.js → agentMachineCommands-NVVHNWYI.js} +30 -27
  9. package/{agentPullCommand-6HWUT3SW.js → agentPullCommand-ZZGU5KOY.js} +4 -4
  10. package/{agentRecordCommands-AASIWOBT.js → agentRecordCommands-4GGRDMD4.js} +57 -51
  11. package/{agentRunCommand-TB5BHXUH.js → agentRunCommand-XOLQNKBZ.js} +63 -54
  12. package/{agentRunControl-6ADXVYMR.js → agentRunControl-Y5AFH5PQ.js} +24 -1
  13. package/{agentRuntimeLocal-QNPNJRVH.js → agentRuntimeLocal-7WYWCGL4.js} +25 -22
  14. package/{agentSlice-RUNXC62Y.js → agentSlice-EAXPGEYV.js} +9 -8
  15. package/appDeleteCommands-77KR2RJ4.js +127 -0
  16. package/appDeployCommands-K7CAHGBI.js +166 -0
  17. package/appDeployStatusCommands-4OEKLTBT.js +147 -0
  18. package/appGetCommands-VM2WDLAZ.js +122 -0
  19. package/appListCommands-GX6BBA6U.js +125 -0
  20. package/{authCommand-YFTR3347.js → authCommand-DY6UUL6O.js} +16 -9
  21. package/{authCommands-YXGOXNBZ.js → authCommands-XTBV7OFZ.js} +6 -5
  22. package/{chunk-DPAB4FQ7.js → chunk-23FZYPLC.js} +1608 -212
  23. package/{chunk-LPEUV5RE.js → chunk-34WPV75U.js} +23 -2
  24. package/{chunk-XPC5C7BK.js → chunk-3ND52WIL.js} +2 -2
  25. package/{chunk-SOTZ6RDN.js → chunk-3Q7WHGCB.js} +1 -1
  26. package/{chunk-3OIRVWXA.js → chunk-3ZX7PERL.js} +10 -1
  27. package/{chunk-KKY4B2Q2.js → chunk-4PWB7JRR.js} +4 -1
  28. package/{chunk-6N4KODMN.js → chunk-4T5F7YZQ.js} +1 -1
  29. package/chunk-7BUYEZ6U.js +671 -0
  30. package/{chunk-AS3ZQ3O2.js → chunk-7OBMZCRD.js} +1 -1
  31. package/{chunk-IGXREZW2.js → chunk-AHCY2S2I.js} +1 -1
  32. package/{chunk-QLUFR47U.js → chunk-AL2V7U3E.js} +1 -1
  33. package/{chunk-MTU75CZ2.js → chunk-B5TOXZAK.js} +1 -1
  34. package/{chunk-AUURUT6L.js → chunk-BV4VEE3W.js} +264 -424
  35. package/{chunk-FRV6A633.js → chunk-CZ6NYQTV.js} +13 -4
  36. package/{chunk-PCTUYVUM.js → chunk-DFCFMCY6.js} +10 -3
  37. package/{chunk-JTMNCCWF.js → chunk-DKZFOK24.js} +16 -87
  38. package/chunk-DL6EPNIK.js +50 -0
  39. package/{chunk-ZQBL7LIC.js → chunk-EDV7EBOI.js} +317 -216
  40. package/{chunk-IWLUTMYX.js → chunk-ELT65PZW.js} +2 -2
  41. package/chunk-FQZZLA3C.js +223 -0
  42. package/{chunk-55NSNCFM.js → chunk-FXUSIQC2.js} +1 -1
  43. package/{chunk-MR6ISAGB.js → chunk-G5U6LDLG.js} +6 -6
  44. package/chunk-GFUIQ4RY.js +136 -0
  45. package/{chunk-NVEWUJVX.js → chunk-HEGV7BH3.js} +1 -1
  46. package/{chunk-BEBNFWDU.js → chunk-HWW2M4SN.js} +3 -3
  47. package/{chunk-4L2OJPCU.js → chunk-I2ZJKTG5.js} +58 -8
  48. package/{chunk-Z5JQNBNY.js → chunk-IYEXFJPC.js} +34 -15
  49. package/{setDialogExtraReferencesAction-LR6MSIXO.js → chunk-JLA4FXYC.js} +2 -17
  50. package/chunk-KFEVY3ST.js +255 -0
  51. package/{chunk-4FX6NVDW.js → chunk-L4F3I4SR.js} +3 -136
  52. package/{chunk-XBS2WYJ2.js → chunk-LLWKHDG4.js} +1 -1
  53. package/{chunk-3WGLLTK4.js → chunk-LSFAWXKC.js} +100 -3
  54. package/{chunk-6EVITP2G.js → chunk-MHSGJW4Z.js} +2 -251
  55. package/{chunk-O6W2O2DA.js → chunk-MKA6QE5E.js} +6 -2
  56. package/{chunk-DGEYDWEZ.js → chunk-MPVYDS7I.js} +3 -3
  57. package/{chunk-KFHN5NGJ.js → chunk-MVQ4TBSD.js} +1 -1
  58. package/{chunk-AVVZUXXC.js → chunk-N54HIJVJ.js} +34 -13
  59. package/{chunk-EHLHSX7R.js → chunk-OK6YSWLH.js} +9 -2
  60. package/{chunk-33BJUVK4.js → chunk-PIZYJVHQ.js} +5 -5
  61. package/{chunk-RLCXU7A5.js → chunk-PJSV3IZ5.js} +1 -1
  62. package/{chunk-7UKFVQ5W.js → chunk-R35XMF6F.js} +126 -41
  63. package/{chunk-OOSFSFMA.js → chunk-R5V5G73M.js} +2 -0
  64. package/{chunk-S2LXHNHG.js → chunk-REA4JLBH.js} +6 -6
  65. package/chunk-RQN4SEKL.js +107 -0
  66. package/{chunk-EABWT43X.js → chunk-RVOUXDFU.js} +5 -5
  67. package/{chunk-NSCHQQPU.js → chunk-SCTYAHYK.js} +470 -325
  68. package/{chunk-JTINRTBT.js → chunk-SKDNBYZK.js} +2 -2
  69. package/{chunk-M43KDE25.js → chunk-SWDPIPOY.js} +2 -8
  70. package/{chunk-KMQPSTMJ.js → chunk-TRT4I4UD.js} +2 -2
  71. package/{chunk-66X4VSRC.js → chunk-UAIVG4J6.js} +42 -2
  72. package/{chunk-3663CXZN.js → chunk-UBHAWFQ6.js} +143 -31
  73. package/{chunk-YJKXGHJ6.js → chunk-UGUW3FHG.js} +4 -4
  74. package/{chunk-P3RIAYGG.js → chunk-V3ED5AWK.js} +3 -3
  75. package/chunk-V5R4NZP2.js +78 -0
  76. package/{chunk-4IJYA27C.js → chunk-VDXCXCXH.js} +1 -1
  77. package/{chunk-MYMMNKYL.js → chunk-VNAEBGDK.js} +156 -6
  78. package/{chunk-FY233ZFU.js → chunk-VYHDJEQD.js} +110 -192
  79. package/{chunk-W4NVOSFF.js → chunk-WFHXMLHZ.js} +1 -1
  80. package/{chunk-H33743XH.js → chunk-WJRJDX2W.js} +1 -1
  81. package/chunk-X4Q4UZEY.js +26 -0
  82. package/{chunk-RPDGJO4D.js → chunk-XHG22OEX.js} +4 -4
  83. package/{chunk-DVRHHFEA.js → chunk-XMLRJUU5.js} +1 -1
  84. package/{chunk-3S2VOMIF.js → chunk-XRZJGPFI.js} +7 -7
  85. package/{chunk-GSINCD4P.js → chunk-YGW4G5W5.js} +25 -12
  86. package/chunk-ZZ2MH7LE.js +84 -0
  87. package/{cliExecutor-K3F7DMRO.js → cliExecutor-DNE7TCC4.js} +2 -2
  88. package/codingSkills-36KN5NQT.js +48 -0
  89. package/{createAgentAutomationAction-FNHPSKKO.js → createAgentAutomationAction-GNFF524X.js} +20 -19
  90. package/{createDialogAction-TZCVQ3NU.js → createDialogAction-RB55KCLO.js} +22 -21
  91. package/{createPageAction-EIGZ3BKT.js → createPageAction-Y7343GLU.js} +26 -25
  92. package/{db-HCJ5PRB5.js → db-W3O47YGF.js} +38 -12
  93. package/{dbSlice-7KQH6GOU.js → dbSlice-CGSRFJN3.js} +8 -7
  94. package/{deleteFile-WPWVZE4B.js → deleteFile-WDZ3VM7B.js} +3 -3
  95. package/{dialogCommands-FO77J5DQ.js → dialogCommands-IAZK6YHQ.js} +30 -27
  96. package/{dialogSlice-MM5U4KE2.js → dialogSlice-UQAXF23P.js} +20 -19
  97. package/{docCreateCommands-I3BS3AZI.js → docCreateCommands-I2EWZGCI.js} +33 -28
  98. package/{docDeleteCommands-Q2OPV52P.js → docDeleteCommands-IZ45UZKG.js} +32 -27
  99. package/{docReadCommands-YOOFACYZ.js → docReadCommands-R6Z4QJYU.js} +31 -26
  100. package/{docStore-NGYQ2JTR.js → docStore-5HOJ4D7D.js} +21 -20
  101. package/{docUpdateCommands-2B32ITHN.js → docUpdateCommands-2LRBKQPY.js} +32 -27
  102. package/{fetchMessages-KTNM7QAR.js → fetchMessages-BMGVZVSE.js} +4 -3
  103. package/{getPricing-P4XRJRZB.js → getPricing-G7DLAST6.js} +3 -3
  104. package/{handleSendMessageAction-JRZWWBKP.js → handleSendMessageAction-Q4HY35WX.js} +21 -20
  105. package/index.js +95 -64
  106. package/{localDialogRead-2VRI24F4.js → localDialogRead-4H3QJFLW.js} +2 -2
  107. package/{localRuntimeDb-LGDF6FQP.js → localRuntimeDb-THJZGAOJ.js} +1 -1
  108. package/{machineCommands-WRWF2ICZ.js → machineCommands-PKBPQKTY.js} +63 -57
  109. package/{machineWsRunDispatch-ZX7Q3TWZ.js → machineWsRunDispatch-UZAW4OXJ.js} +55 -49
  110. package/{models-WQ5N4OJM.js → models-DJFSJ7SW.js} +2 -2
  111. package/package.json +1 -1
  112. package/queryRunOverlay-O4LOMMPO.js +161 -0
  113. package/{read-CN3TNXIP.js → read-3FMPZPER.js} +3 -3
  114. package/{readDocTool-WF3675ED.js → readDocTool-VSYHKK3V.js} +1 -1
  115. package/{readlineWorkspace-ZTGRGW46.js → readlineWorkspace-Y2RDOFZG.js} +762 -218
  116. package/{removeDialogAgentAction-YDHBFEGI.js → removeDialogAgentAction-OAGA2G3U.js} +10 -9
  117. package/{runAgentClientLoop-JZCOP7LG.js → runAgentClientLoop-NBPIKJ6J.js} +44 -38
  118. package/runOverlayPresentation-ZO4VCWEU.js +11 -0
  119. package/{runtimeDoctorCommands-THIHX2SY.js → runtimeDoctorCommands-E2OUORHK.js} +6 -6
  120. package/setDialogExtraReferencesAction-JZEXA5SL.js +27 -0
  121. package/{setPrimaryDialogAgentAction-IIVDCY5C.js → setPrimaryDialogAgentAction-4ZUQQKDG.js} +26 -17
  122. package/{settingSlice-O23YDK2O.js → settingSlice-7MNKHZ6R.js} +9 -8
  123. package/{skillDiscovery-6M2BZUFN.js → skillDiscovery-KJWT7JBU.js} +3 -3
  124. package/{spaceCommands-VV4GTPQK.js → spaceCommands-DHCZ7J5I.js} +31 -28
  125. package/{spaceSlice-DRWWZJP7.js → spaceSlice-ZXLLG3CR.js} +20 -19
  126. package/{streamAgentChatTurn-Y6WGATQR.js → streamAgentChatTurn-L3YW6LSB.js} +98 -57
  127. package/{tableCommands-3P7MJ3PF.js → tableCommands-BEQAGE4I.js} +1 -1
  128. package/{tools-PUNBY3AH.js → tools-ECGXR5QF.js} +33 -28
  129. package/{tuiSummaryLlmCaller-F64WLSAF.js → tuiSummaryLlmCaller-OMSCNHXA.js} +6 -5
  130. package/types-ZSTJ7MPR.js +7 -0
  131. package/{updateDialogTitleAction-YSR4TCMB.js → updateDialogTitleAction-HQ2EUDFT.js} +23 -22
  132. package/{chunk-O4BU24WZ.js → chunk-6Y7A3OQQ.js} +3 -3
  133. package/{chunk-CMKUBIGW.js → chunk-X7W4TNB4.js} +3 -3
  134. 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-REA4JLBH.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-I2ZJKTG5.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-UAIVG4J6.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,8 +3637,9 @@ var uiAskChoiceFunctionSchema = {
3635
3637
  "- \u6BCF\u4E2A question \u53EF\u4EE5\u8BBE\u7F6E multiSelect: true \u5141\u8BB8\u591A\u9009\u3002",
3636
3638
  "- \u6BCF\u4E2A question \u53EF\u4EE5\u8BBE\u7F6E allowOther: false \u9690\u85CF\u201C\u5176\u4ED6\u201D\u8F93\u5165\u6846\u3002",
3637
3639
  "- \u6BCF\u4E2A choice \u53EF\u4EE5\u52A0 detail \u5B57\u6BB5\u63D0\u4F9B\u66F4\u957F\u7684\u63CF\u8FF0\u3002",
3640
+ "- \u6BCF\u4E2A choice \u53EF\u4EE5\u52A0 recommended: true \u6807\u8BB0\u4F60\u7684\u63A8\u8350\u9879\uFF08\u6709\u660E\u786E\u63A8\u8350\u65F6\u7528\uFF09\u3002",
3638
3641
  "",
3639
- "\u4F55\u65F6\u8C03\u7528 / \u8C03\u7528\u89C4\u8303\u7684\u5B8C\u6574\u884C\u4E3A\u89C4\u5219\u7531\u7CFB\u7EDF\u63D0\u793A\u7684\u300C\u4EA4\u4E92\u8BF4\u660E\u300D\u5757\u6CE8\u5165\uFF0C\u4E0D\u5728\u6B64\u91CD\u590D\u3002"
3642
+ "\u4F55\u65F6\u8C03\u7528 / \u63A8\u8350\u4E0E\u6743\u8861 / \u8C03\u7528\u89C4\u8303\u7684\u5B8C\u6574\u884C\u4E3A\u89C4\u5219\u7531\u7CFB\u7EDF\u63D0\u793A\u7684\u300C\u4EA4\u4E92\u8BF4\u660E\u300D\u5757\u6CE8\u5165\uFF0C\u4E0D\u5728\u6B64\u91CD\u590D\u3002"
3640
3643
  ].join("\n"),
3641
3644
  parameters: {
3642
3645
  type: "object",
@@ -3663,6 +3666,13 @@ var uiAskChoiceFunctionSchema = {
3663
3666
  type: "string",
3664
3667
  description: "\u7B80\u77ED\u8865\u5145\uFF08\u5EFA\u8BAE\u4E00\u53E5\u8BDD\uFF09\uFF0C\u957F\u89E3\u91CA\u5199\u8FDB\u8C03\u7528\u524D\u7684\u56DE\u590D\u6587\u672C\u3002"
3665
3668
  },
3669
+ recommended: {
3670
+ type: "boolean",
3671
+ description: [
3672
+ "\u6807\u8BB0\u8FD9\u662F\u4F60\u7684\u63A8\u8350\u9879\u3002\u6709\u660E\u786E\u63A8\u8350\u65F6\u628A\u8BE5\u9009\u9879\u653E\u5728 choices \u7B2C\u4E00\u4F4D\u5E76\u7F6E true\u3002",
3673
+ "\u6CA1\u6709\u660E\u786E\u63A8\u8350\u65F6\u4E0D\u8981\u8BBE\u7F6E\uFF08\u9ED8\u8BA4 false\uFF09\uFF0C\u5E76\u5728\u8C03\u7528\u524D\u6587\u672C\u91CC\u8BF4\u660E\u5404\u9009\u9879\u4F18\u7F3A\u70B9\u3002"
3674
+ ].join(" ")
3675
+ },
3666
3676
  userMessage: {
3667
3677
  type: "string",
3668
3678
  description: [
@@ -3701,6 +3711,10 @@ var uiAskChoiceFunctionSchema = {
3701
3711
  type: "string",
3702
3712
  description: "\u7B80\u77ED\u8865\u5145\uFF08\u5EFA\u8BAE\u4E00\u53E5\u8BDD\uFF09\uFF0C\u957F\u89E3\u91CA\u5199\u8FDB\u8C03\u7528\u524D\u7684\u56DE\u590D\u6587\u672C\u3002"
3703
3713
  },
3714
+ recommended: {
3715
+ type: "boolean",
3716
+ description: "\u6807\u8BB0\u8FD9\u662F\u4F60\u7684\u63A8\u8350\u9879\uFF08\u6709\u660E\u786E\u63A8\u8350\u65F6\u7F6E true\uFF0C\u65E0\u5219\u7701\u7565\uFF09\u3002"
3717
+ },
3704
3718
  userMessage: { type: "string" }
3705
3719
  },
3706
3720
  required: ["id", "label"]
@@ -3743,7 +3757,7 @@ async function uiAskChoiceFunc(args, _thunkApi) {
3743
3757
  const firstQ = args.questions[0];
3744
3758
  return {
3745
3759
  rawData: {
3746
- type: "ui_ask_choice",
3760
+ type: "ask_user",
3747
3761
  question: firstQ?.question ?? "",
3748
3762
  choices: firstQ?.choices ?? [],
3749
3763
  blocking,
@@ -3755,11 +3769,11 @@ async function uiAskChoiceFunc(args, _thunkApi) {
3755
3769
  const question = String(args?.question ?? "").trim();
3756
3770
  const choices = Array.isArray(args?.choices) ? args.choices : [];
3757
3771
  if (!question || choices.length === 0) {
3758
- throw new Error("ui_ask_choice \u9700\u8981 question+choices \u6216 questions\u3002");
3772
+ throw new Error("ask_user \u9700\u8981 question+choices \u6216 questions\u3002");
3759
3773
  }
3760
3774
  return {
3761
3775
  rawData: {
3762
- type: "ui_ask_choice",
3776
+ type: "ask_user",
3763
3777
  question,
3764
3778
  choices,
3765
3779
  blocking
@@ -3776,14 +3790,14 @@ function parseUiAskChoiceContent(rawContent) {
3776
3790
  }
3777
3791
  })() : rawContent;
3778
3792
  if (!parsed || typeof parsed !== "object") return null;
3779
- if (parsed.type !== "ui_ask_choice") return null;
3793
+ if (parsed.type !== "ask_user") return null;
3780
3794
  return parsed;
3781
3795
  }
3782
3796
 
3783
3797
  // packages/ai/policy/personalizationDialog.ts
3784
3798
  var PERSONALIZATION_DIALOG_CATEGORY = "user-overlay-profile";
3785
3799
  var PERSONALIZATION_DIALOG_EXTRA_TOOLS = [
3786
- "ui_ask_choice",
3800
+ "ask_user",
3787
3801
  "updateUserPreferenceProfile"
3788
3802
  ];
3789
3803
  var buildPersonalizationRuntimeOptions = (runtimeOptions) => ({
@@ -3799,20 +3813,41 @@ var buildPersonalizationDialogPolicyContext = () => [
3799
3813
  "\u5F53\u524D\u5BF9\u8BDD\u662F\u201C\u7528\u6237\u4E2A\u6027\u5316\u8BBE\u7F6E\u201D\u6A21\u5F0F\uFF0C\u4E0D\u662F\u666E\u901A\u95F2\u804A\u3002",
3800
3814
  "\u4F60\u7684\u76EE\u6807\u662F\u7528\u7B80\u77ED\u5BF9\u8BDD\u5E2E\u52A9\u7528\u6237\u786E\u8BA4 tone\u3001knowledge_capture\u3001space_context \u8FD9\u4E09\u9879\u504F\u597D\u3002",
3801
3815
  "\u5982\u679C\u7528\u6237\u5148\u4ECB\u7ECD\u81EA\u5DF1\u3001\u5DE5\u4F5C\u65B9\u5F0F\u6216\u957F\u671F\u6C9F\u901A\u504F\u597D\uFF0C\u8BF7\u628A\u8FD9\u4E9B\u53EF\u590D\u7528\u4FE1\u606F\u6574\u7406\u6210\u7B80\u6D01\u7684 globalPrompt \u8349\u6848\uFF0C\u5E76\u5728\u7528\u6237\u786E\u8BA4\u540E\u901A\u8FC7 updateUserPreferenceProfile \u4FDD\u5B58\u3002",
3802
- "\u4F18\u5148\u4E00\u6B21\u53EA\u95EE\u4E00\u4E2A\u95EE\u9898\uFF1B\u5F53\u5B58\u5728\u6E05\u6670\u4E92\u65A5\u9009\u9879\u65F6\uFF0C\u4F18\u5148\u8C03\u7528 ui_ask_choice\u3002",
3816
+ "\u4F18\u5148\u4E00\u6B21\u53EA\u95EE\u4E00\u4E2A\u95EE\u9898\uFF1B\u5F53\u5B58\u5728\u6E05\u6670\u4E92\u65A5\u9009\u9879\u65F6\uFF0C\u4F18\u5148\u8C03\u7528 ask_user\u3002",
3803
3817
  "\u6536\u96C6\u5230\u8DB3\u591F\u4FE1\u606F\u540E\uFF0C\u8C03\u7528 updateUserPreferenceProfile \u4FDD\u5B58\u7ED3\u679C\uFF0C\u7136\u540E\u7528\u81EA\u7136\u8BED\u8A00\u603B\u7ED3\u5DF2\u4FDD\u5B58\u7684\u8BBE\u7F6E\u3002",
3804
3818
  "\u4FDD\u5B58\u5B8C\u6210\u540E\uFF0C\u8981\u63D0\u9192\u7528\u6237\uFF1A\u4EE5\u540E\u4E5F\u53EF\u4EE5\u5728\u8BBE\u7F6E\u91CC\u4FEE\u6539 globalPrompt \u548C\u8FD9\u4E9B\u504F\u597D\uFF0C\u6216\u8005\u518D\u6B21\u6253\u5F00\u8FD9\u4E2A\u5165\u53E3\u7EE7\u7EED\u8C03\u6574\u3002",
3805
3819
  "\u4E2A\u6027\u5316\u8BBE\u7F6E\u5B8C\u6210\u540E\uFF0C\u53EF\u987A\u624B\u5F15\u5BFC\u7528\u6237\u5C1D\u8BD5 1 \u5230 2 \u4E2A\u76F8\u5173\u529F\u80FD\uFF0C\u4F8B\u5982\u9996\u9875\u5FEB\u6377\u5BF9\u8BDD\u3001\u521B\u5EFA\u7B14\u8BB0\u3001\u521B\u5EFA AI\uFF0C\u4F46\u4E0D\u8981\u4E00\u6B21\u63A8\u8350\u592A\u591A\u3002",
3806
3820
  "\u9664\u975E\u7528\u6237\u660E\u786E\u8981\u6C42\uFF0C\u5426\u5219\u4E0D\u8981\u521B\u5EFA\u6587\u6863\uFF0C\u4E0D\u8981\u521B\u5EFA\u6216\u4FEE\u6539\u4EFB\u4F55 agent\u3002"
3807
3821
  ].join("\n");
3808
3822
 
3823
+ // packages/chat/dialog/dialogAgentPolicy.ts
3824
+ var resolveDialogAgentMode = (dialog) => {
3825
+ if (dialog?.agentMode === "auto") return "auto";
3826
+ if (dialog?.agentMode === "fixed") return "fixed";
3827
+ return getPrimaryDialogAgentId(dialog) ? "fixed" : "auto";
3828
+ };
3829
+ var resolveDialogAutoTier = (dialog) => {
3830
+ const tier = asOptionalTrimmedString(dialog?.autoRoute?.stickyTier);
3831
+ return tier === "flash" || tier === "balanced" || tier === "quality" || tier === "image" ? tier : void 0;
3832
+ };
3833
+ var resolveDialogRuntimeAgentKey = (dialog, explicitAgentKey) => {
3834
+ const explicit = asOptionalTrimmedString(explicitAgentKey);
3835
+ if (explicit) return explicit;
3836
+ if (resolveDialogAgentMode(dialog) === "fixed") {
3837
+ const fixed = getPrimaryDialogAgentId(dialog);
3838
+ if (fixed) return fixed;
3839
+ }
3840
+ return resolveAutoExecutionProfile(
3841
+ resolveDialogAutoTier(dialog) ?? DEFAULT_AUTO_EXECUTION_PROFILE.tier
3842
+ ).legacyAgentKey;
3843
+ };
3844
+
3809
3845
  // packages/chat/dialog/actions/handleSendMessageResolver.ts
3810
3846
  function resolveHandleSendMessageContext(input) {
3811
3847
  const { dialogConfig, targetAgentKey, runtimeOptions } = input;
3812
- const defaultAgentKey = getPrimaryDialogAgentId(dialogConfig) ?? void 0;
3813
3848
  return {
3814
- agentKeyToUse: targetAgentKey || defaultAgentKey,
3815
- effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(runtimeOptions) : runtimeOptions
3849
+ agentKeyToUse: resolveDialogRuntimeAgentKey(dialogConfig, targetAgentKey),
3850
+ effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(runtimeOptions ?? {}) : runtimeOptions
3816
3851
  };
3817
3852
  }
3818
3853
 
@@ -4601,6 +4636,7 @@ async function captureUnderstandingFromCompletedUiTurn(input) {
4601
4636
  const token = typeof state3?.auth?.currentToken === "string" ? state3.auth.currentToken : null;
4602
4637
  const baseUrl = resolveMemoryCaptureBaseUrl(state3);
4603
4638
  if (!token || !baseUrl) return;
4639
+ const dialog = input.dialogKey ? selectById(state3, input.dialogKey) : void 0;
4604
4640
  try {
4605
4641
  await fetch(`${baseUrl}/api/memory/capture-turn`, {
4606
4642
  method: "POST",
@@ -4944,6 +4980,33 @@ var messageSlice = createSliceWithThunks({
4944
4980
  });
4945
4981
  }
4946
4982
  }),
4983
+ /**
4984
+ * Append a run-overlay presentation as a non-streaming assistant message.
4985
+ *
4986
+ * This is a pure UI presentation action — it does NOT trigger a new agent
4987
+ * turn, does NOT call the LLM, and is therefore not billed. The message
4988
+ * is upserted into the dialog's message list so the user sees the run
4989
+ * status snapshot at turn-end. A fresh message id/dbKey are minted from
4990
+ * the dialog id so repeated overlays across turns don't collide.
4991
+ *
4992
+ * The message is marked role:"assistant" with isStreaming:false. Callers
4993
+ * that want to keep it out of the LLM context can post-filter by the
4994
+ * `metadata.overlayMessage` flag set here.
4995
+ */
4996
+ appendOverlayMessage: create.reducer((state3, action2) => {
4997
+ const dialogId = extractCustomId(action2.payload.dialogKey);
4998
+ if (!dialogId) return;
4999
+ const dialogState = ensureMessageDialogState(state3, dialogId);
5000
+ const { key: msgKey, messageId } = createDialogMessageKeyAndId(dialogId);
5001
+ upsertOneMessage(dialogState, {
5002
+ id: messageId,
5003
+ dbKey: msgKey,
5004
+ role: "assistant",
5005
+ content: action2.payload.text,
5006
+ isStreaming: false,
5007
+ metadata: { overlayMessage: true }
5008
+ });
5009
+ }),
4947
5010
  prepareAndPersistMessage: create.asyncThunk(
4948
5011
  async (args, thunkApi) => {
4949
5012
  const { message, dialogConfig } = args;
@@ -4969,7 +5032,7 @@ var messageSlice = createSliceWithThunks({
4969
5032
  content: message.content,
4970
5033
  dialogKey
4971
5034
  })
4972
- ).catch((err) => console.error("Failed to add refs:", err));
5035
+ ).catch((err2) => console.error("Failed to add refs:", err2));
4973
5036
  dispatch(messageActions.addUserMessage({ ...fullMessage, dialogId }));
4974
5037
  const { controller, ...messageToWrite } = fullMessage;
4975
5038
  await dispatch(
@@ -5036,8 +5099,8 @@ var messageSlice = createSliceWithThunks({
5036
5099
  messages: finalMessages2.filter(isValidMessage)
5037
5100
  })
5038
5101
  );
5039
- }).catch((err) => {
5040
- console.error("[initMsgs] background remote revalidate failed:", err);
5102
+ }).catch((err2) => {
5103
+ console.error("[initMsgs] background remote revalidate failed:", err2);
5041
5104
  });
5042
5105
  return validLocalMessages;
5043
5106
  }
@@ -5054,7 +5117,7 @@ var messageSlice = createSliceWithThunks({
5054
5117
  updateDialogSummaryAction(
5055
5118
  { dialogKey: decision.dialogKey, preFetchedMessages: finalMessages },
5056
5119
  thunkApi
5057
- ).catch((err) => console.error("Resume summary failed:", err));
5120
+ ).catch((err2) => console.error("Resume summary failed:", err2));
5058
5121
  }
5059
5122
  } catch {
5060
5123
  console.error("[initMsgs] Failed to resume summary");
@@ -5360,12 +5423,12 @@ var messageSlice = createSliceWithThunks({
5360
5423
  reason: summaryReason
5361
5424
  },
5362
5425
  { dispatch, getState }
5363
- ).catch((err) => console.error("Summary update failed:", err));
5426
+ ).catch((err2) => console.error("Summary update failed:", err2));
5364
5427
  if (addRefs) {
5365
5428
  dispatch(addReferenceKeysAction({
5366
5429
  content: finalVisibleContent,
5367
5430
  dialogKey
5368
- })).catch((err) => console.error("Failed to add assistant refs:", err));
5431
+ })).catch((err2) => console.error("Failed to add assistant refs:", err2));
5369
5432
  }
5370
5433
  }
5371
5434
  captureUnderstandingFromCompletedUiTurn2({
@@ -5377,7 +5440,7 @@ var messageSlice = createSliceWithThunks({
5377
5440
  assistantText: textContent,
5378
5441
  toolCalls
5379
5442
  }).catch(
5380
- (err) => console.error("Understanding memory capture failed:", err)
5443
+ (err2) => console.error("Understanding memory capture failed:", err2)
5381
5444
  );
5382
5445
  return {
5383
5446
  id: messageId,
@@ -5529,7 +5592,7 @@ var messageSlice = createSliceWithThunks({
5529
5592
  runtimeOptions: args.runtimeOptions
5530
5593
  });
5531
5594
  if (agentKeyToUse) {
5532
- const { streamAgentChatTurn } = await import("./agentSlice-RUNXC62Y.js");
5595
+ const { streamAgentChatTurn } = await import("./agentSlice-EAXPGEYV.js");
5533
5596
  await dispatch(
5534
5597
  streamAgentChatTurn({
5535
5598
  agentKey: agentKeyToUse,
@@ -5585,7 +5648,8 @@ var {
5585
5648
  editUserMessageAndReplay,
5586
5649
  addToolMessage,
5587
5650
  updateToolMessage,
5588
- removeMessagesByIds
5651
+ removeMessagesByIds,
5652
+ appendOverlayMessage
5589
5653
  } = messageSlice.actions;
5590
5654
  var messageSlice_default = messageSlice.reducer;
5591
5655
 
@@ -7554,6 +7618,12 @@ var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceT
7554
7618
  case "openai":
7555
7619
  case "deepinfra":
7556
7620
  return calculateCacheBasedCost(resolvedPrice, usage, externalPrice);
7621
+ // nolo/crof: honor inputCacheHit only when the model defines it (K3 has
7622
+ // inputCacheHit=2). Models without it (e.g. K2.6) keep simple full-price
7623
+ // billing so cached tokens are not priced at 0.
7624
+ case "nolo":
7625
+ case "crof":
7626
+ return typeof resolvedPrice.inputCacheHit === "number" ? calculateCacheBasedCost(resolvedPrice, usage, externalPrice) : calculateSimpleCost(resolvedPrice, usage, externalPrice);
7557
7627
  case "anthropic":
7558
7628
  return calculateAnthropicCost(resolvedPrice, usage, externalPrice);
7559
7629
  case "google":
@@ -8000,7 +8070,7 @@ var saveTokenUsage = async (data, thunkApi) => {
8000
8070
  currentStats = await thunkApi.dispatch(read({
8001
8071
  dbKey: tokenDayStatsKey
8002
8072
  })).unwrap();
8003
- } catch (err) {
8073
+ } catch (err2) {
8004
8074
  logger3.warn({ tokenDayStatsKey }, "No existing stats found");
8005
8075
  }
8006
8076
  const updatedStats = await updateStats(
@@ -8187,7 +8257,7 @@ var deleteOwnedDialogAttachments = async (args) => {
8187
8257
  metadataReadFailures
8188
8258
  });
8189
8259
  if (!plan.deleteCandidates.length) return plan;
8190
- const { deleteFileAction } = await import("./deleteFile-WPWVZE4B.js");
8260
+ const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
8191
8261
  for (const candidate of plan.deleteCandidates) {
8192
8262
  if (candidate.fileDbKey) {
8193
8263
  await deleteFileAction(candidate.fileDbKey, args.thunkApi);
@@ -8249,7 +8319,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8249
8319
  }
8250
8320
  if (isCurrentDialog) {
8251
8321
  await thunkApi.dispatch(resetMsgs());
8252
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-MM5U4KE2.js");
8322
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-UQAXF23P.js");
8253
8323
  dispatch(clearPendingAttachments2());
8254
8324
  clearWorkflow();
8255
8325
  }
@@ -8258,35 +8328,35 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8258
8328
 
8259
8329
  // packages/chat/dialog/dialogSlice.ts
8260
8330
  var runCreateDialogAction = async (args, thunkApi) => {
8261
- const { createDialogAction } = await import("./createDialogAction-TZCVQ3NU.js");
8331
+ const { createDialogAction } = await import("./createDialogAction-RB55KCLO.js");
8262
8332
  return createDialogAction(args, thunkApi);
8263
8333
  };
8264
8334
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
8265
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-FNHPSKKO.js");
8335
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-GNFF524X.js");
8266
8336
  return createAgentAutomationAction(args, thunkApi);
8267
8337
  };
8268
8338
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
8269
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-YSR4TCMB.js");
8339
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-HQ2EUDFT.js");
8270
8340
  return updateDialogTitleAction(args, thunkApi);
8271
8341
  };
8272
8342
  var runAddDialogAgentAction = async (args, thunkApi) => {
8273
- const { addDialogAgentAction } = await import("./addDialogAgentAction-EJHHJZWW.js");
8343
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-FCMSKYAF.js");
8274
8344
  return addDialogAgentAction(args, thunkApi);
8275
8345
  };
8276
8346
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
8277
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-YDHBFEGI.js");
8347
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-OAGA2G3U.js");
8278
8348
  return removeDialogAgentAction(args, thunkApi);
8279
8349
  };
8280
8350
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
8281
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-IIVDCY5C.js");
8351
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-4ZUQQKDG.js");
8282
8352
  return setPrimaryDialogAgentAction(args, thunkApi);
8283
8353
  };
8284
8354
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
8285
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-LR6MSIXO.js");
8355
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-JZEXA5SL.js");
8286
8356
  return setDialogExtraReferencesAction(args, thunkApi);
8287
8357
  };
8288
8358
  var runHandleSendMessageAction = async (args, thunkApi) => {
8289
- const { handleSendMessageAction } = await import("./handleSendMessageAction-JRZWWBKP.js");
8359
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-Q4HY35WX.js");
8290
8360
  return handleSendMessageAction(args, thunkApi);
8291
8361
  };
8292
8362
  function clearDialogState() {
@@ -8299,7 +8369,7 @@ var createPageAndAddReference = createAsyncThunk(
8299
8369
  async (payload, { dispatch, getState, rejectWithValue }) => {
8300
8370
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
8301
8371
  try {
8302
- const { createDocState } = await import("./docStore-NGYQ2JTR.js");
8372
+ const { createDocState } = await import("./docStore-5HOJ4D7D.js");
8303
8373
  const pageKey = await createDocState(
8304
8374
  { slateData, title },
8305
8375
  { dispatch, getState }
@@ -8354,12 +8424,12 @@ var initDialog = createAsyncThunk(
8354
8424
  })
8355
8425
  ).unwrap();
8356
8426
  } catch (error) {
8357
- const err = error;
8358
- const isAborted = isAbortError(err) || err?.message === "Aborted";
8427
+ const err2 = error;
8428
+ const isAborted = isAbortError(err2) || err2?.message === "Aborted";
8359
8429
  const isCurrentDialog = getActiveDialogKey() === id;
8360
8430
  if (!isAborted && isCurrentDialog) {
8361
- setDialogConfigError(err?.message || "Failed to load dialog");
8362
- console.info("Failed to load dialog config:", err?.message);
8431
+ setDialogConfigError(err2?.message || "Failed to load dialog");
8432
+ console.info("Failed to load dialog config:", err2?.message);
8363
8433
  }
8364
8434
  throw error;
8365
8435
  }
@@ -8527,9 +8597,9 @@ var fetchTableRowsFromServer = async (server, tenantId, tableId, headers) => {
8527
8597
  if (!res.ok) {
8528
8598
  let msg = `\u52A0\u8F7D\u8868 ${tableId} \u884C\u5931\u8D25\uFF08${res.status}\uFF09`;
8529
8599
  try {
8530
- const err = await res.json();
8531
- if (err && typeof err.message === "string") {
8532
- msg = err.message;
8600
+ const err2 = await res.json();
8601
+ if (err2 && typeof err2.message === "string") {
8602
+ msg = err2.message;
8533
8603
  }
8534
8604
  } catch {
8535
8605
  }
@@ -8654,6 +8724,162 @@ var fetchAndCacheTableRows = async ({
8654
8724
  return tableDeleted ? [] : mergedRows.filter((row) => !row?.deletedAt);
8655
8725
  };
8656
8726
 
8727
+ // packages/render/table/tableColumnCore.ts
8728
+ var ok = (value) => ({ ok: true, value });
8729
+ var err = (error) => ({ ok: false, error });
8730
+ var hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
8731
+ var buildMeta = (meta, columns, updatedAt) => ({
8732
+ meta: { ...meta, columns, updatedAt },
8733
+ metaChanges: { columns, updatedAt },
8734
+ noop: false
8735
+ });
8736
+ var reorderList = (list, from, to) => {
8737
+ const next = [...list];
8738
+ const [moved] = next.splice(from, 1);
8739
+ next.splice(to, 0, moved);
8740
+ return next;
8741
+ };
8742
+ function addColumnToMeta(meta, input, deps) {
8743
+ const { columnName } = input;
8744
+ if (!columnName.trim()) {
8745
+ return err("\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8746
+ }
8747
+ if (meta.columns.some((c) => c.name === columnName)) {
8748
+ return err(`\u5B57\u6BB5 ${columnName} \u5DF2\u5B58\u5728`);
8749
+ }
8750
+ const newColumn = {
8751
+ id: deps.id,
8752
+ name: columnName,
8753
+ label: columnName
8754
+ };
8755
+ return ok(buildMeta(meta, [...meta.columns, newColumn], deps.nowIso));
8756
+ }
8757
+ function deleteColumnFromMeta(meta, rows, input, deps) {
8758
+ const { columnName } = input;
8759
+ const { nowIso } = deps;
8760
+ if (!meta.columns.some((c) => c.name === columnName)) {
8761
+ return err(`\u5B57\u6BB5 ${columnName} \u4E0D\u5B58\u5728`);
8762
+ }
8763
+ const newColumns = meta.columns.filter((c) => c.name !== columnName);
8764
+ const rowPatches = rows.filter((row) => hasOwn(row, columnName)).map((row) => ({
8765
+ dbKey: row.dbKey,
8766
+ changes: { [columnName]: null, updatedAt: nowIso }
8767
+ }));
8768
+ const newRows = rows.map((row) => {
8769
+ if (!hasOwn(row, columnName)) {
8770
+ return row;
8771
+ }
8772
+ const { [columnName]: _removed, ...rest } = row;
8773
+ return { ...rest, updatedAt: nowIso };
8774
+ });
8775
+ return ok({
8776
+ ...buildMeta(meta, newColumns, nowIso),
8777
+ rows: newRows,
8778
+ rowPatches
8779
+ });
8780
+ }
8781
+ function reorderColumnInMeta(meta, input, deps) {
8782
+ const { fromIndex, toIndex } = input;
8783
+ const columnCount = meta.columns.length;
8784
+ if (fromIndex < 0 || fromIndex >= columnCount || toIndex < 0 || toIndex >= columnCount) {
8785
+ return err("\u5217\u7D22\u5F15\u8D85\u51FA\u8303\u56F4");
8786
+ }
8787
+ if (fromIndex === toIndex) {
8788
+ return ok({
8789
+ meta,
8790
+ metaChanges: { columns: meta.columns, updatedAt: meta.updatedAt },
8791
+ noop: true
8792
+ });
8793
+ }
8794
+ return ok(
8795
+ buildMeta(meta, reorderList(meta.columns, fromIndex, toIndex), deps.nowIso)
8796
+ );
8797
+ }
8798
+ function renameColumnInMeta(meta, rows, input, deps) {
8799
+ const { oldName } = input;
8800
+ const { nowIso } = deps;
8801
+ const newName = input.newName.trim();
8802
+ if (!newName) {
8803
+ return err("\u65B0\u7684\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8804
+ }
8805
+ if (!meta.columns.some((c) => c.name === oldName)) {
8806
+ return err(`\u5B57\u6BB5 ${oldName} \u4E0D\u5B58\u5728`);
8807
+ }
8808
+ if (meta.columns.some((c) => c.name === newName)) {
8809
+ return err(`\u5B57\u6BB5 ${newName} \u5DF2\u5B58\u5728`);
8810
+ }
8811
+ const newColumns = meta.columns.map(
8812
+ (c) => c.name === oldName ? { ...c, name: newName } : c
8813
+ );
8814
+ const rowPatches = rows.filter((row) => hasOwn(row, oldName)).map((row) => ({
8815
+ dbKey: row.dbKey,
8816
+ changes: {
8817
+ [newName]: row[oldName],
8818
+ [oldName]: null,
8819
+ updatedAt: nowIso
8820
+ }
8821
+ }));
8822
+ const newRows = rows.map((row) => {
8823
+ if (!hasOwn(row, oldName)) {
8824
+ return row;
8825
+ }
8826
+ const { [oldName]: oldValue, ...rest } = row;
8827
+ return { ...rest, [newName]: oldValue, updatedAt: nowIso };
8828
+ });
8829
+ return ok({
8830
+ ...buildMeta(meta, newColumns, nowIso),
8831
+ rows: newRows,
8832
+ rowPatches
8833
+ });
8834
+ }
8835
+ function renameColumnLabelInMeta(meta, input, deps) {
8836
+ const { columnId } = input;
8837
+ const label = input.label.trim();
8838
+ if (!label) {
8839
+ return err("\u5B57\u6BB5\u663E\u793A\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8840
+ }
8841
+ if (!meta.columns.some((c) => c.id === columnId)) {
8842
+ return err("\u8981\u91CD\u547D\u540D\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
8843
+ }
8844
+ const newColumns = meta.columns.map(
8845
+ (c) => c.id === columnId ? { ...c, label } : c
8846
+ );
8847
+ return ok(buildMeta(meta, newColumns, deps.nowIso));
8848
+ }
8849
+ function updateColumnWidthInMeta(meta, input, deps) {
8850
+ const { columnId, width } = input;
8851
+ if (!meta.columns.some((c) => c.id === columnId)) {
8852
+ return err("\u8981\u8C03\u6574\u5BBD\u5EA6\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
8853
+ }
8854
+ const normalizedWidth = typeof width === "number" && width > 0 ? Math.round(width) : void 0;
8855
+ const newColumns = meta.columns.map(
8856
+ (c) => c.id === columnId ? { ...c, width: normalizedWidth } : c
8857
+ );
8858
+ return ok(buildMeta(meta, newColumns, deps.nowIso));
8859
+ }
8860
+ function addColumnOptionInMeta(meta, input, deps) {
8861
+ const { columnId } = input;
8862
+ const option = input.option.trim();
8863
+ if (!option) {
8864
+ return err("\u9009\u9879\u540D\u4E0D\u80FD\u4E3A\u7A7A");
8865
+ }
8866
+ const column = meta.columns.find((c) => c.id === columnId);
8867
+ if (!column) {
8868
+ return err("\u8981\u65B0\u589E\u9009\u9879\u7684\u5B57\u6BB5\u4E0D\u5B58\u5728");
8869
+ }
8870
+ if ((column.options ?? []).some((o) => o.trim() === option)) {
8871
+ return ok({
8872
+ meta,
8873
+ metaChanges: { columns: meta.columns, updatedAt: meta.updatedAt },
8874
+ noop: true
8875
+ });
8876
+ }
8877
+ const newColumns = meta.columns.map(
8878
+ (c) => c.id === columnId ? { ...c, options: [...c.options ?? [], option] } : c
8879
+ );
8880
+ return ok(buildMeta(meta, newColumns, deps.nowIso));
8881
+ }
8882
+
8657
8883
  // packages/render/table/createTableAction.ts
8658
8884
  var import_date_fns2 = __toESM(require_date_fns(), 1);
8659
8885
  import { ulid as ulid4 } from "ulid";
@@ -9809,7 +10035,7 @@ var PluralResolver = class {
9809
10035
  });
9810
10036
  this.pluralRulesCache[cacheKey] = rule;
9811
10037
  return rule;
9812
- } catch (err) {
10038
+ } catch (err2) {
9813
10039
  return;
9814
10040
  }
9815
10041
  }
@@ -10287,23 +10513,23 @@ var Connector = class extends EventEmitter {
10287
10513
  toLoadNamespaces: Object.keys(toLoadNamespaces)
10288
10514
  };
10289
10515
  }
10290
- loaded(name, err, data) {
10516
+ loaded(name, err2, data) {
10291
10517
  const s = name.split("|");
10292
10518
  const lng = s[0];
10293
10519
  const ns = s[1];
10294
- if (err) this.emit("failedLoading", lng, ns, err);
10295
- if (!err && data) {
10520
+ if (err2) this.emit("failedLoading", lng, ns, err2);
10521
+ if (!err2 && data) {
10296
10522
  this.store.addResourceBundle(lng, ns, data, void 0, void 0, {
10297
10523
  skipCopy: true
10298
10524
  });
10299
10525
  }
10300
- this.state[name] = err ? -1 : 2;
10301
- if (err && data) this.state[name] = 0;
10526
+ this.state[name] = err2 ? -1 : 2;
10527
+ if (err2 && data) this.state[name] = 0;
10302
10528
  const loaded = {};
10303
10529
  this.queue.forEach((q) => {
10304
10530
  pushPath(q.loaded, [lng], ns);
10305
10531
  removePending(q, name);
10306
- if (err) q.errors.push(err);
10532
+ if (err2) q.errors.push(err2);
10307
10533
  if (q.pendingCount === 0 && !q.done) {
10308
10534
  Object.keys(q.loaded).forEach((l) => {
10309
10535
  if (!loaded[l]) loaded[l] = {};
@@ -10342,19 +10568,19 @@ var Connector = class extends EventEmitter {
10342
10568
  return;
10343
10569
  }
10344
10570
  this.readingCalls++;
10345
- const resolver = (err, data) => {
10571
+ const resolver = (err2, data) => {
10346
10572
  this.readingCalls--;
10347
10573
  if (this.waitingReads.length > 0) {
10348
10574
  const next = this.waitingReads.shift();
10349
10575
  this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
10350
10576
  }
10351
- if (err && data && tried < this.maxRetries) {
10577
+ if (err2 && data && tried < this.maxRetries) {
10352
10578
  setTimeout(() => {
10353
10579
  this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
10354
10580
  }, wait);
10355
10581
  return;
10356
10582
  }
10357
- callback(err, data);
10583
+ callback(err2, data);
10358
10584
  };
10359
10585
  const fc = this.backend[fcName].bind(this.backend);
10360
10586
  if (fc.length === 2) {
@@ -10365,8 +10591,8 @@ var Connector = class extends EventEmitter {
10365
10591
  } else {
10366
10592
  resolver(null, r);
10367
10593
  }
10368
- } catch (err) {
10369
- resolver(err);
10594
+ } catch (err2) {
10595
+ resolver(err2);
10370
10596
  }
10371
10597
  return;
10372
10598
  }
@@ -10403,10 +10629,10 @@ var Connector = class extends EventEmitter {
10403
10629
  const s = name.split("|");
10404
10630
  const lng = s[0];
10405
10631
  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);
10632
+ this.read(lng, ns, "read", void 0, void 0, (err2, data) => {
10633
+ if (err2) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err2);
10634
+ if (!err2 && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
10635
+ this.loaded(name, err2, data);
10410
10636
  });
10411
10637
  }
10412
10638
  saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
@@ -10437,8 +10663,8 @@ var Connector = class extends EventEmitter {
10437
10663
  } else {
10438
10664
  clb(null, r);
10439
10665
  }
10440
- } catch (err) {
10441
- clb(err);
10666
+ } catch (err2) {
10667
+ clb(err2);
10442
10668
  }
10443
10669
  } else {
10444
10670
  fc(languages, namespace, key, fallbackValue, clb, opts);
@@ -10670,14 +10896,14 @@ var I18n = class _I18n extends EventEmitter {
10670
10896
  });
10671
10897
  const deferred = defer();
10672
10898
  const load = () => {
10673
- const finish = (err, t2) => {
10899
+ const finish = (err2, t2) => {
10674
10900
  this.isInitializing = false;
10675
10901
  if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn("init: i18next is already initialized. You should call init just once!");
10676
10902
  this.isInitialized = true;
10677
10903
  if (!this.options.isClone) this.logger.log("initialized", this.options);
10678
10904
  this.emit("initialized", this.options);
10679
10905
  deferred.resolve(t2);
10680
- callback(err, t2);
10906
+ callback(err2, t2);
10681
10907
  };
10682
10908
  if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return finish(null, this.t.bind(this));
10683
10909
  this.changeLanguage(this.options.lng, finish);
@@ -10736,9 +10962,9 @@ var I18n = class _I18n extends EventEmitter {
10736
10962
  if (!lngs) lngs = this.languages;
10737
10963
  if (!ns) ns = this.options.ns;
10738
10964
  if (!callback) callback = noop;
10739
- this.services.backendConnector.reload(lngs, ns, (err) => {
10965
+ this.services.backendConnector.reload(lngs, ns, (err2) => {
10740
10966
  deferred.resolve();
10741
- callback(err);
10967
+ callback(err2);
10742
10968
  });
10743
10969
  return deferred;
10744
10970
  }
@@ -10791,7 +11017,7 @@ var I18n = class _I18n extends EventEmitter {
10791
11017
  this.resolvedLanguage = void 0;
10792
11018
  this.setResolvedLanguage(l);
10793
11019
  };
10794
- const done = (err, l) => {
11020
+ const done = (err2, l) => {
10795
11021
  if (l) {
10796
11022
  setLngProps(l);
10797
11023
  this.translator.changeLanguage(l);
@@ -10804,7 +11030,7 @@ var I18n = class _I18n extends EventEmitter {
10804
11030
  deferred.resolve(function() {
10805
11031
  return _this2.t(...arguments);
10806
11032
  });
10807
- if (callback) callback(err, function() {
11033
+ if (callback) callback(err2, function() {
10808
11034
  return _this2.t(...arguments);
10809
11035
  });
10810
11036
  };
@@ -10818,8 +11044,8 @@ var I18n = class _I18n extends EventEmitter {
10818
11044
  if (!this.translator.language) this.translator.changeLanguage(l);
10819
11045
  if (this.services.languageDetector && this.services.languageDetector.cacheUserLanguage) this.services.languageDetector.cacheUserLanguage(l);
10820
11046
  }
10821
- this.loadResources(l, (err) => {
10822
- done(err, l);
11047
+ this.loadResources(l, (err2) => {
11048
+ done(err2, l);
10823
11049
  });
10824
11050
  };
10825
11051
  if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
@@ -10917,9 +11143,9 @@ var I18n = class _I18n extends EventEmitter {
10917
11143
  ns.forEach((n) => {
10918
11144
  if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
10919
11145
  });
10920
- this.loadResources((err) => {
11146
+ this.loadResources((err2) => {
10921
11147
  deferred.resolve();
10922
- if (callback) callback(err);
11148
+ if (callback) callback(err2);
10923
11149
  });
10924
11150
  return deferred;
10925
11151
  }
@@ -10933,9 +11159,9 @@ var I18n = class _I18n extends EventEmitter {
10933
11159
  return Promise.resolve();
10934
11160
  }
10935
11161
  this.options.preload = preloaded.concat(newLngs);
10936
- this.loadResources((err) => {
11162
+ this.loadResources((err2) => {
10937
11163
  deferred.resolve();
10938
- if (callback) callback(err);
11164
+ if (callback) callback(err2);
10939
11165
  });
10940
11166
  return deferred;
10941
11167
  }
@@ -11432,12 +11658,6 @@ var initialState3 = {
11432
11658
  rows: [],
11433
11659
  focusContext: null
11434
11660
  };
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
11661
  var createSliceWithThunks3 = buildCreateSlice({
11442
11662
  creators: { asyncThunk: asyncThunkCreator }
11443
11663
  });
@@ -11651,41 +11871,27 @@ var tableSlice = createSliceWithThunks3({
11651
11871
  addColumn: create.asyncThunk(
11652
11872
  async (args, { dispatch, getState, rejectWithValue }) => {
11653
11873
  const { tenantId, tableId, columnName } = args;
11654
- if (!columnName.trim()) {
11655
- return rejectWithValue("\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
11656
- }
11657
11874
  const state3 = getState().table;
11658
11875
  const meta = state3.currentTable;
11659
11876
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11660
11877
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11661
11878
  }
11662
- if (meta.columns.some((c) => c.name === columnName)) {
11663
- return rejectWithValue(`\u5B57\u6BB5 ${columnName} \u5DF2\u5B58\u5728`);
11879
+ const result = addColumnToMeta(
11880
+ meta,
11881
+ { columnName },
11882
+ { id: ulid5(), nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11883
+ );
11884
+ if (!result.ok) {
11885
+ return rejectWithValue(result.error);
11664
11886
  }
11665
11887
  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
11888
  await dispatch(
11675
11889
  patch({
11676
11890
  dbKey: meta.dbKey,
11677
- changes: {
11678
- columns: newColumns,
11679
- updatedAt: nowIso
11680
- }
11891
+ changes: result.value.metaChanges
11681
11892
  })
11682
11893
  ).unwrap();
11683
- const nextMeta = {
11684
- ...meta,
11685
- columns: newColumns,
11686
- updatedAt: nowIso
11687
- };
11688
- return nextMeta;
11894
+ return result.value.meta;
11689
11895
  } catch (e) {
11690
11896
  return rejectWithValue(e.message || "\u6DFB\u52A0\u5B57\u6BB5\u5931\u8D25");
11691
11897
  }
@@ -11714,58 +11920,24 @@ var tableSlice = createSliceWithThunks3({
11714
11920
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11715
11921
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11716
11922
  }
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
11923
+ const result = deleteColumnFromMeta(
11924
+ meta,
11925
+ state3.rows,
11926
+ { columnName },
11927
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11723
11928
  );
11724
- const rows = state3.rows;
11929
+ if (!result.ok) {
11930
+ return rejectWithValue(result.error);
11931
+ }
11932
+ const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
11725
11933
  try {
11726
- const rowsWithField = rows.filter(
11727
- (row) => Object.prototype.hasOwnProperty.call(row, columnName)
11728
- );
11729
11934
  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
- )
11935
+ rowPatches.map((p) => dispatch(patch(p)).unwrap())
11741
11936
  );
11742
11937
  await dispatch(
11743
- patch({
11744
- dbKey: meta.dbKey,
11745
- changes: {
11746
- columns: newColumns,
11747
- updatedAt: nowIso
11748
- }
11749
- })
11938
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11750
11939
  ).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
- };
11940
+ return { meta: nextMeta, rows: newRows };
11769
11941
  } catch (e) {
11770
11942
  return rejectWithValue(e.message || "\u5220\u9664\u5B57\u6BB5\u5931\u8D25");
11771
11943
  }
@@ -11795,30 +11967,22 @@ var tableSlice = createSliceWithThunks3({
11795
11967
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11796
11968
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11797
11969
  }
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");
11970
+ const result = reorderColumnInMeta(
11971
+ meta,
11972
+ { fromIndex, toIndex },
11973
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11974
+ );
11975
+ if (!result.ok) {
11976
+ return rejectWithValue(result.error);
11801
11977
  }
11802
- if (fromIndex === toIndex) {
11978
+ if (result.value.noop) {
11803
11979
  return meta;
11804
11980
  }
11805
- const nowIso = (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date());
11806
- const newColumns = reorderList(meta.columns, fromIndex, toIndex);
11981
+ const { meta: nextMeta, metaChanges } = result.value;
11807
11982
  try {
11808
11983
  await dispatch(
11809
- patch({
11810
- dbKey: meta.dbKey,
11811
- changes: {
11812
- columns: newColumns,
11813
- updatedAt: nowIso
11814
- }
11815
- })
11984
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11816
11985
  ).unwrap();
11817
- const nextMeta = {
11818
- ...meta,
11819
- columns: newColumns,
11820
- updatedAt: nowIso
11821
- };
11822
11986
  return nextMeta;
11823
11987
  } catch (e) {
11824
11988
  return rejectWithValue(e.message || "\u8C03\u6574\u5217\u987A\u5E8F\u5931\u8D25");
@@ -11845,73 +12009,29 @@ var tableSlice = createSliceWithThunks3({
11845
12009
  renameColumn: create.asyncThunk(
11846
12010
  async (args, { dispatch, getState, rejectWithValue }) => {
11847
12011
  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
12012
  const state3 = getState().table;
11853
12013
  const meta = state3.currentTable;
11854
12014
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11855
12015
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11856
12016
  }
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
12017
+ const result = renameColumnInMeta(
12018
+ meta,
12019
+ state3.rows,
12020
+ { oldName, newName },
12021
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11867
12022
  );
12023
+ if (!result.ok) {
12024
+ return rejectWithValue(result.error);
12025
+ }
12026
+ const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
11868
12027
  try {
11869
- const rowsWithOldField = rows.filter(
11870
- (row) => Object.prototype.hasOwnProperty.call(row, oldName)
11871
- );
11872
12028
  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
- })
12029
+ rowPatches.map((p) => dispatch(patch(p)).unwrap())
11886
12030
  );
11887
12031
  await dispatch(
11888
- patch({
11889
- dbKey: meta.dbKey,
11890
- changes: {
11891
- columns: newColumns,
11892
- updatedAt: nowIso
11893
- }
11894
- })
12032
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11895
12033
  ).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
- };
12034
+ return { meta: nextMeta, rows: newRows };
11915
12035
  } catch (e) {
11916
12036
  return rejectWithValue(e.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u5931\u8D25");
11917
12037
  }
@@ -11938,38 +12058,24 @@ var tableSlice = createSliceWithThunks3({
11938
12058
  renameColumnLabel: create.asyncThunk(
11939
12059
  async (args, { dispatch, getState, rejectWithValue }) => {
11940
12060
  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
12061
  const state3 = getState().table;
11946
12062
  const meta = state3.currentTable;
11947
12063
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
11948
12064
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
11949
12065
  }
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
12066
+ const result = renameColumnLabelInMeta(
12067
+ meta,
12068
+ { columnId, label: newLabel },
12069
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
11957
12070
  );
12071
+ if (!result.ok) {
12072
+ return rejectWithValue(result.error);
12073
+ }
12074
+ const { meta: nextMeta, metaChanges } = result.value;
11958
12075
  try {
11959
12076
  await dispatch(
11960
- patch({
11961
- dbKey: meta.dbKey,
11962
- changes: {
11963
- columns: newColumns,
11964
- updatedAt: nowIso
11965
- }
11966
- })
12077
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
11967
12078
  ).unwrap();
11968
- const nextMeta = {
11969
- ...meta,
11970
- columns: newColumns,
11971
- updatedAt: nowIso
11972
- };
11973
12079
  return nextMeta;
11974
12080
  } catch (e) {
11975
12081
  return rejectWithValue(e.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u663E\u793A\u540D\u5931\u8D25");
@@ -12000,30 +12106,19 @@ var tableSlice = createSliceWithThunks3({
12000
12106
  if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
12001
12107
  return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
12002
12108
  }
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
12109
+ const result = updateColumnWidthInMeta(
12110
+ meta,
12111
+ { columnId, width },
12112
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
12011
12113
  );
12114
+ if (!result.ok) {
12115
+ return rejectWithValue(result.error);
12116
+ }
12117
+ const { meta: nextMeta, metaChanges } = result.value;
12012
12118
  try {
12013
12119
  await dispatch(
12014
- patch({
12015
- dbKey: meta.dbKey,
12016
- changes: {
12017
- columns: newColumns,
12018
- updatedAt: nowIso
12019
- }
12020
- })
12120
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
12021
12121
  ).unwrap();
12022
- const nextMeta = {
12023
- ...meta,
12024
- columns: newColumns,
12025
- updatedAt: nowIso
12026
- };
12027
12122
  return nextMeta;
12028
12123
  } catch (e) {
12029
12124
  return rejectWithValue(e.message || "\u66F4\u65B0\u5B57\u6BB5\u5BBD\u5EA6\u5931\u8D25");
@@ -12042,6 +12137,53 @@ var tableSlice = createSliceWithThunks3({
12042
12137
  }
12043
12138
  }
12044
12139
  ),
12140
+ /* --------------------------------------
12141
+ * 4.2-quater 新增 select 选项:addColumnOption
12142
+ * 说明:把新选项追加到 columns[].options(select 弹层「+ 新建选项」入口),
12143
+ * 重复选项为 no-op:跳过 patch 直接返回原 meta,fulfilled 照常刷新 currentTable。
12144
+ * ------------------------------------*/
12145
+ addColumnOption: create.asyncThunk(
12146
+ async (args, { dispatch, getState, rejectWithValue }) => {
12147
+ const { tenantId, tableId, columnId, option } = args;
12148
+ const state3 = getState().table;
12149
+ const meta = state3.currentTable;
12150
+ if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
12151
+ return rejectWithValue("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
12152
+ }
12153
+ const result = addColumnOptionInMeta(
12154
+ meta,
12155
+ { columnId, option },
12156
+ { nowIso: (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date()) }
12157
+ );
12158
+ if (!result.ok) {
12159
+ return rejectWithValue(result.error);
12160
+ }
12161
+ if (result.value.noop) {
12162
+ return meta;
12163
+ }
12164
+ const { meta: nextMeta, metaChanges } = result.value;
12165
+ try {
12166
+ await dispatch(
12167
+ patch({ dbKey: meta.dbKey, changes: metaChanges })
12168
+ ).unwrap();
12169
+ return nextMeta;
12170
+ } catch (e) {
12171
+ return rejectWithValue(e.message || "\u65B0\u589E\u9009\u9879\u5931\u8D25");
12172
+ }
12173
+ },
12174
+ {
12175
+ pending: (state3) => {
12176
+ state3.error = null;
12177
+ },
12178
+ fulfilled: (state3, action2) => {
12179
+ state3.currentTable = action2.payload;
12180
+ state3.isInitialized = true;
12181
+ },
12182
+ rejected: (state3, action2) => {
12183
+ state3.error = action2.payload || action2.error.message || "\u65B0\u589E\u9009\u9879\u65F6\u53D1\u751F\u672A\u77E5\u9519\u8BEF";
12184
+ }
12185
+ }
12186
+ ),
12045
12187
  /* --------------------------------------
12046
12188
  * 4.3 重命名表:renameTable(仅修改显示名称)
12047
12189
  * ------------------------------------*/
@@ -12209,6 +12351,7 @@ var {
12209
12351
  updateCell,
12210
12352
  reorderColumn,
12211
12353
  updateColumnWidth,
12354
+ addColumnOption,
12212
12355
  setTableFocusContext
12213
12356
  } = tableSlice.actions;
12214
12357
  var {
@@ -12256,11 +12399,11 @@ var ENTITY_DELETE_STRATEGIES = {
12256
12399
  await dispatch(deleteTable({ dbKey: key })).unwrap();
12257
12400
  },
12258
12401
  file: async (key, { thunkAPI }) => {
12259
- const { deleteFileAction } = await import("./deleteFile-WPWVZE4B.js");
12402
+ const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
12260
12403
  await deleteFileAction(key, thunkAPI);
12261
12404
  },
12262
12405
  image: async (key, { thunkAPI }) => {
12263
- const { deleteFileAction } = await import("./deleteFile-WPWVZE4B.js");
12406
+ const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
12264
12407
  await deleteFileAction(key, thunkAPI);
12265
12408
  },
12266
12409
  agent: async (key, { dispatch, userId, sourceServerOrigin }) => {
@@ -12343,9 +12486,9 @@ var deleteContentFromSpaceAction = async (input, thunkAPI) => {
12343
12486
  sourceServerOrigin
12344
12487
  });
12345
12488
  }
12346
- } catch (err) {
12347
- console.error(`[deleteContent] Failed to delete entity ${entityKey}:`, err);
12348
- entityRemoveError = err.message || "Unknown error";
12489
+ } catch (err2) {
12490
+ console.error(`[deleteContent] Failed to delete entity ${entityKey}:`, err2);
12491
+ entityRemoveError = err2.message || "Unknown error";
12349
12492
  }
12350
12493
  return {
12351
12494
  contentKey,
@@ -13666,8 +13809,8 @@ async function resolveMemberId(db, identifier) {
13666
13809
  matchCount++;
13667
13810
  }
13668
13811
  }
13669
- } catch (err) {
13670
- logger.warn({ err, identifier: trimmed }, "Failed to scan users by username");
13812
+ } catch (err2) {
13813
+ logger.warn({ err: err2, identifier: trimmed }, "Failed to scan users by username");
13671
13814
  }
13672
13815
  if (matchCount > 1) {
13673
13816
  throw new Error(
@@ -13853,8 +13996,8 @@ async function getUserDataOnce({
13853
13996
  const localResults = await fetchUserData(db, typeArray, effectiveUserId);
13854
13997
  const localData = Object.values(localResults).flat();
13855
13998
  return { data: localData };
13856
- } catch (err) {
13857
- const error = err instanceof Error ? err : new Error("Unknown error occurred");
13999
+ } catch (err2) {
14000
+ const error = err2 instanceof Error ? err2 : new Error("Unknown error occurred");
13858
14001
  return { data: [], error };
13859
14002
  }
13860
14003
  }
@@ -14203,8 +14346,8 @@ var deleteDbKey = (input, spaceId) => async (dispatch, getState) => {
14203
14346
  spaceId: spaceId2,
14204
14347
  ...preferredServerOrigin ? { sourceServerOrigin: preferredServerOrigin } : {}
14205
14348
  })
14206
- ).unwrap().catch((err) => {
14207
- console.warn("[deleteDbKey] space cleanup failed (entity already tombstoned):", err);
14349
+ ).unwrap().catch((err2) => {
14350
+ console.warn("[deleteDbKey] space cleanup failed (entity already tombstoned):", err2);
14208
14351
  })
14209
14352
  )
14210
14353
  );
@@ -14310,10 +14453,10 @@ var deleteLocalSpaceAuthority = async (spaceId, spaceData, dispatch) => {
14310
14453
  },
14311
14454
  dispatch
14312
14455
  );
14313
- } catch (err) {
14456
+ } catch (err2) {
14314
14457
  console.warn(
14315
14458
  `Failed to tombstone local membership ${memberId} for space ${spaceId}:`,
14316
- err
14459
+ err2
14317
14460
  );
14318
14461
  }
14319
14462
  }
@@ -14323,9 +14466,9 @@ var deleteAllMembers = async (spaceData, spaceId, dispatch) => {
14323
14466
  for (const memberId of spaceData.members) {
14324
14467
  const memberKey = createSpaceKey.member(memberId, spaceId);
14325
14468
  await dispatch(remove(memberKey)).unwrap().catch(
14326
- (err) => console.warn(
14469
+ (err2) => console.warn(
14327
14470
  `Failed to delete member ${memberId} for space ${spaceId}:`,
14328
- err
14471
+ err2
14329
14472
  )
14330
14473
  );
14331
14474
  }
@@ -14334,9 +14477,9 @@ var deleteAllMembers = async (spaceData, spaceId, dispatch) => {
14334
14477
  var deleteCurrentUserMember = async (userId, spaceId, dispatch) => {
14335
14478
  const currentUserMemberKey = createSpaceKey.member(userId, spaceId);
14336
14479
  await dispatch(remove(currentUserMemberKey)).unwrap().catch(
14337
- (err) => console.warn(
14480
+ (err2) => console.warn(
14338
14481
  `Failed to delete member key for user ${userId} in space ${spaceId}:`,
14339
- err
14482
+ err2
14340
14483
  )
14341
14484
  );
14342
14485
  };
@@ -14455,7 +14598,7 @@ var fetchSpaceAction = async (input, thunkAPI) => {
14455
14598
  const spaceKey = createSpaceKey.space(spaceId);
14456
14599
  const readSpace = async (dbKey) => {
14457
14600
  try {
14458
- const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-7KQH6GOU.js");
14601
+ const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-CGSRFJN3.js");
14459
14602
  if (fresh) {
14460
14603
  return await dispatch(readAndWait2(dbKey)).unwrap();
14461
14604
  }
@@ -15144,6 +15287,7 @@ export {
15144
15287
  parseUiAskChoiceContent,
15145
15288
  PERSONALIZATION_DIALOG_CATEGORY,
15146
15289
  buildPersonalizationDialogPolicyContext,
15290
+ resolveDialogRuntimeAgentKey,
15147
15291
  resolveHandleSendMessageContext,
15148
15292
  estimateMissingUsage,
15149
15293
  selectCurrentDialogId,
@@ -15158,6 +15302,7 @@ export {
15158
15302
  messageStreamEnd,
15159
15303
  addToolMessage,
15160
15304
  updateToolMessage,
15305
+ appendOverlayMessage,
15161
15306
  setWorkflow,
15162
15307
  updateStep,
15163
15308
  incrementStepsExecuted,