nolo-cli 0.71.0 → 0.72.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 (68) hide show
  1. package/{_executeModel-GOV2OHC7.js → _executeModel-T3FPYFVF.js} +11 -11
  2. package/{agentDeleteCommand-FSIMTL4K.js → agentDeleteCommand-UAMLWTPS.js} +6 -6
  3. package/{agentEmailCommands-YZQ2VVHY.js → agentEmailCommands-65FRADWQ.js} +15 -14
  4. package/{agentListCommands-2YWZYH52.js → agentListCommands-63DOSBY7.js} +7 -7
  5. package/{agentMachineCommands-UCYM5RRQ.js → agentMachineCommands-HMMAULDF.js} +6 -6
  6. package/{agentRecordCommands-TPBYOPMA.js → agentRecordCommands-HX5AEFP7.js} +15 -14
  7. package/{agentRunCommand-HBC2EQVU.js → agentRunCommand-KXPU5X7D.js} +15 -14
  8. package/{agentRuntimeLocal-O6DZDTK4.js → agentRuntimeLocal-XG3IDNOC.js} +4 -4
  9. package/{agentSlice-ZPODGT3P.js → agentSlice-EACXUOWW.js} +1 -1
  10. package/{appDeleteCommands-HIJNWSK7.js → appDeleteCommands-TJXDMOYT.js} +7 -7
  11. package/{appDeployCommands-XULV2ZN6.js → appDeployCommands-ECZJQAAL.js} +7 -7
  12. package/{appDeployStatusCommands-ETY4Z7K6.js → appDeployStatusCommands-DZKVFG3Y.js} +7 -7
  13. package/{appGetCommands-M253LKDA.js → appGetCommands-JIT4OPUD.js} +7 -7
  14. package/{appListCommands-XYFXJMNP.js → appListCommands-NR2HRMDY.js} +7 -7
  15. package/{chatQueueReduxAdapter-Z67OC4WO.js → chatQueueReduxAdapter-XEIJO5WR.js} +2 -2
  16. package/chromeCommands-VOIRNJBL.js +499 -0
  17. package/chromeOpsCommands-M7DPCX2T.js +258 -0
  18. package/{chunk-PWGW5JTK.js → chunk-226XC5JW.js} +2 -2
  19. package/{chunk-SPQ7GSUX.js → chunk-4SUTS5DI.js} +113 -16
  20. package/{chunk-B62OSA77.js → chunk-AFIKMMGC.js} +1 -1
  21. package/{chunk-Q4OT2DC7.js → chunk-AFIWC5NH.js} +1 -1
  22. package/{chunk-RFMPSCHX.js → chunk-AI5QKFXK.js} +5568 -337
  23. package/{chunk-NUTDASGX.js → chunk-ALGK6TIE.js} +2 -2
  24. package/{chunk-VLX45P4L.js → chunk-CDVGNZDA.js} +2 -2
  25. package/{chunk-2QDDKFG5.js → chunk-CQ3WA2NE.js} +77 -0
  26. package/{chunk-CJ23A7U4.js → chunk-CUQ6PG2C.js} +14 -5
  27. package/{chunk-ZIUMSKK4.js → chunk-D74EWXL4.js} +87 -47
  28. package/{chunk-JWO3RQSH.js → chunk-DWPNOYMB.js} +1 -1
  29. package/{chunk-EDKF7RX4.js → chunk-EOARMOVD.js} +2 -0
  30. package/{chunk-T7PQFKJU.js → chunk-FSFQ3A7S.js} +1 -1
  31. package/{chunk-YYLLD6H6.js → chunk-H5I6AJX4.js} +22 -6
  32. package/{chunk-3NVAU4WZ.js → chunk-H7UKKEIS.js} +1 -1
  33. package/{chunk-YCDWJX45.js → chunk-KC5FAHVS.js} +1 -1
  34. package/{chunk-3U3EA3BO.js → chunk-L2Y24GRM.js} +2 -2
  35. package/{chunk-FCCT2LU2.js → chunk-MEVSATIF.js} +61 -19
  36. package/{chunk-BLCUMZNV.js → chunk-P7FA2HMM.js} +66 -120
  37. package/{chunk-AUKZOZFG.js → chunk-QA6YKM3H.js} +1 -1
  38. package/{chunk-HXAINXPQ.js → chunk-QC5LGHYP.js} +1 -1
  39. package/chunk-QCZX4FTW.js +242 -0
  40. package/{chunk-DQAEUZSQ.js → chunk-QRBAZ5PW.js} +2 -2
  41. package/{chunk-F657NADX.js → chunk-QUH3XHL5.js} +3 -3
  42. package/{chunk-TVDZABBT.js → chunk-U6LKJRJB.js} +4 -4
  43. package/{chunk-IDZTNRP2.js → chunk-X7HHHIOZ.js} +10 -2
  44. package/{chunk-AAWBX67U.js → chunk-X7Z7U4Z6.js} +5 -5
  45. package/{contentThunks-VGXYTSKU.js → contentThunks-3SPROFG5.js} +3 -3
  46. package/{createAgentAutomationAction-6YBZFLET.js → createAgentAutomationAction-EIP2EG3O.js} +3 -3
  47. package/{createDialogAction-N7CTNKB5.js → createDialogAction-RLUSTN4D.js} +4 -4
  48. package/{createPageAction-RXOOVKVO.js → createPageAction-4Y52G7WG.js} +3 -3
  49. package/{dialogCommands-PE5FEFJ5.js → dialogCommands-CJCAMML3.js} +7 -7
  50. package/{dialogSlice-NLSKRXBN.js → dialogSlice-THY45JWM.js} +2 -2
  51. package/{docCreateCommands-IPDFZVPG.js → docCreateCommands-H65RSKT4.js} +6 -6
  52. package/{docDeleteCommands-VQ4Y66CM.js → docDeleteCommands-PBYGJ6CZ.js} +7 -7
  53. package/{docReadCommands-PD33VV27.js → docReadCommands-4VRYN5R5.js} +6 -6
  54. package/{docStore-CIAYE5WP.js → docStore-ZQ3ECOPY.js} +1 -1
  55. package/{docUpdateCommands-CGUQ2JY3.js → docUpdateCommands-COZG3ZDB.js} +6 -6
  56. package/{handleSendMessageAction-ENUNMW3Z.js → handleSendMessageAction-CE4M5XIE.js} +2 -2
  57. package/index.js +108 -48
  58. package/{machineCommands-APIJY7UA.js → machineCommands-JE4G4JYB.js} +14 -13
  59. package/{machineWsRunDispatch-42WKRDE7.js → machineWsRunDispatch-FUQOSWD4.js} +14 -13
  60. package/package.json +1 -1
  61. package/{readlineWorkspace-MUV7VRD4.js → readlineWorkspace-Z4V3EB52.js} +191 -57
  62. package/{runAgentClientLoop-A4OXYOCL.js → runAgentClientLoop-NE5EHXSS.js} +9 -9
  63. package/{spaceCommands-Y47DDAQD.js → spaceCommands-WGXHETMT.js} +6 -6
  64. package/{streamAgentChatTurn-YHKNJEFR.js → streamAgentChatTurn-A6L6O22P.js} +11 -11
  65. package/{tools-S5RSWF3R.js → tools-JS475NYO.js} +6 -6
  66. package/{tuiSummaryLlmCaller-J5BEPLW5.js → tuiSummaryLlmCaller-3Z24VUWM.js} +2 -2
  67. package/{updateCommands-AJYSD73Y.js → updateCommands-Y363MC3L.js} +2 -2
  68. package/{updateDialogTitleAction-BU2VPE5B.js → updateDialogTitleAction-GMZUT6RP.js} +3 -3
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-SPQ7GSUX.js";
4
+ } from "./chunk-4SUTS5DI.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-FCCT2LU2.js";
7
+ } from "./chunk-MEVSATIF.js";
8
8
  import {
9
9
  runLocalAgentTurn
10
- } from "./chunk-CJ23A7U4.js";
10
+ } from "./chunk-CUQ6PG2C.js";
11
11
  import {
12
12
  applyToolSurfaceConstraints
13
13
  } from "./chunk-V3ZKNK5D.js";
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  readPipeText,
22
22
  spawnProcess
23
- } from "./chunk-IDZTNRP2.js";
23
+ } from "./chunk-X7HHHIOZ.js";
24
24
  import {
25
25
  parseUserIdFromAuthToken
26
26
  } from "./chunk-A7GB5UGH.js";
@@ -133,6 +133,7 @@ function resolveConnectorRunCwd(args) {
133
133
  }
134
134
  return cwd;
135
135
  }
136
+ var RUN_GIT_TIMEOUT_MS = 1e4;
136
137
  async function runGit(args, cwd, options = {}) {
137
138
  const proc = spawnProcess({
138
139
  cmd: ["git", ...args],
@@ -141,9 +142,24 @@ async function runGit(args, cwd, options = {}) {
141
142
  stderr: "pipe",
142
143
  stdin: "ignore"
143
144
  });
144
- const [stdout, exitCode] = await Promise.all([
145
+ const [stdout, , exitCode] = await Promise.all([
145
146
  readPipeText(proc.stdout),
146
- proc.exited
147
+ // git 在非仓库目录对 diff 系子命令会向 stderr 打印整段 usage(数十 KB):
148
+ // 不消费 stderr 会让 git 阻塞在写满的 stderr 管道上永不退出(bun:child_process),
149
+ // proc.exited 随之永不 resolve——connector 收尾整体挂死(2026-09-16 实测)。
150
+ readPipeText(proc.stderr),
151
+ // 超时保险丝:该路径历史上出过「进程不退出」类挂死(见上);超时 kill 后流关闭、
152
+ // Promise.all 收敛,-1 与真实非零退出一样走「无数据」降级。
153
+ new Promise((resolve2) => {
154
+ const timer = setTimeout(() => {
155
+ proc.kill();
156
+ resolve2(-1);
157
+ }, RUN_GIT_TIMEOUT_MS);
158
+ void proc.exited.then((code) => {
159
+ clearTimeout(timer);
160
+ resolve2(code);
161
+ });
162
+ })
147
163
  ]);
148
164
  if (exitCode !== 0) return null;
149
165
  return options.trim === false ? stdout.replace(/\r?\n$/, "") : stdout.trim();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-TVDZABBT.js";
4
+ } from "./chunk-U6LKJRJB.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-2KDR4CWE.js";
4
4
  import {
5
5
  resolveDefaultSpawn
6
- } from "./chunk-IDZTNRP2.js";
6
+ } from "./chunk-X7HHHIOZ.js";
7
7
  import {
8
8
  isCompiledBinary
9
9
  } from "./chunk-A7GB5UGH.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-Q4OT2DC7.js";
4
+ } from "./chunk-AFIWC5NH.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-AUKZOZFG.js";
7
+ } from "./chunk-QA6YKM3H.js";
8
8
  import {
9
9
  deriveCredentialGroup,
10
10
  toSafeAgentSummary
@@ -81,14 +81,14 @@ import {
81
81
  } from "./chunk-VF4K2QE6.js";
82
82
  import {
83
83
  createDocState
84
- } from "./chunk-DQAEUZSQ.js";
84
+ } from "./chunk-QRBAZ5PW.js";
85
85
  import {
86
86
  BUILTIN_OBJECT_SKILL_IDS,
87
87
  buildBuiltinObjectSkillConfig,
88
88
  buildBuiltinObjectSkillDbKey,
89
89
  buildBuiltinObjectSkillPageContent,
90
90
  createDialogAction
91
- } from "./chunk-VLX45P4L.js";
91
+ } from "./chunk-CDVGNZDA.js";
92
92
  import {
93
93
  DEFAULT_COLLAPSED_CATEGORIES,
94
94
  addContentToSpace,
@@ -106,7 +106,7 @@ import {
106
106
  updateContentCategory,
107
107
  updateContentTitle,
108
108
  writeStoredCollapsedCategories
109
- } from "./chunk-BLCUMZNV.js";
109
+ } from "./chunk-P7FA2HMM.js";
110
110
  import {
111
111
  getCurrentSpaceId,
112
112
  getCurrentSpaceIdRaw,
@@ -128,14 +128,14 @@ import {
128
128
  selectMsgById,
129
129
  uiAskChoiceFunc,
130
130
  uiAskChoiceFunctionSchema
131
- } from "./chunk-ZIUMSKK4.js";
131
+ } from "./chunk-D74EWXL4.js";
132
132
  import {
133
133
  createAgent,
134
134
  deleteServerSyncedCredential,
135
135
  runLlm,
136
136
  streamAgentChatTurn,
137
137
  updateAgent
138
- } from "./chunk-F657NADX.js";
138
+ } from "./chunk-QUH3XHL5.js";
139
139
  import {
140
140
  getActiveDialogKey,
141
141
  selectCurrentDialogKey,
@@ -4672,7 +4672,7 @@ async function deleteDialogsFunc(args, thunkApi) {
4672
4672
  const deletedDialogIds = [];
4673
4673
  const deletedDialogKeys = [];
4674
4674
  const failures = [];
4675
- const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-NLSKRXBN.js");
4675
+ const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-THY45JWM.js");
4676
4676
  for (const target of targets) {
4677
4677
  try {
4678
4678
  await thunkApi.dispatch(deleteDialog2(target.dbKey)).unwrap();
@@ -9933,6 +9933,19 @@ ${preview}`
9933
9933
  }
9934
9934
 
9935
9935
  // packages/ai/tools/chromeConnectorTools.ts
9936
+ var CHROME_CONNECTOR_TOOL_NAMES = [
9937
+ "chrome_list_tabs",
9938
+ "chrome_open_tab",
9939
+ "chrome_close_tab",
9940
+ "chrome_read_page",
9941
+ "chrome_click",
9942
+ "chrome_type",
9943
+ "chrome_press",
9944
+ "chrome_scroll",
9945
+ "chrome_screenshot",
9946
+ "chrome_read_console",
9947
+ "chrome_read_network"
9948
+ ];
9936
9949
  var CHROME_CONNECTOR_READ_TOOL_NAMES = [
9937
9950
  "chrome_list_tabs",
9938
9951
  "chrome_read_page",
@@ -9957,9 +9970,13 @@ var tabId = {
9957
9970
  type: "string",
9958
9971
  description: "Chrome tab id returned by chrome_list_tabs or chrome_open_tab."
9959
9972
  };
9973
+ var elementRef = {
9974
+ type: "string",
9975
+ description: "Revision-scoped ref like 1a2b3c4d-e2, copied verbatim from chrome_read_page; preferred over selector when available."
9976
+ };
9960
9977
  var selector = {
9961
9978
  type: "string",
9962
- description: "CSS selector for the visible page element to operate on."
9979
+ description: "CSS selector for the visible page element to operate on; fallback when no elementRef is available."
9963
9980
  };
9964
9981
  var chromeListTabsFunctionSchema = baseSchema(
9965
9982
  "chrome_list_tabs",
@@ -9981,32 +9998,51 @@ var chromeOpenTabFunctionSchema = baseSchema(
9981
9998
  },
9982
9999
  ["url"]
9983
10000
  );
10001
+ var chromeCloseTabFunctionSchema = baseSchema(
10002
+ "chrome_close_tab",
10003
+ "Close a Chrome tab through the Nolo desktop Chrome connector. Prefer closing the tabs your own run opened with chrome_open_tab, and ask the user before closing a tab they are using. Pinned tabs are refused (TAB_PINNED); unknown tab ids fail (TAB_NOT_FOUND).",
10004
+ {
10005
+ tabId
10006
+ },
10007
+ ["tabId"]
10008
+ );
9984
10009
  var chromeReadPageFunctionSchema = baseSchema(
9985
10010
  "chrome_read_page",
9986
- "Read visible text and lightweight DOM state from a Chrome tab without reading cookies or profile databases.",
10011
+ "Read a compact view of a Chrome tab: visible text (hard cap 6000 chars) plus short-lived elementRefs (hard cap 35) and a pageRevision. Reuse those refs for chrome_click and chrome_type instead of guessing selectors; use region to focus a big page. Does not read cookies or profile databases.",
9987
10012
  {
9988
10013
  tabId,
9989
- selector: {
9990
- ...selector,
9991
- description: "Optional CSS selector to limit the read to part of the page."
10014
+ region: {
10015
+ type: "string",
10016
+ description: "Optional CSS selector limiting the read to part of the page."
10017
+ },
10018
+ maxChars: {
10019
+ type: "number",
10020
+ description: "Optional text character budget; the connector clamps it to a hard maximum."
10021
+ },
10022
+ detail: {
10023
+ type: "string",
10024
+ enum: ["compact", "full"],
10025
+ description: "compact (default) returns budgeted text; full raises the budget and adds capped HTML."
9992
10026
  }
9993
10027
  },
9994
10028
  ["tabId"]
9995
10029
  );
9996
10030
  var chromeClickFunctionSchema = baseSchema(
9997
10031
  "chrome_click",
9998
- "Click a visible element in a Chrome tab. Do not use this for final submit/delete/payment/permission actions without action-time user confirmation.",
10032
+ "Click a visible element in a Chrome tab by elementRef from chrome_read_page, or by CSS selector. Controls whose name indicates an irreversible external action (payment, send, delete, publish, permission change) are refused with SENSITIVE_ACTION_REQUIRES_CONFIRMATION: this desktop runtime has no approval channel, so name the control and ask the user to activate it themselves.",
9999
10033
  {
10000
10034
  tabId,
10035
+ elementRef,
10001
10036
  selector
10002
10037
  },
10003
- ["tabId", "selector"]
10038
+ ["tabId"]
10004
10039
  );
10005
10040
  var chromeTypeFunctionSchema = baseSchema(
10006
10041
  "chrome_type",
10007
- "Type text into a Chrome page element. Typing sensitive data into a third-party site counts as data transmission.",
10042
+ "Type text into a Chrome page element identified by elementRef from chrome_read_page or by CSS selector. Typing into a control whose name indicates an irreversible external action is refused with SENSITIVE_ACTION_REQUIRES_CONFIRMATION, same as clicking it.",
10008
10043
  {
10009
10044
  tabId,
10045
+ elementRef,
10010
10046
  selector,
10011
10047
  text: {
10012
10048
  type: "string",
@@ -10017,11 +10053,11 @@ var chromeTypeFunctionSchema = baseSchema(
10017
10053
  description: "Whether to clear the field before typing. Defaults to true."
10018
10054
  }
10019
10055
  },
10020
- ["tabId", "selector", "text"]
10056
+ ["tabId", "text"]
10021
10057
  );
10022
10058
  var chromePressFunctionSchema = baseSchema(
10023
10059
  "chrome_press",
10024
- "Send a keyboard key or shortcut to a Chrome tab.",
10060
+ "Send a keyboard key or shortcut to a Chrome tab. Enter-like keys are refused with SENSITIVE_ACTION_REQUIRES_CONFIRMATION when the focused control is an irreversible action.",
10025
10061
  {
10026
10062
  tabId,
10027
10063
  key: {
@@ -10073,12 +10109,16 @@ var chromeReadConsoleFunctionSchema = baseSchema(
10073
10109
  );
10074
10110
  var chromeReadNetworkFunctionSchema = baseSchema(
10075
10111
  "chrome_read_network",
10076
- "Read a recent network summary from a Chrome tab using debugger-backed connector state.",
10112
+ "Read a deduplicated recent network summary from a Chrome tab using debugger-backed connector state. Static assets are filtered unless includeAssets is set.",
10077
10113
  {
10078
10114
  tabId,
10079
10115
  limit: {
10080
10116
  type: "number",
10081
10117
  description: "Maximum number of recent network entries to return."
10118
+ },
10119
+ includeAssets: {
10120
+ type: "boolean",
10121
+ description: "Include images, CSS, fonts and other static assets. Defaults to false."
10082
10122
  }
10083
10123
  },
10084
10124
  ["tabId"]
@@ -10086,6 +10126,7 @@ var chromeReadNetworkFunctionSchema = baseSchema(
10086
10126
  var chromeConnectorToolSchemas = [
10087
10127
  chromeListTabsFunctionSchema,
10088
10128
  chromeOpenTabFunctionSchema,
10129
+ chromeCloseTabFunctionSchema,
10089
10130
  chromeReadPageFunctionSchema,
10090
10131
  chromeClickFunctionSchema,
10091
10132
  chromeTypeFunctionSchema,
@@ -15505,7 +15546,7 @@ var executeToolRun = createAsyncThunk(
15505
15546
  if (!executionInput) {
15506
15547
  throw new Error(`ToolRun ${id} has no input to execute with.`);
15507
15548
  }
15508
- const { findToolExecutor: findToolExecutor2 } = await import("./tools-S5RSWF3R.js");
15549
+ const { findToolExecutor: findToolExecutor2 } = await import("./tools-JS475NYO.js");
15509
15550
  const { executor } = findToolExecutor2(run.toolName);
15510
15551
  toolRunStarted({
15511
15552
  id: run.id,
@@ -18012,7 +18053,7 @@ async function updateDocFunc(args, thunkApi) {
18012
18053
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
18013
18054
  };
18014
18055
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
18015
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-CIAYE5WP.js");
18056
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-ZQ3ECOPY.js");
18016
18057
  if (getDocState().pageKey === id) {
18017
18058
  applyExternalDocUpdate({
18018
18059
  slateData: finalSlateData,
@@ -20315,6 +20356,7 @@ export {
20315
20356
  readXPostFunc,
20316
20357
  readXhsProfileFunctionSchema,
20317
20358
  readXhsProfileFunc,
20359
+ CHROME_CONNECTOR_TOOL_NAMES,
20318
20360
  rememberMemoryFunctionSchema,
20319
20361
  deleteMemoryFunctionSchema,
20320
20362
  queryMemoryFunctionSchema,
@@ -9,7 +9,7 @@ import {
9
9
  initReactI18next,
10
10
  instance,
11
11
  toast
12
- } from "./chunk-ZIUMSKK4.js";
12
+ } from "./chunk-D74EWXL4.js";
13
13
  import {
14
14
  require_date_fns
15
15
  } from "./chunk-M76ECQRD.js";
@@ -72,7 +72,8 @@ import {
72
72
  scheduleWriteReplication
73
73
  } from "./chunk-3RAG2NAD.js";
74
74
  import {
75
- createClientLogger
75
+ createClientLogger,
76
+ isAbortError
76
77
  } from "./chunk-QOKAKDPE.js";
77
78
  import {
78
79
  selectIdentityUserId
@@ -102,6 +103,7 @@ var import_date_fns2 = __toESM(require_date_fns(), 1);
102
103
  import { ulid as ulid3 } from "ulid";
103
104
 
104
105
  // packages/render/table/fetchAndCacheTableRows.ts
106
+ var TABLE_ROWS_FETCH_TIMEOUT_MS = 5e3;
105
107
  var getRowTimestamp = (row) => {
106
108
  if (!row || typeof row !== "object") return 0;
107
109
  return asOptionalPositiveFiniteNumber(Date.parse(row.updatedAt ?? "")) ?? asOptionalPositiveFiniteNumber(Date.parse(row.createdAt ?? "")) ?? 0;
@@ -155,46 +157,63 @@ var loadLocalTableRows = async (db, tenantId, tableId) => {
155
157
  }
156
158
  return rows;
157
159
  };
158
- var fetchTableRowsFromServer = async (server, tenantId, tableId, headers) => {
159
- const res = await fetch(`${server}/rpc/listTableRows`, {
160
- method: "POST",
161
- headers,
162
- body: JSON.stringify({
163
- tenantId,
164
- tableId,
165
- includeDeleted: true,
166
- envelope: TABLE_SYNC_ENVELOPE
167
- })
168
- });
169
- if (!res.ok) {
170
- let msg = `\u52A0\u8F7D\u8868 ${tableId} \u884C\u5931\u8D25\uFF08${res.status}\uFF09`;
171
- try {
172
- const err2 = await res.json();
173
- if (err2 && typeof err2.message === "string") {
174
- msg = err2.message;
160
+ var fetchTableRowsFromServer = async (server, tenantId, tableId, headers, fetchImpl = fetch) => {
161
+ const controller = new AbortController();
162
+ const timeoutId = setTimeout(
163
+ () => controller.abort(),
164
+ TABLE_ROWS_FETCH_TIMEOUT_MS
165
+ );
166
+ try {
167
+ const res = await fetchImpl(`${server}/rpc/listTableRows`, {
168
+ method: "POST",
169
+ headers,
170
+ body: JSON.stringify({
171
+ tenantId,
172
+ tableId,
173
+ includeDeleted: true,
174
+ envelope: TABLE_SYNC_ENVELOPE
175
+ }),
176
+ signal: controller.signal
177
+ });
178
+ if (!res.ok) {
179
+ let msg = `\u52A0\u8F7D\u8868 ${tableId} \u884C\u5931\u8D25\uFF08${res.status}\uFF09`;
180
+ try {
181
+ const err2 = await res.json();
182
+ if (err2 && typeof err2.message === "string") {
183
+ msg = err2.message;
184
+ }
185
+ } catch {
175
186
  }
176
- } catch {
187
+ throw new Error(msg);
188
+ }
189
+ const data = await res.json();
190
+ if (Array.isArray(data)) {
191
+ return {
192
+ rows: data,
193
+ deletedRows: [],
194
+ tableMeta: null,
195
+ complete: false
196
+ };
197
+ }
198
+ if (!data || typeof data !== "object" || !Array.isArray(data.rows)) {
199
+ throw new Error("\u670D\u52A1\u5668\u8FD4\u56DE\u683C\u5F0F\u9519\u8BEF\uFF1A\u9884\u671F\u4E3A\u6570\u7EC4");
177
200
  }
178
- throw new Error(msg);
179
- }
180
- const data = await res.json();
181
- if (Array.isArray(data)) {
182
201
  return {
183
- rows: data,
184
- deletedRows: [],
185
- tableMeta: null,
186
- complete: false
202
+ rows: data.rows,
203
+ deletedRows: Array.isArray(data.deletedRows) ? data.deletedRows : [],
204
+ tableMeta: data.tableMeta ?? null,
205
+ complete: data.complete === true
187
206
  };
207
+ } catch (err2) {
208
+ if (isAbortError(err2)) {
209
+ throw new Error(
210
+ `\u52A0\u8F7D\u8868 ${tableId} \u884C\u8D85\u65F6\uFF1A${server} \u5728 ${TABLE_ROWS_FETCH_TIMEOUT_MS / 1e3}s \u5185\u65E0\u54CD\u5E94`
211
+ );
212
+ }
213
+ throw err2;
214
+ } finally {
215
+ clearTimeout(timeoutId);
188
216
  }
189
- if (!data || typeof data !== "object" || !Array.isArray(data.rows)) {
190
- throw new Error("\u670D\u52A1\u5668\u8FD4\u56DE\u683C\u5F0F\u9519\u8BEF\uFF1A\u9884\u671F\u4E3A\u6570\u7EC4");
191
- }
192
- return {
193
- rows: data.rows,
194
- deletedRows: Array.isArray(data.deletedRows) ? data.deletedRows : [],
195
- tableMeta: data.tableMeta ?? null,
196
- complete: data.complete === true
197
- };
198
217
  };
199
218
  var cacheMergedTableRows = async (db, mergedRows) => {
200
219
  if (!db) return;
@@ -252,7 +271,8 @@ var fetchAndCacheTableRows = async ({
252
271
  tenantId,
253
272
  tableId,
254
273
  token,
255
- remoteServers = []
274
+ remoteServers = [],
275
+ fetchImpl = fetch
256
276
  }) => {
257
277
  const headers = {
258
278
  "Content-Type": "application/json"
@@ -263,7 +283,7 @@ var fetchAndCacheTableRows = async ({
263
283
  const localRows = await loadLocalTableRows(db, tenantId, tableId);
264
284
  const remoteResults = await Promise.allSettled(
265
285
  remoteServers.map(
266
- (server) => fetchTableRowsFromServer(server, tenantId, tableId, headers)
286
+ (server) => fetchTableRowsFromServer(server, tenantId, tableId, headers, fetchImpl)
267
287
  )
268
288
  );
269
289
  const fulfilledRemoteSnapshots = remoteResults.filter(
@@ -367,43 +387,6 @@ function reorderColumnInMeta(meta, input, deps) {
367
387
  buildMeta(meta, reorderList(meta.columns, fromIndex, toIndex), deps.nowIso)
368
388
  );
369
389
  }
370
- function renameColumnInMeta(meta, rows, input, deps) {
371
- const { oldName } = input;
372
- const { nowIso } = deps;
373
- const newName = input.newName.trim();
374
- if (!newName) {
375
- return err("\u65B0\u7684\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
376
- }
377
- if (!meta.columns.some((c) => c.name === oldName)) {
378
- return err(`\u5B57\u6BB5 ${oldName} \u4E0D\u5B58\u5728`);
379
- }
380
- if (meta.columns.some((c) => c.name === newName)) {
381
- return err(`\u5B57\u6BB5 ${newName} \u5DF2\u5B58\u5728`);
382
- }
383
- const newColumns = meta.columns.map(
384
- (c) => c.name === oldName ? { ...c, name: newName } : c
385
- );
386
- const rowPatches = rows.filter((row) => hasOwn(row, oldName)).map((row) => ({
387
- dbKey: row.dbKey,
388
- changes: {
389
- [newName]: row[oldName],
390
- [oldName]: null,
391
- updatedAt: nowIso
392
- }
393
- }));
394
- const newRows = rows.map((row) => {
395
- if (!hasOwn(row, oldName)) {
396
- return row;
397
- }
398
- const { [oldName]: oldValue, ...rest } = row;
399
- return { ...rest, [newName]: oldValue, updatedAt: nowIso };
400
- });
401
- return ok({
402
- ...buildMeta(meta, newColumns, nowIso),
403
- rows: newRows,
404
- rowPatches
405
- });
406
- }
407
390
  function renameColumnLabelInMeta(meta, input, deps) {
408
391
  const { columnId } = input;
409
392
  const label = input.label.trim();
@@ -460,7 +443,13 @@ import { ulid as ulid2 } from "ulid";
460
443
  instance.use(initReactI18next).init({
461
444
  ...i18nBaseConfig,
462
445
  lng: "zh-CN" /* ZH_CN */,
463
- fallbackLng: "zh-CN" /* ZH_CN */,
446
+ fallbackLng: {
447
+ ["en" /* EN */]: ["en" /* EN */],
448
+ ["zh-CN" /* ZH_CN */]: ["zh-CN" /* ZH_CN */, "en" /* EN */],
449
+ ["zh-Hant" /* ZH_HANT */]: ["zh-Hant" /* ZH_HANT */, "zh-CN" /* ZH_CN */, "en" /* EN */],
450
+ ["ja" /* JA */]: ["ja" /* JA */, "en" /* EN */],
451
+ default: ["en" /* EN */]
452
+ },
464
453
  compatibilityJSON: "v3"
465
454
  });
466
455
  var client_default = instance;
@@ -1189,49 +1178,6 @@ var reorderColumn = createTableCommand(
1189
1178
  }
1190
1179
  }
1191
1180
  );
1192
- var renameColumn = createTableCommand(
1193
- "table/renameColumn",
1194
- async (args, { dispatch } = {}) => {
1195
- const { tenantId, tableId, oldName, newName } = args;
1196
- const meta = state.currentTable;
1197
- if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
1198
- throw new Error("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
1199
- }
1200
- const result = renameColumnInMeta(
1201
- meta,
1202
- state.rows,
1203
- { oldName, newName },
1204
- { nowIso: (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date()) }
1205
- );
1206
- if (!result.ok) {
1207
- throw new Error(result.error);
1208
- }
1209
- const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
1210
- setState((s) => ({ ...s, error: null }));
1211
- try {
1212
- if (dispatch) {
1213
- await Promise.all(
1214
- rowPatches.map((p) => safeDispatch(dispatch, patch(p)))
1215
- );
1216
- await safeDispatch(
1217
- dispatch,
1218
- patch({ dbKey: meta.dbKey, changes: metaChanges })
1219
- );
1220
- }
1221
- setState((s) => ({
1222
- ...s,
1223
- currentTable: nextMeta,
1224
- rows: newRows,
1225
- isInitialized: true
1226
- }));
1227
- return { meta: nextMeta, rows: newRows };
1228
- } catch (e) {
1229
- const msg = e?.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u5931\u8D25";
1230
- setState((s) => ({ ...s, error: msg }));
1231
- throw e;
1232
- }
1233
- }
1234
- );
1235
1181
  var renameColumnLabel = createTableCommand(
1236
1182
  "table/renameColumnLabel",
1237
1183
  async (args, { dispatch } = {}) => {
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  readPipeText,
13
13
  spawnProcess
14
- } from "./chunk-IDZTNRP2.js";
14
+ } from "./chunk-X7HHHIOZ.js";
15
15
  import {
16
16
  parseUserIdFromAuthToken,
17
17
  readOption,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sanitizeForOutbound
3
- } from "./chunk-2QDDKFG5.js";
3
+ } from "./chunk-CQ3WA2NE.js";
4
4
  import {
5
5
  accumulateToolCallDelta,
6
6
  createThinkParserState,