@wirecat/drive-cli 0.62.0 → 0.64.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 (150) hide show
  1. package/README.md +2 -1
  2. package/dist/bin/drive.js +2 -2
  3. package/dist/bundle/{all-profiles-CKD2DWUK.js → all-profiles-BPPT2AK5.js} +13 -14
  4. package/dist/bundle/{anthropic-E3T4USLA.js → anthropic-JW6GOJUD.js} +13 -11
  5. package/dist/bundle/{app-server-JB2AEWWL.js → app-server-KAQIOJMZ.js} +53 -54
  6. package/dist/bundle/{bun-CC44AAND.js → bun-UT7GNTPV.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-AUMFKYVR.js → bun-sqlite-2OIVV3LS.js} +8 -8
  8. package/dist/bundle/{chunk-EOOGWUTP.js → chunk-2FEZ24DK.js} +10 -10
  9. package/dist/bundle/{chunk-N7OZPKU7.js → chunk-2W464HAE.js} +4 -4
  10. package/dist/bundle/{chunk-UGXN5D7U.js → chunk-34BIDKF4.js} +332 -430
  11. package/dist/bundle/{chunk-WZKEU7WR.js → chunk-36GPBPWM.js} +1 -1
  12. package/dist/bundle/{chunk-LQKD257P.js → chunk-3J5KAFNA.js} +2255 -1125
  13. package/dist/bundle/{chunk-7W5HYGVW.js → chunk-3NULZGQU.js} +2 -2
  14. package/dist/bundle/{chunk-XFRRKZHQ.js → chunk-46CD64J2.js} +155 -36
  15. package/dist/bundle/{chunk-DWJHL6DV.js → chunk-4CNTID2X.js} +4 -4
  16. package/dist/bundle/{chunk-LWE4JGRN.js → chunk-4YRENUB5.js} +2 -2
  17. package/dist/bundle/{chunk-SW4I5BR7.js → chunk-5HSRQ53R.js} +2 -2
  18. package/dist/bundle/{chunk-IR4SQLBR.js → chunk-5OFA5EXE.js} +2 -2
  19. package/dist/bundle/{chunk-R347FPYU.js → chunk-5ZBR55US.js} +1 -1
  20. package/dist/bundle/{chunk-Q2LRPOKL.js → chunk-66AF4FBW.js} +4 -4
  21. package/dist/bundle/{chunk-RWSXVCSG.js → chunk-6B37XO6B.js} +23 -5
  22. package/dist/bundle/{chunk-ZMOUUOT2.js → chunk-6G53ZFUT.js} +1 -1
  23. package/dist/bundle/{chunk-HCNQT3QE.js → chunk-AHB4OJCI.js} +1951 -580
  24. package/dist/bundle/{chunk-JK3U25QZ.js → chunk-B67BLRAI.js} +59 -1
  25. package/dist/bundle/{chunk-7ZXIWZQ6.js → chunk-B7XBIOMR.js} +12 -12
  26. package/dist/bundle/{chunk-FEZF3TII.js → chunk-BDYWZ7JE.js} +50 -6
  27. package/dist/bundle/{chunk-SVPCHFKI.js → chunk-BEUAICUD.js} +2 -2
  28. package/dist/bundle/{chunk-TDX4GZFO.js → chunk-BEZJA44H.js} +7 -7
  29. package/dist/bundle/{chunk-RIDQNVZM.js → chunk-BZ2ZKILM.js} +3 -3
  30. package/dist/bundle/{chunk-FUITWY7O.js → chunk-C7WBNOYW.js} +1 -1
  31. package/dist/bundle/{chunk-CJHY5YIF.js → chunk-CPMRM3GQ.js} +489 -210
  32. package/dist/bundle/{chunk-FNWIJ6EJ.js → chunk-DD7EFG6B.js} +2 -2
  33. package/dist/bundle/{chunk-W4RTIL7S.js → chunk-E2LBCCTG.js} +5 -5
  34. package/dist/bundle/{chunk-O2XOX4HB.js → chunk-EC2XGDKJ.js} +50 -34
  35. package/dist/bundle/{chunk-4OSSOWDM.js → chunk-EJ4PNHPP.js} +1 -1
  36. package/dist/bundle/{chunk-XS5POQST.js → chunk-EQEGJVO2.js} +1 -1
  37. package/dist/bundle/{chunk-U2BFYSQV.js → chunk-EWGVDFPT.js} +8983 -3343
  38. package/dist/bundle/{chunk-OBH5BA62.js → chunk-EZ6O3ST3.js} +3 -3
  39. package/dist/bundle/{chunk-HG6CAYJH.js → chunk-F2VDAG32.js} +3 -3
  40. package/dist/bundle/{chunk-RPMKG63Z.js → chunk-G3NULXOM.js} +4 -4
  41. package/dist/bundle/{chunk-OD4U7GUY.js → chunk-G4KEKKDE.js} +20 -20
  42. package/dist/bundle/{chunk-OTROVC4E.js → chunk-GSMYXGFR.js} +1 -1
  43. package/dist/bundle/{chunk-XZUS7XRO.js → chunk-GW3U6OLD.js} +1 -1
  44. package/dist/bundle/{chunk-6EY46GAN.js → chunk-HW4UPST2.js} +2 -2
  45. package/dist/bundle/{chunk-2HF2MRXI.js → chunk-IDAK4DDK.js} +1 -1
  46. package/dist/bundle/{chunk-27YUUGXQ.js → chunk-IK6KH3RE.js} +1 -1
  47. package/dist/bundle/{chunk-QTI6IVHZ.js → chunk-IX7NQJLY.js} +8 -8
  48. package/dist/bundle/{chunk-YMWENGKH.js → chunk-J62DI53V.js} +1 -1
  49. package/dist/bundle/{chunk-AH5C3D3D.js → chunk-JRXFW7HE.js} +5 -5
  50. package/dist/bundle/{chunk-KLFSRKHB.js → chunk-K6BSB53R.js} +1 -1
  51. package/dist/bundle/{chunk-ONP2IBHY.js → chunk-KE4XPPRQ.js} +98 -81
  52. package/dist/bundle/{chunk-UQLWMGSD.js → chunk-KG2XKEHL.js} +5 -5
  53. package/dist/bundle/{chunk-T5NWWXS2.js → chunk-KIN6PDFE.js} +24 -2
  54. package/dist/bundle/{chunk-QH7DOVO3.js → chunk-KVW4XNKB.js} +45 -29
  55. package/dist/bundle/{chunk-PEQA6LA5.js → chunk-LOMW6F2E.js} +230 -236
  56. package/dist/bundle/{chunk-4SIZEJ3M.js → chunk-M73NNJ3X.js} +2 -2
  57. package/dist/bundle/{chunk-QCKZ3GAA.js → chunk-N622LRPM.js} +4 -4
  58. package/dist/bundle/{chunk-YPFUYQDP.js → chunk-O2QO5UZC.js} +13 -13
  59. package/dist/bundle/{chunk-QCX6XZLA.js → chunk-OEVHZOHC.js} +12 -12
  60. package/dist/bundle/{chunk-VAYB52HF.js → chunk-OH3K2E7X.js} +402 -184
  61. package/dist/bundle/{chunk-YXYTY4GF.js → chunk-P7DEGRZA.js} +21 -21
  62. package/dist/bundle/{chunk-YUWPNG7B.js → chunk-PBMSBCVB.js} +1 -1
  63. package/dist/bundle/{chunk-67ZQCWBV.js → chunk-QEAD2LF4.js} +3 -3
  64. package/dist/bundle/{chunk-JN5TVEEL.js → chunk-QXCKJUZY.js} +124 -22
  65. package/dist/bundle/{chunk-T7X53FCJ.js → chunk-SIOIMO62.js} +37 -37
  66. package/dist/bundle/{chunk-O7ALBI2I.js → chunk-TNV2FXVK.js} +5 -5
  67. package/dist/bundle/chunk-UD55VB2N.js +87 -0
  68. package/dist/bundle/{chunk-L7K2MOIC.js → chunk-UIEA6FIV.js} +22 -22
  69. package/dist/bundle/{chunk-EW7PKB4M.js → chunk-UJR272CP.js} +29 -29
  70. package/dist/bundle/{chunk-YALI4C7C.js → chunk-USLZE36C.js} +6 -6
  71. package/dist/bundle/{chunk-YOJDGAPT.js → chunk-VIJ6ACYB.js} +8 -8
  72. package/dist/bundle/{chunk-MN4VXU3M.js → chunk-VPLFD5RJ.js} +4 -4
  73. package/dist/bundle/{chunk-VQDD64A4.js → chunk-VT2UFYPJ.js} +8 -10
  74. package/dist/bundle/{chunk-CZ2GJHLL.js → chunk-WWCYTMAV.js} +2 -2
  75. package/dist/bundle/{chunk-DJOAMGF4.js → chunk-XPXKD63J.js} +13 -13
  76. package/dist/bundle/{chunk-E43ENLJJ.js → chunk-ZF6GUZCE.js} +1 -1
  77. package/dist/bundle/{chunk-XEW2EN6F.js → chunk-ZRZ4HTCK.js} +60 -34
  78. package/dist/bundle/{chunk-2KN35F32.js → chunk-ZSZJLJIA.js} +10 -10
  79. package/dist/bundle/command-contract-H5OYJOPF.js +38 -0
  80. package/dist/bundle/{decode-WIIX3Y2X.js → decode-HTOQ6S3V.js} +8 -8
  81. package/dist/bundle/{dispatch-GEFIXA6X.js → dispatch-SH5SP6LA.js} +11 -11
  82. package/dist/bundle/drive.js +11 -11
  83. package/dist/bundle/{echarts-OYINM4C4.js → echarts-KFHB6SLX.js} +2 -2
  84. package/dist/bundle/{embed-DWZIYMBX.js → embed-YATFB2PN.js} +9 -9
  85. package/dist/bundle/{embedder-ILWH7ZRM.js → embedder-MQPDFGTJ.js} +12 -12
  86. package/dist/bundle/entry-YZBB647C.js +22 -0
  87. package/dist/bundle/{failure-GV77W3CD.js → failure-4FQL4XJI.js} +4 -4
  88. package/dist/bundle/first-run-5JT3UQZB.js +30 -0
  89. package/dist/bundle/first-screen-BEMDEWO7.js +36 -0
  90. package/dist/bundle/{google-KLZSUAVY.js → google-DVADVICN.js} +13 -13
  91. package/dist/bundle/{google-api-HZQ5R4ZO.js → google-api-QMFGCXBM.js} +55 -57
  92. package/dist/bundle/grants-WKB2E4TA.js +103 -0
  93. package/dist/bundle/{identity-J2DON4IO.js → identity-FYVDK4M2.js} +6 -6
  94. package/dist/bundle/{instructions-HGOJ23AJ.js → instructions-D3GF3B7M.js} +1 -1
  95. package/dist/bundle/{login-BD2TS4GY.js → login-COFZ2IWP.js} +61 -63
  96. package/dist/bundle/{mcp-GWDA3HOA.js → mcp-RKJG22KM.js} +2 -2
  97. package/dist/bundle/{node-CPKTDPH7.js → node-OFICOKX3.js} +2 -2
  98. package/dist/bundle/{node-sqlite-IXDCRLSX.js → node-sqlite-DNBTDOXD.js} +9 -9
  99. package/dist/bundle/oauth-PDQHWFBF.js +22 -0
  100. package/dist/bundle/{open-O7P3ZV3Y.js → open-PTPR2YWX.js} +8 -8
  101. package/dist/bundle/{openai-RCFQKCXC.js → openai-2KV5LUW4.js} +17 -17
  102. package/dist/bundle/{process-KXDRJO22.js → process-EAW6NST2.js} +1 -1
  103. package/dist/bundle/{program-UCHFC7JQ.js → program-6UV5Q5YN.js} +310 -279
  104. package/dist/bundle/prompt-634TPMJK.js +19 -0
  105. package/dist/bundle/{reasons-57J2D77K.js → reasons-DDWCEYSQ.js} +5 -5
  106. package/dist/bundle/{recognize-MRCYGP2J.js → recognize-SJO6QUDW.js} +7 -7
  107. package/dist/bundle/{remote-L3L4PHKF.js → remote-6JXZITKF.js} +10 -10
  108. package/dist/bundle/{rerank-PSOE6XFT.js → rerank-MD5VOPQ6.js} +10 -10
  109. package/dist/bundle/{serve-72OGS3BF.js → serve-LZTROA2M.js} +12 -12
  110. package/dist/bundle/server-GT7X666D.js +69 -0
  111. package/dist/bundle/{server-SCXKYHBO.js → server-NSA3UAFY.js} +43 -44
  112. package/dist/bundle/{services-YAFTELBI.js → services-F5A6XQCV.js} +69 -34
  113. package/dist/bundle/{sqlite-runtime-DLK4SU33.js → sqlite-runtime-7YF6REKS.js} +9 -9
  114. package/dist/bundle/{start-AFFA3LKM.js → start-MUFLE6FA.js} +30 -8
  115. package/dist/bundle/{state-T5VNAJSZ.js → state-UC54F3YZ.js} +9 -9
  116. package/dist/bundle/{store-4OFK7PKQ.js → store-F5FJGWMR.js} +58 -20
  117. package/dist/bundle/{store-R6MSY2IM.js → store-J53YNAH6.js} +43 -18
  118. package/dist/bundle/store-maintenance-command-GJVXLBAB.js +58 -0
  119. package/dist/bundle/tokens-H2EJKGA5.js +101 -0
  120. package/dist/commands/account.d.ts +4 -0
  121. package/dist/commands/account.d.ts.map +1 -0
  122. package/dist/commands/account.js +33 -0
  123. package/dist/commands/account.js.map +1 -0
  124. package/dist/commands/config.d.ts.map +1 -1
  125. package/dist/commands/config.js +5 -1
  126. package/dist/commands/config.js.map +1 -1
  127. package/dist/profile-lock.d.ts +1 -0
  128. package/dist/profile-lock.d.ts.map +1 -1
  129. package/dist/profile-lock.js +1 -0
  130. package/dist/profile-lock.js.map +1 -1
  131. package/dist/program.d.ts.map +1 -1
  132. package/dist/program.js +2 -0
  133. package/dist/program.js.map +1 -1
  134. package/dist/version.d.ts +1 -1
  135. package/dist/version.js +1 -1
  136. package/package.json +3 -3
  137. package/dist/bundle/chunk-AQVUEZEP.js +0 -22
  138. package/dist/bundle/chunk-DRZZBN3V.js +0 -33
  139. package/dist/bundle/chunk-UOXOLGNG.js +0 -42
  140. package/dist/bundle/command-contract-OB5BRABN.js +0 -39
  141. package/dist/bundle/entry-V5V3TOTY.js +0 -22
  142. package/dist/bundle/first-run-V3VVLQF4.js +0 -30
  143. package/dist/bundle/first-screen-Y3RIN7FU.js +0 -37
  144. package/dist/bundle/grants-L7XLHLUT.js +0 -105
  145. package/dist/bundle/oauth-HOGY4YBB.js +0 -22
  146. package/dist/bundle/prompt-EVPPBN5W.js +0 -17
  147. package/dist/bundle/server-C5TGNFXW.js +0 -70
  148. package/dist/bundle/store-maintenance-command-QDMCXGV6.js +0 -60
  149. package/dist/bundle/tokens-HIG36RNS.js +0 -103
  150. /package/dist/bundle/{chunk-ZQ3GWKDQ.js → chunk-SW6C6WH5.js} +0 -0
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  visibleControls
5
- } from "./chunk-2HF2MRXI.js";
5
+ } from "./chunk-IDAK4DDK.js";
6
6
  import {
7
7
  BASE_REASONS,
8
8
  COMMON_DETAILS,
@@ -10,16 +10,16 @@ import {
10
10
  CRASH_REASON,
11
11
  stepOf,
12
12
  writes
13
- } from "./chunk-FEZF3TII.js";
13
+ } from "./chunk-BDYWZ7JE.js";
14
14
  import {
15
15
  errorCodes,
16
16
  isCliError
17
- } from "./chunk-4OSSOWDM.js";
17
+ } from "./chunk-EJ4PNHPP.js";
18
18
  import {
19
19
  __name
20
20
  } from "./chunk-ZVVMGPBJ.js";
21
21
 
22
- // node_modules/.pnpm/@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
22
+ // node_modules/.pnpm/@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
23
23
  var EXIT_CODES = {
24
24
  validation_error: 2,
25
25
  configuration_error: 3,
@@ -40,7 +40,7 @@ var EXIT_CODES = {
40
40
  var exitCodeFor = /* @__PURE__ */ __name((code) => EXIT_CODES[code], "exitCodeFor");
41
41
  var GENERIC_FAILURE = 1;
42
42
 
43
- // node_modules/.pnpm/@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
43
+ // node_modules/.pnpm/@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
44
44
  var recognise = /* @__PURE__ */ __name((failure) => {
45
45
  if (isCliError(failure))
46
46
  return failure;
@@ -1,13 +1,33 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ finite,
5
+ getDotPath,
6
+ maxValue,
7
+ minValue,
8
+ number,
9
+ optional,
10
+ pipe,
11
+ safeParse
12
+ } from "./chunk-BDYWZ7JE.js";
3
13
  import {
4
14
  CliError
5
- } from "./chunk-4OSSOWDM.js";
15
+ } from "./chunk-EJ4PNHPP.js";
6
16
  import {
7
17
  __name
8
18
  } from "./chunk-ZVVMGPBJ.js";
9
19
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/models/types.js
20
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/models/options.js
21
+ var checkedOptions = /* @__PURE__ */ __name((provider, schema, options) => {
22
+ const parsed = safeParse(schema, options);
23
+ if (!parsed.success) {
24
+ throw new CliError("validation_error", `${provider} option ${getDotPath(parsed.issues[0]) ?? "options"} is unknown or has the wrong type`);
25
+ }
26
+ return parsed.output;
27
+ }, "checkedOptions");
28
+ var range = /* @__PURE__ */ __name((min, max) => optional(pipe(number(), finite(), minValue(min), maxValue(max))), "range");
29
+
30
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/models/types.js
11
31
  var MAX_MODEL_IMAGE_BYTES = 4 * 1024 * 1024;
12
32
  var validateImages = /* @__PURE__ */ __name((images) => {
13
33
  if (images === void 0)
@@ -38,6 +58,8 @@ var systemFor = /* @__PURE__ */ __name((request) => [
38
58
  ].filter((one) => one !== void 0).join("\n"), "systemFor");
39
59
 
40
60
  export {
61
+ checkedOptions,
62
+ range,
41
63
  MAX_MODEL_IMAGE_BYTES,
42
64
  validateImages,
43
65
  messagesFor,
@@ -1,6 +1,7 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
+ ADDED_PROVIDER,
4
5
  MIGRATIONS,
5
6
  SnapshotBudget,
6
7
  assertReadCompatible,
@@ -27,24 +28,28 @@ import {
27
28
  tagMemberIds,
28
29
  thingOf,
29
30
  write
30
- } from "./chunk-U2BFYSQV.js";
31
+ } from "./chunk-EWGVDFPT.js";
32
+ import {
33
+ damagedFile
34
+ } from "./chunk-B67BLRAI.js";
31
35
  import {
32
36
  fold
33
- } from "./chunk-YOJDGAPT.js";
37
+ } from "./chunk-VIJ6ACYB.js";
34
38
  import {
35
39
  CliError
36
- } from "./chunk-4OSSOWDM.js";
40
+ } from "./chunk-EJ4PNHPP.js";
37
41
  import {
38
42
  __name
39
43
  } from "./chunk-ZVVMGPBJ.js";
40
44
 
41
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/damage.js
45
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/damage.js
42
46
  var DERIVED = /* @__PURE__ */ new Set(["mentions", "involvements", "embeddings"]);
43
47
  var named = /* @__PURE__ */ __name((tables) => tables.length <= 5 ? tables.join(", ") : `${tables.slice(0, 5).join(", ")} and ${tables.length - 5} more`, "named");
44
48
  var isDerivedTable = /* @__PURE__ */ __name((table, searchIndexes) => DERIVED.has(table) || table.startsWith("vector_index_") || searchIndexes.some((index) => table === index || table.startsWith(`${index}_`)), "isDerivedTable");
45
49
  var WIRECAT_UNITS = ["memo-*", "mail-*", "tg-*", "max-*", "wirecat-*"];
46
- var explainDamage = /* @__PURE__ */ __name((health, command) => {
47
- if (health.ok)
50
+ var seen = /* @__PURE__ */ __name((mark) => `\`${mark.command}\` found the store damaged at ${mark.at} (${mark.error})`, "seen");
51
+ var explainDamage = /* @__PURE__ */ __name((health, command, mark = null) => {
52
+ if (health.ok && !mark)
48
53
  return null;
49
54
  const indexNames = (health.searchIndexes ?? []).map((index) => index.name);
50
55
  const badIndexes = (health.searchIndexes ?? []).filter((index) => !index.ok).map((index) => index.name);
@@ -53,12 +58,13 @@ var explainDamage = /* @__PURE__ */ __name((health, command) => {
53
58
  const derived = [.../* @__PURE__ */ new Set([...tables.filter((table) => isDerivedTable(table, indexNames)), ...badIndexes])];
54
59
  const unopened = health.error !== void 0;
55
60
  const json = (health.invalidJson ?? []).map(({ table, column }) => `${table}.${column}`);
56
- const what = unopened ? `the store file cannot be opened: ${health.error}` : health.checked === "quick" ? "the store file's header or schema is damaged" : `the store file is damaged: ${health.problems ?? 0} problems` + (sources.length ? ` in the data of ${named(sources)}` : "") + (derived.length ? `${sources.length ? ", and" : " in"} the search data of ${named(derived)}` : "") + (json.length ? `; values that are not valid JSON in ${named(json)}` : "");
61
+ const checked = health.ok ? `${seen(mark)}; the quick check reads too little to see it, and a deep check that passes clears it` : unopened ? `the store file cannot be opened: ${health.error}` : health.checked === "quick" ? "the store file's header or schema is damaged" : `the store file is damaged: ${health.problems ?? 0} problems` + (sources.length ? ` in the data of ${named(sources)}` : "") + (derived.length ? `${sources.length ? ", and" : " in"} the search data of ${named(derived)}` : "") + (json.length ? `; values that are not valid JSON in ${named(json)}` : "");
62
+ const what = mark && !health.ok ? `${checked}; ${seen(mark)}` : checked;
57
63
  const impact = [
58
64
  ...sources.length ? [`some rows of ${named(sources)} cannot be read; a recovery keeps every row it can read and names the rest`] : [],
59
65
  ...derived.length ? [`searches may miss results or fail; ${named(derived)} hold nothing that is not elsewhere, and are rebuilt`] : [],
60
66
  ...json.length ? [`a read of a row with a broken JSON value fails ("malformed JSON"); a recovery clears those values`] : [],
61
- "reads that do not touch a damaged page work; a write that touches one fails until the store is recovered"
67
+ mark ? "reads that do not touch a damaged page work; every command that writes the store refuses until it is recovered" : "reads that do not touch a damaged page work; a write that touches one fails until the store is recovered"
62
68
  ];
63
69
  return {
64
70
  what,
@@ -71,7 +77,7 @@ var explainDamage = /* @__PURE__ */ __name((health, command) => {
71
77
  `journalctl --user ${WIRECAT_UNITS.map((unit) => `-u '${unit}'`).join(" ")} --since -14d | grep -i -e malformed -e corrupt -e 'disk full'`,
72
78
  "journalctl -k --since -14d | grep -i -e 'I/O error' -e nvme -e ata",
73
79
  `df -h ${health.path.replace(/\/[^/]*$/, "")}`,
74
- ...health.checked === "quick" ? [`${command} store recover`] : []
80
+ ...health.checked === "quick" || health.ok ? [`${command} store recover`] : []
75
81
  ],
76
82
  impact,
77
83
  externalUnaffected: "only this computer's copy is damaged: Telegram, MAX, the mail servers and Google Drive keep their own data, so whatever is lost here can be fetched again by a sync",
@@ -83,11 +89,11 @@ var explainDamage = /* @__PURE__ */ __name((health, command) => {
83
89
  };
84
90
  }, "explainDamage");
85
91
 
86
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
92
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
87
93
  import { realpathSync, statSync } from "node:fs";
88
94
  import { resolve } from "node:path";
89
95
 
90
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/people.js
96
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/people.js
91
97
  var planPeople = /* @__PURE__ */ __name((database, snapshot, mappings, bindings, conflicts) => {
92
98
  const creatable = /* @__PURE__ */ new Set();
93
99
  let people = 0, identities = 0;
@@ -150,11 +156,11 @@ var copyPeople = /* @__PURE__ */ __name((database, snapshot, mappings, now) => {
150
156
  }
151
157
  }, "copyPeople");
152
158
 
153
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/document-transfer/digest.js
159
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/document-transfer/digest.js
154
160
  import { createHash } from "node:crypto";
155
161
  var digest = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "digest");
156
162
 
157
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/collection.js
163
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/collection.js
158
164
  var documentsKeyOf = /* @__PURE__ */ __name((collection) => {
159
165
  const colon = collection.indexOf(":");
160
166
  const provider = collection.slice(0, colon);
@@ -198,7 +204,7 @@ var currentCollection = /* @__PURE__ */ __name((row) => {
198
204
  };
199
205
  }, "currentCollection");
200
206
 
201
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/plan.js
207
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/plan.js
202
208
  var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindings) => {
203
209
  const mappings = /* @__PURE__ */ new Map();
204
210
  const missing = /* @__PURE__ */ new Set(), conflicts = /* @__PURE__ */ new Set();
@@ -365,7 +371,7 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
365
371
  };
366
372
  }, "planTransfer");
367
373
 
368
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
374
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
369
375
  var TRANSFER_TABLES = { document: "documents", note: "notes", memory: "memories", fact: "facts" };
370
376
  var MAX_ENTITIES = 1e3;
371
377
  var MAX_AUXILIARY = 1e4;
@@ -507,7 +513,7 @@ var transferSnapshot = /* @__PURE__ */ __name((database, collection) => read(dat
507
513
  item.bot = { name: String(bot.name), kind: String(bot.kind) };
508
514
  }
509
515
  if (thing.type === "document") {
510
- const doc = database.prepare(`SELECT a.provider,a.external_id AS account,a.name,d.external_id,d.body,d.content_hash,d.deleted_at FROM documents d JOIN accounts a ON a.id=d.account_id WHERE d.id=? AND ${filesAccountSql("a.provider")}`).get(thing.id);
516
+ const doc = database.prepare(`SELECT a.provider,a.external_id AS account,a.name,d.external_id,d.body,d.content_hash,d.deleted_at FROM documents d JOIN accounts a ON a.id=d.account_id WHERE d.id=? AND ${filesAccountSql("a.provider")} AND a.provider<>'${ADDED_PROVIDER}'`).get(thing.id);
511
517
  if (doc) {
512
518
  item.collection = collectionNameOf({ provider: doc.provider, external_id: doc.account, name: doc.name });
513
519
  item.external_id = String(doc.external_id);
@@ -527,7 +533,7 @@ var transferSnapshot = /* @__PURE__ */ __name((database, collection) => read(dat
527
533
  };
528
534
  }), "transferSnapshot");
529
535
 
530
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/apply.js
536
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/apply.js
531
537
  var providerHere = /* @__PURE__ */ __name(({ provider, name, settings }) => {
532
538
  if (provider !== "folder" || String(name ?? "").startsWith("google-drive:"))
533
539
  return provider ?? null;
@@ -699,7 +705,7 @@ var remapEntity = /* @__PURE__ */ __name((database, entity, id, mappings) => {
699
705
  database.prepare(`UPDATE ${TRANSFER_TABLES[entity.kind]} SET ${columns.join(",")} WHERE id=?`).run(...values, id);
700
706
  }, "remapEntity");
701
707
 
702
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
708
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
703
709
  var locations = /* @__PURE__ */ __name((options) => {
704
710
  for (const value of [options.source, options.destination, options.collection])
705
711
  if (typeof value !== "string" || !value.trim())
@@ -752,6 +758,9 @@ var openPreviewTarget = /* @__PURE__ */ __name(async (path) => {
752
758
  }, "openPreviewTarget");
753
759
  var previewDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
754
760
  const location = locations(options);
761
+ return damagedFile([location.source, location.destination], () => previewWith(location, options));
762
+ }, "previewDocumentTransfer");
763
+ var previewWith = /* @__PURE__ */ __name(async (location, options) => {
755
764
  const source = await openSource(location.source);
756
765
  try {
757
766
  const target = await openPreviewTarget(location.destination);
@@ -763,11 +772,14 @@ var previewDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
763
772
  } finally {
764
773
  source.database.close();
765
774
  }
766
- }, "previewDocumentTransfer");
775
+ }, "previewWith");
767
776
  var applyDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
768
777
  if (!/^[a-f0-9]{64}$/.test(options.expected_fingerprint))
769
778
  throw new CliError("validation_error", "apply requires the fingerprint returned by a transfer preview");
770
779
  const location = locations(options);
780
+ return damagedFile([location.source, location.destination], () => applyWith(location, options));
781
+ }, "applyDocumentTransfer");
782
+ var applyWith = /* @__PURE__ */ __name(async (location, options) => {
771
783
  const source = await openSource(location.source);
772
784
  try {
773
785
  const snapshot = transferSnapshot(source.database, options.collection);
@@ -793,9 +805,9 @@ var applyDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
793
805
  } finally {
794
806
  source.database.close();
795
807
  }
796
- }, "applyDocumentTransfer");
808
+ }, "applyWith");
797
809
 
798
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/health.js
810
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/health.js
799
811
  import { existsSync, statSync as statSync2 } from "node:fs";
800
812
  var JSON_COLUMNS = {
801
813
  accounts: ["settings"],
@@ -937,7 +949,7 @@ var storeHealth = /* @__PURE__ */ __name(async (path, { deep = false } = {}) =>
937
949
  }
938
950
  }, "storeHealth");
939
951
 
940
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/project-transfer/preview.js
952
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/preview.js
941
953
  var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) => {
942
954
  if (!options || typeof options !== "object" || Array.isArray(options))
943
955
  throw new CliError("validation_error", "project preview options are required");
@@ -951,15 +963,19 @@ var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) =>
951
963
  if (typeof options.project !== "string" || !/^project:[1-9]\d*$/.test(options.project) || !Number.isSafeInteger(Number(options.project.slice(8))))
952
964
  throw new CliError("validation_error", "project preview project is a project:<safe integer id> reference");
953
965
  const budget = new SnapshotBudget(options.maxReadBytes ?? 4 * 1024 * 1024);
954
- const context = await openStoreContext({ path: options.target, env: options.env, readOnly: true });
955
- try {
956
- return previewAnnotationSnapshot(context.database, Number(options.project.slice(8)), snapshot, options.bindings, budget);
957
- } finally {
958
- context.database.close();
959
- }
966
+ const target = options.target;
967
+ const project2 = options.project;
968
+ return damagedFile([target], async () => {
969
+ const context = await openStoreContext({ path: target, env: options.env, readOnly: true });
970
+ try {
971
+ return previewAnnotationSnapshot(context.database, Number(project2.slice(8)), snapshot, options.bindings, budget);
972
+ } finally {
973
+ context.database.close();
974
+ }
975
+ });
960
976
  }, "previewProjectAnnotationSnapshot");
961
977
 
962
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot.js
978
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot.js
963
979
  var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
964
980
  if (!options || typeof options !== "object" || Array.isArray(options))
965
981
  throw new CliError("validation_error", "snapshot options are required");