@wirecat/drive-cli 0.60.0 → 0.62.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 (174) hide show
  1. package/README.md +4 -5
  2. package/dist/bin/drive.js +2 -2
  3. package/dist/browse.d.ts +20 -0
  4. package/dist/browse.d.ts.map +1 -0
  5. package/dist/browse.js +146 -0
  6. package/dist/browse.js.map +1 -0
  7. package/dist/bundle/{all-profiles-537I27Z4.js → all-profiles-CKD2DWUK.js} +14 -14
  8. package/dist/bundle/{anthropic-X4NWVHDF.js → anthropic-E3T4USLA.js} +9 -9
  9. package/dist/bundle/{app-server-KSHJKKS7.js → app-server-JB2AEWWL.js} +58 -55
  10. package/dist/bundle/{bun-WTBGGCUC.js → bun-CC44AAND.js} +2 -2
  11. package/dist/bundle/{bun-sqlite-T7Y3JFFD.js → bun-sqlite-AUMFKYVR.js} +8 -8
  12. package/dist/bundle/{chunk-2AXA5SKP.js → chunk-27YUUGXQ.js} +1 -1
  13. package/dist/bundle/{chunk-HIP43OGZ.js → chunk-2HF2MRXI.js} +1 -1
  14. package/dist/bundle/{chunk-AXWXQNTC.js → chunk-2KN35F32.js} +10 -10
  15. package/dist/bundle/{chunk-EBLA7GXY.js → chunk-4OSSOWDM.js} +2 -1
  16. package/dist/bundle/{chunk-XFXRGQXJ.js → chunk-4SIZEJ3M.js} +2 -2
  17. package/dist/bundle/{chunk-LQSRVQ3V.js → chunk-67ZQCWBV.js} +3 -3
  18. package/dist/bundle/{chunk-FO4TCH6P.js → chunk-6EY46GAN.js} +2 -2
  19. package/dist/bundle/{chunk-4XZXH2NM.js → chunk-7W5HYGVW.js} +4 -2
  20. package/dist/bundle/{chunk-FZOCQQ66.js → chunk-7ZXIWZQ6.js} +12 -12
  21. package/dist/bundle/{chunk-YGG7UA3C.js → chunk-AH5C3D3D.js} +5 -5
  22. package/dist/bundle/{chunk-YDN2RH5S.js → chunk-AQVUEZEP.js} +2 -2
  23. package/dist/bundle/{chunk-N7S2UPF3.js → chunk-CJHY5YIF.js} +494 -227
  24. package/dist/bundle/{chunk-MXP35VPO.js → chunk-CZ2GJHLL.js} +2 -2
  25. package/dist/bundle/{chunk-HQVIK6PM.js → chunk-DJOAMGF4.js} +262 -368
  26. package/dist/bundle/{chunk-HCJG7ENG.js → chunk-DRZZBN3V.js} +3 -3
  27. package/dist/bundle/{chunk-TXMTMEHW.js → chunk-DWJHL6DV.js} +4 -4
  28. package/dist/bundle/{chunk-S36HRPNS.js → chunk-E43ENLJJ.js} +1 -1
  29. package/dist/bundle/{chunk-4VHBDVY2.js → chunk-EOOGWUTP.js} +14 -10
  30. package/dist/bundle/{chunk-5XHLQZAG.js → chunk-EW7PKB4M.js} +58 -49
  31. package/dist/bundle/{chunk-TKW4QWCY.js → chunk-FEZF3TII.js} +12 -6
  32. package/dist/bundle/{chunk-KEXTTZJM.js → chunk-FNWIJ6EJ.js} +2 -2
  33. package/dist/bundle/{chunk-OYNUBWD2.js → chunk-FUITWY7O.js} +1 -1
  34. package/dist/bundle/{chunk-TVQDMP2F.js → chunk-HCNQT3QE.js} +1440 -771
  35. package/dist/bundle/{chunk-FTZNUZO7.js → chunk-HG6CAYJH.js} +3 -3
  36. package/dist/bundle/{chunk-SZXI4OXX.js → chunk-IR4SQLBR.js} +2 -2
  37. package/dist/bundle/{chunk-UTFATA4K.js → chunk-JK3U25QZ.js} +1 -1
  38. package/dist/bundle/{chunk-SBHSNOU4.js → chunk-JN5TVEEL.js} +96 -27
  39. package/dist/bundle/{chunk-IXN7Y6JA.js → chunk-KLFSRKHB.js} +1 -1
  40. package/dist/bundle/{chunk-57QVQGBE.js → chunk-L7K2MOIC.js} +22 -22
  41. package/dist/bundle/{chunk-JGUJJNGZ.js → chunk-LQKD257P.js} +582 -424
  42. package/dist/bundle/{chunk-GVRS5AIH.js → chunk-LWE4JGRN.js} +2 -2
  43. package/dist/bundle/{chunk-D6WIWOQC.js → chunk-MN4VXU3M.js} +4 -4
  44. package/dist/bundle/{chunk-QIJWSKZL.js → chunk-N7OZPKU7.js} +4 -4
  45. package/dist/bundle/{chunk-W62CON5K.js → chunk-O2XOX4HB.js} +34 -10
  46. package/dist/bundle/{chunk-PDYHEWKG.js → chunk-O7ALBI2I.js} +5 -5
  47. package/dist/bundle/{chunk-PETFPXLU.js → chunk-OBH5BA62.js} +3 -3
  48. package/dist/bundle/{chunk-246P2DCT.js → chunk-OD4U7GUY.js} +113 -51
  49. package/dist/bundle/{chunk-67QXMO2G.js → chunk-ONP2IBHY.js} +26 -26
  50. package/dist/bundle/{chunk-JQLIM6BH.js → chunk-OTROVC4E.js} +1 -1
  51. package/dist/bundle/{chunk-73TTP6ET.js → chunk-PEQA6LA5.js} +617 -243
  52. package/dist/bundle/{chunk-ALWTUDZF.js → chunk-Q2LRPOKL.js} +22 -14
  53. package/dist/bundle/{chunk-CKGHRWVR.js → chunk-QCKZ3GAA.js} +4 -4
  54. package/dist/bundle/chunk-QCX6XZLA.js +415 -0
  55. package/dist/bundle/{chunk-UVLSWLPZ.js → chunk-QH7DOVO3.js} +204 -58
  56. package/dist/bundle/{chunk-OMKUBCNN.js → chunk-QTI6IVHZ.js} +8 -8
  57. package/dist/bundle/{chunk-6HTKB4WC.js → chunk-R347FPYU.js} +1 -1
  58. package/dist/bundle/chunk-RIDQNVZM.js +64 -0
  59. package/dist/bundle/{chunk-ZPQS7XJA.js → chunk-RPMKG63Z.js} +18 -4
  60. package/dist/bundle/{chunk-XDIEQ2CE.js → chunk-RWSXVCSG.js} +3 -3
  61. package/dist/bundle/{chunk-3TQHIHZI.js → chunk-SVPCHFKI.js} +2 -2
  62. package/dist/bundle/{chunk-V2VMBM7O.js → chunk-SW4I5BR7.js} +2 -2
  63. package/dist/bundle/{chunk-EHAI773E.js → chunk-T5NWWXS2.js} +2 -2
  64. package/dist/bundle/{chunk-4CBZEAQ7.js → chunk-T7X53FCJ.js} +34 -34
  65. package/dist/bundle/{chunk-77C5XRH3.js → chunk-TDX4GZFO.js} +7 -7
  66. package/dist/bundle/{chunk-PPL5ASW2.js → chunk-U2BFYSQV.js} +14158 -2039
  67. package/dist/bundle/{chunk-DQDKLZAK.js → chunk-UGXN5D7U.js} +719 -128
  68. package/dist/bundle/{chunk-UNJE63JK.js → chunk-UOXOLGNG.js} +2 -2
  69. package/dist/bundle/{chunk-LJ77Y3TK.js → chunk-UQLWMGSD.js} +6 -5
  70. package/dist/bundle/{chunk-HFGR33KD.js → chunk-VAYB52HF.js} +33 -31
  71. package/dist/bundle/{chunk-GD6TQ6U4.js → chunk-VQDD64A4.js} +8 -8
  72. package/dist/bundle/{chunk-22ATLSNK.js → chunk-W4RTIL7S.js} +5 -5
  73. package/dist/bundle/{chunk-UVYVIHEA.js → chunk-WZKEU7WR.js} +4 -2
  74. package/dist/bundle/{chunk-5AMRCBMP.js → chunk-XEW2EN6F.js} +51 -37
  75. package/dist/bundle/{chunk-O37ESNAP.js → chunk-XFRRKZHQ.js} +242 -90
  76. package/dist/bundle/{chunk-K6XVRA6U.js → chunk-XS5POQST.js} +1 -1
  77. package/dist/bundle/{chunk-IRZ7OF3F.js → chunk-XZUS7XRO.js} +1 -1
  78. package/dist/bundle/{chunk-V7QMHMR3.js → chunk-YALI4C7C.js} +6 -6
  79. package/dist/bundle/{chunk-73MNUSP3.js → chunk-YMWENGKH.js} +1 -1
  80. package/dist/bundle/{chunk-MVNPE5FZ.js → chunk-YOJDGAPT.js} +8 -8
  81. package/dist/bundle/{chunk-DMHGWL5D.js → chunk-YPFUYQDP.js} +13 -13
  82. package/dist/bundle/{chunk-VVCZS42A.js → chunk-YUWPNG7B.js} +1 -1
  83. package/dist/bundle/{chunk-VRW6ZDTH.js → chunk-YXYTY4GF.js} +39 -26
  84. package/dist/bundle/{chunk-ZYCLPJ7U.js → chunk-ZMOUUOT2.js} +1 -1
  85. package/dist/bundle/command-contract-OB5BRABN.js +39 -0
  86. package/dist/bundle/{decode-35N57AFW.js → decode-WIIX3Y2X.js} +8 -8
  87. package/dist/bundle/{dispatch-CWXZW3PL.js → dispatch-GEFIXA6X.js} +9 -9
  88. package/dist/bundle/drive.js +11 -11
  89. package/dist/bundle/{echarts-3P3QZWMU.js → echarts-OYINM4C4.js} +2 -2
  90. package/dist/bundle/{embed-Q6Q5IOJQ.js → embed-DWZIYMBX.js} +9 -9
  91. package/dist/bundle/{embedder-D44JDTAA.js → embedder-ILWH7ZRM.js} +12 -12
  92. package/dist/bundle/entry-V5V3TOTY.js +22 -0
  93. package/dist/bundle/{failure-GRMMSDCZ.js → failure-GV77W3CD.js} +4 -4
  94. package/dist/bundle/first-run-V3VVLQF4.js +30 -0
  95. package/dist/bundle/first-screen-Y3RIN7FU.js +37 -0
  96. package/dist/bundle/{google-6ZZDKFBN.js → google-KLZSUAVY.js} +13 -13
  97. package/dist/bundle/{google-api-E6MOJ4ZD.js → google-api-HZQ5R4ZO.js} +83 -64
  98. package/dist/bundle/grants-L7XLHLUT.js +105 -0
  99. package/dist/bundle/{identity-TID7S5NE.js → identity-J2DON4IO.js} +6 -6
  100. package/dist/bundle/{instructions-ANJN4HV3.js → instructions-HGOJ23AJ.js} +1 -1
  101. package/dist/bundle/{login-BGMK2ABH.js → login-BD2TS4GY.js} +64 -64
  102. package/dist/bundle/{mcp-WBHKX5E3.js → mcp-GWDA3HOA.js} +2 -2
  103. package/dist/bundle/{node-VOB45ES2.js → node-CPKTDPH7.js} +2 -2
  104. package/dist/bundle/{node-sqlite-TSX6XQY2.js → node-sqlite-IXDCRLSX.js} +9 -9
  105. package/dist/bundle/oauth-HOGY4YBB.js +22 -0
  106. package/dist/bundle/{open-3USWHGNR.js → open-O7P3ZV3Y.js} +8 -8
  107. package/dist/bundle/{openai-YZ5VGPIP.js → openai-RCFQKCXC.js} +17 -17
  108. package/dist/bundle/{process-44JS2W7L.js → process-KXDRJO22.js} +1 -1
  109. package/dist/bundle/{program-TZLAFKJV.js → program-UCHFC7JQ.js} +266 -104
  110. package/dist/bundle/prompt-EVPPBN5W.js +17 -0
  111. package/dist/bundle/{reasons-ZK3U3CIN.js → reasons-57J2D77K.js} +5 -5
  112. package/dist/bundle/{recognize-OFW7HWTM.js → recognize-MRCYGP2J.js} +7 -7
  113. package/dist/bundle/{remote-YBDRZQZ5.js → remote-L3L4PHKF.js} +10 -10
  114. package/dist/bundle/{rerank-TQQNS5FJ.js → rerank-PSOE6XFT.js} +10 -10
  115. package/dist/bundle/{serve-OPZXMVLH.js → serve-72OGS3BF.js} +12 -12
  116. package/dist/bundle/server-C5TGNFXW.js +70 -0
  117. package/dist/bundle/{server-2D6DDIK5.js → server-SCXKYHBO.js} +44 -44
  118. package/dist/bundle/{services-34WKT3NN.js → services-YAFTELBI.js} +42 -32
  119. package/dist/bundle/{sqlite-runtime-WPUMKLUV.js → sqlite-runtime-DLK4SU33.js} +9 -9
  120. package/dist/bundle/{start-ZXUJZ4JV.js → start-AFFA3LKM.js} +9 -7
  121. package/dist/bundle/{state-AV2RB3AQ.js → state-T5VNAJSZ.js} +9 -9
  122. package/dist/bundle/{store-YKV4GAMS.js → store-4OFK7PKQ.js} +48 -28
  123. package/dist/bundle/{store-3M7N2Q5T.js → store-R6MSY2IM.js} +20 -18
  124. package/dist/bundle/store-maintenance-command-QDMCXGV6.js +60 -0
  125. package/dist/bundle/tokens-HIG36RNS.js +103 -0
  126. package/dist/commands/config.js +1 -1
  127. package/dist/commands/config.js.map +1 -1
  128. package/dist/commands/folders.d.ts +2 -1
  129. package/dist/commands/folders.d.ts.map +1 -1
  130. package/dist/commands/folders.js +16 -3
  131. package/dist/commands/folders.js.map +1 -1
  132. package/dist/commands/session.d.ts.map +1 -1
  133. package/dist/commands/session.js +10 -2
  134. package/dist/commands/session.js.map +1 -1
  135. package/dist/config.d.ts +16 -5
  136. package/dist/config.d.ts.map +1 -1
  137. package/dist/config.js +11 -17
  138. package/dist/config.js.map +1 -1
  139. package/dist/download.d.ts +3 -2
  140. package/dist/download.d.ts.map +1 -1
  141. package/dist/download.js +21 -9
  142. package/dist/download.js.map +1 -1
  143. package/dist/google-api.d.ts +3 -1
  144. package/dist/google-api.d.ts.map +1 -1
  145. package/dist/google-api.js +27 -7
  146. package/dist/google-api.js.map +1 -1
  147. package/dist/login.js +1 -1
  148. package/dist/login.js.map +1 -1
  149. package/dist/program.d.ts.map +1 -1
  150. package/dist/program.js +7 -7
  151. package/dist/program.js.map +1 -1
  152. package/dist/tokens.d.ts.map +1 -1
  153. package/dist/tokens.js +15 -6
  154. package/dist/tokens.js.map +1 -1
  155. package/dist/version.d.ts +1 -1
  156. package/dist/version.js +1 -1
  157. package/package.json +3 -3
  158. package/dist/bundle/chunk-77YTRBL6.js +0 -249
  159. package/dist/bundle/chunk-YYHKVOVK.js +0 -132
  160. package/dist/bundle/command-contract-NUIWUVYB.js +0 -39
  161. package/dist/bundle/entry-ZHCNI7XO.js +0 -22
  162. package/dist/bundle/first-run-3DC2SDWM.js +0 -30
  163. package/dist/bundle/first-screen-YJF4YODC.js +0 -37
  164. package/dist/bundle/grants-GWXDH5GM.js +0 -105
  165. package/dist/bundle/oauth-CEOYXW6C.js +0 -22
  166. package/dist/bundle/prompt-SG7LAOXW.js +0 -17
  167. package/dist/bundle/server-R6G2O772.js +0 -70
  168. package/dist/bundle/store-maintenance-command-WDXNY4ZF.js +0 -60
  169. package/dist/bundle/tokens-F63RXXEF.js +0 -103
  170. package/dist/oauth-application.d.ts +0 -5
  171. package/dist/oauth-application.d.ts.map +0 -1
  172. package/dist/oauth-application.js +0 -9
  173. package/dist/oauth-application.js.map +0 -1
  174. /package/dist/bundle/{chunk-LK2E2ELG.js → chunk-ZQ3GWKDQ.js} +0 -0
@@ -1,10 +1,5 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
- import {
4
- organization,
5
- project,
6
- reminder
7
- } from "./chunk-YYHKVOVK.js";
8
3
  import {
9
4
  MIGRATIONS,
10
5
  SnapshotBudget,
@@ -32,25 +27,67 @@ import {
32
27
  tagMemberIds,
33
28
  thingOf,
34
29
  write
35
- } from "./chunk-PPL5ASW2.js";
36
- import {
37
- queryFieldsOf
38
- } from "./chunk-4VHBDVY2.js";
30
+ } from "./chunk-U2BFYSQV.js";
39
31
  import {
40
32
  fold
41
- } from "./chunk-MVNPE5FZ.js";
33
+ } from "./chunk-YOJDGAPT.js";
42
34
  import {
43
35
  CliError
44
- } from "./chunk-EBLA7GXY.js";
36
+ } from "./chunk-4OSSOWDM.js";
45
37
  import {
46
38
  __name
47
39
  } from "./chunk-ZVVMGPBJ.js";
48
40
 
49
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
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
42
+ var DERIVED = /* @__PURE__ */ new Set(["mentions", "involvements", "embeddings"]);
43
+ var named = /* @__PURE__ */ __name((tables) => tables.length <= 5 ? tables.join(", ") : `${tables.slice(0, 5).join(", ")} and ${tables.length - 5} more`, "named");
44
+ var isDerivedTable = /* @__PURE__ */ __name((table, searchIndexes) => DERIVED.has(table) || table.startsWith("vector_index_") || searchIndexes.some((index) => table === index || table.startsWith(`${index}_`)), "isDerivedTable");
45
+ var WIRECAT_UNITS = ["memo-*", "mail-*", "tg-*", "max-*", "wirecat-*"];
46
+ var explainDamage = /* @__PURE__ */ __name((health, command) => {
47
+ if (health.ok)
48
+ return null;
49
+ const indexNames = (health.searchIndexes ?? []).map((index) => index.name);
50
+ const badIndexes = (health.searchIndexes ?? []).filter((index) => !index.ok).map((index) => index.name);
51
+ const tables = (health.damagedTables ?? []).map((one) => one.table).filter((table) => table !== null);
52
+ const sources = tables.filter((table) => !isDerivedTable(table, indexNames));
53
+ const derived = [.../* @__PURE__ */ new Set([...tables.filter((table) => isDerivedTable(table, indexNames)), ...badIndexes])];
54
+ const unopened = health.error !== void 0;
55
+ 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)}` : "");
57
+ const impact = [
58
+ ...sources.length ? [`some rows of ${named(sources)} cannot be read; a recovery keeps every row it can read and names the rest`] : [],
59
+ ...derived.length ? [`searches may miss results or fail; ${named(derived)} hold nothing that is not elsewhere, and are rebuilt`] : [],
60
+ ...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"
62
+ ];
63
+ return {
64
+ what,
65
+ causes: [
66
+ "the computer lost power or crashed, or the disk filled up, while a tool was writing",
67
+ "the file was copied, restored or synced while a tool had it open, or it sits in a synced or network folder",
68
+ "a fault of the disk itself"
69
+ ],
70
+ investigate: [
71
+ `journalctl --user ${WIRECAT_UNITS.map((unit) => `-u '${unit}'`).join(" ")} --since -14d | grep -i -e malformed -e corrupt -e 'disk full'`,
72
+ "journalctl -k --since -14d | grep -i -e 'I/O error' -e nvme -e ata",
73
+ `df -h ${health.path.replace(/\/[^/]*$/, "")}`,
74
+ ...health.checked === "quick" ? [`${command} store recover`] : []
75
+ ],
76
+ impact,
77
+ 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",
78
+ steps: [
79
+ "stop every timer and server of the WireCat tools; `store recover run` lists the ones still running",
80
+ `${command} store recover run`,
81
+ "run the fetch commands it prints, then start the timers again"
82
+ ]
83
+ };
84
+ }, "explainDamage");
85
+
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
50
87
  import { realpathSync, statSync } from "node:fs";
51
88
  import { resolve } from "node:path";
52
89
 
53
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/people.js
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
54
91
  var planPeople = /* @__PURE__ */ __name((database, snapshot, mappings, bindings, conflicts) => {
55
92
  const creatable = /* @__PURE__ */ new Set();
56
93
  let people = 0, identities = 0;
@@ -113,11 +150,11 @@ var copyPeople = /* @__PURE__ */ __name((database, snapshot, mappings, now) => {
113
150
  }
114
151
  }, "copyPeople");
115
152
 
116
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/document-transfer/digest.js
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
117
154
  import { createHash } from "node:crypto";
118
155
  var digest = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "digest");
119
156
 
120
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/collection.js
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
121
158
  var documentsKeyOf = /* @__PURE__ */ __name((collection) => {
122
159
  const colon = collection.indexOf(":");
123
160
  const provider = collection.slice(0, colon);
@@ -161,7 +198,7 @@ var currentCollection = /* @__PURE__ */ __name((row) => {
161
198
  };
162
199
  }, "currentCollection");
163
200
 
164
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/plan.js
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
165
202
  var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindings) => {
166
203
  const mappings = /* @__PURE__ */ new Map();
167
204
  const missing = /* @__PURE__ */ new Set(), conflicts = /* @__PURE__ */ new Set();
@@ -270,9 +307,9 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
270
307
  }
271
308
  for (const alias of snapshot.aliases) {
272
309
  const sourceTag = snapshot.taggings.find((tagging) => tagging.tag_id === alias.aliasable_id);
273
- const named = canonicalTagNamed(database, String(alias.name));
310
+ const named2 = canonicalTagNamed(database, String(alias.name));
274
311
  const targetTag = sourceTag && canonicalTagNamed(database, String(sourceTag.tag_name));
275
- if (named && named.id !== targetTag?.id)
312
+ if (named2 && named2.id !== targetTag?.id)
276
313
  conflicts.add(`destination alias conflicts with source tag ${String(alias.aliasable_id)}`);
277
314
  if (targetTag && alias.display === 1) {
278
315
  const displayed = database.prepare("SELECT name_folded FROM aliases WHERE aliasable_type='tag' AND aliasable_id=? AND account_id IS NULL AND display=1").get(targetTag.id);
@@ -328,7 +365,7 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
328
365
  };
329
366
  }, "planTransfer");
330
367
 
331
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
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
332
369
  var TRANSFER_TABLES = { document: "documents", note: "notes", memory: "memories", fact: "facts" };
333
370
  var MAX_ENTITIES = 1e3;
334
371
  var MAX_AUXILIARY = 1e4;
@@ -490,7 +527,7 @@ var transferSnapshot = /* @__PURE__ */ __name((database, collection) => read(dat
490
527
  };
491
528
  }), "transferSnapshot");
492
529
 
493
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/apply.js
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
494
531
  var providerHere = /* @__PURE__ */ __name(({ provider, name, settings }) => {
495
532
  if (provider !== "folder" || String(name ?? "").startsWith("google-drive:"))
496
533
  return provider ?? null;
@@ -662,7 +699,7 @@ var remapEntity = /* @__PURE__ */ __name((database, entity, id, mappings) => {
662
699
  database.prepare(`UPDATE ${TRANSFER_TABLES[entity.kind]} SET ${columns.join(",")} WHERE id=?`).run(...values, id);
663
700
  }, "remapEntity");
664
701
 
665
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
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
666
703
  var locations = /* @__PURE__ */ __name((options) => {
667
704
  for (const value of [options.source, options.destination, options.collection])
668
705
  if (typeof value !== "string" || !value.trim())
@@ -758,42 +795,149 @@ var applyDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
758
795
  }
759
796
  }, "applyDocumentTransfer");
760
797
 
761
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
762
- var ORGANIZATIONS_QUERY = {
763
- entity: "organization",
764
- backend: "sql",
765
- fields: queryFieldsOf(organization, {
766
- native: ["id", "kind", "scope", "created_at"],
767
- examples: { id: "id:1", kind: "kind:company", scope: "scope:work", created_at: "created_at>=2026-01-01" }
768
- })
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
799
+ import { existsSync, statSync as statSync2 } from "node:fs";
800
+ var JSON_COLUMNS = {
801
+ accounts: ["settings"],
802
+ account_identities: ["mail_signals"],
803
+ bot_updates: ["payload"],
804
+ documents: ["front_matter"],
805
+ emails: ["headers"],
806
+ meeting_participants: ["sessions"],
807
+ messages: ["mentions", "reply_to"],
808
+ proposed_actions: ["payload", "result"],
809
+ searches: ["params"],
810
+ tag_consolidations: ["source_member_ids", "survivor_member_ids"],
811
+ task_events: ["changes"]
769
812
  };
770
- var PROJECTS_QUERY = {
771
- entity: "project",
772
- backend: "sql",
773
- fields: queryFieldsOf(project, {
774
- native: ["id", "key", "name", "kind", "type", "organization_id", "scope", "created_at"],
775
- examples: {
776
- id: "id:1",
777
- key: "key:SMP",
778
- name: "name:*tart*",
779
- kind: "kind:inbox",
780
- type: "type:work",
781
- organization_id: "organization_id:1",
782
- scope: "scope:work",
783
- created_at: "created_at>=2026-01-01"
813
+ var jsonColumns = /* @__PURE__ */ __name((database) => database.prepare(`SELECT m.name AS "table", c.name AS "column", c."notnull" AS required FROM sqlite_master m, pragma_table_info(m.name) c
814
+ WHERE m.type = 'table' AND m.sql NOT LIKE 'CREATE VIRTUAL%' ORDER BY 1, 2`).all().map((row) => ({ table: String(row.table), column: String(row.column), required: Number(row.required) === 1 })).filter(({ table, column }) => column === "metadata" || JSON_COLUMNS[table]?.includes(column)), "jsonColumns");
815
+ var invalidJson = /* @__PURE__ */ __name((database) => jsonColumns(database).map((one) => ({
816
+ ...one,
817
+ rows: Number(database.prepare(`SELECT count(*) AS n FROM "${one.table}" WHERE "${one.column}" IS NOT NULL AND NOT json_valid("${one.column}")`).get()?.n)
818
+ })).filter(({ rows }) => rows > 0), "invalidJson");
819
+ var QUICK_CHECK_LIMIT = 1e4;
820
+ var QUICK_HEALTH_CHECKS = "the file header, its size against its page count, and the schema's own pages";
821
+ var FTS5 = /^\s*CREATE\s+VIRTUAL\s+TABLE\s+\S+\s+USING\s+fts5\s*\(/i;
822
+ var fts5Tables = /* @__PURE__ */ __name((database) => database.prepare("SELECT name, sql FROM sqlite_master WHERE type = 'table' AND sql LIKE 'CREATE VIRTUAL TABLE%' ORDER BY name").all().filter((row) => FTS5.test(String(row.sql))).map((row) => {
823
+ const sql = String(row.sql);
824
+ return { name: String(row.name), sql, external: /content\s*=\s*'[^']+'/i.test(sql) };
825
+ }), "fts5Tables");
826
+ var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
827
+ var bytesOf = /* @__PURE__ */ __name((path) => statSync2(path, { throwIfNoEntry: false })?.size ?? 0, "bytesOf");
828
+ var damagedTables = /* @__PURE__ */ __name((database, lines) => {
829
+ const roots = new Map(database.prepare("SELECT rootpage, tbl_name FROM sqlite_master WHERE rootpage > 0").all().map((row) => [Number(row.rootpage), String(row.tbl_name)]));
830
+ const owners = new Map(database.prepare("SELECT name, tbl_name FROM sqlite_master WHERE type = 'index'").all().map((row) => [String(row.name), String(row.tbl_name)]));
831
+ const virtual = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND sql LIKE 'CREATE VIRTUAL TABLE%'").all().map((row) => String(row.name));
832
+ const ownerOf = /* @__PURE__ */ __name((table) => table === null ? null : virtual.find((name) => table.startsWith(`${name}_`)) ?? table, "ownerOf");
833
+ const tables = /* @__PURE__ */ new Map();
834
+ for (const raw of lines) {
835
+ const line = raw.replace(/^\*\*\* in database \w+ \*\*\*\s*/, "");
836
+ const tree = /^Tree (\d+) /.exec(line);
837
+ const column = /value in (\w+)\.\w+/.exec(line) ?? /^table (\w+): /.exec(line);
838
+ const index = /index (\w+)/.exec(line)?.[1];
839
+ const table = ownerOf(tree ? roots.get(Number(tree[1])) ?? null : column ? column[1] ?? null : index ? owners.get(index) ?? null : null);
840
+ const known = tables.get(table);
841
+ if (known)
842
+ known.problems += 1;
843
+ else
844
+ tables.set(table, { table, problems: 1, sample: line.slice(0, 200) });
845
+ }
846
+ return [...tables.values()].sort((a, b) => b.problems - a.problems);
847
+ }, "damagedTables");
848
+ var searchIndexHealth = /* @__PURE__ */ __name((database) => fts5Tables(database).map(({ name }) => {
849
+ try {
850
+ database.exec("BEGIN");
851
+ try {
852
+ database.exec(`INSERT INTO "${name}" ("${name}", rank) VALUES ('integrity-check', 0)`);
853
+ } finally {
854
+ database.exec("ROLLBACK");
784
855
  }
785
- })
786
- };
787
- var REMINDERS_QUERY = {
788
- entity: "reminder",
789
- backend: "sql",
790
- fields: queryFieldsOf(reminder, {
791
- native: ["id", "state", "due_at", "revision"],
792
- examples: { id: "id:1", state: "state:pending", due_at: "due_at>=2026-01-01", revision: "revision>1" }
793
- })
794
- };
856
+ return { name, ok: true };
857
+ } catch (error) {
858
+ return { name, ok: false, error: messageOf(error) };
859
+ }
860
+ }), "searchIndexHealth");
861
+ var pragmaLines = /* @__PURE__ */ __name((database, sql) => database.prepare(sql).all().flatMap((row) => String(Object.values(row)[0]).split("\n")), "pragmaLines");
862
+ var checkLines = /* @__PURE__ */ __name((database) => {
863
+ try {
864
+ return pragmaLines(database, `PRAGMA quick_check(${QUICK_CHECK_LIMIT})`);
865
+ } catch {
866
+ const tables = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND rootpage > 0 ORDER BY name").all().map((row) => String(row.name));
867
+ return tables.flatMap((table) => {
868
+ try {
869
+ return pragmaLines(database, `PRAGMA quick_check("${table}")`).filter((line) => line !== "ok");
870
+ } catch (error) {
871
+ return [`table ${table}: ${messageOf(error)}`];
872
+ }
873
+ });
874
+ }
875
+ }, "checkLines");
876
+ var quickHealth = /* @__PURE__ */ __name((database, path) => {
877
+ const pragma = /* @__PURE__ */ __name((name) => Number(Object.values(database.prepare(`PRAGMA ${name}`).get() ?? {})[0] ?? 0), "pragma");
878
+ const file = {
879
+ bytes: bytesOf(path),
880
+ pages: pragma("page_count"),
881
+ pageSize: pragma("page_size"),
882
+ freePages: pragma("freelist_count")
883
+ };
884
+ const schema = database.prepare("PRAGMA quick_check('sqlite_schema')").all().map((row) => String(Object.values(row)[0]));
885
+ const walFrames = existsSync(`${path}-wal`) && bytesOf(`${path}-wal`) > 0;
886
+ const sized = walFrames || file.bytes === file.pages * file.pageSize;
887
+ const problems = [
888
+ ...schema.length === 1 && schema[0] === "ok" ? [] : schema,
889
+ ...sized ? [] : [`the file holds ${file.bytes} bytes, its header says ${file.pages * file.pageSize}`]
890
+ ];
891
+ return { file, problems };
892
+ }, "quickHealth");
893
+ var storeHealth = /* @__PURE__ */ __name(async (path, { deep = false } = {}) => {
894
+ const started = Date.now();
895
+ const checked = deep ? "deep" : "quick";
896
+ const done = /* @__PURE__ */ __name((health) => ({
897
+ path,
898
+ checked,
899
+ ...health,
900
+ ms: Date.now() - started
901
+ }), "done");
902
+ let database;
903
+ try {
904
+ database = (await openSqlite(path, { readOnly: !deep })).database;
905
+ } catch (error) {
906
+ return done({ ok: false, error: messageOf(error) });
907
+ }
908
+ try {
909
+ const { file, problems } = quickHealth(database, path);
910
+ if (!deep) {
911
+ return done({
912
+ ok: problems.length === 0,
913
+ file,
914
+ ...problems.length ? {
915
+ problems: problems.length,
916
+ damagedTables: [{ table: null, problems: problems.length, sample: problems[0] }]
917
+ } : {}
918
+ });
919
+ }
920
+ database.exec("PRAGMA busy_timeout = 30000");
921
+ const lines = checkLines(database);
922
+ const pagesOk = lines.length === 1 && lines[0] === "ok";
923
+ const indexes = searchIndexHealth(database);
924
+ const json = pagesOk ? invalidJson(database) : [];
925
+ return done({
926
+ ok: pagesOk && problems.length === 0 && indexes.every((index) => index.ok) && json.length === 0,
927
+ file,
928
+ problems: pagesOk ? 0 : lines.length,
929
+ damagedTables: pagesOk ? [] : damagedTables(database, lines),
930
+ searchIndexes: indexes,
931
+ invalidJson: json
932
+ });
933
+ } catch (error) {
934
+ return done({ ok: false, error: messageOf(error) });
935
+ } finally {
936
+ database.close();
937
+ }
938
+ }, "storeHealth");
795
939
 
796
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/project-transfer/preview.js
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
797
941
  var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) => {
798
942
  if (!options || typeof options !== "object" || Array.isArray(options))
799
943
  throw new CliError("validation_error", "project preview options are required");
@@ -815,7 +959,7 @@ var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) =>
815
959
  }
816
960
  }, "previewProjectAnnotationSnapshot");
817
961
 
818
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot.js
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
819
963
  var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
820
964
  if (!options || typeof options !== "object" || Array.isArray(options))
821
965
  throw new CliError("validation_error", "snapshot options are required");
@@ -837,11 +981,13 @@ var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
837
981
  }, "snapshotProjectAnnotations");
838
982
 
839
983
  export {
984
+ explainDamage,
985
+ invalidJson,
986
+ QUICK_HEALTH_CHECKS,
987
+ fts5Tables,
988
+ storeHealth,
840
989
  previewDocumentTransfer,
841
990
  applyDocumentTransfer,
842
- ORGANIZATIONS_QUERY,
843
- PROJECTS_QUERY,
844
- REMINDERS_QUERY,
845
991
  previewProjectAnnotationSnapshot,
846
992
  snapshotProjectAnnotations
847
993
  };
@@ -7,7 +7,7 @@ import {
7
7
  commandPathOf,
8
8
  findCommand,
9
9
  outputOf
10
- } from "./chunk-PDYHEWKG.js";
10
+ } from "./chunk-O7ALBI2I.js";
11
11
  import {
12
12
  Command,
13
13
  Help,
@@ -18,18 +18,18 @@ import {
18
18
  environmentOf,
19
19
  metaOf,
20
20
  takesProfile
21
- } from "./chunk-73TTP6ET.js";
21
+ } from "./chunk-PEQA6LA5.js";
22
22
  import {
23
23
  writes
24
- } from "./chunk-TKW4QWCY.js";
24
+ } from "./chunk-FEZF3TII.js";
25
25
  import {
26
26
  CliError
27
- } from "./chunk-EBLA7GXY.js";
27
+ } from "./chunk-4OSSOWDM.js";
28
28
  import {
29
29
  __name
30
30
  } from "./chunk-ZVVMGPBJ.js";
31
31
 
32
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/cli/help/sections.js
32
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/help/sections.js
33
33
  var SECTIONS = {
34
34
  read: "Read",
35
35
  write: "Write",
@@ -94,7 +94,7 @@ var CORE_SECTIONS = {
94
94
  upgrade: "setup"
95
95
  };
96
96
 
97
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/cli/help/commands-text.js
97
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/help/commands-text.js
98
98
  var DESCRIPTION = 90;
99
99
  var COLUMN = 52;
100
100
  var short = /* @__PURE__ */ __name((text) => {
@@ -133,7 +133,7 @@ var commandsText = /* @__PURE__ */ __name((root, commands, scope) => {
133
133
  `;
134
134
  }, "commandsText");
135
135
 
136
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
136
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
137
137
  var ARGUMENT_KINDS = {
138
138
  chat: "chat",
139
139
  chats: "chat",
@@ -325,7 +325,7 @@ var installCommandHelp = /* @__PURE__ */ __name((program, { profile = true } = {
325
325
  command.addHelpText("after", () => commandHelpText(command));
326
326
  }, "installCommandHelp");
327
327
 
328
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
328
+ // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
329
329
  var WIRECAT_TOOLS = [
330
330
  {
331
331
  command: "tg",
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/mcp/instructions.js
7
+ // 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/mcp/instructions.js
8
8
  var instructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => {
9
9
  const all = typeof profile !== "string";
10
10
  const offers = /* @__PURE__ */ __name((key) => all || writes.includes(key), "offers");
@@ -0,0 +1,64 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ count,
5
+ id,
6
+ text,
7
+ time
8
+ } from "./chunk-CJHY5YIF.js";
9
+ import {
10
+ array,
11
+ nullable,
12
+ optional,
13
+ picklist,
14
+ record,
15
+ reference,
16
+ strictObject,
17
+ string,
18
+ unknown
19
+ } from "./chunk-FEZF3TII.js";
20
+
21
+ // 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/entities/note.js
22
+ var link = {
23
+ target_text: nullable(text),
24
+ kind: text,
25
+ anchor: nullable(text)
26
+ };
27
+ var note = strictObject({
28
+ ref: reference,
29
+ kind: optional(picklist(["note", "document"])),
30
+ provider: optional(text),
31
+ account: optional(text),
32
+ url: optional(text),
33
+ id,
34
+ source: picklist(["file", "internal"]),
35
+ folder_id: nullable(id),
36
+ path: nullable(text),
37
+ title: nullable(text),
38
+ text,
39
+ /** Raises on every edit; `notes edit --revision` takes it, so an edit made meanwhile is refused, not lost. */
40
+ revision: count,
41
+ /** A file's front matter as parsed, keys as the file writes them; null for a note without it. */
42
+ front_matter: nullable(record(string(), unknown())),
43
+ /** The hash of a file's bytes when last imported; null for a note written here. */
44
+ content_hash: nullable(text),
45
+ /** The file the note was exported to, where that is known; null otherwise. */
46
+ export_path: nullable(text),
47
+ created_at: time,
48
+ /** When the store's copy last changed. */
49
+ updated_at: time,
50
+ deleted_at: optional(nullable(time)),
51
+ tags: optional(array(text)),
52
+ /** The first line holding a word of a search. */
53
+ excerpt: optional(text),
54
+ /** Which halves of a search found it. */
55
+ found_by: optional(array(picklist(["title", "words", "meaning"]))),
56
+ /** What the note links to; `to` is null while the name written matches nothing stored. */
57
+ links: optional(array(strictObject({ to: nullable(reference), ...link }))),
58
+ /** The notes and messages that link to it. */
59
+ backlinks: optional(array(strictObject({ from: reference, ...link })))
60
+ });
61
+
62
+ export {
63
+ note
64
+ };
@@ -5,15 +5,15 @@ import {
5
5
  } from "./chunk-Y5E2WNWB.js";
6
6
  import {
7
7
  CliError
8
- } from "./chunk-EBLA7GXY.js";
8
+ } from "./chunk-4OSSOWDM.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/speech/recognize.js
13
+ // 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/speech/recognize.js
14
14
  import { createRequire } from "node:module";
15
15
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
16
+ // 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/speech/ogg-limit.js
17
17
  var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
18
18
  var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
19
19
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
@@ -70,7 +70,7 @@ var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
70
70
  throw invalid();
71
71
  }, "checkOggDuration");
72
72
 
73
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/speech/recognize.js
73
+ // 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/speech/recognize.js
74
74
  var SAMPLE_RATE = 16e3;
75
75
  var LEAD = SAMPLE_RATE / 2;
76
76
  var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
@@ -195,9 +195,23 @@ var openRecognizer = /* @__PURE__ */ __name((model, path, vadModel) => {
195
195
  });
196
196
  return heard;
197
197
  }, "pieces");
198
+ const piecesUntil = /* @__PURE__ */ __name(async (pcm, signal) => {
199
+ const spans = [];
200
+ cut(vad, pcm, (span) => spans.push(span));
201
+ const heard = [];
202
+ for (const { start, end, samples } of spans) {
203
+ await new Promise((resolve) => setImmediate(resolve));
204
+ signal.throwIfAborted();
205
+ const text = piece(samples);
206
+ if (text)
207
+ heard.push({ start, end, text });
208
+ }
209
+ return heard;
210
+ }, "piecesUntil");
198
211
  return {
199
212
  recognize: /* @__PURE__ */ __name((pcm) => pieces(pcm).map(({ text }) => text).join(" "), "recognize"),
200
213
  pieces,
214
+ piecesUntil,
201
215
  free: /* @__PURE__ */ __name(() => {
202
216
  vad.free();
203
217
  engine.free();
@@ -4,15 +4,15 @@ import {
4
4
  MAX_SECRET_INPUT,
5
5
  bufferedInput,
6
6
  inputPolicy
7
- } from "./chunk-SZXI4OXX.js";
7
+ } from "./chunk-IR4SQLBR.js";
8
8
  import {
9
9
  CliError
10
- } from "./chunk-EBLA7GXY.js";
10
+ } from "./chunk-4OSSOWDM.js";
11
11
  import {
12
12
  __name
13
13
  } from "./chunk-ZVVMGPBJ.js";
14
14
 
15
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/terminal/prompt.js
15
+ // 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/terminal/prompt.js
16
16
  import { createInterface } from "node:readline";
17
17
  import { Writable } from "node:stream";
18
18
  var readSecret = /* @__PURE__ */ __name(async (prompt, { input = process.stdin, output = process.stderr, echo = false, signal: givenSignal } = {}) => {
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CAPABILITY_STATEMENTS,
5
5
  storeCapable
6
- } from "./chunk-V7QMHMR3.js";
6
+ } from "./chunk-YALI4C7C.js";
7
7
  import {
8
8
  importFrom
9
9
  } from "./chunk-Y5E2WNWB.js";
@@ -11,7 +11,7 @@ import {
11
11
  __name
12
12
  } from "./chunk-ZVVMGPBJ.js";
13
13
 
14
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/sqlite-runtime.js
14
+ // 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/sqlite-runtime.js
15
15
  import { spawn, spawnSync } from "node:child_process";
16
16
  import { readFileSync } from "node:fs";
17
17
  import { dirname } from "node:path";
@@ -5,12 +5,12 @@ import {
5
5
  } from "./chunk-Y5E2WNWB.js";
6
6
  import {
7
7
  CliError
8
- } from "./chunk-EBLA7GXY.js";
8
+ } from "./chunk-4OSSOWDM.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
13
+ // 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/vector-extension.js
14
14
  import { readFileSync } from "node:fs";
15
15
  var musl = /* @__PURE__ */ __name(() => {
16
16
  if (process.platform !== "linux")
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-EBLA7GXY.js";
5
+ } from "./chunk-4OSSOWDM.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.565.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ff8e334310c9524b6cc272472a342b2f/node_modules/@wirecat/cli-core/dist/models/types.js
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
11
11
  var MAX_MODEL_IMAGE_BYTES = 4 * 1024 * 1024;
12
12
  var validateImages = /* @__PURE__ */ __name((images) => {
13
13
  if (images === void 0)