@wirecat/mail-cli 0.16.3 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +7 -4
  3. package/dist/bin/mail.js +2 -2
  4. package/dist/bundle/{all-profiles-TUDREUUW.js → all-profiles-4CVOXA5Y.js} +10 -10
  5. package/dist/bundle/{anthropic-KQOVSP6C.js → anthropic-5VIKYINO.js} +6 -6
  6. package/dist/bundle/{app-server-QK7PKVT7.js → app-server-LTSQBDPF.js} +53 -50
  7. package/dist/bundle/{bun-2NMWL5YB.js → bun-C7DBRUW2.js} +2 -2
  8. package/dist/bundle/{bun-sqlite-Y4FP6SDX.js → bun-sqlite-Y5JKT62B.js} +5 -5
  9. package/dist/bundle/{chunk-MLWN27HF.js → chunk-23HWKHPZ.js} +326 -288
  10. package/dist/bundle/{chunk-4IEDXIUN.js → chunk-2NWOYXPJ.js} +240 -64
  11. package/dist/bundle/{chunk-YPF6OS37.js → chunk-3DQYO7FB.js} +1 -1
  12. package/dist/bundle/{chunk-I3K6JG4I.js → chunk-3W5H4TM7.js} +182 -60
  13. package/dist/bundle/{chunk-CGH6UH3T.js → chunk-3YRE6DNM.js} +8 -8
  14. package/dist/bundle/{chunk-LMN7SYX4.js → chunk-43I5XD7S.js} +1 -1
  15. package/dist/bundle/{chunk-KMZRXGTF.js → chunk-5S6Q3SWU.js} +4 -2
  16. package/dist/bundle/{chunk-XEIGKPYU.js → chunk-6RO5RDNR.js} +50 -3
  17. package/dist/bundle/{chunk-OYB3FUYQ.js → chunk-7P4ICYJT.js} +1 -1
  18. package/dist/bundle/{chunk-XBIPSSKI.js → chunk-7SWWVDEZ.js} +4 -4
  19. package/dist/bundle/{chunk-4IIH5PXR.js → chunk-A5OMARL4.js} +28 -28
  20. package/dist/bundle/{chunk-ZNW4E3SG.js → chunk-ACLILULA.js} +3 -3
  21. package/dist/bundle/{chunk-EZIJPXDZ.js → chunk-AOMSP4EI.js} +6 -6
  22. package/dist/bundle/{chunk-G6RG2AZV.js → chunk-BHNBWFT5.js} +55 -8
  23. package/dist/bundle/{chunk-FHY664YS.js → chunk-BMFPCW6Q.js} +4 -4
  24. package/dist/bundle/{chunk-PWTEWT4M.js → chunk-BMGVKULS.js} +4 -4
  25. package/dist/bundle/{chunk-QCNK3YUZ.js → chunk-BMV56JCL.js} +19 -19
  26. package/dist/bundle/{chunk-B2NDDA2W.js → chunk-C4RUKMDT.js} +16 -10
  27. package/dist/bundle/{chunk-XAANQN4R.js → chunk-C5T5K7HW.js} +208 -83
  28. package/dist/bundle/{chunk-7LMTWOTP.js → chunk-CPEN6BZZ.js} +2 -2
  29. package/dist/bundle/{chunk-EB2IULWB.js → chunk-DALBYUPC.js} +2 -2
  30. package/dist/bundle/{chunk-6DVPPLAN.js → chunk-DPSH46NO.js} +5 -5
  31. package/dist/bundle/{chunk-VTJ5TMGN.js → chunk-EFP5NN7I.js} +3 -3
  32. package/dist/bundle/{chunk-KJV3BI7S.js → chunk-ERBEBORA.js} +23 -21
  33. package/dist/bundle/{chunk-RPEW7E3S.js → chunk-FLOOPXOT.js} +12 -12
  34. package/dist/bundle/{chunk-R6SBRHVG.js → chunk-GLLLYACZ.js} +6 -6
  35. package/dist/bundle/{chunk-WKHHCCJE.js → chunk-GRP67IQ4.js} +56 -47
  36. package/dist/bundle/{chunk-5KPPP3QN.js → chunk-HFUS33UT.js} +14 -2
  37. package/dist/bundle/{chunk-TTOKDZQX.js → chunk-HTFBXGJF.js} +2 -2
  38. package/dist/bundle/{chunk-N7DLDEFU.js → chunk-IANOK5SE.js} +2 -2
  39. package/dist/bundle/{chunk-3CVDHJER.js → chunk-ITUC5WAV.js} +1 -1
  40. package/dist/bundle/{chunk-POS35G6D.js → chunk-JO3BIMYK.js} +3 -3
  41. package/dist/bundle/{chunk-EBEYU7RW.js → chunk-KVSC657S.js} +44 -143
  42. package/dist/bundle/{chunk-DDQXDX4U.js → chunk-L3YX7A5M.js} +7 -7
  43. package/dist/bundle/{chunk-VP5FL5JQ.js → chunk-M7C4IGJ6.js} +8 -8
  44. package/dist/bundle/{chunk-ZS6YKNYS.js → chunk-MCR43SWG.js} +4 -4
  45. package/dist/bundle/{chunk-UBLFUQ7O.js → chunk-N5VEJ3E7.js} +97 -12
  46. package/dist/bundle/{chunk-IJYYD2JU.js → chunk-NDJZQCF3.js} +467 -231
  47. package/dist/bundle/{chunk-HN3EDDVX.js → chunk-OLJDZTHB.js} +13 -13
  48. package/dist/bundle/{chunk-3ZJE5TIG.js → chunk-OMKPALMX.js} +2 -2
  49. package/dist/bundle/{chunk-X7EBOXBY.js → chunk-OUGGAAXI.js} +13235 -1228
  50. package/dist/bundle/{chunk-YGJO5VNR.js → chunk-P6WCG6X2.js} +36 -30
  51. package/dist/bundle/{chunk-K2OQCQ2N.js → chunk-QPF4LTK5.js} +6 -6
  52. package/dist/bundle/{chunk-ARDUJR5Z.js → chunk-RIO3TD3I.js} +1 -1
  53. package/dist/bundle/{chunk-5FPQGUJA.js → chunk-RQSF7X22.js} +1 -1
  54. package/dist/bundle/{chunk-GAYW2JRW.js → chunk-SIYT2BBI.js} +10 -10
  55. package/dist/bundle/chunk-SMS5YNPB.js +64 -0
  56. package/dist/bundle/{chunk-PYX6K527.js → chunk-SW2KERUB.js} +648 -130
  57. package/dist/bundle/{chunk-Q4T2HBZP.js → chunk-TVZ77ZOV.js} +2 -2
  58. package/dist/bundle/{chunk-DKIAHQRN.js → chunk-U43HUE35.js} +9 -9
  59. package/dist/bundle/{chunk-CT2MIWXY.js → chunk-UEGABYXI.js} +3 -3
  60. package/dist/bundle/{chunk-KV4267S4.js → chunk-UHC5I3JV.js} +1 -1
  61. package/dist/bundle/{chunk-EDJQDR5X.js → chunk-UWL2IOII.js} +4 -4
  62. package/dist/bundle/{chunk-M6O4DH5F.js → chunk-UXD5JMS5.js} +1 -1
  63. package/dist/bundle/{chunk-ANFIIXBL.js → chunk-WA3DQSAZ.js} +2 -2
  64. package/dist/bundle/{chunk-FROWEHK7.js → chunk-XGTW3GRX.js} +2 -2
  65. package/dist/bundle/{chunk-VD6GZ3W2.js → chunk-YA2JPMYX.js} +2 -2
  66. package/dist/bundle/{chunk-CRYWPLJP.js → chunk-ZLH465EU.js} +1 -1
  67. package/dist/bundle/{chunk-HVAXTTOT.js → chunk-ZT2Y267T.js} +3 -3
  68. package/dist/bundle/command-contract-Y3GIKCPB.js +34 -0
  69. package/dist/bundle/{decode-WCS4KOHV.js → decode-WVIDLK4E.js} +5 -5
  70. package/dist/bundle/{dispatch-3ILCYZ4Q.js → dispatch-R5OF2FVZ.js} +8 -8
  71. package/dist/bundle/{dist-FL422DTA.js → dist-KGQWS3XL.js} +41 -23
  72. package/dist/bundle/{echarts-45D6USAX.js → echarts-VMKACZBF.js} +2 -2
  73. package/dist/bundle/{embed-4B4ATLCN.js → embed-EQINOOST.js} +6 -6
  74. package/dist/bundle/{embedder-ASWGJXNV.js → embedder-LM52TDRN.js} +9 -9
  75. package/dist/bundle/{failure-UDL5QZRZ.js → failure-WYKVF6RH.js} +2 -2
  76. package/dist/bundle/{first-run-5K3UD4BU.js → first-run-H4VXZAAF.js} +11 -11
  77. package/dist/bundle/first-screen-ZP74TJLK.js +32 -0
  78. package/dist/bundle/{instructions-6EFSPC7C.js → instructions-NLSME663.js} +1 -1
  79. package/dist/bundle/mail.js +12 -12
  80. package/dist/bundle/{mcp-PPVOM4SE.js → mcp-CFVG2OUS.js} +2 -2
  81. package/dist/bundle/{node-OXC26QXO.js → node-FGMSXLTA.js} +2 -2
  82. package/dist/bundle/{node-sqlite-PXHZAG7Y.js → node-sqlite-K3T3ZRBY.js} +6 -6
  83. package/dist/bundle/{oauth-YK2QLC7U.js → oauth-OJKJ6JLH.js} +7 -7
  84. package/dist/bundle/{open-SABDXZ4B.js → open-DCYIXHXS.js} +5 -5
  85. package/dist/bundle/{openai-DPURPXEU.js → openai-C4H4W57J.js} +14 -14
  86. package/dist/bundle/{process-YWPAOI6G.js → process-MN4NSYGA.js} +1 -1
  87. package/dist/bundle/{program-4ILOQHLO.js → program-ZZZOKWCX.js} +4026 -12667
  88. package/dist/bundle/{prompt-GKVNFGFE.js → prompt-ELEJUDAU.js} +5 -5
  89. package/dist/bundle/{recognize-344YDSLX.js → recognize-G2FVMI5M.js} +4 -4
  90. package/dist/bundle/{remote-53UZUJJU.js → remote-F4YVSEYM.js} +7 -7
  91. package/dist/bundle/{rerank-PAIRND6R.js → rerank-7VM5R5N6.js} +7 -7
  92. package/dist/bundle/{serve-DZSO7LJK.js → serve-A7NRFPRN.js} +9 -9
  93. package/dist/bundle/{server-EGG3V67I.js → server-7R2BEIRY.js} +39 -39
  94. package/dist/bundle/server-DFJA2HBO.js +64 -0
  95. package/dist/bundle/{sqlite-runtime-ZQ6F3VYZ.js → sqlite-runtime-4SKUB4EN.js} +6 -6
  96. package/dist/bundle/{state-LXPOWLZ5.js → state-S2FKK2XB.js} +6 -6
  97. package/dist/bundle/{store-PHT75I6S.js → store-4HAARQVR.js} +34 -26
  98. package/dist/bundle/{store-4ZMSK5R5.js → store-FLHO3UMA.js} +17 -15
  99. package/dist/bundle/store-maintenance-command-BINJIQ6F.js +54 -0
  100. package/dist/commands/account.d.ts.map +1 -1
  101. package/dist/commands/account.js +56 -64
  102. package/dist/commands/account.js.map +1 -1
  103. package/dist/commands/attachments.d.ts.map +1 -1
  104. package/dist/commands/attachments.js +15 -12
  105. package/dist/commands/attachments.js.map +1 -1
  106. package/dist/commands/context.d.ts +4 -0
  107. package/dist/commands/context.d.ts.map +1 -1
  108. package/dist/commands/context.js +12 -1
  109. package/dist/commands/context.js.map +1 -1
  110. package/dist/commands/doctor.d.ts.map +1 -0
  111. package/dist/{mail → commands}/doctor.js +1 -1
  112. package/dist/commands/doctor.js.map +1 -0
  113. package/dist/commands/drafts-send.d.ts.map +1 -1
  114. package/dist/commands/drafts-send.js +12 -10
  115. package/dist/commands/drafts-send.js.map +1 -1
  116. package/dist/commands/drafts.d.ts.map +1 -1
  117. package/dist/commands/drafts.js +28 -14
  118. package/dist/commands/drafts.js.map +1 -1
  119. package/dist/commands/export.d.ts.map +1 -1
  120. package/dist/commands/export.js +194 -195
  121. package/dist/commands/export.js.map +1 -1
  122. package/dist/commands/folders.d.ts.map +1 -1
  123. package/dist/commands/folders.js +19 -32
  124. package/dist/commands/folders.js.map +1 -1
  125. package/dist/commands/import.d.ts.map +1 -1
  126. package/dist/commands/import.js +10 -5
  127. package/dist/commands/import.js.map +1 -1
  128. package/dist/commands/messages.d.ts +0 -21
  129. package/dist/commands/messages.d.ts.map +1 -1
  130. package/dist/commands/messages.js +10 -278
  131. package/dist/commands/messages.js.map +1 -1
  132. package/dist/commands/organising.d.ts +98 -0
  133. package/dist/commands/organising.d.ts.map +1 -0
  134. package/dist/commands/organising.js +231 -0
  135. package/dist/commands/organising.js.map +1 -0
  136. package/dist/commands/restore.d.ts +3 -0
  137. package/dist/commands/restore.d.ts.map +1 -0
  138. package/dist/commands/restore.js +93 -0
  139. package/dist/commands/restore.js.map +1 -0
  140. package/dist/commands/rules.d.ts.map +1 -1
  141. package/dist/commands/rules.js +3 -2
  142. package/dist/commands/rules.js.map +1 -1
  143. package/dist/commands/send.d.ts +14 -3
  144. package/dist/commands/send.d.ts.map +1 -1
  145. package/dist/commands/send.js +18 -11
  146. package/dist/commands/send.js.map +1 -1
  147. package/dist/commands/session-start.d.ts.map +1 -1
  148. package/dist/commands/session-start.js +14 -4
  149. package/dist/commands/session-start.js.map +1 -1
  150. package/dist/commands/status.js +2 -2
  151. package/dist/commands/status.js.map +1 -1
  152. package/dist/commands/sync.d.ts.map +1 -1
  153. package/dist/commands/sync.js +136 -141
  154. package/dist/commands/sync.js.map +1 -1
  155. package/dist/commands/tags.d.ts.map +1 -1
  156. package/dist/commands/tags.js +11 -7
  157. package/dist/commands/tags.js.map +1 -1
  158. package/dist/commands/words.d.ts +8 -0
  159. package/dist/commands/words.d.ts.map +1 -0
  160. package/dist/commands/words.js +52 -0
  161. package/dist/commands/words.js.map +1 -0
  162. package/dist/discovery.d.ts.map +1 -1
  163. package/dist/discovery.js +2 -1
  164. package/dist/discovery.js.map +1 -1
  165. package/dist/export/journal.d.ts +8 -6
  166. package/dist/export/journal.d.ts.map +1 -1
  167. package/dist/export/journal.js +39 -14
  168. package/dist/export/journal.js.map +1 -1
  169. package/dist/mail/changes.d.ts +9 -2
  170. package/dist/mail/changes.d.ts.map +1 -1
  171. package/dist/mail/changes.js +45 -17
  172. package/dist/mail/changes.js.map +1 -1
  173. package/dist/mail/cleanup.d.ts.map +1 -1
  174. package/dist/mail/cleanup.js +5 -1
  175. package/dist/mail/cleanup.js.map +1 -1
  176. package/dist/mail/domain-age.d.ts.map +1 -1
  177. package/dist/mail/domain-age.js +24 -6
  178. package/dist/mail/domain-age.js.map +1 -1
  179. package/dist/mail/drafts.d.ts.map +1 -1
  180. package/dist/mail/drafts.js +9 -7
  181. package/dist/mail/drafts.js.map +1 -1
  182. package/dist/mail/imap/connection.d.ts.map +1 -1
  183. package/dist/mail/imap/connection.js +8 -9
  184. package/dist/mail/imap/connection.js.map +1 -1
  185. package/dist/mail/imap/errors.d.ts.map +1 -1
  186. package/dist/mail/imap/errors.js +2 -2
  187. package/dist/mail/imap/errors.js.map +1 -1
  188. package/dist/mail/imap/read.d.ts.map +1 -1
  189. package/dist/mail/imap/read.js +8 -5
  190. package/dist/mail/imap/read.js.map +1 -1
  191. package/dist/mail/imap/write.d.ts.map +1 -1
  192. package/dist/mail/imap/write.js +2 -1
  193. package/dist/mail/imap/write.js.map +1 -1
  194. package/dist/mail/locate.d.ts +32 -0
  195. package/dist/mail/locate.d.ts.map +1 -0
  196. package/dist/mail/locate.js +99 -0
  197. package/dist/mail/locate.js.map +1 -0
  198. package/dist/mail/mbox.d.ts.map +1 -1
  199. package/dist/mail/mbox.js +7 -5
  200. package/dist/mail/mbox.js.map +1 -1
  201. package/dist/mail/organise.d.ts +35 -50
  202. package/dist/mail/organise.d.ts.map +1 -1
  203. package/dist/mail/organise.js +44 -279
  204. package/dist/mail/organise.js.map +1 -1
  205. package/dist/mail/restore.d.ts +22 -0
  206. package/dist/mail/restore.d.ts.map +1 -0
  207. package/dist/mail/restore.js +193 -0
  208. package/dist/mail/restore.js.map +1 -0
  209. package/dist/mail/rules/apply.d.ts.map +1 -1
  210. package/dist/mail/rules/apply.js +5 -4
  211. package/dist/mail/rules/apply.js.map +1 -1
  212. package/dist/mail/rules/file.d.ts.map +1 -1
  213. package/dist/mail/rules/file.js +37 -8
  214. package/dist/mail/rules/file.js.map +1 -1
  215. package/dist/mail/rules/filters.d.ts.map +1 -1
  216. package/dist/mail/rules/filters.js +13 -7
  217. package/dist/mail/rules/filters.js.map +1 -1
  218. package/dist/mail/rules/query.d.ts.map +1 -1
  219. package/dist/mail/rules/query.js +7 -7
  220. package/dist/mail/rules/query.js.map +1 -1
  221. package/dist/mail/save.js +1 -1
  222. package/dist/mail/save.js.map +1 -1
  223. package/dist/mail/send.d.ts +4 -3
  224. package/dist/mail/send.d.ts.map +1 -1
  225. package/dist/mail/send.js +8 -8
  226. package/dist/mail/send.js.map +1 -1
  227. package/dist/mail/smtp.js +1 -1
  228. package/dist/mail/smtp.js.map +1 -1
  229. package/dist/oauth.d.ts +3 -2
  230. package/dist/oauth.d.ts.map +1 -1
  231. package/dist/oauth.js +16 -7
  232. package/dist/oauth.js.map +1 -1
  233. package/dist/profile.d.ts.map +1 -1
  234. package/dist/profile.js +3 -2
  235. package/dist/profile.js.map +1 -1
  236. package/dist/program.js +1 -1
  237. package/dist/program.js.map +1 -1
  238. package/dist/providers.js +3 -3
  239. package/dist/providers.js.map +1 -1
  240. package/dist/reasons.d.ts.map +1 -1
  241. package/dist/reasons.js +12 -0
  242. package/dist/reasons.js.map +1 -1
  243. package/dist/version.d.ts +1 -1
  244. package/dist/version.js +1 -1
  245. package/package.json +5 -4
  246. package/skills/mail-cli/SKILL.md +3 -3
  247. package/dist/bundle/chunk-GIKNAOER.js +0 -132
  248. package/dist/bundle/command-contract-GVNLRXWS.js +0 -34
  249. package/dist/bundle/first-screen-NNX54MYC.js +0 -32
  250. package/dist/bundle/server-SGGMRV2K.js +0 -64
  251. package/dist/bundle/store-maintenance-command-C6ONZNRX.js +0 -54
  252. package/dist/index.d.ts +0 -3
  253. package/dist/index.d.ts.map +0 -1
  254. package/dist/index.js +0 -3
  255. package/dist/index.js.map +0 -1
  256. package/dist/mail/doctor.d.ts.map +0 -1
  257. package/dist/mail/doctor.js.map +0 -1
  258. /package/dist/bundle/{chunk-LU3WKZBA.js → chunk-QZLK2ISN.js} +0 -0
  259. /package/dist/{mail → commands}/doctor.d.ts +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/executable.js
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/executable.js
8
8
  import { existsSync } from "node:fs";
9
9
  import { win32 } from "node:path";
10
10
  var variable = /* @__PURE__ */ __name((env, name) => Object.entries(env).find(([key]) => key.toUpperCase() === name)?.[1], "variable");
@@ -1,10 +1,5 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
- import {
4
- organization,
5
- project,
6
- reminder
7
- } from "./chunk-GIKNAOER.js";
8
3
  import {
9
4
  MIGRATIONS,
10
5
  SnapshotBudget,
@@ -28,31 +23,71 @@ import {
28
23
  tagMemberIds,
29
24
  thingOf,
30
25
  write
31
- } from "./chunk-X7EBOXBY.js";
26
+ } from "./chunk-OUGGAAXI.js";
32
27
  import {
33
28
  filesAccountSql,
34
29
  folderProviderOf,
35
30
  folderProviderSql,
36
31
  isDocumentAccountProvider
37
- } from "./chunk-EBEYU7RW.js";
38
- import {
39
- queryFieldsOf
40
- } from "./chunk-4IEDXIUN.js";
32
+ } from "./chunk-KVSC657S.js";
41
33
  import {
42
34
  fold
43
- } from "./chunk-CGH6UH3T.js";
35
+ } from "./chunk-3YRE6DNM.js";
44
36
  import {
45
37
  CliError
46
- } from "./chunk-EB2IULWB.js";
38
+ } from "./chunk-DALBYUPC.js";
47
39
  import {
48
40
  __name
49
41
  } from "./chunk-ZVVMGPBJ.js";
50
42
 
51
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
43
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/damage.js
44
+ var DERIVED = /* @__PURE__ */ new Set(["mentions", "involvements", "embeddings"]);
45
+ var named = /* @__PURE__ */ __name((tables) => tables.length <= 5 ? tables.join(", ") : `${tables.slice(0, 5).join(", ")} and ${tables.length - 5} more`, "named");
46
+ var isDerivedTable = /* @__PURE__ */ __name((table, searchIndexes) => DERIVED.has(table) || table.startsWith("vector_index_") || searchIndexes.some((index) => table === index || table.startsWith(`${index}_`)), "isDerivedTable");
47
+ var WIRECAT_UNITS = ["memo-*", "mail-*", "tg-*", "max-*", "wirecat-*"];
48
+ var explainDamage = /* @__PURE__ */ __name((health, command) => {
49
+ if (health.ok)
50
+ return null;
51
+ const indexNames = (health.searchIndexes ?? []).map((index) => index.name);
52
+ const badIndexes = (health.searchIndexes ?? []).filter((index) => !index.ok).map((index) => index.name);
53
+ const tables = (health.damagedTables ?? []).map((one) => one.table).filter((table) => table !== null);
54
+ const sources = tables.filter((table) => !isDerivedTable(table, indexNames));
55
+ const derived = [.../* @__PURE__ */ new Set([...tables.filter((table) => isDerivedTable(table, indexNames)), ...badIndexes])];
56
+ const unopened = health.error !== void 0;
57
+ const what = unopened ? `the store file cannot be opened: ${health.error}` : health.checked === "quick" ? "the store file's header or schema is damaged" : `the store file is damaged: ${health.problems ?? 0} problems` + (sources.length ? ` in the data of ${named(sources)}` : "") + (derived.length ? `${sources.length ? ", and" : " in"} the search data of ${named(derived)}` : "");
58
+ const impact = [
59
+ ...sources.length ? [`some rows of ${named(sources)} cannot be read; a recovery keeps every row it can read and names the rest`] : [],
60
+ ...derived.length ? [`searches may miss results or fail; ${named(derived)} hold nothing that is not elsewhere, and are rebuilt`] : [],
61
+ "reads that do not touch a damaged page work; a write that touches one fails until the store is recovered"
62
+ ];
63
+ return {
64
+ what,
65
+ causes: [
66
+ "the computer lost power or crashed, or the disk filled up, while a tool was writing",
67
+ "the file was copied, restored or synced while a tool had it open, or it sits in a synced or network folder",
68
+ "a fault of the disk itself"
69
+ ],
70
+ investigate: [
71
+ `journalctl --user ${WIRECAT_UNITS.map((unit) => `-u '${unit}'`).join(" ")} --since -14d | grep -i -e malformed -e corrupt -e 'disk full'`,
72
+ "journalctl -k --since -14d | grep -i -e 'I/O error' -e nvme -e ata",
73
+ `df -h ${health.path.replace(/\/[^/]*$/, "")}`,
74
+ ...health.checked === "quick" ? [`${command} store recover`] : []
75
+ ],
76
+ impact,
77
+ externalUnaffected: "only this computer's copy is damaged: Telegram, MAX, the mail servers and Google Drive keep their own data, so whatever is lost here can be fetched again by a sync",
78
+ steps: [
79
+ "stop every timer and server of the WireCat tools; `store recover run` lists the ones still running",
80
+ `${command} store recover run`,
81
+ "run the fetch commands it prints, then start the timers again"
82
+ ]
83
+ };
84
+ }, "explainDamage");
85
+
86
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
52
87
  import { realpathSync, statSync } from "node:fs";
53
88
  import { resolve } from "node:path";
54
89
 
55
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/people.js
90
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/people.js
56
91
  var planPeople = /* @__PURE__ */ __name((database, snapshot, mappings, bindings, conflicts) => {
57
92
  const creatable = /* @__PURE__ */ new Set();
58
93
  let people = 0, identities = 0;
@@ -115,11 +150,11 @@ var copyPeople = /* @__PURE__ */ __name((database, snapshot, mappings, now) => {
115
150
  }
116
151
  }, "copyPeople");
117
152
 
118
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/document-transfer/digest.js
153
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/document-transfer/digest.js
119
154
  import { createHash } from "node:crypto";
120
155
  var digest = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "digest");
121
156
 
122
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/collection.js
157
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/collection.js
123
158
  var documentsKeyOf = /* @__PURE__ */ __name((collection) => {
124
159
  const colon = collection.indexOf(":");
125
160
  const provider = collection.slice(0, colon);
@@ -163,7 +198,7 @@ var currentCollection = /* @__PURE__ */ __name((row) => {
163
198
  };
164
199
  }, "currentCollection");
165
200
 
166
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/plan.js
201
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/plan.js
167
202
  var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindings) => {
168
203
  const mappings = /* @__PURE__ */ new Map();
169
204
  const missing = /* @__PURE__ */ new Set(), conflicts = /* @__PURE__ */ new Set();
@@ -272,9 +307,9 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
272
307
  }
273
308
  for (const alias of snapshot.aliases) {
274
309
  const sourceTag = snapshot.taggings.find((tagging) => tagging.tag_id === alias.aliasable_id);
275
- const named = canonicalTagNamed(database, String(alias.name));
310
+ const named2 = canonicalTagNamed(database, String(alias.name));
276
311
  const targetTag = sourceTag && canonicalTagNamed(database, String(sourceTag.tag_name));
277
- if (named && named.id !== targetTag?.id)
312
+ if (named2 && named2.id !== targetTag?.id)
278
313
  conflicts.add(`destination alias conflicts with source tag ${String(alias.aliasable_id)}`);
279
314
  if (targetTag && alias.display === 1) {
280
315
  const displayed = database.prepare("SELECT name_folded FROM aliases WHERE aliasable_type='tag' AND aliasable_id=? AND account_id IS NULL AND display=1").get(targetTag.id);
@@ -330,7 +365,7 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
330
365
  };
331
366
  }, "planTransfer");
332
367
 
333
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
368
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
334
369
  var TRANSFER_TABLES = { document: "documents", note: "notes", memory: "memories", fact: "facts" };
335
370
  var MAX_ENTITIES = 1e3;
336
371
  var MAX_AUXILIARY = 1e4;
@@ -492,7 +527,7 @@ var transferSnapshot = /* @__PURE__ */ __name((database, collection) => read(dat
492
527
  };
493
528
  }), "transferSnapshot");
494
529
 
495
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/apply.js
530
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/apply.js
496
531
  var providerHere = /* @__PURE__ */ __name(({ provider, name, settings }) => {
497
532
  if (provider !== "folder" || String(name ?? "").startsWith("google-drive:"))
498
533
  return provider ?? null;
@@ -664,7 +699,7 @@ var remapEntity = /* @__PURE__ */ __name((database, entity, id, mappings) => {
664
699
  database.prepare(`UPDATE ${TRANSFER_TABLES[entity.kind]} SET ${columns.join(",")} WHERE id=?`).run(...values, id);
665
700
  }, "remapEntity");
666
701
 
667
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
702
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
668
703
  var locations = /* @__PURE__ */ __name((options) => {
669
704
  for (const value of [options.source, options.destination, options.collection])
670
705
  if (typeof value !== "string" || !value.trim())
@@ -760,42 +795,128 @@ var applyDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
760
795
  }
761
796
  }, "applyDocumentTransfer");
762
797
 
763
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
764
- var ORGANIZATIONS_QUERY = {
765
- entity: "organization",
766
- backend: "sql",
767
- fields: queryFieldsOf(organization, {
768
- native: ["id", "kind", "scope", "created_at"],
769
- examples: { id: "id:1", kind: "kind:company", scope: "scope:work", created_at: "created_at>=2026-01-01" }
770
- })
771
- };
772
- var PROJECTS_QUERY = {
773
- entity: "project",
774
- backend: "sql",
775
- fields: queryFieldsOf(project, {
776
- native: ["id", "key", "name", "kind", "type", "organization_id", "scope", "created_at"],
777
- examples: {
778
- id: "id:1",
779
- key: "key:SMP",
780
- name: "name:*tart*",
781
- kind: "kind:inbox",
782
- type: "type:work",
783
- organization_id: "organization_id:1",
784
- scope: "scope:work",
785
- created_at: "created_at>=2026-01-01"
798
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/health.js
799
+ import { existsSync, statSync as statSync2 } from "node:fs";
800
+ var QUICK_CHECK_LIMIT = 1e4;
801
+ var QUICK_HEALTH_CHECKS = "the file header, its size against its page count, and the schema's own pages";
802
+ var FTS5 = /^\s*CREATE\s+VIRTUAL\s+TABLE\s+\S+\s+USING\s+fts5\s*\(/i;
803
+ var fts5Tables = /* @__PURE__ */ __name((database) => database.prepare("SELECT name, sql FROM sqlite_master WHERE type = 'table' AND sql LIKE 'CREATE VIRTUAL TABLE%' ORDER BY name").all().filter((row) => FTS5.test(String(row.sql))).map((row) => {
804
+ const sql = String(row.sql);
805
+ return { name: String(row.name), sql, external: /content\s*=\s*'[^']+'/i.test(sql) };
806
+ }), "fts5Tables");
807
+ var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
808
+ var bytesOf = /* @__PURE__ */ __name((path) => statSync2(path, { throwIfNoEntry: false })?.size ?? 0, "bytesOf");
809
+ var damagedTables = /* @__PURE__ */ __name((database, lines) => {
810
+ const roots = new Map(database.prepare("SELECT rootpage, tbl_name FROM sqlite_master WHERE rootpage > 0").all().map((row) => [Number(row.rootpage), String(row.tbl_name)]));
811
+ const owners = new Map(database.prepare("SELECT name, tbl_name FROM sqlite_master WHERE type = 'index'").all().map((row) => [String(row.name), String(row.tbl_name)]));
812
+ const virtual = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND sql LIKE 'CREATE VIRTUAL TABLE%'").all().map((row) => String(row.name));
813
+ const ownerOf = /* @__PURE__ */ __name((table) => table === null ? null : virtual.find((name) => table.startsWith(`${name}_`)) ?? table, "ownerOf");
814
+ const tables = /* @__PURE__ */ new Map();
815
+ for (const raw of lines) {
816
+ const line = raw.replace(/^\*\*\* in database \w+ \*\*\*\s*/, "");
817
+ const tree = /^Tree (\d+) /.exec(line);
818
+ const column = /value in (\w+)\.\w+/.exec(line) ?? /^table (\w+): /.exec(line);
819
+ const index = /index (\w+)/.exec(line)?.[1];
820
+ const table = ownerOf(tree ? roots.get(Number(tree[1])) ?? null : column ? column[1] ?? null : index ? owners.get(index) ?? null : null);
821
+ const known = tables.get(table);
822
+ if (known)
823
+ known.problems += 1;
824
+ else
825
+ tables.set(table, { table, problems: 1, sample: line.slice(0, 200) });
826
+ }
827
+ return [...tables.values()].sort((a, b) => b.problems - a.problems);
828
+ }, "damagedTables");
829
+ var searchIndexHealth = /* @__PURE__ */ __name((database) => fts5Tables(database).map(({ name }) => {
830
+ try {
831
+ database.exec("BEGIN");
832
+ try {
833
+ database.exec(`INSERT INTO "${name}" ("${name}", rank) VALUES ('integrity-check', 0)`);
834
+ } finally {
835
+ database.exec("ROLLBACK");
786
836
  }
787
- })
788
- };
789
- var REMINDERS_QUERY = {
790
- entity: "reminder",
791
- backend: "sql",
792
- fields: queryFieldsOf(reminder, {
793
- native: ["id", "state", "due_at", "revision"],
794
- examples: { id: "id:1", state: "state:pending", due_at: "due_at>=2026-01-01", revision: "revision>1" }
795
- })
796
- };
837
+ return { name, ok: true };
838
+ } catch (error) {
839
+ return { name, ok: false, error: messageOf(error) };
840
+ }
841
+ }), "searchIndexHealth");
842
+ var pragmaLines = /* @__PURE__ */ __name((database, sql) => database.prepare(sql).all().flatMap((row) => String(Object.values(row)[0]).split("\n")), "pragmaLines");
843
+ var checkLines = /* @__PURE__ */ __name((database) => {
844
+ try {
845
+ return pragmaLines(database, `PRAGMA quick_check(${QUICK_CHECK_LIMIT})`);
846
+ } catch {
847
+ const tables = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND rootpage > 0 ORDER BY name").all().map((row) => String(row.name));
848
+ return tables.flatMap((table) => {
849
+ try {
850
+ return pragmaLines(database, `PRAGMA quick_check("${table}")`).filter((line) => line !== "ok");
851
+ } catch (error) {
852
+ return [`table ${table}: ${messageOf(error)}`];
853
+ }
854
+ });
855
+ }
856
+ }, "checkLines");
857
+ var quickHealth = /* @__PURE__ */ __name((database, path) => {
858
+ const pragma = /* @__PURE__ */ __name((name) => Number(Object.values(database.prepare(`PRAGMA ${name}`).get() ?? {})[0] ?? 0), "pragma");
859
+ const file = {
860
+ bytes: bytesOf(path),
861
+ pages: pragma("page_count"),
862
+ pageSize: pragma("page_size"),
863
+ freePages: pragma("freelist_count")
864
+ };
865
+ const schema = database.prepare("PRAGMA quick_check('sqlite_schema')").all().map((row) => String(Object.values(row)[0]));
866
+ const walFrames = existsSync(`${path}-wal`) && bytesOf(`${path}-wal`) > 0;
867
+ const sized = walFrames || file.bytes === file.pages * file.pageSize;
868
+ const problems = [
869
+ ...schema.length === 1 && schema[0] === "ok" ? [] : schema,
870
+ ...sized ? [] : [`the file holds ${file.bytes} bytes, its header says ${file.pages * file.pageSize}`]
871
+ ];
872
+ return { file, problems };
873
+ }, "quickHealth");
874
+ var storeHealth = /* @__PURE__ */ __name(async (path, { deep = false } = {}) => {
875
+ const started = Date.now();
876
+ const checked = deep ? "deep" : "quick";
877
+ const done = /* @__PURE__ */ __name((health) => ({
878
+ path,
879
+ checked,
880
+ ...health,
881
+ ms: Date.now() - started
882
+ }), "done");
883
+ let database;
884
+ try {
885
+ database = (await openSqlite(path, { readOnly: !deep })).database;
886
+ } catch (error) {
887
+ return done({ ok: false, error: messageOf(error) });
888
+ }
889
+ try {
890
+ const { file, problems } = quickHealth(database, path);
891
+ if (!deep) {
892
+ return done({
893
+ ok: problems.length === 0,
894
+ file,
895
+ ...problems.length ? {
896
+ problems: problems.length,
897
+ damagedTables: [{ table: null, problems: problems.length, sample: problems[0] }]
898
+ } : {}
899
+ });
900
+ }
901
+ database.exec("PRAGMA busy_timeout = 30000");
902
+ const lines = checkLines(database);
903
+ const pagesOk = lines.length === 1 && lines[0] === "ok";
904
+ const indexes = searchIndexHealth(database);
905
+ return done({
906
+ ok: pagesOk && problems.length === 0 && indexes.every((index) => index.ok),
907
+ file,
908
+ problems: pagesOk ? 0 : lines.length,
909
+ damagedTables: pagesOk ? [] : damagedTables(database, lines),
910
+ searchIndexes: indexes
911
+ });
912
+ } catch (error) {
913
+ return done({ ok: false, error: messageOf(error) });
914
+ } finally {
915
+ database.close();
916
+ }
917
+ }, "storeHealth");
797
918
 
798
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/project-transfer/preview.js
919
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/project-transfer/preview.js
799
920
  var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) => {
800
921
  if (!options || typeof options !== "object" || Array.isArray(options))
801
922
  throw new CliError("validation_error", "project preview options are required");
@@ -817,7 +938,7 @@ var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) =>
817
938
  }
818
939
  }, "previewProjectAnnotationSnapshot");
819
940
 
820
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot.js
941
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot.js
821
942
  var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
822
943
  if (!options || typeof options !== "object" || Array.isArray(options))
823
944
  throw new CliError("validation_error", "snapshot options are required");
@@ -839,11 +960,12 @@ var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
839
960
  }, "snapshotProjectAnnotations");
840
961
 
841
962
  export {
963
+ explainDamage,
842
964
  previewDocumentTransfer,
843
965
  applyDocumentTransfer,
844
- ORGANIZATIONS_QUERY,
845
- PROJECTS_QUERY,
846
- REMINDERS_QUERY,
966
+ QUICK_HEALTH_CHECKS,
967
+ fts5Tables,
968
+ storeHealth,
847
969
  previewProjectAnnotationSnapshot,
848
970
  snapshotProjectAnnotations
849
971
  };
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-EB2IULWB.js";
5
+ } from "./chunk-DALBYUPC.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/search/languages.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/search/languages.js
11
11
  var LANGUAGES = [
12
12
  { name: "russian", code: "ru", label: "Russian", script: "cyrillic", dictionary: "dictionary-ru" },
13
13
  { name: "english", code: "en", label: "English", script: "latin", dictionary: "dictionary-en" },
@@ -15,12 +15,12 @@ var LANGUAGES = [
15
15
  ];
16
16
  var languagesOf = /* @__PURE__ */ __name((script) => LANGUAGES.filter((one) => one.script === script).map(({ name }) => name), "languagesOf");
17
17
 
18
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/normalize.js
18
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/normalize.js
19
19
  var NORMALIZER_VERSION = 1;
20
20
  var fold = /* @__PURE__ */ __name((text) => text.normalize("NFKD").replace(new RegExp("\\p{M}+", "gu"), "").normalize("NFC").toLowerCase(), "fold");
21
21
  var normalize = /* @__PURE__ */ __name((text) => fold(text).replace(new RegExp("\\p{Cc}", "gu"), " ").replace(/\s+/gu, " ").trim(), "normalize");
22
22
 
23
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/search/snowball/base-stemmer.js
23
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/search/snowball/base-stemmer.js
24
24
  var BaseStemmer = class {
25
25
  static {
26
26
  __name(this, "BaseStemmer");
@@ -395,7 +395,7 @@ var BaseStemmer = class {
395
395
  }
396
396
  };
397
397
 
398
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/search/snowball/english-stemmer.js
398
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/search/snowball/english-stemmer.js
399
399
  var a_0 = [
400
400
  ["arsen", -1],
401
401
  ["commun", -1],
@@ -1096,7 +1096,7 @@ var english_stemmer_default = class extends BaseStemmer {
1096
1096
  stemWord = this.stem;
1097
1097
  };
1098
1098
 
1099
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/search/snowball/russian-stemmer.js
1099
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/search/snowball/russian-stemmer.js
1100
1100
  var a_02 = [
1101
1101
  ["\u0432", 1],
1102
1102
  ["\u0438\u0432", 2, 1],
@@ -1519,7 +1519,7 @@ var russian_stemmer_default = class extends BaseStemmer {
1519
1519
  stemWord = this.stem;
1520
1520
  };
1521
1521
 
1522
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/search/snowball/spanish-stemmer.js
1522
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/search/snowball/spanish-stemmer.js
1523
1523
  var a_03 = [
1524
1524
  ["", 6],
1525
1525
  ["\xE1", 1, 1],
@@ -2195,7 +2195,7 @@ var spanish_stemmer_default = class extends BaseStemmer {
2195
2195
  stemWord = this.stem;
2196
2196
  };
2197
2197
 
2198
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/search/stem.js
2198
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/search/stem.js
2199
2199
  var SNOWBALL_VERSION = "3.1.1";
2200
2200
  var CYRILLIC_STEMMERS = [...languagesOf("cyrillic"), "none"];
2201
2201
  var LATIN_STEMMERS = [...languagesOf("latin"), "none"];
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/shared-55XJMTPA.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/shared-55XJMTPA.js
8
8
  var entityKind = /* @__PURE__ */ Symbol.for("drizzle:entityKind");
9
9
  var kindsByConstructor = /* @__PURE__ */ new WeakMap();
10
10
  function collectKinds(ctor) {
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/store/driver.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/store/driver.js
8
8
  var TIME_LIMIT_FUNCTION = "wc_time_limit";
9
9
  var TimeLimitReached = class extends Error {
10
10
  static {
@@ -25,10 +25,12 @@ var PRAGMAS = `
25
25
  PRAGMA journal_mode = WAL;
26
26
  PRAGMA foreign_keys = ON;
27
27
  `;
28
+ var isQueryOnly = /* @__PURE__ */ __name((database) => Number(Object.values(database.prepare("PRAGMA query_only").get() ?? {})[0]) === 1, "isQueryOnly");
28
29
 
29
30
  export {
30
31
  TIME_LIMIT_FUNCTION,
31
32
  TimeLimitReached,
32
33
  beforeTimeLimit,
33
- PRAGMAS
34
+ PRAGMAS,
35
+ isQueryOnly
34
36
  };
@@ -2,15 +2,15 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  QUERY_REASONS
5
- } from "./chunk-4IEDXIUN.js";
5
+ } from "./chunk-2NWOYXPJ.js";
6
6
  import {
7
7
  defineReasons
8
- } from "./chunk-G6RG2AZV.js";
8
+ } from "./chunk-BHNBWFT5.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/errors/reasons.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/errors/reasons.js
14
14
  var validation = /* @__PURE__ */ __name((reason, message) => [reason, "validation_error", message], "validation");
15
15
  var QUERY = [
16
16
  ["query.aborted", "the search was stopped before it finished"],
@@ -71,6 +71,10 @@ var OTHERS = [
71
71
  validation("mail-findings.partial", "a cited email is not stored whole yet; cite it once it is"),
72
72
  validation("evidence-findings.dedicated-review", "review evidence findings through the dedicated findings command"),
73
73
  validation("mail-findings.dedicated-review", "review mail findings through the dedicated findings command"),
74
+ validation("mail-findings.invalid", "a checked mail findings batch would be refused; details.problems names why, finding by finding"),
75
+ validation("mail-findings.key-used", "the findings batch key was already used for different input"),
76
+ validation("finding.unknown-field", "a finding has a field its kind does not take"),
77
+ validation("finding.missing-field", "a finding leaves out a field its kind needs"),
74
78
  validation("document.changed", "the document changed while it was read; nothing was saved"),
75
79
  ["document.not-imported", "not_found", "the document is not imported in this source account"],
76
80
  ["extraction.invalid-proposals", "invalid_response", "the model's memory proposals could not be used"],
@@ -78,6 +82,8 @@ var OTHERS = [
78
82
  validation("file.locked", "another process holds the file's lock"),
79
83
  validation("mail.cursor-ahead", "an acknowledge cursor is past the newest stored email"),
80
84
  ["mail.holder-not-yours", "permission_error", "a run moves only the mark of the holder its schedule names"],
85
+ ["mail.no-mark", "not_found", "the holder has no mark in the mailbox yet; its first review starts it"],
86
+ ["mail.reset-owner-only", "permission_error", "only the owner moves a holder's mark back"],
81
87
  ["mail.source-failed", "provider_error", "the mail server refused or did not complete a request"],
82
88
  ["mail.search-refused", "provider_error", "the mail server refused to search a folder"],
83
89
  [
@@ -159,6 +165,14 @@ var OTHERS = [
159
165
  ],
160
166
  validation("store.refused", "the local store refused the document text"),
161
167
  ["store.not-writable", "permission_error", "the message store cannot be written from this process"],
168
+ validation("store.in-use", "a process or a scheduled timer has the store open; stop it, then recover the store"),
169
+ [
170
+ "store.sqlite3-missing",
171
+ "configuration_error",
172
+ "recovering the store needs the sqlite3 program, 3.43 or newer, with its .recover command"
173
+ ],
174
+ validation("store.recovery-failed", "the recovered store did not pass its check, so the store was left as it was"),
175
+ validation("store.changed-during-recovery", "the store was written to during the recovery, so it was left as it was"),
162
176
  [
163
177
  "store.vector-extension-missing",
164
178
  "configuration_error",
@@ -173,12 +187,16 @@ var OTHERS = [
173
187
  validation("input.required", "the command needs an answer and cannot ask for one"),
174
188
  validation("input.too-large", "the input is over its size limit"),
175
189
  ["meeting-project.stale", "configuration_error", "the meeting's project changed meanwhile"],
190
+ validation("fact.not-accepted", "only an accepted fact can be revoked"),
191
+ validation("fact.owner-written", "the owner wrote this fact; it was never proposed, so it cannot be revoked"),
176
192
  validation("fact.payment-retired", "a payment is a payments row in store.finance, not a fact"),
193
+ validation("fact.revoke-correction", "an accepted correction cannot be revoked; its superseded fact stays"),
177
194
  validation("finance.allocate", "the invoice or payment cannot take an allocation in its state"),
178
195
  validation("finance.currency", "the payment and the invoice are in different currencies; nothing is converted"),
179
196
  validation("finance.field", "a field of the invoice or payment is not valid"),
180
197
  validation("finance.line-amount", "the line's amount is not its quantity times its unit price"),
181
198
  validation("finance.lines", "the invoice's lines are not valid"),
199
+ ["finance.not-allocated", "not_found", "the payment is not allocated to that invoice"],
182
200
  validation("finance.over-invoice", "the allocation would settle more than the invoice's total"),
183
201
  validation("finance.over-payment", "the allocation would use more than the payment's amount"),
184
202
  ["finance.owner-only", "permission_error", "only the owner does this with money"],
@@ -186,10 +204,12 @@ var OTHERS = [
186
204
  validation("finance.ref", "the reference names no invoice or payment"),
187
205
  validation("finance.status", "the invoice's status does not allow this"),
188
206
  validation("finance.total", "the invoice's total is not the sum of its lines"),
207
+ validation("finance.unallocate", "a rejected or deleted payment's allocations are not taken back"),
189
208
  validation("record.entity", "the invoice or payment the record stands for was refused"),
190
209
  ["record.map-owner-only", "permission_error", "only the owner says which entity a source record is"],
191
210
  validation("record.map-type", "a record maps only to an entity of its own type"),
192
211
  validation("record.mapped", "the record already stands for another entity"),
212
+ validation("record.over-payment", "the record's settles amounts add up to more than the payment"),
193
213
  validation("record.not-found", "the store holds no such record to delete"),
194
214
  validation("record.invalid", "a field of the record is not the kind the entity needs"),
195
215
  validation("record.reference-not-found", "a reference in the record's fields is not in the store"),
@@ -200,6 +220,31 @@ var OTHERS = [
200
220
  validation("money.amount", "the amount is not a decimal string in the currency's scale"),
201
221
  validation("money.currency", "the currency is not one the store keeps money in"),
202
222
  validation("money.quantity", "the quantity is not a decimal above 0"),
223
+ validation("deal.closed", "a deleted deal or lead does not move or close"),
224
+ validation("deal.copy", "a CRM's copy changes in the CRM; its next sync brings the change here"),
225
+ validation("deal.field", "a field of the deal or lead is not valid"),
226
+ validation("deal.ref", "the reference names no deal or lead"),
227
+ validation("deal.stage", "no stage of that name, or a stage name more than one pipeline has"),
228
+ validation("pipeline.ambiguous", "more than one pipeline has that name; name it by its pipeline: reference"),
229
+ validation("pipeline.duplicate", "a pipeline of that name and kind is already stored"),
230
+ validation("pipeline.field", "a pipeline needs a name and at least one stage, each named once"),
231
+ ["pipeline.not-found", "not_found", "no stored pipeline has that name or reference"],
232
+ validation("crm.stage-unknown", "a CRM item stands in a stage the store does not hold; it was not kept"),
233
+ validation("crm.item-invalid", "a CRM item has a field the store refuses, such as a currency it does not keep"),
234
+ validation("crm.pipeline-required", "the CRM has more than one pipeline of the kind; the write names one"),
235
+ validation("field.unknown", "no custom field of the kind has that code or label; `fields list` lists them"),
236
+ validation("field.ambiguous", "more than one custom field has that label; name one by its code"),
237
+ validation("field.unknown-option", "the list field has no option with that id or label"),
238
+ validation("field.unknown-kind", "fields are listed for deals, leads, people and organizations only"),
239
+ validation("crm.write-unsupported", "the CRM does not take this write, or does not recognise a repeated one"),
240
+ validation("crm.unlisted-held", "a list of every id would mark most of a kind deleted; nothing was, until --rescan"),
241
+ validation("order.duplicate", "the shop's order with this number is already stored; change its status instead"),
242
+ validation("order.proposed", "the shop's order with this number already waits for the owner in a findings batch"),
243
+ validation("order.field", "a field of the order is not valid"),
244
+ validation("order.source-url", "an order's source URL is not an http or https address"),
245
+ ["order.not-found", "not_found", "no stored order of that shop has that number"],
246
+ validation("order.ref", "the reference names no order, or a shop's number names more than one"),
247
+ validation("order.status", "a rejected or deleted order's status does not change"),
203
248
  ["model.not-downloaded", "not_found", "the model is not downloaded on this machine"],
204
249
  ["person.no-owner", "not_found", "no person is marked as the owner in the store"],
205
250
  ["transcription.no-key", "authentication_error", "no OpenAI key is set for transcription"],
@@ -244,6 +289,8 @@ var OTHERS = [
244
289
  validation("tag.invalid", "the tag is not valid"),
245
290
  ["reactions.list-hidden", "permission_error", "the chat does not let its members see who reacted"],
246
291
  ["reactions.broadcast", "permission_error", "a channel does not show who reacted to its posts"],
292
+ validation("task.external-id", "an external id is <service>:<id>, such as avito:4512345678"),
293
+ validation("task.source-url", "a task's source URL is not an http or https address"),
247
294
  validation("task.category-unknown", "the category is not in the task category list"),
248
295
  validation("task.claimed", "someone else holds the task"),
249
296
  validation("task.closed", "the task is already closed"),
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/http/listen.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_b9e89c8ee4e42a523b0faff8db1d3e1d/node_modules/@wirecat/cli-core/dist/http/listen.js
8
8
  import { createServer } from "node:http";
9
9
  import { Readable } from "node:stream";
10
10
  var MAX_BODY = 4 * 1024 * 1024;
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  singleLine
5
- } from "./chunk-EB2IULWB.js";
5
+ } from "./chunk-DALBYUPC.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/names.js
10
+ // node_modules/.pnpm/@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/names.js
11
11
  var FIRST_PARTY_TOOLS = [
12
12
  { name: "tg", package: "@wirecat/tg-cli" },
13
13
  { name: "max", package: "@wirecat/max-cli" },
@@ -30,7 +30,7 @@ var PROGRAM_PREFIX = "wcat-";
30
30
  var DESCRIBE_FLAG = "--wcat-describe";
31
31
  var DISPATCH_FLAG = "--wcat-dispatch";
32
32
 
33
- // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/describe.js
33
+ // node_modules/.pnpm/@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/describe.js
34
34
  var DESCRIBE_FORMAT = 1;
35
35
  var describeAnswer = /* @__PURE__ */ __name((tool) => ({
36
36
  wcat_describe: DESCRIBE_FORMAT,
@@ -59,7 +59,7 @@ var parseDescribe = /* @__PURE__ */ __name((text) => {
59
59
  };
60
60
  }, "parseDescribe");
61
61
 
62
- // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/shim.js
62
+ // node_modules/.pnpm/@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/shim.js
63
63
  import { lstatSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
64
64
  import { join } from "node:path";
65
65
  var SHIM_FORMAT = 1;