@wirecat/drive-cli 0.65.0 → 0.67.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 (233) hide show
  1. package/contracts/wirecat.json +2899 -0
  2. package/dist/bin/drive.js +2 -2
  3. package/dist/bin/drive.js.map +1 -1
  4. package/dist/browse.d.ts +1 -1
  5. package/dist/browse.d.ts.map +1 -1
  6. package/dist/browse.js +1 -1
  7. package/dist/bundle/{all-profiles-PD7GJHFA.js → all-profiles-DVZUVAPQ.js} +14 -14
  8. package/dist/bundle/{anthropic-PJKFON5H.js → anthropic-Y45C45O2.js} +20 -13
  9. package/dist/bundle/{app-server-6ELQA6FJ.js → app-server-GTXUOUGD.js} +67 -56
  10. package/dist/bundle/{bun-P54TGES2.js → bun-QVJV76QJ.js} +2 -2
  11. package/dist/bundle/{bun-sqlite-TND5ZRJH.js → bun-sqlite-CC7PIAMH.js} +9 -9
  12. package/dist/bundle/{chunk-Y5PKRITX.js → chunk-2MEVCMBW.js} +5 -5
  13. package/dist/bundle/{chunk-ZILALBYQ.js → chunk-2PIA45FC.js} +7 -5
  14. package/dist/bundle/{chunk-SIWXYB4E.js → chunk-2Y3YBDZX.js} +3123 -2851
  15. package/dist/bundle/{chunk-54V4H6PM.js → chunk-3RG6LL25.js} +12 -12
  16. package/dist/bundle/{chunk-UTNRBOEN.js → chunk-4G7WQNG7.js} +3 -2
  17. package/dist/bundle/{chunk-OWMZUWCM.js → chunk-4VH7M2OD.js} +6 -14
  18. package/dist/bundle/{chunk-EM7NL5ES.js → chunk-5DMPGTNR.js} +3 -3
  19. package/dist/bundle/{chunk-W2XY6C5S.js → chunk-5TK2YQCO.js} +2 -2
  20. package/dist/bundle/{chunk-NQ5XMSLA.js → chunk-5TSILGTO.js} +21668 -28647
  21. package/dist/bundle/{chunk-FBHSWQU7.js → chunk-6ERQE4FS.js} +319 -102
  22. package/dist/bundle/{chunk-4AOINPN2.js → chunk-7AZCAUST.js} +8 -2
  23. package/dist/bundle/{chunk-DA63E2UM.js → chunk-7J2IP3WL.js} +18 -15
  24. package/dist/bundle/{chunk-JPPPLKAO.js → chunk-7JKECODO.js} +1 -2
  25. package/dist/bundle/{chunk-SEQWBZYH.js → chunk-AAZPDWRD.js} +1 -1
  26. package/dist/bundle/{chunk-CWLL63JD.js → chunk-ABJQ6IDU.js} +17 -17
  27. package/dist/bundle/{chunk-PHOL2DZM.js → chunk-AJ3DFPRT.js} +63 -5
  28. package/dist/bundle/{chunk-4EDWLR22.js → chunk-AZKFZ7J7.js} +1 -1
  29. package/dist/bundle/{chunk-IMHW7VIV.js → chunk-BHSLMJF7.js} +5 -5
  30. package/dist/bundle/{chunk-EHU6EYGO.js → chunk-C72WYRXD.js} +12 -12
  31. package/dist/bundle/chunk-CWDC6QJM.js +72 -0
  32. package/dist/bundle/{chunk-TTP4NOP3.js → chunk-D4MVEOU2.js} +4 -4
  33. package/dist/bundle/{chunk-ZR2EJPMQ.js → chunk-DAFKV6DJ.js} +226 -18
  34. package/dist/bundle/{chunk-RNHGQ35R.js → chunk-E3XA56TS.js} +1 -1
  35. package/dist/bundle/{chunk-ELJUBPY4.js → chunk-EA2OB75T.js} +1 -1
  36. package/dist/bundle/{chunk-7TAP7Y2E.js → chunk-ETAFFY3J.js} +196 -112
  37. package/dist/bundle/{chunk-D6Z43SOG.js → chunk-EXWOOST5.js} +402 -362
  38. package/dist/bundle/{chunk-MCPOZNWG.js → chunk-FIVFP53N.js} +1 -1
  39. package/dist/bundle/{chunk-HP3NT6JJ.js → chunk-FOMQ4MG3.js} +3 -3
  40. package/dist/bundle/{chunk-VMAMRFFC.js → chunk-FS2PG2PE.js} +117 -44
  41. package/dist/bundle/{chunk-6DCLZLGX.js → chunk-HCZYJMBP.js} +1 -1
  42. package/dist/bundle/{chunk-OFJXHEFT.js → chunk-HJF2QGOX.js} +93 -31
  43. package/dist/bundle/{chunk-XPWZSW6Y.js → chunk-IJCUAKR5.js} +4 -4
  44. package/dist/bundle/{chunk-O6K2E7OA.js → chunk-IRULPE5M.js} +1522 -1107
  45. package/dist/bundle/{chunk-EU5MD24W.js → chunk-JCNEPYQZ.js} +13 -13
  46. package/dist/bundle/{chunk-VDZY3L7U.js → chunk-JEMBW6IO.js} +1 -1
  47. package/dist/bundle/{chunk-Z2ADO6UA.js → chunk-JJHDV32D.js} +2 -2
  48. package/dist/bundle/{chunk-FA6JNXCC.js → chunk-JLUQZZ26.js} +8 -8
  49. package/dist/bundle/{chunk-WRAUO5EJ.js → chunk-JO7BJYAP.js} +45 -22
  50. package/dist/bundle/{chunk-TOVWMURV.js → chunk-JRFKCYMW.js} +22 -7
  51. package/dist/bundle/{chunk-M7ELUGU6.js → chunk-JY2GZDJL.js} +4 -4
  52. package/dist/bundle/chunk-LSAIXPAX.js +47 -0
  53. package/dist/bundle/{chunk-WVJHZIDH.js → chunk-LXRBTXCZ.js} +3 -3
  54. package/dist/bundle/{chunk-RX5CJ55S.js → chunk-M4OP5ASJ.js} +1 -1
  55. package/dist/bundle/{chunk-F56DRBGY.js → chunk-MBLB4TQI.js} +75 -20
  56. package/dist/bundle/{chunk-4Y5YBFMS.js → chunk-MEQNAZ6R.js} +7 -7
  57. package/dist/bundle/{chunk-XYE7XZPB.js → chunk-MEY7URZZ.js} +39 -35
  58. package/dist/bundle/{chunk-IBO23OID.js → chunk-MF46W7PQ.js} +2 -2
  59. package/dist/bundle/{chunk-7AQGVX5O.js → chunk-MW46BLWH.js} +60 -29
  60. package/dist/bundle/{chunk-VHQYWFWV.js → chunk-NFIR346J.js} +1 -1
  61. package/dist/bundle/{chunk-NI5PD5KM.js → chunk-NWYVOHIX.js} +18611 -16472
  62. package/dist/bundle/chunk-NYECVHFH.js +10283 -0
  63. package/dist/bundle/{chunk-D7WB54P7.js → chunk-OOBSSU2G.js} +546 -457
  64. package/dist/bundle/{chunk-VLXWAH5E.js → chunk-P6A77LMP.js} +4 -4
  65. package/dist/bundle/{chunk-ZD4MB7NH.js → chunk-PDHN4GHU.js} +5 -40
  66. package/dist/bundle/{chunk-PLP5527C.js → chunk-PV3AWPHR.js} +5 -5
  67. package/dist/bundle/{chunk-TMHF4BCL.js → chunk-QOKPRFHM.js} +2 -2
  68. package/dist/bundle/{chunk-JMJIH6JH.js → chunk-RC72RU66.js} +6 -6
  69. package/dist/bundle/{chunk-NQRTKYJB.js → chunk-RLH6BOEG.js} +47 -80
  70. package/dist/bundle/{chunk-II4S2DBJ.js → chunk-SJE7UGOW.js} +12 -6
  71. package/dist/bundle/{chunk-LMKPP2JP.js → chunk-SXJDCRXE.js} +1 -1
  72. package/dist/bundle/{chunk-B2LPCHQN.js → chunk-T2VAEDJS.js} +4 -4
  73. package/dist/bundle/{chunk-I272E6UR.js → chunk-U2ERT45N.js} +54 -117
  74. package/dist/bundle/{chunk-A27UVLPK.js → chunk-UFNE57VY.js} +3 -3
  75. package/dist/bundle/{chunk-5XSBCMAF.js → chunk-ULH3TNUP.js} +4 -4
  76. package/dist/bundle/{chunk-3ONWN3IA.js → chunk-UOAHZV3K.js} +161 -48
  77. package/dist/bundle/{chunk-ECEP4SO3.js → chunk-UPCEHSIZ.js} +10 -10
  78. package/dist/bundle/{chunk-42G2XNPN.js → chunk-V7E25BUU.js} +2 -2
  79. package/dist/bundle/{chunk-EZ2OLYEK.js → chunk-VZ5KETIX.js} +14 -5
  80. package/dist/bundle/{chunk-X7YGGWXI.js → chunk-WBKYZZQT.js} +3 -2
  81. package/dist/bundle/{chunk-GW3LBY3T.js → chunk-WKIQKGOF.js} +146 -133
  82. package/dist/bundle/{chunk-O7ZDCOZE.js → chunk-WWW7YTFG.js} +1 -1
  83. package/dist/bundle/{chunk-2AFI4KGI.js → chunk-XZCF5XU7.js} +7 -7
  84. package/dist/bundle/chunk-Y2QVNVHK.js +70 -0
  85. package/dist/bundle/{chunk-WRMJN6UQ.js → chunk-Y5WSRG3F.js} +3 -3
  86. package/dist/bundle/{chunk-A4QNADEX.js → chunk-YI4DXASF.js} +49 -49
  87. package/dist/bundle/{chunk-SS4LKLD7.js → chunk-YVUAG7RF.js} +371 -362
  88. package/dist/bundle/chunk-ZEPDEFVT.js +71 -0
  89. package/dist/bundle/{chunk-SE352DBY.js → chunk-ZH4H5XTA.js} +1 -1
  90. package/dist/bundle/{chunk-3HXNDF6Q.js → chunk-ZK46UHDP.js} +2 -2
  91. package/dist/bundle/{chunk-SNLSEYJO.js → chunk-ZU5VQYNY.js} +1 -1
  92. package/dist/bundle/cli-U4LSBYDV.js +1101 -0
  93. package/dist/bundle/command-contract-UU5T24ZZ.js +41 -0
  94. package/dist/bundle/{command-server-entry-36JXYIJB.js → command-server-entry-PK6FBUPO.js} +31 -30
  95. package/dist/bundle/{decode-T5ZW57WZ.js → decode-3ZE6NBKV.js} +8 -8
  96. package/dist/bundle/{dispatch-RMA2XFYA.js → dispatch-WBEOHZDV.js} +9 -9
  97. package/dist/bundle/drive.js +13 -13
  98. package/dist/bundle/{echarts-KQ44LPSF.js → echarts-6FWNCNXK.js} +2 -2
  99. package/dist/bundle/{embed-Q7XST53J.js → embed-DGYBBZUW.js} +9 -9
  100. package/dist/bundle/{embedder-RWZSBVW2.js → embedder-O7A6VMWI.js} +12 -12
  101. package/dist/bundle/entry-CDJ2QSU2.js +25 -0
  102. package/dist/bundle/{failure-7NP4QPIN.js → failure-X6PSLVSO.js} +4 -4
  103. package/dist/bundle/first-run-UOQW7DN5.js +30 -0
  104. package/dist/bundle/first-screen-SNDV4YKF.js +39 -0
  105. package/dist/bundle/google-HPX52KMC.js +45 -0
  106. package/dist/bundle/{google-api-P5DRHD7L.js → google-api-HIMN4XL5.js} +68 -63
  107. package/dist/bundle/grants-RO42I6E4.js +111 -0
  108. package/dist/bundle/{identity-VDV6CHRW.js → identity-NFGHDPLL.js} +8 -6
  109. package/dist/bundle/{instructions-Q45FVY6H.js → instructions-6JAQYCM6.js} +1 -1
  110. package/dist/bundle/{login-XKN3NI6X.js → login-RZOQN63N.js} +73 -70
  111. package/dist/bundle/{mcp-7KQUJNFN.js → mcp-TDKGDB4V.js} +2 -2
  112. package/dist/bundle/{node-MSW565D3.js → node-KSIX3GIH.js} +2 -2
  113. package/dist/bundle/{node-sqlite-S74XVVHL.js → node-sqlite-4FJ6WJXN.js} +10 -10
  114. package/dist/bundle/oauth-BKZAMFKK.js +22 -0
  115. package/dist/bundle/{open-P7UQG7XJ.js → open-4AQJGH42.js} +8 -8
  116. package/dist/bundle/{openai-DDHJ57KZ.js → openai-24F2OX55.js} +28 -21
  117. package/dist/bundle/{process-NMUB5SHK.js → process-7NOA2T7H.js} +1 -1
  118. package/dist/bundle/{program-PJNWP6JW.js → program-7JHMLDEX.js} +306 -692
  119. package/dist/bundle/{prompt-VOSMK4C2.js → prompt-NM66MAZ4.js} +8 -8
  120. package/dist/bundle/{reasons-KDAXOC5S.js → reasons-KSYP5VDJ.js} +5 -5
  121. package/dist/bundle/{recognize-GZIY63HS.js → recognize-DBKV2JYZ.js} +7 -7
  122. package/dist/bundle/{remote-V3YGN7LN.js → remote-ABWUTBVB.js} +13 -10
  123. package/dist/bundle/{rerank-XRU6AVN7.js → rerank-FQAU4ENY.js} +10 -10
  124. package/dist/bundle/{serve-NDOAFA57.js → serve-QLJG4QZD.js} +12 -12
  125. package/dist/bundle/server-NUBLY5SV.js +74 -0
  126. package/dist/bundle/{server-BKGWJYMC.js → server-VGZNK5XD.js} +47 -45
  127. package/dist/bundle/{services-TYDMFQCA.js → services-5KARVUHK.js} +44 -34
  128. package/dist/bundle/{sqlite-runtime-UAFJKSJR.js → sqlite-runtime-ILF6EFQJ.js} +9 -9
  129. package/dist/bundle/{start-2ZLDP2OE.js → start-C6EXYXAL.js} +7 -7
  130. package/dist/bundle/{state-6SP27J2K.js → state-R2M56GPU.js} +9 -9
  131. package/dist/bundle/{store-4UUY545Q.js → store-2OBVMUQL.js} +21 -19
  132. package/dist/bundle/{store-EJN27MXI.js → store-DA4K7HWW.js} +23 -21
  133. package/dist/bundle/store-maintenance-command-KSIPI5B5.js +65 -0
  134. package/dist/bundle/tokens-VQDGSHRB.js +111 -0
  135. package/dist/commands/config.d.ts.map +1 -1
  136. package/dist/commands/config.js +5 -3
  137. package/dist/commands/config.js.map +1 -1
  138. package/dist/commands/discovery.d.ts +0 -1
  139. package/dist/commands/discovery.d.ts.map +1 -1
  140. package/dist/commands/discovery.js +6 -26
  141. package/dist/commands/discovery.js.map +1 -1
  142. package/dist/commands/knowledge.d.ts.map +1 -1
  143. package/dist/commands/knowledge.js +7 -6
  144. package/dist/commands/knowledge.js.map +1 -1
  145. package/dist/commands/search.d.ts.map +1 -1
  146. package/dist/commands/search.js +15 -12
  147. package/dist/commands/search.js.map +1 -1
  148. package/dist/commands/sync.d.ts.map +1 -1
  149. package/dist/commands/sync.js +2 -1
  150. package/dist/commands/sync.js.map +1 -1
  151. package/dist/commands/transcripts.d.ts +4 -0
  152. package/dist/commands/transcripts.d.ts.map +1 -0
  153. package/dist/commands/transcripts.js +42 -0
  154. package/dist/commands/transcripts.js.map +1 -0
  155. package/dist/config.d.ts +10 -0
  156. package/dist/config.d.ts.map +1 -1
  157. package/dist/config.js +17 -3
  158. package/dist/config.js.map +1 -1
  159. package/dist/contract-overrides.d.ts +16 -4
  160. package/dist/contract-overrides.d.ts.map +1 -1
  161. package/dist/contract-overrides.js +86 -410
  162. package/dist/contract-overrides.js.map +1 -1
  163. package/dist/errors.d.ts.map +1 -1
  164. package/dist/errors.js +4 -0
  165. package/dist/errors.js.map +1 -1
  166. package/dist/google-api.d.ts.map +1 -1
  167. package/dist/google-api.js +4 -1
  168. package/dist/google-api.js.map +1 -1
  169. package/dist/google.d.ts.map +1 -1
  170. package/dist/google.js +31 -28
  171. package/dist/google.js.map +1 -1
  172. package/dist/identity.d.ts +4 -0
  173. package/dist/identity.d.ts.map +1 -1
  174. package/dist/identity.js +22 -0
  175. package/dist/identity.js.map +1 -1
  176. package/dist/knowledge.js +2 -2
  177. package/dist/knowledge.js.map +1 -1
  178. package/dist/list-queries.d.ts +10 -0
  179. package/dist/list-queries.d.ts.map +1 -1
  180. package/dist/list-queries.js +12 -1
  181. package/dist/list-queries.js.map +1 -1
  182. package/dist/login.d.ts.map +1 -1
  183. package/dist/login.js +2 -2
  184. package/dist/login.js.map +1 -1
  185. package/dist/model.d.ts +4 -1
  186. package/dist/model.d.ts.map +1 -1
  187. package/dist/program.d.ts.map +1 -1
  188. package/dist/program.js +10 -6
  189. package/dist/program.js.map +1 -1
  190. package/dist/reasons.d.ts.map +1 -1
  191. package/dist/reasons.js +0 -1
  192. package/dist/reasons.js.map +1 -1
  193. package/dist/state.d.ts.map +1 -1
  194. package/dist/state.js +2 -0
  195. package/dist/state.js.map +1 -1
  196. package/dist/store-transition.js +2 -2
  197. package/dist/store-transition.js.map +1 -1
  198. package/dist/store.d.ts.map +1 -1
  199. package/dist/store.js +7 -7
  200. package/dist/store.js.map +1 -1
  201. package/dist/sync.d.ts.map +1 -1
  202. package/dist/sync.js +5 -1
  203. package/dist/sync.js.map +1 -1
  204. package/dist/tokens.d.ts +9 -2
  205. package/dist/tokens.d.ts.map +1 -1
  206. package/dist/tokens.js +18 -15
  207. package/dist/tokens.js.map +1 -1
  208. package/dist/transcripts.d.ts +21 -0
  209. package/dist/transcripts.d.ts.map +1 -0
  210. package/dist/transcripts.js +48 -0
  211. package/dist/transcripts.js.map +1 -0
  212. package/dist/version.d.ts +1 -1
  213. package/dist/version.js +1 -1
  214. package/dist/wcat.d.ts +3 -0
  215. package/dist/wcat.d.ts.map +1 -0
  216. package/dist/wcat.js +4 -0
  217. package/dist/wcat.js.map +1 -0
  218. package/package.json +7 -7
  219. package/dist/bundle/chunk-CGQRZRTH.js +0 -26
  220. package/dist/bundle/chunk-IKHOIXJR.js +0 -27
  221. package/dist/bundle/chunk-SBZB7HMU.js +0 -1055
  222. package/dist/bundle/command-contract-25E4PYMD.js +0 -40
  223. package/dist/bundle/dist-PY3MVR3G.js +0 -21
  224. package/dist/bundle/entry-HPLW4QL2.js +0 -25
  225. package/dist/bundle/first-run-RL3RKYZW.js +0 -30
  226. package/dist/bundle/first-screen-NX3TM2VJ.js +0 -38
  227. package/dist/bundle/google-DPD5N6AQ.js +0 -42
  228. package/dist/bundle/grants-TX4MHLI4.js +0 -109
  229. package/dist/bundle/oauth-6R7AWAES.js +0 -22
  230. package/dist/bundle/server-QD2MUJJZ.js +0 -72
  231. package/dist/bundle/store-maintenance-command-LETURZDC.js +0 -60
  232. package/dist/bundle/tokens-MTFJPTYT.js +0 -107
  233. /package/dist/bundle/{chunk-YVNHQFLC.js → chunk-XWBPP2HX.js} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/executable.js
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/executable.js
8
8
  import { existsSync } from "node:fs";
9
9
  import { win32 } from "node:path";
10
10
  var variable = /* @__PURE__ */ __name((env, name) => Object.entries(env).find(([key]) => key.toUpperCase() === name)?.[1], "variable");
@@ -4,15 +4,15 @@ import {
4
4
  MAX_SECRET_INPUT,
5
5
  bufferedInput,
6
6
  inputPolicy
7
- } from "./chunk-Z2ADO6UA.js";
7
+ } from "./chunk-JJHDV32D.js";
8
8
  import {
9
9
  CliError
10
- } from "./chunk-ELJUBPY4.js";
10
+ } from "./chunk-EA2OB75T.js";
11
11
  import {
12
12
  __name
13
13
  } from "./chunk-ZVVMGPBJ.js";
14
14
 
15
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/terminal/prompt.js
15
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/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 EMPTY_TRIES = 3;
@@ -2,10 +2,10 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  walkQuery
5
- } from "./chunk-ECEP4SO3.js";
5
+ } from "./chunk-UPCEHSIZ.js";
6
6
  import {
7
7
  writeSecurely
8
- } from "./chunk-7AQGVX5O.js";
8
+ } from "./chunk-MW46BLWH.js";
9
9
  import {
10
10
  array,
11
11
  literal,
@@ -21,16 +21,16 @@ import {
21
21
  safeParse,
22
22
  string,
23
23
  trim
24
- } from "./chunk-TOVWMURV.js";
24
+ } from "./chunk-JRFKCYMW.js";
25
25
  import {
26
26
  CliError,
27
27
  isCliError
28
- } from "./chunk-ELJUBPY4.js";
28
+ } from "./chunk-EA2OB75T.js";
29
29
  import {
30
30
  __name
31
31
  } from "./chunk-ZVVMGPBJ.js";
32
32
 
33
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/documents/blocks.js
33
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/documents/blocks.js
34
34
  var MARKS = ["bold", "italic", "strike", "code", "link"];
35
35
  var sameMarks = /* @__PURE__ */ __name((a, b) => MARKS.every((mark) => a[mark] === b[mark]), "sameMarks");
36
36
  var normalizeInlines = /* @__PURE__ */ __name((inlines) => {
@@ -78,7 +78,7 @@ var key = /* @__PURE__ */ __name((block, withChecked) => {
78
78
  var blockKey = /* @__PURE__ */ __name((block) => JSON.stringify(key(block, true)), "blockKey");
79
79
  var blockShape = /* @__PURE__ */ __name((block) => JSON.stringify(key(block, false)), "blockShape");
80
80
 
81
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/block-diff.js
81
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/block-diff.js
82
82
  var MAX_CELLS = 4e6;
83
83
  var matches = /* @__PURE__ */ __name((a, b, keyOf) => {
84
84
  const ka = a.map(keyOf);
@@ -224,7 +224,7 @@ var mergeBlocks = /* @__PURE__ */ __name((baseLocal, baseRemote, local, remote,
224
224
  return { status: "clean", blocks, conflicts };
225
225
  }, "mergeBlocks");
226
226
 
227
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/extraction.js
227
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/extraction.js
228
228
  var Proposal = object({
229
229
  kind: picklist(["summary", "digest", "fact", "preference"]),
230
230
  body: pipe(string(), trim(), minLength(1), maxLength(15e3)),
@@ -259,7 +259,7 @@ var extractMemories = /* @__PURE__ */ __name(async (text, complete) => {
259
259
  return { ...proposals, provider: answer.provider, model: answer.model, tokens: answer.tokens };
260
260
  }, "extractMemories");
261
261
 
262
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/ingestion.js
262
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/ingestion.js
263
263
  var documentIngestion = /* @__PURE__ */ __name((store, options) => {
264
264
  const folder = /* @__PURE__ */ __name(async (principal, create) => {
265
265
  if (options.provider)
@@ -295,10 +295,10 @@ var documentIngestion = /* @__PURE__ */ __name((store, options) => {
295
295
  const stale = /* @__PURE__ */ __name(async (ref) => {
296
296
  for (const status of ["proposed", "confirmed"]) {
297
297
  for (let batch = 0; ; batch++) {
298
- const memories = await store.memories.list({ subject: ref, status, limit: 500 });
299
- for (const memory of memories)
298
+ const { items, hasMore } = await store.memories.list({ subject: ref, status, limit: 500 });
299
+ for (const memory of items)
300
300
  await store.memories.markStale(memory.ref, "owner");
301
- if (memories.length < 500)
301
+ if (!hasMore)
302
302
  break;
303
303
  if (batch >= 20)
304
304
  throw new CliError("provider_error", "memory invalidation exceeded its batch bound");
@@ -386,7 +386,7 @@ var documentIngestion = /* @__PURE__ */ __name((store, options) => {
386
386
  };
387
387
  }, "documentIngestion");
388
388
 
389
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/knowledge.js
389
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/knowledge.js
390
390
  var writer = /* @__PURE__ */ __name((by) => {
391
391
  if (by === void 0)
392
392
  throw new CliError("validation_error", "name who writes it: the owner or an agent; there is no default", {
@@ -508,8 +508,7 @@ var documentKnowledge = /* @__PURE__ */ __name((store, folder) => {
508
508
  }, "memory"),
509
509
  searchMemories: /* @__PURE__ */ __name(async (principal, ref, query, scope) => {
510
510
  await document(principal, ref);
511
- const items = await store.memories.search(query, { subject: ref, ...scope ? { scope } : {}, limit: 200 });
512
- return { items, limit_reached: items.length === 200 };
511
+ return store.memories.search(query, { subject: ref, ...scope ? { scope } : {}, limit: 200 });
513
512
  }, "searchMemories"),
514
513
  addFact: /* @__PURE__ */ __name(async (principal, ref, { statement, type, scope, by, supersedes, occurredAt }) => {
515
514
  await document(principal, ref);
@@ -542,7 +541,7 @@ var documentKnowledge = /* @__PURE__ */ __name((store, folder) => {
542
541
  return port;
543
542
  }, "documentKnowledge");
544
543
 
545
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/documents/markdown-blocks.js
544
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/documents/markdown-blocks.js
546
545
  var parser;
547
546
  var loadParser = /* @__PURE__ */ __name(() => parser ??= Promise.all([
548
547
  import("./mdast-util-from-markdown-CE73EWJ2.js"),
@@ -667,7 +666,7 @@ var placedMarkdownBlocks = /* @__PURE__ */ __name(async (markdown) => {
667
666
  return blocks(tree.children);
668
667
  }, "placedMarkdownBlocks");
669
668
 
670
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/markdown-splice.js
669
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/markdown-splice.js
671
670
  var escapeText = /* @__PURE__ */ __name((text) => text.replace(/[\\`*_[\]<>~|]/g, "\\$&"), "escapeText");
672
671
  var codeSpan = /* @__PURE__ */ __name((text) => {
673
672
  const longest = (text.match(/`+/g) ?? []).reduce((most, run) => Math.max(most, run.length), 0);
@@ -853,15 +852,15 @@ var columnsBefore = /* @__PURE__ */ __name((placed, index) => {
853
852
  return columns;
854
853
  }, "columnsBefore");
855
854
 
856
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/mirror-watch.js
855
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/mirror-watch.js
857
856
  import { watch } from "node:fs";
858
857
 
859
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/mirrors.js
858
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/mirrors.js
860
859
  import { createHash as createHash2 } from "node:crypto";
861
860
  import { mkdirSync, readFileSync } from "node:fs";
862
861
  import { join as join2 } from "node:path";
863
862
 
864
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/push.js
863
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/push.js
865
864
  import { createHash, randomUUID } from "node:crypto";
866
865
  import { createReadStream } from "node:fs";
867
866
  import { chmod, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
@@ -1113,7 +1112,7 @@ var pushDocuments = /* @__PURE__ */ __name(async (options) => {
1113
1112
  return result;
1114
1113
  }, "pushDocuments");
1115
1114
 
1116
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/mirrors.js
1115
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/mirrors.js
1117
1116
  var mirrorId = /* @__PURE__ */ __name((root, folder) => createHash2("sha256").update(JSON.stringify([root, folder])).digest("hex").slice(0, 8), "mirrorId");
1118
1117
  var ID = pipe(string(), regex(/^[A-Za-z0-9_-]{1,200}$/));
1119
1118
  var stateSchema = /* @__PURE__ */ __name((kinds) => object({
@@ -1235,7 +1234,7 @@ var syncMirrors = /* @__PURE__ */ __name(async (options) => {
1235
1234
  };
1236
1235
  }, "syncMirrors");
1237
1236
 
1238
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/mirror-watch.js
1237
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/mirror-watch.js
1239
1238
  var sleep = /* @__PURE__ */ __name((milliseconds, signal) => new Promise((resolve) => {
1240
1239
  const finish = /* @__PURE__ */ __name(() => {
1241
1240
  clearTimeout(timer);
@@ -1374,7 +1373,7 @@ async function* watchMirrors(sync, options) {
1374
1373
  }
1375
1374
  __name(watchMirrors, "watchMirrors");
1376
1375
 
1377
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/proposals.js
1376
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/proposals.js
1378
1377
  var extractDocumentMemories = /* @__PURE__ */ __name(async (options) => {
1379
1378
  const source = options.read();
1380
1379
  const text = options.tab ? source.snapshot.tabs.find((tab) => tab.id === options.tab)?.text : source.snapshot.text;
@@ -1424,10 +1423,10 @@ Snapshot: ${source.hash}`;
1424
1423
  };
1425
1424
  }, "extractDocumentMemories");
1426
1425
 
1427
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/sync.js
1426
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/sync.js
1428
1427
  import { createHash as createHash4 } from "node:crypto";
1429
1428
 
1430
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/documents/scope.js
1429
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/documents/scope.js
1431
1430
  var within = /* @__PURE__ */ __name((file, roots, folders, seen = /* @__PURE__ */ new Set()) => {
1432
1431
  if (file.trashed)
1433
1432
  return false;
@@ -1441,10 +1440,18 @@ var within = /* @__PURE__ */ __name((file, roots, folders, seen = /* @__PURE__ *
1441
1440
  return folder ? within(folder, roots, folders, next) : roots.includes(id);
1442
1441
  });
1443
1442
  }, "within");
1443
+ var inScope = /* @__PURE__ */ __name((file, roots, folders, matched = /* @__PURE__ */ new Set(), query) => {
1444
+ if (file.trashed)
1445
+ return false;
1446
+ if (query?.mode === "exclude" && query.matches(file))
1447
+ return false;
1448
+ return matched.has(file.id) || within(file, roots, folders);
1449
+ }, "inScope");
1444
1450
 
1445
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/documents/catalog.js
1446
- var catalogFiles = /* @__PURE__ */ __name((state, roots) => {
1451
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/documents/catalog.js
1452
+ var catalogFiles = /* @__PURE__ */ __name((state, roots, query) => {
1447
1453
  const folders = state.pending?.folders ?? state.folders;
1454
+ const matched = new Set(state.pending?.matched ?? state.matched ?? []);
1448
1455
  const files = new Map(Object.values(state.documents).map((doc) => [doc.metadata.id, doc.metadata]));
1449
1456
  for (const skip of state.skipped)
1450
1457
  if (skip.file)
@@ -1457,19 +1464,19 @@ var catalogFiles = /* @__PURE__ */ __name((state, roots) => {
1457
1464
  else if (job.file)
1458
1465
  files.set(job.id, job.file);
1459
1466
  }
1460
- return [...files.values()].filter((file) => within(file, roots, folders));
1467
+ return [...files.values()].filter((file) => inScope(file, roots, folders, matched, query));
1461
1468
  }, "catalogFiles");
1462
1469
 
1463
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/plan.js
1470
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/plan.js
1464
1471
  import { createHash as createHash3 } from "node:crypto";
1465
- var scopeHash = /* @__PURE__ */ __name((roots) => createHash3("sha256").update(JSON.stringify([...roots].sort())).digest("hex"), "scopeHash");
1472
+ var scopeHash = /* @__PURE__ */ __name((roots, query) => createHash3("sha256").update(JSON.stringify(query ? [[...roots].sort(), query.mode, query.key] : [...roots].sort())).digest("hex"), "scopeHash");
1466
1473
  var changedSince = /* @__PURE__ */ __name((previous, file) => previous.version !== file.version || previous.modifiedAt !== file.modifiedAt || previous.name !== file.name || previous.canDownload !== file.canDownload || JSON.stringify(previous.parents) !== JSON.stringify(file.parents), "changedSince");
1467
1474
  var SAVE_EVERY_MS = 2e3;
1468
1475
  var planDocuments = /* @__PURE__ */ __name(async (options, source, state, roots, limit, pictures, abandoned = [], walks) => {
1469
- const { isFolder, skipReason, retryable, maxEntries: MAX_ENTRIES, errorOf } = options;
1476
+ const { isFolder, skipReason, retryable, maxEntries: MAX_ENTRIES, errorOf, query } = options;
1470
1477
  const tooManyEntries = /* @__PURE__ */ __name(() => options.limitError?.() ?? new CliError("validation_error", `selected folders exceed the ${MAX_ENTRIES} entry limit`), "tooManyEntries");
1471
- const scope = scopeHash(roots);
1472
- if (!roots.length)
1478
+ const scope = scopeHash(roots, query);
1479
+ if (!roots.length && query?.mode !== "include")
1473
1480
  return {
1474
1481
  scope,
1475
1482
  cursor: state.cursor ?? "",
@@ -1478,7 +1485,10 @@ var planDocuments = /* @__PURE__ */ __name(async (options, source, state, roots,
1478
1485
  jobs: [.../* @__PURE__ */ new Set([...Object.keys(state.documents), ...abandoned])].map((id) => ({ id, kind: "remove" }))
1479
1486
  };
1480
1487
  if (!source)
1481
- throw new CliError("configuration_error", "selected folders require an authenticated source");
1488
+ throw new CliError("configuration_error", "selected folders or a saved query require an authenticated source");
1489
+ if (query?.mode === "include" && !query.list)
1490
+ throw new CliError("configuration_error", "a query that includes files must list them");
1491
+ const found = query?.mode === "include" && query.list ? await query.list() : [];
1482
1492
  const initial = !state.cursor || scope !== state.scope;
1483
1493
  const resumed = initial ? walks?.read(scope) : void 0;
1484
1494
  const cursor = initial ? resumed?.cursor ?? await source.startToken() : state.cursor;
@@ -1607,13 +1617,25 @@ var planDocuments = /* @__PURE__ */ __name(async (options, source, state, roots,
1607
1617
  if (!visited.has(folder.id) && within(folder, roots, folders))
1608
1618
  await crawl(folder);
1609
1619
  }
1620
+ const matched = /* @__PURE__ */ new Set();
1621
+ for (const file of found) {
1622
+ if (isFolder(file) || file.trashed || !query?.matches(file) || matched.has(file.id))
1623
+ continue;
1624
+ if (!files.has(file.id) && ++discovered > MAX_ENTRIES)
1625
+ throw tooManyEntries();
1626
+ const prior = state.documents[file.id]?.metadata ?? state.skipped.find((item) => item.id === file.id)?.file;
1627
+ if (initial || !prior || changedSince(prior, file))
1628
+ changed.add(file.id);
1629
+ files.set(file.id, file);
1630
+ matched.add(file.id);
1631
+ }
1610
1632
  const jobs = [];
1611
1633
  const skipped = [];
1612
1634
  for (const root of roots)
1613
1635
  if (folders[root]?.trashed)
1614
1636
  skipped.push({ id: root, reason: "selected folder is unavailable" });
1615
1637
  for (const [id, file] of files) {
1616
- if (!within(file, roots, folders))
1638
+ if (!inScope(file, roots, folders, matched, query))
1617
1639
  continue;
1618
1640
  const previousSkip = state.skipped.find((item) => item.id === id);
1619
1641
  const reason = skipReason(file);
@@ -1637,21 +1659,28 @@ var planDocuments = /* @__PURE__ */ __name(async (options, source, state, roots,
1637
1659
  }
1638
1660
  for (const id of /* @__PURE__ */ new Set([...Object.keys(state.documents), ...abandoned])) {
1639
1661
  const file = files.get(id);
1640
- if (!file || !within(file, roots, folders))
1662
+ if (!file || !inScope(file, roots, folders, matched, query))
1641
1663
  jobs.push({ id, kind: "remove" });
1642
1664
  }
1643
1665
  const scopedFolders = Object.fromEntries(Object.entries(folders).filter(([, file]) => within(file, roots, folders) || roots.includes(file.id)));
1644
- return { scope, cursor: finalCursor, folders: scopedFolders, jobs, skipped };
1666
+ return {
1667
+ scope,
1668
+ cursor: finalCursor,
1669
+ folders: scopedFolders,
1670
+ jobs,
1671
+ skipped,
1672
+ ...query?.mode === "include" ? { matched: [...matched] } : {}
1673
+ };
1645
1674
  }, "planDocuments");
1646
1675
 
1647
- // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/services/documents/sync.js
1676
+ // node_modules/.pnpm/@wirecat+cli-core@0.652.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_8be4ae3be01c4720e564a3a01e19fd64/node_modules/@wirecat/cli-core/dist/services/documents/sync.js
1648
1677
  var MAX_PICTURE_BYTES = 25 * 1024 * 1024;
1649
1678
  var SAVE_EVERY_MS2 = 2e3;
1650
1679
  var SAVE_EVERY_ITEMS = 25;
1651
1680
  var isPicture = /* @__PURE__ */ __name((file) => file.mime.startsWith("image/") && file.canDownload, "isPicture");
1652
1681
  var hashText2 = /* @__PURE__ */ __name((text) => createHash4("sha256").update(text).digest("hex"), "hashText");
1653
1682
  var syncDocuments = /* @__PURE__ */ __name(async (options) => {
1654
- const { source, index, state: statePort, principal, roots, textLimit: limit, max, signal, rescan = false, pictures = false, assertHeld, errorOf, skipReason, storeVersion: VERSION } = options;
1683
+ const { source, index, state: statePort, principal, roots, textLimit: limit, max, signal, rescan = false, pictures = false, assertHeld, errorOf, skipReason, storeVersion: VERSION, query } = options;
1655
1684
  if (![max, limit, options.maxEntries].every((value) => Number.isSafeInteger(value) && value > 0))
1656
1685
  throw new CliError("validation_error", "sync limits must be positive whole numbers");
1657
1686
  const profile = { principal, roots, picture_search: pictures };
@@ -1667,20 +1696,20 @@ var syncDocuments = /* @__PURE__ */ __name(async (options) => {
1667
1696
  pending: 0,
1668
1697
  skipped: [],
1669
1698
  errors: [],
1670
- coverage: "selected folders only; unsupported files are reported",
1699
+ coverage: query?.mode === "include" ? "selected folders and the files a saved query finds; unsupported files are reported" : query?.mode === "exclude" ? "selected folders only, without the files a saved query keeps out; unsupported files are reported" : "selected folders only; unsupported files are reported",
1671
1700
  ...profile.picture_search ? { pictures: 0 } : {}
1672
1701
  };
1673
1702
  let writer2;
1674
1703
  let flush;
1675
1704
  try {
1676
- if (profile.roots.length && (!source || await source.identity() !== profile.principal))
1705
+ if ((profile.roots.length || query?.mode === "include") && (!source || await source.identity() !== profile.principal))
1677
1706
  throw new CliError("authentication_error", "signed-in source account does not match this profile", {
1678
1707
  reason: "profile.wrong-account"
1679
1708
  });
1680
1709
  const state = statePort.read();
1681
1710
  if (state.principal !== principal)
1682
1711
  throw new CliError("configuration_error", "sync state belongs to another source account");
1683
- const currentScope = scopeHash(profile.roots);
1712
+ const currentScope = scopeHash(profile.roots, query);
1684
1713
  const abandoned = state.pending && (state.pending.scope !== currentScope || rescan) ? state.pending.jobs.map((job) => job.id) : [];
1685
1714
  if (state.pending?.scope !== currentScope || rescan)
1686
1715
  delete state.pending;
@@ -1701,7 +1730,7 @@ var syncDocuments = /* @__PURE__ */ __name(async (options) => {
1701
1730
  if (!pending)
1702
1731
  throw new CliError("invalid_response", "could not prepare a sync batch");
1703
1732
  if (index.catalog)
1704
- await index.catalog.import(profile.principal, catalogFiles(state, profile.roots));
1733
+ await index.catalog.import(profile.principal, catalogFiles(state, profile.roots, query));
1705
1734
  result.skipped = state.skipped.map(({ id, reason }) => ({ id, reason }));
1706
1735
  const saveNamesOnly = /* @__PURE__ */ __name(async (file, reason) => {
1707
1736
  const doc = { metadata: file, markdown: "", text: "", tabs: [], notRead: reason };
@@ -1778,7 +1807,8 @@ var syncDocuments = /* @__PURE__ */ __name(async (options) => {
1778
1807
  if (!source)
1779
1808
  throw new CliError("configuration_error", "a pending save requires source sign-in");
1780
1809
  const content = await source.content(job.id, limit);
1781
- if (!within(content.metadata, profile.roots, pending.folders)) {
1810
+ const listed = query?.mode === "include" && (pending.matched?.includes(job.id) ?? query.matches(content.metadata));
1811
+ if (!listed && !inScope(content.metadata, profile.roots, pending.folders, /* @__PURE__ */ new Set(), query)) {
1782
1812
  await index.remove(profile.principal, job.id);
1783
1813
  statePort.removeSnapshot(job.id);
1784
1814
  delete state.documents[job.id];
@@ -1839,6 +1869,10 @@ var syncDocuments = /* @__PURE__ */ __name(async (options) => {
1839
1869
  state.cursor = pending.cursor;
1840
1870
  state.scope = pending.scope;
1841
1871
  state.folders = pending.folders;
1872
+ if (pending.matched)
1873
+ state.matched = pending.matched;
1874
+ else
1875
+ delete state.matched;
1842
1876
  delete state.pending;
1843
1877
  state.lastSync = new Date(now()).toISOString();
1844
1878
  statePort.save(state);
@@ -1850,6 +1884,40 @@ var syncDocuments = /* @__PURE__ */ __name(async (options) => {
1850
1884
  }
1851
1885
  }, "syncDocuments");
1852
1886
 
1887
+ // dist/model.js
1888
+ var FOLDER = "application/vnd.google-apps.folder";
1889
+ var DOC = "application/vnd.google-apps.document";
1890
+ var SHEET = "application/vnd.google-apps.spreadsheet";
1891
+ var metadataJson = /* @__PURE__ */ __name(({ modifiedAt, canDownload, createdAt, driveId, lastModifiedBy, providerMetadata, ...rest }) => ({
1892
+ ...rest,
1893
+ ...providerMetadata === void 0 ? {} : { provider_metadata: providerMetadata },
1894
+ ...modifiedAt === void 0 ? {} : { modified_at: modifiedAt },
1895
+ can_download: canDownload,
1896
+ ...createdAt === void 0 ? {} : { created_at: createdAt },
1897
+ ...driveId === void 0 ? {} : { drive_id: driveId },
1898
+ ...lastModifiedBy === void 0 ? {} : { last_modified_by: lastModifiedBy }
1899
+ }), "metadataJson");
1900
+ var DOCUMENT_LIST_FIELDS = Object.keys({
1901
+ id: true,
1902
+ name: true,
1903
+ mime: true,
1904
+ parents: true,
1905
+ version: true,
1906
+ url: true,
1907
+ trashed: true,
1908
+ size: true,
1909
+ description: true,
1910
+ owners: true,
1911
+ provider_metadata: true,
1912
+ modified_at: true,
1913
+ can_download: true,
1914
+ created_at: true,
1915
+ drive_id: true,
1916
+ last_modified_by: true,
1917
+ reference: true,
1918
+ tabs: true
1919
+ });
1920
+
1853
1921
  export {
1854
1922
  normalizeInlines,
1855
1923
  blockKey,
@@ -1867,5 +1935,10 @@ export {
1867
1935
  watchMirrors,
1868
1936
  extractDocumentMemories,
1869
1937
  catalogFiles,
1870
- syncDocuments
1938
+ syncDocuments,
1939
+ FOLDER,
1940
+ DOC,
1941
+ SHEET,
1942
+ metadataJson,
1943
+ DOCUMENT_LIST_FIELDS
1871
1944
  };
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
8
8
  var CONTROL = (
9
9
  // biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
10
10
  /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu