@wirecat/drive-cli 0.61.0 → 0.63.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 (152) hide show
  1. package/dist/bin/drive.js +2 -2
  2. package/dist/browse.d.ts +20 -0
  3. package/dist/browse.d.ts.map +1 -0
  4. package/dist/browse.js +146 -0
  5. package/dist/browse.js.map +1 -0
  6. package/dist/bundle/{all-profiles-H4L3Z5UM.js → all-profiles-GZJS3UKC.js} +13 -14
  7. package/dist/bundle/{anthropic-PPGFISVP.js → anthropic-RGV3WXX5.js} +9 -9
  8. package/dist/bundle/{app-server-YXVK2FUZ.js → app-server-AA2PJ7PV.js} +57 -55
  9. package/dist/bundle/{bun-DKZAL6ML.js → bun-OXZYIA3R.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-MTZY36QK.js → bun-sqlite-D45NSDM3.js} +8 -8
  11. package/dist/bundle/{chunk-KV4267S4.js → chunk-27YUUGXQ.js} +1 -1
  12. package/dist/bundle/{chunk-6IBM4Z3V.js → chunk-2HF2MRXI.js} +1 -1
  13. package/dist/bundle/{chunk-HGOYQUT7.js → chunk-2NIC72HH.js} +4 -2
  14. package/dist/bundle/{chunk-XZBR2O63.js → chunk-2TDUGC5D.js} +1501 -781
  15. package/dist/bundle/{chunk-DEPMQHXQ.js → chunk-2TFXK3R4.js} +4 -4
  16. package/dist/bundle/{chunk-JVBLXSAA.js → chunk-33MGFUED.js} +652 -249
  17. package/dist/bundle/{chunk-S4YK6TTG.js → chunk-3BZRKLJ6.js} +13 -13
  18. package/dist/bundle/{chunk-6SUGANRJ.js → chunk-3HK5WMI5.js} +6 -6
  19. package/dist/bundle/{chunk-YWIU4HOT.js → chunk-3QINVLZI.js} +1 -1
  20. package/dist/bundle/{chunk-XYCCGGKN.js → chunk-44SBK6KB.js} +1207 -643
  21. package/dist/bundle/{chunk-LARQTWIL.js → chunk-4CIZWCXV.js} +1 -1
  22. package/dist/bundle/{chunk-WZ5XK74U.js → chunk-4OSSOWDM.js} +1 -1
  23. package/dist/bundle/{chunk-XGNC5OJG.js → chunk-4S4JMW6I.js} +1 -1
  24. package/dist/bundle/{chunk-WIU733D2.js → chunk-534OBX5Y.js} +1 -1
  25. package/dist/bundle/{chunk-UO2IUDVK.js → chunk-5PPL7JDM.js} +2 -2
  26. package/dist/bundle/{chunk-OFFA54TW.js → chunk-6EY46GAN.js} +2 -2
  27. package/dist/bundle/{chunk-RFRCOAWS.js → chunk-6KQJSFYF.js} +22 -22
  28. package/dist/bundle/{chunk-6DN4VPA7.js → chunk-6MQSQ4LX.js} +33 -31
  29. package/dist/bundle/{chunk-NIX2MWHZ.js → chunk-7EMQ26BA.js} +39 -25
  30. package/dist/bundle/{chunk-X2CXW4HM.js → chunk-ABYGSJZ4.js} +7 -7
  31. package/dist/bundle/{chunk-I26VL4W7.js → chunk-AEX37ETW.js} +2 -2
  32. package/dist/bundle/{chunk-36CWGEVX.js → chunk-BKYMKVHT.js} +2 -2
  33. package/dist/bundle/{chunk-3WZH3WV3.js → chunk-CE2TJBLP.js} +3 -3
  34. package/dist/bundle/{chunk-YMBFZA3H.js → chunk-DJ3SDJZY.js} +8 -8
  35. package/dist/bundle/{chunk-DXPOVLQC.js → chunk-DJHLVUL6.js} +227 -90
  36. package/dist/bundle/{chunk-VPDAH7PJ.js → chunk-E4SDKMBJ.js} +59 -1
  37. package/dist/bundle/{chunk-NZ2EIZLX.js → chunk-EOOGWUTP.js} +10 -10
  38. package/dist/bundle/{chunk-VYXVPYA3.js → chunk-FEZF3TII.js} +6 -6
  39. package/dist/bundle/{chunk-Q4XVBKX4.js → chunk-FRIJUILO.js} +3 -3
  40. package/dist/bundle/{chunk-OLPJRD4S.js → chunk-FUITWY7O.js} +1 -1
  41. package/dist/bundle/{chunk-AM4RIWOZ.js → chunk-HZZCEQTH.js} +18 -4
  42. package/dist/bundle/{chunk-2RJA4BQB.js → chunk-J24ZFCWM.js} +39 -26
  43. package/dist/bundle/{chunk-QSGT4ZH4.js → chunk-J4DIHPZ6.js} +1 -1
  44. package/dist/bundle/{chunk-ZHYRHERD.js → chunk-L37LMMRJ.js} +2 -2
  45. package/dist/bundle/{chunk-XLFJLZJL.js → chunk-LMAVCYLQ.js} +22 -14
  46. package/dist/bundle/{chunk-E6J5YH2N.js → chunk-LZEOQW7S.js} +36 -36
  47. package/dist/bundle/{chunk-FE5JJXKA.js → chunk-MOTRI3SY.js} +2 -2
  48. package/dist/bundle/{chunk-PJTX2MOI.js → chunk-ND6LLYGF.js} +98 -81
  49. package/dist/bundle/{chunk-3I2D5TK2.js → chunk-NEFSGCVA.js} +10 -10
  50. package/dist/bundle/{chunk-OGNOQDWB.js → chunk-O2XOX4HB.js} +34 -10
  51. package/dist/bundle/{chunk-DCBFNBEB.js → chunk-OD4U7GUY.js} +20 -20
  52. package/dist/bundle/{chunk-BXR7BKM3.js → chunk-OTROVC4E.js} +1 -1
  53. package/dist/bundle/{chunk-UKOYQC5O.js → chunk-OXY6SSZG.js} +184 -29
  54. package/dist/bundle/{chunk-ZMNYK3FC.js → chunk-PDCCYHCH.js} +5 -5
  55. package/dist/bundle/{chunk-J5UDQD5S.js → chunk-PO5RQQIG.js} +5 -5
  56. package/dist/bundle/{chunk-PY7LKNOS.js → chunk-Q5DJTRKV.js} +2 -2
  57. package/dist/bundle/{chunk-E5EXJ2XS.js → chunk-QCKZ3GAA.js} +4 -4
  58. package/dist/bundle/{chunk-3SJQNS72.js → chunk-RKELRWH7.js} +5 -5
  59. package/dist/bundle/{chunk-6Y2FWJZ4.js → chunk-S4RXABDR.js} +3 -3
  60. package/dist/bundle/{chunk-BQMIDYBA.js → chunk-SXM6MHRR.js} +12 -12
  61. package/dist/bundle/chunk-TF23BZW5.js +64 -0
  62. package/dist/bundle/{chunk-N2RLJTIW.js → chunk-TWUH22Z5.js} +4 -4
  63. package/dist/bundle/chunk-UPOSDTPT.js +87 -0
  64. package/dist/bundle/{chunk-J4HQVHMN.js → chunk-UQLWMGSD.js} +5 -5
  65. package/dist/bundle/{chunk-K7LS3NGM.js → chunk-V3NVXIQR.js} +736 -230
  66. package/dist/bundle/{chunk-TKGAYKXW.js → chunk-VAUMOZU5.js} +228 -66
  67. package/dist/bundle/{chunk-BF6TQMNB.js → chunk-VJEOGKAN.js} +8 -10
  68. package/dist/bundle/{chunk-XGMDWIUP.js → chunk-VKPCONDQ.js} +4 -4
  69. package/dist/bundle/{chunk-73WSULMI.js → chunk-WYGWWHZP.js} +2 -2
  70. package/dist/bundle/{chunk-5W56YMQS.js → chunk-XDC3TWTL.js} +60 -51
  71. package/dist/bundle/{chunk-5W7D5H2R.js → chunk-XIUDS3OK.js} +1 -1
  72. package/dist/bundle/{chunk-3UPIJ7DW.js → chunk-XNVFKMVR.js} +21868 -4533
  73. package/dist/bundle/{chunk-O5CUFS7T.js → chunk-XR6ESRU6.js} +2 -2
  74. package/dist/bundle/{chunk-EPCJUL6M.js → chunk-Y6GNA7HE.js} +3 -3
  75. package/dist/bundle/{chunk-67HS46KM.js → chunk-YGU6ULU5.js} +12 -12
  76. package/dist/bundle/{chunk-HFM653T3.js → chunk-YIP7ELON.js} +768 -131
  77. package/dist/bundle/{chunk-3252WXOL.js → chunk-YUWPNG7B.js} +1 -1
  78. package/dist/bundle/{chunk-QR5VQXQ5.js → chunk-Z42YYLTS.js} +59 -37
  79. package/dist/bundle/{chunk-AWN22PJK.js → chunk-Z5KC7XBR.js} +3 -3
  80. package/dist/bundle/{chunk-ECEYAQGN.js → chunk-ZM5J6ZMB.js} +4 -2
  81. package/dist/bundle/{chunk-YPF6OS37.js → chunk-ZMOUUOT2.js} +1 -1
  82. package/dist/bundle/{chunk-CACYL36O.js → chunk-ZOJU7ZFI.js} +8 -8
  83. package/dist/bundle/command-contract-BRW3AP44.js +38 -0
  84. package/dist/bundle/{decode-62A3HGPW.js → decode-G5YEIPNC.js} +8 -8
  85. package/dist/bundle/{dispatch-IE7PBEQC.js → dispatch-GEFIXA6X.js} +9 -9
  86. package/dist/bundle/drive.js +11 -11
  87. package/dist/bundle/{echarts-BGBPRGR5.js → echarts-W2CWHNXR.js} +2 -2
  88. package/dist/bundle/{embed-J3IBVV2V.js → embed-OBFFPVF4.js} +9 -9
  89. package/dist/bundle/{embedder-QFPMDRT2.js → embedder-NGCBQHIG.js} +12 -12
  90. package/dist/bundle/entry-ET6HGM7A.js +22 -0
  91. package/dist/bundle/{failure-BKOGBMIC.js → failure-GV77W3CD.js} +4 -4
  92. package/dist/bundle/first-run-JG52UZVO.js +30 -0
  93. package/dist/bundle/first-screen-CIL3GFAA.js +36 -0
  94. package/dist/bundle/{google-RXM2XEPD.js → google-CIWUVJ5C.js} +13 -13
  95. package/dist/bundle/{google-api-NC65BZO4.js → google-api-Z3NSTBBR.js} +56 -57
  96. package/dist/bundle/grants-3S4RL3WB.js +104 -0
  97. package/dist/bundle/{identity-PI6F2GWA.js → identity-OM6GFZ7T.js} +6 -6
  98. package/dist/bundle/{instructions-6LPDSKAD.js → instructions-YQBQSYSS.js} +1 -1
  99. package/dist/bundle/{login-HTY7GT2S.js → login-7RYSDVN3.js} +62 -63
  100. package/dist/bundle/{mcp-PPVOM4SE.js → mcp-GWDA3HOA.js} +2 -2
  101. package/dist/bundle/{node-IB246NCQ.js → node-IVU33RL7.js} +2 -2
  102. package/dist/bundle/{node-sqlite-G2Y5SFJM.js → node-sqlite-SIH5BEW2.js} +9 -9
  103. package/dist/bundle/oauth-PT4JEHLL.js +22 -0
  104. package/dist/bundle/{open-WD4GFSJD.js → open-IAO2SNII.js} +8 -8
  105. package/dist/bundle/{openai-QVM4PMY7.js → openai-SGOUBHXP.js} +17 -17
  106. package/dist/bundle/{process-SWPJGPQC.js → process-BPBMV3AT.js} +1 -1
  107. package/dist/bundle/{program-WHYFAMXR.js → program-MYKKJ4F6.js} +231 -87
  108. package/dist/bundle/prompt-3ZM64DCB.js +17 -0
  109. package/dist/bundle/{reasons-Q34DQWB6.js → reasons-57J2D77K.js} +5 -5
  110. package/dist/bundle/{recognize-DM3YWHSE.js → recognize-A5C5RPB3.js} +7 -7
  111. package/dist/bundle/{remote-KXVWRK7J.js → remote-VWYFLRGO.js} +10 -10
  112. package/dist/bundle/{rerank-TINXM3MY.js → rerank-4NGQWREA.js} +10 -10
  113. package/dist/bundle/{serve-IY2WL656.js → serve-Y6LQTFH5.js} +12 -12
  114. package/dist/bundle/{server-VPY3OWPC.js → server-6AUHIIUA.js} +43 -44
  115. package/dist/bundle/server-PFHI35HA.js +69 -0
  116. package/dist/bundle/{services-PXNBOCOC.js → services-2W4J7EMW.js} +47 -32
  117. package/dist/bundle/{sqlite-runtime-5ZK2CV7Y.js → sqlite-runtime-P6BBDX2H.js} +9 -9
  118. package/dist/bundle/{start-LDVCN3DK.js → start-AFFA3LKM.js} +9 -7
  119. package/dist/bundle/{state-3MKTT3VS.js → state-PXKKXR3R.js} +9 -9
  120. package/dist/bundle/{store-4VQOT5IJ.js → store-CN6JEUC4.js} +28 -18
  121. package/dist/bundle/{store-7M4MSUJV.js → store-IVV2BAGZ.js} +78 -28
  122. package/dist/bundle/store-maintenance-command-MSY2QNEH.js +59 -0
  123. package/dist/bundle/tokens-P4LPNUFW.js +102 -0
  124. package/dist/commands/config.d.ts.map +1 -1
  125. package/dist/commands/config.js +5 -1
  126. package/dist/commands/config.js.map +1 -1
  127. package/dist/commands/folders.d.ts +2 -1
  128. package/dist/commands/folders.d.ts.map +1 -1
  129. package/dist/commands/folders.js +16 -3
  130. package/dist/commands/folders.js.map +1 -1
  131. package/dist/program.js +1 -1
  132. package/dist/program.js.map +1 -1
  133. package/dist/tokens.d.ts.map +1 -1
  134. package/dist/tokens.js +15 -6
  135. package/dist/tokens.js.map +1 -1
  136. package/dist/version.d.ts +1 -1
  137. package/dist/version.js +1 -1
  138. package/package.json +3 -3
  139. package/dist/bundle/chunk-BCWUDTYQ.js +0 -22
  140. package/dist/bundle/chunk-W767AUNR.js +0 -132
  141. package/dist/bundle/chunk-WUP2MJDN.js +0 -42
  142. package/dist/bundle/command-contract-T3EO5AYD.js +0 -39
  143. package/dist/bundle/entry-YQSYER66.js +0 -22
  144. package/dist/bundle/first-run-ZIFPVZAI.js +0 -30
  145. package/dist/bundle/first-screen-L5U26EY7.js +0 -37
  146. package/dist/bundle/grants-SEWUYYH3.js +0 -105
  147. package/dist/bundle/oauth-MWBKBI4T.js +0 -22
  148. package/dist/bundle/prompt-OVYCGZB7.js +0 -17
  149. package/dist/bundle/server-EMWVVT2C.js +0 -70
  150. package/dist/bundle/store-maintenance-command-NRATYBWD.js +0 -60
  151. package/dist/bundle/tokens-XUKLM3SL.js +0 -103
  152. /package/dist/bundle/{chunk-LU3WKZBA.js → chunk-ZQ3GWKDQ.js} +0 -0
package/dist/bin/drive.js CHANGED
@@ -9,7 +9,7 @@ if (
9
9
  (words[0] === "--version" || words[0] === "-V") &&
10
10
  !Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
11
11
  ) {
12
- process.stdout.write("0.61.0\n")
12
+ process.stdout.write("0.63.0\n")
13
13
  } else {
14
14
  // Before the bundle compiles: the bundle's own call comes after its chunks.
15
15
  module.enableCompileCache()
@@ -28,7 +28,7 @@ if (
28
28
  : next(specifier, context),
29
29
  })
30
30
  }
31
- const chunks = ["../bundle/all-profiles-H4L3Z5UM.js","../bundle/anthropic-PPGFISVP.js","../bundle/app-server-YXVK2FUZ.js","../bundle/bun-DKZAL6ML.js","../bundle/bun-sqlite-MTZY36QK.js","../bundle/command-contract-T3EO5AYD.js","../bundle/decode-62A3HGPW.js","../bundle/dispatch-IE7PBEQC.js","../bundle/dist-MWTMOYWT.js","../bundle/dist-PY3MVR3G.js","../bundle/echarts-BGBPRGR5.js","../bundle/embed-J3IBVV2V.js","../bundle/embedder-QFPMDRT2.js","../bundle/entry-YQSYER66.js","../bundle/failure-BKOGBMIC.js","../bundle/first-run-ZIFPVZAI.js","../bundle/first-screen-L5U26EY7.js","../bundle/google-RXM2XEPD.js","../bundle/google-api-NC65BZO4.js","../bundle/grants-SEWUYYH3.js","../bundle/identity-PI6F2GWA.js","../bundle/instructions-6LPDSKAD.js","../bundle/login-HTY7GT2S.js","../bundle/mcp-PPVOM4SE.js","../bundle/mdast-util-from-markdown-FXEPSNER.js","../bundle/mdast-util-gfm-SZM5GBDF.js","../bundle/micromark-extension-gfm-GRL24TU6.js","../bundle/node-IB246NCQ.js","../bundle/node-KM3CUABH.js","../bundle/node-TLZSIHIJ.js","../bundle/node-sqlite-G2Y5SFJM.js","../bundle/oauth-MWBKBI4T.js","../bundle/open-WD4GFSJD.js","../bundle/openai-QVM4PMY7.js","../bundle/process-SWPJGPQC.js","../bundle/program-WHYFAMXR.js","../bundle/prompt-OVYCGZB7.js","../bundle/reasons-Q34DQWB6.js","../bundle/recognize-DM3YWHSE.js","../bundle/remote-KXVWRK7J.js","../bundle/rerank-TINXM3MY.js","../bundle/serve-IY2WL656.js","../bundle/server-EMWVVT2C.js","../bundle/server-VPY3OWPC.js","../bundle/services-PXNBOCOC.js","../bundle/sqlite-runtime-5ZK2CV7Y.js","../bundle/start-LDVCN3DK.js","../bundle/state-3MKTT3VS.js","../bundle/store-4VQOT5IJ.js","../bundle/store-7M4MSUJV.js","../bundle/store-maintenance-command-NRATYBWD.js","../bundle/terminal-DHJ4D3BC.js","../bundle/tokens-XUKLM3SL.js"]
31
+ const chunks = ["../bundle/all-profiles-GZJS3UKC.js","../bundle/anthropic-RGV3WXX5.js","../bundle/app-server-AA2PJ7PV.js","../bundle/bun-OXZYIA3R.js","../bundle/bun-sqlite-D45NSDM3.js","../bundle/command-contract-BRW3AP44.js","../bundle/decode-G5YEIPNC.js","../bundle/dispatch-GEFIXA6X.js","../bundle/dist-MWTMOYWT.js","../bundle/dist-PY3MVR3G.js","../bundle/echarts-W2CWHNXR.js","../bundle/embed-OBFFPVF4.js","../bundle/embedder-NGCBQHIG.js","../bundle/entry-ET6HGM7A.js","../bundle/failure-GV77W3CD.js","../bundle/first-run-JG52UZVO.js","../bundle/first-screen-CIL3GFAA.js","../bundle/google-CIWUVJ5C.js","../bundle/google-api-Z3NSTBBR.js","../bundle/grants-3S4RL3WB.js","../bundle/identity-OM6GFZ7T.js","../bundle/instructions-YQBQSYSS.js","../bundle/login-7RYSDVN3.js","../bundle/mcp-GWDA3HOA.js","../bundle/mdast-util-from-markdown-FXEPSNER.js","../bundle/mdast-util-gfm-SZM5GBDF.js","../bundle/micromark-extension-gfm-GRL24TU6.js","../bundle/node-IVU33RL7.js","../bundle/node-KM3CUABH.js","../bundle/node-TLZSIHIJ.js","../bundle/node-sqlite-SIH5BEW2.js","../bundle/oauth-PT4JEHLL.js","../bundle/open-IAO2SNII.js","../bundle/openai-SGOUBHXP.js","../bundle/process-BPBMV3AT.js","../bundle/program-MYKKJ4F6.js","../bundle/prompt-3ZM64DCB.js","../bundle/reasons-57J2D77K.js","../bundle/recognize-A5C5RPB3.js","../bundle/remote-VWYFLRGO.js","../bundle/rerank-4NGQWREA.js","../bundle/serve-Y6LQTFH5.js","../bundle/server-6AUHIIUA.js","../bundle/server-PFHI35HA.js","../bundle/services-2W4J7EMW.js","../bundle/sqlite-runtime-P6BBDX2H.js","../bundle/start-AFFA3LKM.js","../bundle/state-PXKKXR3R.js","../bundle/store-CN6JEUC4.js","../bundle/store-IVV2BAGZ.js","../bundle/store-maintenance-command-MSY2QNEH.js","../bundle/terminal-DHJ4D3BC.js","../bundle/tokens-P4LPNUFW.js"]
32
32
  if (((words) => words
33
33
  .filter((word) => !word.startsWith("-"))
34
34
  .slice(0, 2)
@@ -0,0 +1,20 @@
1
+ import type { ListBody } from "@wirecat/cli-core/cli";
2
+ import * as v from "valibot";
3
+ /** Not a Google id: Drive has no folder for the files others shared, so browse names that root itself. */
4
+ export declare const SHARED_WITH_ME = "shared-with-me";
5
+ export type Call = (method: string, params: Record<string, unknown>) => Promise<unknown>;
6
+ export declare const browseRow: v.StrictObjectSchema<{
7
+ readonly id: v.StringSchema<undefined>;
8
+ readonly name: v.StringSchema<undefined>;
9
+ readonly kind: v.PicklistSchema<["my_drive", "shared_with_me", "shared_drive", "folder"], undefined>;
10
+ readonly parent: v.NullableSchema<v.StringSchema<undefined>, undefined>;
11
+ readonly location: v.PicklistSchema<["my_drive", "shared_with_me", "shared_drive"], undefined>;
12
+ readonly drive_id: v.NullableSchema<v.StringSchema<undefined>, undefined>;
13
+ readonly child_folders: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
14
+ readonly added: v.BooleanSchema<undefined>;
15
+ }, undefined>;
16
+ export type BrowseRow = v.InferOutput<typeof browseRow>;
17
+ export declare const BROWSE_HELP = "\nEach item, one level of the tree (--json prints them under \"items\"):\n id folder id to pass to --parent or to folders add; shared-with-me at the top level\n name folder name as Google shows it\n kind my_drive, shared_with_me or shared_drive (the top level), folder (below it)\n parent the --parent given, or null at the top level\n location where the folder lives: my_drive, shared_with_me or shared_drive\n drive_id the shared drive's id, or null\n child_folders folders directly inside it, or null when not counted (Shared with me, a level of over 1000 folders)\n added whether sync already imports this folder (folders add)\nFolders are listed by name. Only folders are listed; files inside them are not.\nFailures carry error.reason: oauth.missing (not signed in), oauth.expired (sign in again),\nprovider.rate-limited (retry later), not_found code (no such folder).";
18
+ /** One level of the owner's remote folders, read-only: the top level, or the folders directly inside `parent`. */
19
+ export declare const browseFolders: (call: Call, parent: string | undefined, selected: readonly string[]) => Promise<ListBody<BrowseRow>>;
20
+ //# sourceMappingURL=browse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browse.d.ts","sourceRoot":"","sources":["../src/browse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,0GAA0G;AAC1G,eAAO,MAAM,cAAc,mBAAmB,CAAA;AAE9C,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAExF,eAAO,MAAM,SAAS;;;;;;;;;aASpB,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,SAAS,CAAC,CAAA;AAEvD,eAAO,MAAM,WAAW,q7BAY8C,CAAA;AAyHtE,kHAAkH;AAClH,eAAO,MAAM,aAAa,SAClB,IAAI,UACF,MAAM,GAAG,SAAS,YAChB,SAAS,MAAM,EAAE,KAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAmC7B,CAAA"}
package/dist/browse.js ADDED
@@ -0,0 +1,146 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ import { listOf } from "@wirecat/cli-core/cli";
3
+ import * as v from "valibot";
4
+ import { FOLDER } from "./model.js";
5
+ import { MAX_ENTRIES } from "./supported.js";
6
+ /** Not a Google id: Drive has no folder for the files others shared, so browse names that root itself. */
7
+ export const SHARED_WITH_ME = "shared-with-me";
8
+ export const browseRow = v.strictObject({
9
+ id: v.string(),
10
+ name: v.string(),
11
+ kind: v.picklist(["my_drive", "shared_with_me", "shared_drive", "folder"]),
12
+ parent: v.nullable(v.string()),
13
+ location: v.picklist(["my_drive", "shared_with_me", "shared_drive"]),
14
+ drive_id: v.nullable(v.string()),
15
+ child_folders: v.nullable(v.number()),
16
+ added: v.boolean(),
17
+ });
18
+ export const BROWSE_HELP = `
19
+ Each item, one level of the tree (--json prints them under "items"):
20
+ id folder id to pass to --parent or to folders add; shared-with-me at the top level
21
+ name folder name as Google shows it
22
+ kind my_drive, shared_with_me or shared_drive (the top level), folder (below it)
23
+ parent the --parent given, or null at the top level
24
+ location where the folder lives: my_drive, shared_with_me or shared_drive
25
+ drive_id the shared drive's id, or null
26
+ child_folders folders directly inside it, or null when not counted (Shared with me, a level of over 1000 folders)
27
+ added whether sync already imports this folder (folders add)
28
+ Folders are listed by name. Only folders are listed; files inside them are not.
29
+ Failures carry error.reason: oauth.missing (not signed in), oauth.expired (sign in again),
30
+ provider.rate-limited (retry later), not_found code (no such folder).`;
31
+ const PAGE_BOUND = 1000;
32
+ const COUNTED_LEVEL = 1000;
33
+ const COUNT_CHUNK = 50;
34
+ const SAFE_ID = /^[A-Za-z0-9_-]{1,200}$/;
35
+ const NOT_TRASHED_FOLDER = `mimeType = '${FOLDER}' and trashed = false`;
36
+ const ACROSS_DRIVES = { supportsAllDrives: true, includeItemsFromAllDrives: true };
37
+ /** Every page of one Google list, bounded like sync's folder listing. */
38
+ const everyPage = async (call, method, params, key) => {
39
+ const rows = [];
40
+ const seen = new Set();
41
+ let incomplete = false;
42
+ let pageToken;
43
+ for (let page = 0; page < PAGE_BOUND; page++) {
44
+ const data = ((await call(method, { ...params, ...(pageToken ? { pageToken } : {}) })) ?? {});
45
+ for (const row of data[key] ?? [])
46
+ rows.push(row);
47
+ if (data.incompleteSearch)
48
+ incomplete = true;
49
+ if (rows.length > MAX_ENTRIES)
50
+ throw new CliError("provider_error", `this level holds more than ${MAX_ENTRIES} folders; drive lists at most that`, {
51
+ reason: "listing.too-large",
52
+ });
53
+ if (!data.nextPageToken)
54
+ return { rows, incomplete };
55
+ if (seen.has(data.nextPageToken))
56
+ throw new CliError("invalid_response", "Google repeated a folder page token");
57
+ seen.add(data.nextPageToken);
58
+ pageToken = data.nextPageToken;
59
+ }
60
+ throw new CliError("provider_error", "folder pagination exceeded its bound", { reason: "listing.too-large" });
61
+ };
62
+ /** One batched query per 50 folders instead of one per folder; null when the level is too big to count. */
63
+ const childCounts = async (call, ids) => {
64
+ const counted = ids.filter((id) => SAFE_ID.test(id));
65
+ if (counted.length > COUNTED_LEVEL)
66
+ return undefined;
67
+ const counts = new Map(counted.map((id) => [id, 0]));
68
+ for (let start = 0; start < counted.length; start += COUNT_CHUNK) {
69
+ const chunk = counted.slice(start, start + COUNT_CHUNK);
70
+ const { rows, incomplete } = await everyPage(call, "drive.files.list", {
71
+ q: `${NOT_TRASHED_FOLDER} and (${chunk.map((id) => `'${id}' in parents`).join(" or ")})`,
72
+ fields: "nextPageToken,incompleteSearch,files(parents)",
73
+ pageSize: 1000,
74
+ ...ACROSS_DRIVES,
75
+ }, "files");
76
+ if (incomplete)
77
+ return undefined;
78
+ for (const row of rows)
79
+ for (const parent of row.parents ?? []) {
80
+ const count = counts.get(parent);
81
+ if (count !== undefined)
82
+ counts.set(parent, count + 1);
83
+ }
84
+ }
85
+ return counts;
86
+ };
87
+ const byName = (a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: "base", numeric: true }) || a.id.localeCompare(b.id);
88
+ const listed = (items, incomplete) => listOf("", {
89
+ items,
90
+ limit: Math.max(1, items.length),
91
+ has_more: false,
92
+ ...(incomplete
93
+ ? { missing: [{ field: "items", why: "Google searched only some of the drives; some folders may be missing" }] }
94
+ : {}),
95
+ });
96
+ const roots = async (call, added) => {
97
+ const myDrive = ((await call("drive.files.get", { fileId: "root", fields: "id" })) ?? {});
98
+ if (!myDrive.id)
99
+ throw new CliError("invalid_response", "Google did not return the My Drive folder");
100
+ const { rows: drives } = await everyPage(call, "drive.drives.list", { pageSize: 100, fields: "nextPageToken,drives(id,name)" }, "drives");
101
+ const shared = drives.flatMap((drive) => (drive.id ? [{ id: drive.id, name: drive.name ?? "" }] : []));
102
+ const counts = await childCounts(call, [myDrive.id, ...shared.map((drive) => drive.id)]);
103
+ const top = (id, name, kind) => ({
104
+ id,
105
+ name,
106
+ kind,
107
+ parent: null,
108
+ location: kind,
109
+ drive_id: kind === "shared_drive" ? id : null,
110
+ child_folders: kind === "shared_with_me" ? null : (counts?.get(id) ?? null),
111
+ added: added(id) || (kind === "my_drive" && added("root")),
112
+ });
113
+ return listed([
114
+ top(myDrive.id, "My Drive", "my_drive"),
115
+ top(SHARED_WITH_ME, "Shared with me", "shared_with_me"),
116
+ ...shared.map((drive) => top(drive.id, drive.name, "shared_drive")).sort(byName),
117
+ ], false);
118
+ };
119
+ /** One level of the owner's remote folders, read-only: the top level, or the folders directly inside `parent`. */
120
+ export const browseFolders = async (call, parent, selected) => {
121
+ const added = (id) => selected.includes(id);
122
+ if (parent === undefined)
123
+ return roots(call, added);
124
+ const { rows, incomplete } = await everyPage(call, "drive.files.list", {
125
+ q: parent === SHARED_WITH_ME
126
+ ? `sharedWithMe = true and ${NOT_TRASHED_FOLDER}`
127
+ : `'${parent}' in parents and ${NOT_TRASHED_FOLDER}`,
128
+ fields: "nextPageToken,incompleteSearch,files(id,name,driveId,ownedByMe)",
129
+ pageSize: 1000,
130
+ ...ACROSS_DRIVES,
131
+ }, "files");
132
+ const folders = rows.filter((row) => Boolean(row.id));
133
+ const counts = await childCounts(call, folders.map((folder) => folder.id));
134
+ const items = folders.map((folder) => ({
135
+ id: folder.id,
136
+ name: folder.name ?? "",
137
+ kind: "folder",
138
+ parent,
139
+ location: folder.driveId ? "shared_drive" : folder.ownedByMe === false ? "shared_with_me" : "my_drive",
140
+ drive_id: folder.driveId ?? null,
141
+ child_folders: counts?.get(folder.id) ?? null,
142
+ added: added(folder.id),
143
+ }));
144
+ return listed(items.sort(byName), incomplete);
145
+ };
146
+ //# sourceMappingURL=browse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browse.js","sourceRoot":"","sources":["../src/browse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,0GAA0G;AAC1G,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAA;AAI9C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,YAAY,CAAC;IACtC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,QAAQ,CA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AE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;KACxB,CAAC,CACH,CAAA;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAA;AAC/C,CAAC,CAAA"}
@@ -2,33 +2,32 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  answeredWire
5
- } from "./chunk-QSGT4ZH4.js";
5
+ } from "./chunk-J4DIHPZ6.js";
6
6
  import {
7
7
  CALLER_META_KEY,
8
8
  PROXY_CLIENT_NAME,
9
9
  StdioServerTransport,
10
10
  callerOf,
11
11
  serveStdio
12
- } from "./chunk-73WSULMI.js";
12
+ } from "./chunk-WYGWWHZP.js";
13
13
  import {
14
14
  McpServer
15
15
  } from "./chunk-5D4AEUVA.js";
16
- import "./chunk-BF6TQMNB.js";
17
- import "./chunk-BCWUDTYQ.js";
18
- import "./chunk-VPDAH7PJ.js";
19
- import "./chunk-LU3WKZBA.js";
20
- import "./chunk-DCBFNBEB.js";
21
- import "./chunk-J4HQVHMN.js";
16
+ import "./chunk-VJEOGKAN.js";
17
+ import "./chunk-E4SDKMBJ.js";
18
+ import "./chunk-ZQ3GWKDQ.js";
19
+ import "./chunk-OD4U7GUY.js";
20
+ import "./chunk-UQLWMGSD.js";
22
21
  import "./chunk-Y5E2WNWB.js";
23
- import "./chunk-6IBM4Z3V.js";
24
- import "./chunk-OFFA54TW.js";
25
- import "./chunk-VYXVPYA3.js";
26
- import "./chunk-WZ5XK74U.js";
22
+ import "./chunk-2HF2MRXI.js";
23
+ import "./chunk-6EY46GAN.js";
24
+ import "./chunk-FEZF3TII.js";
25
+ import "./chunk-4OSSOWDM.js";
27
26
  import {
28
27
  __name
29
28
  } from "./chunk-ZVVMGPBJ.js";
30
29
 
31
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/mcp/all-profiles.js
30
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/mcp/all-profiles.js
32
31
  import { spawn } from "node:child_process";
33
32
  import { randomUUID } from "node:crypto";
34
33
  var PROTOCOL = "2025-06-18";
@@ -262,7 +261,7 @@ var serveAllProfilesOverStdio = /* @__PURE__ */ __name(async (options, io = {})
262
261
  }, "serveAllProfilesOverStdio");
263
262
  var serveAllProfilesOverHttp = /* @__PURE__ */ __name(async (options, http) => {
264
263
  const { build, close } = allProfilesServer(options);
265
- const { serveOverHttp } = await import("./serve-IY2WL656.js");
264
+ const { serveOverHttp } = await import("./serve-Y6LQTFH5.js");
266
265
  const listening = await serveOverHttp(build, {
267
266
  ...http,
268
267
  appName: options.command,
@@ -2,31 +2,31 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  checkedOptions
5
- } from "./chunk-AWN22PJK.js";
5
+ } from "./chunk-Z5KC7XBR.js";
6
6
  import {
7
7
  messagesFor,
8
8
  systemFor
9
- } from "./chunk-FE5JJXKA.js";
9
+ } from "./chunk-MOTRI3SY.js";
10
10
  import {
11
11
  Anthropic
12
12
  } from "./chunk-FXBHOCJK.js";
13
- import "./chunk-DCBFNBEB.js";
14
- import "./chunk-J4HQVHMN.js";
13
+ import "./chunk-OD4U7GUY.js";
14
+ import "./chunk-UQLWMGSD.js";
15
15
  import "./chunk-Y5E2WNWB.js";
16
- import "./chunk-6IBM4Z3V.js";
17
- import "./chunk-OFFA54TW.js";
16
+ import "./chunk-2HF2MRXI.js";
17
+ import "./chunk-6EY46GAN.js";
18
18
  import {
19
19
  array,
20
20
  optional,
21
21
  strictObject,
22
22
  string
23
- } from "./chunk-VYXVPYA3.js";
24
- import "./chunk-WZ5XK74U.js";
23
+ } from "./chunk-FEZF3TII.js";
24
+ import "./chunk-4OSSOWDM.js";
25
25
  import {
26
26
  __name
27
27
  } from "./chunk-ZVVMGPBJ.js";
28
28
 
29
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/models/anthropic.js
29
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/models/anthropic.js
30
30
  var options = strictObject({
31
31
  stop_sequences: optional(array(string()))
32
32
  });
@@ -3,34 +3,34 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  PER_RUN,
5
5
  envelope
6
- } from "./chunk-E6J5YH2N.js";
6
+ } from "./chunk-LZEOQW7S.js";
7
7
  import {
8
8
  mcpUrlOf
9
- } from "./chunk-QR5VQXQ5.js";
9
+ } from "./chunk-Z42YYLTS.js";
10
10
  import {
11
11
  answered,
12
12
  failed,
13
13
  registerCommands,
14
14
  runCommandForAgent,
15
15
  toolsFromCommands
16
- } from "./chunk-DXPOVLQC.js";
16
+ } from "./chunk-DJHLVUL6.js";
17
17
  import {
18
18
  agentJson,
19
19
  skillResource
20
- } from "./chunk-UKOYQC5O.js";
20
+ } from "./chunk-OXY6SSZG.js";
21
21
  import {
22
22
  answeredWire
23
- } from "./chunk-QSGT4ZH4.js";
23
+ } from "./chunk-J4DIHPZ6.js";
24
24
  import {
25
25
  StdioServerTransport,
26
26
  serveStdio
27
- } from "./chunk-73WSULMI.js";
27
+ } from "./chunk-WYGWWHZP.js";
28
28
  import {
29
29
  McpServer
30
30
  } from "./chunk-5D4AEUVA.js";
31
- import "./chunk-5W56YMQS.js";
32
- import "./chunk-2RJA4BQB.js";
33
- import "./chunk-3SJQNS72.js";
31
+ import "./chunk-XDC3TWTL.js";
32
+ import "./chunk-J24ZFCWM.js";
33
+ import "./chunk-RKELRWH7.js";
34
34
  import {
35
35
  DEFAULT_OUTPUT_BYTES,
36
36
  changesAuthorityAt,
@@ -39,65 +39,64 @@ import {
39
39
  judgedTargets,
40
40
  readsOverMcpAt,
41
41
  rootOf2 as rootOf
42
- } from "./chunk-JVBLXSAA.js";
43
- import "./chunk-BF6TQMNB.js";
44
- import "./chunk-XGMDWIUP.js";
42
+ } from "./chunk-33MGFUED.js";
43
+ import "./chunk-VJEOGKAN.js";
44
+ import "./chunk-VKPCONDQ.js";
45
45
  import {
46
46
  readOnlyLockOf
47
- } from "./chunk-ECEYAQGN.js";
47
+ } from "./chunk-ZM5J6ZMB.js";
48
48
  import {
49
49
  mcpHttpMarker
50
- } from "./chunk-DEPMQHXQ.js";
51
- import "./chunk-Q4XVBKX4.js";
52
- import "./chunk-WIU733D2.js";
50
+ } from "./chunk-2TFXK3R4.js";
51
+ import "./chunk-FRIJUILO.js";
52
+ import "./chunk-534OBX5Y.js";
53
53
  import {
54
54
  appInstructions
55
- } from "./chunk-YWIU4HOT.js";
56
- import "./chunk-XYCCGGKN.js";
57
- import "./chunk-PJTX2MOI.js";
58
- import "./chunk-S4YK6TTG.js";
59
- import "./chunk-6DN4VPA7.js";
60
- import "./chunk-BCWUDTYQ.js";
61
- import "./chunk-E5EXJ2XS.js";
62
- import "./chunk-YPF6OS37.js";
63
- import "./chunk-FE5JJXKA.js";
64
- import "./chunk-3WZH3WV3.js";
65
- import "./chunk-J5UDQD5S.js";
55
+ } from "./chunk-3QINVLZI.js";
56
+ import "./chunk-44SBK6KB.js";
57
+ import "./chunk-ND6LLYGF.js";
58
+ import "./chunk-3BZRKLJ6.js";
59
+ import "./chunk-6MQSQ4LX.js";
60
+ import "./chunk-QCKZ3GAA.js";
61
+ import "./chunk-ZMOUUOT2.js";
62
+ import "./chunk-MOTRI3SY.js";
63
+ import "./chunk-CE2TJBLP.js";
64
+ import "./chunk-VAUMOZU5.js";
65
+ import "./chunk-TF23BZW5.js";
66
+ import "./chunk-PO5RQQIG.js";
66
67
  import "./chunk-5DPV7X27.js";
67
- import "./chunk-XLFJLZJL.js";
68
- import "./chunk-TKGAYKXW.js";
69
- import "./chunk-W767AUNR.js";
70
- import "./chunk-3UPIJ7DW.js";
71
- import "./chunk-WUP2MJDN.js";
72
- import "./chunk-K7LS3NGM.js";
73
- import "./chunk-NZ2EIZLX.js";
74
- import "./chunk-VPDAH7PJ.js";
75
- import "./chunk-CACYL36O.js";
76
- import "./chunk-X2CXW4HM.js";
77
- import "./chunk-I26VL4W7.js";
78
- import "./chunk-6SUGANRJ.js";
79
- import "./chunk-XGNC5OJG.js";
80
- import "./chunk-O5CUFS7T.js";
68
+ import "./chunk-LMAVCYLQ.js";
69
+ import "./chunk-XNVFKMVR.js";
70
+ import "./chunk-UPOSDTPT.js";
71
+ import "./chunk-V3NVXIQR.js";
72
+ import "./chunk-EOOGWUTP.js";
73
+ import "./chunk-E4SDKMBJ.js";
74
+ import "./chunk-ZOJU7ZFI.js";
75
+ import "./chunk-ABYGSJZ4.js";
76
+ import "./chunk-AEX37ETW.js";
77
+ import "./chunk-3HK5WMI5.js";
78
+ import "./chunk-4S4JMW6I.js";
79
+ import "./chunk-XR6ESRU6.js";
81
80
  import "./chunk-D72URWJE.js";
82
- import "./chunk-KV4267S4.js";
83
- import "./chunk-LU3WKZBA.js";
84
- import "./chunk-HGOYQUT7.js";
85
- import "./chunk-DCBFNBEB.js";
81
+ import "./chunk-27YUUGXQ.js";
82
+ import "./chunk-ZQ3GWKDQ.js";
83
+ import "./chunk-2NIC72HH.js";
84
+ import "./chunk-OD4U7GUY.js";
86
85
  import {
87
86
  mcpErrorResult
88
- } from "./chunk-J4HQVHMN.js";
87
+ } from "./chunk-UQLWMGSD.js";
89
88
  import "./chunk-Y5E2WNWB.js";
90
- import "./chunk-6IBM4Z3V.js";
91
- import "./chunk-OFFA54TW.js";
92
- import "./chunk-VYXVPYA3.js";
89
+ import "./chunk-2HF2MRXI.js";
90
+ import "./chunk-6EY46GAN.js";
91
+ import "./chunk-FEZF3TII.js";
93
92
  import {
94
93
  CliError
95
- } from "./chunk-WZ5XK74U.js";
94
+ } from "./chunk-4OSSOWDM.js";
96
95
  import {
97
96
  __name
98
97
  } from "./chunk-ZVVMGPBJ.js";
99
98
 
100
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/mcp/app-server.js
99
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/mcp/app-server.js
101
100
  var EXCLUDED = [["mcp"]];
102
101
  var createAppServer = /* @__PURE__ */ __name((command, context, options) => {
103
102
  const { app } = options;
@@ -197,9 +196,12 @@ var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options)
197
196
  });
198
197
  const ended = await new Promise((resolve) => {
199
198
  wire.ended.then(() => resolve("input"));
200
- if (own)
201
- signal?.addEventListener("abort", () => resolve("stopped"), { once: true });
202
- else {
199
+ if (own) {
200
+ if (signal?.aborted)
201
+ resolve("stopped");
202
+ else
203
+ signal?.addEventListener("abort", () => resolve("stopped"), { once: true });
204
+ } else {
203
205
  process.once("SIGINT", () => resolve("stopped"));
204
206
  process.once("SIGTERM", () => resolve("stopped"));
205
207
  }
@@ -212,7 +214,7 @@ var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options)
212
214
  var serveAppOverHttp = /* @__PURE__ */ __name(async (command, context, options, http) => {
213
215
  const { app } = options;
214
216
  const { build } = createAppServer(command, context, options);
215
- const { serveOverHttp } = await import("./serve-IY2WL656.js");
217
+ const { serveOverHttp } = await import("./serve-Y6LQTFH5.js");
216
218
  const listening = await serveOverHttp(build, {
217
219
  ...http,
218
220
  appName: app.command,
@@ -18,12 +18,12 @@ import {
18
18
  jitCompatCheck,
19
19
  refineSqliteCodecs,
20
20
  sql
21
- } from "./chunk-XGNC5OJG.js";
21
+ } from "./chunk-4S4JMW6I.js";
22
22
  import {
23
23
  __name
24
24
  } from "./chunk-ZVVMGPBJ.js";
25
25
 
26
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/bun.js
26
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/bun.js
27
27
  import { Database } from "bun:sqlite";
28
28
  var bunSQLiteCodecs = refineSqliteCodecs({
29
29
  "integer:boolean": { normalize: booleanFromInteger },
@@ -3,21 +3,21 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  loadVectorExtension,
5
5
  vectorExtension
6
- } from "./chunk-ZHYRHERD.js";
7
- import "./chunk-DCBFNBEB.js";
8
- import "./chunk-J4HQVHMN.js";
6
+ } from "./chunk-L37LMMRJ.js";
7
+ import "./chunk-OD4U7GUY.js";
8
+ import "./chunk-UQLWMGSD.js";
9
9
  import {
10
10
  importFrom
11
11
  } from "./chunk-Y5E2WNWB.js";
12
- import "./chunk-6IBM4Z3V.js";
13
- import "./chunk-OFFA54TW.js";
14
- import "./chunk-VYXVPYA3.js";
15
- import "./chunk-WZ5XK74U.js";
12
+ import "./chunk-2HF2MRXI.js";
13
+ import "./chunk-6EY46GAN.js";
14
+ import "./chunk-FEZF3TII.js";
15
+ import "./chunk-4OSSOWDM.js";
16
16
  import {
17
17
  __name
18
18
  } from "./chunk-ZVVMGPBJ.js";
19
19
 
20
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/store/drivers/bun-sqlite.js
20
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/drivers/bun-sqlite.js
21
21
  var customised = false;
22
22
  var ownLibrary = /* @__PURE__ */ __name(async () => {
23
23
  try {
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/installer.js
7
+ // 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/installer.js
8
8
  var installerOf = /* @__PURE__ */ __name((scriptPath) => {
9
9
  const path = scriptPath.replaceAll("\\", "/");
10
10
  if (path.includes("/_npx/"))
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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.80.9_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
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/store/driver.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/driver.js
8
8
  var TIME_LIMIT_FUNCTION = "wc_time_limit";
9
9
  var TimeLimitReached = class extends Error {
10
10
  static {
@@ -25,10 +25,12 @@ var PRAGMAS = `
25
25
  PRAGMA journal_mode = WAL;
26
26
  PRAGMA foreign_keys = ON;
27
27
  `;
28
+ var isQueryOnly = /* @__PURE__ */ __name((database) => Number(Object.values(database.prepare("PRAGMA query_only").get() ?? {})[0]) === 1, "isQueryOnly");
28
29
 
29
30
  export {
30
31
  TIME_LIMIT_FUNCTION,
31
32
  TimeLimitReached,
32
33
  beforeTimeLimit,
33
- PRAGMAS
34
+ PRAGMAS,
35
+ isQueryOnly
34
36
  };