@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
@@ -2,15 +2,15 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  wirecatDirectory
5
- } from "./chunk-KEXTTZJM.js";
5
+ } from "./chunk-FNWIJ6EJ.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/models.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/models.js
14
14
  var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/csukuangfj/${repository}/resolve/${commit}/${name}`, "huggingFace");
15
15
  var gigaam = huggingFace("sherpa-onnx-nemo-transducer-punct-giga-am-v3-russian-2025-12-16", "a6039be7cee829a9044a69ac0ebaf1c191217c97");
16
16
  var gigaamCtc = huggingFace("sherpa-onnx-nemo-ctc-punct-giga-am-v3-russian-2025-12-16", "4fb5407ff028a69fec516cdf4c10fac9ddea7c16");
@@ -137,7 +137,7 @@ var speechModel = /* @__PURE__ */ __name((id) => {
137
137
  return model;
138
138
  }, "speechModel");
139
139
 
140
- // 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/install.js
140
+ // 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/install.js
141
141
  import { createHash, randomUUID } from "node:crypto";
142
142
  import { createReadStream, createWriteStream, mkdirSync, statSync } from "node:fs";
143
143
  import { rename, rm } from "node:fs/promises";
@@ -175,11 +175,12 @@ var sizeOf = /* @__PURE__ */ __name((path) => {
175
175
  }
176
176
  }, "sizeOf");
177
177
  var installedBytes = /* @__PURE__ */ __name((model) => model.files.reduce((sum, file) => sum + file.bytes, 0), "installedBytes");
178
- var install = /* @__PURE__ */ __name(async (model, directory, { fetch: get = fetch, progress, verifyExisting } = {}) => {
178
+ var install = /* @__PURE__ */ __name(async (model, directory, { fetch: get = fetch, progress, bytes, verifyExisting } = {}) => {
179
179
  mkdirSync(join(directory, model.id), { recursive: true, mode: 448 });
180
- await installFiles(placed(model, directory), { fetch: get, progress, verifyExisting });
180
+ await installFiles(placed(model, directory), { fetch: get, progress, bytes, verifyExisting });
181
181
  }, "install");
182
- var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, progress, verifyExisting } = {}) => {
182
+ var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, progress, bytes = /* @__PURE__ */ __name(() => {
183
+ }, "bytes"), verifyExisting } = {}) => {
183
184
  if (verifyExisting)
184
185
  for (const [file, path] of files) {
185
186
  if (sizeOf(path) !== void 0) {
@@ -192,18 +193,24 @@ var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, pr
192
193
  }
193
194
  }
194
195
  }
195
- for (const [file, path] of files) {
196
- if (sizeOf(path) === file.bytes)
197
- continue;
196
+ const total = files.reduce((sum, [file]) => sum + file.bytes, 0);
197
+ const missing = files.filter(([file, path]) => sizeOf(path) !== file.bytes);
198
+ let done = total - missing.reduce((sum, [file]) => sum + file.bytes, 0);
199
+ bytes(done, total);
200
+ for (const [file, path] of missing) {
198
201
  mkdirSync(dirname(path), { recursive: true, mode: 448 });
199
202
  progress?.(`downloading ${file.name} (${megabytes(file.bytes)})`);
200
- await fetchVerified(file, path, get);
203
+ const before = done;
204
+ await fetchVerified(file, path, get, (received) => {
205
+ done = before + received;
206
+ bytes(done, total);
207
+ });
201
208
  }
202
209
  }, "installFiles");
203
- var fetchVerified = /* @__PURE__ */ __name(async (file, path, get) => {
210
+ var fetchVerified = /* @__PURE__ */ __name(async (file, path, get, received) => {
204
211
  const stalled = watchdog(STALL_MS);
205
212
  try {
206
- await fetchInto(file, path, get, stalled);
213
+ await fetchInto(file, path, get, stalled, received);
207
214
  } catch (error) {
208
215
  if (stalled.signal.aborted) {
209
216
  throw new CliError("timeout", `${file.name} stopped downloading for ${STALL_MS / 1e3} s \u2014 nothing was installed`);
@@ -213,7 +220,7 @@ var fetchVerified = /* @__PURE__ */ __name(async (file, path, get) => {
213
220
  stalled.stop();
214
221
  }
215
222
  }, "fetchVerified");
216
- var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled) => {
223
+ var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled, received) => {
217
224
  const response = await get(file.url, { signal: stalled.signal });
218
225
  if (!response.ok || !response.body) {
219
226
  await response.body?.cancel();
@@ -231,6 +238,7 @@ var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled) => {
231
238
  return;
232
239
  }
233
240
  hash.update(chunk);
241
+ received(bytes);
234
242
  done(null, chunk);
235
243
  }
236
244
  });
@@ -3,26 +3,26 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  executableEnvironment,
5
5
  executableOnPath
6
- } from "./chunk-ZYCLPJ7U.js";
6
+ } from "./chunk-ZMOUUOT2.js";
7
7
  import {
8
8
  require_cross_spawn
9
9
  } from "./chunk-D72URWJE.js";
10
10
  import {
11
11
  loadConfigFile,
12
12
  saveConfigFile
13
- } from "./chunk-246P2DCT.js";
13
+ } from "./chunk-OD4U7GUY.js";
14
14
  import {
15
15
  number,
16
16
  object,
17
17
  optional,
18
18
  string
19
- } from "./chunk-TKW4QWCY.js";
19
+ } from "./chunk-FEZF3TII.js";
20
20
  import {
21
21
  __name,
22
22
  __toESM
23
23
  } from "./chunk-ZVVMGPBJ.js";
24
24
 
25
- // node_modules/.pnpm/@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/update/index.js
25
+ // 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/update/index.js
26
26
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
27
27
  import { existsSync } from "node:fs";
28
28
  var updateCommand = /* @__PURE__ */ __name((installer, packageName) => {
@@ -0,0 +1,415 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ operations,
5
+ privateFiles
6
+ } from "./chunk-HCNQT3QE.js";
7
+ import {
8
+ commandPathKey,
9
+ commandPermissions
10
+ } from "./chunk-EW7PKB4M.js";
11
+ import {
12
+ AI_ENTRIES,
13
+ checkConfigText,
14
+ issueMessage,
15
+ settingsFor,
16
+ usableProfileName,
17
+ withSettingDefaults
18
+ } from "./chunk-PEQA6LA5.js";
19
+ import {
20
+ LEVELS
21
+ } from "./chunk-VAYB52HF.js";
22
+ import {
23
+ MAX_TEXT_CHARS
24
+ } from "./chunk-UOXOLGNG.js";
25
+ import {
26
+ DRIVE_APP
27
+ } from "./chunk-4SIZEJ3M.js";
28
+ import {
29
+ BASE_CONSTANTS,
30
+ baseConstantsSchema,
31
+ loadConstants,
32
+ resolvePaths,
33
+ saveConfigFile
34
+ } from "./chunk-OD4U7GUY.js";
35
+ import {
36
+ array,
37
+ boolean,
38
+ integer,
39
+ literal,
40
+ maxValue,
41
+ minLength,
42
+ minValue,
43
+ nonEmpty,
44
+ number,
45
+ object,
46
+ optional,
47
+ parse,
48
+ picklist,
49
+ pipe,
50
+ record,
51
+ regex,
52
+ strictObject,
53
+ string,
54
+ transform,
55
+ trim,
56
+ union
57
+ } from "./chunk-FEZF3TII.js";
58
+ import {
59
+ CliError
60
+ } from "./chunk-4OSSOWDM.js";
61
+ import {
62
+ __name
63
+ } from "./chunk-ZVVMGPBJ.js";
64
+
65
+ // 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/oauth/client-file.js
66
+ import { readFileSync } from "node:fs";
67
+ var readClientFile = /* @__PURE__ */ __name((location, options = {}) => {
68
+ if (!options.shipped && typeof location === "string") {
69
+ const mode = privateFiles({ files: [location], dirs: [] }, options.platform);
70
+ if (mode.checked && !mode.ok)
71
+ throw new CliError("configuration_error", `the client file can be read by other users of this computer; run chmod 600 ${location} and try again`, { reason: "sign-in.client-file-open" });
72
+ }
73
+ try {
74
+ const { installed } = JSON.parse(readFileSync(location, "utf8"));
75
+ const { client_id: clientId, client_secret: clientSecret } = installed;
76
+ if (typeof clientId !== "string" || !clientId)
77
+ throw new TypeError("client_id");
78
+ if (clientSecret !== void 0 && typeof clientSecret !== "string")
79
+ throw new TypeError("client_secret");
80
+ return { clientId, ...clientSecret ? { clientSecret } : {} };
81
+ } catch {
82
+ throw options.invalid ?? new CliError("configuration_error", "could not read a Desktop app OAuth client JSON from the client file; its contents were not logged", { reason: "sign-in.client-file-invalid" });
83
+ }
84
+ }, "readClientFile");
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/constants/obscure.js
87
+ import { createDecipheriv } from "node:crypto";
88
+ var KEY = Buffer.from("d43012779aa2dded3e98092a3dbcf5d8980c564172f5ce0a5fd0574e5f740339", "hex");
89
+ var reveal = /* @__PURE__ */ __name((obscured) => {
90
+ const bytes = Buffer.from(obscured, "base64url");
91
+ const decipher = createDecipheriv("aes-256-ctr", KEY, bytes.subarray(0, 16));
92
+ return Buffer.concat([decipher.update(bytes.subarray(16)), decipher.final()]).toString("utf8");
93
+ }, "reveal");
94
+
95
+ // 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/constants/index.js
96
+ var CORE_CONSTANTS = new URL("../../constants.json", new URL("constants/index.js", import.meta.resolve("@wirecat/cli-core")).href);
97
+ var constantsSchema = object({
98
+ ...baseConstantsSchema.entries,
99
+ google: object({
100
+ app: object({
101
+ client_id: pipe(string(), nonEmpty(), transform(reveal)),
102
+ client_secret: optional(pipe(string(), transform(reveal)))
103
+ })
104
+ }),
105
+ microsoft: object({ app: object({ client_id: pipe(string(), nonEmpty()) }) })
106
+ });
107
+ var loaded = /* @__PURE__ */ new Map();
108
+ var constants = /* @__PURE__ */ __name((toolLayer, schema) => {
109
+ const key = toolLayer?.href ?? "";
110
+ if (!loaded.has(key)) {
111
+ const layers = toolLayer ? [BASE_CONSTANTS, CORE_CONSTANTS, toolLayer] : [BASE_CONSTANTS, CORE_CONSTANTS];
112
+ loaded.set(key, loadConstants(layers, schema ?? constantsSchema));
113
+ }
114
+ return loaded.get(key);
115
+ }, "constants");
116
+ var oauthApp = /* @__PURE__ */ __name((options) => {
117
+ const { env, prefix, provider } = options;
118
+ const name = `${prefix}_${provider.toUpperCase()}_CLIENT`;
119
+ const clientSecret = env[`${name}_SECRET`];
120
+ const own = [
121
+ [options.clientId, "flag"],
122
+ [env[`${name}_ID`], "env"],
123
+ [options.configClientId, "config"]
124
+ ];
125
+ const [clientId, source] = own.find(([id]) => id) ?? [];
126
+ if (clientId && source)
127
+ return app({ clientId, ...clientSecret ? { clientSecret } : {} }, source);
128
+ if (clientSecret)
129
+ throw new CliError("configuration_error", `${name}_SECRET is set without a client id; set ${name}_ID too, or unset it to use WireCat's app`, { reason: "sign-in.secret-without-id" });
130
+ const wirecat = options.wirecat;
131
+ if (!wirecat?.client_id)
132
+ return void 0;
133
+ return app({ clientId: wirecat.client_id, ...wirecat.client_secret ? { clientSecret: wirecat.client_secret } : {} }, "constants");
134
+ }, "oauthApp");
135
+ var app = /* @__PURE__ */ __name((client, source) => ({ client: { ...client, source }, source }), "app");
136
+ var googleApp = /* @__PURE__ */ __name((options) => {
137
+ const { clientFile, platform } = options;
138
+ if (clientFile)
139
+ return app(readClientFile(clientFile, platform ? { platform } : {}), "flag");
140
+ const wirecat = (options.constants ?? constants()).google.app;
141
+ return oauthApp({ ...options, provider: "google", wirecat });
142
+ }, "googleApp");
143
+ var oauthClientReport = /* @__PURE__ */ __name((app2, reason) => app2?.source ? { client: app2.source === "constants" ? "wirecat" : "own", source: app2.source } : { client: null, source: null, ...reason ? { reason } : {} }, "oauthClientReport");
144
+
145
+ // dist/policy-keys.js
146
+ var permissionKeys = /* @__PURE__ */ __name((paths2) => {
147
+ const keys = /* @__PURE__ */ new Set([
148
+ "mcp.authority",
149
+ "mcp",
150
+ "sheets.create",
151
+ "sheets.rename",
152
+ "sheets.insert",
153
+ "sheets.format",
154
+ "sheets.update"
155
+ ]);
156
+ for (const path of paths2)
157
+ keys.add(path.join("."));
158
+ for (const operation of operations)
159
+ for (const key of methodPolicyKeys(operation.id))
160
+ keys.add(key);
161
+ return keys;
162
+ }, "permissionKeys");
163
+ var permissionNames = /* @__PURE__ */ __name((keys) => {
164
+ const names = /* @__PURE__ */ new Set();
165
+ for (const key of keys) {
166
+ const parts = key.split(".");
167
+ for (let end = 1; end <= parts.length; end++)
168
+ names.add(parts.slice(0, end).join("."));
169
+ }
170
+ return names;
171
+ }, "permissionNames");
172
+ var DEFAULT_LEVELS = {
173
+ "mcp.authority": "deny",
174
+ ...Object.fromEntries(operations.filter((op) => op.effect === "destructive").map((op) => [`api.${op.id}`, "ask"]))
175
+ };
176
+ var methodPolicyKeys = /* @__PURE__ */ __name((method, body) => {
177
+ const parts = method.split(".");
178
+ const verb = parts.at(-1);
179
+ const alias = method.startsWith("drive.files.") ? `files.${verb}` : method.startsWith("docs.documents.") ? `documents.${verb === "batchUpdate" ? "update" : verb}` : method.startsWith("sheets.spreadsheets.") ? `sheets.${method === "sheets.spreadsheets.get" ? "info" : method === "sheets.spreadsheets.values.get" ? "show" : verb === "append" ? "add" : verb}` : method === "driveactivity.activity.query" ? "documents.history" : method.startsWith("drive.") ? `${parts[1]}.${verb}` : void 0;
180
+ const keys = [`api.${method}`, ...alias ? [alias] : []];
181
+ if (method === "drive.replies.create" && body)
182
+ keys.push(body.action === "resolve" ? "comments.resolve" : body.action === "reopen" ? "comments.reopen" : "comments.reply");
183
+ if (method === "drive.replies.create" && body?.content !== void 0)
184
+ keys.push("comments.reply");
185
+ if (method === "sheets.spreadsheets.batchUpdate" && Array.isArray(body?.requests)) {
186
+ const object2 = /* @__PURE__ */ __name((value) => !!value && typeof value === "object" && !Array.isArray(value), "object");
187
+ for (const request of body.requests) {
188
+ if (!object2(request))
189
+ continue;
190
+ if (request.addSheet || request.duplicateSheet)
191
+ keys.push("sheets.create");
192
+ if (object2(request.updateSheetProperties)) {
193
+ const update = request.updateSheetProperties;
194
+ if (object2(update.properties) && update.properties.title !== void 0 || String(update.fields).split(",").some((field) => field.trim() === "title" || field.trim() === "*"))
195
+ keys.push("sheets.rename");
196
+ if (object2(update.properties) && update.properties.gridProperties)
197
+ keys.push("sheets.insert");
198
+ }
199
+ if (request.insertDimension || request.appendDimension || request.insertRange)
200
+ keys.push("sheets.insert");
201
+ if (request.repeatCell || request.updateCells || request.appendCells || request.updateBorders || request.addConditionalFormatRule || request.updateConditionalFormatRule || request.deleteConditionalFormatRule || request.addBanding || request.updateBanding || request.deleteBanding)
202
+ keys.push("sheets.format");
203
+ if (request.updateCells || request.appendCells || request.findReplace || request.pasteData || request.copyPaste || request.cutPaste || request.autoFill)
204
+ keys.push("sheets.update");
205
+ if (request.pasteData || request.copyPaste || request.cutPaste || request.autoFill)
206
+ keys.push("sheets.format");
207
+ if (object2(request.repeatCell) && (String(request.repeatCell.fields).split(",").some((field) => field.trim() === "*" || field.includes("userEnteredValue")) || object2(request.repeatCell.cell) && request.repeatCell.cell.userEnteredValue !== void 0))
208
+ keys.push("sheets.update");
209
+ }
210
+ }
211
+ return [...new Set(keys)];
212
+ }, "methodPolicyKeys");
213
+
214
+ // dist/config.js
215
+ import { readFileSync as readFileSync2 } from "node:fs";
216
+ import { join } from "node:path";
217
+ var Common = {
218
+ ...AI_ENTRIES,
219
+ permissions: optional(record(string(), picklist(LEVELS))),
220
+ max_text_chars: optional(pipe(number(), integer(), minValue(1), maxValue(MAX_TEXT_CHARS))),
221
+ google_client_id: optional(pipe(string(), trim(), minLength(1)))
222
+ };
223
+ var RunSettings = {
224
+ record: optional(boolean()),
225
+ keep_runs_for_days: optional(pipe(number(), integer(), minValue(1))),
226
+ keep_successful_runs_for_days: optional(pipe(number(), integer(), minValue(1))),
227
+ runs_size_limit_mb: optional(pipe(number(), integer(), minValue(1))),
228
+ record_input: optional(union([boolean(), literal("failed")]))
229
+ };
230
+ var SharedDefaults = {
231
+ limit: optional(pipe(number(), integer(), minValue(1))),
232
+ sends_per_hour: optional(pipe(number(), integer(), minValue(0))),
233
+ update_check: optional(boolean()),
234
+ skill_hint: optional(boolean())
235
+ };
236
+ var DEFAULTS_ONLY = /* @__PURE__ */ new Set([...Object.keys(RunSettings), "update_check", "skill_hint"]);
237
+ var SETTING_NAMES = /* @__PURE__ */ new Set([...Object.keys(Common), "picture_search", ...DEFAULTS_ONLY]);
238
+ var Mirror = strictObject({
239
+ id: pipe(string(), regex(/^[a-z0-9-]{1,40}$/)),
240
+ path: pipe(string(), minLength(1)),
241
+ folder: pipe(string(), regex(/^[A-Za-z0-9_-]{1,200}$/))
242
+ });
243
+ var Profile = strictObject({
244
+ principal: string(),
245
+ roots: optional(array(pipe(string(), regex(/^[A-Za-z0-9_-]{1,200}$/))), []),
246
+ mirrors: optional(array(Mirror)),
247
+ storage: picklist(["keyring", "file"]),
248
+ picture_search: optional(boolean()),
249
+ ...Common
250
+ });
251
+ var ConfigSchema = strictObject({
252
+ profiles: optional(record(string(), Profile), {}),
253
+ defaults: optional(strictObject({ ...Common, ...RunSettings, ...SharedDefaults }))
254
+ });
255
+ var keyOf = /* @__PURE__ */ __name((path) => {
256
+ if (path[0] !== "api" || path[1] === void 0)
257
+ return commandPathKey(path);
258
+ if (["call", "list", "show"].includes(path[1]))
259
+ return null;
260
+ const operation = operations.find((one) => one.command === path[1]);
261
+ return operation ? `api.${operation.id}` : commandPathKey(path);
262
+ }, "keyOf");
263
+ var configuration = settingsFor(DRIVE_APP, {
264
+ configRepair: false,
265
+ // drive's own schema decides what the file may hold, so `doctor` names a profile that lacks its principal.
266
+ schema: ConfigSchema,
267
+ profile: {
268
+ principal: optional(string()),
269
+ roots: optional(array(pipe(string(), regex(/^[A-Za-z0-9_-]{1,200}$/)))),
270
+ mirrors: optional(array(Mirror)),
271
+ storage: optional(picklist(["keyring", "file"])),
272
+ max_text_chars: Common.max_text_chars,
273
+ google_client_id: Common.google_client_id
274
+ },
275
+ settings: [
276
+ {
277
+ key: "max_text_chars",
278
+ default: MAX_TEXT_CHARS,
279
+ description: "the most characters of text one file may have to be imported"
280
+ }
281
+ ],
282
+ permissions: commandPermissions({ keyOf, extra: [...permissionKeys([])], defaults: DEFAULT_LEVELS })
283
+ });
284
+ var paths = /* @__PURE__ */ __name((env) => resolvePaths({ appName: "drive-cli", prefix: "DRIVE", env }), "paths");
285
+ var configPath = /* @__PURE__ */ __name((env) => join(paths(env).config, "config.json"), "configPath");
286
+ var TOOL = "drive";
287
+ var isNode = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isNode");
288
+ var withoutIncomplete = /* @__PURE__ */ __name((raw, issues) => {
289
+ const incomplete = new Set(issues.flatMap((issue) => issue.kind === "missing_setting" && issue.profile ? [issue.profile] : []));
290
+ if (!incomplete.size || !isNode(raw) || !isNode(raw.profiles))
291
+ return void 0;
292
+ return {
293
+ ...raw,
294
+ profiles: Object.fromEntries(Object.entries(raw.profiles).filter(([name]) => !incomplete.has(name)))
295
+ };
296
+ }, "withoutIncomplete");
297
+ var examine = /* @__PURE__ */ __name((text, file, knownPermissions) => {
298
+ const check = /* @__PURE__ */ __name((body) => checkConfigText(body, {
299
+ file,
300
+ tool: TOOL,
301
+ schema: ConfigSchema,
302
+ repair: false,
303
+ ...knownPermissions ? { knownPermissions } : {}
304
+ }), "check");
305
+ const first = check(text);
306
+ if (first.issues.some((issue) => issue.kind === "invalid_json"))
307
+ return { raw: {}, config: { profiles: {} }, issues: first.issues };
308
+ const raw = JSON.parse(text);
309
+ if (first.config)
310
+ return { raw, config: first.config, issues: first.issues };
311
+ const rest = withoutIncomplete(raw, first.issues);
312
+ const second = rest && check(JSON.stringify(rest));
313
+ return {
314
+ raw,
315
+ config: second?.config ?? { profiles: {} },
316
+ // Saved permissions are checked only in what loads, and the first pass loaded nothing.
317
+ issues: [...first.issues, ...(second?.issues ?? []).filter((issue) => issue.kind === "unknown_permission")]
318
+ };
319
+ }, "examine");
320
+ var inspectConfig = /* @__PURE__ */ __name((env, knownPermissions) => {
321
+ const path = configPath(env);
322
+ let text;
323
+ try {
324
+ text = readFileSync2(path, "utf8");
325
+ } catch {
326
+ return { path, found: false, raw: {}, config: { profiles: {} }, issues: [] };
327
+ }
328
+ return { path, found: true, ...examine(text, path, knownPermissions) };
329
+ }, "inspectConfig");
330
+ var configIssues = /* @__PURE__ */ __name((raw, file, knownPermissions) => examine(JSON.stringify(raw), file, knownPermissions).issues, "configIssues");
331
+ var refusal = /* @__PURE__ */ __name((issues) => new CliError("configuration_error", issueMessage(issues)), "refusal");
332
+ var readConfig = /* @__PURE__ */ __name((env, knownPermissions) => {
333
+ const { config, issues } = inspectConfig(env, knownPermissions);
334
+ if (issues.length)
335
+ throw refusal(issues);
336
+ return config;
337
+ }, "readConfig");
338
+ var writeConfig = /* @__PURE__ */ __name((env, config) => {
339
+ const [issue] = configIssues(config, "drive settings");
340
+ if (issue)
341
+ throw new CliError("configuration_error", `drive settings: ${issue.profile === void 0 ? "" : `profile ${issue.profile}: `}${issue.what}`);
342
+ saveConfigFile(configPath(env), withDefaults(parse(ConfigSchema, config)));
343
+ }, "writeConfig");
344
+ var withDefaults = /* @__PURE__ */ __name((raw, except = []) => withSettingDefaults(isNode(raw) && !Object.hasOwn(raw, "defaults") ? { ...raw, defaults: {} } : raw, configuration.declaredSettings.filter(({ key }) => !except.includes(key))).config, "withDefaults");
345
+ var profileName = usableProfileName;
346
+ var fileId = /* @__PURE__ */ __name((input) => {
347
+ let id = input;
348
+ if (input.startsWith("https://")) {
349
+ const url = new URL(input);
350
+ if (url.hostname !== "drive.google.com" && url.hostname !== "docs.google.com")
351
+ throw new CliError("validation_error", "use a Google Drive/Docs URL or file ID");
352
+ id = url.pathname.match(/\/(?:folders|d)\/([^/]+)/)?.[1] ?? "";
353
+ }
354
+ if (!/^[A-Za-z0-9_-]{1,200}$/.test(id))
355
+ throw new CliError("validation_error", "invalid Google file ID");
356
+ return id;
357
+ }, "fileId");
358
+ var unknownProfile = /* @__PURE__ */ __name((name, profiles) => new CliError("validation_error", profiles.length ? `no profile ${name} here \u2014 profiles here: ${profiles.join(", ")}; a new one signs in with drive ${name} session start` : `no profiles here yet; create one with drive ${name} session start`, { reason: "profile.unknown", profiles }), "unknownProfile");
359
+ var activeProfile = /* @__PURE__ */ __name((env, name) => {
360
+ const config = readConfig(env);
361
+ const profile = config.profiles[profileName(name)];
362
+ if (!profile)
363
+ throw unknownProfile(name, Object.keys(config.profiles).sort());
364
+ return profile;
365
+ }, "activeProfile");
366
+ var checkTextLimit = /* @__PURE__ */ __name((value) => {
367
+ if (typeof value !== "number" || !Number.isInteger(value) || value < 1)
368
+ throw new CliError("validation_error", "max_text_chars must be a positive whole number of characters");
369
+ if (value > MAX_TEXT_CHARS)
370
+ throw new CliError("validation_error", `max_text_chars can be at most ${MAX_TEXT_CHARS}: the document readers return at most that many characters`);
371
+ return value;
372
+ }, "checkTextLimit");
373
+ var textLimit = /* @__PURE__ */ __name((env, name) => activeProfile(env, name).max_text_chars ?? readConfig(env).defaults?.max_text_chars ?? MAX_TEXT_CHARS, "textLimit");
374
+ var pictureSearch = /* @__PURE__ */ __name((env, name) => activeProfile(env, name).picture_search ?? false, "pictureSearch");
375
+ var googleAppOf = /* @__PURE__ */ __name((env, { file, clientId, profile } = {}) => {
376
+ const own = file || clientId || env.DRIVE_GOOGLE_CLIENT_ID;
377
+ const config = own ? void 0 : readConfig(env);
378
+ const configClientId = (profile === void 0 ? void 0 : config?.profiles[profileName(profile)]?.google_client_id) ?? config?.defaults?.google_client_id;
379
+ return googleApp({ env, prefix: "DRIVE", clientFile: file, clientId, configClientId });
380
+ }, "googleAppOf");
381
+ var application = /* @__PURE__ */ __name((env, choice = {}) => googleAppOf(env, choice).client, "application");
382
+ var selectedFolders = /* @__PURE__ */ __name((env, profile, filter = {}) => activeProfile(env, profile).roots.flatMap((id) => filter.id === void 0 || id === filter.id ? [{ id }] : []), "selectedFolders");
383
+ var configuredMirrors = /* @__PURE__ */ __name((env, profile, filter = {}) => (activeProfile(env, profile).mirrors ?? []).filter((row) => Object.entries(filter).every(([key, value]) => row[key] === value)), "configuredMirrors");
384
+ var configuredSessions = /* @__PURE__ */ __name((env, filter, knownPermissions) => Object.entries(readConfig(env, knownPermissions).profiles).flatMap(([name, row]) => (filter.profile === void 0 || filter.profile === name) && (filter.storage === void 0 || filter.storage === row.storage) ? [{ profile: name, selected_folders: row.roots.length, storage: row.storage }] : []), "configuredSessions");
385
+
386
+ export {
387
+ oauthClientReport,
388
+ permissionKeys,
389
+ permissionNames,
390
+ DEFAULT_LEVELS,
391
+ methodPolicyKeys,
392
+ DEFAULTS_ONLY,
393
+ SETTING_NAMES,
394
+ configuration,
395
+ paths,
396
+ configPath,
397
+ inspectConfig,
398
+ configIssues,
399
+ refusal,
400
+ readConfig,
401
+ writeConfig,
402
+ withDefaults,
403
+ profileName,
404
+ fileId,
405
+ unknownProfile,
406
+ activeProfile,
407
+ checkTextLimit,
408
+ textLimit,
409
+ pictureSearch,
410
+ googleAppOf,
411
+ application,
412
+ selectedFolders,
413
+ configuredMirrors,
414
+ configuredSessions
415
+ };