@wirecat/mail-cli 0.23.1 → 0.25.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 (117) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/bin/mail.js +2 -2
  3. package/dist/bundle/{all-profiles-FJHJCGRU.js → all-profiles-QEV2PSOR.js} +11 -11
  4. package/dist/bundle/{anthropic-AFL7NKVZ.js → anthropic-5NKQXIHM.js} +28 -12
  5. package/dist/bundle/{app-server-WKCBJMHI.js → app-server-G2CJNT4R.js} +62 -50
  6. package/dist/bundle/{bun-HQATAQJQ.js → bun-6HBYWQIX.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-4ECAV7OU.js → bun-sqlite-DXIQ7BVR.js} +9 -5
  8. package/dist/bundle/{chunk-MUDHCYN4.js → chunk-37F6QYTO.js} +6 -6
  9. package/dist/bundle/{chunk-NMGF3UOZ.js → chunk-3XVR2ROR.js} +50 -46
  10. package/dist/bundle/{chunk-QUKD5SO2.js → chunk-434YOD6A.js} +4 -4
  11. package/dist/bundle/{chunk-7SWWVDEZ.js → chunk-4W4EVVL4.js} +61 -21
  12. package/dist/bundle/{chunk-CCYHBNRL.js → chunk-5QYK3LWS.js} +326 -56
  13. package/dist/bundle/{chunk-7YRKUEYE.js → chunk-5ZYFV6FD.js} +694 -228
  14. package/dist/bundle/chunk-7GLJSJ7M.js +16 -0
  15. package/dist/bundle/{chunk-NOA6E6MM.js → chunk-A6BPOX5O.js} +38841 -24161
  16. package/dist/bundle/{chunk-34743C4C.js → chunk-ADKMBXY4.js} +1 -1
  17. package/dist/bundle/{chunk-2HXHAFRP.js → chunk-B7SWTH5O.js} +2 -2
  18. package/dist/bundle/{chunk-NKBAZ4VC.js → chunk-BC7PFQL7.js} +2 -2
  19. package/dist/bundle/{chunk-ROKTS7WM.js → chunk-CBYBZCQP.js} +1 -1
  20. package/dist/bundle/chunk-CIWWNBVW.js +188 -0
  21. package/dist/bundle/{chunk-SBGXKM4U.js → chunk-DIA56CS7.js} +8 -7
  22. package/dist/bundle/{chunk-VYHIX3OP.js → chunk-EXVY76VO.js} +61 -607
  23. package/dist/bundle/{chunk-BVJQBAGL.js → chunk-FZZD4AFY.js} +14 -14
  24. package/dist/bundle/{chunk-VFKX5UMJ.js → chunk-G5LHHAW2.js} +6 -6
  25. package/dist/bundle/{chunk-QV3M2MHG.js → chunk-GJRYZXBN.js} +13 -136
  26. package/dist/bundle/{chunk-GJNFNC76.js → chunk-GY4XCLCO.js} +10 -15
  27. package/dist/bundle/{chunk-V7CFZ773.js → chunk-HEIDAHRC.js} +2 -2
  28. package/dist/bundle/{chunk-AGNAT7CM.js → chunk-HEYVMAAQ.js} +2 -2
  29. package/dist/bundle/{chunk-HOKGIYUO.js → chunk-HJSJBNCJ.js} +119 -9
  30. package/dist/bundle/{chunk-KKGX7JMX.js → chunk-HLXVUMZJ.js} +2 -2
  31. package/dist/bundle/{chunk-OU5CWCG2.js → chunk-IACWKZWS.js} +1 -1
  32. package/dist/bundle/{chunk-QR7JZM3D.js → chunk-IXO4SCKE.js} +1 -1
  33. package/dist/bundle/{chunk-GOMJNH56.js → chunk-IZOYW4Z4.js} +32 -8
  34. package/dist/bundle/{chunk-WN4HP7IZ.js → chunk-J4OYK4WL.js} +14 -14
  35. package/dist/bundle/{chunk-76RTQYJQ.js → chunk-JG4MNYG2.js} +1 -1
  36. package/dist/bundle/{chunk-VAMCRP47.js → chunk-K2OGF7KC.js} +2 -2
  37. package/dist/bundle/chunk-K6HR6HCO.js +32 -0
  38. package/dist/bundle/{chunk-B6QMMRIM.js → chunk-KFB2X6KE.js} +1530 -1525
  39. package/dist/bundle/{chunk-3UFD76IR.js → chunk-KK4HD3SI.js} +6 -6
  40. package/dist/bundle/{chunk-3QVGB2CI.js → chunk-L4QVOEOB.js} +4 -4
  41. package/dist/bundle/chunk-LGZPKKBN.js +53 -0
  42. package/dist/bundle/chunk-LVGX7VTD.js +138 -0
  43. package/dist/bundle/chunk-MBFPFWCO.js +1243 -0
  44. package/dist/bundle/{chunk-3DQYO7FB.js → chunk-MCPOZNWG.js} +1 -1
  45. package/dist/bundle/{chunk-SR3ADLGX.js → chunk-MWGH3M46.js} +3 -3
  46. package/dist/bundle/{chunk-OJCUSHZG.js → chunk-ND5H5ADM.js} +4 -4
  47. package/dist/bundle/chunk-NMZQTYKJ.js +18 -0
  48. package/dist/bundle/{chunk-4YJJQNNJ.js → chunk-OLKCJBZY.js} +5 -5
  49. package/dist/bundle/{chunk-E7ZVKQHG.js → chunk-OLLIWNFG.js} +3 -3
  50. package/dist/bundle/{chunk-R5MYOLQP.js → chunk-P6GXNT7Z.js} +13 -13
  51. package/dist/bundle/{chunk-M7RGG3UU.js → chunk-PGC5TRH6.js} +3 -3
  52. package/dist/bundle/{chunk-3OZKDC6Y.js → chunk-PHHH2NQP.js} +15 -9
  53. package/dist/bundle/{chunk-S5OTP7XS.js → chunk-PP3YOAWG.js} +3 -3
  54. package/dist/bundle/{chunk-4IFX4HV2.js → chunk-PQMJ5BXH.js} +4 -4
  55. package/dist/bundle/{chunk-ZXIPJF3Y.js → chunk-QB3DP2TN.js} +2 -2
  56. package/dist/bundle/{chunk-4IWJARFA.js → chunk-QQUY4MZY.js} +1 -1
  57. package/dist/bundle/{chunk-UHC5I3JV.js → chunk-RX5CJ55S.js} +1 -1
  58. package/dist/bundle/{chunk-CYQVWITQ.js → chunk-S2QRAKQI.js} +99 -42
  59. package/dist/bundle/{chunk-V3TDQUXD.js → chunk-SMTBV62X.js} +44 -60
  60. package/dist/bundle/{chunk-SNTLN2QT.js → chunk-T27IMG6X.js} +3 -1
  61. package/dist/bundle/{chunk-LLYVBO3R.js → chunk-TY644DKQ.js} +19 -19
  62. package/dist/bundle/{chunk-R554W7ZO.js → chunk-U6IQ6YQ2.js} +2 -2
  63. package/dist/bundle/{chunk-MBKNL5TX.js → chunk-VFU7PVPQ.js} +373 -133
  64. package/dist/bundle/{chunk-UMXVQIGD.js → chunk-VL6H2BND.js} +377 -12
  65. package/dist/bundle/{chunk-DALBYUPC.js → chunk-VUBZFMGP.js} +2 -2
  66. package/dist/bundle/{chunk-VYIIX6VN.js → chunk-WOAYHCM2.js} +1 -1
  67. package/dist/bundle/{chunk-LQDMUMA2.js → chunk-WX6OYVCH.js} +5370 -3700
  68. package/dist/bundle/chunk-XMDEM6BZ.js +2094 -0
  69. package/dist/bundle/{chunk-CUOCDJFI.js → chunk-XQYKIZMG.js} +13 -9
  70. package/dist/bundle/{chunk-PMIKRELC.js → chunk-YNS2YVUR.js} +69 -6
  71. package/dist/bundle/{chunk-CBWA2T3N.js → chunk-Z5T6OW3V.js} +14 -5
  72. package/dist/bundle/command-contract-XSW2Q33S.js +36 -0
  73. package/dist/bundle/command-server-entry-XMSSY5ID.js +165 -0
  74. package/dist/bundle/{decode-QXKTMOTH.js → decode-RYGB4PGT.js} +5 -5
  75. package/dist/bundle/{dispatch-G4CYFWQ2.js → dispatch-PLQOIZG5.js} +10 -10
  76. package/dist/bundle/{dist-5FX36DAW.js → dist-GY2AQETI.js} +79 -46
  77. package/dist/bundle/{echarts-HHUM43TU.js → echarts-7CM2MCMW.js} +2 -2
  78. package/dist/bundle/{embed-SRZSDZVI.js → embed-FTBDPOPT.js} +6 -6
  79. package/dist/bundle/{embedder-WZIZCWLX.js → embedder-B43WGNBD.js} +9 -9
  80. package/dist/bundle/{failure-FFPK2WYB.js → failure-XP5QYV2T.js} +2 -2
  81. package/dist/bundle/{first-run-6DVWZ3JQ.js → first-run-XIIUARNM.js} +12 -11
  82. package/dist/bundle/first-screen-Z7HC6PQU.js +34 -0
  83. package/dist/bundle/{instructions-UWONE6UT.js → instructions-R7OHVAWH.js} +1 -1
  84. package/dist/bundle/mail.js +37 -13
  85. package/dist/bundle/{mcp-CFVG2OUS.js → mcp-7KQUJNFN.js} +2 -2
  86. package/dist/bundle/{node-HLAOYJDB.js → node-3N2JGZ7V.js} +2 -2
  87. package/dist/bundle/{node-sqlite-RO66I7W6.js → node-sqlite-WFJXW3CZ.js} +10 -6
  88. package/dist/bundle/{oauth-VNLB2TET.js → oauth-SVJLQTWV.js} +7 -7
  89. package/dist/bundle/{open-QQSG343L.js → open-ZDONVKSX.js} +5 -5
  90. package/dist/bundle/{openai-JTFC7OGF.js → openai-XVEW6XOU.js} +21 -38
  91. package/dist/bundle/{process-3CZAXR6P.js → process-YAHHUFR5.js} +1 -1
  92. package/dist/bundle/{program-XTOS4RAM.js → program-HU2UVMJE.js} +7071 -5421
  93. package/dist/bundle/{prompt-HGQ6GPYL.js → prompt-JAJ2CUJI.js} +5 -5
  94. package/dist/bundle/{recognize-2SHMNEIZ.js → recognize-UFBWUNFR.js} +4 -4
  95. package/dist/bundle/{remote-GBQC3433.js → remote-2GFOVLCR.js} +9 -7
  96. package/dist/bundle/{rerank-FQHQXFNR.js → rerank-BGPSMXTL.js} +7 -7
  97. package/dist/bundle/{serve-THU67QUZ.js → serve-CB3XJTH3.js} +9 -9
  98. package/dist/bundle/server-34GEF22R.js +68 -0
  99. package/dist/bundle/{server-LOT3CLYX.js → server-M7FQY7TX.js} +42 -40
  100. package/dist/bundle/{sqlite-runtime-NOOUMBC4.js → sqlite-runtime-AEV6PGDR.js} +6 -6
  101. package/dist/bundle/{state-KSKZCV2U.js → state-YLBEQLBI.js} +6 -6
  102. package/dist/bundle/{store-BAKSHTKF.js → store-CDUL3HKK.js} +19 -16
  103. package/dist/bundle/{store-OHNZOQ7U.js → store-EKWKY6GG.js} +49 -20
  104. package/dist/bundle/store-maintenance-command-XH2JUM5F.js +58 -0
  105. package/dist/config.d.ts +4 -0
  106. package/dist/config.d.ts.map +1 -1
  107. package/dist/version.d.ts +1 -1
  108. package/dist/version.js +1 -1
  109. package/package.json +3 -3
  110. package/dist/bundle/chunk-5UKBUI4I.js +0 -35
  111. package/dist/bundle/chunk-EXPR6QAX.js +0 -394
  112. package/dist/bundle/chunk-FWFNUJQD.js +0 -12172
  113. package/dist/bundle/command-contract-IIHBNF7J.js +0 -35
  114. package/dist/bundle/first-screen-SRZ7NYHZ.js +0 -33
  115. package/dist/bundle/server-VKMUX7ZT.js +0 -65
  116. package/dist/bundle/store-maintenance-command-ROQHJVEA.js +0 -54
  117. /package/dist/bundle/{chunk-QZLK2ISN.js → chunk-YVNHQFLC.js} +0 -0
@@ -2,11 +2,11 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  renderMessages
5
- } from "./chunk-AGNAT7CM.js";
5
+ } from "./chunk-HEYVMAAQ.js";
6
6
  import {
7
7
  answerOf,
8
8
  messengerContext
9
- } from "./chunk-VYHIX3OP.js";
9
+ } from "./chunk-EXVY76VO.js";
10
10
  import {
11
11
  FETCHING,
12
12
  RULES_VERSION,
@@ -23,6 +23,7 @@ import {
23
23
  patiently,
24
24
  pollVoteAnswer,
25
25
  queryTerms,
26
+ refuseLockedOutput,
26
27
  senderIsMe,
27
28
  serveRelay,
28
29
  servicesFor,
@@ -30,17 +31,17 @@ import {
30
31
  typedQuery,
31
32
  withQuery,
32
33
  withTimeLimit
33
- } from "./chunk-LQDMUMA2.js";
34
+ } from "./chunk-WX6OYVCH.js";
34
35
  import {
35
36
  holdLock,
36
37
  lockPath,
37
38
  releaseLock,
38
39
  servingProfiles,
39
40
  takeLock
40
- } from "./chunk-M7RGG3UU.js";
41
+ } from "./chunk-PGC5TRH6.js";
41
42
  import {
42
43
  readSecret
43
- } from "./chunk-S5OTP7XS.js";
44
+ } from "./chunk-PP3YOAWG.js";
44
45
  import {
45
46
  Command,
46
47
  LOCAL_READ,
@@ -49,7 +50,7 @@ import {
49
50
  REMOTE_WRITE,
50
51
  annotate,
51
52
  codeOf,
52
- currentRun,
53
+ commandAt,
53
54
  destroysNothing,
54
55
  environmentOf,
55
56
  itemOf,
@@ -66,20 +67,21 @@ import {
66
67
  snakeKeys,
67
68
  storeTable,
68
69
  withoutProviderRefs
69
- } from "./chunk-B6QMMRIM.js";
70
+ } from "./chunk-KFB2X6KE.js";
70
71
  import {
71
72
  levelFor
72
- } from "./chunk-SBGXKM4U.js";
73
+ } from "./chunk-DIA56CS7.js";
73
74
  import {
74
75
  holdersOf
75
- } from "./chunk-OU5CWCG2.js";
76
+ } from "./chunk-IACWKZWS.js";
76
77
  import {
77
78
  QUICK_HEALTH_CHECKS,
78
- explainDamage,
79
79
  fts5Tables,
80
80
  invalidJson,
81
+ lossUnknown,
82
+ storeDamageReport,
81
83
  storeHealth
82
- } from "./chunk-CYQVWITQ.js";
84
+ } from "./chunk-S2QRAKQI.js";
83
85
  import {
84
86
  CORPORA,
85
87
  MIGRATIONS,
@@ -114,39 +116,51 @@ import {
114
116
  storeClients,
115
117
  storeContents,
116
118
  vectorIndexCounts
117
- } from "./chunk-NOA6E6MM.js";
118
- import {
119
- formatLocator,
120
- parseLocator
121
- } from "./chunk-FWFNUJQD.js";
119
+ } from "./chunk-A6BPOX5O.js";
122
120
  import {
121
+ currentRun,
123
122
  readDamageMark,
124
123
  readHealthMark,
124
+ readJournalMark,
125
125
  recordDeepCheck
126
- } from "./chunk-EXPR6QAX.js";
126
+ } from "./chunk-MBFPFWCO.js";
127
127
  import {
128
+ formatLocator,
129
+ parseLocator,
128
130
  queryFieldsOf
129
- } from "./chunk-7YRKUEYE.js";
131
+ } from "./chunk-5ZYFV6FD.js";
130
132
  import {
131
133
  failureKey,
132
134
  isStoreDamage
133
- } from "./chunk-R554W7ZO.js";
135
+ } from "./chunk-U6IQ6YQ2.js";
136
+ import {
137
+ modelAddressAllowed,
138
+ onThisComputer
139
+ } from "./chunk-K6HR6HCO.js";
140
+ import {
141
+ readSharedSection,
142
+ sharedConfigPath,
143
+ writeSharedSection
144
+ } from "./chunk-KK4HD3SI.js";
134
145
  import {
135
146
  storePath
136
- } from "./chunk-5UKBUI4I.js";
147
+ } from "./chunk-LGZPKKBN.js";
137
148
  import {
138
149
  openCache
139
- } from "./chunk-MUDHCYN4.js";
150
+ } from "./chunk-37F6QYTO.js";
140
151
  import {
152
+ Credentials,
153
+ isMovedRun,
141
154
  resolvePaths,
142
155
  writeSecurely
143
- } from "./chunk-LLYVBO3R.js";
156
+ } from "./chunk-TY644DKQ.js";
144
157
  import {
145
158
  array,
146
159
  boolean,
147
160
  check,
148
161
  forward,
149
162
  getDotPath,
163
+ maxLength,
150
164
  minLength,
151
165
  nullable,
152
166
  object,
@@ -161,10 +175,10 @@ import {
161
175
  string,
162
176
  transform,
163
177
  trim
164
- } from "./chunk-GOMJNH56.js";
178
+ } from "./chunk-IZOYW4Z4.js";
165
179
  import {
166
180
  CliError
167
- } from "./chunk-DALBYUPC.js";
181
+ } from "./chunk-VUBZFMGP.js";
168
182
  import {
169
183
  __commonJS,
170
184
  __name,
@@ -5504,11 +5518,11 @@ var require_liquid_node = __commonJS({
5504
5518
  }
5505
5519
  });
5506
5520
 
5507
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5521
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5508
5522
  import { chmodSync, constants, copyFileSync, existsSync as existsSync10, mkdirSync, realpathSync as realpathSync3, renameSync as renameSync3, rmSync as rmSync3, statfsSync as statfsSync2, statSync as statSync4, writeFileSync as writeFileSync2 } from "node:fs";
5509
5523
  import { dirname as dirname3, resolve } from "node:path";
5510
5524
 
5511
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/sealed.js
5525
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/sealed.js
5512
5526
  import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
5513
5527
  import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
5514
5528
  import { Transform } from "node:stream";
@@ -5615,7 +5629,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
5615
5629
  renameSync(pending, to);
5616
5630
  }, "unsealFile");
5617
5631
 
5618
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5632
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5619
5633
  var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
5620
5634
  var fileSchemaOf = /* @__PURE__ */ __name((database) => {
5621
5635
  const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
@@ -5639,7 +5653,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
5639
5653
  };
5640
5654
  }, "compatibilityOf");
5641
5655
 
5642
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/repair.js
5656
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/store/repair.js
5643
5657
  import { createHash as createHash2 } from "node:crypto";
5644
5658
  var COPY_MARK = "__repair_";
5645
5659
  var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
@@ -5893,19 +5907,19 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
5893
5907
  return found;
5894
5908
  }, "deleteCopy");
5895
5909
 
5896
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5910
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5897
5911
  import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
5898
5912
 
5899
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5913
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
5900
5914
  import { existsSync as existsSync3 } from "node:fs";
5901
5915
 
5902
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/recover.js
5916
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/store/recover.js
5903
5917
  import { execFileSync, spawn } from "node:child_process";
5904
5918
  import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
5905
5919
  import { basename, dirname, join } from "node:path";
5906
5920
  import { Transform as Transform2 } from "node:stream";
5907
5921
 
5908
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/refill.js
5922
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/store/refill.js
5909
5923
  var REFILL_MARGIN_MS = 864e5;
5910
5924
  var TIME_KEYS = 1e12;
5911
5925
  var integerId = `external_id GLOB '[0-9]*' AND NOT external_id GLOB '*[^0-9]*'`;
@@ -5985,7 +5999,7 @@ var forgetMail = /* @__PURE__ */ __name((database, cutoff, now) => {
5985
5999
  return [...folders].map(([account, count3]) => ({ account, folders: count3 }));
5986
6000
  }, "forgetMail");
5987
6001
 
5988
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/recover.js
6002
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/store/recover.js
5989
6003
  var SQLITE3_MINIMUM = [3, 43, 0];
5990
6004
  var STORE_PARTS = ["", "-wal", "-shm"];
5991
6005
  var RECOVER_LOCK = ".recover-lock";
@@ -6513,7 +6527,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
6513
6527
  }
6514
6528
  }, "recoverLocked");
6515
6529
 
6516
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6530
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
6517
6531
  var COUNTED = [
6518
6532
  "accounts",
6519
6533
  "chats",
@@ -6546,18 +6560,23 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) =>
6546
6560
  }
6547
6561
  } catch {
6548
6562
  }
6563
+ const journal = readJournalMark(path);
6549
6564
  recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema });
6550
6565
  const mark = readDamageMark(path);
6551
- const explanation = explainDamage(health, command, mark);
6566
+ const lastKnownGood = readHealthMark(path)?.last_ok_at ?? null;
6552
6567
  const inUse = storeHolders(path) ?? null;
6553
6568
  const timers = activeTimers() ?? null;
6554
6569
  const sqlite3 = sqlite3Program();
6555
- const next = health.ok ? [] : [
6556
- ...timers?.length ? [stopTimers(timers)] : [],
6557
- ...(inUse ?? []).map(({ pid, name }) => `stop ${name} (process ${pid}): it has the store open`),
6558
- ...sqlite3.usable ? [] : ["install sqlite3 3.43 or newer (apt install sqlite3, brew install sqlite)"],
6559
- `${command} store recover run`
6560
- ];
6570
+ const report = storeDamageReport({
6571
+ health,
6572
+ command,
6573
+ mark,
6574
+ journal,
6575
+ lastOkAt: lastKnownGood,
6576
+ holders: inUse,
6577
+ timers,
6578
+ sqlite3Usable: sqlite3.usable
6579
+ });
6561
6580
  return {
6562
6581
  path,
6563
6582
  exists: true,
@@ -6568,13 +6587,13 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) =>
6568
6587
  damagedSearchIndexes: (health.searchIndexes ?? []).filter((index) => !index.ok).map(({ name, error }) => ({ name, ...error ? { error } : {} })),
6569
6588
  invalidJson: health.invalidJson ?? [],
6570
6589
  rows,
6571
- explanation,
6590
+ report,
6572
6591
  damageMark: mark ? (({ inode: _, ...seen }) => seen)(mark) : null,
6573
- lastKnownGood: readHealthMark(path)?.last_ok_at ?? null,
6592
+ lastKnownGood,
6574
6593
  inUse,
6575
6594
  timers,
6576
6595
  sqlite3: { version: sqlite3.version, usable: sqlite3.usable },
6577
- next
6596
+ next: report?.steps.map((step) => step.command) ?? []
6578
6597
  };
6579
6598
  }, "storeRecoveryCheck");
6580
6599
  var storeRecoveryRun = /* @__PURE__ */ __name(async (env, { command, version, note, timers: scheduled = activeTimers, copy }) => {
@@ -6615,13 +6634,12 @@ var refetchNotes = /* @__PURE__ */ __name(({ since, chats, mail }) => {
6615
6634
  var recoveryNotes = /* @__PURE__ */ __name((answer) => {
6616
6635
  if ("keptAt" in answer) {
6617
6636
  const lost = answer.lost.map(({ table, before, read, kept, goneAtLeast, seenIn }) => `${table}: ${kept} kept of ${before ?? "an uncountable number"}${read > kept ? `, ${read - kept} read but unusable` : ""}` + (goneAtLeast > 0 ? `; at least ${goneAtLeast} rows are gone (the index ${seenIn} lists them)` : ""));
6618
- const since = answer.lastKnownGood ? `since the last deep check that passed (${answer.lastKnownGood})` : "since the store was made (no deep check that passed is on record)";
6619
6637
  return [
6620
6638
  `recovered in ${answer.seconds.total} s; the damaged file is kept at ${answer.keptAt}`,
6621
6639
  ...lost,
6622
6640
  ...Object.entries(answer.placed).map(([table, rows]) => `${table}: ${rows} rows found on pages no table claimed were put back`),
6623
6641
  ...refetchNotes(answer.refetch),
6624
- `${lost.some((line) => line.includes("are gone")) ? "more rows may be gone" : "how many rows were lost is unknown"}: damage can take rows written ${since} without leaving a trace; a sync fetches again what the servers still hold`,
6642
+ lossUnknown(answer.lastKnownGood, lost.some((line) => line.includes("are gone"))),
6625
6643
  ...answer.dangling.map(({ table, parent, rows }) => `${rows} rows of ${table} point at ${parent} rows the store does not hold`),
6626
6644
  ...answer.invalidJson.map(({ table, column, rows, required }) => `${table}.${column}: ${rows} values were not valid JSON \u2014 ${required ? "those rows were dropped" : "set to empty"}`),
6627
6645
  ...answer.next.map((line) => `next: ${line}`)
@@ -6629,13 +6647,16 @@ var recoveryNotes = /* @__PURE__ */ __name((answer) => {
6629
6647
  }
6630
6648
  if (!answer.exists)
6631
6649
  return ["no store yet"];
6632
- if (answer.ok)
6650
+ const report = answer.report;
6651
+ if (!report)
6633
6652
  return [`the store is healthy (checked every page and search index in ${answer.seconds} s)`];
6634
- const why = answer.explanation;
6635
6653
  return [
6636
- ...why ? [why.what, ...why.impact, why.externalUnaffected] : [],
6637
- answer.lastKnownGood ? `the store last passed a deep check at ${answer.lastKnownGood}` : "no deep check that passed is on record for this store",
6638
- ...answer.next.map((line) => `next: ${line}`)
6654
+ report.whatHappened,
6655
+ ...report.impact,
6656
+ report.externalDataSafe,
6657
+ report.loss,
6658
+ ...report.likelyCauses.map(({ cause, check: check2 }) => `maybe: ${cause} \u2014 check: ${check2}`),
6659
+ ...report.steps.map(({ command, why, destructive }) => `next: ${command} # ${destructive ? "changes things: " : ""}${why}`)
6639
6660
  ];
6640
6661
  }, "recoveryNotes");
6641
6662
  var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
@@ -6662,7 +6683,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
6662
6683
  return recover;
6663
6684
  }, "storeRecoverCommand");
6664
6685
 
6665
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6686
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/store-info.js
6666
6687
  var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
6667
6688
  var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
6668
6689
  var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
@@ -6708,7 +6729,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
6708
6729
  renderAnswer(this, outputFor(this), itemOf(answer));
6709
6730
  }), "storeInfoCommand");
6710
6731
 
6711
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6732
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
6712
6733
  var ENCRYPT_OPTION = [
6713
6734
  "--encrypt",
6714
6735
  "compress and encrypt with a password, typed at a hidden prompt or piped on stdin; it is never kept \u2014 lose it and the file cannot be opened"
@@ -6727,7 +6748,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
6727
6748
  return password;
6728
6749
  }, "passwordOf");
6729
6750
 
6730
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/rules.js
6751
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/replies/rules.js
6731
6752
  import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
6732
6753
  import { join as join2 } from "node:path";
6733
6754
  var REPLY_ACTIONS = ["reply", "task"];
@@ -6898,7 +6919,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
6898
6919
  }, "problem");
6899
6920
  var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
6900
6921
 
6901
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/state.js
6922
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/replies/state.js
6902
6923
  import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
6903
6924
  import { join as join3 } from "node:path";
6904
6925
  var ANSWERED_KEPT = 1e3;
@@ -6951,7 +6972,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
6951
6972
  }, "recordReply");
6952
6973
  var broken2 = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply state ${path} cannot be read (${why}) \u2014 fix or move the file`), "broken");
6953
6974
 
6954
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/decide.js
6975
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/replies/decide.js
6955
6976
  var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
6956
6977
  var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
6957
6978
  const { message, chat, owner, sender } = incoming;
@@ -7057,10 +7078,10 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
7057
7078
  return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
7058
7079
  }, "filled");
7059
7080
 
7060
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/template.js
7081
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/replies/template.js
7061
7082
  var import_liquidjs2 = __toESM(require_liquid_node(), 1);
7062
7083
 
7063
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/render/liquid.js
7084
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/render/liquid.js
7064
7085
  var import_liquidjs = __toESM(require_liquid_node(), 1);
7065
7086
  var safeLiquid = /* @__PURE__ */ __name((limits) => {
7066
7087
  const engine = new import_liquidjs.Liquid({
@@ -7087,7 +7108,7 @@ var safeLiquid = /* @__PURE__ */ __name((limits) => {
7087
7108
  return engine;
7088
7109
  }, "safeLiquid");
7089
7110
 
7090
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/template.js
7111
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/replies/template.js
7091
7112
  var TEMPLATE_LIMITS = {
7092
7113
  parse: 32768,
7093
7114
  renders: 2e3,
@@ -7226,7 +7247,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
7226
7247
  }
7227
7248
  }, "renderReplyTemplate");
7228
7249
 
7229
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
7250
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
7230
7251
  var DRY_RUN_DAYS = 7;
7231
7252
  var PAGE = 500;
7232
7253
  var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
@@ -7340,7 +7361,178 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
7340
7361
  }
7341
7362
  }, "storedSince");
7342
7363
 
7343
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/consents.js
7364
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/models/ai.js
7365
+ var AI_PROVIDERS = ["anthropic", "openai", "ollama"];
7366
+ var DEFAULT_BASE_URL = {
7367
+ anthropic: "https://api.anthropic.com",
7368
+ openai: "https://api.openai.com/v1",
7369
+ ollama: "http://127.0.0.1:11434/v1"
7370
+ };
7371
+ var OFFICIAL = {
7372
+ "https://api.openai.com": "openai",
7373
+ "https://api.anthropic.com": "anthropic"
7374
+ };
7375
+ var SECTION = "ai";
7376
+ var aiAddressAllowed = modelAddressAllowed;
7377
+ var consentShape = strictObject({
7378
+ origin: string(),
7379
+ model: string(),
7380
+ at: string()
7381
+ });
7382
+ var settingShape = strictObject({
7383
+ provider: picklist(AI_PROVIDERS),
7384
+ model: pipe(string(), trim(), minLength(1), maxLength(200)),
7385
+ base_url: optional(pipe(string(), check(aiAddressAllowed, "use https, or http only on this computer"))),
7386
+ images: optional(consentShape)
7387
+ });
7388
+ var aiSettingPath = /* @__PURE__ */ __name((env) => sharedConfigPath(storePath(env), env), "aiSettingPath");
7389
+ var readAiSetting = /* @__PURE__ */ __name((path) => {
7390
+ const section = readSharedSection(path, SECTION);
7391
+ if (section === void 0)
7392
+ return void 0;
7393
+ const checked = safeParse(settingShape, section);
7394
+ if (!checked.success)
7395
+ throw new CliError("configuration_error", `${path}: ai.${getDotPath(checked.issues[0]) ?? "setting"} is invalid`, {
7396
+ reason: "ai.setting-invalid"
7397
+ });
7398
+ return checked.output;
7399
+ }, "readAiSetting");
7400
+ var writeAiSetting = /* @__PURE__ */ __name((path, setting) => writeSharedSection(path, SECTION, setting), "writeAiSetting");
7401
+ var aiSettingOf = /* @__PURE__ */ __name((given) => {
7402
+ const draft = {
7403
+ provider: given.provider,
7404
+ model: given.model,
7405
+ ...given.baseUrl?.trim() ? { base_url: given.baseUrl.trim().replace(/\/+$/, "") } : {}
7406
+ };
7407
+ const checked = safeParse(settingShape, draft);
7408
+ if (!checked.success) {
7409
+ const field = getDotPath(checked.issues[0]);
7410
+ throw new CliError("validation_error", field === "provider" ? `the provider is one of ${AI_PROVIDERS.join(", ")}` : field === "base_url" ? "this address is not allowed: use https, or http only on this computer" : "name the model, 1 to 200 characters", { reason: field === "base_url" ? "ai.address-refused" : "ai.setting-invalid" });
7411
+ }
7412
+ if (checked.output.provider === "ollama" && !onThisComputer(aiBaseUrl(checked.output)))
7413
+ throw new CliError("validation_error", "Ollama is read only on this computer", { reason: "ai.address-refused" });
7414
+ return given.allowImages ? {
7415
+ ...checked.output,
7416
+ images: { origin: aiOrigin(checked.output), model: checked.output.model, at: (/* @__PURE__ */ new Date()).toISOString() }
7417
+ } : checked.output;
7418
+ }, "aiSettingOf");
7419
+ var aiBaseUrl = /* @__PURE__ */ __name((setting) => setting.base_url ?? DEFAULT_BASE_URL[setting.provider], "aiBaseUrl");
7420
+ var aiOrigin = /* @__PURE__ */ __name((setting) => new URL(aiBaseUrl(setting)).origin, "aiOrigin");
7421
+ var aiTarget = /* @__PURE__ */ __name((setting) => ({
7422
+ provider: setting.provider === "anthropic" ? "anthropic" : "openai",
7423
+ model: setting.model,
7424
+ baseUrl: aiBaseUrl(setting)
7425
+ }), "aiTarget");
7426
+ var aiImagesAllowed = /* @__PURE__ */ __name((setting) => setting.images?.origin === aiOrigin(setting) && setting.images.model === setting.model, "aiImagesAllowed");
7427
+ var aiKeys = /* @__PURE__ */ __name((app, env, keyring) => {
7428
+ const where = { appName: "WireCat", prefix: "WIRECAT", env };
7429
+ const credentials = new Credentials({
7430
+ configDir: resolvePaths(where).config,
7431
+ service: "WireCat",
7432
+ // A tool run with its own folders moved (MEMO_CONFIG_DIR…) is a test or a sandbox, not the owner.
7433
+ isolated: isMovedRun(where) || isMovedRun({ appName: app.appName, prefix: app.envPrefix, env }),
7434
+ env,
7435
+ ...keyring ? { keyring } : {},
7436
+ warn: /* @__PURE__ */ __name((message) => process.stderr.write(`${message}
7437
+ `), "warn")
7438
+ });
7439
+ const account = /* @__PURE__ */ __name((origin) => `ai:${origin}`, "account");
7440
+ return {
7441
+ read: /* @__PURE__ */ __name((origin) => {
7442
+ const stored = credentials.read(account(origin));
7443
+ if (stored)
7444
+ return { key: stored.secret, source: stored.source };
7445
+ const official = OFFICIAL[origin];
7446
+ const legacy = official ?? (origin.startsWith("https://") ? endpointKeyName(origin) : void 0);
7447
+ const found = legacy === void 0 ? void 0 : embeddingKeys(app, env, keyring).read(legacy);
7448
+ return found ? { key: found.key, source: found.source === "env" ? "environment" : found.source } : void 0;
7449
+ }, "read"),
7450
+ write: /* @__PURE__ */ __name((origin, key) => credentials.write(account(origin), key, { signIn: true }), "write"),
7451
+ remove: /* @__PURE__ */ __name((origin) => credentials.remove(account(origin)), "remove")
7452
+ };
7453
+ }, "aiKeys");
7454
+ var aiNeedsKey = /* @__PURE__ */ __name((setting) => aiLeavesComputer(setting), "aiNeedsKey");
7455
+ var aiTakesKey = /* @__PURE__ */ __name((setting) => setting.provider !== "ollama", "aiTakesKey");
7456
+ var keyFor = /* @__PURE__ */ __name((setting, deps) => aiTakesKey(setting) ? aiKeys(deps.app, deps.env, deps.keyring).read(aiOrigin(setting))?.key : void 0, "keyFor");
7457
+ var gatewayFor = /* @__PURE__ */ __name((setting, deps, key) => modelGateway({
7458
+ resolve: /* @__PURE__ */ __name(() => aiTarget(setting), "resolve"),
7459
+ consent: /* @__PURE__ */ __name(() => true, "consent"),
7460
+ key: /* @__PURE__ */ __name(() => key, "key"),
7461
+ env: deps.env,
7462
+ ...deps.fetch ? { fetch: deps.fetch } : {},
7463
+ ...deps.signal ? { signal: deps.signal } : {}
7464
+ }), "gatewayFor");
7465
+ var aiLeavesComputer = /* @__PURE__ */ __name((setting) => !onThisComputer(aiBaseUrl(setting)), "aiLeavesComputer");
7466
+ var sharedModel = /* @__PURE__ */ __name((deps) => {
7467
+ const setting = readAiSetting(aiSettingPath(deps.env));
7468
+ if (!setting)
7469
+ return void 0;
7470
+ return { target: { ...aiTarget(setting), baseUrl: aiBaseUrl(setting) }, key: keyFor(setting, deps), setting };
7471
+ }, "sharedModel");
7472
+ var reasonOf = /* @__PURE__ */ __name((error) => {
7473
+ if (!(error instanceof CliError))
7474
+ return "ai.failed";
7475
+ if (error.code === "rate_limited")
7476
+ return "ai.rate-limited";
7477
+ const { reason, status } = error.details;
7478
+ if (reason === "model.key-rejected")
7479
+ return "ai.key-rejected";
7480
+ if (reason === "model.unreachable")
7481
+ return "ai.unreachable";
7482
+ if (reason === "model.empty-answer")
7483
+ return "ai.empty-answer";
7484
+ if (status === 402)
7485
+ return "ai.no-credit";
7486
+ if (status === 404)
7487
+ return "ai.model-unknown";
7488
+ if (typeof status === "number" && status >= 500)
7489
+ return "ai.provider-error";
7490
+ return "ai.failed";
7491
+ }, "reasonOf");
7492
+ var checkAi = /* @__PURE__ */ __name(async (deps) => {
7493
+ const setting = readAiSetting(aiSettingPath(deps.env));
7494
+ if (!setting)
7495
+ return { ok: false, reason: "ai.not-set", ms: null };
7496
+ const key = keyFor(setting, deps);
7497
+ if (aiNeedsKey(setting) && !key)
7498
+ return { ok: false, reason: "ai.key-missing", ms: null };
7499
+ const started = Date.now();
7500
+ try {
7501
+ await gatewayFor(setting, deps, key).complete({
7502
+ purpose: "check",
7503
+ system: "Reply with the word OK.",
7504
+ prompt: "OK?",
7505
+ // Reasoning models spend tokens before they answer; too low a cap reads as a broken setup.
7506
+ maxTokens: 2048
7507
+ });
7508
+ return { ok: true, reason: "ai.ok", ms: Date.now() - started };
7509
+ } catch (error) {
7510
+ return { ok: false, reason: reasonOf(error), ms: null };
7511
+ }
7512
+ }, "checkAi");
7513
+
7514
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/models/purpose.js
7515
+ var HOSTED = {
7516
+ openai: "https://api.openai.com/v1",
7517
+ anthropic: "https://api.anthropic.com"
7518
+ };
7519
+ var purposeModel = /* @__PURE__ */ __name((settings, purpose, deps) => {
7520
+ const configured = modelTarget(settings, purpose);
7521
+ if (configured) {
7522
+ const baseUrl = configured.baseUrl ?? HOSTED[configured.provider] ?? "";
7523
+ return {
7524
+ target: { ...configured, baseUrl },
7525
+ key: /* @__PURE__ */ __name(() => embeddingKeys(deps.app, deps.env, deps.keyring).read(configured.baseUrl === void 0 ? configured.provider : endpointKeyName(configured.baseUrl))?.key, "key")
7526
+ };
7527
+ }
7528
+ const provider = settings.models?.[purpose]?.provider ?? settings.models?.default?.provider;
7529
+ if (provider === "off")
7530
+ return void 0;
7531
+ const shared = sharedModel(deps);
7532
+ return shared ? { target: shared.target, key: /* @__PURE__ */ __name(() => shared.key, "key"), shared: shared.setting } : void 0;
7533
+ }, "purposeModel");
7534
+
7535
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/replies/consents.js
7344
7536
  import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
7345
7537
  import { join as join4 } from "node:path";
7346
7538
  var shape = strictObject({
@@ -7365,19 +7557,21 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
7365
7557
  return consent.provider === provider && !consent.deniedChats.includes(chat);
7366
7558
  }, "mayModelReply");
7367
7559
 
7368
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7560
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/replies/rendering.js
7369
7561
  var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options = {
7370
7562
  ai: true
7371
7563
  }) => async (rule2, message, chat, now) => {
7564
+ const deps = { app, env, keyring: options.keyring };
7372
7565
  let called;
7373
7566
  const gateway = modelGateway({
7374
7567
  signal: options.signal,
7568
+ env,
7375
7569
  resolve: /* @__PURE__ */ __name((purpose) => {
7376
- called = modelTarget(settings(), purpose);
7377
- return called;
7570
+ called = purposeModel(settings(), purpose, deps);
7571
+ return called?.target;
7378
7572
  }, "resolve"),
7379
7573
  consent: /* @__PURE__ */ __name((_request, target) => mayModelReply(replyConsentPathFor(app, profile, env), replyModelIdentity(target.provider, target.baseUrl ?? ""), message.chatId), "consent"),
7380
- key: /* @__PURE__ */ __name((provider, target) => embeddingKeys(app, env, options.keyring).read(target.baseUrl === void 0 ? provider : endpointKeyName(target.baseUrl))?.key, "key")
7574
+ key: /* @__PURE__ */ __name(() => called?.key(), "key")
7381
7575
  });
7382
7576
  if (options.signal?.aborted)
7383
7577
  throw new CliError("cancelled", "reply rendering cancelled");
@@ -7399,9 +7593,8 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
7399
7593
  });
7400
7594
  if (options.signal?.aborted)
7401
7595
  throw new CliError("cancelled", "reply rendering cancelled");
7402
- const current = modelTarget(settings(), "replies");
7403
- const baseUrl = called?.baseUrl ?? (called?.provider === "anthropic" ? "https://api.anthropic.com" : "https://api.openai.com/v1");
7404
- if (!called || JSON.stringify(current) !== JSON.stringify(called) || !mayModelReply(replyConsentPathFor(app, profile, env), replyModelIdentity(called.provider, baseUrl), message.chatId)) {
7596
+ const current = purposeModel(settings(), "replies", deps)?.target;
7597
+ if (!called || JSON.stringify(current) !== JSON.stringify(called.target) || !mayModelReply(replyConsentPathFor(app, profile, env), replyModelIdentity(called.target.provider, called.target.baseUrl), message.chatId)) {
7405
7598
  throw new CliError("permission_error", "reply model consent or configuration changed during rendering");
7406
7599
  }
7407
7600
  return result3;
@@ -7412,7 +7605,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
7412
7605
  return result2;
7413
7606
  }, "replyRenderer");
7414
7607
 
7415
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/serve.js
7608
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/replies/serve.js
7416
7609
  var NOT_ALLOWED = "replies.send is not allow";
7417
7610
  var NO_RULES = "no rules";
7418
7611
  var ONLY_TASK = "opened a task, sent nothing";
@@ -7505,7 +7698,7 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
7505
7698
  return { skip: why };
7506
7699
  }, "replyTo");
7507
7700
 
7508
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7701
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
7509
7702
  var START_SYNC_DELAY_MS = 3e4;
7510
7703
  var START_SYNC_BUDGET_MS = 5 * 6e4;
7511
7704
  var START_SYNC_WINDOW_MS = 7 * 864e5;
@@ -7582,7 +7775,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch, note, warn,
7582
7775
  };
7583
7776
  }, "startSync");
7584
7777
 
7585
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7778
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
7586
7779
  var FIRST_FETCH_MS = 6e4;
7587
7780
  var DAY_MS = 864e5;
7588
7781
  var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
@@ -7636,7 +7829,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs =
7636
7829
  };
7637
7830
  }, "memberFetches");
7638
7831
 
7639
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7832
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
7640
7833
  var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
7641
7834
  var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
7642
7835
  if (context.format === "pretty") {
@@ -7669,7 +7862,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
7669
7862
  return context;
7670
7863
  }, "recordDiagnostics");
7671
7864
 
7672
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-outdated.js
7865
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-outdated.js
7673
7866
  import { existsSync as existsSync8, readFileSync as readFileSync5, realpathSync as realpathSync2 } from "node:fs";
7674
7867
  import { dirname as dirname2, join as join5 } from "node:path";
7675
7868
  var OUTDATED_CHECK_MS = 6e4;
@@ -7755,7 +7948,7 @@ var watchOutdated = /* @__PURE__ */ __name(({ check: check2, onOutdated, everyMs
7755
7948
  };
7756
7949
  }, "watchOutdated");
7757
7950
 
7758
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7951
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7759
7952
  var STEMS_EVERY_MS = 3e4;
7760
7953
  var STEMS_SLICE_MS = 2e3;
7761
7954
  var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
@@ -7795,7 +7988,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
7795
7988
  };
7796
7989
  }, "stemFills");
7797
7990
 
7798
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7991
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7799
7992
  var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
7800
7993
  var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7801
7994
  kind: attachment.kind,
@@ -7807,6 +8000,7 @@ var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7807
8000
  width: attachment.width,
7808
8001
  height: attachment.height,
7809
8002
  duration: attachment.duration,
8003
+ local_path: attachment.localPath,
7810
8004
  contact: attachment.contact && defined({
7811
8005
  name: attachment.contact.name,
7812
8006
  first_name: attachment.contact.firstName,
@@ -7814,7 +8008,7 @@ var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7814
8008
  phone: attachment.contact.phone,
7815
8009
  user_id: attachment.contact.userId
7816
8010
  }),
7817
- buttons: attachment.buttons
8011
+ buttons: attachment.buttons?.map((row) => row.map(({ data: _data, ...button }) => button))
7818
8012
  }), "attachmentItem");
7819
8013
  var quotedItem = /* @__PURE__ */ __name((quoted) => quoted === null ? null : {
7820
8014
  id: quoted.id,
@@ -7890,7 +8084,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
7890
8084
  locale: messenger.app.locale
7891
8085
  }), "viewOf");
7892
8086
 
7893
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
8087
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7894
8088
  var observed = /* @__PURE__ */ __name((value) => ({
7895
8089
  value: value.value,
7896
8090
  observed_at: value.observedAt,
@@ -7957,7 +8151,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
7957
8151
  }
7958
8152
  }, "watchEventItem");
7959
8153
 
7960
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
8154
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7961
8155
  var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
7962
8156
  output: { entity: "watch_item" },
7963
8157
  effects: REMOTE_READ,
@@ -8112,7 +8306,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
8112
8306
  }
8113
8307
  }, "describe");
8114
8308
 
8115
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8309
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
8116
8310
  var serveCommand = /* @__PURE__ */ __name((messenger) => {
8117
8311
  const command = annotate(new Command("serve"), {
8118
8312
  output: { entity: "serve_summary" },
@@ -8395,7 +8589,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
8395
8589
  };
8396
8590
  }, "tasking");
8397
8591
 
8398
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8592
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
8399
8593
  import { existsSync as existsSync9 } from "node:fs";
8400
8594
  var PATH = "store tables list";
8401
8595
  var STORE_TABLES_QUERY = {
@@ -8412,14 +8606,14 @@ var filterOf = /* @__PURE__ */ __name((words) => {
8412
8606
  const kind = terms.get("kind");
8413
8607
  return { ...name === void 0 ? {} : { name }, ...kind === void 0 ? {} : { kind } };
8414
8608
  }, "filterOf");
8415
- var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
8416
- const tables = new Command("tables").description("the tables of the local archive");
8609
+ var storeTablesCommand = /* @__PURE__ */ __name((owner) => {
8610
+ const tables = new Command("tables").description("the tables of the local store");
8417
8611
  withQuery(annotate(tables.command("list"), {
8418
8612
  effects: LOCAL_READ,
8419
8613
  examples: [
8420
- `${messenger.app.command} store tables list`,
8421
- `${messenger.app.command} store tables list kind:data`,
8422
- `${messenger.app.command} store tables list --full --json`
8614
+ `${owner.app.command} store tables list`,
8615
+ `${owner.app.command} store tables list kind:data`,
8616
+ `${owner.app.command} store tables list --full --json`
8423
8617
  ]
8424
8618
  }), STORE_TABLES_QUERY).summary("every table of the local archive, with its kind and row count").description("every table of the local archive: its kind (data, search index, part of a search index, internal) and its rows, a search index's rows not counted; --full adds each table's size on disk, which reads the whole file (about ten seconds for 3 GB); changes nothing").action(async function(words) {
8425
8619
  const filter = filterOf(words);
@@ -8438,7 +8632,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
8438
8632
  return tables;
8439
8633
  }, "storeTablesCommand");
8440
8634
 
8441
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8635
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
8442
8636
  var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
8443
8637
  var WORD_INDEX = "message_words";
8444
8638
  var schemaOf = /* @__PURE__ */ __name((database) => {
@@ -8477,6 +8671,7 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, v
8477
8671
  if (!existsSync10(path))
8478
8672
  return { path, exists: false };
8479
8673
  const checked = await storeHealth(path, { deep });
8674
+ const journal = readJournalMark(path);
8480
8675
  const recorded = deep ? recordDeepCheck(path, checked, {
8481
8676
  cli: command ?? "unknown",
8482
8677
  ...version ? { version } : {},
@@ -8494,13 +8689,15 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, v
8494
8689
  ...checked.invalidJson?.length ? { invalidJson: checked.invalidJson } : {},
8495
8690
  ...checked.searchIndexes?.some((index) => !index.ok) ? { damagedSearchIndexes: checked.searchIndexes.filter((index) => !index.ok).map((index) => index.name) } : {}
8496
8691
  };
8497
- const damage = command ? explainDamage(checked, command, mark) : null;
8692
+ const damage = command ? storeDamageReport({ health: checked, command, mark, journal, lastOkAt: lastKnownGood }) : null;
8498
8693
  const healthOf = {
8499
8694
  health,
8500
8695
  lastKnownGood,
8501
8696
  ...mark ? { damageMark: withoutInode(mark) } : {},
8697
+ ...journal ? { journalMark: journal } : {},
8502
8698
  ...recorded?.cleared ? { damageMarkCleared: withoutInode(recorded.cleared) } : {},
8503
- ...damage ? { damage } : {}
8699
+ // `what` keeps memo's doctor, which reads it, compiling until it moves to `whatHappened`.
8700
+ ...damage ? { damage: { what: damage.whatHappened, ...damage } } : {}
8504
8701
  };
8505
8702
  try {
8506
8703
  return await reading(path, (database) => {
@@ -8520,27 +8717,52 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, v
8520
8717
  }
8521
8718
  }, "storeSummary");
8522
8719
  var result = /* @__PURE__ */ __name((command, value, next = []) => renderAnswer(command, outputFor(command), itemOf(snakeKeys(value), { next })), "result");
8523
- var storeMaintenanceCommands = /* @__PURE__ */ __name((messenger) => [
8720
+ var chatty = /* @__PURE__ */ __name((owner) => owner.provider !== void 0, "chatty");
8721
+ var archive = /* @__PURE__ */ __name((owner) => chatty(owner) ? "local archive" : "local store", "archive");
8722
+ var createdBy = /* @__PURE__ */ __name((owner) => chatty(owner) ? `the first \`${owner.app.command}\` command that reads a chat creates it` : `the first \`${owner.app.command}\` command that saves anything creates it`, "createdBy");
8723
+ var storeMaintenanceCommands = /* @__PURE__ */ __name((owner) => [
8524
8724
  storeInfoCommand(),
8525
- checkCommand(messenger),
8526
- migrateCommand(messenger),
8527
- reindexCommand(messenger),
8725
+ checkCommand(owner),
8726
+ migrateCommand(owner),
8727
+ reindexCommand(owner),
8528
8728
  backupCommand(),
8529
- restoreCommand(messenger),
8729
+ restoreCommand(owner),
8530
8730
  decryptCommand(),
8531
- repairCommand(messenger),
8532
- resetCommand(messenger),
8731
+ repairCommand(owner),
8732
+ resetCommand(owner),
8533
8733
  copiesCommand(),
8534
- storeTablesCommand(messenger),
8535
- storeRecoverCommand({ command: messenger.app.command, version: messenger.app.version })
8734
+ storeTablesCommand(owner),
8735
+ storeRecoverCommand({ command: owner.app.command, version: owner.app.version })
8536
8736
  ], "storeMaintenanceCommands");
8537
- var refuseWhileServing = /* @__PURE__ */ __name((command, messenger) => {
8538
- const serving = servingProfiles(messenger.app, environmentOf(command).env ?? process.env);
8737
+ var EXAMPLES = {
8738
+ backup: "./backup.db",
8739
+ check: "",
8740
+ "copies delete": "messages_copy_1",
8741
+ decrypt: "./backup.enc --output ./restored.db",
8742
+ info: "",
8743
+ migrate: "",
8744
+ rebuild: "",
8745
+ repair: "--dry-run",
8746
+ reset: "",
8747
+ restore: "./backup.db"
8748
+ };
8749
+ var addStoreMaintenanceCommands = /* @__PURE__ */ __name((store, owner, profile) => {
8750
+ for (const command of storeMaintenanceCommands(owner))
8751
+ store.addCommand(command);
8752
+ for (const [path, args] of Object.entries(EXAMPLES)) {
8753
+ const command = commandAt(store, path);
8754
+ if (command)
8755
+ annotate(command, { examples: [`${owner.app.command} ${profile} store ${path} ${args}`.trimEnd()] });
8756
+ }
8757
+ return store;
8758
+ }, "addStoreMaintenanceCommands");
8759
+ var refuseWhileServing = /* @__PURE__ */ __name((command, owner) => {
8760
+ const serving = servingProfiles(owner.app, environmentOf(command).env ?? process.env);
8539
8761
  if (serving.length > 0) {
8540
- throw new CliError("validation_error", `${messenger.app.command} serve is running for ${serving.join(", ")} \u2014 ${serving.map((profile) => `\`${messenger.app.command} ${profile} server stop\``).join(", ")} first`);
8762
+ throw new CliError("validation_error", `${owner.app.command} serve is running for ${serving.join(", ")} \u2014 ${serving.map((profile) => `\`${owner.app.command} ${profile} server stop\``).join(", ")} first`);
8541
8763
  }
8542
8764
  }, "refuseWhileServing");
8543
- var repairCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("repair"), { output: { entity: "store_repair" }, effects: LOCAL_WRITE }).summary("repair table shapes while keeping the old tables").description("bring every table to this build's shape, deleting nothing: a table of the wrong shape is kept as a copy beside a new one").option("--dry-run", "say what it would do, and change nothing").action(async function() {
8765
+ var repairCommand = /* @__PURE__ */ __name((owner) => annotate(new Command("repair"), { output: { entity: "store_repair" }, effects: LOCAL_WRITE }).summary("repair table shapes while keeping the old tables").description("bring every table to this build's shape, deleting nothing: a table of the wrong shape is kept as a copy beside a new one").option("--dry-run", "say what it would do, and change nothing").action(async function() {
8544
8766
  const { renderer, format } = outputFor(this);
8545
8767
  const { dryRun: dryRun2 } = this.opts();
8546
8768
  const path = storePath(environmentOf(this).env ?? process.env);
@@ -8549,13 +8771,13 @@ var repairCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("
8549
8771
  return;
8550
8772
  }
8551
8773
  if (!dryRun2)
8552
- refuseWhileServing(this, messenger);
8774
+ refuseWhileServing(this, owner);
8553
8775
  const fresh = await openCache(":memory:");
8554
8776
  try {
8555
8777
  const report = await reading(path, (database) => repairStore(database, fresh, { dryRun: dryRun2 === true }));
8556
8778
  result(this, { path, ...report });
8557
8779
  if (format === "pretty")
8558
- for (const note of notesOf(report, messenger.app.command))
8780
+ for (const note of notesOf(report, owner.app.command))
8559
8781
  renderer.note(note);
8560
8782
  } finally {
8561
8783
  fresh.close();
@@ -8589,7 +8811,7 @@ var copiesCommand = /* @__PURE__ */ __name(() => new Command("copies").descripti
8589
8811
  const deleted = await reading(path, (database) => deleteCopy(database, name));
8590
8812
  result(this, { path, deleted });
8591
8813
  })), "copiesCommand");
8592
- var checkCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("check"), { output: { entity: "store_check" }, effects: LOCAL_READ }).summary("check the local archive for problems").description("whether the store is healthy \u2014 integrity, search indexes, disk, and which chats are behind").action(async function() {
8814
+ var checkCommand = /* @__PURE__ */ __name((owner) => annotate(new Command("check"), { output: { entity: "store_check" }, effects: LOCAL_READ }).summary(`check the ${archive(owner)} for problems`).description(`whether the store is healthy \u2014 integrity, search indexes, disk${chatty(owner) ? ", and which chats are behind" : ""}`).action(async function() {
8593
8815
  const { renderer } = outputFor(this);
8594
8816
  const path = storePath(environmentOf(this).env ?? process.env);
8595
8817
  if (!existsSync10(path)) {
@@ -8603,7 +8825,7 @@ var checkCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("c
8603
8825
  result(this, { path, exists: true, ok: false, opens: false, error: messageOf2(error) });
8604
8826
  return;
8605
8827
  }
8606
- const { command } = messenger.app;
8828
+ const { command } = owner.app;
8607
8829
  const next = /* @__PURE__ */ new Map();
8608
8830
  const step = /* @__PURE__ */ __name((id, args = {}) => {
8609
8831
  if (!next.has(id))
@@ -8619,10 +8841,10 @@ var checkCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("c
8619
8841
  step("store.reindex");
8620
8842
  else if (stems && !stems.ready)
8621
8843
  step("store.migrate");
8622
- const behind = answer.chatsBehind.find((chat) => chat.provider === messenger.provider);
8623
- if (behind && messenger.history !== "store")
8844
+ const behind = answer.chatsBehind.find((chat) => chat.provider === owner.provider);
8845
+ if (behind && owner.history !== "store")
8624
8846
  step("messages.sync");
8625
- else if (behind && syncsOneChat(messenger))
8847
+ else if (behind && syncsOneChat(owner))
8626
8848
  step("messages.sync", { chat: behind.chat });
8627
8849
  result(this, answer, [...next.values()]);
8628
8850
  if (answer.schema.version < SPEAKS) {
@@ -8637,7 +8859,7 @@ var checkCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("c
8637
8859
  renderer.note(`${orphans} pointers name a row that is gone or a type the store does not know \u2014 see orphan_pointers`);
8638
8860
  if (answer.vectors && answer.vectors.unused > 0)
8639
8861
  renderer.note(`${answer.vectors.unused} vectors belong to no text the store still holds \u2014 \`${command} store rebuild\` drops them`);
8640
- const older = answer.conversations.filter((chat) => chat.provider === messenger.provider && !chat.current).length;
8862
+ const older = answer.conversations.filter((chat) => chat.provider === owner.provider && !chat.current).length;
8641
8863
  if (older > 0) {
8642
8864
  renderer.note(`${older} chats' conversations were built by older rules \u2014 \`${command} conversations links rebuild --chat <chat>\``);
8643
8865
  }
@@ -8740,19 +8962,19 @@ var chatsBehind = /* @__PURE__ */ __name((database) => database.prepare(`SELECT
8740
8962
  held: row.held === null ? null : isoOf(row.held),
8741
8963
  refreshed: isoOf(row.refreshed)
8742
8964
  })), "chatsBehind");
8743
- var migrateCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("migrate"), { output: { entity: "store_migration" }, effects: LOCAL_WRITE }).summary("migrate an older local archive").description("bring the store up to this build's schema, then normalize, index and stem the messages and notes stored before it").action(async function() {
8965
+ var migrateCommand = /* @__PURE__ */ __name((owner) => annotate(new Command("migrate"), { output: { entity: "store_migration" }, effects: LOCAL_WRITE }).summary(`migrate an older ${archive(owner)}`).description("bring the store up to this build's schema, then normalize, index and stem the messages and notes stored before it").action(async function() {
8744
8966
  const { renderer } = outputFor(this);
8745
8967
  const path = storePath(environmentOf(this).env ?? process.env);
8746
8968
  if (!existsSync10(path)) {
8747
8969
  result(this, { path, exists: false });
8748
- renderer.note(`no store yet \u2014 the first \`${messenger.app.command}\` command that reads a chat creates it`);
8970
+ renderer.note(`no store yet \u2014 ${createdBy(owner)}`);
8749
8971
  return;
8750
8972
  }
8751
8973
  const answer = await reading(path, (database) => {
8752
8974
  const from = schemaOf(database).version;
8753
8975
  migrate(database, {
8754
- command: messenger.app.command,
8755
- version: messenger.app.version,
8976
+ command: owner.app.command,
8977
+ version: owner.app.version,
8756
8978
  rollback: { store: path, warn: /* @__PURE__ */ __name((line) => renderer.warn(line), "warn") }
8757
8979
  });
8758
8980
  const { normalized, indexed, terms } = buildWordIndex(database, (note) => renderer.note(note));
@@ -8804,7 +9026,7 @@ var buildNoteIndex = /* @__PURE__ */ __name((database, note, { reset = false } =
8804
9026
  note(`indexing ${pending} notes`);
8805
9027
  return { notesIndexed: drainNoteIndex(database, stemmerCache()) };
8806
9028
  }, "buildNoteIndex");
8807
- var reindexCommand = /* @__PURE__ */ __name((messenger) => destroysNothing(annotate(new Command("rebuild"), { output: { entity: "store_reindex" }, effects: LOCAL_WRITE })).summary("rebuild the local archive's search indexes").description("rebuild the word index, its typo vocabulary, the stems, the files' word index, the notes' indexes and who took part in what, from what is stored, and drop the vectors no stored text uses; loses nothing").action(async function() {
9029
+ var reindexCommand = /* @__PURE__ */ __name((owner) => destroysNothing(annotate(new Command("rebuild"), { output: { entity: "store_reindex" }, effects: LOCAL_WRITE })).summary(`rebuild the ${archive(owner)}'s search indexes`).description("rebuild the word index, its typo vocabulary, the stems, the files' word index, the notes' indexes and who took part in what, from what is stored, and drop the vectors no stored text uses; loses nothing").action(async function() {
8808
9030
  const { renderer } = outputFor(this);
8809
9031
  const path = storePath(environmentOf(this).env ?? process.env);
8810
9032
  if (!existsSync10(path)) {
@@ -8849,6 +9071,9 @@ var backupCommand = /* @__PURE__ */ __name(() => destroysNothing(annotate(new Co
8849
9071
  const { encrypt } = this.opts();
8850
9072
  const path = storePath(environmentOf(this).env ?? process.env);
8851
9073
  const target = resolve(file2);
9074
+ const { app, env } = environmentOf(this);
9075
+ if (app)
9076
+ refuseLockedOutput(target, app, env ?? process.env, "<file>");
8852
9077
  if (!existsSync10(path))
8853
9078
  throw new CliError("not_found", `no store at ${path} to back up`);
8854
9079
  if (existsSync10(target))
@@ -8893,37 +9118,37 @@ var decryptCommand = /* @__PURE__ */ __name(() => annotate(new Command("decrypt"
8893
9118
  await unsealFile(from, to, await passwordOf(this, { twice: false }));
8894
9119
  result(this, { path: to, from, bytes: bytesOf2(to) });
8895
9120
  }), "decryptCommand");
8896
- var restoreCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("restore"), { output: { entity: "store_restore" }, effects: LOCAL_WRITE }).summary("restore a backup and keep the current store, or roll back a breaking upgrade").description("put a backup in place of the store; the store it replaces is kept beside it, never deleted. Given a rollback copy (backups/<store>-rollback-schema-<version>-<time>.db, kept for a day before an upgrade older tools cannot open), put its tables back in the store and return it to that version instead").argument("<file>", "a file `store backup` wrote, or a rollback copy; one written with --encrypt asks for its password").action(async function(file2) {
9121
+ var restoreCommand = /* @__PURE__ */ __name((owner) => annotate(new Command("restore"), { output: { entity: "store_restore" }, effects: LOCAL_WRITE }).summary("restore a backup and keep the current store, or roll back a breaking upgrade").description("put a backup in place of the store; the store it replaces is kept beside it, never deleted. Given a rollback copy (backups/<store>-rollback-schema-<version>-<time>.db, kept for a day before an upgrade older tools cannot open), put its tables back in the store and return it to that version instead").argument("<file>", "a file `store backup` wrote, or a rollback copy; one written with --encrypt asks for its password").action(async function(file2) {
8897
9122
  const path = storePath(environmentOf(this).env ?? process.env);
8898
9123
  const given = resolve(file2);
8899
9124
  if (!existsSync10(given))
8900
9125
  throw new CliError("not_found", `no file at ${given}`);
8901
- refuseWhileServing(this, messenger);
9126
+ refuseWhileServing(this, owner);
8902
9127
  if (!isSealed(given))
8903
- return restoreFrom(this, messenger, given, given);
9128
+ return restoreFrom(this, owner, given, given);
8904
9129
  const opened = `${path}.unsealing-${process.pid}`;
8905
9130
  mkdirSync(dirname3(path), { recursive: true, mode: 448 });
8906
9131
  try {
8907
9132
  await unsealFile(given, opened, await passwordOf(this, { twice: false }));
8908
- await restoreFrom(this, messenger, opened, given);
9133
+ await restoreFrom(this, owner, opened, given);
8909
9134
  } finally {
8910
9135
  rmSync3(opened, { force: true });
8911
9136
  }
8912
9137
  }), "restoreCommand");
8913
- var restoreFrom = /* @__PURE__ */ __name(async (command, messenger, backup, given) => {
9138
+ var restoreFrom = /* @__PURE__ */ __name(async (command, owner, backup, given) => {
8914
9139
  const { renderer } = outputFor(command);
8915
9140
  const path = storePath(environmentOf(command).env ?? process.env);
8916
9141
  if (existsSync10(path) && realpathSync3(backup) === realpathSync3(path)) {
8917
9142
  throw new CliError("validation_error", `${backup} is the store itself`);
8918
9143
  }
8919
9144
  if (await isRollbackCopy(backup))
8920
- return rollBackFrom(command, messenger, backup);
9145
+ return rollBackFrom(command, owner, backup);
8921
9146
  const schema = await backupSchema(backup);
8922
9147
  const stamp = stampNow();
8923
9148
  const kept = existsSync10(path) ? `${path}.before-restore-${stamp}` : null;
8924
9149
  if (kept) {
8925
9150
  const waitMs = environmentOf(command).storeLockWaitMs;
8926
- await quiesce(path, messenger, "restore", (message) => renderer.warn(message), waitMs);
9151
+ await quiesce(path, owner, "restore", (message) => renderer.warn(message), waitMs);
8927
9152
  } else
8928
9153
  mkdirSync(dirname3(path), { recursive: true, mode: 448 });
8929
9154
  const incoming = `${path}.restoring-${stamp}`;
@@ -8951,13 +9176,13 @@ var isRollbackCopy = /* @__PURE__ */ __name(async (file2) => {
8951
9176
  return false;
8952
9177
  }
8953
9178
  }, "isRollbackCopy");
8954
- var rollBackFrom = /* @__PURE__ */ __name(async (command, messenger, copy) => {
9179
+ var rollBackFrom = /* @__PURE__ */ __name(async (command, owner, copy) => {
8955
9180
  const { renderer } = outputFor(command);
8956
9181
  const path = storePath(environmentOf(command).env ?? process.env);
8957
9182
  if (!existsSync10(path))
8958
9183
  throw new CliError("not_found", `no store at ${path} to roll back`);
8959
9184
  const waitMs = environmentOf(command).storeLockWaitMs;
8960
- await quiesce(path, messenger, "restore", (message) => renderer.warn(message), waitMs);
9185
+ await quiesce(path, owner, "restore", (message) => renderer.warn(message), waitMs);
8961
9186
  const { database } = await openSqlite(path);
8962
9187
  let rolled;
8963
9188
  try {
@@ -9002,8 +9227,8 @@ var backupSchema = /* @__PURE__ */ __name(async (backup) => {
9002
9227
  return schema;
9003
9228
  }, "backupSchema");
9004
9229
  var STORE_LOCK_WAIT_MS = 1e3;
9005
- var quiesce = /* @__PURE__ */ __name(async (path, messenger, then, warn, waitMs = STORE_LOCK_WAIT_MS) => {
9006
- const { command } = messenger.app;
9230
+ var quiesce = /* @__PURE__ */ __name(async (path, owner, then, warn, waitMs = STORE_LOCK_WAIT_MS) => {
9231
+ const { command } = owner.app;
9007
9232
  const files = [path, `${path}-wal`, `${path}-shm`].filter((file2) => existsSync10(file2)).map((file2) => realpathSync3(file2));
9008
9233
  const holders = holdersOf(files);
9009
9234
  if (holders === void 0) {
@@ -9025,21 +9250,21 @@ var quiesce = /* @__PURE__ */ __name(async (path, messenger, then, warn, waitMs
9025
9250
  database.close();
9026
9251
  }
9027
9252
  }, "quiesce");
9028
- var resetCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("reset"), { output: { entity: "store_reset" }, effects: LOCAL_WRITE }).summary("back up the local archive and replace it with an empty one").description("back the store up beside itself, then delete it and start an empty one at this build's schema; asks first, or --yes").option("--no-backup", "delete the store without backing it up first").option("--dry-run", "list every table it would empty, with its rows, and delete nothing").action(async function({ backup: keep, dryRun: dryRun2 }) {
9253
+ var resetCommand = /* @__PURE__ */ __name((owner) => annotate(new Command("reset"), { output: { entity: "store_reset" }, effects: LOCAL_WRITE }).summary(`back up the ${archive(owner)} and replace it with an empty one`).description("back the store up beside itself, then delete it and start an empty one at this build's schema; asks first, or --yes").option("--no-backup", "delete the store without backing it up first").option("--dry-run", "list every table it would empty, with its rows, and delete nothing").action(async function({ backup: keep, dryRun: dryRun2 }) {
9029
9254
  const { renderer } = outputFor(this);
9030
- const { command } = messenger.app;
9255
+ const { command } = owner.app;
9031
9256
  const env = environmentOf(this).env ?? process.env;
9032
9257
  const path = storePath(env);
9033
9258
  if (!existsSync10(path)) {
9034
9259
  result(this, { path, exists: false, reset: false });
9035
- renderer.note(`no store at ${path} \u2014 nothing to reset; the first \`${command}\` command that reads a chat creates it`);
9260
+ renderer.note(`no store at ${path} \u2014 nothing to reset; ${createdBy(owner)}`);
9036
9261
  return;
9037
9262
  }
9038
9263
  if (dryRun2) {
9039
- result(this, await resetPreview(path, messenger, env, keep));
9264
+ result(this, await resetPreview(path, owner, env, keep));
9040
9265
  return;
9041
9266
  }
9042
- refuseWhileServing(this, messenger);
9267
+ refuseWhileServing(this, owner);
9043
9268
  if (this.optsWithGlobals().yes !== true) {
9044
9269
  const what = `this deletes the store at ${path} and starts an empty one, ${keep ? "after a backup beside it" : "with no backup"}`;
9045
9270
  const answer = await answerOf(this, `${what}. Go ahead? [y/N] `);
@@ -9048,7 +9273,7 @@ var resetCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("r
9048
9273
  if (!/^\s*y(es)?\s*$/i.test(answer))
9049
9274
  throw new CliError("cancelled", "cancelled \u2014 the store is unchanged");
9050
9275
  }
9051
- await quiesce(path, messenger, "reset", (message) => renderer.warn(message), environmentOf(this).storeLockWaitMs);
9276
+ await quiesce(path, owner, "reset", (message) => renderer.warn(message), environmentOf(this).storeLockWaitMs);
9052
9277
  const backup = keep ? `${path}.backup-${stampNow()}` : null;
9053
9278
  let backedUp = null;
9054
9279
  if (backup) {
@@ -9074,10 +9299,10 @@ var resetCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("r
9074
9299
  renderer.note(backup ? `the store is empty at schema ${schema}; \`${command} store restore ${backup}\` puts the old one back once a build can read it` : `the store is empty at schema ${schema}; there is no backup`);
9075
9300
  }), "resetCommand");
9076
9301
  var STORE_PARTS2 = ["", "-wal", "-shm"];
9077
- var resetPreview = /* @__PURE__ */ __name(async (path, messenger, env, keep) => {
9302
+ var resetPreview = /* @__PURE__ */ __name(async (path, owner, env, keep) => {
9078
9303
  const files = STORE_PARTS2.map((suffix) => `${path}${suffix}`).filter((file2) => existsSync10(file2));
9079
9304
  const holders = holdersOf(files.map((file2) => realpathSync3(file2)));
9080
- const serving = servingProfiles(messenger.app, env).length > 0;
9305
+ const serving = servingProfiles(owner.app, env).length > 0;
9081
9306
  const read = await readingOnly(path, (database) => ({
9082
9307
  schema: schemaOf(database).version,
9083
9308
  tables: emptiedTables(database)
@@ -9120,6 +9345,20 @@ export {
9120
9345
  paused,
9121
9346
  DRY_RUN_DAYS,
9122
9347
  dryRun,
9348
+ AI_PROVIDERS,
9349
+ aiSettingPath,
9350
+ readAiSetting,
9351
+ writeAiSetting,
9352
+ aiSettingOf,
9353
+ aiBaseUrl,
9354
+ aiOrigin,
9355
+ aiImagesAllowed,
9356
+ aiKeys,
9357
+ aiTakesKey,
9358
+ aiLeavesComputer,
9359
+ sharedModel,
9360
+ checkAi,
9361
+ purposeModel,
9123
9362
  replyConsentPathFor,
9124
9363
  readReplyConsent,
9125
9364
  writeReplyConsent,
@@ -9139,5 +9378,6 @@ export {
9139
9378
  serveCommand,
9140
9379
  storeSummary,
9141
9380
  storeMaintenanceCommands,
9381
+ addStoreMaintenanceCommands,
9142
9382
  buildStems
9143
9383
  };