nolo-cli 0.17.0 → 0.19.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 (79) hide show
  1. package/{_executeModel-WPNX5DH4.js → _executeModel-X5PCIZN6.js} +19 -19
  2. package/{agentDeleteCommand-L3357EFL.js → agentDeleteCommand-2BZDQV36.js} +12 -12
  3. package/{agentEmailCommands-N65AVLEI.js → agentEmailCommands-2QJDGRMB.js} +25 -25
  4. package/{agentListCommands-CH27FTI2.js → agentListCommands-6VEPTKBI.js} +14 -14
  5. package/{agentMachineCommands-PPK5HJZB.js → agentMachineCommands-NVVHNWYI.js} +12 -12
  6. package/{agentRecordCommands-HTVXD4TT.js → agentRecordCommands-4GGRDMD4.js} +24 -24
  7. package/{agentRunCommand-MGLVJUA5.js → agentRunCommand-XOLQNKBZ.js} +24 -24
  8. package/{agentRunControl-P75VPTGS.js → agentRunControl-Y5AFH5PQ.js} +2 -2
  9. package/{agentRuntimeLocal-QUTBSY3I.js → agentRuntimeLocal-7WYWCGL4.js} +9 -9
  10. package/{agentSlice-DOGRCMWK.js → agentSlice-EAXPGEYV.js} +1 -1
  11. package/{appDeleteCommands-FEEVXUBG.js → appDeleteCommands-77KR2RJ4.js} +13 -13
  12. package/{appDeployCommands-C4HCGC4B.js → appDeployCommands-K7CAHGBI.js} +13 -13
  13. package/{appDeployStatusCommands-IR5ZUZBQ.js → appDeployStatusCommands-4OEKLTBT.js} +13 -13
  14. package/{appGetCommands-6RJGZ66Z.js → appGetCommands-VM2WDLAZ.js} +13 -13
  15. package/{appListCommands-VMTF5YZF.js → appListCommands-GX6BBA6U.js} +13 -13
  16. package/{authCommand-WJZPOLSS.js → authCommand-DY6UUL6O.js} +6 -6
  17. package/{chunk-UZY4BEBR.js → chunk-23FZYPLC.js} +43 -14
  18. package/{chunk-IOOMJJ4Z.js → chunk-34WPV75U.js} +21 -0
  19. package/{chunk-JP7REMYP.js → chunk-3ZX7PERL.js} +1 -1
  20. package/{chunk-HV2A3B4W.js → chunk-AHCY2S2I.js} +1 -1
  21. package/{chunk-BT6K76S7.js → chunk-BV4VEE3W.js} +41 -15
  22. package/{chunk-PZCBZO4J.js → chunk-CZ6NYQTV.js} +12 -3
  23. package/{chunk-FVIPEIVX.js → chunk-DFCFMCY6.js} +1 -1
  24. package/{chunk-NEKFSXOP.js → chunk-EDV7EBOI.js} +22 -20
  25. package/{chunk-FKXFCYVO.js → chunk-FQZZLA3C.js} +2 -0
  26. package/{chunk-L6NVTGI7.js → chunk-FXUSIQC2.js} +1 -1
  27. package/{chunk-VDNQF5VI.js → chunk-G5U6LDLG.js} +2 -2
  28. package/{chunk-ZVOZH2HW.js → chunk-HEGV7BH3.js} +1 -1
  29. package/{chunk-RRGVDPH3.js → chunk-HWW2M4SN.js} +3 -3
  30. package/{chunk-EGPCU42M.js → chunk-I2ZJKTG5.js} +2 -2
  31. package/{chunk-NYUXSXLY.js → chunk-IYEXFJPC.js} +2 -2
  32. package/{chunk-FPKLD4KB.js → chunk-L4F3I4SR.js} +1 -1
  33. package/{chunk-RK5NYQEL.js → chunk-LLWKHDG4.js} +1 -1
  34. package/{chunk-MUCU6ATG.js → chunk-MHSGJW4Z.js} +1 -1
  35. package/{chunk-O6W2O2DA.js → chunk-MKA6QE5E.js} +6 -2
  36. package/{chunk-YXTRNO5W.js → chunk-MPVYDS7I.js} +3 -3
  37. package/{chunk-AAODAAUQ.js → chunk-N54HIJVJ.js} +1 -1
  38. package/{chunk-UB4RYYNQ.js → chunk-OK6YSWLH.js} +1 -1
  39. package/{chunk-VGMJ6PDJ.js → chunk-PIZYJVHQ.js} +2 -2
  40. package/{chunk-D3HVJJIA.js → chunk-PJSV3IZ5.js} +1 -1
  41. package/{chunk-YLRTBX4Y.js → chunk-R35XMF6F.js} +25 -9
  42. package/{chunk-MD3V54DA.js → chunk-REA4JLBH.js} +3 -3
  43. package/{chunk-CEFXYF66.js → chunk-RQN4SEKL.js} +1 -1
  44. package/{chunk-NVB267BZ.js → chunk-SCTYAHYK.js} +87 -15
  45. package/{chunk-45BY7RLP.js → chunk-SWDPIPOY.js} +1 -1
  46. package/{chunk-HQPG2PIV.js → chunk-UAIVG4J6.js} +1 -1
  47. package/{chunk-SNZV4QCE.js → chunk-UBHAWFQ6.js} +86 -17
  48. package/{chunk-L2MLZQXU.js → chunk-V3ED5AWK.js} +2 -2
  49. package/{chunk-RG2U2MTJ.js → chunk-VDXCXCXH.js} +1 -1
  50. package/{chunk-TSIYZBTH.js → chunk-VNAEBGDK.js} +1 -1
  51. package/{chunk-ZJZCMKOR.js → chunk-VYHDJEQD.js} +17 -29
  52. package/{chunk-QCJITMYO.js → chunk-YGW4G5W5.js} +7 -4
  53. package/{createAgentAutomationAction-PMOLEPGJ.js → createAgentAutomationAction-GNFF524X.js} +6 -6
  54. package/{createDialogAction-DPRTYNAK.js → createDialogAction-RB55KCLO.js} +7 -7
  55. package/{createPageAction-JGZK3WAM.js → createPageAction-Y7343GLU.js} +6 -6
  56. package/{db-HCJ5PRB5.js → db-W3O47YGF.js} +38 -12
  57. package/{dialogCommands-XED6DKLV.js → dialogCommands-IAZK6YHQ.js} +13 -13
  58. package/{dialogSlice-KO4NRNKC.js → dialogSlice-UQAXF23P.js} +6 -6
  59. package/{docCreateCommands-P6DYWHH3.js → docCreateCommands-I2EWZGCI.js} +12 -12
  60. package/{docDeleteCommands-KUWXAMSN.js → docDeleteCommands-IZ45UZKG.js} +13 -13
  61. package/{docReadCommands-ECW55TKB.js → docReadCommands-R6Z4QJYU.js} +12 -12
  62. package/{docStore-6KMERNUY.js → docStore-5HOJ4D7D.js} +7 -7
  63. package/{docUpdateCommands-5J4BTJQN.js → docUpdateCommands-2LRBKQPY.js} +12 -12
  64. package/{getPricing-RYY6OBA4.js → getPricing-G7DLAST6.js} +3 -3
  65. package/{handleSendMessageAction-R3ZHTVU4.js → handleSendMessageAction-Q4HY35WX.js} +6 -6
  66. package/index.js +52 -52
  67. package/{localDialogRead-HQZPVIE3.js → localDialogRead-4H3QJFLW.js} +1 -1
  68. package/{machineCommands-JF2YL34J.js → machineCommands-PKBPQKTY.js} +23 -23
  69. package/{machineWsRunDispatch-ON4AEOJL.js → machineWsRunDispatch-UZAW4OXJ.js} +23 -23
  70. package/{models-5K5G2CZI.js → models-DJFSJ7SW.js} +2 -2
  71. package/package.json +1 -1
  72. package/{readlineWorkspace-SUCINTL7.js → readlineWorkspace-Y2RDOFZG.js} +472 -97
  73. package/{runAgentClientLoop-OBD2AVEL.js → runAgentClientLoop-NBPIKJ6J.js} +16 -16
  74. package/{spaceCommands-32NTNLHS.js → spaceCommands-DHCZ7J5I.js} +12 -12
  75. package/{spaceSlice-P7VOXLY6.js → spaceSlice-ZXLLG3CR.js} +6 -6
  76. package/{streamAgentChatTurn-UHEMNI3X.js → streamAgentChatTurn-L3YW6LSB.js} +19 -19
  77. package/{tools-BMXIXHMB.js → tools-ECGXR5QF.js} +11 -11
  78. package/{tuiSummaryLlmCaller-VUNVBRX3.js → tuiSummaryLlmCaller-OMSCNHXA.js} +4 -4
  79. package/{updateDialogTitleAction-LJBDYZLH.js → updateDialogTitleAction-HQ2EUDFT.js} +6 -6
@@ -4,10 +4,10 @@ import {
4
4
  providerHttpFailure,
5
5
  readSseFrames,
6
6
  throwIfChatCompletionStreamFailed
7
- } from "./chunk-AAODAAUQ.js";
7
+ } from "./chunk-N54HIJVJ.js";
8
8
  import {
9
9
  parseToolArgumentsJson
10
- } from "./chunk-QCJITMYO.js";
10
+ } from "./chunk-YGW4G5W5.js";
11
11
  import {
12
12
  createThinkParserState,
13
13
  createToolCallAccumulator,
@@ -18,7 +18,7 @@ import {
18
18
  import {
19
19
  requiresBareImageUrl,
20
20
  toBareImageUrlMessages
21
- } from "./chunk-IOOMJJ4Z.js";
21
+ } from "./chunk-34WPV75U.js";
22
22
  import {
23
23
  shouldStripReasoningContentForOutbound,
24
24
  toOpenAiCompatibleMessages
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  buildProviderAuthHeaders,
28
28
  buildProviderExecutionPlan
29
- } from "./chunk-MUCU6ATG.js";
29
+ } from "./chunk-MHSGJW4Z.js";
30
30
  import {
31
31
  createGlob,
32
32
  resolveExecutableOnPath
@@ -1139,7 +1139,8 @@ var ProcessRegistry = class {
1139
1139
  command: proc.command,
1140
1140
  label: proc.label,
1141
1141
  startedAt: Date.now(),
1142
- status: "running"
1142
+ status: "running",
1143
+ persist: proc.persist ?? false
1143
1144
  });
1144
1145
  }
1145
1146
  list() {
@@ -1162,9 +1163,9 @@ var ProcessRegistry = class {
1162
1163
  }
1163
1164
  return false;
1164
1165
  }
1165
- stopAll(signal = "SIGTERM") {
1166
+ stopAll(signal = "SIGTERM", opts) {
1166
1167
  for (const item of this.processes.values()) {
1167
- if (item.status === "running") {
1168
+ if (item.status === "running" && (opts?.includePersist || !item.persist)) {
1168
1169
  try {
1169
1170
  process.kill(-item.pgid, signal);
1170
1171
  } catch {
@@ -1629,6 +1630,10 @@ function buildLaunchProcessTool() {
1629
1630
  label: {
1630
1631
  type: "string",
1631
1632
  description: "Optional friendly label for the process."
1633
+ },
1634
+ persist: {
1635
+ type: "boolean",
1636
+ description: "Mark the process as persistent so it survives the current TUI/session exit (kept running in the background when the conversation closes). Defaults to false. Use for long-lived services (e.g. a desktop dev server) you want to keep alive after the session ends."
1632
1637
  }
1633
1638
  },
1634
1639
  required: ["command"]
@@ -1641,7 +1646,7 @@ function buildListProcessesTool() {
1641
1646
  type: "function",
1642
1647
  function: {
1643
1648
  name: "listProcesses",
1644
- description: "List currently registered background processes launched via launchProcess. Returns array of {pid, label, command, status, startedAt}.",
1649
+ description: "List currently registered background processes launched via launchProcess. Returns array of {pid, label, command, status, startedAt, persist}.",
1645
1650
  parameters: {
1646
1651
  type: "object",
1647
1652
  properties: {}
@@ -1785,6 +1790,16 @@ var SEARCH_OUTPUT_CHAR_LIMIT = 2e4;
1785
1790
  function readTrimmedString(value) {
1786
1791
  return asOptionalTrimmedString(value);
1787
1792
  }
1793
+ function readBoolean(parsed, key) {
1794
+ const val = parsed[key];
1795
+ if (typeof val === "boolean") return val;
1796
+ if (typeof val === "string") {
1797
+ const lower = val.trim().toLowerCase();
1798
+ if (lower === "true") return true;
1799
+ if (lower === "false") return false;
1800
+ }
1801
+ return void 0;
1802
+ }
1788
1803
  function resolveExecShellTimeoutMs(override) {
1789
1804
  const fromOverride = asOptionalPositiveFiniteNumber(override);
1790
1805
  if (fromOverride !== void 0) return fromOverride;
@@ -3502,6 +3517,7 @@ async function launchProcessTool(args) {
3502
3517
  }
3503
3518
  const labelArg = readTrimmedString(parsed.label);
3504
3519
  const label = labelArg || deriveLabel(command);
3520
+ const persist = readBoolean(parsed, "persist");
3505
3521
  const fullCommand = buildWorkspaceShellCommand({
3506
3522
  toolName: args.call.name,
3507
3523
  command,
@@ -3526,7 +3542,7 @@ async function launchProcessTool(args) {
3526
3542
  }
3527
3543
  const pgid = detached ? pid : pid;
3528
3544
  const registry2 = getProcessRegistry();
3529
- registry2.add({ pid, pgid, command, label });
3545
+ registry2.add({ pid, pgid, command, label, persist });
3530
3546
  const cleanupChildOnHostSignal = (signal) => {
3531
3547
  try {
3532
3548
  if (detached) {
@@ -300,7 +300,7 @@ var slice = createSliceWithThunks({
300
300
  const overrides = {};
301
301
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
302
302
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
303
- const { _executeModel } = await import("./_executeModel-WPNX5DH4.js");
303
+ const { _executeModel } = await import("./_executeModel-X5PCIZN6.js");
304
304
  return _executeModel(
305
305
  {
306
306
  isStreaming: args.isStreaming ?? false,
@@ -321,7 +321,7 @@ var slice = createSliceWithThunks({
321
321
  * - 循环直到无工具调用或触发其他运行时停止条件
322
322
  */
323
323
  runAgent: create.asyncThunk(async (args, thunkApi) => {
324
- const { runAgentClientLoop } = await import("./runAgentClientLoop-OBD2AVEL.js");
324
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-NBPIKJ6J.js");
325
325
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
326
326
  {
327
327
  agentKey: args.agentKey,
@@ -337,7 +337,7 @@ var slice = createSliceWithThunks({
337
337
  * 聊天轮次流式 Agent 调用
338
338
  */
339
339
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
340
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-UHEMNI3X.js");
340
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-L3YW6LSB.js");
341
341
  return streamAgentChatTurnHandler(args, thunkApi);
342
342
  }),
343
343
  /**
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  requireTokenUser
3
- } from "./chunk-FPKLD4KB.js";
3
+ } from "./chunk-L4F3I4SR.js";
4
4
  import {
5
5
  resolveServerUrl
6
6
  } from "./chunk-A7GB5UGH.js";
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  deleteServerSyncedCredential,
14
14
  runLlm
15
- } from "./chunk-MD3V54DA.js";
15
+ } from "./chunk-REA4JLBH.js";
16
16
  import {
17
17
  getApproxPricePerImage
18
18
  } from "./chunk-CWMSB67P.js";
@@ -38,14 +38,14 @@ import {
38
38
  planCompression,
39
39
  resolveAutoExecutionProfile,
40
40
  serializeMessageContent
41
- } from "./chunk-EGPCU42M.js";
41
+ } from "./chunk-I2ZJKTG5.js";
42
42
  import {
43
43
  createFileCredentialBroker
44
44
  } from "./chunk-5CS33IBL.js";
45
45
  import {
46
46
  findModelConfig,
47
47
  getModelConfig
48
- } from "./chunk-HQPG2PIV.js";
48
+ } from "./chunk-UAIVG4J6.js";
49
49
  import {
50
50
  toErrorMessage
51
51
  } from "./chunk-HNMXYYJR.js";
@@ -3639,11 +3639,7 @@ var uiAskChoiceFunctionSchema = {
3639
3639
  "- \u6BCF\u4E2A choice \u53EF\u4EE5\u52A0 detail \u5B57\u6BB5\u63D0\u4F9B\u66F4\u957F\u7684\u63CF\u8FF0\u3002",
3640
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
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",
3645
- "",
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"
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"
3647
3643
  ].join("\n"),
3648
3644
  parameters: {
3649
3645
  type: "object",
@@ -5596,7 +5592,7 @@ var messageSlice = createSliceWithThunks({
5596
5592
  runtimeOptions: args.runtimeOptions
5597
5593
  });
5598
5594
  if (agentKeyToUse) {
5599
- const { streamAgentChatTurn } = await import("./agentSlice-DOGRCMWK.js");
5595
+ const { streamAgentChatTurn } = await import("./agentSlice-EAXPGEYV.js");
5600
5596
  await dispatch(
5601
5597
  streamAgentChatTurn({
5602
5598
  agentKey: agentKeyToUse,
@@ -7622,6 +7618,12 @@ var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceT
7622
7618
  case "openai":
7623
7619
  case "deepinfra":
7624
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);
7625
7627
  case "anthropic":
7626
7628
  return calculateAnthropicCost(resolvedPrice, usage, externalPrice);
7627
7629
  case "google":
@@ -8317,7 +8319,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8317
8319
  }
8318
8320
  if (isCurrentDialog) {
8319
8321
  await thunkApi.dispatch(resetMsgs());
8320
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-KO4NRNKC.js");
8322
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-UQAXF23P.js");
8321
8323
  dispatch(clearPendingAttachments2());
8322
8324
  clearWorkflow();
8323
8325
  }
@@ -8326,15 +8328,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8326
8328
 
8327
8329
  // packages/chat/dialog/dialogSlice.ts
8328
8330
  var runCreateDialogAction = async (args, thunkApi) => {
8329
- const { createDialogAction } = await import("./createDialogAction-DPRTYNAK.js");
8331
+ const { createDialogAction } = await import("./createDialogAction-RB55KCLO.js");
8330
8332
  return createDialogAction(args, thunkApi);
8331
8333
  };
8332
8334
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
8333
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-PMOLEPGJ.js");
8335
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-GNFF524X.js");
8334
8336
  return createAgentAutomationAction(args, thunkApi);
8335
8337
  };
8336
8338
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
8337
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-LJBDYZLH.js");
8339
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-HQ2EUDFT.js");
8338
8340
  return updateDialogTitleAction(args, thunkApi);
8339
8341
  };
8340
8342
  var runAddDialogAgentAction = async (args, thunkApi) => {
@@ -8354,7 +8356,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
8354
8356
  return setDialogExtraReferencesAction(args, thunkApi);
8355
8357
  };
8356
8358
  var runHandleSendMessageAction = async (args, thunkApi) => {
8357
- const { handleSendMessageAction } = await import("./handleSendMessageAction-R3ZHTVU4.js");
8359
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-Q4HY35WX.js");
8358
8360
  return handleSendMessageAction(args, thunkApi);
8359
8361
  };
8360
8362
  function clearDialogState() {
@@ -8367,7 +8369,7 @@ var createPageAndAddReference = createAsyncThunk(
8367
8369
  async (payload, { dispatch, getState, rejectWithValue }) => {
8368
8370
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
8369
8371
  try {
8370
- const { createDocState } = await import("./docStore-6KMERNUY.js");
8372
+ const { createDocState } = await import("./docStore-5HOJ4D7D.js");
8371
8373
  const pageKey = await createDocState(
8372
8374
  { slateData, title },
8373
8375
  { dispatch, getState }
@@ -8855,6 +8857,28 @@ function updateColumnWidthInMeta(meta, input, deps) {
8855
8857
  );
8856
8858
  return ok(buildMeta(meta, newColumns, deps.nowIso));
8857
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
+ }
8858
8882
 
8859
8883
  // packages/render/table/createTableAction.ts
8860
8884
  var import_date_fns2 = __toESM(require_date_fns(), 1);
@@ -12113,6 +12137,53 @@ var tableSlice = createSliceWithThunks3({
12113
12137
  }
12114
12138
  }
12115
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
+ ),
12116
12187
  /* --------------------------------------
12117
12188
  * 4.3 重命名表:renameTable(仅修改显示名称)
12118
12189
  * ------------------------------------*/
@@ -12280,6 +12351,7 @@ var {
12280
12351
  updateCell,
12281
12352
  reorderColumn,
12282
12353
  updateColumnWidth,
12354
+ addColumnOption,
12283
12355
  setTableFocusContext
12284
12356
  } = tableSlice.actions;
12285
12357
  var {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildAgentRuntimeAgentLookupKeys,
3
3
  shouldFetchAgentRuntimeRecordRemotely
4
- } from "./chunk-YLRTBX4Y.js";
4
+ } from "./chunk-R35XMF6F.js";
5
5
 
6
6
  // packages/cli/client/localAgentRecords.ts
7
7
  var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;
@@ -15,7 +15,7 @@ import {
15
15
  platformHostedModels,
16
16
  xaiModels,
17
17
  zaiModels
18
- } from "./chunk-O6W2O2DA.js";
18
+ } from "./chunk-MKA6QE5E.js";
19
19
  import {
20
20
  __export
21
21
  } from "./chunk-4VNS5WPM.js";
@@ -5,10 +5,10 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-PZCBZO4J.js";
8
+ } from "./chunk-CZ6NYQTV.js";
9
9
  import {
10
10
  performFetchRequest
11
- } from "./chunk-ZJZCMKOR.js";
11
+ } from "./chunk-VYHDJEQD.js";
12
12
  import {
13
13
  createSSEParser,
14
14
  createToolRunId,
@@ -19,7 +19,7 @@ import {
19
19
  toolRunSetPending,
20
20
  toolRunStarted,
21
21
  toolRunSucceeded
22
- } from "./chunk-NEKFSXOP.js";
22
+ } from "./chunk-EDV7EBOI.js";
23
23
  import {
24
24
  getPublicImageAgentMode
25
25
  } from "./chunk-VIDPVFP3.js";
@@ -29,13 +29,13 @@ import {
29
29
  messageStreaming,
30
30
  selectCurrentSpaceId,
31
31
  updateToolMessage
32
- } from "./chunk-NVB267BZ.js";
32
+ } from "./chunk-SCTYAHYK.js";
33
33
  import {
34
34
  streamAgentChatTurn
35
- } from "./chunk-MD3V54DA.js";
35
+ } from "./chunk-REA4JLBH.js";
36
36
  import {
37
37
  EMPTY_ASSISTANT_REPAIR_PROMPT
38
- } from "./chunk-QCJITMYO.js";
38
+ } from "./chunk-YGW4G5W5.js";
39
39
  import {
40
40
  accumulateToolCallDelta,
41
41
  createThinkParserState,
@@ -47,10 +47,10 @@ import {
47
47
  } from "./chunk-LSFAWXKC.js";
48
48
  import {
49
49
  getModelInfo
50
- } from "./chunk-EGPCU42M.js";
50
+ } from "./chunk-I2ZJKTG5.js";
51
51
  import {
52
52
  getApiEndpoint
53
- } from "./chunk-HQPG2PIV.js";
53
+ } from "./chunk-UAIVG4J6.js";
54
54
  import {
55
55
  toErrorMessage
56
56
  } from "./chunk-HNMXYYJR.js";
@@ -1223,6 +1223,7 @@ function applyDelta(state, delta) {
1223
1223
  const reasoningChunk = delta.reasoning_content ?? delta.reasoning ?? "";
1224
1224
  if (reasoningChunk) {
1225
1225
  next.reasoningBuffer = (next.reasoningBuffer || "") + reasoningChunk;
1226
+ hasNewVisibleContent = true;
1226
1227
  }
1227
1228
  if (Array.isArray(delta.tool_calls) && delta.tool_calls.length > 0) {
1228
1229
  const accumulated = accumulateToolCallChunks(
@@ -1268,6 +1269,7 @@ function applyDelta(state, delta) {
1268
1269
  next.thinkState = parsed.state;
1269
1270
  if (parsed.reasoning) {
1270
1271
  next.reasoningBuffer = (next.reasoningBuffer || "") + parsed.reasoning;
1272
+ hasNewVisibleContent = true;
1271
1273
  }
1272
1274
  if (parsed.content) {
1273
1275
  next = {
@@ -1296,6 +1298,58 @@ function emitStreamingUpdate(hasNewVisibleContent, state, ctx) {
1296
1298
  })
1297
1299
  );
1298
1300
  }
1301
+ function createStreamThrottler(emitUpdate, options) {
1302
+ let pendingState = null;
1303
+ let timerId = null;
1304
+ const defaultSchedule = (cb) => {
1305
+ if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
1306
+ return window.requestAnimationFrame(cb);
1307
+ }
1308
+ return setTimeout(cb, 16);
1309
+ };
1310
+ const defaultCancel = (id) => {
1311
+ if (typeof window !== "undefined" && typeof window.cancelAnimationFrame === "function") {
1312
+ window.cancelAnimationFrame(id);
1313
+ return;
1314
+ }
1315
+ clearTimeout(id);
1316
+ };
1317
+ const scheduleFn = options?.schedule ?? defaultSchedule;
1318
+ const cancelFn = options?.cancel ?? defaultCancel;
1319
+ return {
1320
+ push(state) {
1321
+ pendingState = state;
1322
+ if (timerId === null) {
1323
+ timerId = scheduleFn(() => {
1324
+ timerId = null;
1325
+ if (pendingState !== null) {
1326
+ const stateToEmit = pendingState;
1327
+ pendingState = null;
1328
+ emitUpdate(stateToEmit);
1329
+ }
1330
+ });
1331
+ }
1332
+ },
1333
+ flush() {
1334
+ if (timerId !== null) {
1335
+ cancelFn(timerId);
1336
+ timerId = null;
1337
+ }
1338
+ if (pendingState !== null) {
1339
+ const stateToEmit = pendingState;
1340
+ pendingState = null;
1341
+ emitUpdate(stateToEmit);
1342
+ }
1343
+ },
1344
+ cancel() {
1345
+ if (timerId !== null) {
1346
+ cancelFn(timerId);
1347
+ timerId = null;
1348
+ }
1349
+ pendingState = null;
1350
+ }
1351
+ };
1352
+ }
1299
1353
  function validateAndPartitionToolCalls(state) {
1300
1354
  const validCalls = [];
1301
1355
  const invalidCalls = [];
@@ -1510,7 +1564,8 @@ var sendOpenAICompletionsRequest = async ({
1510
1564
  parentMessageId,
1511
1565
  messageMetadata,
1512
1566
  disableToolsForThisRequest = false,
1513
- quickChatPerfStartedAt
1567
+ quickChatPerfStartedAt,
1568
+ streamThrottlerOptions
1514
1569
  }) => {
1515
1570
  const { dispatch, getState, signal: thunkSignal } = thunkApi;
1516
1571
  const dialogId = extractCustomId(dialogKey);
@@ -1557,6 +1612,16 @@ var sendOpenAICompletionsRequest = async ({
1557
1612
  let lastFinishReason = null;
1558
1613
  let activeMessageMetadata = messageMetadata;
1559
1614
  let emptyCompletionRetryUsed = false;
1615
+ const throttler = createStreamThrottler((latestState) => {
1616
+ emitStreamingUpdate(true, latestState, {
1617
+ dispatch,
1618
+ agentConfig,
1619
+ messageId,
1620
+ msgKey,
1621
+ dialogId,
1622
+ messageMetadata: activeMessageMetadata
1623
+ });
1624
+ }, streamThrottlerOptions);
1560
1625
  const buildMeta = () => ({
1561
1626
  hasToolCalls: Array.isArray(streamState.assistantToolCalls) && streamState.assistantToolCalls.length > 0,
1562
1627
  hasPendingInteraction: hasPendingInteractionOverall,
@@ -1664,6 +1729,7 @@ var sendOpenAICompletionsRequest = async ({
1664
1729
  while (true) {
1665
1730
  const { done, value } = await readStreamChunkWithTimeout(reader, signal);
1666
1731
  if (done) {
1732
+ throttler.flush();
1667
1733
  const producedNothing = streamState.contentBuffer.length === 0 && !streamState.reasoningBuffer.trim() && (streamState.assistantToolCalls?.length ?? 0) === 0;
1668
1734
  if (producedNothing && !emptyCompletionRetryUsed && !streamState.hasHandedOff && !streamState.alreadyFinalized && !signal.aborted) {
1669
1735
  emptyCompletionRetryUsed = true;
@@ -1683,6 +1749,7 @@ var sendOpenAICompletionsRequest = async ({
1683
1749
  dialogId
1684
1750
  });
1685
1751
  if (retryResponse.ok && retryResponse.body) {
1752
+ throttler.cancel();
1686
1753
  streamState = createInitialStreamState();
1687
1754
  parseSSE = createSSEParser();
1688
1755
  decoder = new TextDecoder();
@@ -1732,6 +1799,7 @@ var sendOpenAICompletionsRequest = async ({
1732
1799
  continue;
1733
1800
  }
1734
1801
  if (data.error) {
1802
+ throttler.flush();
1735
1803
  const errorMsg = `Error: ${formatStreamErrorMessage(data)}`;
1736
1804
  streamState = {
1737
1805
  ...streamState,
@@ -1760,19 +1828,18 @@ var sendOpenAICompletionsRequest = async ({
1760
1828
  { dialogKey }
1761
1829
  );
1762
1830
  }
1763
- emitStreamingUpdate(hasNewVisibleContent, streamState, {
1764
- dispatch,
1765
- agentConfig,
1766
- messageId,
1767
- msgKey,
1768
- dialogId,
1769
- messageMetadata: activeMessageMetadata
1770
- });
1831
+ if (hasNewVisibleContent) {
1832
+ throttler.push(streamState);
1833
+ }
1834
+ if (Array.isArray(delta.tool_calls) && delta.tool_calls.length > 0) {
1835
+ throttler.flush();
1836
+ }
1771
1837
  const finishReason = choice.finish_reason;
1772
1838
  if (finishReason) {
1773
1839
  lastFinishReason = finishReason;
1774
1840
  streamState.finishReason = finishReason;
1775
1841
  if (finishReason === "tool_calls") {
1842
+ throttler.flush();
1776
1843
  if (streamState.totalUsage) {
1777
1844
  dispatch(tokenUsageLiveUpdate({
1778
1845
  input_tokens: streamState.totalUsage.prompt_tokens ?? streamState.totalUsage.input_tokens,
@@ -1813,6 +1880,7 @@ var sendOpenAICompletionsRequest = async ({
1813
1880
  }
1814
1881
  }
1815
1882
  } catch (error) {
1883
+ throttler.flush();
1816
1884
  let errorText;
1817
1885
  const isAbort = isAbortError(error);
1818
1886
  if (isAbort) {
@@ -1834,6 +1902,7 @@ var sendOpenAICompletionsRequest = async ({
1834
1902
  }
1835
1903
  streamState = await finalizeStream(streamState, finalizeCtx);
1836
1904
  } finally {
1905
+ throttler.cancel();
1837
1906
  logQuickChatPerfStage(quickChatPerfStartedAt, "openai-completions-stream-finished", {
1838
1907
  dialogKey
1839
1908
  });
@@ -7,7 +7,7 @@ import {
7
7
  listUserRecordsFromServers,
8
8
  readDbRecordFromServers,
9
9
  readLiveDbRecordAfterTombstoneMerge
10
- } from "./chunk-ZVOZH2HW.js";
10
+ } from "./chunk-HEGV7BH3.js";
11
11
  import {
12
12
  buildDialogAttachmentPlan,
13
13
  extractFileContentIds
@@ -625,7 +625,7 @@ async function tryHttpDialogCandidates(args) {
625
625
  throw Object.assign(new Error("All HTTP dialog reads failed"), { attempts });
626
626
  }
627
627
  async function readDialogFromLocalDb(dialogKey, dialogId, limit) {
628
- const { readDialogFromLocalDb: readLocalDialog } = await import("./localDialogRead-HQZPVIE3.js");
628
+ const { readDialogFromLocalDb: readLocalDialog } = await import("./localDialogRead-4H3QJFLW.js");
629
629
  const result = await readLocalDialog({ dialogKey, dialogId, limit });
630
630
  return {
631
631
  ...result,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  generatePkcePair,
3
3
  startCallbackServer
4
- } from "./chunk-UB4RYYNQ.js";
4
+ } from "./chunk-OK6YSWLH.js";
5
5
  import {
6
6
  toErrorMessage
7
7
  } from "./chunk-HNMXYYJR.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isAgentRunTerminalStatus
3
- } from "./chunk-FKXFCYVO.js";
3
+ } from "./chunk-FQZZLA3C.js";
4
4
  import {
5
5
  isCompiledBinary,
6
6
  resolveCliEntrypointPath