@wirecat/mail-cli 0.23.1 → 0.24.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 (114) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/bin/mail.js +2 -2
  3. package/dist/bundle/{all-profiles-FJHJCGRU.js → all-profiles-VS7P6DJY.js} +11 -11
  4. package/dist/bundle/{anthropic-AFL7NKVZ.js → anthropic-C5JXKGBS.js} +16 -7
  5. package/dist/bundle/{app-server-WKCBJMHI.js → app-server-HU3LVU42.js} +51 -50
  6. package/dist/bundle/{bun-HQATAQJQ.js → bun-QLFX47WZ.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-4ECAV7OU.js → bun-sqlite-W4PGAKVY.js} +5 -5
  8. package/dist/bundle/{chunk-3UFD76IR.js → chunk-3FD3IATT.js} +6 -6
  9. package/dist/bundle/{chunk-R554W7ZO.js → chunk-3KSK5BBB.js} +2 -2
  10. package/dist/bundle/{chunk-AGNAT7CM.js → chunk-4QNHAM3J.js} +2 -2
  11. package/dist/bundle/{chunk-7SWWVDEZ.js → chunk-4W4EVVL4.js} +61 -21
  12. package/dist/bundle/{chunk-NMGF3UOZ.js → chunk-5NLHDK7P.js} +50 -46
  13. package/dist/bundle/{chunk-VFKX5UMJ.js → chunk-5X3GU5LI.js} +6 -6
  14. package/dist/bundle/{chunk-NKBAZ4VC.js → chunk-64ZG5ERD.js} +2 -2
  15. package/dist/bundle/{chunk-WN4HP7IZ.js → chunk-6PWCQKMD.js} +12 -12
  16. package/dist/bundle/{chunk-V3TDQUXD.js → chunk-6VV7J2TN.js} +36 -57
  17. package/dist/bundle/{chunk-SNTLN2QT.js → chunk-A6J4MPTI.js} +3 -1
  18. package/dist/bundle/{chunk-CUOCDJFI.js → chunk-AUTX2MLF.js} +11 -9
  19. package/dist/bundle/{chunk-5UKBUI4I.js → chunk-B72343TK.js} +2 -2
  20. package/dist/bundle/{chunk-4IWJARFA.js → chunk-BFQQV22T.js} +1 -1
  21. package/dist/bundle/chunk-C3NYJW6B.js +1542 -0
  22. package/dist/bundle/{chunk-OJCUSHZG.js → chunk-C5BMCLCQ.js} +4 -4
  23. package/dist/bundle/{chunk-OU5CWCG2.js → chunk-DW3F6DUW.js} +1 -1
  24. package/dist/bundle/chunk-EKGRNFYQ.js +18 -0
  25. package/dist/bundle/{chunk-B6QMMRIM.js → chunk-FKWUUCX2.js} +1340 -1542
  26. package/dist/bundle/{chunk-LLYVBO3R.js → chunk-FNLUKODV.js} +19 -19
  27. package/dist/bundle/{chunk-KKGX7JMX.js → chunk-H5FJTHVA.js} +2 -2
  28. package/dist/bundle/{chunk-3QVGB2CI.js → chunk-HBZAJINU.js} +4 -4
  29. package/dist/bundle/{chunk-V7CFZ773.js → chunk-IRUN4XOV.js} +2 -2
  30. package/dist/bundle/{chunk-VAMCRP47.js → chunk-JMLIKXFO.js} +2 -2
  31. package/dist/bundle/{chunk-QR7JZM3D.js → chunk-JOQGJUFT.js} +1 -1
  32. package/dist/bundle/{chunk-CBWA2T3N.js → chunk-JWMLMAHP.js} +4 -4
  33. package/dist/bundle/{chunk-S5OTP7XS.js → chunk-KGOVFEWZ.js} +3 -3
  34. package/dist/bundle/{chunk-PMIKRELC.js → chunk-KV4VTKF3.js} +3 -3
  35. package/dist/bundle/chunk-LVGX7VTD.js +138 -0
  36. package/dist/bundle/{chunk-3DQYO7FB.js → chunk-MCPOZNWG.js} +1 -1
  37. package/dist/bundle/{chunk-E7ZVKQHG.js → chunk-MTO6YVMN.js} +3 -3
  38. package/dist/bundle/{chunk-CCYHBNRL.js → chunk-NCRSE647.js} +286 -48
  39. package/dist/bundle/{chunk-GJNFNC76.js → chunk-NSIN5IM4.js} +8 -8
  40. package/dist/bundle/{chunk-ZXIPJF3Y.js → chunk-NWKKPDZV.js} +2 -2
  41. package/dist/bundle/chunk-O373QEAJ.js +1243 -0
  42. package/dist/bundle/{chunk-VYIIX6VN.js → chunk-OQW6GHUA.js} +1 -1
  43. package/dist/bundle/{chunk-2HXHAFRP.js → chunk-PRQ2U7HF.js} +2 -2
  44. package/dist/bundle/{chunk-MBKNL5TX.js → chunk-PT6MF2VU.js} +87 -77
  45. package/dist/bundle/{chunk-SBGXKM4U.js → chunk-Q4OKEN3B.js} +7 -7
  46. package/dist/bundle/{chunk-ROKTS7WM.js → chunk-Q6K2XUGU.js} +1 -1
  47. package/dist/bundle/{chunk-VYHIX3OP.js → chunk-QI3PXUOJ.js} +43 -595
  48. package/dist/bundle/{chunk-UMXVQIGD.js → chunk-QVMOEB3I.js} +377 -12
  49. package/dist/bundle/{chunk-HOKGIYUO.js → chunk-RLQZFZLK.js} +62 -7
  50. package/dist/bundle/{chunk-3OZKDC6Y.js → chunk-RN7OI5KL.js} +8 -8
  51. package/dist/bundle/{chunk-BVJQBAGL.js → chunk-RNZKQMFY.js} +14 -14
  52. package/dist/bundle/{chunk-4YJJQNNJ.js → chunk-RUASZW3M.js} +5 -5
  53. package/dist/bundle/{chunk-UHC5I3JV.js → chunk-RX5CJ55S.js} +1 -1
  54. package/dist/bundle/{chunk-SR3ADLGX.js → chunk-SWKQ6IAR.js} +3 -3
  55. package/dist/bundle/{chunk-QUKD5SO2.js → chunk-TI7ZIPA2.js} +4 -4
  56. package/dist/bundle/{chunk-LQDMUMA2.js → chunk-TLEBSMC7.js} +1997 -768
  57. package/dist/bundle/{chunk-MUDHCYN4.js → chunk-U6MMQNNK.js} +6 -6
  58. package/dist/bundle/{chunk-CYQVWITQ.js → chunk-VNKWSCN7.js} +99 -42
  59. package/dist/bundle/{chunk-DALBYUPC.js → chunk-VUBZFMGP.js} +2 -2
  60. package/dist/bundle/{chunk-34743C4C.js → chunk-VVL4MKYH.js} +1 -1
  61. package/dist/bundle/{chunk-7YRKUEYE.js → chunk-WOX7FZJP.js} +667 -222
  62. package/dist/bundle/{chunk-R5MYOLQP.js → chunk-X47BL4M5.js} +13 -13
  63. package/dist/bundle/{chunk-GOMJNH56.js → chunk-X7J3TTDO.js} +8 -8
  64. package/dist/bundle/{chunk-NOA6E6MM.js → chunk-XBEO472U.js} +29202 -16302
  65. package/dist/bundle/{chunk-4IFX4HV2.js → chunk-YA45XV6G.js} +4 -4
  66. package/dist/bundle/{chunk-M7RGG3UU.js → chunk-YBQ5AYLZ.js} +3 -3
  67. package/dist/bundle/{chunk-QV3M2MHG.js → chunk-YI544LHI.js} +13 -136
  68. package/dist/bundle/chunk-ZO4MQWIK.js +188 -0
  69. package/dist/bundle/{chunk-76RTQYJQ.js → chunk-ZR2BDNGG.js} +1 -1
  70. package/dist/bundle/command-contract-ERYYPAD2.js +35 -0
  71. package/dist/bundle/command-server-entry-5E3PPDE5.js +164 -0
  72. package/dist/bundle/{decode-QXKTMOTH.js → decode-AVWV7SVZ.js} +5 -5
  73. package/dist/bundle/{dispatch-G4CYFWQ2.js → dispatch-BXPHSNK5.js} +10 -10
  74. package/dist/bundle/{dist-5FX36DAW.js → dist-PIOOKBWT.js} +70 -44
  75. package/dist/bundle/{echarts-HHUM43TU.js → echarts-7K6YQV52.js} +2 -2
  76. package/dist/bundle/{embed-SRZSDZVI.js → embed-4NT76GJK.js} +6 -6
  77. package/dist/bundle/{embedder-WZIZCWLX.js → embedder-ITQFF7EN.js} +9 -9
  78. package/dist/bundle/{failure-FFPK2WYB.js → failure-3Q65JOPD.js} +2 -2
  79. package/dist/bundle/{first-run-6DVWZ3JQ.js → first-run-PM74YU4X.js} +11 -11
  80. package/dist/bundle/first-screen-WBVGVSMY.js +33 -0
  81. package/dist/bundle/{instructions-UWONE6UT.js → instructions-JDSITYHV.js} +1 -1
  82. package/dist/bundle/mail.js +37 -13
  83. package/dist/bundle/{mcp-CFVG2OUS.js → mcp-7KQUJNFN.js} +2 -2
  84. package/dist/bundle/{node-HLAOYJDB.js → node-D6YIJOJI.js} +2 -2
  85. package/dist/bundle/{node-sqlite-RO66I7W6.js → node-sqlite-PJOHHB4X.js} +6 -6
  86. package/dist/bundle/{oauth-VNLB2TET.js → oauth-BOWJ3IBT.js} +7 -7
  87. package/dist/bundle/{open-QQSG343L.js → open-FIAKKZMW.js} +5 -5
  88. package/dist/bundle/{openai-JTFC7OGF.js → openai-QL54VVLC.js} +16 -37
  89. package/dist/bundle/{process-3CZAXR6P.js → process-AYHK7WRC.js} +1 -1
  90. package/dist/bundle/{program-XTOS4RAM.js → program-6FKWOTBK.js} +2267 -1351
  91. package/dist/bundle/{prompt-HGQ6GPYL.js → prompt-XJZCBELC.js} +5 -5
  92. package/dist/bundle/{recognize-2SHMNEIZ.js → recognize-OQKWAHBY.js} +4 -4
  93. package/dist/bundle/{remote-GBQC3433.js → remote-NLVUZ5WK.js} +7 -7
  94. package/dist/bundle/{rerank-FQHQXFNR.js → rerank-NRPZDTJ7.js} +7 -7
  95. package/dist/bundle/{serve-THU67QUZ.js → serve-O4YUI7F6.js} +9 -9
  96. package/dist/bundle/server-6OT5ZEWL.js +66 -0
  97. package/dist/bundle/{server-LOT3CLYX.js → server-WAL3M4OO.js} +40 -40
  98. package/dist/bundle/{sqlite-runtime-NOOUMBC4.js → sqlite-runtime-5YHGI4D4.js} +6 -6
  99. package/dist/bundle/{state-KSKZCV2U.js → state-WYYOJ7KK.js} +6 -6
  100. package/dist/bundle/{store-BAKSHTKF.js → store-6BJO3F2J.js} +16 -16
  101. package/dist/bundle/{store-OHNZOQ7U.js → store-X72GOJHD.js} +44 -20
  102. package/dist/bundle/store-maintenance-command-ASS7RBYC.js +54 -0
  103. package/dist/config.d.ts +4 -0
  104. package/dist/config.d.ts.map +1 -1
  105. package/dist/version.d.ts +1 -1
  106. package/dist/version.js +1 -1
  107. package/package.json +3 -3
  108. package/dist/bundle/chunk-EXPR6QAX.js +0 -394
  109. package/dist/bundle/chunk-FWFNUJQD.js +0 -12172
  110. package/dist/bundle/command-contract-IIHBNF7J.js +0 -35
  111. package/dist/bundle/first-screen-SRZ7NYHZ.js +0 -33
  112. package/dist/bundle/server-VKMUX7ZT.js +0 -65
  113. package/dist/bundle/store-maintenance-command-ROQHJVEA.js +0 -54
  114. /package/dist/bundle/{chunk-QZLK2ISN.js → chunk-YVNHQFLC.js} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/mcp/instructions.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/mcp/instructions.js
8
8
  var instructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => {
9
9
  const all = typeof profile !== "string";
10
10
  const offers = /* @__PURE__ */ __name((key) => all || writes.includes(key), "offers");
@@ -8,12 +8,12 @@ import {
8
8
  ACCESS_SECONDS,
9
9
  REFRESH_SECONDS,
10
10
  readStored
11
- } from "./chunk-4IFX4HV2.js";
11
+ } from "./chunk-YA45XV6G.js";
12
12
  import {
13
13
  __name
14
14
  } from "./chunk-ZVVMGPBJ.js";
15
15
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/mcp/http/oauth.js
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/mcp/http/oauth.js
17
17
  import { createHash, randomBytes, randomInt, timingSafeEqual } from "node:crypto";
18
18
  import { chmodSync, mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
19
19
  import { dirname } from "node:path";
@@ -2,11 +2,11 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  renderMessages
5
- } from "./chunk-AGNAT7CM.js";
5
+ } from "./chunk-4QNHAM3J.js";
6
6
  import {
7
7
  answerOf,
8
8
  messengerContext
9
- } from "./chunk-VYHIX3OP.js";
9
+ } from "./chunk-QI3PXUOJ.js";
10
10
  import {
11
11
  FETCHING,
12
12
  RULES_VERSION,
@@ -30,17 +30,17 @@ import {
30
30
  typedQuery,
31
31
  withQuery,
32
32
  withTimeLimit
33
- } from "./chunk-LQDMUMA2.js";
33
+ } from "./chunk-TLEBSMC7.js";
34
34
  import {
35
35
  holdLock,
36
36
  lockPath,
37
37
  releaseLock,
38
38
  servingProfiles,
39
39
  takeLock
40
- } from "./chunk-M7RGG3UU.js";
40
+ } from "./chunk-YBQ5AYLZ.js";
41
41
  import {
42
42
  readSecret
43
- } from "./chunk-S5OTP7XS.js";
43
+ } from "./chunk-KGOVFEWZ.js";
44
44
  import {
45
45
  Command,
46
46
  LOCAL_READ,
@@ -49,7 +49,6 @@ import {
49
49
  REMOTE_WRITE,
50
50
  annotate,
51
51
  codeOf,
52
- currentRun,
53
52
  destroysNothing,
54
53
  environmentOf,
55
54
  itemOf,
@@ -66,20 +65,21 @@ import {
66
65
  snakeKeys,
67
66
  storeTable,
68
67
  withoutProviderRefs
69
- } from "./chunk-B6QMMRIM.js";
68
+ } from "./chunk-FKWUUCX2.js";
70
69
  import {
71
70
  levelFor
72
- } from "./chunk-SBGXKM4U.js";
71
+ } from "./chunk-Q4OKEN3B.js";
73
72
  import {
74
73
  holdersOf
75
- } from "./chunk-OU5CWCG2.js";
74
+ } from "./chunk-DW3F6DUW.js";
76
75
  import {
77
76
  QUICK_HEALTH_CHECKS,
78
- explainDamage,
79
77
  fts5Tables,
80
78
  invalidJson,
79
+ lossUnknown,
80
+ storeDamageReport,
81
81
  storeHealth
82
- } from "./chunk-CYQVWITQ.js";
82
+ } from "./chunk-VNKWSCN7.js";
83
83
  import {
84
84
  CORPORA,
85
85
  MIGRATIONS,
@@ -114,33 +114,33 @@ import {
114
114
  storeClients,
115
115
  storeContents,
116
116
  vectorIndexCounts
117
- } from "./chunk-NOA6E6MM.js";
118
- import {
119
- formatLocator,
120
- parseLocator
121
- } from "./chunk-FWFNUJQD.js";
117
+ } from "./chunk-XBEO472U.js";
122
118
  import {
119
+ currentRun,
123
120
  readDamageMark,
124
121
  readHealthMark,
122
+ readJournalMark,
125
123
  recordDeepCheck
126
- } from "./chunk-EXPR6QAX.js";
124
+ } from "./chunk-O373QEAJ.js";
127
125
  import {
126
+ formatLocator,
127
+ parseLocator,
128
128
  queryFieldsOf
129
- } from "./chunk-7YRKUEYE.js";
129
+ } from "./chunk-WOX7FZJP.js";
130
130
  import {
131
131
  failureKey,
132
132
  isStoreDamage
133
- } from "./chunk-R554W7ZO.js";
133
+ } from "./chunk-3KSK5BBB.js";
134
134
  import {
135
135
  storePath
136
- } from "./chunk-5UKBUI4I.js";
136
+ } from "./chunk-B72343TK.js";
137
137
  import {
138
138
  openCache
139
- } from "./chunk-MUDHCYN4.js";
139
+ } from "./chunk-U6MMQNNK.js";
140
140
  import {
141
141
  resolvePaths,
142
142
  writeSecurely
143
- } from "./chunk-LLYVBO3R.js";
143
+ } from "./chunk-FNLUKODV.js";
144
144
  import {
145
145
  array,
146
146
  boolean,
@@ -161,10 +161,10 @@ import {
161
161
  string,
162
162
  transform,
163
163
  trim
164
- } from "./chunk-GOMJNH56.js";
164
+ } from "./chunk-X7J3TTDO.js";
165
165
  import {
166
166
  CliError
167
- } from "./chunk-DALBYUPC.js";
167
+ } from "./chunk-VUBZFMGP.js";
168
168
  import {
169
169
  __commonJS,
170
170
  __name,
@@ -5504,11 +5504,11 @@ var require_liquid_node = __commonJS({
5504
5504
  }
5505
5505
  });
5506
5506
 
5507
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5507
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5508
5508
  import { chmodSync, constants, copyFileSync, existsSync as existsSync10, mkdirSync, realpathSync as realpathSync3, renameSync as renameSync3, rmSync as rmSync3, statfsSync as statfsSync2, statSync as statSync4, writeFileSync as writeFileSync2 } from "node:fs";
5509
5509
  import { dirname as dirname3, resolve } from "node:path";
5510
5510
 
5511
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/sealed.js
5511
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/sealed.js
5512
5512
  import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
5513
5513
  import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
5514
5514
  import { Transform } from "node:stream";
@@ -5615,7 +5615,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
5615
5615
  renameSync(pending, to);
5616
5616
  }, "unsealFile");
5617
5617
 
5618
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5618
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5619
5619
  var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
5620
5620
  var fileSchemaOf = /* @__PURE__ */ __name((database) => {
5621
5621
  const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
@@ -5639,7 +5639,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
5639
5639
  };
5640
5640
  }, "compatibilityOf");
5641
5641
 
5642
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/repair.js
5642
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/store/repair.js
5643
5643
  import { createHash as createHash2 } from "node:crypto";
5644
5644
  var COPY_MARK = "__repair_";
5645
5645
  var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
@@ -5893,19 +5893,19 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
5893
5893
  return found;
5894
5894
  }, "deleteCopy");
5895
5895
 
5896
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5896
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5897
5897
  import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
5898
5898
 
5899
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5899
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5900
5900
  import { existsSync as existsSync3 } from "node:fs";
5901
5901
 
5902
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/recover.js
5902
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/store/recover.js
5903
5903
  import { execFileSync, spawn } from "node:child_process";
5904
5904
  import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
5905
5905
  import { basename, dirname, join } from "node:path";
5906
5906
  import { Transform as Transform2 } from "node:stream";
5907
5907
 
5908
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/refill.js
5908
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/store/refill.js
5909
5909
  var REFILL_MARGIN_MS = 864e5;
5910
5910
  var TIME_KEYS = 1e12;
5911
5911
  var integerId = `external_id GLOB '[0-9]*' AND NOT external_id GLOB '*[^0-9]*'`;
@@ -5985,7 +5985,7 @@ var forgetMail = /* @__PURE__ */ __name((database, cutoff, now) => {
5985
5985
  return [...folders].map(([account, count3]) => ({ account, folders: count3 }));
5986
5986
  }, "forgetMail");
5987
5987
 
5988
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/recover.js
5988
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/store/recover.js
5989
5989
  var SQLITE3_MINIMUM = [3, 43, 0];
5990
5990
  var STORE_PARTS = ["", "-wal", "-shm"];
5991
5991
  var RECOVER_LOCK = ".recover-lock";
@@ -6513,7 +6513,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6513
6513
  }
6514
6514
  }, "recoverLocked");
6515
6515
 
6516
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6516
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6517
6517
  var COUNTED = [
6518
6518
  "accounts",
6519
6519
  "chats",
@@ -6546,18 +6546,23 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) =>
6546
6546
  }
6547
6547
  } catch {
6548
6548
  }
6549
+ const journal = readJournalMark(path);
6549
6550
  recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema });
6550
6551
  const mark = readDamageMark(path);
6551
- const explanation = explainDamage(health, command, mark);
6552
+ const lastKnownGood = readHealthMark(path)?.last_ok_at ?? null;
6552
6553
  const inUse = storeHolders(path) ?? null;
6553
6554
  const timers = activeTimers() ?? null;
6554
6555
  const sqlite3 = sqlite3Program();
6555
- const next = health.ok ? [] : [
6556
- ...timers?.length ? [stopTimers(timers)] : [],
6557
- ...(inUse ?? []).map(({ pid, name }) => `stop ${name} (process ${pid}): it has the store open`),
6558
- ...sqlite3.usable ? [] : ["install sqlite3 3.43 or newer (apt install sqlite3, brew install sqlite)"],
6559
- `${command} store recover run`
6560
- ];
6556
+ const report = storeDamageReport({
6557
+ health,
6558
+ command,
6559
+ mark,
6560
+ journal,
6561
+ lastOkAt: lastKnownGood,
6562
+ holders: inUse,
6563
+ timers,
6564
+ sqlite3Usable: sqlite3.usable
6565
+ });
6561
6566
  return {
6562
6567
  path,
6563
6568
  exists: true,
@@ -6568,13 +6573,13 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) =>
6568
6573
  damagedSearchIndexes: (health.searchIndexes ?? []).filter((index) => !index.ok).map(({ name, error }) => ({ name, ...error ? { error } : {} })),
6569
6574
  invalidJson: health.invalidJson ?? [],
6570
6575
  rows,
6571
- explanation,
6576
+ report,
6572
6577
  damageMark: mark ? (({ inode: _, ...seen }) => seen)(mark) : null,
6573
- lastKnownGood: readHealthMark(path)?.last_ok_at ?? null,
6578
+ lastKnownGood,
6574
6579
  inUse,
6575
6580
  timers,
6576
6581
  sqlite3: { version: sqlite3.version, usable: sqlite3.usable },
6577
- next
6582
+ next: report?.steps.map((step) => step.command) ?? []
6578
6583
  };
6579
6584
  }, "storeRecoveryCheck");
6580
6585
  var storeRecoveryRun = /* @__PURE__ */ __name(async (env, { command, version, note, timers: scheduled = activeTimers, copy }) => {
@@ -6615,13 +6620,12 @@ var refetchNotes = /* @__PURE__ */ __name(({ since, chats, mail }) => {
6615
6620
  var recoveryNotes = /* @__PURE__ */ __name((answer) => {
6616
6621
  if ("keptAt" in answer) {
6617
6622
  const lost = answer.lost.map(({ table, before, read, kept, goneAtLeast, seenIn }) => `${table}: ${kept} kept of ${before ?? "an uncountable number"}${read > kept ? `, ${read - kept} read but unusable` : ""}` + (goneAtLeast > 0 ? `; at least ${goneAtLeast} rows are gone (the index ${seenIn} lists them)` : ""));
6618
- const since = answer.lastKnownGood ? `since the last deep check that passed (${answer.lastKnownGood})` : "since the store was made (no deep check that passed is on record)";
6619
6623
  return [
6620
6624
  `recovered in ${answer.seconds.total} s; the damaged file is kept at ${answer.keptAt}`,
6621
6625
  ...lost,
6622
6626
  ...Object.entries(answer.placed).map(([table, rows]) => `${table}: ${rows} rows found on pages no table claimed were put back`),
6623
6627
  ...refetchNotes(answer.refetch),
6624
- `${lost.some((line) => line.includes("are gone")) ? "more rows may be gone" : "how many rows were lost is unknown"}: damage can take rows written ${since} without leaving a trace; a sync fetches again what the servers still hold`,
6628
+ lossUnknown(answer.lastKnownGood, lost.some((line) => line.includes("are gone"))),
6625
6629
  ...answer.dangling.map(({ table, parent, rows }) => `${rows} rows of ${table} point at ${parent} rows the store does not hold`),
6626
6630
  ...answer.invalidJson.map(({ table, column, rows, required }) => `${table}.${column}: ${rows} values were not valid JSON \u2014 ${required ? "those rows were dropped" : "set to empty"}`),
6627
6631
  ...answer.next.map((line) => `next: ${line}`)
@@ -6629,13 +6633,16 @@ var recoveryNotes = /* @__PURE__ */ __name((answer) => {
6629
6633
  }
6630
6634
  if (!answer.exists)
6631
6635
  return ["no store yet"];
6632
- if (answer.ok)
6636
+ const report = answer.report;
6637
+ if (!report)
6633
6638
  return [`the store is healthy (checked every page and search index in ${answer.seconds} s)`];
6634
- const why = answer.explanation;
6635
6639
  return [
6636
- ...why ? [why.what, ...why.impact, why.externalUnaffected] : [],
6637
- answer.lastKnownGood ? `the store last passed a deep check at ${answer.lastKnownGood}` : "no deep check that passed is on record for this store",
6638
- ...answer.next.map((line) => `next: ${line}`)
6640
+ report.whatHappened,
6641
+ ...report.impact,
6642
+ report.externalDataSafe,
6643
+ report.loss,
6644
+ ...report.likelyCauses.map(({ cause, check: check2 }) => `maybe: ${cause} \u2014 check: ${check2}`),
6645
+ ...report.steps.map(({ command, why, destructive }) => `next: ${command} # ${destructive ? "changes things: " : ""}${why}`)
6639
6646
  ];
6640
6647
  }, "recoveryNotes");
6641
6648
  var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
@@ -6662,7 +6669,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
6662
6669
  return recover;
6663
6670
  }, "storeRecoverCommand");
6664
6671
 
6665
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6672
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6666
6673
  var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
6667
6674
  var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
6668
6675
  var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
@@ -6708,7 +6715,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
6708
6715
  renderAnswer(this, outputFor(this), itemOf(answer));
6709
6716
  }), "storeInfoCommand");
6710
6717
 
6711
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6718
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6712
6719
  var ENCRYPT_OPTION = [
6713
6720
  "--encrypt",
6714
6721
  "compress and encrypt with a password, typed at a hidden prompt or piped on stdin; it is never kept \u2014 lose it and the file cannot be opened"
@@ -6727,7 +6734,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
6727
6734
  return password;
6728
6735
  }, "passwordOf");
6729
6736
 
6730
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/rules.js
6737
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/replies/rules.js
6731
6738
  import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
6732
6739
  import { join as join2 } from "node:path";
6733
6740
  var REPLY_ACTIONS = ["reply", "task"];
@@ -6898,7 +6905,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
6898
6905
  }, "problem");
6899
6906
  var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
6900
6907
 
6901
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/state.js
6908
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/replies/state.js
6902
6909
  import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
6903
6910
  import { join as join3 } from "node:path";
6904
6911
  var ANSWERED_KEPT = 1e3;
@@ -6951,7 +6958,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
6951
6958
  }, "recordReply");
6952
6959
  var broken2 = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply state ${path} cannot be read (${why}) \u2014 fix or move the file`), "broken");
6953
6960
 
6954
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/decide.js
6961
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/replies/decide.js
6955
6962
  var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
6956
6963
  var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
6957
6964
  const { message, chat, owner, sender } = incoming;
@@ -7057,10 +7064,10 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
7057
7064
  return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
7058
7065
  }, "filled");
7059
7066
 
7060
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/template.js
7067
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/replies/template.js
7061
7068
  var import_liquidjs2 = __toESM(require_liquid_node(), 1);
7062
7069
 
7063
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/render/liquid.js
7070
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/render/liquid.js
7064
7071
  var import_liquidjs = __toESM(require_liquid_node(), 1);
7065
7072
  var safeLiquid = /* @__PURE__ */ __name((limits) => {
7066
7073
  const engine = new import_liquidjs.Liquid({
@@ -7087,7 +7094,7 @@ var safeLiquid = /* @__PURE__ */ __name((limits) => {
7087
7094
  return engine;
7088
7095
  }, "safeLiquid");
7089
7096
 
7090
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/template.js
7097
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/replies/template.js
7091
7098
  var TEMPLATE_LIMITS = {
7092
7099
  parse: 32768,
7093
7100
  renders: 2e3,
@@ -7226,7 +7233,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
7226
7233
  }
7227
7234
  }, "renderReplyTemplate");
7228
7235
 
7229
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
7236
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
7230
7237
  var DRY_RUN_DAYS = 7;
7231
7238
  var PAGE = 500;
7232
7239
  var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
@@ -7340,7 +7347,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
7340
7347
  }
7341
7348
  }, "storedSince");
7342
7349
 
7343
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/consents.js
7350
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/replies/consents.js
7344
7351
  import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
7345
7352
  import { join as join4 } from "node:path";
7346
7353
  var shape = strictObject({
@@ -7365,7 +7372,7 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
7365
7372
  return consent.provider === provider && !consent.deniedChats.includes(chat);
7366
7373
  }, "mayModelReply");
7367
7374
 
7368
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7375
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7369
7376
  var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options = {
7370
7377
  ai: true
7371
7378
  }) => async (rule2, message, chat, now) => {
@@ -7412,7 +7419,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
7412
7419
  return result2;
7413
7420
  }, "replyRenderer");
7414
7421
 
7415
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/serve.js
7422
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/replies/serve.js
7416
7423
  var NOT_ALLOWED = "replies.send is not allow";
7417
7424
  var NO_RULES = "no rules";
7418
7425
  var ONLY_TASK = "opened a task, sent nothing";
@@ -7505,7 +7512,7 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
7505
7512
  return { skip: why };
7506
7513
  }, "replyTo");
7507
7514
 
7508
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7515
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7509
7516
  var START_SYNC_DELAY_MS = 3e4;
7510
7517
  var START_SYNC_BUDGET_MS = 5 * 6e4;
7511
7518
  var START_SYNC_WINDOW_MS = 7 * 864e5;
@@ -7582,7 +7589,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch, note, warn,
7582
7589
  };
7583
7590
  }, "startSync");
7584
7591
 
7585
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7592
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7586
7593
  var FIRST_FETCH_MS = 6e4;
7587
7594
  var DAY_MS = 864e5;
7588
7595
  var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
@@ -7636,7 +7643,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs =
7636
7643
  };
7637
7644
  }, "memberFetches");
7638
7645
 
7639
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7646
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7640
7647
  var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
7641
7648
  var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
7642
7649
  if (context.format === "pretty") {
@@ -7669,7 +7676,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
7669
7676
  return context;
7670
7677
  }, "recordDiagnostics");
7671
7678
 
7672
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-outdated.js
7679
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-outdated.js
7673
7680
  import { existsSync as existsSync8, readFileSync as readFileSync5, realpathSync as realpathSync2 } from "node:fs";
7674
7681
  import { dirname as dirname2, join as join5 } from "node:path";
7675
7682
  var OUTDATED_CHECK_MS = 6e4;
@@ -7755,7 +7762,7 @@ var watchOutdated = /* @__PURE__ */ __name(({ check: check2, onOutdated, everyMs
7755
7762
  };
7756
7763
  }, "watchOutdated");
7757
7764
 
7758
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7765
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7759
7766
  var STEMS_EVERY_MS = 3e4;
7760
7767
  var STEMS_SLICE_MS = 2e3;
7761
7768
  var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
@@ -7795,7 +7802,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
7795
7802
  };
7796
7803
  }, "stemFills");
7797
7804
 
7798
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7805
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7799
7806
  var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
7800
7807
  var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7801
7808
  kind: attachment.kind,
@@ -7814,7 +7821,7 @@ var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7814
7821
  phone: attachment.contact.phone,
7815
7822
  user_id: attachment.contact.userId
7816
7823
  }),
7817
- buttons: attachment.buttons
7824
+ buttons: attachment.buttons?.map((row) => row.map(({ data: _data, ...button }) => button))
7818
7825
  }), "attachmentItem");
7819
7826
  var quotedItem = /* @__PURE__ */ __name((quoted) => quoted === null ? null : {
7820
7827
  id: quoted.id,
@@ -7890,7 +7897,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
7890
7897
  locale: messenger.app.locale
7891
7898
  }), "viewOf");
7892
7899
 
7893
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7900
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7894
7901
  var observed = /* @__PURE__ */ __name((value) => ({
7895
7902
  value: value.value,
7896
7903
  observed_at: value.observedAt,
@@ -7957,7 +7964,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
7957
7964
  }
7958
7965
  }, "watchEventItem");
7959
7966
 
7960
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7967
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7961
7968
  var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
7962
7969
  output: { entity: "watch_item" },
7963
7970
  effects: REMOTE_READ,
@@ -8112,7 +8119,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
8112
8119
  }
8113
8120
  }, "describe");
8114
8121
 
8115
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8122
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8116
8123
  var serveCommand = /* @__PURE__ */ __name((messenger) => {
8117
8124
  const command = annotate(new Command("serve"), {
8118
8125
  output: { entity: "serve_summary" },
@@ -8395,7 +8402,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
8395
8402
  };
8396
8403
  }, "tasking");
8397
8404
 
8398
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8405
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8399
8406
  import { existsSync as existsSync9 } from "node:fs";
8400
8407
  var PATH = "store tables list";
8401
8408
  var STORE_TABLES_QUERY = {
@@ -8438,7 +8445,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
8438
8445
  return tables;
8439
8446
  }, "storeTablesCommand");
8440
8447
 
8441
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8448
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8442
8449
  var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
8443
8450
  var WORD_INDEX = "message_words";
8444
8451
  var schemaOf = /* @__PURE__ */ __name((database) => {
@@ -8477,6 +8484,7 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, v
8477
8484
  if (!existsSync10(path))
8478
8485
  return { path, exists: false };
8479
8486
  const checked = await storeHealth(path, { deep });
8487
+ const journal = readJournalMark(path);
8480
8488
  const recorded = deep ? recordDeepCheck(path, checked, {
8481
8489
  cli: command ?? "unknown",
8482
8490
  ...version ? { version } : {},
@@ -8494,13 +8502,15 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, v
8494
8502
  ...checked.invalidJson?.length ? { invalidJson: checked.invalidJson } : {},
8495
8503
  ...checked.searchIndexes?.some((index) => !index.ok) ? { damagedSearchIndexes: checked.searchIndexes.filter((index) => !index.ok).map((index) => index.name) } : {}
8496
8504
  };
8497
- const damage = command ? explainDamage(checked, command, mark) : null;
8505
+ const damage = command ? storeDamageReport({ health: checked, command, mark, journal, lastOkAt: lastKnownGood }) : null;
8498
8506
  const healthOf = {
8499
8507
  health,
8500
8508
  lastKnownGood,
8501
8509
  ...mark ? { damageMark: withoutInode(mark) } : {},
8510
+ ...journal ? { journalMark: journal } : {},
8502
8511
  ...recorded?.cleared ? { damageMarkCleared: withoutInode(recorded.cleared) } : {},
8503
- ...damage ? { damage } : {}
8512
+ // `what` keeps memo's doctor, which reads it, compiling until it moves to `whatHappened`.
8513
+ ...damage ? { damage: { what: damage.whatHappened, ...damage } } : {}
8504
8514
  };
8505
8515
  try {
8506
8516
  return await reading(path, (database) => {
@@ -5,19 +5,19 @@ import {
5
5
  fieldsOf,
6
6
  processStreams,
7
7
  projectFields
8
- } from "./chunk-LLYVBO3R.js";
8
+ } from "./chunk-FNLUKODV.js";
9
9
  import {
10
10
  COMPACT_FLAG
11
- } from "./chunk-GOMJNH56.js";
11
+ } from "./chunk-X7J3TTDO.js";
12
12
  import {
13
13
  CliError,
14
14
  singleLine
15
- } from "./chunk-DALBYUPC.js";
15
+ } from "./chunk-VUBZFMGP.js";
16
16
  import {
17
17
  __name
18
18
  } from "./chunk-ZVVMGPBJ.js";
19
19
 
20
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/sends/permissions.js
20
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/sends/permissions.js
21
21
  var LEVELS = ["deny", "readonly", "ask", "allow"];
22
22
  var DANGEROUS = /* @__PURE__ */ new Set(["messages.delete", "bot.messages.delete", "topics.delete", "chats.delete", "chats.clear"]);
23
23
  var skipFlagFor = /* @__PURE__ */ __name((key) => DANGEROUS.has(key) ? "--allow-dangerous" : "--yes", "skipFlagFor");
@@ -417,7 +417,7 @@ var assertRetentionEvidenceRead = /* @__PURE__ */ __name((permissions) => {
417
417
  }
418
418
  }, "assertRetentionEvidenceRead");
419
419
 
420
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/result-fields.js
420
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/cli/result-fields.js
421
421
  var named = /* @__PURE__ */ __name((work) => {
422
422
  try {
423
423
  return work();
@@ -444,7 +444,7 @@ var projectFields2 = /* @__PURE__ */ __name((value, fields) => named(() => {
444
444
  return projectFields(value, fields);
445
445
  }), "projectFields");
446
446
 
447
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/output-detail.js
447
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/output-detail.js
448
448
  var RARELY_SET = ["editedAt", "replyTo", "forwardedFrom", "reactions"];
449
449
  var BRIEF = ["locator", "chatTitle", "timestamp", "senderName", "excerpt", "score"];
450
450
  var SNAKE_BRIEF = ["ref", "chat_title", "timestamp", "sender_name", "excerpt", "score"];
@@ -480,7 +480,7 @@ var atDetail = /* @__PURE__ */ __name((value, detail = "default") => {
480
480
  return value;
481
481
  }, "atDetail");
482
482
 
483
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/output.js
483
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/output.js
484
484
  var refuseCompact = /* @__PURE__ */ __name(({ json, jsonl, fields, hitDetail }) => {
485
485
  const other = jsonl ? "--jsonl" : fields !== void 0 ? "--json=\u2026" : json ? "--json" : hitDetail === "brief" ? "--brief" : "";
486
486
  if (other)
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/runs/secrets.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/runs/secrets.js
8
8
  var SECRET_WORDS = /* @__PURE__ */ new Set([
9
9
  "authorization",
10
10
  "cookie",