@wirecat/drive-cli 0.62.0 → 0.63.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 (111) hide show
  1. package/dist/bin/drive.js +2 -2
  2. package/dist/bundle/{all-profiles-CKD2DWUK.js → all-profiles-GZJS3UKC.js} +6 -7
  3. package/dist/bundle/{anthropic-E3T4USLA.js → anthropic-RGV3WXX5.js} +3 -3
  4. package/dist/bundle/{app-server-JB2AEWWL.js → app-server-AA2PJ7PV.js} +40 -41
  5. package/dist/bundle/{bun-CC44AAND.js → bun-OXZYIA3R.js} +2 -2
  6. package/dist/bundle/{bun-sqlite-AUMFKYVR.js → bun-sqlite-D45NSDM3.js} +2 -2
  7. package/dist/bundle/{chunk-WZKEU7WR.js → chunk-2NIC72HH.js} +1 -1
  8. package/dist/bundle/{chunk-HCNQT3QE.js → chunk-2TDUGC5D.js} +331 -280
  9. package/dist/bundle/{chunk-DWJHL6DV.js → chunk-2TFXK3R4.js} +4 -4
  10. package/dist/bundle/{chunk-PEQA6LA5.js → chunk-33MGFUED.js} +169 -140
  11. package/dist/bundle/{chunk-YPFUYQDP.js → chunk-3BZRKLJ6.js} +12 -12
  12. package/dist/bundle/{chunk-YALI4C7C.js → chunk-3HK5WMI5.js} +5 -5
  13. package/dist/bundle/{chunk-R347FPYU.js → chunk-3QINVLZI.js} +1 -1
  14. package/dist/bundle/{chunk-LQKD257P.js → chunk-44SBK6KB.js} +938 -532
  15. package/dist/bundle/{chunk-XZUS7XRO.js → chunk-4CIZWCXV.js} +1 -1
  16. package/dist/bundle/{chunk-XS5POQST.js → chunk-4S4JMW6I.js} +1 -1
  17. package/dist/bundle/{chunk-YMWENGKH.js → chunk-534OBX5Y.js} +1 -1
  18. package/dist/bundle/{chunk-4SIZEJ3M.js → chunk-5PPL7JDM.js} +1 -1
  19. package/dist/bundle/{chunk-L7K2MOIC.js → chunk-6KQJSFYF.js} +18 -18
  20. package/dist/bundle/{chunk-VAYB52HF.js → chunk-6MQSQ4LX.js} +20 -20
  21. package/dist/bundle/{chunk-DJOAMGF4.js → chunk-7EMQ26BA.js} +9 -9
  22. package/dist/bundle/{chunk-TDX4GZFO.js → chunk-ABYGSJZ4.js} +4 -4
  23. package/dist/bundle/{chunk-FNWIJ6EJ.js → chunk-AEX37ETW.js} +1 -1
  24. package/dist/bundle/{chunk-SVPCHFKI.js → chunk-BKYMKVHT.js} +2 -2
  25. package/dist/bundle/{chunk-OBH5BA62.js → chunk-CE2TJBLP.js} +2 -2
  26. package/dist/bundle/{chunk-QTI6IVHZ.js → chunk-DJ3SDJZY.js} +6 -6
  27. package/dist/bundle/{chunk-XFRRKZHQ.js → chunk-DJHLVUL6.js} +16 -13
  28. package/dist/bundle/{chunk-JK3U25QZ.js → chunk-E4SDKMBJ.js} +59 -1
  29. package/dist/bundle/{chunk-HG6CAYJH.js → chunk-FRIJUILO.js} +2 -2
  30. package/dist/bundle/{chunk-RPMKG63Z.js → chunk-HZZCEQTH.js} +3 -3
  31. package/dist/bundle/{chunk-YXYTY4GF.js → chunk-J24ZFCWM.js} +16 -16
  32. package/dist/bundle/{chunk-E43ENLJJ.js → chunk-J4DIHPZ6.js} +1 -1
  33. package/dist/bundle/{chunk-SW4I5BR7.js → chunk-L37LMMRJ.js} +1 -1
  34. package/dist/bundle/{chunk-Q2LRPOKL.js → chunk-LMAVCYLQ.js} +3 -3
  35. package/dist/bundle/{chunk-T7X53FCJ.js → chunk-LZEOQW7S.js} +31 -31
  36. package/dist/bundle/{chunk-T5NWWXS2.js → chunk-MOTRI3SY.js} +1 -1
  37. package/dist/bundle/{chunk-ONP2IBHY.js → chunk-ND6LLYGF.js} +97 -80
  38. package/dist/bundle/{chunk-2KN35F32.js → chunk-NEFSGCVA.js} +8 -8
  39. package/dist/bundle/{chunk-JN5TVEEL.js → chunk-OXY6SSZG.js} +101 -14
  40. package/dist/bundle/{chunk-W4RTIL7S.js → chunk-PDCCYHCH.js} +2 -2
  41. package/dist/bundle/{chunk-AH5C3D3D.js → chunk-PO5RQQIG.js} +4 -4
  42. package/dist/bundle/{chunk-CZ2GJHLL.js → chunk-Q5DJTRKV.js} +2 -2
  43. package/dist/bundle/{chunk-O7ALBI2I.js → chunk-RKELRWH7.js} +3 -3
  44. package/dist/bundle/{chunk-67ZQCWBV.js → chunk-S4RXABDR.js} +2 -2
  45. package/dist/bundle/{chunk-QCX6XZLA.js → chunk-SXM6MHRR.js} +9 -9
  46. package/dist/bundle/{chunk-RIDQNVZM.js → chunk-TF23BZW5.js} +2 -2
  47. package/dist/bundle/{chunk-N7OZPKU7.js → chunk-TWUH22Z5.js} +1 -1
  48. package/dist/bundle/chunk-UPOSDTPT.js +87 -0
  49. package/dist/bundle/{chunk-CJHY5YIF.js → chunk-V3NVXIQR.js} +353 -114
  50. package/dist/bundle/{chunk-QH7DOVO3.js → chunk-VAUMOZU5.js} +44 -28
  51. package/dist/bundle/{chunk-VQDD64A4.js → chunk-VJEOGKAN.js} +7 -9
  52. package/dist/bundle/{chunk-MN4VXU3M.js → chunk-VKPCONDQ.js} +3 -3
  53. package/dist/bundle/{chunk-LWE4JGRN.js → chunk-WYGWWHZP.js} +2 -2
  54. package/dist/bundle/{chunk-EW7PKB4M.js → chunk-XDC3TWTL.js} +25 -25
  55. package/dist/bundle/{chunk-KLFSRKHB.js → chunk-XIUDS3OK.js} +1 -1
  56. package/dist/bundle/{chunk-U2BFYSQV.js → chunk-XNVFKMVR.js} +8559 -3343
  57. package/dist/bundle/{chunk-IR4SQLBR.js → chunk-XR6ESRU6.js} +1 -1
  58. package/dist/bundle/{chunk-RWSXVCSG.js → chunk-Y6GNA7HE.js} +2 -2
  59. package/dist/bundle/{chunk-7ZXIWZQ6.js → chunk-YGU6ULU5.js} +10 -10
  60. package/dist/bundle/{chunk-UGXN5D7U.js → chunk-YIP7ELON.js} +108 -62
  61. package/dist/bundle/{chunk-XEW2EN6F.js → chunk-Z42YYLTS.js} +31 -23
  62. package/dist/bundle/{chunk-DRZZBN3V.js → chunk-Z5KC7XBR.js} +1 -1
  63. package/dist/bundle/{chunk-7W5HYGVW.js → chunk-ZM5J6ZMB.js} +1 -1
  64. package/dist/bundle/{chunk-YOJDGAPT.js → chunk-ZOJU7ZFI.js} +7 -7
  65. package/dist/bundle/{command-contract-OB5BRABN.js → command-contract-BRW3AP44.js} +13 -14
  66. package/dist/bundle/{decode-WIIX3Y2X.js → decode-G5YEIPNC.js} +2 -2
  67. package/dist/bundle/drive.js +3 -3
  68. package/dist/bundle/{echarts-OYINM4C4.js → echarts-W2CWHNXR.js} +2 -2
  69. package/dist/bundle/{embed-DWZIYMBX.js → embed-OBFFPVF4.js} +3 -3
  70. package/dist/bundle/{embedder-ILWH7ZRM.js → embedder-NGCBQHIG.js} +6 -6
  71. package/dist/bundle/{entry-V5V3TOTY.js → entry-ET6HGM7A.js} +5 -5
  72. package/dist/bundle/{first-run-V3VVLQF4.js → first-run-JG52UZVO.js} +5 -5
  73. package/dist/bundle/{first-screen-Y3RIN7FU.js → first-screen-CIL3GFAA.js} +14 -15
  74. package/dist/bundle/{google-KLZSUAVY.js → google-CIWUVJ5C.js} +4 -4
  75. package/dist/bundle/{google-api-HZQ5R4ZO.js → google-api-Z3NSTBBR.js} +44 -45
  76. package/dist/bundle/{grants-L7XLHLUT.js → grants-3S4RL3WB.js} +49 -50
  77. package/dist/bundle/{identity-J2DON4IO.js → identity-OM6GFZ7T.js} +1 -1
  78. package/dist/bundle/{instructions-HGOJ23AJ.js → instructions-YQBQSYSS.js} +1 -1
  79. package/dist/bundle/{login-BD2TS4GY.js → login-7RYSDVN3.js} +48 -49
  80. package/dist/bundle/{node-CPKTDPH7.js → node-IVU33RL7.js} +2 -2
  81. package/dist/bundle/{node-sqlite-IXDCRLSX.js → node-sqlite-SIH5BEW2.js} +3 -3
  82. package/dist/bundle/{oauth-HOGY4YBB.js → oauth-PT4JEHLL.js} +4 -4
  83. package/dist/bundle/{open-O7P3ZV3Y.js → open-IAO2SNII.js} +2 -2
  84. package/dist/bundle/{openai-RCFQKCXC.js → openai-SGOUBHXP.js} +10 -10
  85. package/dist/bundle/{process-KXDRJO22.js → process-BPBMV3AT.js} +1 -1
  86. package/dist/bundle/{program-UCHFC7JQ.js → program-MYKKJ4F6.js} +68 -67
  87. package/dist/bundle/{prompt-EVPPBN5W.js → prompt-3ZM64DCB.js} +2 -2
  88. package/dist/bundle/{recognize-MRCYGP2J.js → recognize-A5C5RPB3.js} +1 -1
  89. package/dist/bundle/{remote-L3L4PHKF.js → remote-VWYFLRGO.js} +4 -4
  90. package/dist/bundle/{rerank-PSOE6XFT.js → rerank-4NGQWREA.js} +4 -4
  91. package/dist/bundle/{serve-72OGS3BF.js → serve-Y6LQTFH5.js} +6 -6
  92. package/dist/bundle/{server-SCXKYHBO.js → server-6AUHIIUA.js} +32 -33
  93. package/dist/bundle/server-PFHI35HA.js +69 -0
  94. package/dist/bundle/{services-YAFTELBI.js → services-2W4J7EMW.js} +26 -21
  95. package/dist/bundle/{sqlite-runtime-DLK4SU33.js → sqlite-runtime-P6BBDX2H.js} +3 -3
  96. package/dist/bundle/{state-T5VNAJSZ.js → state-PXKKXR3R.js} +3 -3
  97. package/dist/bundle/{store-R6MSY2IM.js → store-CN6JEUC4.js} +18 -10
  98. package/dist/bundle/{store-4OFK7PKQ.js → store-IVV2BAGZ.js} +42 -12
  99. package/dist/bundle/store-maintenance-command-MSY2QNEH.js +59 -0
  100. package/dist/bundle/tokens-P4LPNUFW.js +102 -0
  101. package/dist/commands/config.d.ts.map +1 -1
  102. package/dist/commands/config.js +5 -1
  103. package/dist/commands/config.js.map +1 -1
  104. package/dist/version.d.ts +1 -1
  105. package/dist/version.js +1 -1
  106. package/package.json +2 -2
  107. package/dist/bundle/chunk-AQVUEZEP.js +0 -22
  108. package/dist/bundle/chunk-UOXOLGNG.js +0 -42
  109. package/dist/bundle/server-C5TGNFXW.js +0 -70
  110. package/dist/bundle/store-maintenance-command-QDMCXGV6.js +0 -60
  111. package/dist/bundle/tokens-HIG36RNS.js +0 -103
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  answerOf,
5
5
  messengerContext
6
- } from "./chunk-EW7PKB4M.js";
6
+ } from "./chunk-XDC3TWTL.js";
7
7
  import {
8
8
  chatEventAnswer,
9
9
  memberAnswer,
@@ -12,7 +12,7 @@ import {
12
12
  serveRelay,
13
13
  typedQuery,
14
14
  withQuery
15
- } from "./chunk-YXYTY4GF.js";
15
+ } from "./chunk-J24ZFCWM.js";
16
16
  import {
17
17
  stringWidth,
18
18
  wrapAnsi
@@ -40,24 +40,24 @@ import {
40
40
  snakeKeys,
41
41
  storeTable,
42
42
  withoutProviderRefs
43
- } from "./chunk-PEQA6LA5.js";
43
+ } from "./chunk-33MGFUED.js";
44
44
  import {
45
45
  envName
46
- } from "./chunk-7W5HYGVW.js";
46
+ } from "./chunk-ZM5J6ZMB.js";
47
47
  import {
48
48
  holdLock,
49
49
  lockPath,
50
50
  releaseLock,
51
51
  servingProfiles,
52
52
  takeLock
53
- } from "./chunk-HG6CAYJH.js";
53
+ } from "./chunk-FRIJUILO.js";
54
54
  import {
55
55
  holdersOf
56
- } from "./chunk-YMWENGKH.js";
56
+ } from "./chunk-534OBX5Y.js";
57
57
  import {
58
58
  checkedOptions,
59
59
  range
60
- } from "./chunk-DRZZBN3V.js";
60
+ } from "./chunk-Z5KC7XBR.js";
61
61
  import {
62
62
  FETCHING,
63
63
  RULES_VERSION,
@@ -69,30 +69,29 @@ import {
69
69
  patiently,
70
70
  senderIsMe,
71
71
  servicesFor,
72
- syncsOneChat,
72
+ syncsOneChat
73
+ } from "./chunk-44SBK6KB.js";
74
+ import {
73
75
  withTimeLimit
74
- } from "./chunk-LQKD257P.js";
76
+ } from "./chunk-ND6LLYGF.js";
75
77
  import {
76
78
  codeOf,
77
79
  currentRun,
78
80
  levelFor,
79
81
  parseDuration
80
- } from "./chunk-VAYB52HF.js";
81
- import {
82
- failureKey
83
- } from "./chunk-AQVUEZEP.js";
82
+ } from "./chunk-6MQSQ4LX.js";
84
83
  import {
85
84
  messagesFor,
86
85
  systemFor,
87
86
  validateImages
88
- } from "./chunk-T5NWWXS2.js";
87
+ } from "./chunk-MOTRI3SY.js";
89
88
  import {
90
89
  QUICK_HEALTH_CHECKS,
91
90
  explainDamage,
92
91
  fts5Tables,
93
92
  invalidJson,
94
93
  storeHealth
95
- } from "./chunk-QH7DOVO3.js";
94
+ } from "./chunk-VAUMOZU5.js";
96
95
  import {
97
96
  CORPORA,
98
97
  MIGRATIONS,
@@ -128,19 +127,28 @@ import {
128
127
  storeClients,
129
128
  storeContents,
130
129
  vectorIndexCounts
131
- } from "./chunk-U2BFYSQV.js";
130
+ } from "./chunk-XNVFKMVR.js";
131
+ import {
132
+ readDamageMark,
133
+ readHealthMark,
134
+ recordDeepCheck
135
+ } from "./chunk-V3NVXIQR.js";
132
136
  import {
133
137
  queryFieldsOf
134
138
  } from "./chunk-EOOGWUTP.js";
139
+ import {
140
+ failureKey,
141
+ isStoreDamage
142
+ } from "./chunk-E4SDKMBJ.js";
135
143
  import {
136
144
  storePath
137
- } from "./chunk-FNWIJ6EJ.js";
145
+ } from "./chunk-AEX37ETW.js";
138
146
  import {
139
147
  openCache
140
- } from "./chunk-YALI4C7C.js";
148
+ } from "./chunk-3HK5WMI5.js";
141
149
  import {
142
150
  readSecret
143
- } from "./chunk-RWSXVCSG.js";
151
+ } from "./chunk-Y6GNA7HE.js";
144
152
  import {
145
153
  Credentials,
146
154
  pathsAreOverridden,
@@ -5517,11 +5525,11 @@ var require_liquid_node = __commonJS({
5517
5525
  }
5518
5526
  });
5519
5527
 
5520
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5528
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5521
5529
  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";
5522
5530
  import { dirname as dirname2, resolve } from "node:path";
5523
5531
 
5524
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/sealed.js
5532
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/sealed.js
5525
5533
  import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
5526
5534
  import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
5527
5535
  import { Transform } from "node:stream";
@@ -5628,7 +5636,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
5628
5636
  renameSync(pending, to);
5629
5637
  }, "unsealFile");
5630
5638
 
5631
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5639
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5632
5640
  var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
5633
5641
  var fileSchemaOf = /* @__PURE__ */ __name((database) => {
5634
5642
  const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
@@ -5652,7 +5660,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
5652
5660
  };
5653
5661
  }, "compatibilityOf");
5654
5662
 
5655
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/repair.js
5663
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/repair.js
5656
5664
  import { createHash as createHash2 } from "node:crypto";
5657
5665
  var COPY_MARK = "__repair_";
5658
5666
  var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
@@ -5906,13 +5914,13 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
5906
5914
  return found;
5907
5915
  }, "deleteCopy");
5908
5916
 
5909
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5917
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5910
5918
  import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
5911
5919
 
5912
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5920
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5913
5921
  import { existsSync as existsSync3 } from "node:fs";
5914
5922
 
5915
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/recover.js
5923
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/recover.js
5916
5924
  import { execFileSync, spawn } from "node:child_process";
5917
5925
  import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
5918
5926
  import { basename, dirname, join } from "node:path";
@@ -6210,7 +6218,14 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6210
6218
  }, "stopWatching");
6211
6219
  try {
6212
6220
  const dataVersion = /* @__PURE__ */ __name(() => Number(watch.prepare("PRAGMA data_version").get()?.data_version), "dataVersion");
6213
- const rowsBefore = tableRows(watch);
6221
+ let rowsBefore;
6222
+ try {
6223
+ rowsBefore = tableRows(watch);
6224
+ } catch (error) {
6225
+ if (!isStoreDamage(error))
6226
+ throw error;
6227
+ 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" });
6228
+ }
6214
6229
  const before = { data: dataVersion(), inode: statSync2(path).ino };
6215
6230
  const stamp = new Date(now()).toISOString().replace(/[:.]/g, "-");
6216
6231
  const target = `${path}.recovering-${stamp}`;
@@ -6238,6 +6253,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6238
6253
  let dangling;
6239
6254
  let json;
6240
6255
  let fetch2;
6256
+ let schema;
6241
6257
  try {
6242
6258
  kept = tableRows(opened.database);
6243
6259
  migrate(opened.database, { command, ...version ? { version } : {} });
@@ -6247,6 +6263,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6247
6263
  note("looking for rows that point at rows that were lost");
6248
6264
  dangling = danglingRows(opened.database);
6249
6265
  fetch2 = mailToFetch(opened.database);
6266
+ schema = fileSchemaOf(opened.database).version;
6250
6267
  opened.database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
6251
6268
  } catch (error) {
6252
6269
  opened.database.close();
@@ -6274,6 +6291,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6274
6291
  for (const suffix of STORE_PARTS)
6275
6292
  if (existsSync2(`${target}${suffix}`))
6276
6293
  renameSync2(`${target}${suffix}`, `${path}${suffix}`);
6294
+ recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema, now });
6277
6295
  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);
6278
6296
  const seconds = /* @__PURE__ */ __name((from, to) => Math.round((to - from) / 100) / 10, "seconds");
6279
6297
  return {
@@ -6299,7 +6317,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6299
6317
  }
6300
6318
  }, "recoverLocked");
6301
6319
 
6302
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6320
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6303
6321
  var COUNTED = [
6304
6322
  "accounts",
6305
6323
  "chats",
@@ -6314,15 +6332,17 @@ var COUNTED = [
6314
6332
  "mentions"
6315
6333
  ];
6316
6334
  var stopTimers = /* @__PURE__ */ __name((timers) => `systemctl --user stop ${timers.join(" ")}`, "stopTimers");
6317
- var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
6335
+ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) => {
6318
6336
  const path = storePath(env);
6319
6337
  if (!existsSync3(path))
6320
6338
  return { path, exists: false, ok: true, next: [] };
6321
6339
  const health = await storeHealth(path, { deep: true });
6322
6340
  let rows = {};
6341
+ let schema = null;
6323
6342
  try {
6324
6343
  const { database } = await openSqlite(path, { readOnly: true });
6325
6344
  try {
6345
+ schema = fileSchemaOf(database).version;
6326
6346
  const all = tableRows(database);
6327
6347
  rows = Object.fromEntries(COUNTED.filter((table) => table in all).map((table) => [table, all[table] ?? null]));
6328
6348
  } finally {
@@ -6330,7 +6350,9 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
6330
6350
  }
6331
6351
  } catch {
6332
6352
  }
6333
- const explanation = explainDamage(health, command);
6353
+ recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema });
6354
+ const mark = readDamageMark(path);
6355
+ const explanation = explainDamage(health, command, mark);
6334
6356
  const inUse = storeHolders(path) ?? null;
6335
6357
  const timers = activeTimers() ?? null;
6336
6358
  const sqlite3 = sqlite3Program();
@@ -6351,6 +6373,8 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
6351
6373
  invalidJson: health.invalidJson ?? [],
6352
6374
  rows,
6353
6375
  explanation,
6376
+ damageMark: mark ? (({ inode: _, ...seen }) => seen)(mark) : null,
6377
+ lastKnownGood: readHealthMark(path)?.last_ok_at ?? null,
6354
6378
  inUse,
6355
6379
  timers,
6356
6380
  sqlite3: { version: sqlite3.version, usable: sqlite3.usable },
@@ -6398,13 +6422,14 @@ var recoveryNotes = /* @__PURE__ */ __name((answer) => {
6398
6422
  const why = answer.explanation;
6399
6423
  return [
6400
6424
  ...why ? [why.what, ...why.impact, why.externalUnaffected] : [],
6425
+ answer.lastKnownGood ? `the store last passed a deep check at ${answer.lastKnownGood}` : "no deep check that passed is on record for this store",
6401
6426
  ...answer.next.map((line) => `next: ${line}`)
6402
6427
  ];
6403
6428
  }, "recoveryNotes");
6404
6429
  var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
6405
6430
  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() {
6406
6431
  const output = outputFor(this);
6407
- const answer = await storeRecoveryCheck(environmentOf(this).env ?? process.env, command);
6432
+ const answer = await storeRecoveryCheck(environmentOf(this).env ?? process.env, command, version);
6408
6433
  renderAnswer(this, output, itemOf(snakeKeys(answer)));
6409
6434
  if (output.format === "pretty")
6410
6435
  for (const line of recoveryNotes(answer))
@@ -6425,7 +6450,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
6425
6450
  return recover;
6426
6451
  }, "storeRecoverCommand");
6427
6452
 
6428
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6453
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6429
6454
  var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
6430
6455
  var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
6431
6456
  var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
@@ -6471,7 +6496,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
6471
6496
  renderAnswer(this, outputFor(this), itemOf(answer));
6472
6497
  }), "storeInfoCommand");
6473
6498
 
6474
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6499
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6475
6500
  var ENCRYPT_OPTION = [
6476
6501
  "--encrypt",
6477
6502
  "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"
@@ -6490,7 +6515,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
6490
6515
  return password;
6491
6516
  }, "passwordOf");
6492
6517
 
6493
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/replies/rules.js
6518
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/replies/rules.js
6494
6519
  import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
6495
6520
  import { join as join2 } from "node:path";
6496
6521
  var REPLY_ACTIONS = ["reply", "task"];
@@ -6661,7 +6686,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
6661
6686
  }, "problem");
6662
6687
  var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
6663
6688
 
6664
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/replies/state.js
6689
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/replies/state.js
6665
6690
  import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
6666
6691
  import { join as join3 } from "node:path";
6667
6692
  var ANSWERED_KEPT = 1e3;
@@ -6714,7 +6739,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
6714
6739
  }, "recordReply");
6715
6740
  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");
6716
6741
 
6717
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/replies/decide.js
6742
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/replies/decide.js
6718
6743
  var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
6719
6744
  var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
6720
6745
  const { message, chat, owner, sender } = incoming;
@@ -6820,7 +6845,7 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
6820
6845
  return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
6821
6846
  }, "filled");
6822
6847
 
6823
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/replies/template.js
6848
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/replies/template.js
6824
6849
  var import_liquidjs = __toESM(require_liquid_node(), 1);
6825
6850
  var TEMPLATE_LIMITS = {
6826
6851
  parse: 32768,
@@ -6980,7 +7005,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
6980
7005
  }
6981
7006
  }, "renderReplyTemplate");
6982
7007
 
6983
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
7008
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
6984
7009
  var DRY_RUN_DAYS = 7;
6985
7010
  var PAGE = 500;
6986
7011
  var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
@@ -7094,7 +7119,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
7094
7119
  }
7095
7120
  }, "storedSince");
7096
7121
 
7097
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
7122
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
7098
7123
  var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
7099
7124
  const host = new URL(baseUrl).host;
7100
7125
  return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
@@ -7125,7 +7150,7 @@ var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) =>
7125
7150
  };
7126
7151
  }, "embeddingKeys");
7127
7152
 
7128
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/models/openai.js
7153
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/models/openai.js
7129
7154
  var options = strictObject({
7130
7155
  temperature: range(0, 2),
7131
7156
  top_p: range(0, 1),
@@ -7174,7 +7199,7 @@ var openai = {
7174
7199
  }), "complete")
7175
7200
  };
7176
7201
 
7177
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/models/index.js
7202
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/models/index.js
7178
7203
  var modelGateway = /* @__PURE__ */ __name((deps) => ({
7179
7204
  complete: /* @__PURE__ */ __name(async (request) => {
7180
7205
  if (deps.signal?.aborted)
@@ -7189,7 +7214,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
7189
7214
  if (!adapter && target.provider === "openai")
7190
7215
  adapter = openai;
7191
7216
  if (!adapter && target.provider === "anthropic")
7192
- adapter = (await import("./anthropic-E3T4USLA.js")).anthropic;
7217
+ adapter = (await import("./anthropic-RGV3WXX5.js")).anthropic;
7193
7218
  if (!adapter)
7194
7219
  throw new CliError("validation_error", `no model adapter for ${target.provider}`);
7195
7220
  if (request.images !== void 0 && adapter.images !== true)
@@ -7230,7 +7255,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
7230
7255
  }, "complete")
7231
7256
  }), "modelGateway");
7232
7257
 
7233
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/replies/consents.js
7258
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/replies/consents.js
7234
7259
  import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
7235
7260
  import { join as join4 } from "node:path";
7236
7261
  var shape = strictObject({
@@ -7255,7 +7280,7 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
7255
7280
  return consent.provider === provider && !consent.deniedChats.includes(chat);
7256
7281
  }, "mayModelReply");
7257
7282
 
7258
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7283
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7259
7284
  var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options2 = {
7260
7285
  ai: true
7261
7286
  }) => async (rule2, message, chat, now) => {
@@ -7302,7 +7327,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
7302
7327
  return result2;
7303
7328
  }, "replyRenderer");
7304
7329
 
7305
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/replies/serve.js
7330
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/replies/serve.js
7306
7331
  var NOT_ALLOWED = "replies.send is not allow";
7307
7332
  var NO_RULES = "no rules";
7308
7333
  var ONLY_TASK = "opened a task, sent nothing";
@@ -7395,7 +7420,7 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
7395
7420
  return { skip: why };
7396
7421
  }, "replyTo");
7397
7422
 
7398
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7423
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7399
7424
  var START_SYNC_DELAY_MS = 3e4;
7400
7425
  var START_SYNC_BUDGET_MS = 5 * 6e4;
7401
7426
  var START_SYNC_WINDOW_MS = 7 * 864e5;
@@ -7472,7 +7497,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note
7472
7497
  };
7473
7498
  }, "startSync");
7474
7499
 
7475
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7500
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7476
7501
  var FIRST_FETCH_MS = 6e4;
7477
7502
  var DAY_MS = 864e5;
7478
7503
  var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
@@ -7526,7 +7551,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
7526
7551
  };
7527
7552
  }, "memberFetches");
7528
7553
 
7529
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7554
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7530
7555
  var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
7531
7556
  var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
7532
7557
  if (context.format === "pretty") {
@@ -7559,7 +7584,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
7559
7584
  return context;
7560
7585
  }, "recordDiagnostics");
7561
7586
 
7562
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7587
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7563
7588
  var STEMS_EVERY_MS = 3e4;
7564
7589
  var STEMS_SLICE_MS = 2e3;
7565
7590
  var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
@@ -7599,7 +7624,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
7599
7624
  };
7600
7625
  }, "stemFills");
7601
7626
 
7602
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/render/messages.js
7627
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/render/messages.js
7603
7628
  import { styleText } from "node:util";
7604
7629
  var TIME_WIDTH = 8;
7605
7630
  var INDENT = " ".repeat(TIME_WIDTH + 2);
@@ -7775,7 +7800,7 @@ var editedAt = /* @__PURE__ */ __name((message, options2) => {
7775
7800
  return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
7776
7801
  }, "editedAt");
7777
7802
 
7778
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7803
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7779
7804
  var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
7780
7805
  var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7781
7806
  kind: attachment.kind,
@@ -7870,7 +7895,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
7870
7895
  locale: messenger.app.locale
7871
7896
  }), "viewOf");
7872
7897
 
7873
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7898
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7874
7899
  var observed = /* @__PURE__ */ __name((value) => ({
7875
7900
  value: value.value,
7876
7901
  observed_at: value.observedAt,
@@ -7937,7 +7962,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
7937
7962
  }
7938
7963
  }, "watchEventItem");
7939
7964
 
7940
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7965
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7941
7966
  var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
7942
7967
  output: { entity: "watch_item" },
7943
7968
  effects: REMOTE_READ,
@@ -8092,7 +8117,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
8092
8117
  }
8093
8118
  }, "describe");
8094
8119
 
8095
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8120
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8096
8121
  var serveCommand = /* @__PURE__ */ __name((messenger) => {
8097
8122
  const command = annotate(new Command("serve"), {
8098
8123
  output: { entity: "serve_summary" },
@@ -8356,7 +8381,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
8356
8381
  };
8357
8382
  }, "tasking");
8358
8383
 
8359
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8384
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8360
8385
  import { existsSync as existsSync8 } from "node:fs";
8361
8386
  var PATH = "store tables list";
8362
8387
  var STORE_TABLES_QUERY = {
@@ -8399,7 +8424,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
8399
8424
  return tables;
8400
8425
  }, "storeTablesCommand");
8401
8426
 
8402
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8427
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8403
8428
  var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
8404
8429
  var WORD_INDEX = "message_words";
8405
8430
  var schemaOf = /* @__PURE__ */ __name((database) => {
@@ -8425,11 +8450,26 @@ var readingOnly = /* @__PURE__ */ __name(async (path, read) => {
8425
8450
  database.close();
8426
8451
  }
8427
8452
  }, "readingOnly");
8428
- var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command } = {}) => {
8453
+ var withoutInode = /* @__PURE__ */ __name(({ inode: _, ...mark }) => mark, "withoutInode");
8454
+ var fileSchema = /* @__PURE__ */ __name(async (path) => {
8455
+ try {
8456
+ return await readingOnly(path, (database) => fileSchemaOf(database).version);
8457
+ } catch {
8458
+ return null;
8459
+ }
8460
+ }, "fileSchema");
8461
+ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, version } = {}) => {
8429
8462
  const path = storePath(env);
8430
8463
  if (!existsSync9(path))
8431
8464
  return { path, exists: false };
8432
8465
  const checked = await storeHealth(path, { deep });
8466
+ const recorded = deep ? recordDeepCheck(path, checked, {
8467
+ cli: command ?? "unknown",
8468
+ ...version ? { version } : {},
8469
+ schema: await fileSchema(path)
8470
+ }) : null;
8471
+ const mark = readDamageMark(path);
8472
+ const lastKnownGood = readHealthMark(path)?.last_ok_at ?? null;
8433
8473
  const health = {
8434
8474
  checked: checked.checked,
8435
8475
  covers: deep ? "every page and every search index" : QUICK_HEALTH_CHECKS,
@@ -8440,18 +8480,24 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command }
8440
8480
  ...checked.invalidJson?.length ? { invalidJson: checked.invalidJson } : {},
8441
8481
  ...checked.searchIndexes?.some((index) => !index.ok) ? { damagedSearchIndexes: checked.searchIndexes.filter((index) => !index.ok).map((index) => index.name) } : {}
8442
8482
  };
8443
- const damage = command ? explainDamage(checked, command) : null;
8444
- const healthOf = { health, ...damage ? { damage } : {} };
8483
+ const damage = command ? explainDamage(checked, command, mark) : null;
8484
+ const healthOf = {
8485
+ health,
8486
+ lastKnownGood,
8487
+ ...mark ? { damageMark: withoutInode(mark) } : {},
8488
+ ...recorded?.cleared ? { damageMarkCleared: withoutInode(recorded.cleared) } : {},
8489
+ ...damage ? { damage } : {}
8490
+ };
8445
8491
  try {
8446
8492
  return await reading(path, (database) => {
8447
- const { version, writable } = schemaOf(database);
8493
+ const { version: version2, writable } = schemaOf(database);
8448
8494
  return {
8449
8495
  path,
8450
8496
  exists: true,
8451
- schema: version,
8497
+ schema: version2,
8452
8498
  speaks: SPEAKS,
8453
8499
  writable,
8454
- ...version > 0 ? { chats: count2(database, "chats"), messages: count2(database, "messages") } : {},
8500
+ ...version2 > 0 ? { chats: count2(database, "chats"), messages: count2(database, "messages") } : {},
8455
8501
  ...healthOf
8456
8502
  };
8457
8503
  });