@wirecat/mail-cli 0.19.0 → 0.21.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 (105) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/bin/mail.js +2 -2
  3. package/dist/bundle/{all-profiles-MRNWJSXX.js → all-profiles-DTUWUCQQ.js} +7 -6
  4. package/dist/bundle/{anthropic-OUV5B4ZR.js → anthropic-YJAEQSNT.js} +3 -3
  5. package/dist/bundle/{app-server-TLZPGT53.js → app-server-3ZXSTBA3.js} +41 -40
  6. package/dist/bundle/{bun-IDEPIM6S.js → bun-34VBM7C5.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-DW4XMJOP.js → bun-sqlite-GCT7ROCK.js} +2 -2
  8. package/dist/bundle/{chunk-ETZFPIDO.js → chunk-2PPEDB67.js} +31 -29
  9. package/dist/bundle/{chunk-HUOAAQU7.js → chunk-3DSYLE5N.js} +2 -2
  10. package/dist/bundle/{chunk-RYRR5NFB.js → chunk-3HDQVTND.js} +4 -4
  11. package/dist/bundle/{chunk-H3KB77WL.js → chunk-4FWJNIPH.js} +1 -1
  12. package/dist/bundle/{chunk-NA63ZIYN.js → chunk-4WIEVQ2Q.js} +8 -14
  13. package/dist/bundle/{chunk-EWXCMKLM.js → chunk-566MEXK5.js} +2 -2
  14. package/dist/bundle/{chunk-GZAETQ6X.js → chunk-72N26BQM.js} +24 -22
  15. package/dist/bundle/{chunk-DC6BXHWF.js → chunk-7XLOWYGD.js} +93 -6
  16. package/dist/bundle/{chunk-RYE5SRUM.js → chunk-AF62BPIW.js} +5 -5
  17. package/dist/bundle/{chunk-GAPH7GET.js → chunk-B74SOC4R.js} +9 -20
  18. package/dist/bundle/{chunk-BQM4ROFB.js → chunk-FTI73RLC.js} +2 -2
  19. package/dist/bundle/{chunk-OUMXW53I.js → chunk-GAPQENMY.js} +2 -2
  20. package/dist/bundle/{chunk-4EMXLDQ6.js → chunk-HJ2CXDKJ.js} +130 -11
  21. package/dist/bundle/{chunk-2ZDKZGES.js → chunk-HN43G27G.js} +30 -22
  22. package/dist/bundle/{chunk-VVHEB3M3.js → chunk-HRRSTIGP.js} +4 -4
  23. package/dist/bundle/{chunk-QC6QDORL.js → chunk-HSBGNVEL.js} +202 -171
  24. package/dist/bundle/{chunk-CQVRBZGP.js → chunk-I2SDXWLR.js} +173 -48
  25. package/dist/bundle/{chunk-3CJVUCDZ.js → chunk-J2U6LUT5.js} +3 -3
  26. package/dist/bundle/{chunk-WJQWEKZL.js → chunk-J4UZXBEV.js} +1 -1
  27. package/dist/bundle/{chunk-57KFWOMH.js → chunk-KMQAHDBM.js} +7170 -13496
  28. package/dist/bundle/{chunk-7H45FPAT.js → chunk-LF5XM4HE.js} +1 -1
  29. package/dist/bundle/chunk-LTXYJAJK.js +12211 -0
  30. package/dist/bundle/{chunk-YJMQWOPH.js → chunk-MD64ITYO.js} +1 -1
  31. package/dist/bundle/{chunk-WELIANTW.js → chunk-MDDB7M7Z.js} +1 -1
  32. package/dist/bundle/{chunk-ZXQDJMWD.js → chunk-NOVBK4SY.js} +12 -12
  33. package/dist/bundle/{chunk-YL5WH6XH.js → chunk-O3M2S62X.js} +3 -3
  34. package/dist/bundle/{chunk-H4MWBB4X.js → chunk-ODFHIXMA.js} +1 -1
  35. package/dist/bundle/{chunk-HCRMPNSO.js → chunk-OKO2Q6H6.js} +2 -2
  36. package/dist/bundle/{chunk-FBSDRNW5.js → chunk-P2QJA7S5.js} +1 -1
  37. package/dist/bundle/{chunk-VIXEQPVE.js → chunk-P6FT6YYT.js} +17 -14
  38. package/dist/bundle/{chunk-QU3JH3GB.js → chunk-QE72KTS7.js} +1 -1
  39. package/dist/bundle/{chunk-W3PU5XGE.js → chunk-QPRXTLMD.js} +1 -1
  40. package/dist/bundle/{chunk-EQWYG3QN.js → chunk-QTMVGOSF.js} +298 -266
  41. package/dist/bundle/{chunk-HTNWOOA2.js → chunk-R3WPMQYZ.js} +105 -61
  42. package/dist/bundle/{chunk-SOZXI7I3.js → chunk-RFB27ACZ.js} +2 -2
  43. package/dist/bundle/{chunk-P2RSKCY4.js → chunk-RPCKBXKN.js} +1 -1
  44. package/dist/bundle/{chunk-QXZTVB5I.js → chunk-RT6SLZBI.js} +1 -1
  45. package/dist/bundle/{chunk-TX2TTMK4.js → chunk-RY7PBP4F.js} +45 -29
  46. package/dist/bundle/{chunk-7ERCJWNL.js → chunk-SCIC2CJS.js} +4 -4
  47. package/dist/bundle/{chunk-33BOFLDQ.js → chunk-SFC46MP2.js} +249 -8
  48. package/dist/bundle/chunk-SYEICLTR.js +66 -0
  49. package/dist/bundle/{chunk-HOGJNJ3T.js → chunk-T3DTYJTG.js} +1 -1
  50. package/dist/bundle/{chunk-NBHMSEN4.js → chunk-T4FVIPUJ.js} +1 -1
  51. package/dist/bundle/{chunk-MQISDBH2.js → chunk-TCCN5TON.js} +1 -1
  52. package/dist/bundle/{chunk-KO2DA7CN.js → chunk-V6OIIVH3.js} +10 -10
  53. package/dist/bundle/{chunk-A5A6MPIX.js → chunk-VDUGE6TH.js} +2 -2
  54. package/dist/bundle/{chunk-LCP2DMBD.js → chunk-VINSQR4X.js} +7 -7
  55. package/dist/bundle/{chunk-42QY6DIG.js → chunk-VQZCIDSO.js} +2 -2
  56. package/dist/bundle/{chunk-OYYEY3UE.js → chunk-WBAA2X3E.js} +9 -9
  57. package/dist/bundle/{chunk-2WORM2E3.js → chunk-Z75WYAX6.js} +6 -6
  58. package/dist/bundle/{chunk-POWHDZIC.js → chunk-Z7N4MGOQ.js} +5 -5
  59. package/dist/bundle/{chunk-R2ETE3SX.js → chunk-ZKLXSVIO.js} +1 -1
  60. package/dist/bundle/{chunk-OBSV2GUJ.js → chunk-ZZSHGCRC.js} +3 -3
  61. package/dist/bundle/{command-contract-36ASI4YI.js → command-contract-Y4ZQAJEC.js} +14 -13
  62. package/dist/bundle/{decode-Z37HTJ53.js → decode-BIOOL5E4.js} +2 -2
  63. package/dist/bundle/{dist-E3UUAOWA.js → dist-TJVIRLE5.js} +77 -17
  64. package/dist/bundle/{echarts-TSRD7GVA.js → echarts-ECPGMKXO.js} +2 -2
  65. package/dist/bundle/{embed-Z5GZUUCK.js → embed-F7JFSLHN.js} +3 -3
  66. package/dist/bundle/{embedder-SYWZ6JW2.js → embedder-U4G74HV3.js} +6 -6
  67. package/dist/bundle/{first-run-I5GMVVX5.js → first-run-JTYPUYQP.js} +5 -5
  68. package/dist/bundle/first-screen-W6RWTAU7.js +33 -0
  69. package/dist/bundle/{instructions-IMW3LWMS.js → instructions-WNCGZ7OJ.js} +1 -1
  70. package/dist/bundle/mail.js +2 -2
  71. package/dist/bundle/{node-V6SRRJ2F.js → node-UIRGGMGT.js} +2 -2
  72. package/dist/bundle/{node-sqlite-HN2P6PY2.js → node-sqlite-4ZM7OPRF.js} +3 -3
  73. package/dist/bundle/{oauth-7FIIKNXY.js → oauth-5RAJZPBW.js} +4 -4
  74. package/dist/bundle/{open-6XPAHITO.js → open-7ORCHOAI.js} +2 -2
  75. package/dist/bundle/{openai-B5MSVUDL.js → openai-XSJNXJA7.js} +10 -10
  76. package/dist/bundle/{process-LNEAZMJV.js → process-ZLO72UVZ.js} +1 -1
  77. package/dist/bundle/{program-BDB3D2HE.js → program-LBLGFZWU.js} +1733 -1654
  78. package/dist/bundle/{prompt-ZXS7F7OS.js → prompt-IDUPCUGM.js} +2 -2
  79. package/dist/bundle/{recognize-ONHYBE77.js → recognize-OS3EZKIM.js} +1 -1
  80. package/dist/bundle/{remote-IBZTKGBQ.js → remote-PF4LZR65.js} +4 -4
  81. package/dist/bundle/{rerank-TWODAEGK.js → rerank-CQNZF3JI.js} +4 -4
  82. package/dist/bundle/{serve-PPJIP254.js → serve-Y2DDLGBT.js} +6 -6
  83. package/dist/bundle/server-I3IALQMC.js +65 -0
  84. package/dist/bundle/{server-VG7EAG5C.js → server-TVRT7YEY.js} +33 -32
  85. package/dist/bundle/{sqlite-runtime-JZFSB33U.js → sqlite-runtime-5343C3OE.js} +3 -3
  86. package/dist/bundle/{state-2FUXS6RU.js → state-4GBTMPIV.js} +3 -3
  87. package/dist/bundle/{store-VURW3NE7.js → store-OLBLTQPT.js} +44 -13
  88. package/dist/bundle/{store-PYAP6NYK.js → store-QA6QJ5BB.js} +20 -11
  89. package/dist/bundle/store-maintenance-command-LB6CMGP4.js +55 -0
  90. package/dist/commands/send.d.ts +1 -0
  91. package/dist/commands/send.d.ts.map +1 -1
  92. package/dist/commands/send.js +10 -2
  93. package/dist/commands/send.js.map +1 -1
  94. package/dist/mail/compose.d.ts +2 -0
  95. package/dist/mail/compose.d.ts.map +1 -1
  96. package/dist/mail/compose.js +1 -0
  97. package/dist/mail/compose.js.map +1 -1
  98. package/dist/version.d.ts +1 -1
  99. package/dist/version.js +1 -1
  100. package/package.json +2 -2
  101. package/skills/mail-cli/SKILL.md +2 -1
  102. package/dist/bundle/chunk-IRY3ZFPW.js +0 -656
  103. package/dist/bundle/first-screen-R3LHPHU3.js +0 -32
  104. package/dist/bundle/server-JBV7NTAA.js +0 -64
  105. package/dist/bundle/store-maintenance-command-EHWGMBEA.js +0 -54
@@ -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-R2ETE3SX.js";
5
+ } from "./chunk-ZKLXSVIO.js";
6
6
  import {
7
7
  answerOf,
8
8
  messengerContext
9
- } from "./chunk-GZAETQ6X.js";
9
+ } from "./chunk-72N26BQM.js";
10
10
  import {
11
11
  FETCHING,
12
12
  RULES_VERSION,
@@ -27,19 +27,19 @@ import {
27
27
  typedQuery,
28
28
  withQuery,
29
29
  withTimeLimit
30
- } from "./chunk-EQWYG3QN.js";
30
+ } from "./chunk-QTMVGOSF.js";
31
31
  import {
32
32
  checkedOptions,
33
33
  range
34
- } from "./chunk-W3PU5XGE.js";
34
+ } from "./chunk-QPRXTLMD.js";
35
35
  import {
36
36
  messagesFor,
37
37
  systemFor,
38
38
  validateImages
39
- } from "./chunk-MQISDBH2.js";
39
+ } from "./chunk-TCCN5TON.js";
40
40
  import {
41
41
  readSecret
42
- } from "./chunk-OUMXW53I.js";
42
+ } from "./chunk-GAPQENMY.js";
43
43
  import {
44
44
  Command,
45
45
  LOCAL_READ,
@@ -67,30 +67,27 @@ import {
67
67
  snakeKeys,
68
68
  storeTable,
69
69
  withoutProviderRefs
70
- } from "./chunk-QC6QDORL.js";
70
+ } from "./chunk-HSBGNVEL.js";
71
71
  import {
72
72
  levelFor
73
- } from "./chunk-VVHEB3M3.js";
74
- import {
75
- failureKey
76
- } from "./chunk-GAPH7GET.js";
73
+ } from "./chunk-HRRSTIGP.js";
77
74
  import {
78
75
  holdLock,
79
76
  lockPath,
80
77
  releaseLock,
81
78
  servingProfiles,
82
79
  takeLock
83
- } from "./chunk-42QY6DIG.js";
80
+ } from "./chunk-VQZCIDSO.js";
84
81
  import {
85
82
  holdersOf
86
- } from "./chunk-HOGJNJ3T.js";
83
+ } from "./chunk-T3DTYJTG.js";
87
84
  import {
88
85
  QUICK_HEALTH_CHECKS,
89
86
  explainDamage,
90
87
  fts5Tables,
91
88
  invalidJson,
92
89
  storeHealth
93
- } from "./chunk-TX2TTMK4.js";
90
+ } from "./chunk-RY7PBP4F.js";
94
91
  import {
95
92
  CORPORA,
96
93
  MIGRATIONS,
@@ -124,20 +121,29 @@ import {
124
121
  storeClients,
125
122
  storeContents,
126
123
  vectorIndexCounts
127
- } from "./chunk-57KFWOMH.js";
124
+ } from "./chunk-KMQAHDBM.js";
128
125
  import {
129
126
  formatLocator,
130
127
  parseLocator
131
- } from "./chunk-IRY3ZFPW.js";
128
+ } from "./chunk-LTXYJAJK.js";
129
+ import {
130
+ readDamageMark,
131
+ readHealthMark,
132
+ recordDeepCheck
133
+ } from "./chunk-HJ2CXDKJ.js";
132
134
  import {
133
135
  queryFieldsOf
134
- } from "./chunk-CQVRBZGP.js";
136
+ } from "./chunk-I2SDXWLR.js";
137
+ import {
138
+ failureKey,
139
+ isStoreDamage
140
+ } from "./chunk-SYEICLTR.js";
135
141
  import {
136
142
  storePath
137
- } from "./chunk-P2RSKCY4.js";
143
+ } from "./chunk-RPCKBXKN.js";
138
144
  import {
139
145
  openCache
140
- } from "./chunk-RYE5SRUM.js";
146
+ } from "./chunk-AF62BPIW.js";
141
147
  import {
142
148
  Credentials,
143
149
  pathsAreOverridden,
@@ -5510,11 +5516,11 @@ var require_liquid_node = __commonJS({
5510
5516
  }
5511
5517
  });
5512
5518
 
5513
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5519
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5514
5520
  import { chmodSync, constants, copyFileSync, existsSync as existsSync9, mkdirSync, realpathSync as realpathSync2, renameSync as renameSync3, rmSync as rmSync3, statfsSync as statfsSync2, statSync as statSync4, writeFileSync as writeFileSync2 } from "node:fs";
5515
5521
  import { dirname as dirname2, resolve } from "node:path";
5516
5522
 
5517
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/sealed.js
5523
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/sealed.js
5518
5524
  import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
5519
5525
  import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
5520
5526
  import { Transform } from "node:stream";
@@ -5621,7 +5627,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
5621
5627
  renameSync(pending, to);
5622
5628
  }, "unsealFile");
5623
5629
 
5624
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5630
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5625
5631
  var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
5626
5632
  var fileSchemaOf = /* @__PURE__ */ __name((database) => {
5627
5633
  const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
@@ -5645,7 +5651,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
5645
5651
  };
5646
5652
  }, "compatibilityOf");
5647
5653
 
5648
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/store/repair.js
5654
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/repair.js
5649
5655
  import { createHash as createHash2 } from "node:crypto";
5650
5656
  var COPY_MARK = "__repair_";
5651
5657
  var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
@@ -5899,13 +5905,13 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
5899
5905
  return found;
5900
5906
  }, "deleteCopy");
5901
5907
 
5902
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5908
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5903
5909
  import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
5904
5910
 
5905
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5911
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5906
5912
  import { existsSync as existsSync3 } from "node:fs";
5907
5913
 
5908
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/store/recover.js
5914
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/recover.js
5909
5915
  import { execFileSync, spawn } from "node:child_process";
5910
5916
  import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
5911
5917
  import { basename, dirname, join } from "node:path";
@@ -6203,7 +6209,14 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6203
6209
  }, "stopWatching");
6204
6210
  try {
6205
6211
  const dataVersion = /* @__PURE__ */ __name(() => Number(watch.prepare("PRAGMA data_version").get()?.data_version), "dataVersion");
6206
- const rowsBefore = tableRows(watch);
6212
+ let rowsBefore;
6213
+ try {
6214
+ rowsBefore = tableRows(watch);
6215
+ } catch (error) {
6216
+ if (!isStoreDamage(error))
6217
+ throw error;
6218
+ throw new CliError("configuration_error", "the store file's header or schema is damaged, so its tables cannot be listed and it cannot be recovered; the file was left as it was", { reason: "store.unreadable" });
6219
+ }
6207
6220
  const before = { data: dataVersion(), inode: statSync2(path).ino };
6208
6221
  const stamp = new Date(now()).toISOString().replace(/[:.]/g, "-");
6209
6222
  const target = `${path}.recovering-${stamp}`;
@@ -6231,6 +6244,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6231
6244
  let dangling;
6232
6245
  let json;
6233
6246
  let fetch2;
6247
+ let schema;
6234
6248
  try {
6235
6249
  kept = tableRows(opened.database);
6236
6250
  migrate(opened.database, { command, ...version ? { version } : {} });
@@ -6240,6 +6254,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6240
6254
  note("looking for rows that point at rows that were lost");
6241
6255
  dangling = danglingRows(opened.database);
6242
6256
  fetch2 = mailToFetch(opened.database);
6257
+ schema = fileSchemaOf(opened.database).version;
6243
6258
  opened.database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
6244
6259
  } catch (error) {
6245
6260
  opened.database.close();
@@ -6267,6 +6282,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6267
6282
  for (const suffix of STORE_PARTS)
6268
6283
  if (existsSync2(`${target}${suffix}`))
6269
6284
  renameSync2(`${target}${suffix}`, `${path}${suffix}`);
6285
+ recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema, now });
6270
6286
  const lost = Object.entries(rowsBefore).map(([table, before2]) => ({ table, before: before2, read: read[table] ?? 0, kept: kept[table] ?? 0 })).filter(({ before: before2, read: read2, kept: kept2 }) => before2 === null || before2 > kept2 || read2 > kept2);
6271
6287
  const seconds = /* @__PURE__ */ __name((from, to) => Math.round((to - from) / 100) / 10, "seconds");
6272
6288
  return {
@@ -6292,7 +6308,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6292
6308
  }
6293
6309
  }, "recoverLocked");
6294
6310
 
6295
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6311
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6296
6312
  var COUNTED = [
6297
6313
  "accounts",
6298
6314
  "chats",
@@ -6307,15 +6323,17 @@ var COUNTED = [
6307
6323
  "mentions"
6308
6324
  ];
6309
6325
  var stopTimers = /* @__PURE__ */ __name((timers) => `systemctl --user stop ${timers.join(" ")}`, "stopTimers");
6310
- var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
6326
+ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) => {
6311
6327
  const path = storePath(env);
6312
6328
  if (!existsSync3(path))
6313
6329
  return { path, exists: false, ok: true, next: [] };
6314
6330
  const health = await storeHealth(path, { deep: true });
6315
6331
  let rows = {};
6332
+ let schema = null;
6316
6333
  try {
6317
6334
  const { database } = await openSqlite(path, { readOnly: true });
6318
6335
  try {
6336
+ schema = fileSchemaOf(database).version;
6319
6337
  const all = tableRows(database);
6320
6338
  rows = Object.fromEntries(COUNTED.filter((table) => table in all).map((table) => [table, all[table] ?? null]));
6321
6339
  } finally {
@@ -6323,7 +6341,9 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
6323
6341
  }
6324
6342
  } catch {
6325
6343
  }
6326
- const explanation = explainDamage(health, command);
6344
+ recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema });
6345
+ const mark = readDamageMark(path);
6346
+ const explanation = explainDamage(health, command, mark);
6327
6347
  const inUse = storeHolders(path) ?? null;
6328
6348
  const timers = activeTimers() ?? null;
6329
6349
  const sqlite3 = sqlite3Program();
@@ -6344,6 +6364,8 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
6344
6364
  invalidJson: health.invalidJson ?? [],
6345
6365
  rows,
6346
6366
  explanation,
6367
+ damageMark: mark ? (({ inode: _, ...seen }) => seen)(mark) : null,
6368
+ lastKnownGood: readHealthMark(path)?.last_ok_at ?? null,
6347
6369
  inUse,
6348
6370
  timers,
6349
6371
  sqlite3: { version: sqlite3.version, usable: sqlite3.usable },
@@ -6391,13 +6413,14 @@ var recoveryNotes = /* @__PURE__ */ __name((answer) => {
6391
6413
  const why = answer.explanation;
6392
6414
  return [
6393
6415
  ...why ? [why.what, ...why.impact, why.externalUnaffected] : [],
6416
+ answer.lastKnownGood ? `the store last passed a deep check at ${answer.lastKnownGood}` : "no deep check that passed is on record for this store",
6394
6417
  ...answer.next.map((line) => `next: ${line}`)
6395
6418
  ];
6396
6419
  }, "recoveryNotes");
6397
6420
  var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
6398
6421
  const recover = annotate(new Command("recover"), { effects: LOCAL_READ, examples: [`${command} store recover`] }).summary("what is damaged in the store and how to recover it").description("check every page and search index of the store, say what is damaged, what it means and the commands that recover it; changes nothing").action(async function() {
6399
6422
  const output = outputFor(this);
6400
- const answer = await storeRecoveryCheck(environmentOf(this).env ?? process.env, command);
6423
+ const answer = await storeRecoveryCheck(environmentOf(this).env ?? process.env, command, version);
6401
6424
  renderAnswer(this, output, itemOf(snakeKeys(answer)));
6402
6425
  if (output.format === "pretty")
6403
6426
  for (const line of recoveryNotes(answer))
@@ -6418,7 +6441,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
6418
6441
  return recover;
6419
6442
  }, "storeRecoverCommand");
6420
6443
 
6421
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6444
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6422
6445
  var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
6423
6446
  var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
6424
6447
  var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
@@ -6464,7 +6487,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
6464
6487
  renderAnswer(this, outputFor(this), itemOf(answer));
6465
6488
  }), "storeInfoCommand");
6466
6489
 
6467
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6490
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6468
6491
  var ENCRYPT_OPTION = [
6469
6492
  "--encrypt",
6470
6493
  "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"
@@ -6483,7 +6506,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
6483
6506
  return password;
6484
6507
  }, "passwordOf");
6485
6508
 
6486
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/replies/rules.js
6509
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/replies/rules.js
6487
6510
  import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
6488
6511
  import { join as join2 } from "node:path";
6489
6512
  var REPLY_ACTIONS = ["reply", "task"];
@@ -6654,7 +6677,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
6654
6677
  }, "problem");
6655
6678
  var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
6656
6679
 
6657
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/replies/state.js
6680
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/replies/state.js
6658
6681
  import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
6659
6682
  import { join as join3 } from "node:path";
6660
6683
  var ANSWERED_KEPT = 1e3;
@@ -6707,7 +6730,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
6707
6730
  }, "recordReply");
6708
6731
  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");
6709
6732
 
6710
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/replies/decide.js
6733
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/replies/decide.js
6711
6734
  var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
6712
6735
  var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
6713
6736
  const { message, chat, owner, sender } = incoming;
@@ -6813,7 +6836,7 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
6813
6836
  return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
6814
6837
  }, "filled");
6815
6838
 
6816
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/replies/template.js
6839
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/replies/template.js
6817
6840
  var import_liquidjs = __toESM(require_liquid_node(), 1);
6818
6841
  var TEMPLATE_LIMITS = {
6819
6842
  parse: 32768,
@@ -6973,7 +6996,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
6973
6996
  }
6974
6997
  }, "renderReplyTemplate");
6975
6998
 
6976
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
6999
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
6977
7000
  var DRY_RUN_DAYS = 7;
6978
7001
  var PAGE = 500;
6979
7002
  var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
@@ -7087,7 +7110,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
7087
7110
  }
7088
7111
  }, "storedSince");
7089
7112
 
7090
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
7113
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
7091
7114
  var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
7092
7115
  const host = new URL(baseUrl).host;
7093
7116
  return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
@@ -7118,7 +7141,7 @@ var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) =>
7118
7141
  };
7119
7142
  }, "embeddingKeys");
7120
7143
 
7121
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/models/openai.js
7144
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/models/openai.js
7122
7145
  var options = strictObject({
7123
7146
  temperature: range(0, 2),
7124
7147
  top_p: range(0, 1),
@@ -7167,7 +7190,7 @@ var openai = {
7167
7190
  }), "complete")
7168
7191
  };
7169
7192
 
7170
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/models/index.js
7193
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/models/index.js
7171
7194
  var modelGateway = /* @__PURE__ */ __name((deps) => ({
7172
7195
  complete: /* @__PURE__ */ __name(async (request) => {
7173
7196
  if (deps.signal?.aborted)
@@ -7182,7 +7205,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
7182
7205
  if (!adapter && target.provider === "openai")
7183
7206
  adapter = openai;
7184
7207
  if (!adapter && target.provider === "anthropic")
7185
- adapter = (await import("./anthropic-OUV5B4ZR.js")).anthropic;
7208
+ adapter = (await import("./anthropic-YJAEQSNT.js")).anthropic;
7186
7209
  if (!adapter)
7187
7210
  throw new CliError("validation_error", `no model adapter for ${target.provider}`);
7188
7211
  if (request.images !== void 0 && adapter.images !== true)
@@ -7223,7 +7246,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
7223
7246
  }, "complete")
7224
7247
  }), "modelGateway");
7225
7248
 
7226
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/replies/consents.js
7249
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/replies/consents.js
7227
7250
  import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
7228
7251
  import { join as join4 } from "node:path";
7229
7252
  var shape = strictObject({
@@ -7248,7 +7271,7 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
7248
7271
  return consent.provider === provider && !consent.deniedChats.includes(chat);
7249
7272
  }, "mayModelReply");
7250
7273
 
7251
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7274
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7252
7275
  var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options2 = {
7253
7276
  ai: true
7254
7277
  }) => async (rule2, message, chat, now) => {
@@ -7295,7 +7318,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
7295
7318
  return result2;
7296
7319
  }, "replyRenderer");
7297
7320
 
7298
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/replies/serve.js
7321
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/replies/serve.js
7299
7322
  var NOT_ALLOWED = "replies.send is not allow";
7300
7323
  var NO_RULES = "no rules";
7301
7324
  var ONLY_TASK = "opened a task, sent nothing";
@@ -7388,7 +7411,7 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
7388
7411
  return { skip: why };
7389
7412
  }, "replyTo");
7390
7413
 
7391
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7414
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7392
7415
  var START_SYNC_DELAY_MS = 3e4;
7393
7416
  var START_SYNC_BUDGET_MS = 5 * 6e4;
7394
7417
  var START_SYNC_WINDOW_MS = 7 * 864e5;
@@ -7465,7 +7488,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note
7465
7488
  };
7466
7489
  }, "startSync");
7467
7490
 
7468
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7491
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7469
7492
  var FIRST_FETCH_MS = 6e4;
7470
7493
  var DAY_MS = 864e5;
7471
7494
  var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
@@ -7519,7 +7542,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
7519
7542
  };
7520
7543
  }, "memberFetches");
7521
7544
 
7522
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7545
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7523
7546
  var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
7524
7547
  var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
7525
7548
  if (context.format === "pretty") {
@@ -7552,7 +7575,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
7552
7575
  return context;
7553
7576
  }, "recordDiagnostics");
7554
7577
 
7555
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7578
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7556
7579
  var STEMS_EVERY_MS = 3e4;
7557
7580
  var STEMS_SLICE_MS = 2e3;
7558
7581
  var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
@@ -7592,7 +7615,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
7592
7615
  };
7593
7616
  }, "stemFills");
7594
7617
 
7595
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7618
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7596
7619
  var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
7597
7620
  var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7598
7621
  kind: attachment.kind,
@@ -7687,7 +7710,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
7687
7710
  locale: messenger.app.locale
7688
7711
  }), "viewOf");
7689
7712
 
7690
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7713
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7691
7714
  var observed = /* @__PURE__ */ __name((value) => ({
7692
7715
  value: value.value,
7693
7716
  observed_at: value.observedAt,
@@ -7754,7 +7777,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
7754
7777
  }
7755
7778
  }, "watchEventItem");
7756
7779
 
7757
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7780
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7758
7781
  var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
7759
7782
  output: { entity: "watch_item" },
7760
7783
  effects: REMOTE_READ,
@@ -7909,7 +7932,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
7909
7932
  }
7910
7933
  }, "describe");
7911
7934
 
7912
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
7935
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
7913
7936
  var serveCommand = /* @__PURE__ */ __name((messenger) => {
7914
7937
  const command = annotate(new Command("serve"), {
7915
7938
  output: { entity: "serve_summary" },
@@ -8173,7 +8196,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
8173
8196
  };
8174
8197
  }, "tasking");
8175
8198
 
8176
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8199
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8177
8200
  import { existsSync as existsSync8 } from "node:fs";
8178
8201
  var PATH = "store tables list";
8179
8202
  var STORE_TABLES_QUERY = {
@@ -8216,7 +8239,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
8216
8239
  return tables;
8217
8240
  }, "storeTablesCommand");
8218
8241
 
8219
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8242
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8220
8243
  var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
8221
8244
  var WORD_INDEX = "message_words";
8222
8245
  var schemaOf = /* @__PURE__ */ __name((database) => {
@@ -8242,11 +8265,26 @@ var readingOnly = /* @__PURE__ */ __name(async (path, read) => {
8242
8265
  database.close();
8243
8266
  }
8244
8267
  }, "readingOnly");
8245
- var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command } = {}) => {
8268
+ var withoutInode = /* @__PURE__ */ __name(({ inode: _, ...mark }) => mark, "withoutInode");
8269
+ var fileSchema = /* @__PURE__ */ __name(async (path) => {
8270
+ try {
8271
+ return await readingOnly(path, (database) => fileSchemaOf(database).version);
8272
+ } catch {
8273
+ return null;
8274
+ }
8275
+ }, "fileSchema");
8276
+ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, version } = {}) => {
8246
8277
  const path = storePath(env);
8247
8278
  if (!existsSync9(path))
8248
8279
  return { path, exists: false };
8249
8280
  const checked = await storeHealth(path, { deep });
8281
+ const recorded = deep ? recordDeepCheck(path, checked, {
8282
+ cli: command ?? "unknown",
8283
+ ...version ? { version } : {},
8284
+ schema: await fileSchema(path)
8285
+ }) : null;
8286
+ const mark = readDamageMark(path);
8287
+ const lastKnownGood = readHealthMark(path)?.last_ok_at ?? null;
8250
8288
  const health = {
8251
8289
  checked: checked.checked,
8252
8290
  covers: deep ? "every page and every search index" : QUICK_HEALTH_CHECKS,
@@ -8257,18 +8295,24 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command }
8257
8295
  ...checked.invalidJson?.length ? { invalidJson: checked.invalidJson } : {},
8258
8296
  ...checked.searchIndexes?.some((index) => !index.ok) ? { damagedSearchIndexes: checked.searchIndexes.filter((index) => !index.ok).map((index) => index.name) } : {}
8259
8297
  };
8260
- const damage = command ? explainDamage(checked, command) : null;
8261
- const healthOf = { health, ...damage ? { damage } : {} };
8298
+ const damage = command ? explainDamage(checked, command, mark) : null;
8299
+ const healthOf = {
8300
+ health,
8301
+ lastKnownGood,
8302
+ ...mark ? { damageMark: withoutInode(mark) } : {},
8303
+ ...recorded?.cleared ? { damageMarkCleared: withoutInode(recorded.cleared) } : {},
8304
+ ...damage ? { damage } : {}
8305
+ };
8262
8306
  try {
8263
8307
  return await reading(path, (database) => {
8264
- const { version, writable } = schemaOf(database);
8308
+ const { version: version2, writable } = schemaOf(database);
8265
8309
  return {
8266
8310
  path,
8267
8311
  exists: true,
8268
- schema: version,
8312
+ schema: version2,
8269
8313
  speaks: SPEAKS,
8270
8314
  writable,
8271
- ...version > 0 ? { chats: count2(database, "chats"), messages: count2(database, "messages") } : {},
8315
+ ...version2 > 0 ? { chats: count2(database, "chats"), messages: count2(database, "messages") } : {},
8272
8316
  ...healthOf
8273
8317
  };
8274
8318
  });
@@ -8,12 +8,12 @@ import {
8
8
  ACCESS_SECONDS,
9
9
  REFRESH_SECONDS,
10
10
  readStored
11
- } from "./chunk-7ERCJWNL.js";
11
+ } from "./chunk-SCIC2CJS.js";
12
12
  import {
13
13
  __name
14
14
  } from "./chunk-ZVVMGPBJ.js";
15
15
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/mcp/http/oauth.js
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/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";
@@ -7,7 +7,7 @@ import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/store/path.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/path.js
11
11
  import { userInfo } from "node:os";
12
12
  import { isAbsolute, join, relative, resolve } from "node:path";
13
13
  var wirecatDirectory = /* @__PURE__ */ __name((env = process.env, platform) => resolvePaths({ appName: "WireCat", prefix: "WIRECAT", env, ...platform ? { platform } : {} }).state, "wirecatDirectory");
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_53afa6060d8ea71d32941ef81a17e026/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/shared-55XJMTPA.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/shared-55XJMTPA.js
8
8
  var entityKind = /* @__PURE__ */ Symbol.for("drizzle:entityKind");
9
9
  var kindsByConstructor = /* @__PURE__ */ new WeakMap();
10
10
  function collectKinds(ctor) {