@wirecat/cli-memo 0.131.47 → 0.131.49

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 (163) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/memo.js +2 -2
  3. package/dist/bundle/{all-profiles-75EGCXK3.js → all-profiles-3HADTQZA.js} +9 -9
  4. package/dist/bundle/{anthropic-PTAYBCPR.js → anthropic-RI4DWC3G.js} +6 -6
  5. package/dist/bundle/{app-server-YSUBXGGB.js → app-server-6EKWAYJI.js} +42 -42
  6. package/dist/bundle/auto-NKUBNWLS.js +86 -0
  7. package/dist/bundle/{bun-3AIG5ML4.js → bun-HUHQD76Z.js} +2 -2
  8. package/dist/bundle/{bun-sqlite-5FCGI6EO.js → bun-sqlite-RPSKGB4O.js} +5 -5
  9. package/dist/bundle/{chunk-3HPFTKDH.js → chunk-2HPYP3ZT.js} +4 -4
  10. package/dist/bundle/{chunk-KLBZJZD2.js → chunk-2OIGV355.js} +216 -143
  11. package/dist/bundle/{chunk-R44PUK7G.js → chunk-355PHJYX.js} +1 -1
  12. package/dist/bundle/{chunk-F4HMPMET.js → chunk-3BG5VYMV.js} +10 -10
  13. package/dist/bundle/{chunk-5N6HWFXN.js → chunk-4VQPPX47.js} +350 -295
  14. package/dist/bundle/{chunk-PGVADNDD.js → chunk-57LMWEDK.js} +3 -3
  15. package/dist/bundle/{chunk-ELKK5M66.js → chunk-5JVA43HX.js} +6 -6
  16. package/dist/bundle/{chunk-U35N3EC7.js → chunk-5RVL7GYA.js} +2 -2
  17. package/dist/bundle/{chunk-BNIWLVWG.js → chunk-6N6BVPVX.js} +18 -4
  18. package/dist/bundle/{chunk-JY34MQW4.js → chunk-7RNHFNHX.js} +4 -4
  19. package/dist/bundle/{chunk-HCZV537M.js → chunk-AKD62EUH.js} +2 -2
  20. package/dist/bundle/{chunk-RZ54DSVU.js → chunk-BXTDAGM4.js} +2 -2
  21. package/dist/bundle/{chunk-V3B5COFP.js → chunk-BYVASZVV.js} +5 -5
  22. package/dist/bundle/{chunk-DS4DOK75.js → chunk-D5KGXYG6.js} +33 -25
  23. package/dist/bundle/{chunk-4LWX2WOB.js → chunk-DJRBSOWH.js} +4 -4
  24. package/dist/bundle/{chunk-W2JVP7GK.js → chunk-DVA6MQWK.js} +1 -1
  25. package/dist/bundle/{chunk-SN63VOE6.js → chunk-EBNNONF5.js} +8 -8
  26. package/dist/bundle/{chunk-XRRPQCTS.js → chunk-EJDV5IIF.js} +1 -1
  27. package/dist/bundle/{chunk-ZKH6LC5P.js → chunk-FOM7WE2C.js} +9 -9
  28. package/dist/bundle/{chunk-GA3KFYEZ.js → chunk-GAKZOX2S.js} +20 -11
  29. package/dist/bundle/{chunk-IPMBB6W5.js → chunk-GIDZGGAD.js} +4 -4
  30. package/dist/bundle/{chunk-6TKWJKPS.js → chunk-GV6XJMUW.js} +12 -12
  31. package/dist/bundle/{chunk-EFQCDCLY.js → chunk-HCMXUHHF.js} +99 -74
  32. package/dist/bundle/{chunk-U75ANK5K.js → chunk-HXOAPH47.js} +1 -1
  33. package/dist/bundle/{chunk-J324GKJM.js → chunk-IXXBPSXO.js} +2 -2
  34. package/dist/bundle/{chunk-UFVGAFID.js → chunk-KVOHC4ZM.js} +22 -14
  35. package/dist/bundle/{chunk-N63KZFH4.js → chunk-LUPJB7ZD.js} +9 -9
  36. package/dist/bundle/{chunk-IPLPMD6H.js → chunk-LZWXGO3G.js} +2 -2
  37. package/dist/bundle/{chunk-6QNPOBR5.js → chunk-N6IHOYMT.js} +198 -81
  38. package/dist/bundle/{chunk-32QM6X5H.js → chunk-ND6D4A6H.js} +3 -3
  39. package/dist/bundle/{chunk-MCMEBL3C.js → chunk-NJDGZRF5.js} +31 -15
  40. package/dist/bundle/{chunk-25RDNYKZ.js → chunk-NTQUBSIJ.js} +6 -6
  41. package/dist/bundle/{chunk-I2RDACUF.js → chunk-O3KOW7RG.js} +8 -8
  42. package/dist/bundle/{chunk-2R2Z2VWL.js → chunk-O3ZOYXH3.js} +20 -20
  43. package/dist/bundle/{chunk-W3T45MMN.js → chunk-OQTBCPSG.js} +8 -8
  44. package/dist/bundle/{chunk-SYTYLLYO.js → chunk-OT23U5LT.js} +2 -2
  45. package/dist/bundle/{chunk-OSCRP52P.js → chunk-P2LMXIHL.js} +675 -400
  46. package/dist/bundle/{chunk-ZLIARJU4.js → chunk-P2TISY3R.js} +1 -1
  47. package/dist/bundle/{chunk-CID4MNRQ.js → chunk-P3ASN72F.js} +1 -1
  48. package/dist/bundle/{chunk-YMK35KVV.js → chunk-PEYCLVIO.js} +2 -2
  49. package/dist/bundle/{chunk-UE4GMPBY.js → chunk-PUTGTW6W.js} +1 -1
  50. package/dist/bundle/{chunk-G3YSCD77.js → chunk-PYRHU35W.js} +173 -156
  51. package/dist/bundle/{chunk-DDADFHR7.js → chunk-QCPUC3HW.js} +13 -13
  52. package/dist/bundle/{chunk-N5QQFDNV.js → chunk-QCRJNWJZ.js} +3 -3
  53. package/dist/bundle/{chunk-HVTW2M6T.js → chunk-QNM36ARO.js} +8 -2
  54. package/dist/bundle/{chunk-Y5CAKD4X.js → chunk-QOGYHU3Q.js} +4 -4
  55. package/dist/bundle/{chunk-MMJDQQFX.js → chunk-RKFKRCOH.js} +310 -279
  56. package/dist/bundle/{chunk-DMTLG2GD.js → chunk-RYMYE5PF.js} +8 -8
  57. package/dist/bundle/{chunk-MSBRZ5QD.js → chunk-S7F4ZDFU.js} +3 -3
  58. package/dist/bundle/{chunk-G4W42RGE.js → chunk-SSPSNSC5.js} +1 -1
  59. package/dist/bundle/{chunk-ILK5BCBB.js → chunk-TSUNLSIN.js} +2 -2
  60. package/dist/bundle/{chunk-6IVHND3S.js → chunk-UAR6UMFL.js} +5 -5
  61. package/dist/bundle/{chunk-HYEYRFWX.js → chunk-UDJTRFRV.js} +1 -1
  62. package/dist/bundle/{chunk-FSAMZHIM.js → chunk-UG4BO256.js} +6 -6
  63. package/dist/bundle/{chunk-LE7NROV6.js → chunk-UJLYVXP6.js} +34 -34
  64. package/dist/bundle/{chunk-EVZI54B5.js → chunk-V2DMJ6ES.js} +6 -6
  65. package/dist/bundle/{chunk-LER7G4XY.js → chunk-VW6BF6M7.js} +1 -1
  66. package/dist/bundle/{chunk-V6OYLCCM.js → chunk-W6JQNNJ5.js} +3 -3
  67. package/dist/bundle/{chunk-DWBTCOF2.js → chunk-WNW6VW27.js} +7 -7
  68. package/dist/bundle/{chunk-KWM7HLAI.js → chunk-XH6K2B5L.js} +4 -4
  69. package/dist/bundle/{chunk-GOFPCOEI.js → chunk-XXGBXCBQ.js} +11 -11
  70. package/dist/bundle/{chunk-GQLSVXS2.js → chunk-XZZFHQGM.js} +22 -22
  71. package/dist/bundle/{chunk-CODD5SXC.js → chunk-Y6VH7IRN.js} +29 -29
  72. package/dist/bundle/{chunk-Y4ZXDJQF.js → chunk-ZA7FKGB7.js} +2 -2
  73. package/dist/bundle/command-contract-MRLLZQ4M.js +32 -0
  74. package/dist/bundle/{decode-F2A2BLIA.js → decode-IYWZ3X7X.js} +5 -5
  75. package/dist/bundle/{dispatch-MLRETSNQ.js → dispatch-HCRXCPCF.js} +8 -8
  76. package/dist/bundle/{echarts-JL55HJCM.js → echarts-5LLJ6JXC.js} +2 -2
  77. package/dist/bundle/{embed-74KVORNN.js → embed-EGY2R4FN.js} +6 -6
  78. package/dist/bundle/{embedder-GACNPCZN.js → embedder-K2BGPWNX.js} +9 -9
  79. package/dist/bundle/{entry-7FI2H4RQ.js → entry-NMAZNDNU.js} +7 -7
  80. package/dist/bundle/{failure-UJBGB2GP.js → failure-G4DCTWFD.js} +2 -2
  81. package/dist/bundle/failure-SACX3WGX.js +66 -0
  82. package/dist/bundle/{first-run-D4VBIJ7H.js → first-run-QDCSWX3N.js} +11 -11
  83. package/dist/bundle/first-screen-YABO6OZ7.js +30 -0
  84. package/dist/bundle/{instructions-QNPIVGKX.js → instructions-P72XX4AK.js} +1 -1
  85. package/dist/bundle/{mcp-YMXA6IH6.js → mcp-M4QN2E7R.js} +2 -2
  86. package/dist/bundle/mcp-QRZ2HSON.js +90 -0
  87. package/dist/bundle/memo.js +16 -16
  88. package/dist/bundle/{node-SPFML2D5.js → node-ZB4RNICS.js} +2 -2
  89. package/dist/bundle/{node-sqlite-T3KILRCP.js → node-sqlite-7XJ4J4E5.js} +6 -6
  90. package/dist/bundle/{oauth-ZOGSHZF3.js → oauth-FMH3JIPT.js} +7 -7
  91. package/dist/bundle/{open-XXFVCGCA.js → open-PRCTOHHL.js} +5 -5
  92. package/dist/bundle/{openai-JRHZLFKD.js → openai-VW4W6SIO.js} +10 -10
  93. package/dist/bundle/{process-OGYYVVLG.js → process-XNN4WG6N.js} +1 -1
  94. package/dist/bundle/{program-EFCQACPD.js → program-OSHEAD76.js} +161 -89
  95. package/dist/bundle/{prompt-53D5WVD3.js → prompt-RT55UZGB.js} +5 -5
  96. package/dist/bundle/{recognize-7GYZKJCD.js → recognize-AQ2UXUC2.js} +4 -4
  97. package/dist/bundle/{remote-V5GUFZCG.js → remote-T3P5OWRR.js} +7 -7
  98. package/dist/bundle/{rerank-FUNVBYFI.js → rerank-743T3675.js} +7 -7
  99. package/dist/bundle/{serve-ZLUYFAXC.js → serve-BSKOU4FJ.js} +9 -9
  100. package/dist/bundle/{server-HJRMD3XD.js → server-7GH6JLM3.js} +57 -57
  101. package/dist/bundle/server-VMWVYGK7.js +48 -0
  102. package/dist/bundle/server-ZFHSK6TT.js +61 -0
  103. package/dist/bundle/{state-4P7H6KBM.js → state-MDMI3I2Z.js} +6 -6
  104. package/dist/bundle/{store-NILJK24C.js → store-I3DIZALN.js} +13 -13
  105. package/dist/bundle/store-maintenance-command-HZPQPOK7.js +48 -0
  106. package/dist/bundle/update-Y3UQ5DQJ.js +69 -0
  107. package/dist/doctor/command.d.ts +2 -0
  108. package/dist/doctor/command.d.ts.map +1 -1
  109. package/dist/examples.d.ts.map +1 -1
  110. package/dist/examples.js +1 -0
  111. package/dist/examples.js.map +1 -1
  112. package/dist/memories/memory.d.ts.map +1 -1
  113. package/dist/memories/memory.js +3 -1
  114. package/dist/memories/memory.js.map +1 -1
  115. package/dist/notes/folders-command.d.ts.map +1 -1
  116. package/dist/notes/folders-command.js +51 -1
  117. package/dist/notes/folders-command.js.map +1 -1
  118. package/dist/notes/folders.d.ts +1 -0
  119. package/dist/notes/folders.d.ts.map +1 -1
  120. package/dist/notes/folders.js +1 -0
  121. package/dist/notes/folders.js.map +1 -1
  122. package/dist/notes/import.d.ts +3 -1
  123. package/dist/notes/import.d.ts.map +1 -1
  124. package/dist/notes/import.js +8 -3
  125. package/dist/notes/import.js.map +1 -1
  126. package/dist/notes/state.d.ts +2 -0
  127. package/dist/notes/state.d.ts.map +1 -1
  128. package/dist/notes/state.js +3 -1
  129. package/dist/notes/state.js.map +1 -1
  130. package/dist/progress.d.ts +12 -0
  131. package/dist/progress.d.ts.map +1 -0
  132. package/dist/progress.js +19 -0
  133. package/dist/progress.js.map +1 -0
  134. package/dist/reasons.d.ts.map +1 -1
  135. package/dist/reasons.js +6 -0
  136. package/dist/reasons.js.map +1 -1
  137. package/dist/run/auto.d.ts +3 -0
  138. package/dist/run/auto.d.ts.map +1 -1
  139. package/dist/run/auto.js +16 -4
  140. package/dist/run/auto.js.map +1 -1
  141. package/dist/run/import.d.ts.map +1 -1
  142. package/dist/run/import.js +7 -1
  143. package/dist/run/import.js.map +1 -1
  144. package/dist/search/answers.d.ts.map +1 -1
  145. package/dist/search/answers.js +7 -2
  146. package/dist/search/answers.js.map +1 -1
  147. package/dist/search/search.d.ts.map +1 -1
  148. package/dist/search/search.js +4 -3
  149. package/dist/search/search.js.map +1 -1
  150. package/dist/version.d.ts +1 -1
  151. package/dist/version.js +1 -1
  152. package/package.json +4 -4
  153. package/dist/bundle/auto-GB35FRTV.js +0 -86
  154. package/dist/bundle/command-contract-YYILWWYQ.js +0 -32
  155. package/dist/bundle/failure-AHPPXHAW.js +0 -66
  156. package/dist/bundle/first-screen-D7Q2U7VP.js +0 -30
  157. package/dist/bundle/mcp-AFXHH33V.js +0 -90
  158. package/dist/bundle/server-4OJC7ZWM.js +0 -61
  159. package/dist/bundle/server-CGUUZBLB.js +0 -48
  160. package/dist/bundle/store-maintenance-command-VP7CIBSS.js +0 -48
  161. package/dist/bundle/update-NPK4DT2E.js +0 -69
  162. /package/dist/bundle/{chunk-AT5Y62SD.js → chunk-CDFNOKPG.js} +0 -0
  163. /package/dist/bundle/{chunk-JPGEFBRW.js → chunk-VOXIGICJ.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-GQLSVXS2.js";
6
+ } from "./chunk-XZZFHQGM.js";
7
7
  import {
8
8
  FETCHING,
9
9
  QUICK_HEALTH_CHECKS,
@@ -13,6 +13,7 @@ import {
13
13
  chatEventAnswer,
14
14
  explainDamage,
15
15
  fts5Tables,
16
+ invalidJson,
16
17
  memberAnswer,
17
18
  newSendId,
18
19
  onlineDeps,
@@ -28,7 +29,7 @@ import {
28
29
  typedQuery,
29
30
  withQuery,
30
31
  withTimeLimit
31
- } from "./chunk-5N6HWFXN.js";
32
+ } from "./chunk-4VQPPX47.js";
32
33
  import {
33
34
  stringWidth,
34
35
  wrapAnsi
@@ -60,23 +61,23 @@ import {
60
61
  snakeKeys,
61
62
  storeTable,
62
63
  withoutProviderRefs
63
- } from "./chunk-G3YSCD77.js";
64
+ } from "./chunk-PYRHU35W.js";
64
65
  import {
65
66
  failureKey
66
- } from "./chunk-ZKH6LC5P.js";
67
+ } from "./chunk-FOM7WE2C.js";
67
68
  import {
68
69
  envName
69
- } from "./chunk-SYTYLLYO.js";
70
+ } from "./chunk-OT23U5LT.js";
70
71
  import {
71
72
  holdLock,
72
73
  lockPath,
73
74
  releaseLock,
74
75
  servingProfiles,
75
76
  takeLock
76
- } from "./chunk-MSBRZ5QD.js";
77
+ } from "./chunk-S7F4ZDFU.js";
77
78
  import {
78
79
  holdersOf
79
- } from "./chunk-W2JVP7GK.js";
80
+ } from "./chunk-DVA6MQWK.js";
80
81
  import {
81
82
  CORPORA,
82
83
  MIGRATIONS,
@@ -112,34 +113,34 @@ import {
112
113
  storeClients,
113
114
  storeContents,
114
115
  vectorIndexCounts
115
- } from "./chunk-OSCRP52P.js";
116
+ } from "./chunk-P2LMXIHL.js";
116
117
  import {
117
118
  queryFieldsOf
118
- } from "./chunk-EFQCDCLY.js";
119
+ } from "./chunk-HCMXUHHF.js";
119
120
  import {
120
121
  readSecret
121
- } from "./chunk-V6OYLCCM.js";
122
+ } from "./chunk-W6JQNNJ5.js";
122
123
  import {
123
124
  checkedOptions,
124
125
  range
125
- } from "./chunk-32QM6X5H.js";
126
+ } from "./chunk-ND6D4A6H.js";
126
127
  import {
127
128
  messagesFor,
128
129
  systemFor,
129
130
  validateImages
130
- } from "./chunk-U35N3EC7.js";
131
+ } from "./chunk-5RVL7GYA.js";
131
132
  import {
132
133
  storePath
133
- } from "./chunk-IPLPMD6H.js";
134
+ } from "./chunk-LZWXGO3G.js";
134
135
  import {
135
136
  openCache
136
- } from "./chunk-25RDNYKZ.js";
137
+ } from "./chunk-NTQUBSIJ.js";
137
138
  import {
138
139
  Credentials,
139
140
  pathsAreOverridden,
140
141
  resolvePaths,
141
142
  writeSecurely
142
- } from "./chunk-2R2Z2VWL.js";
143
+ } from "./chunk-O3ZOYXH3.js";
143
144
  import {
144
145
  array,
145
146
  boolean,
@@ -163,12 +164,12 @@ import {
163
164
  transform,
164
165
  trim,
165
166
  union
166
- } from "./chunk-SN63VOE6.js";
167
+ } from "./chunk-EBNNONF5.js";
167
168
  import {
168
169
  CliError,
169
170
  singleLine,
170
171
  visibleControls
171
- } from "./chunk-RZ54DSVU.js";
172
+ } from "./chunk-BXTDAGM4.js";
172
173
  import {
173
174
  __commonJS,
174
175
  __name,
@@ -4812,15 +4813,15 @@ var require_liquid_node = __commonJS({
4812
4813
  }
4813
4814
  *render(ctx, emitter) {
4814
4815
  const group = yield evalToken(this.group, ctx);
4815
- const fingerprint2 = `cycle:${group}:` + this.candidates.join(",");
4816
+ const fingerprint = `cycle:${group}:` + this.candidates.join(",");
4816
4817
  const groups = ctx.getRegister("cycle", {});
4817
- let idx = groups[fingerprint2];
4818
+ let idx = groups[fingerprint];
4818
4819
  if (idx === void 0) {
4819
- idx = groups[fingerprint2] = 0;
4820
+ idx = groups[fingerprint] = 0;
4820
4821
  }
4821
4822
  const candidate = this.candidates[idx];
4822
4823
  idx = (idx + 1) % this.candidates.length;
4823
- groups[fingerprint2] = idx;
4824
+ groups[fingerprint] = idx;
4824
4825
  return yield evalToken(candidate, ctx);
4825
4826
  }
4826
4827
  *arguments() {
@@ -5508,11 +5509,11 @@ var require_liquid_node = __commonJS({
5508
5509
  }
5509
5510
  });
5510
5511
 
5511
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5512
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5512
5513
  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";
5513
5514
  import { dirname as dirname2, resolve } from "node:path";
5514
5515
 
5515
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/sealed.js
5516
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/sealed.js
5516
5517
  import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
5517
5518
  import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
5518
5519
  import { Transform } from "node:stream";
@@ -5619,7 +5620,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
5619
5620
  renameSync(pending, to);
5620
5621
  }, "unsealFile");
5621
5622
 
5622
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5623
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5623
5624
  var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
5624
5625
  var fileSchemaOf = /* @__PURE__ */ __name((database) => {
5625
5626
  const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
@@ -5643,7 +5644,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
5643
5644
  };
5644
5645
  }, "compatibilityOf");
5645
5646
 
5646
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/store/repair.js
5647
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/repair.js
5647
5648
  import { createHash as createHash2 } from "node:crypto";
5648
5649
  var COPY_MARK = "__repair_";
5649
5650
  var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
@@ -5897,19 +5898,20 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
5897
5898
  return found;
5898
5899
  }, "deleteCopy");
5899
5900
 
5900
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5901
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5901
5902
  import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
5902
5903
 
5903
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5904
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5904
5905
  import { existsSync as existsSync3 } from "node:fs";
5905
5906
 
5906
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/store/recover.js
5907
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/recover.js
5907
5908
  import { execFileSync, spawn } from "node:child_process";
5908
5909
  import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
5909
5910
  import { basename, dirname, join } from "node:path";
5910
5911
  import { Transform as Transform2 } from "node:stream";
5911
5912
  var SQLITE3_MINIMUM = [3, 43, 0];
5912
5913
  var STORE_PARTS = ["", "-wal", "-shm"];
5914
+ var RECOVER_LOCK = ".recover-lock";
5913
5915
  var INSERTED = /^INSERT OR IGNORE INTO '([^']+)'/;
5914
5916
  var LOST_AND_FOUND = "recover_lost_and_found";
5915
5917
  var recovers = /* @__PURE__ */ __name((program) => {
@@ -5944,11 +5946,55 @@ var activeTimers = /* @__PURE__ */ __name(() => {
5944
5946
  return void 0;
5945
5947
  }
5946
5948
  }, "activeTimers");
5949
+ var alive = /* @__PURE__ */ __name((pid) => {
5950
+ try {
5951
+ process.kill(pid, 0);
5952
+ return true;
5953
+ } catch (error) {
5954
+ return error.code === "EPERM";
5955
+ }
5956
+ }, "alive");
5957
+ var runningRecovery = /* @__PURE__ */ __name((path) => {
5958
+ let pid;
5959
+ try {
5960
+ pid = Number(readFileSync(`${path}${RECOVER_LOCK}`, "utf8").trim());
5961
+ } catch {
5962
+ return null;
5963
+ }
5964
+ return Number.isInteger(pid) && pid > 0 && alive(pid) ? pid : null;
5965
+ }, "runningRecovery");
5966
+ var takeRecoverLock = /* @__PURE__ */ __name((path) => {
5967
+ const lock = `${path}${RECOVER_LOCK}`;
5968
+ const take = /* @__PURE__ */ __name(() => writeFileSync(lock, String(process.pid), { flag: "wx", mode: 384 }), "take");
5969
+ try {
5970
+ take();
5971
+ } catch (error) {
5972
+ if (error.code !== "EEXIST")
5973
+ throw error;
5974
+ const pid = runningRecovery(path);
5975
+ if (pid === null) {
5976
+ rmSync2(lock, { force: true });
5977
+ take();
5978
+ } else {
5979
+ throw new CliError("validation_error", `the store is being recovered by process ${pid} \u2014 wait for it to finish`, {
5980
+ reason: "store.recovering"
5981
+ });
5982
+ }
5983
+ }
5984
+ return () => rmSync2(lock, { force: true });
5985
+ }, "takeRecoverLock");
5947
5986
  var storeHolders = /* @__PURE__ */ __name((path) => {
5948
5987
  const folder = realpathSync(dirname(path));
5949
5988
  const files = STORE_PARTS.map((suffix) => join(folder, `${basename(path)}${suffix}`));
5950
5989
  const wanted = process.platform === "linux" ? files.flatMap((file2) => [file2, `${file2} (deleted)`]) : files.filter(existsSync2);
5951
- return holdersOf(wanted)?.map((pid) => {
5990
+ const recovering = runningRecovery(path);
5991
+ const pids = holdersOf(wanted);
5992
+ if (pids === void 0 && recovering === null)
5993
+ return void 0;
5994
+ const all = [
5995
+ .../* @__PURE__ */ new Set([...pids ?? [], ...recovering !== null && recovering !== process.pid ? [recovering] : []])
5996
+ ];
5997
+ return all.map((pid) => {
5952
5998
  let name = "?";
5953
5999
  try {
5954
6000
  name = readFileSync(`/proc/${pid}/comm`, "utf8").trim();
@@ -6110,10 +6156,14 @@ var mailToFetch = /* @__PURE__ */ __name((database) => {
6110
6156
  return [];
6111
6157
  }
6112
6158
  }, "mailToFetch");
6113
- var fingerprint = /* @__PURE__ */ __name((path) => ["", "-wal"].map((suffix) => {
6114
- const stat = statSync2(`${path}${suffix}`, { throwIfNoEntry: false });
6115
- return stat ? `${stat.size}:${stat.mtimeMs}` : "-";
6116
- }).join("|"), "fingerprint");
6159
+ var clearInvalidJson = /* @__PURE__ */ __name((database) => {
6160
+ const found = invalidJson(database);
6161
+ for (const { table, column, required } of found) {
6162
+ const invalid = `"${column}" IS NOT NULL AND NOT json_valid("${column}")`;
6163
+ database.exec(required ? `DELETE FROM "${table}" WHERE ${invalid}` : `UPDATE "${table}" SET "${column}" = NULL WHERE ${invalid}`);
6164
+ }
6165
+ return found;
6166
+ }, "clearInvalidJson");
6117
6167
  var refuseInUse = /* @__PURE__ */ __name((path) => {
6118
6168
  const holders = storeHolders(path);
6119
6169
  if (holders && holders.length > 0) {
@@ -6130,98 +6180,118 @@ var recoverStore = /* @__PURE__ */ __name(async ({ path, command, version, sqlit
6130
6180
  if (!program.usable) {
6131
6181
  throw new CliError("configuration_error", program.version ? `sqlite3 ${program.version} cannot recover: the recovery needs ${SQLITE3_MINIMUM.join(".")} or newer, built with .recover` : "the recovery needs the sqlite3 program with its .recover command: install it (apt install sqlite3, brew install sqlite)", { reason: "store.sqlite3-missing" });
6132
6182
  }
6133
- refuseInUse(path);
6134
- const bytes = STORE_PARTS.reduce((sum, suffix) => sum + (statSync2(`${path}${suffix}`, { throwIfNoEntry: false })?.size ?? 0), 0);
6135
- const { bavail, bsize } = statfsSync(dirname(path));
6136
- if (Number(bavail) * Number(bsize) < bytes * 1.2)
6137
- throw new CliError("validation_error", `the recovery needs about ${Math.ceil(bytes * 1.2 / 1e9)} GB free beside the store`);
6138
- const old = await openSqlite(path, { readOnly: true });
6139
- let rowsBefore;
6183
+ const releaseLock2 = takeRecoverLock(path);
6140
6184
  try {
6141
- rowsBefore = tableRows(old.database);
6185
+ refuseInUse(path);
6186
+ const bytes = STORE_PARTS.reduce((sum, suffix) => sum + (statSync2(`${path}${suffix}`, { throwIfNoEntry: false })?.size ?? 0), 0);
6187
+ const { bavail, bsize } = statfsSync(dirname(path));
6188
+ if (Number(bavail) * Number(bsize) < bytes * 1.2)
6189
+ throw new CliError("validation_error", `the recovery needs about ${Math.ceil(bytes * 1.2 / 1e9)} GB free beside the store`);
6190
+ return await recoverLocked({ path, command, version, sqlite3, now, note, copy, started, program });
6142
6191
  } finally {
6143
- old.database.close();
6144
- }
6145
- const before = fingerprint(path);
6146
- const stamp = new Date(now()).toISOString().replace(/[:.]/g, "-");
6147
- const target = `${path}.recovering-${stamp}`;
6148
- writeFileSync(target, "", { flag: "wx", mode: 384 });
6149
- const dropTarget = /* @__PURE__ */ __name(() => {
6150
- for (const suffix of [...STORE_PARTS, "-journal"])
6151
- rmSync2(`${target}${suffix}`, { force: true });
6152
- }, "dropTarget");
6153
- note(`copying the readable rows into ${target}`);
6154
- let copied;
6155
- let copyErrors;
6156
- let read;
6157
- let opened;
6158
- try {
6159
- ;
6160
- ({ errors: copyErrors, read } = await (copy ?? ((from, to) => copyReadableRows(from, to, sqlite3)))(path, target));
6161
- copied = Date.now();
6162
- opened = await openSqlite(target);
6163
- } catch (error) {
6164
- dropTarget();
6165
- throw error;
6192
+ releaseLock2();
6166
6193
  }
6167
- let rebuilt;
6168
- let kept;
6169
- let dangling;
6170
- let fetch2;
6194
+ }, "recoverStore");
6195
+ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqlite3, now, note, copy, started, program }) => {
6196
+ const watch = (await openSqlite(path, { readOnly: true })).database;
6197
+ let watching = true;
6198
+ const stopWatching = /* @__PURE__ */ __name(() => {
6199
+ if (watching)
6200
+ watch.close();
6201
+ watching = false;
6202
+ }, "stopWatching");
6171
6203
  try {
6172
- kept = tableRows(opened.database);
6173
- migrate(opened.database, { command, ...version ? { version } : {} });
6174
- rebuilt = rebuildDerived(opened.database, { now, note });
6175
- note("looking for rows that point at rows that were lost");
6176
- dangling = danglingRows(opened.database);
6177
- fetch2 = mailToFetch(opened.database);
6178
- opened.database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
6179
- } catch (error) {
6204
+ const dataVersion = /* @__PURE__ */ __name(() => Number(watch.prepare("PRAGMA data_version").get()?.data_version), "dataVersion");
6205
+ const rowsBefore = tableRows(watch);
6206
+ const before = { data: dataVersion(), inode: statSync2(path).ino };
6207
+ const stamp = new Date(now()).toISOString().replace(/[:.]/g, "-");
6208
+ const target = `${path}.recovering-${stamp}`;
6209
+ writeFileSync(target, "", { flag: "wx", mode: 384 });
6210
+ const dropTarget = /* @__PURE__ */ __name(() => {
6211
+ for (const suffix of [...STORE_PARTS, "-journal"])
6212
+ rmSync2(`${target}${suffix}`, { force: true });
6213
+ }, "dropTarget");
6214
+ note(`copying the readable rows into ${target}`);
6215
+ let copied;
6216
+ let copyErrors;
6217
+ let read;
6218
+ let opened;
6219
+ try {
6220
+ ;
6221
+ ({ errors: copyErrors, read } = await (copy ?? ((from, to) => copyReadableRows(from, to, sqlite3)))(path, target));
6222
+ copied = Date.now();
6223
+ opened = await openSqlite(target);
6224
+ } catch (error) {
6225
+ dropTarget();
6226
+ throw error;
6227
+ }
6228
+ let rebuilt;
6229
+ let kept;
6230
+ let dangling;
6231
+ let json;
6232
+ let fetch2;
6233
+ try {
6234
+ kept = tableRows(opened.database);
6235
+ migrate(opened.database, { command, ...version ? { version } : {} });
6236
+ note("clearing values that are not valid JSON");
6237
+ json = clearInvalidJson(opened.database);
6238
+ rebuilt = rebuildDerived(opened.database, { now, note });
6239
+ note("looking for rows that point at rows that were lost");
6240
+ dangling = danglingRows(opened.database);
6241
+ fetch2 = mailToFetch(opened.database);
6242
+ opened.database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
6243
+ } catch (error) {
6244
+ opened.database.close();
6245
+ dropTarget();
6246
+ throw error;
6247
+ }
6180
6248
  opened.database.close();
6181
- dropTarget();
6182
- throw error;
6183
- }
6184
- opened.database.close();
6185
- const rebuiltAt = Date.now();
6186
- note("checking the recovered file");
6187
- const health = await storeHealth(target, { deep: true });
6188
- const checkedAt = Date.now();
6189
- if (!health.ok) {
6190
- throw new CliError("validation_error", `the recovered file did not pass its check, so the store was left as it was; the file is kept at ${target}`, { reason: "store.recovery-failed" });
6191
- }
6192
- refuseInUse(path);
6193
- if (fingerprint(path) !== before) {
6194
- throw new CliError("validation_error", `the store was written to during the recovery, so it was left as it was \u2014 stop every timer and run it again; ${target} can be deleted`, { reason: "store.changed-during-recovery" });
6249
+ const rebuiltAt = Date.now();
6250
+ note("checking the recovered file");
6251
+ const health = await storeHealth(target, { deep: true });
6252
+ const checkedAt = Date.now();
6253
+ if (!health.ok) {
6254
+ throw new CliError("validation_error", `the recovered file did not pass its check, so the store was left as it was; the file is kept at ${target}`, { reason: "store.recovery-failed" });
6255
+ }
6256
+ refuseInUse(path);
6257
+ const changed = dataVersion() !== before.data || statSync2(path, { throwIfNoEntry: false })?.ino !== before.inode;
6258
+ stopWatching();
6259
+ if (changed) {
6260
+ throw new CliError("validation_error", `the store was written to during the recovery, so it was left as it was \u2014 stop every timer and run it again; ${target} can be deleted`, { reason: "store.changed-during-recovery" });
6261
+ }
6262
+ const keptAt = `${path}.before-recover-${stamp}`;
6263
+ for (const suffix of STORE_PARTS)
6264
+ if (existsSync2(`${path}${suffix}`))
6265
+ renameSync2(`${path}${suffix}`, `${keptAt}${suffix}`);
6266
+ for (const suffix of STORE_PARTS)
6267
+ if (existsSync2(`${target}${suffix}`))
6268
+ renameSync2(`${target}${suffix}`, `${path}${suffix}`);
6269
+ 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);
6270
+ const seconds = /* @__PURE__ */ __name((from, to) => Math.round((to - from) / 100) / 10, "seconds");
6271
+ return {
6272
+ path,
6273
+ keptAt,
6274
+ sqlite3: program.version,
6275
+ lost,
6276
+ dangling,
6277
+ invalidJson: json,
6278
+ mailToFetch: fetch2,
6279
+ rebuilt,
6280
+ copyErrors,
6281
+ health,
6282
+ seconds: {
6283
+ copy: seconds(started, copied),
6284
+ rebuild: seconds(copied, rebuiltAt),
6285
+ check: seconds(rebuiltAt, checkedAt),
6286
+ total: seconds(started, Date.now())
6287
+ }
6288
+ };
6289
+ } finally {
6290
+ stopWatching();
6195
6291
  }
6196
- const keptAt = `${path}.before-recover-${stamp}`;
6197
- for (const suffix of STORE_PARTS)
6198
- if (existsSync2(`${path}${suffix}`))
6199
- renameSync2(`${path}${suffix}`, `${keptAt}${suffix}`);
6200
- for (const suffix of STORE_PARTS)
6201
- if (existsSync2(`${target}${suffix}`))
6202
- renameSync2(`${target}${suffix}`, `${path}${suffix}`);
6203
- 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);
6204
- const seconds = /* @__PURE__ */ __name((from, to) => Math.round((to - from) / 100) / 10, "seconds");
6205
- return {
6206
- path,
6207
- keptAt,
6208
- sqlite3: program.version,
6209
- lost,
6210
- dangling,
6211
- mailToFetch: fetch2,
6212
- rebuilt,
6213
- copyErrors,
6214
- health,
6215
- seconds: {
6216
- copy: seconds(started, copied),
6217
- rebuild: seconds(copied, rebuiltAt),
6218
- check: seconds(rebuiltAt, checkedAt),
6219
- total: seconds(started, Date.now())
6220
- }
6221
- };
6222
- }, "recoverStore");
6292
+ }, "recoverLocked");
6223
6293
 
6224
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6294
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6225
6295
  var COUNTED = [
6226
6296
  "accounts",
6227
6297
  "chats",
@@ -6270,6 +6340,7 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
6270
6340
  problems: health.problems ?? 0,
6271
6341
  damagedTables: health.damagedTables ?? [],
6272
6342
  damagedSearchIndexes: (health.searchIndexes ?? []).filter((index) => !index.ok).map(({ name, error }) => ({ name, ...error ? { error } : {} })),
6343
+ invalidJson: health.invalidJson ?? [],
6273
6344
  rows,
6274
6345
  explanation,
6275
6346
  inUse,
@@ -6308,6 +6379,7 @@ var recoveryNotes = /* @__PURE__ */ __name((answer) => {
6308
6379
  `recovered in ${answer.seconds.total} s; the damaged file is kept at ${answer.keptAt}`,
6309
6380
  ...lost.length ? lost : ["no table lost a row"],
6310
6381
  ...answer.dangling.map(({ table, parent, rows }) => `${rows} rows of ${table} point at ${parent} rows the store does not hold`),
6382
+ ...answer.invalidJson.map(({ table, column, rows, required }) => `${table}.${column}: ${rows} values were not valid JSON \u2014 ${required ? "those rows were dropped" : "set to empty"}`),
6311
6383
  ...answer.next.map((line) => `next: ${line}`)
6312
6384
  ];
6313
6385
  }
@@ -6345,7 +6417,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
6345
6417
  return recover;
6346
6418
  }, "storeRecoverCommand");
6347
6419
 
6348
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6420
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6349
6421
  var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
6350
6422
  var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
6351
6423
  var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
@@ -6391,7 +6463,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
6391
6463
  renderAnswer(this, outputFor(this), itemOf(answer));
6392
6464
  }), "storeInfoCommand");
6393
6465
 
6394
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6466
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6395
6467
  var ENCRYPT_OPTION = [
6396
6468
  "--encrypt",
6397
6469
  "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"
@@ -6410,7 +6482,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
6410
6482
  return password;
6411
6483
  }, "passwordOf");
6412
6484
 
6413
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/replies/rules.js
6485
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/replies/rules.js
6414
6486
  import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
6415
6487
  import { join as join2 } from "node:path";
6416
6488
  var REPLY_ACTIONS = ["reply", "task"];
@@ -6581,7 +6653,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
6581
6653
  }, "problem");
6582
6654
  var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
6583
6655
 
6584
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/replies/state.js
6656
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/replies/state.js
6585
6657
  import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
6586
6658
  import { join as join3 } from "node:path";
6587
6659
  var ANSWERED_KEPT = 1e3;
@@ -6634,7 +6706,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
6634
6706
  }, "recordReply");
6635
6707
  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");
6636
6708
 
6637
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/replies/decide.js
6709
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/replies/decide.js
6638
6710
  var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
6639
6711
  var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
6640
6712
  const { message, chat, owner, sender } = incoming;
@@ -6740,7 +6812,7 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
6740
6812
  return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
6741
6813
  }, "filled");
6742
6814
 
6743
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/replies/template.js
6815
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/replies/template.js
6744
6816
  var import_liquidjs = __toESM(require_liquid_node(), 1);
6745
6817
  var TEMPLATE_LIMITS = {
6746
6818
  parse: 32768,
@@ -6900,7 +6972,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
6900
6972
  }
6901
6973
  }, "renderReplyTemplate");
6902
6974
 
6903
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
6975
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
6904
6976
  var DRY_RUN_DAYS = 7;
6905
6977
  var PAGE = 500;
6906
6978
  var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
@@ -7014,7 +7086,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
7014
7086
  }
7015
7087
  }, "storedSince");
7016
7088
 
7017
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
7089
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
7018
7090
  var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
7019
7091
  const host = new URL(baseUrl).host;
7020
7092
  return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
@@ -7045,7 +7117,7 @@ var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) =>
7045
7117
  };
7046
7118
  }, "embeddingKeys");
7047
7119
 
7048
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/models/openai.js
7120
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/models/openai.js
7049
7121
  var options = strictObject({
7050
7122
  temperature: range(0, 2),
7051
7123
  top_p: range(0, 1),
@@ -7094,7 +7166,7 @@ var openai = {
7094
7166
  }), "complete")
7095
7167
  };
7096
7168
 
7097
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/models/index.js
7169
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/models/index.js
7098
7170
  var modelGateway = /* @__PURE__ */ __name((deps) => ({
7099
7171
  complete: /* @__PURE__ */ __name(async (request) => {
7100
7172
  if (deps.signal?.aborted)
@@ -7109,7 +7181,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
7109
7181
  if (!adapter && target.provider === "openai")
7110
7182
  adapter = openai;
7111
7183
  if (!adapter && target.provider === "anthropic")
7112
- adapter = (await import("./anthropic-PTAYBCPR.js")).anthropic;
7184
+ adapter = (await import("./anthropic-RI4DWC3G.js")).anthropic;
7113
7185
  if (!adapter)
7114
7186
  throw new CliError("validation_error", `no model adapter for ${target.provider}`);
7115
7187
  if (request.images !== void 0 && adapter.images !== true)
@@ -7150,7 +7222,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
7150
7222
  }, "complete")
7151
7223
  }), "modelGateway");
7152
7224
 
7153
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/replies/consents.js
7225
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/replies/consents.js
7154
7226
  import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
7155
7227
  import { join as join4 } from "node:path";
7156
7228
  var shape = strictObject({
@@ -7175,7 +7247,7 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
7175
7247
  return consent.provider === provider && !consent.deniedChats.includes(chat);
7176
7248
  }, "mayModelReply");
7177
7249
 
7178
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7250
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7179
7251
  var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options2 = {
7180
7252
  ai: true
7181
7253
  }) => async (rule2, message, chat, now) => {
@@ -7222,7 +7294,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
7222
7294
  return result2;
7223
7295
  }, "replyRenderer");
7224
7296
 
7225
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/replies/serve.js
7297
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/replies/serve.js
7226
7298
  var NOT_ALLOWED = "replies.send is not allow";
7227
7299
  var NO_RULES = "no rules";
7228
7300
  var ONLY_TASK = "opened a task, sent nothing";
@@ -7315,7 +7387,7 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
7315
7387
  return { skip: why };
7316
7388
  }, "replyTo");
7317
7389
 
7318
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7390
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7319
7391
  var START_SYNC_DELAY_MS = 3e4;
7320
7392
  var START_SYNC_BUDGET_MS = 5 * 6e4;
7321
7393
  var START_SYNC_WINDOW_MS = 7 * 864e5;
@@ -7392,7 +7464,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note
7392
7464
  };
7393
7465
  }, "startSync");
7394
7466
 
7395
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7467
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7396
7468
  var FIRST_FETCH_MS = 6e4;
7397
7469
  var DAY_MS = 864e5;
7398
7470
  var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
@@ -7446,7 +7518,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
7446
7518
  };
7447
7519
  }, "memberFetches");
7448
7520
 
7449
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7521
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7450
7522
  var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
7451
7523
  var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
7452
7524
  if (context.format === "pretty") {
@@ -7479,7 +7551,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
7479
7551
  return context;
7480
7552
  }, "recordDiagnostics");
7481
7553
 
7482
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7554
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7483
7555
  var STEMS_EVERY_MS = 3e4;
7484
7556
  var STEMS_SLICE_MS = 2e3;
7485
7557
  var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
@@ -7519,7 +7591,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
7519
7591
  };
7520
7592
  }, "stemFills");
7521
7593
 
7522
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/render/messages.js
7594
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/render/messages.js
7523
7595
  import { styleText } from "node:util";
7524
7596
  var TIME_WIDTH = 8;
7525
7597
  var INDENT = " ".repeat(TIME_WIDTH + 2);
@@ -7695,7 +7767,7 @@ var editedAt = /* @__PURE__ */ __name((message, options2) => {
7695
7767
  return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
7696
7768
  }, "editedAt");
7697
7769
 
7698
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7770
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7699
7771
  var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
7700
7772
  var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7701
7773
  kind: attachment.kind,
@@ -7790,7 +7862,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
7790
7862
  locale: messenger.app.locale
7791
7863
  }), "viewOf");
7792
7864
 
7793
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7865
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7794
7866
  var observed = /* @__PURE__ */ __name((value) => ({
7795
7867
  value: value.value,
7796
7868
  observed_at: value.observedAt,
@@ -7857,7 +7929,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
7857
7929
  }
7858
7930
  }, "watchEventItem");
7859
7931
 
7860
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7932
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7861
7933
  var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
7862
7934
  output: { entity: "watch_item" },
7863
7935
  effects: REMOTE_READ,
@@ -8012,7 +8084,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
8012
8084
  }
8013
8085
  }, "describe");
8014
8086
 
8015
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8087
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8016
8088
  var serveCommand = /* @__PURE__ */ __name((messenger) => {
8017
8089
  const command = annotate(new Command("serve"), {
8018
8090
  output: { entity: "serve_summary" },
@@ -8276,7 +8348,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
8276
8348
  };
8277
8349
  }, "tasking");
8278
8350
 
8279
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8351
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8280
8352
  import { existsSync as existsSync8 } from "node:fs";
8281
8353
  var PATH = "store tables list";
8282
8354
  var STORE_TABLES_QUERY = {
@@ -8319,7 +8391,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
8319
8391
  return tables;
8320
8392
  }, "storeTablesCommand");
8321
8393
 
8322
- // node_modules/.pnpm/@wirecat+cli-core@0.599.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_9abdd607bcc42461f37eac6c77838a67/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8394
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8323
8395
  var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
8324
8396
  var WORD_INDEX = "message_words";
8325
8397
  var schemaOf = /* @__PURE__ */ __name((database) => {
@@ -8357,6 +8429,7 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command }
8357
8429
  ms: checked.ms,
8358
8430
  ...checked.problems ? { problems: checked.problems } : {},
8359
8431
  ...checked.damagedTables?.length ? { damagedTables: checked.damagedTables } : {},
8432
+ ...checked.invalidJson?.length ? { invalidJson: checked.invalidJson } : {},
8360
8433
  ...checked.searchIndexes?.some((index) => !index.ok) ? { damagedSearchIndexes: checked.searchIndexes.filter((index) => !index.ok).map((index) => index.name) } : {}
8361
8434
  };
8362
8435
  const damage = command ? explainDamage(checked, command) : null;