@wirecat/tg-cli 0.119.0 → 0.120.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 (107) hide show
  1. package/contracts/wirecat.json +2 -0
  2. package/dist/bin/tg.js +2 -2
  3. package/dist/bundle/{adapter-NEQQOANM.js → adapter-OJKHXGBC.js} +49 -49
  4. package/dist/bundle/{all-profiles-QFT46FTF.js → all-profiles-URIWNL23.js} +10 -10
  5. package/dist/bundle/{anthropic-UJ4RYCWU.js → anthropic-YUKNB63B.js} +5 -5
  6. package/dist/bundle/{app-server-NE3EL5IK.js → app-server-H5QNHGH4.js} +43 -43
  7. package/dist/bundle/{bot-api-D4H5SCP5.js → bot-api-27GN4Y3D.js} +49 -49
  8. package/dist/bundle/{bot-history-KF2PUMWA.js → bot-history-VVSWLVZM.js} +18 -18
  9. package/dist/bundle/{bun-F7MH5YKA.js → bun-PAAJX3GU.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-FYDJXUHF.js → bun-sqlite-TPEBWFZH.js} +5 -5
  11. package/dist/bundle/{chunk-XM3P7LLT.js → chunk-34DSPJNN.js} +2 -2
  12. package/dist/bundle/{chunk-QD27C3BG.js → chunk-3FPFRDG2.js} +10 -8
  13. package/dist/bundle/{chunk-OG2CG2GS.js → chunk-3GLLWDM6.js} +12 -12
  14. package/dist/bundle/{chunk-FQ3C6DFV.js → chunk-3SANNNWS.js} +3 -3
  15. package/dist/bundle/{chunk-G3MQOH6Z.js → chunk-4JATS2J5.js} +3 -3
  16. package/dist/bundle/{chunk-6OE5I3PR.js → chunk-4OWY7QBE.js} +6 -6
  17. package/dist/bundle/{chunk-QG5U6HCI.js → chunk-4W4EVVL4.js} +4 -4
  18. package/dist/bundle/{chunk-JKKEMVW3.js → chunk-6XHZV7AQ.js} +4 -4
  19. package/dist/bundle/{chunk-IAGX5VFL.js → chunk-7DPWVKYS.js} +4 -4
  20. package/dist/bundle/{chunk-5EHJWIW4.js → chunk-7I6YVQHW.js} +2 -2
  21. package/dist/bundle/{chunk-TKHEVAEG.js → chunk-7N4IUEX3.js} +8 -8
  22. package/dist/bundle/{chunk-HV5YYAJX.js → chunk-7VNV426X.js} +51 -18
  23. package/dist/bundle/{chunk-YMWPRHXG.js → chunk-7WS3ULOO.js} +1185 -426
  24. package/dist/bundle/{chunk-FJKP6MMP.js → chunk-B7B65ZLU.js} +2 -2
  25. package/dist/bundle/{chunk-3EQ7USKJ.js → chunk-CGUDXNJE.js} +2 -2
  26. package/dist/bundle/{chunk-4AACB23H.js → chunk-CLTMVPGT.js} +13 -13
  27. package/dist/bundle/{chunk-FQZSS3AB.js → chunk-CLURRDNU.js} +6 -6
  28. package/dist/bundle/{chunk-RGU2G3KL.js → chunk-CYWV2RLN.js} +4 -4
  29. package/dist/bundle/{chunk-F223KYWG.js → chunk-D2WNQJUQ.js} +1 -1
  30. package/dist/bundle/{chunk-6ERQJRL2.js → chunk-DDKFAUQD.js} +2 -2
  31. package/dist/bundle/{chunk-Z4CGZAFQ.js → chunk-DE7QIEUP.js} +34 -34
  32. package/dist/bundle/{chunk-7VUNJDYU.js → chunk-DH7VKHTZ.js} +4 -4
  33. package/dist/bundle/{chunk-L33G5ARH.js → chunk-DQTQO6PB.js} +1005 -768
  34. package/dist/bundle/{chunk-TEZKCH5B.js → chunk-FATTEYZH.js} +2 -2
  35. package/dist/bundle/{chunk-23JGV5FQ.js → chunk-FPWXG53C.js} +11 -11
  36. package/dist/bundle/{chunk-MDLSI3EN.js → chunk-H5XC2WYO.js} +35 -589
  37. package/dist/bundle/{chunk-UBCLVM7C.js → chunk-HDSKBXAF.js} +3 -3
  38. package/dist/bundle/{chunk-X5PDWCG7.js → chunk-HIBYYKGO.js} +1 -1
  39. package/dist/bundle/{chunk-HPQQ76WF.js → chunk-JJY3TQTM.js} +3 -3
  40. package/dist/bundle/{chunk-D6YTBJY6.js → chunk-JQLGS3SG.js} +1 -1
  41. package/dist/bundle/{chunk-2BAJ6ORN.js → chunk-JSEIT2WO.js} +1 -1
  42. package/dist/bundle/{chunk-BXIPT2BO.js → chunk-KLHOQ6XQ.js} +1 -1
  43. package/dist/bundle/{chunk-CX2WCEQU.js → chunk-KP26Y5OA.js} +1440 -248
  44. package/dist/bundle/{chunk-3K65KTXD.js → chunk-KRCMKFUV.js} +2 -2
  45. package/dist/bundle/{chunk-HGMMRT4G.js → chunk-KTV5Y5EX.js} +2 -2
  46. package/dist/bundle/{chunk-7C6POLLO.js → chunk-KW6JZGG3.js} +1 -1
  47. package/dist/bundle/{chunk-D4Y2KL5V.js → chunk-LLCGOZ44.js} +4 -4
  48. package/dist/bundle/{chunk-FRW3CWC7.js → chunk-LS72R7DN.js} +34 -34
  49. package/dist/bundle/{chunk-NDSRND3E.js → chunk-LVGX7VTD.js} +4 -4
  50. package/dist/bundle/{chunk-5FEEFXJA.js → chunk-MCPOZNWG.js} +1 -1
  51. package/dist/bundle/{chunk-6K5R3YPN.js → chunk-MMPISXSU.js} +2 -2
  52. package/dist/bundle/{chunk-65BWMPCI.js → chunk-MTD6WZKV.js} +2 -2
  53. package/dist/bundle/{chunk-TT4CIXVH.js → chunk-PDYTNTQI.js} +6 -6
  54. package/dist/bundle/{chunk-KBHK5UGL.js → chunk-RX5CJ55S.js} +1 -1
  55. package/dist/bundle/{chunk-QTFXYR5W.js → chunk-S6OC367D.js} +4 -4
  56. package/dist/bundle/{chunk-DQELQ7BL.js → chunk-THJHYMFR.js} +1293 -1525
  57. package/dist/bundle/{chunk-RUNFFBJU.js → chunk-U2TPRUWK.js} +84 -72
  58. package/dist/bundle/{chunk-V5Z2JO6X.js → chunk-U6HEZPCR.js} +19 -19
  59. package/dist/bundle/{chunk-SMHLQEE2.js → chunk-VUBZFMGP.js} +2 -2
  60. package/dist/bundle/{chunk-W2BIBPRU.js → chunk-VUUR2SRS.js} +67 -44
  61. package/dist/bundle/{chunk-KC4MQRAB.js → chunk-WGGSFGNZ.js} +8 -8
  62. package/dist/bundle/{chunk-ZEQ7ONPZ.js → chunk-WLBPNLDF.js} +3 -3
  63. package/dist/bundle/{chunk-QQ3QZFFD.js → chunk-WQ55F4Y3.js} +8 -8
  64. package/dist/bundle/{chunk-72QLHHSO.js → chunk-YBOVL25O.js} +17 -15
  65. package/dist/bundle/{chunk-S3HAFJVC.js → chunk-YDROJG2Y.js} +86 -29
  66. package/dist/bundle/{chunk-CIDFV3IT.js → chunk-YQKEPT22.js} +1 -1
  67. package/dist/bundle/{chunk-XDMJVWWR.js → chunk-ZON7K5QE.js} +3 -3
  68. package/dist/bundle/{chunk-ROOUBFUW.js → chunk-ZRRZTPSB.js} +18152 -17010
  69. package/dist/bundle/command-contract-KW6FNOJO.js +33 -0
  70. package/dist/bundle/{decode-5N4ERCHC.js → decode-RVWSCZW4.js} +5 -5
  71. package/dist/bundle/{dispatch-TBGXBDHE.js → dispatch-U2DW6UI7.js} +8 -8
  72. package/dist/bundle/{echarts-YDEBAMXT.js → echarts-6VNUD3JF.js} +2 -2
  73. package/dist/bundle/{embed-T7H62XFR.js → embed-LWLCQKIK.js} +6 -6
  74. package/dist/bundle/{embedder-AW3O2TR3.js → embedder-CXKHLRJT.js} +9 -9
  75. package/dist/bundle/{entry-L2LJ2VPY.js → entry-HV4NSX3Z.js} +7 -7
  76. package/dist/bundle/{failure-AWHPW2HE.js → failure-HJD7S5UA.js} +2 -2
  77. package/dist/bundle/{first-run-6PBZSRZU.js → first-run-OPI6NIWQ.js} +11 -11
  78. package/dist/bundle/first-screen-BVQLF4LN.js +31 -0
  79. package/dist/bundle/{instructions-C3NJERO7.js → instructions-TK4HXL3A.js} +1 -1
  80. package/dist/bundle/{mcp-CWLASTLV.js → mcp-7KQUJNFN.js} +2 -2
  81. package/dist/bundle/{node-P3CIIYWU.js → node-WFPNBUCU.js} +2 -2
  82. package/dist/bundle/{node-sqlite-YVHMNRVA.js → node-sqlite-L5BRGJLK.js} +6 -6
  83. package/dist/bundle/{oauth-5OQYA2SV.js → oauth-CGVWL35B.js} +7 -7
  84. package/dist/bundle/{open-YGWUVSU7.js → open-HLL55C5S.js} +5 -5
  85. package/dist/bundle/{openai-U45JBQ6F.js → openai-YFCNXIJ4.js} +14 -14
  86. package/dist/bundle/{process-DCYX5EDG.js → process-4A5JP5LO.js} +1 -1
  87. package/dist/bundle/{program-UZBFH2EZ.js → program-IFGQGSUF.js} +52 -52
  88. package/dist/bundle/{prompt-HPVTPTFI.js → prompt-B5FYE2DQ.js} +5 -5
  89. package/dist/bundle/{proxy-transport-D7MCHGSV.js → proxy-transport-ENU2SJYT.js} +5 -5
  90. package/dist/bundle/{recognize-IJCPFJ76.js → recognize-ZHMHGIV3.js} +4 -4
  91. package/dist/bundle/{remote-MWDYQWFW.js → remote-A3W5HE52.js} +7 -7
  92. package/dist/bundle/{rerank-SXG64475.js → rerank-HWJAQOZM.js} +7 -7
  93. package/dist/bundle/{serve-KJQENHEH.js → serve-PP326Q2F.js} +9 -9
  94. package/dist/bundle/{server-MXVXZWN6.js → server-MV6CL63L.js} +35 -35
  95. package/dist/bundle/server-TZGGOJ26.js +60 -0
  96. package/dist/bundle/{state-CKKJWH27.js → state-Y3RJ7ZXB.js} +6 -6
  97. package/dist/bundle/{store-R3BE4V56.js → store-EVNI2MHZ.js} +13 -13
  98. package/dist/bundle/store-maintenance-command-XPQE47RE.js +49 -0
  99. package/dist/bundle/tg.js +13 -13
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.js +1 -1
  102. package/package.json +3 -3
  103. package/dist/bundle/command-contract-7TGMZRBE.js +0 -33
  104. package/dist/bundle/first-screen-UKCD7D2R.js +0 -31
  105. package/dist/bundle/server-RTMCRKQF.js +0 -60
  106. package/dist/bundle/store-maintenance-command-KDGBSBNU.js +0 -49
  107. /package/dist/bundle/{chunk-DWX4DE2I.js → chunk-YVNHQFLC.js} +0 -0
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  answerOf,
5
5
  messengerContext
6
- } from "./chunk-MDLSI3EN.js";
6
+ } from "./chunk-H5XC2WYO.js";
7
7
  import {
8
8
  FETCHING,
9
9
  RULES_VERSION,
@@ -27,14 +27,15 @@ import {
27
27
  typedQuery,
28
28
  withQuery,
29
29
  withTimeLimit
30
- } from "./chunk-YMWPRHXG.js";
30
+ } from "./chunk-7WS3ULOO.js";
31
31
  import {
32
32
  QUICK_HEALTH_CHECKS,
33
- explainDamage,
34
33
  fts5Tables,
35
34
  invalidJson,
35
+ lossUnknown,
36
+ storeDamageReport,
36
37
  storeHealth
37
- } from "./chunk-S3HAFJVC.js";
38
+ } from "./chunk-YDROJG2Y.js";
38
39
  import {
39
40
  stringWidth,
40
41
  wrapAnsi
@@ -47,7 +48,6 @@ import {
47
48
  REMOTE_WRITE,
48
49
  annotate,
49
50
  codeOf,
50
- currentRun,
51
51
  destroysNothing,
52
52
  environmentOf,
53
53
  itemOf,
@@ -65,17 +65,17 @@ import {
65
65
  snakeKeys,
66
66
  storeTable,
67
67
  withoutProviderRefs
68
- } from "./chunk-DQELQ7BL.js";
68
+ } from "./chunk-THJHYMFR.js";
69
69
  import {
70
70
  holdLock,
71
71
  lockPath,
72
72
  releaseLock,
73
73
  servingProfiles,
74
74
  takeLock
75
- } from "./chunk-XDMJVWWR.js";
75
+ } from "./chunk-ZON7K5QE.js";
76
76
  import {
77
77
  holdersOf
78
- } from "./chunk-D6YTBJY6.js";
78
+ } from "./chunk-JQLGS3SG.js";
79
79
  import {
80
80
  CORPORA,
81
81
  MIGRATIONS,
@@ -88,7 +88,6 @@ import {
88
88
  fillStems,
89
89
  fillTrigrams,
90
90
  fillVectorIndexes,
91
- formatLocator,
92
91
  involvementStoreOver,
93
92
  isDerivedTable,
94
93
  migrate,
@@ -96,7 +95,6 @@ import {
96
95
  openSqlite,
97
96
  openStore,
98
97
  orphanPointers,
99
- parseLocator,
100
98
  pendingNormalization,
101
99
  readStoreTables,
102
100
  rebuildMentions,
@@ -112,30 +110,34 @@ import {
112
110
  storeClients,
113
111
  storeContents,
114
112
  vectorIndexCounts
115
- } from "./chunk-ROOUBFUW.js";
113
+ } from "./chunk-ZRRZTPSB.js";
116
114
  import {
115
+ currentRun,
116
+ formatLocator,
117
+ parseLocator,
117
118
  queryFieldsOf,
118
119
  readDamageMark,
119
120
  readHealthMark,
121
+ readJournalMark,
120
122
  recordDeepCheck
121
- } from "./chunk-CX2WCEQU.js";
123
+ } from "./chunk-KP26Y5OA.js";
122
124
  import {
123
125
  failureKey,
124
126
  isStoreDamage
125
- } from "./chunk-ZEQ7ONPZ.js";
127
+ } from "./chunk-WLBPNLDF.js";
126
128
  import {
127
129
  readSecret
128
- } from "./chunk-HPQQ76WF.js";
130
+ } from "./chunk-JJY3TQTM.js";
129
131
  import {
130
132
  storePath
131
- } from "./chunk-6K5R3YPN.js";
133
+ } from "./chunk-MMPISXSU.js";
132
134
  import {
133
135
  openCache
134
- } from "./chunk-TT4CIXVH.js";
136
+ } from "./chunk-PDYTNTQI.js";
135
137
  import {
136
138
  resolvePaths,
137
139
  writeSecurely
138
- } from "./chunk-V5Z2JO6X.js";
140
+ } from "./chunk-U6HEZPCR.js";
139
141
  import {
140
142
  array,
141
143
  boolean,
@@ -156,12 +158,12 @@ import {
156
158
  string,
157
159
  transform,
158
160
  trim
159
- } from "./chunk-KC4MQRAB.js";
161
+ } from "./chunk-WGGSFGNZ.js";
160
162
  import {
161
163
  CliError,
162
164
  singleLine,
163
165
  visibleControls
164
- } from "./chunk-SMHLQEE2.js";
166
+ } from "./chunk-VUBZFMGP.js";
165
167
  import {
166
168
  __commonJS,
167
169
  __name,
@@ -5501,11 +5503,11 @@ var require_liquid_node = __commonJS({
5501
5503
  }
5502
5504
  });
5503
5505
 
5504
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5506
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5505
5507
  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";
5506
5508
  import { dirname as dirname3, resolve } from "node:path";
5507
5509
 
5508
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sealed.js
5510
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sealed.js
5509
5511
  import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
5510
5512
  import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
5511
5513
  import { Transform } from "node:stream";
@@ -5612,7 +5614,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
5612
5614
  renameSync(pending, to);
5613
5615
  }, "unsealFile");
5614
5616
 
5615
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5617
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5616
5618
  var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
5617
5619
  var fileSchemaOf = /* @__PURE__ */ __name((database) => {
5618
5620
  const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
@@ -5636,7 +5638,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
5636
5638
  };
5637
5639
  }, "compatibilityOf");
5638
5640
 
5639
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/store/repair.js
5641
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/repair.js
5640
5642
  import { createHash as createHash2 } from "node:crypto";
5641
5643
  var COPY_MARK = "__repair_";
5642
5644
  var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
@@ -5890,19 +5892,19 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
5890
5892
  return found;
5891
5893
  }, "deleteCopy");
5892
5894
 
5893
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5895
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5894
5896
  import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
5895
5897
 
5896
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5898
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5897
5899
  import { existsSync as existsSync3 } from "node:fs";
5898
5900
 
5899
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/store/recover.js
5901
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/recover.js
5900
5902
  import { execFileSync, spawn } from "node:child_process";
5901
5903
  import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
5902
5904
  import { basename, dirname, join } from "node:path";
5903
5905
  import { Transform as Transform2 } from "node:stream";
5904
5906
 
5905
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/store/refill.js
5907
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/refill.js
5906
5908
  var REFILL_MARGIN_MS = 864e5;
5907
5909
  var TIME_KEYS = 1e12;
5908
5910
  var integerId = `external_id GLOB '[0-9]*' AND NOT external_id GLOB '*[^0-9]*'`;
@@ -5982,7 +5984,7 @@ var forgetMail = /* @__PURE__ */ __name((database, cutoff, now) => {
5982
5984
  return [...folders].map(([account, count3]) => ({ account, folders: count3 }));
5983
5985
  }, "forgetMail");
5984
5986
 
5985
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/store/recover.js
5987
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/recover.js
5986
5988
  var SQLITE3_MINIMUM = [3, 43, 0];
5987
5989
  var STORE_PARTS = ["", "-wal", "-shm"];
5988
5990
  var RECOVER_LOCK = ".recover-lock";
@@ -6510,7 +6512,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6510
6512
  }
6511
6513
  }, "recoverLocked");
6512
6514
 
6513
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6515
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6514
6516
  var COUNTED = [
6515
6517
  "accounts",
6516
6518
  "chats",
@@ -6543,18 +6545,23 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) =>
6543
6545
  }
6544
6546
  } catch {
6545
6547
  }
6548
+ const journal = readJournalMark(path);
6546
6549
  recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema });
6547
6550
  const mark = readDamageMark(path);
6548
- const explanation = explainDamage(health, command, mark);
6551
+ const lastKnownGood = readHealthMark(path)?.last_ok_at ?? null;
6549
6552
  const inUse = storeHolders(path) ?? null;
6550
6553
  const timers = activeTimers() ?? null;
6551
6554
  const sqlite3 = sqlite3Program();
6552
- const next = health.ok ? [] : [
6553
- ...timers?.length ? [stopTimers(timers)] : [],
6554
- ...(inUse ?? []).map(({ pid, name }) => `stop ${name} (process ${pid}): it has the store open`),
6555
- ...sqlite3.usable ? [] : ["install sqlite3 3.43 or newer (apt install sqlite3, brew install sqlite)"],
6556
- `${command} store recover run`
6557
- ];
6555
+ const report = storeDamageReport({
6556
+ health,
6557
+ command,
6558
+ mark,
6559
+ journal,
6560
+ lastOkAt: lastKnownGood,
6561
+ holders: inUse,
6562
+ timers,
6563
+ sqlite3Usable: sqlite3.usable
6564
+ });
6558
6565
  return {
6559
6566
  path,
6560
6567
  exists: true,
@@ -6565,13 +6572,13 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) =>
6565
6572
  damagedSearchIndexes: (health.searchIndexes ?? []).filter((index) => !index.ok).map(({ name, error }) => ({ name, ...error ? { error } : {} })),
6566
6573
  invalidJson: health.invalidJson ?? [],
6567
6574
  rows,
6568
- explanation,
6575
+ report,
6569
6576
  damageMark: mark ? (({ inode: _, ...seen }) => seen)(mark) : null,
6570
- lastKnownGood: readHealthMark(path)?.last_ok_at ?? null,
6577
+ lastKnownGood,
6571
6578
  inUse,
6572
6579
  timers,
6573
6580
  sqlite3: { version: sqlite3.version, usable: sqlite3.usable },
6574
- next
6581
+ next: report?.steps.map((step) => step.command) ?? []
6575
6582
  };
6576
6583
  }, "storeRecoveryCheck");
6577
6584
  var storeRecoveryRun = /* @__PURE__ */ __name(async (env, { command, version, note, timers: scheduled = activeTimers, copy }) => {
@@ -6612,13 +6619,12 @@ var refetchNotes = /* @__PURE__ */ __name(({ since, chats, mail }) => {
6612
6619
  var recoveryNotes = /* @__PURE__ */ __name((answer) => {
6613
6620
  if ("keptAt" in answer) {
6614
6621
  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)` : ""));
6615
- 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)";
6616
6622
  return [
6617
6623
  `recovered in ${answer.seconds.total} s; the damaged file is kept at ${answer.keptAt}`,
6618
6624
  ...lost,
6619
6625
  ...Object.entries(answer.placed).map(([table, rows]) => `${table}: ${rows} rows found on pages no table claimed were put back`),
6620
6626
  ...refetchNotes(answer.refetch),
6621
- `${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`,
6627
+ lossUnknown(answer.lastKnownGood, lost.some((line) => line.includes("are gone"))),
6622
6628
  ...answer.dangling.map(({ table, parent, rows }) => `${rows} rows of ${table} point at ${parent} rows the store does not hold`),
6623
6629
  ...answer.invalidJson.map(({ table, column, rows, required }) => `${table}.${column}: ${rows} values were not valid JSON \u2014 ${required ? "those rows were dropped" : "set to empty"}`),
6624
6630
  ...answer.next.map((line) => `next: ${line}`)
@@ -6626,13 +6632,16 @@ var recoveryNotes = /* @__PURE__ */ __name((answer) => {
6626
6632
  }
6627
6633
  if (!answer.exists)
6628
6634
  return ["no store yet"];
6629
- if (answer.ok)
6635
+ const report = answer.report;
6636
+ if (!report)
6630
6637
  return [`the store is healthy (checked every page and search index in ${answer.seconds} s)`];
6631
- const why = answer.explanation;
6632
6638
  return [
6633
- ...why ? [why.what, ...why.impact, why.externalUnaffected] : [],
6634
- answer.lastKnownGood ? `the store last passed a deep check at ${answer.lastKnownGood}` : "no deep check that passed is on record for this store",
6635
- ...answer.next.map((line) => `next: ${line}`)
6639
+ report.whatHappened,
6640
+ ...report.impact,
6641
+ report.externalDataSafe,
6642
+ report.loss,
6643
+ ...report.likelyCauses.map(({ cause, check: check2 }) => `maybe: ${cause} \u2014 check: ${check2}`),
6644
+ ...report.steps.map(({ command, why, destructive }) => `next: ${command} # ${destructive ? "changes things: " : ""}${why}`)
6636
6645
  ];
6637
6646
  }, "recoveryNotes");
6638
6647
  var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
@@ -6659,7 +6668,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
6659
6668
  return recover;
6660
6669
  }, "storeRecoverCommand");
6661
6670
 
6662
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6671
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6663
6672
  var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
6664
6673
  var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
6665
6674
  var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
@@ -6705,7 +6714,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
6705
6714
  renderAnswer(this, outputFor(this), itemOf(answer));
6706
6715
  }), "storeInfoCommand");
6707
6716
 
6708
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6717
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6709
6718
  var ENCRYPT_OPTION = [
6710
6719
  "--encrypt",
6711
6720
  "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"
@@ -6724,7 +6733,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
6724
6733
  return password;
6725
6734
  }, "passwordOf");
6726
6735
 
6727
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/replies/rules.js
6736
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/replies/rules.js
6728
6737
  import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
6729
6738
  import { join as join2 } from "node:path";
6730
6739
  var REPLY_ACTIONS = ["reply", "task"];
@@ -6895,7 +6904,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
6895
6904
  }, "problem");
6896
6905
  var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
6897
6906
 
6898
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/replies/state.js
6907
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/replies/state.js
6899
6908
  import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
6900
6909
  import { join as join3 } from "node:path";
6901
6910
  var ANSWERED_KEPT = 1e3;
@@ -6948,7 +6957,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
6948
6957
  }, "recordReply");
6949
6958
  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");
6950
6959
 
6951
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/replies/decide.js
6960
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/replies/decide.js
6952
6961
  var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
6953
6962
  var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
6954
6963
  const { message, chat, owner, sender } = incoming;
@@ -7054,10 +7063,10 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
7054
7063
  return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
7055
7064
  }, "filled");
7056
7065
 
7057
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/replies/template.js
7066
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/replies/template.js
7058
7067
  var import_liquidjs2 = __toESM(require_liquid_node(), 1);
7059
7068
 
7060
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/render/liquid.js
7069
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/render/liquid.js
7061
7070
  var import_liquidjs = __toESM(require_liquid_node(), 1);
7062
7071
  var safeLiquid = /* @__PURE__ */ __name((limits) => {
7063
7072
  const engine = new import_liquidjs.Liquid({
@@ -7084,7 +7093,7 @@ var safeLiquid = /* @__PURE__ */ __name((limits) => {
7084
7093
  return engine;
7085
7094
  }, "safeLiquid");
7086
7095
 
7087
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/replies/template.js
7096
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/replies/template.js
7088
7097
  var TEMPLATE_LIMITS = {
7089
7098
  parse: 32768,
7090
7099
  renders: 2e3,
@@ -7223,7 +7232,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
7223
7232
  }
7224
7233
  }, "renderReplyTemplate");
7225
7234
 
7226
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
7235
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
7227
7236
  var DRY_RUN_DAYS = 7;
7228
7237
  var PAGE = 500;
7229
7238
  var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
@@ -7337,7 +7346,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
7337
7346
  }
7338
7347
  }, "storedSince");
7339
7348
 
7340
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/replies/consents.js
7349
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/replies/consents.js
7341
7350
  import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
7342
7351
  import { join as join4 } from "node:path";
7343
7352
  var shape = strictObject({
@@ -7362,7 +7371,7 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
7362
7371
  return consent.provider === provider && !consent.deniedChats.includes(chat);
7363
7372
  }, "mayModelReply");
7364
7373
 
7365
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7374
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7366
7375
  var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options = {
7367
7376
  ai: true
7368
7377
  }) => async (rule2, message, chat, now) => {
@@ -7409,7 +7418,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
7409
7418
  return result2;
7410
7419
  }, "replyRenderer");
7411
7420
 
7412
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/replies/serve.js
7421
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/replies/serve.js
7413
7422
  var NOT_ALLOWED = "replies.send is not allow";
7414
7423
  var NO_RULES = "no rules";
7415
7424
  var ONLY_TASK = "opened a task, sent nothing";
@@ -7502,7 +7511,7 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
7502
7511
  return { skip: why };
7503
7512
  }, "replyTo");
7504
7513
 
7505
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7514
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7506
7515
  var START_SYNC_DELAY_MS = 3e4;
7507
7516
  var START_SYNC_BUDGET_MS = 5 * 6e4;
7508
7517
  var START_SYNC_WINDOW_MS = 7 * 864e5;
@@ -7579,7 +7588,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch, note, warn,
7579
7588
  };
7580
7589
  }, "startSync");
7581
7590
 
7582
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7591
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7583
7592
  var FIRST_FETCH_MS = 6e4;
7584
7593
  var DAY_MS = 864e5;
7585
7594
  var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
@@ -7633,7 +7642,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs =
7633
7642
  };
7634
7643
  }, "memberFetches");
7635
7644
 
7636
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7645
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7637
7646
  var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
7638
7647
  var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
7639
7648
  if (context.format === "pretty") {
@@ -7666,7 +7675,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
7666
7675
  return context;
7667
7676
  }, "recordDiagnostics");
7668
7677
 
7669
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-outdated.js
7678
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-outdated.js
7670
7679
  import { existsSync as existsSync8, readFileSync as readFileSync5, realpathSync as realpathSync2 } from "node:fs";
7671
7680
  import { dirname as dirname2, join as join5 } from "node:path";
7672
7681
  var OUTDATED_CHECK_MS = 6e4;
@@ -7752,7 +7761,7 @@ var watchOutdated = /* @__PURE__ */ __name(({ check: check2, onOutdated, everyMs
7752
7761
  };
7753
7762
  }, "watchOutdated");
7754
7763
 
7755
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7764
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7756
7765
  var STEMS_EVERY_MS = 3e4;
7757
7766
  var STEMS_SLICE_MS = 2e3;
7758
7767
  var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
@@ -7792,7 +7801,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
7792
7801
  };
7793
7802
  }, "stemFills");
7794
7803
 
7795
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/render/messages.js
7804
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/render/messages.js
7796
7805
  import { styleText } from "node:util";
7797
7806
  var TIME_WIDTH = 8;
7798
7807
  var INDENT = " ".repeat(TIME_WIDTH + 2);
@@ -7968,7 +7977,7 @@ var editedAt = /* @__PURE__ */ __name((message, options) => {
7968
7977
  return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
7969
7978
  }, "editedAt");
7970
7979
 
7971
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7980
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7972
7981
  var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
7973
7982
  var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7974
7983
  kind: attachment.kind,
@@ -8063,7 +8072,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
8063
8072
  locale: messenger.app.locale
8064
8073
  }), "viewOf");
8065
8074
 
8066
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
8075
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
8067
8076
  var observed = /* @__PURE__ */ __name((value) => ({
8068
8077
  value: value.value,
8069
8078
  observed_at: value.observedAt,
@@ -8130,7 +8139,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
8130
8139
  }
8131
8140
  }, "watchEventItem");
8132
8141
 
8133
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
8142
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
8134
8143
  var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
8135
8144
  output: { entity: "watch_item" },
8136
8145
  effects: REMOTE_READ,
@@ -8285,7 +8294,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
8285
8294
  }
8286
8295
  }, "describe");
8287
8296
 
8288
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8297
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8289
8298
  var serveCommand = /* @__PURE__ */ __name((messenger) => {
8290
8299
  const command = annotate(new Command("serve"), {
8291
8300
  output: { entity: "serve_summary" },
@@ -8568,7 +8577,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
8568
8577
  };
8569
8578
  }, "tasking");
8570
8579
 
8571
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8580
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8572
8581
  import { existsSync as existsSync9 } from "node:fs";
8573
8582
  var PATH = "store tables list";
8574
8583
  var STORE_TABLES_QUERY = {
@@ -8611,7 +8620,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
8611
8620
  return tables;
8612
8621
  }, "storeTablesCommand");
8613
8622
 
8614
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8623
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8615
8624
  var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
8616
8625
  var WORD_INDEX = "message_words";
8617
8626
  var schemaOf = /* @__PURE__ */ __name((database) => {
@@ -8650,6 +8659,7 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, v
8650
8659
  if (!existsSync10(path))
8651
8660
  return { path, exists: false };
8652
8661
  const checked = await storeHealth(path, { deep });
8662
+ const journal = readJournalMark(path);
8653
8663
  const recorded = deep ? recordDeepCheck(path, checked, {
8654
8664
  cli: command ?? "unknown",
8655
8665
  ...version ? { version } : {},
@@ -8667,13 +8677,15 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, v
8667
8677
  ...checked.invalidJson?.length ? { invalidJson: checked.invalidJson } : {},
8668
8678
  ...checked.searchIndexes?.some((index) => !index.ok) ? { damagedSearchIndexes: checked.searchIndexes.filter((index) => !index.ok).map((index) => index.name) } : {}
8669
8679
  };
8670
- const damage = command ? explainDamage(checked, command, mark) : null;
8680
+ const damage = command ? storeDamageReport({ health: checked, command, mark, journal, lastOkAt: lastKnownGood }) : null;
8671
8681
  const healthOf = {
8672
8682
  health,
8673
8683
  lastKnownGood,
8674
8684
  ...mark ? { damageMark: withoutInode(mark) } : {},
8685
+ ...journal ? { journalMark: journal } : {},
8675
8686
  ...recorded?.cleared ? { damageMarkCleared: withoutInode(recorded.cleared) } : {},
8676
- ...damage ? { damage } : {}
8687
+ // `what` keeps memo's doctor, which reads it, compiling until it moves to `whatHappened`.
8688
+ ...damage ? { damage: { what: damage.whatHappened, ...damage } } : {}
8677
8689
  };
8678
8690
  try {
8679
8691
  return await reading(path, (database) => {