@wirecat/cli-memo 0.131.75 → 0.131.76

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 (186) hide show
  1. package/dist/actions/actions.d.ts +1 -0
  2. package/dist/actions/actions.d.ts.map +1 -1
  3. package/dist/actions/actions.js +3 -3
  4. package/dist/actions/actions.js.map +1 -1
  5. package/dist/actions/command.d.ts.map +1 -1
  6. package/dist/actions/command.js +3 -1
  7. package/dist/actions/command.js.map +1 -1
  8. package/dist/agents/command.d.ts.map +1 -1
  9. package/dist/agents/command.js +3 -2
  10. package/dist/agents/command.js.map +1 -1
  11. package/dist/agents/log.d.ts +1 -1
  12. package/dist/agents/log.d.ts.map +1 -1
  13. package/dist/agents/log.js +5 -4
  14. package/dist/agents/log.js.map +1 -1
  15. package/dist/bin/memo.js +2 -2
  16. package/dist/bin/memo.js.map +1 -1
  17. package/dist/bundle/{all-profiles-LUGN5BHP.js → all-profiles-CGQTLFDM.js} +5 -5
  18. package/dist/bundle/{anthropic-W7JXDZPL.js → anthropic-C744EPRR.js} +2 -2
  19. package/dist/bundle/{app-server-TRRARE66.js → app-server-LOH7WXAB.js} +36 -36
  20. package/dist/bundle/auto-R3ABUML7.js +89 -0
  21. package/dist/bundle/{bun-S3JZIN4S.js → bun-SQWZDSWT.js} +2 -2
  22. package/dist/bundle/{bun-sqlite-X3WQN3CV.js → bun-sqlite-YVBFXNWB.js} +2 -2
  23. package/dist/bundle/{chunk-ZISVFVQU.js → chunk-2KGYREGD.js} +363 -362
  24. package/dist/bundle/{chunk-SCYHDYLI.js → chunk-3NCRQMEN.js} +1 -1
  25. package/dist/bundle/{chunk-BDVM5652.js → chunk-3PLYUZAR.js} +1 -1
  26. package/dist/bundle/{chunk-YLYZNPAZ.js → chunk-42UNPXTC.js} +1 -1
  27. package/dist/bundle/{chunk-5CTOWPOL.js → chunk-47WS4BML.js} +4 -4
  28. package/dist/bundle/{chunk-7Y4HUYI3.js → chunk-4DTJF6E7.js} +5 -5
  29. package/dist/bundle/chunk-4IWOPJL4.js +185 -0
  30. package/dist/bundle/{chunk-E2PSOSTN.js → chunk-5AQIET5P.js} +1 -1
  31. package/dist/bundle/{chunk-RZS24U4N.js → chunk-5NY7U6CM.js} +8 -8
  32. package/dist/bundle/{chunk-VFKCZJFT.js → chunk-6RPLAGAL.js} +20 -20
  33. package/dist/bundle/{chunk-4KDORB7C.js → chunk-6YRVBXFH.js} +7 -7
  34. package/dist/bundle/{chunk-KDBAY5JZ.js → chunk-7OZEQIK7.js} +1 -1
  35. package/dist/bundle/{chunk-WZHCQ4VZ.js → chunk-7PSGKP3R.js} +6 -6
  36. package/dist/bundle/{chunk-VB4OLJHK.js → chunk-7XFJRX6F.js} +2 -2
  37. package/dist/bundle/{chunk-ZP2XI5DR.js → chunk-AI6PMW7L.js} +4 -4
  38. package/dist/bundle/{chunk-WKLF7CAM.js → chunk-AUCXJVUI.js} +29 -29
  39. package/dist/bundle/{chunk-UIAGASGP.js → chunk-C7OOLF5J.js} +5 -5
  40. package/dist/bundle/{chunk-NR633L2N.js → chunk-DDSKTPU7.js} +3 -3
  41. package/dist/bundle/{chunk-MPZBV5RL.js → chunk-DUON3SRD.js} +7 -7
  42. package/dist/bundle/{chunk-XQHOMQNZ.js → chunk-EVLOYNXC.js} +3 -3
  43. package/dist/bundle/{chunk-LPGE6ACC.js → chunk-FH753LZS.js} +1 -1
  44. package/dist/bundle/{chunk-JINEHQ2T.js → chunk-FUATAPSB.js} +93 -80
  45. package/dist/bundle/{chunk-6VMIMAZ2.js → chunk-GB64N6DP.js} +297 -294
  46. package/dist/bundle/{chunk-XQ3RZU3J.js → chunk-GBU4U55M.js} +1 -1
  47. package/dist/bundle/{chunk-XPSXVUZG.js → chunk-H3WELZYK.js} +2 -2
  48. package/dist/bundle/{chunk-6FTZ53TT.js → chunk-HAMGOLFU.js} +1 -1
  49. package/dist/bundle/{chunk-KYJBGCTC.js → chunk-KYLKZKQ7.js} +1 -1
  50. package/dist/bundle/{chunk-SJD4KTK2.js → chunk-LLBZDBPT.js} +2 -2
  51. package/dist/bundle/{chunk-W64FO6DD.js → chunk-MFQTOOHR.js} +397 -34
  52. package/dist/bundle/{chunk-5RLCKP5E.js → chunk-MODHP5VA.js} +12 -12
  53. package/dist/bundle/{chunk-LX3OSTBD.js → chunk-N2FIIVJV.js} +4 -4
  54. package/dist/bundle/{chunk-V7BDQIZS.js → chunk-NE3UIK5P.js} +2 -2
  55. package/dist/bundle/{chunk-ZTZLAGZA.js → chunk-NM4QMIOQ.js} +2 -2
  56. package/dist/bundle/{chunk-G45BLLDR.js → chunk-O3KNZVDZ.js} +2 -2
  57. package/dist/bundle/{chunk-XMHWGHID.js → chunk-ODCHYVTW.js} +173 -152
  58. package/dist/bundle/{chunk-6I4DOBSD.js → chunk-OEH5JUAL.js} +12 -12
  59. package/dist/bundle/{chunk-SIQDO5DN.js → chunk-OJU774SG.js} +3 -3
  60. package/dist/bundle/{chunk-ZL63GL3Y.js → chunk-PFNEOHCY.js} +2 -2
  61. package/dist/bundle/{chunk-C6MWOBEL.js → chunk-RLRKBPLJ.js} +15 -9
  62. package/dist/bundle/{chunk-346PWQJF.js → chunk-RTSRESGX.js} +5 -5
  63. package/dist/bundle/{chunk-KUFOM3SB.js → chunk-S54Z74G2.js} +1 -1
  64. package/dist/bundle/{chunk-UU3OAPGO.js → chunk-SF2OLWBU.js} +6 -6
  65. package/dist/bundle/{chunk-6AOPUQTC.js → chunk-TD4HM7XL.js} +1 -1
  66. package/dist/bundle/{chunk-GFVSZY4J.js → chunk-TGURQ4YH.js} +7 -1
  67. package/dist/bundle/{chunk-E74VWHZ2.js → chunk-TPWAXJUQ.js} +1 -1
  68. package/dist/bundle/{chunk-4QGUBKN5.js → chunk-TXVXEE7L.js} +4 -4
  69. package/dist/bundle/{chunk-FGMFJUHR.js → chunk-V6CRCAWN.js} +668 -367
  70. package/dist/bundle/{chunk-YB4KGUXY.js → chunk-VFJAGY3L.js} +2 -2
  71. package/dist/bundle/{chunk-YDTGYYOR.js → chunk-W5ARY4U2.js} +4 -4
  72. package/dist/bundle/{chunk-AOHT5FNX.js → chunk-XGPSFPLH.js} +45 -45
  73. package/dist/bundle/{chunk-QYJJBE56.js → chunk-Y7YXXWQI.js} +3 -3
  74. package/dist/bundle/{chunk-SIOPF2UG.js → chunk-YD7XTYEC.js} +5 -5
  75. package/dist/bundle/{chunk-OWUEEVF6.js → chunk-YNXQAB4X.js} +11 -10
  76. package/dist/bundle/{chunk-EWRHTZD3.js → chunk-YRJ2576I.js} +10 -10
  77. package/dist/bundle/{chunk-4XI7S3PO.js → chunk-YSOTOUHJ.js} +13 -13
  78. package/dist/bundle/{chunk-IQIM4UC7.js → chunk-YU7KZW5I.js} +4 -4
  79. package/dist/bundle/{chunk-ZXW5FPH2.js → chunk-Z3NRIW4M.js} +1 -1
  80. package/dist/bundle/{chunk-2QND7VJS.js → chunk-ZHAHSVQO.js} +5 -5
  81. package/dist/bundle/{chunk-QKWM4VK4.js → chunk-ZIA7AU7L.js} +2 -2
  82. package/dist/bundle/{command-contract-QQG343ZQ.js → command-contract-IEUSFI3B.js} +11 -11
  83. package/dist/bundle/{command-server-entry-XVUPTSSH.js → command-server-entry-472XWNSN.js} +66 -50
  84. package/dist/bundle/{decode-METZOSMG.js → decode-SFZ67QJN.js} +2 -2
  85. package/dist/bundle/{echarts-EBSP4VCK.js → echarts-3U34KH7O.js} +2 -2
  86. package/dist/bundle/{embed-GVVU7N7W.js → embed-ZEZXJ45Q.js} +3 -3
  87. package/dist/bundle/{embedder-6BZOYAXV.js → embedder-AASO2I4Z.js} +6 -6
  88. package/dist/bundle/{entry-TBOYUMWB.js → entry-7VHMR3LD.js} +5 -5
  89. package/dist/bundle/failure-DJSK3LGN.js +69 -0
  90. package/dist/bundle/{first-run-HQ4GA4EF.js → first-run-YL3TIUU3.js} +5 -5
  91. package/dist/bundle/{first-screen-6T65PQ37.js → first-screen-OQVOWRYM.js} +12 -12
  92. package/dist/bundle/{instructions-VDKK3Y5Z.js → instructions-HG2ZZ7AP.js} +1 -1
  93. package/dist/bundle/{mcp-DEY765VA.js → mcp-EUFDOVMI.js} +35 -35
  94. package/dist/bundle/memo.js +8 -8
  95. package/dist/bundle/{node-HWGZYNUX.js → node-7AQN6OTR.js} +2 -2
  96. package/dist/bundle/{node-sqlite-PSYENWGS.js → node-sqlite-55KMFPGI.js} +3 -3
  97. package/dist/bundle/{oauth-TQGMUJK2.js → oauth-S2GLD4PY.js} +4 -4
  98. package/dist/bundle/{open-KDDJDKCE.js → open-6R4UPST5.js} +2 -2
  99. package/dist/bundle/{openai-QPGCUM4T.js → openai-JK5GCSDK.js} +7 -7
  100. package/dist/bundle/{process-APNTXJJE.js → process-C7J3IT7Q.js} +1 -1
  101. package/dist/bundle/{program-OGDARQTX.js → program-KWI6M5IB.js} +354 -151
  102. package/dist/bundle/{prompt-BMBZCLGF.js → prompt-EEFKVWSA.js} +2 -2
  103. package/dist/bundle/{recognize-3SEY2MAR.js → recognize-STYHVWQ6.js} +1 -1
  104. package/dist/bundle/{remote-ODH54UXO.js → remote-6MXZXHYY.js} +4 -4
  105. package/dist/bundle/{rerank-JQHBNTUK.js → rerank-IMX2ONZG.js} +4 -4
  106. package/dist/bundle/{serve-C22ZONSM.js → serve-ZNN464BH.js} +6 -6
  107. package/dist/bundle/server-4CHUUMVI.js +48 -0
  108. package/dist/bundle/{server-ADPO4V4B.js → server-L6OS2MJ5.js} +53 -52
  109. package/dist/bundle/server-VCZCAQOB.js +62 -0
  110. package/dist/bundle/{state-M3VGXSV4.js → state-7MP4KKPG.js} +3 -3
  111. package/dist/bundle/{store-GSZAXU3A.js → store-EMAKEEYI.js} +9 -9
  112. package/dist/bundle/store-maintenance-command-LWN6OUFA.js +47 -0
  113. package/dist/bundle/update-I4X2UO6J.js +72 -0
  114. package/dist/digest/backfill.d.ts.map +1 -1
  115. package/dist/digest/backfill.js +2 -1
  116. package/dist/digest/backfill.js.map +1 -1
  117. package/dist/digest/digest-commands.d.ts.map +1 -1
  118. package/dist/digest/digest-commands.js +2 -1
  119. package/dist/digest/digest-commands.js.map +1 -1
  120. package/dist/doctor/command.d.ts.map +1 -1
  121. package/dist/doctor/command.js +2 -1
  122. package/dist/doctor/command.js.map +1 -1
  123. package/dist/examples.d.ts.map +1 -1
  124. package/dist/examples.js +13 -1
  125. package/dist/examples.js.map +1 -1
  126. package/dist/exit-code.d.ts +7 -0
  127. package/dist/exit-code.d.ts.map +1 -0
  128. package/dist/exit-code.js +19 -0
  129. package/dist/exit-code.js.map +1 -0
  130. package/dist/facts/command.d.ts.map +1 -1
  131. package/dist/facts/command.js +3 -2
  132. package/dist/facts/command.js.map +1 -1
  133. package/dist/facts/fact.d.ts +1 -1
  134. package/dist/facts/fact.d.ts.map +1 -1
  135. package/dist/facts/fact.js +3 -3
  136. package/dist/facts/fact.js.map +1 -1
  137. package/dist/mcp/catalogue.d.ts +3 -0
  138. package/dist/mcp/catalogue.d.ts.map +1 -1
  139. package/dist/mcp/catalogue.js +1 -0
  140. package/dist/mcp/catalogue.js.map +1 -1
  141. package/dist/memories/command.d.ts.map +1 -1
  142. package/dist/memories/command.js +3 -2
  143. package/dist/memories/command.js.map +1 -1
  144. package/dist/memories/memory.d.ts +1 -1
  145. package/dist/memories/memory.d.ts.map +1 -1
  146. package/dist/memories/memory.js +2 -2
  147. package/dist/memories/memory.js.map +1 -1
  148. package/dist/page.d.ts +14 -5
  149. package/dist/page.d.ts.map +1 -1
  150. package/dist/page.js +11 -5
  151. package/dist/page.js.map +1 -1
  152. package/dist/program.d.ts +3 -1
  153. package/dist/program.d.ts.map +1 -1
  154. package/dist/program.js +7 -1
  155. package/dist/program.js.map +1 -1
  156. package/dist/reasons.d.ts.map +1 -1
  157. package/dist/reasons.js +6 -0
  158. package/dist/reasons.js.map +1 -1
  159. package/dist/records/import.d.ts.map +1 -1
  160. package/dist/records/import.js +60 -5
  161. package/dist/records/import.js.map +1 -1
  162. package/dist/records/input.d.ts +6 -2
  163. package/dist/records/input.d.ts.map +1 -1
  164. package/dist/records/input.js +87 -3
  165. package/dist/records/input.js.map +1 -1
  166. package/dist/run/import.d.ts.map +1 -1
  167. package/dist/run/import.js +2 -1
  168. package/dist/run/import.js.map +1 -1
  169. package/dist/sources/command.d.ts.map +1 -1
  170. package/dist/sources/command.js +27 -2
  171. package/dist/sources/command.js.map +1 -1
  172. package/dist/sources/read.d.ts +13 -0
  173. package/dist/sources/read.d.ts.map +1 -1
  174. package/dist/sources/read.js +27 -1
  175. package/dist/sources/read.js.map +1 -1
  176. package/dist/version.d.ts +1 -1
  177. package/dist/version.js +1 -1
  178. package/package.json +2 -2
  179. package/dist/bundle/auto-AQAKW55Z.js +0 -89
  180. package/dist/bundle/chunk-XPCTY6XV.js +0 -116
  181. package/dist/bundle/failure-EKMEAYZH.js +0 -69
  182. package/dist/bundle/server-3UX245DY.js +0 -62
  183. package/dist/bundle/server-6G5XF3V5.js +0 -48
  184. package/dist/bundle/store-maintenance-command-QMTALGSQ.js +0 -47
  185. package/dist/bundle/update-HDJ23IV5.js +0 -72
  186. /package/dist/bundle/{chunk-IXSUVHW6.js → chunk-IKIYW7FW.js} +0 -0
@@ -27,19 +27,19 @@ import {
27
27
  serverSearchOptions,
28
28
  summaryOf,
29
29
  unansweredHours
30
- } from "./chunk-FGMFJUHR.js";
30
+ } from "./chunk-V6CRCAWN.js";
31
31
  import {
32
32
  MAIL_HIT_UNTRUSTED,
33
33
  messagesAnswer,
34
34
  offsetOf,
35
35
  shownOf
36
- } from "./chunk-VFKCZJFT.js";
36
+ } from "./chunk-6RPLAGAL.js";
37
37
  import {
38
38
  messageItem
39
- } from "./chunk-AOHT5FNX.js";
39
+ } from "./chunk-XGPSFPLH.js";
40
40
  import {
41
41
  knownPermissionKeys
42
- } from "./chunk-4XI7S3PO.js";
42
+ } from "./chunk-YSOTOUHJ.js";
43
43
  import {
44
44
  AGENDA_DEFAULTS,
45
45
  DEFAULT_BACKEND,
@@ -63,17 +63,20 @@ import {
63
63
  sourceKey,
64
64
  typedQuery,
65
65
  withQuery
66
- } from "./chunk-6VMIMAZ2.js";
66
+ } from "./chunk-GB64N6DP.js";
67
67
  import {
68
68
  DEFAULT_DECISION_POLICY,
69
69
  MESSAGE_PARSING,
70
+ RECORDS_SCHEMA_VERSION,
71
+ RECORD_TYPES,
70
72
  THREAD_COLUMNS,
71
73
  mailOwnText,
74
+ pointerOf,
72
75
  queryFilter,
73
76
  registrableOf,
74
77
  scoreGroup,
75
78
  validateFields
76
- } from "./chunk-ZISVFVQU.js";
79
+ } from "./chunk-2KGYREGD.js";
77
80
  import {
78
81
  Command,
79
82
  FETCH,
@@ -103,11 +106,11 @@ import {
103
106
  snakeKeys,
104
107
  withSettingDefaults,
105
108
  withoutSetting
106
- } from "./chunk-XMHWGHID.js";
109
+ } from "./chunk-ODCHYVTW.js";
107
110
  import {
108
111
  mailHolderVariable,
109
112
  readOnlyLockOf
110
- } from "./chunk-KUFOM3SB.js";
113
+ } from "./chunk-S54Z74G2.js";
111
114
  import {
112
115
  DEAL_KINDS,
113
116
  KEEP_RUNS_FOR_DAYS,
@@ -125,7 +128,7 @@ import {
125
128
  time,
126
129
  timezoneOf,
127
130
  untrusted
128
- } from "./chunk-JINEHQ2T.js";
131
+ } from "./chunk-FUATAPSB.js";
129
132
  import {
130
133
  configFilePath,
131
134
  resolvePaths,
@@ -163,6 +166,361 @@ import {
163
166
  __toESM
164
167
  } from "./chunk-ZVVMGPBJ.js";
165
168
 
169
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/domain/records-table.js
170
+ var TABLE_RECORD_TYPES = Object.keys(RECORD_TYPES).filter((type) => !RECORD_TYPES[type].importOnly);
171
+ var TableError = class extends Error {
172
+ static {
173
+ __name(this, "TableError");
174
+ }
175
+ errors;
176
+ constructor(errors) {
177
+ super(errors.map((e) => e.message).join("; "));
178
+ this.errors = errors;
179
+ }
180
+ };
181
+ var LIST_SEPARATOR = "|";
182
+ var BOM = "\uFEFF";
183
+ var specOf = /* @__PURE__ */ __name((type) => RECORD_TYPES[type], "specOf");
184
+ var typesOf = /* @__PURE__ */ __name((schema) => schema.type === void 0 ? [] : typeof schema.type === "string" ? [schema.type] : [...schema.type], "typesOf");
185
+ var shapeOf = /* @__PURE__ */ __name((schema) => {
186
+ const types = typesOf(schema);
187
+ if (types.includes("integer"))
188
+ return "integer";
189
+ if (types.includes("boolean"))
190
+ return "boolean";
191
+ if (types.includes("array"))
192
+ return "list";
193
+ if (schema.pattern?.includes("T[0-9]{2}"))
194
+ return "instant";
195
+ if (schema.pattern?.startsWith("^[0-9]{4}-"))
196
+ return "day";
197
+ if (schema.pattern?.includes("[A-Za-z]{3}"))
198
+ return "currency";
199
+ if (schema.pattern?.includes("(\\.[0-9]"))
200
+ return "decimal";
201
+ return "text";
202
+ }, "shapeOf");
203
+ var valuesOf = /* @__PURE__ */ __name((schema) => schema.enum?.filter((v) => v !== null), "valuesOf");
204
+ var flat = /* @__PURE__ */ __name((schema) => {
205
+ const types = typesOf(schema);
206
+ return !types.includes("object") && !(types.includes("array") && schema.items?.type === "object");
207
+ }, "flat");
208
+ var fieldColumn = /* @__PURE__ */ __name((name, schema, required, kind) => {
209
+ const values = valuesOf(schema);
210
+ const shape = shapeOf(schema);
211
+ return {
212
+ name,
213
+ kind,
214
+ required,
215
+ shape,
216
+ description: schema.description ?? "",
217
+ ...values ? { values } : {},
218
+ ...shape === "list" ? { many: true } : {}
219
+ };
220
+ }, "fieldColumn");
221
+ var roleColumn = /* @__PURE__ */ __name((name, role) => ({
222
+ name,
223
+ kind: "role",
224
+ required: role.required === true,
225
+ shape: "text",
226
+ description: role.targets.length === 1 ? `The ${role.targets[0]}'s external id` : `<type>:<external id>, the type one of ${role.targets.join(", ")}`,
227
+ targets: role.targets,
228
+ ...role.many ? { many: true } : {}
229
+ }), "roleColumn");
230
+ var recordColumns = /* @__PURE__ */ __name((type) => {
231
+ const spec = specOf(type);
232
+ if (!spec || spec.importOnly)
233
+ return [];
234
+ const fields = spec.fields.properties ?? {};
235
+ const required = spec.fields.required ?? [];
236
+ const lists = Object.entries(fields).filter(([, schema]) => !flat(schema));
237
+ return [
238
+ { name: "external_id", kind: "id", required: true, shape: "text", description: "Its id in your system" },
239
+ ...Object.entries(fields).filter(([, schema]) => flat(schema)).map(([name, schema]) => fieldColumn(name, schema, required.includes(name), "field")),
240
+ ...Object.entries(spec.roles).filter(([, role]) => !role.linked).map(([name, role]) => roleColumn(name, role)),
241
+ ...lists.flatMap(([list, schema]) => {
242
+ const item = schema.items ?? {};
243
+ const own = item.required ?? [];
244
+ return Object.entries(item.properties ?? {}).map(([key, s]) => fieldColumn(`${list}.${key}`, s, required.includes(list) && own.includes(key), "item"));
245
+ })
246
+ ];
247
+ }, "recordColumns");
248
+ var csvCell = /* @__PURE__ */ __name((value, separator) => /["\r\n]/.test(value) || value.includes(separator) ? `"${value.replaceAll('"', '""')}"` : value, "csvCell");
249
+ var example = /* @__PURE__ */ __name((column) => {
250
+ if (column.values?.[0])
251
+ return column.values[0];
252
+ switch (column.shape) {
253
+ case "decimal":
254
+ return "100.00";
255
+ case "day":
256
+ return "2026-01-31";
257
+ case "instant":
258
+ return "2026-01-31T09:00:00Z";
259
+ case "currency":
260
+ return "EUR";
261
+ case "integer":
262
+ return 1;
263
+ case "boolean":
264
+ return true;
265
+ case "list":
266
+ return ["\u2026"];
267
+ default:
268
+ return column.description || "\u2026";
269
+ }
270
+ }, "example");
271
+ var exampleRef = /* @__PURE__ */ __name((column) => ({
272
+ role: column.name,
273
+ type: column.targets?.[0] ?? "",
274
+ external_id: `${column.targets?.[0] ?? "record"}-1`
275
+ }), "exampleRef");
276
+ var recordTemplate = /* @__PURE__ */ __name((type, format, { source, separator = "," } = {}) => {
277
+ const columns = recordColumns(type);
278
+ if (columns.length === 0)
279
+ throw new TableError([unknownType(type)]);
280
+ if (format === "csv")
281
+ return `${BOM}${columns.map((c) => csvCell(c.name, separator)).join(separator)}\r
282
+ `;
283
+ const fields = {};
284
+ for (const c of columns.filter((c2) => c2.kind === "field"))
285
+ fields[c.name] = example(c);
286
+ for (const c of columns.filter((c2) => c2.kind === "item")) {
287
+ const [list = "", key = ""] = c.name.split(".");
288
+ fields[list] ??= [{}];
289
+ const [first] = fields[list];
290
+ if (first)
291
+ first[key] = example(c);
292
+ }
293
+ const envelope = {
294
+ schema_version: RECORDS_SCHEMA_VERSION,
295
+ source: {
296
+ provider: source?.provider ?? "sheet",
297
+ account: source?.account ?? "main",
298
+ batch_id: source?.batch_id ?? "first-import"
299
+ },
300
+ records: [
301
+ {
302
+ key: `${type}-1`,
303
+ type,
304
+ external_id: `${type}-1`,
305
+ operation: "upsert",
306
+ fields,
307
+ relations: columns.filter((c) => c.kind === "role").map(exampleRef)
308
+ }
309
+ ]
310
+ };
311
+ return `${JSON.stringify(envelope, null, 2)}
312
+ `;
313
+ }, "recordTemplate");
314
+ var csvRows = /* @__PURE__ */ __name((text2, separator) => {
315
+ const rows = [];
316
+ let cells = [];
317
+ let cell = "";
318
+ let quoted2 = false;
319
+ let line2 = 1;
320
+ let start = 1;
321
+ const end = /* @__PURE__ */ __name(() => {
322
+ cells.push(cell);
323
+ cell = "";
324
+ }, "end");
325
+ for (let i = 0; i < text2.length; i++) {
326
+ const c = text2[i];
327
+ if (quoted2) {
328
+ if (c === '"' && text2[i + 1] === '"') {
329
+ cell += '"';
330
+ i++;
331
+ } else if (c === '"')
332
+ quoted2 = false;
333
+ else {
334
+ if (c === "\n")
335
+ line2++;
336
+ cell += c;
337
+ }
338
+ } else if (c === '"' && cell === "")
339
+ quoted2 = true;
340
+ else if (c === separator)
341
+ end();
342
+ else if (c === "\n" || c === "\r") {
343
+ if (c === "\r" && text2[i + 1] === "\n")
344
+ i++;
345
+ end();
346
+ rows.push({ cells, line: start });
347
+ cells = [];
348
+ line2++;
349
+ start = line2;
350
+ } else
351
+ cell += c;
352
+ }
353
+ if (cell !== "" || cells.length > 0) {
354
+ end();
355
+ rows.push({ cells, line: start });
356
+ }
357
+ return rows.filter((r) => r.cells.some((c) => c.trim() !== ""));
358
+ }, "csvRows");
359
+ var csvSeparator = /* @__PURE__ */ __name((header) => {
360
+ const count2 = /* @__PURE__ */ __name((s) => header.split(s).length - 1, "count");
361
+ return [";", " ", ","].reduce((best, s) => count2(s) > count2(best) ? s : best, ",");
362
+ }, "csvSeparator");
363
+ var DAY_DOTTED = /^(\d{1,2})[./](\d{1,2})[./](\d{4})$/;
364
+ var normalized = /* @__PURE__ */ __name((column, raw) => {
365
+ const value = raw.trim();
366
+ switch (column.shape) {
367
+ case "decimal": {
368
+ const plain = value.replace(/[\s  ]/g, "");
369
+ return /^\d+,\d+$/.test(plain) ? plain.replace(",", ".") : plain;
370
+ }
371
+ case "day": {
372
+ const dotted = DAY_DOTTED.exec(value);
373
+ return dotted ? `${dotted[3]}-${dotted[2]?.padStart(2, "0")}-${dotted[1]?.padStart(2, "0")}` : value;
374
+ }
375
+ case "currency":
376
+ return value.toUpperCase();
377
+ case "integer":
378
+ return /^-?\d+$/.test(value) ? Number(value) : value;
379
+ case "boolean":
380
+ return /^(true|yes|1|да|sí|si)$/i.test(value) ? true : /^(false|no|0|нет)$/i.test(value) ? false : value;
381
+ case "list":
382
+ return value.split(LIST_SEPARATOR).map((v) => v.trim()).filter(Boolean);
383
+ default:
384
+ return column.many ? value.split(LIST_SEPARATOR).map((v) => v.trim()).filter(Boolean) : value;
385
+ }
386
+ }, "normalized");
387
+ var unknownType = /* @__PURE__ */ __name((type) => ({
388
+ pointer: "",
389
+ code: "record.type",
390
+ message: `no table for ${type}: use one of ${TABLE_RECORD_TYPES.join(", ")}`
391
+ }), "unknownType");
392
+ var relationsOf = /* @__PURE__ */ __name((column, raw) => {
393
+ const targets = column.targets ?? [];
394
+ const values = column.many ? raw.split(LIST_SEPARATOR) : [raw];
395
+ const out = [];
396
+ for (const value of values.map((v) => v.trim()).filter(Boolean)) {
397
+ const at = value.indexOf(":");
398
+ const named = at > 0 ? value.slice(0, at) : "";
399
+ if (targets.length === 1 && !targets.includes(named)) {
400
+ out.push({ role: column.name, type: targets[0], external_id: value });
401
+ continue;
402
+ }
403
+ if (!targets.includes(named) || at === value.length - 1)
404
+ return {
405
+ pointer: "",
406
+ code: "record.invalid",
407
+ message: `${column.name} takes <type>:<external id>, the type one of ${targets.join(", ")}: not ${value}`
408
+ };
409
+ out.push({ role: column.name, type: named, external_id: value.slice(at + 1) });
410
+ }
411
+ return out;
412
+ }, "relationsOf");
413
+ var envelopeOfCsv = /* @__PURE__ */ __name((text2, { type, source, options }) => {
414
+ const columns = recordColumns(type);
415
+ if (columns.length === 0)
416
+ throw new TableError([unknownType(type)]);
417
+ const body = text2.startsWith(BOM) ? text2.slice(1) : text2;
418
+ const separator = csvSeparator(body.slice(0, body.search(/\r?\n|$/)));
419
+ const [head, ...rows] = csvRows(body, separator);
420
+ if (!head)
421
+ throw new TableError([{ pointer: "", code: "envelope.invalid", message: "the file has no header row" }]);
422
+ const byName = new Map(columns.map((c) => [c.name, c]));
423
+ const header = head.cells.map((name) => name.trim());
424
+ const unknown2 = header.filter((name) => name !== "" && !byName.has(name));
425
+ if (unknown2.length > 0)
426
+ throw new TableError([
427
+ {
428
+ pointer: "",
429
+ code: "envelope.invalid",
430
+ message: `columns ${type} has no field for: ${unknown2.join(", ")}. Download the ${type} template for the list`,
431
+ place: { line: 1, column: unknown2[0] }
432
+ }
433
+ ]);
434
+ if (!header.includes("external_id"))
435
+ throw new TableError([
436
+ { pointer: "", code: "envelope.invalid", message: "the header has no external_id column", place: { line: 1 } }
437
+ ]);
438
+ const records = [];
439
+ const indexById = /* @__PURE__ */ new Map();
440
+ const places = /* @__PURE__ */ new Map();
441
+ const errors = [];
442
+ for (const row of rows) {
443
+ const cell = /* @__PURE__ */ __name((name) => row.cells[header.indexOf(name)] ?? "", "cell");
444
+ const id = cell("external_id").trim();
445
+ if (!id) {
446
+ errors.push({
447
+ pointer: "",
448
+ code: "record.invalid",
449
+ message: "a row has no external_id",
450
+ place: { line: row.line, column: "external_id" }
451
+ });
452
+ continue;
453
+ }
454
+ const known = indexById.get(id);
455
+ const index = known ?? records.length;
456
+ const record2 = records[index] ?? {
457
+ key: `${type}:${id}`,
458
+ type,
459
+ external_id: id,
460
+ operation: "upsert",
461
+ fields: {},
462
+ relations: []
463
+ };
464
+ if (known === void 0) {
465
+ records.push(record2);
466
+ indexById.set(id, index);
467
+ places.set(pointerOf("records", index), { line: row.line });
468
+ }
469
+ const fields = record2.fields;
470
+ const item = {};
471
+ let list = "";
472
+ header.forEach((name, i) => {
473
+ const column = byName.get(name);
474
+ const raw = row.cells[i] ?? "";
475
+ if (!column || column.kind === "id" || raw.trim() === "")
476
+ return;
477
+ const at = { line: row.line, column: name };
478
+ if (column.kind === "field") {
479
+ fields[name] = normalized(column, raw);
480
+ places.set(pointerOf("records", index, "fields", name), at);
481
+ } else if (column.kind === "role") {
482
+ const relations = relationsOf(column, raw);
483
+ if (!Array.isArray(relations)) {
484
+ errors.push({ ...relations, pointer: pointerOf("records", index, "relations"), key: record2.key, place: at });
485
+ return;
486
+ }
487
+ record2.relations = [...(record2.relations ?? []).filter((r) => r.role !== name), ...relations];
488
+ places.set(pointerOf("records", index, "relations"), at);
489
+ } else {
490
+ const [of = "", key = ""] = name.split(".");
491
+ list = of;
492
+ item[key] = normalized(column, raw);
493
+ }
494
+ });
495
+ if (list) {
496
+ fields[list] ??= [];
497
+ const items = fields[list];
498
+ places.set(pointerOf("records", index, "fields", list, items.length), { line: row.line });
499
+ items.push(item);
500
+ }
501
+ }
502
+ if (errors.length > 0)
503
+ throw new TableError(errors);
504
+ const envelope = {
505
+ schema_version: RECORDS_SCHEMA_VERSION,
506
+ source,
507
+ ...options ? { options } : {},
508
+ records
509
+ };
510
+ return {
511
+ envelope,
512
+ placeOf(pointer) {
513
+ const item = /^\/records\/\d+\/fields\/([^/]+)\/\d+\/([^/]+)/.exec(pointer);
514
+ for (let at = pointer; at !== ""; at = at.slice(0, at.lastIndexOf("/"))) {
515
+ const place = places.get(at);
516
+ if (place)
517
+ return item && !place.column ? { ...place, column: `${item[1]}.${item[2]}` } : place;
518
+ }
519
+ return void 0;
520
+ }
521
+ };
522
+ }, "envelopeOfCsv");
523
+
166
524
  // node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
167
525
  var qrcode = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
168
526
  const PAD0 = 236;
@@ -1796,7 +2154,7 @@ var createDataURL = /* @__PURE__ */ __name(function(width, height, getPixel) {
1796
2154
  }, "createDataURL");
1797
2155
  var stringToBytes = qrcode.stringToBytes;
1798
2156
 
1799
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/attachments.js
2157
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/attachments.js
1800
2158
  var MAX_ATTACHMENT_CHARS = 2e5;
1801
2159
  var DEFAULT_ATTACHMENT_POLICY = { read: true, maxBytes: 10 * 1024 * 1024 };
1802
2160
  var POLICY_SKIPS = ["not-read", "too-large"];
@@ -1835,7 +2193,7 @@ var readAttachments = /* @__PURE__ */ __name(async (mail, messageId, { loadEngin
1835
2193
  return files;
1836
2194
  }, "readAttachments");
1837
2195
 
1838
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/read.js
2196
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/read.js
1839
2197
  var lowerSuspicious = /* @__PURE__ */ __name((items, suspicious) => [
1840
2198
  ...items.filter((item) => !suspicious(item)),
1841
2199
  ...items.filter(suspicious)
@@ -1922,11 +2280,11 @@ var attachmentsText = /* @__PURE__ */ __name((hit) => (hit.attachments ?? []).ma
1922
2280
  ${file.text.replace(/\n/g, "\n ")}`;
1923
2281
  }).join("\n"), "attachmentsText");
1924
2282
 
1925
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/bulk.js
2283
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/bulk.js
1926
2284
  var BULK = "bulk";
1927
2285
  var bulkBox = { externalId: "memo:bulk", name: "bulk", kind: BULK };
1928
2286
 
1929
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/email-input.js
2287
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/email-input.js
1930
2288
  var sentAtOf = /* @__PURE__ */ __name((date, receivedAt) => {
1931
2289
  const sent = date === null ? Number.NaN : Date.parse(date);
1932
2290
  return Number.isNaN(sent) ? Date.parse(receivedAt) : sent;
@@ -1946,7 +2304,7 @@ var parsedEmail = /* @__PURE__ */ __name((mail, item, header, address) => ({
1946
2304
  outgoing: mail.from === null ? null : mail.from.email === address
1947
2305
  }), "parsedEmail");
1948
2306
 
1949
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/presets.js
2307
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/presets.js
1950
2308
  var PRESETS = {
1951
2309
  social: {
1952
2310
  about: "notifications from social networks",
@@ -2038,7 +2396,7 @@ var presetMatches = /* @__PURE__ */ __name((name, facts) => {
2038
2396
  return false;
2039
2397
  }, "presetMatches");
2040
2398
 
2041
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/probe.js
2399
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/probe.js
2042
2400
  var share = /* @__PURE__ */ __name((part, whole) => Math.round(part / whole * 100) / 100, "share");
2043
2401
  var isSent = /* @__PURE__ */ __name((item) => item.labels?.includes("Sent") || /(^|\/)sent\b/i.test(item.folder ?? ""), "isSent");
2044
2402
  var groupKey = /* @__PURE__ */ __name((headers) => headers.listId === void 0 ? `from:${headers.from}` : `list:${headers.listId}`, "groupKey");
@@ -2106,7 +2464,7 @@ var probeMail = /* @__PURE__ */ __name((items, limit, ages = /* @__PURE__ */ new
2106
2464
  };
2107
2465
  }, "probeMail");
2108
2466
 
2109
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/facts.js
2467
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/facts.js
2110
2468
  var factsOf = /* @__PURE__ */ __name((listed2, rules, ages = /* @__PURE__ */ new Map()) => {
2111
2469
  const grouped = rules.some(({ match }) => match.score_at_least !== void 0 || match.preset !== void 0);
2112
2470
  if (!grouped)
@@ -2315,9 +2673,9 @@ function resolveLabel(charset) {
2315
2673
  if (utf16) {
2316
2674
  return utf16;
2317
2675
  }
2318
- const normalized = normalizeCharset(charset);
2319
- const codePage = normalized.match(codePagePattern);
2320
- const alias = codePage && codePageAliases.get(codePage[1]) || charsetAliases.get(normalized) || normalized;
2676
+ const normalized2 = normalizeCharset(charset);
2677
+ const codePage = normalized2.match(codePagePattern);
2678
+ const alias = codePage && codePageAliases.get(codePage[1]) || charsetAliases.get(normalized2) || normalized2;
2321
2679
  return ENCODING_LABELS.has(alias) ? alias : null;
2322
2680
  }
2323
2681
  __name(resolveLabel, "resolveLabel");
@@ -7377,7 +7735,7 @@ var PostalMime = class _PostalMime {
7377
7735
  }
7378
7736
  };
7379
7737
 
7380
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/headers.js
7738
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/headers.js
7381
7739
  var unfold = /* @__PURE__ */ __name((text2) => text2.replace(/\r?\n[ \t]+/g, " "), "unfold");
7382
7740
  var field = /* @__PURE__ */ __name((unfolded, name) => new RegExp(`^${name}:[ \\t]*(.*?)\\r?$`, "im").exec(unfolded)?.[1], "field");
7383
7741
  var fieldsOf = /* @__PURE__ */ __name((unfolded, name) => [...unfolded.matchAll(new RegExp(`^${name}:[ \\t]*(.*?)\\r?$`, "gim"))].map(([, value]) => value), "fieldsOf");
@@ -7424,7 +7782,7 @@ var mailHeadersOf = /* @__PURE__ */ __name((raw) => {
7424
7782
  };
7425
7783
  }, "mailHeadersOf");
7426
7784
 
7427
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/parse.js
7785
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/parse.js
7428
7786
  var MAX_BODY_CHARS = 1e6;
7429
7787
  var MAX_ATTACHMENTS = 50;
7430
7788
  var BRACKETED_ID = /<[^<>\s]+>/g;
@@ -7489,13 +7847,13 @@ var parseMail = /* @__PURE__ */ __name(async (raw, maxBodyChars = MAX_BODY_CHARS
7489
7847
  };
7490
7848
  }, "parseMail");
7491
7849
 
7492
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/partial.js
7850
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/partial.js
7493
7851
  var PARTIAL = "partial";
7494
7852
 
7495
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/account-key.js
7853
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/account-key.js
7496
7854
  var mailAccountKey = /* @__PURE__ */ __name((address) => ({ provider: "email", account: address.toLowerCase() }), "mailAccountKey");
7497
7855
 
7498
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/rule-stored.js
7856
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/rule-stored.js
7499
7857
  var ACTION_OF = { full: "keep", envelope: "envelope", skip: "skip" };
7500
7858
  var KINDS2 = {
7501
7859
  from: "string",
@@ -7564,7 +7922,7 @@ var storedMailRuleSet = /* @__PURE__ */ __name(async (store, account, query) =>
7564
7922
  }, "storedMailRuleSet");
7565
7923
  var storedMailRules = /* @__PURE__ */ __name(async (store, account, query) => (await storedMailRuleSet(store, account, query)).rules, "storedMailRules");
7566
7924
 
7567
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/rules.js
7925
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/rules.js
7568
7926
  var DAY_MS = 24 * 60 * 60 * 1e3;
7569
7927
  var domainOf = /* @__PURE__ */ __name((address) => address.slice(address.lastIndexOf("@") + 1), "domainOf");
7570
7928
  var domainMatches = /* @__PURE__ */ __name((wanted2, sender) => {
@@ -7636,7 +7994,7 @@ var tagsOf = /* @__PURE__ */ __name((rules, facts) => {
7636
7994
  }, "tagsOf");
7637
7995
  var conditionKeys = /* @__PURE__ */ __name((match) => Object.keys(match).filter((key) => match[key] !== void 0).sort(), "conditionKeys");
7638
7996
 
7639
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/rule-input.js
7997
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/rule-input.js
7640
7998
  var STORE_ACTION = { keep: "full", envelope: "envelope", skip: "skip" };
7641
7999
  var LOWER = ["from", "domain", "list_id", "subject"];
7642
8000
  var conditionsOf = /* @__PURE__ */ __name((match) => Object.fromEntries(conditionKeys(match).map((key) => {
@@ -7666,7 +8024,7 @@ var ruleInput = /* @__PURE__ */ __name((rule, source = rule.source ?? "owner") =
7666
8024
  decidedAt: decidedAtOf(rule.decided_at)
7667
8025
  }), "ruleInput");
7668
8026
 
7669
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/rule-tags.js
8027
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/rule-tags.js
7670
8028
  var reuseOf = /* @__PURE__ */ __name((error) => {
7671
8029
  const { details } = error;
7672
8030
  return details?.reason === "tag-review.required" ? details.candidates?.[0]?.name : void 0;
@@ -7727,7 +8085,7 @@ var settleRuleTags = /* @__PURE__ */ __name(async (store, accountId, rules, outc
7727
8085
  }
7728
8086
  }, "settleRuleTags");
7729
8087
 
7730
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/server-query.js
8088
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/server-query.js
7731
8089
  var DAY = 864e5;
7732
8090
  var empty = /* @__PURE__ */ __name(() => ({ words: [], from: [], to: [], cc: [], subject: [], body: [] }), "empty");
7733
8091
  var narrows = /* @__PURE__ */ __name((criteria) => criteria.words.length + criteria.from.length + criteria.to.length + criteria.cc.length + criteria.subject.length + criteria.body.length > 0 || criteria.since !== void 0 || criteria.before !== void 0 || criteria.seen !== void 0 || criteria.flagged !== void 0, "narrows");
@@ -7800,7 +8158,7 @@ var mailCriteriaOf = /* @__PURE__ */ __name((text2, { exact, timezone } = {}) =>
7800
8158
  };
7801
8159
  }, "mailCriteriaOf");
7802
8160
 
7803
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/server-search.js
8161
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/server-search.js
7804
8162
  var refusal = {
7805
8163
  unsupported: "this mailbox's server cannot be searched \u2014 use --backend archive",
7806
8164
  offline: "--backend server needs the network \u2014 not with --offline",
@@ -8015,7 +8373,7 @@ var searchMailServer = /* @__PURE__ */ __name(async (store, mailbox, access, req
8015
8373
  return { report, sources };
8016
8374
  }, "searchMailServer");
8017
8375
 
8018
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/cli/marks.js
8376
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/cli/marks.js
8019
8377
  var iso = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
8020
8378
  var mailMark = strictObject({
8021
8379
  holder: string(),
@@ -8113,7 +8471,7 @@ var resetMarkCommand = /* @__PURE__ */ __name((mail) => answerEntity(annotate(ne
8113
8471
  });
8114
8472
  }), "resetMarkCommand");
8115
8473
 
8116
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/review.js
8474
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/review.js
8117
8475
  var REVIEW_THREADS = 50;
8118
8476
  var REVIEW_PER_THREAD = 50;
8119
8477
  var OWED_DAYS = 30;
@@ -8211,7 +8569,7 @@ var reviewMail = /* @__PURE__ */ __name(async (store, mailbox, options) => {
8211
8569
  };
8212
8570
  }, "reviewMail");
8213
8571
 
8214
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/cli/review.js
8572
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/cli/review.js
8215
8573
  var DAY2 = 864e5;
8216
8574
  var REVIEW_UNTRUSTED = [...SUMMARY_UNTRUSTED, ...MAIL_HIT_UNTRUSTED];
8217
8575
  var MAIL_REVIEW_QUERY = defineQuery({
@@ -8493,7 +8851,7 @@ an agent over MCP, and each scheduled run.`).action(async function(query) {
8493
8851
  saved?.save(found.checked ?? {}, found.complete ? { through: found.until } : {});
8494
8852
  }), "mailReviewCommand");
8495
8853
 
8496
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/cli/bulk-settings.js
8854
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/cli/bulk-settings.js
8497
8855
  var listed = /* @__PURE__ */ __name((words2) => words2.join(", "), "listed");
8498
8856
  var MAIL_BULK_SETTINGS = [
8499
8857
  {
@@ -8549,7 +8907,7 @@ var bulkTriageOf = /* @__PURE__ */ __name((config) => {
8549
8907
  };
8550
8908
  }, "bulkTriageOf");
8551
8909
 
8552
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/cli/index.js
8910
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/cli/index.js
8553
8911
  var absentAccount = /* @__PURE__ */ __name((error) => {
8554
8912
  if (error instanceof CliError && error.code === "not_found")
8555
8913
  return void 0;
@@ -9303,6 +9661,11 @@ var migrateConfig = /* @__PURE__ */ __name((env = process.env) => {
9303
9661
  }, "migrateConfig");
9304
9662
 
9305
9663
  export {
9664
+ TABLE_RECORD_TYPES,
9665
+ TableError,
9666
+ recordColumns,
9667
+ recordTemplate,
9668
+ envelopeOfCsv,
9306
9669
  lowerSuspicious,
9307
9670
  searchMail,
9308
9671
  ATTACHMENT_CHARS,