@wirecat/drive-cli 0.70.0 → 0.72.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 (262) hide show
  1. package/README.md +150 -70
  2. package/contracts/wirecat.json +77 -8
  3. package/dist/bin/drive.js +2 -2
  4. package/dist/bundle/agent-23OB2NZP.js +46 -0
  5. package/dist/bundle/{all-profiles-FW3GK3QO.js → all-profiles-GXGDVNQJ.js} +67 -25
  6. package/dist/bundle/{anthropic-QVKJT3II.js → anthropic-H5C4GQHC.js} +9 -9
  7. package/dist/bundle/{app-server-QU73RD5R.js → app-server-EQ3UK4C7.js} +97 -79
  8. package/dist/bundle/{bun-5XCD5CBB.js → bun-DTJVSRY3.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-TIGSVNSV.js → bun-sqlite-JIFY7MAE.js} +9 -9
  10. package/dist/bundle/chunk-2Q325BBD.js +353 -0
  11. package/dist/bundle/chunk-35FIJGTT.js +52 -0
  12. package/dist/bundle/{chunk-7C5KENNU.js → chunk-3FRQ6V4T.js} +3 -3
  13. package/dist/bundle/chunk-47L262VI.js +340 -0
  14. package/dist/bundle/chunk-4HP6KGBI.js +32 -0
  15. package/dist/bundle/{chunk-GA3URWIF.js → chunk-4HPXWYTE.js} +1 -1
  16. package/dist/bundle/{chunk-HYXXMSVD.js → chunk-4IUNYYYL.js} +4473 -2685
  17. package/dist/bundle/{chunk-FYPW7NMH.js → chunk-4JS32SRX.js} +64 -4
  18. package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
  19. package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
  20. package/dist/bundle/{chunk-SONPLYV7.js → chunk-55FH6IEL.js} +5 -5
  21. package/dist/bundle/{chunk-VVN6GHAZ.js → chunk-5BNMWSU2.js} +659 -255
  22. package/dist/bundle/{chunk-FVTKFIQH.js → chunk-5H747A76.js} +5496 -3195
  23. package/dist/bundle/{chunk-PR7XD2DI.js → chunk-5KWCO56H.js} +2 -2
  24. package/dist/bundle/{chunk-3AHBZP33.js → chunk-5U3NCE5R.js} +35 -12
  25. package/dist/bundle/{chunk-HRATXUFH.js → chunk-6CCO3JCM.js} +31 -22
  26. package/dist/bundle/{chunk-RLNZ7NX5.js → chunk-6ZW2ZJYC.js} +2 -2
  27. package/dist/bundle/{chunk-RQNRYF6D.js → chunk-75DAHQOV.js} +3 -3
  28. package/dist/bundle/{chunk-7QSRODXM.js → chunk-77OBW43F.js} +6 -6
  29. package/dist/bundle/{chunk-GV5DGHSA.js → chunk-7EFM6AW3.js} +4 -4
  30. package/dist/bundle/{chunk-BXPC5TFG.js → chunk-A3S7QM5L.js} +3 -3
  31. package/dist/bundle/{chunk-IGNIUDI3.js → chunk-AA4LKC6W.js} +251 -565
  32. package/dist/bundle/chunk-ASTKHB6B.js +3233 -0
  33. package/dist/bundle/{chunk-3TCMANIM.js → chunk-BM6V7456.js} +8 -227
  34. package/dist/bundle/chunk-BO6EDBYJ.js +50 -0
  35. package/dist/bundle/{chunk-F5KJWRF5.js → chunk-BPA3R4KN.js} +2 -100
  36. package/dist/bundle/chunk-CIFE4KPX.js +2159 -0
  37. package/dist/bundle/chunk-CKB4XZZJ.js +730 -0
  38. package/dist/bundle/{chunk-YCL3SK4T.js → chunk-COJTCEZP.js} +113 -860
  39. package/dist/bundle/{chunk-BD2K2ONK.js → chunk-CWPYDT73.js} +6 -6
  40. package/dist/bundle/{chunk-6BMTW5A6.js → chunk-D4JNCXS7.js} +9 -9
  41. package/dist/bundle/chunk-DCPWZIOV.js +696 -0
  42. package/dist/bundle/{chunk-P7PLKNPX.js → chunk-DHMNCOQI.js} +415 -272
  43. package/dist/bundle/chunk-DOQMH4DC.js +280 -0
  44. package/dist/bundle/chunk-DQSOYH6N.js +20 -0
  45. package/dist/bundle/{chunk-ML3R2UHV.js → chunk-DWRUOLBF.js} +4 -4
  46. package/dist/bundle/{chunk-5JTB4URG.js → chunk-E3VWZC3K.js} +14 -13
  47. package/dist/bundle/chunk-ECYOTDJM.js +14 -0
  48. package/dist/bundle/{chunk-7IBENBCK.js → chunk-EVG3AA5M.js} +2 -2
  49. package/dist/bundle/chunk-F4BX7TH2.js +15 -0
  50. package/dist/bundle/{chunk-FCSHWUMW.js → chunk-FBEZSA76.js} +5 -5
  51. package/dist/bundle/{chunk-RHSBXOQM.js → chunk-FBQJN74J.js} +1 -1
  52. package/dist/bundle/{chunk-4WK26MPY.js → chunk-FIZOPJYY.js} +1 -1
  53. package/dist/bundle/chunk-FNAYSZWK.js +783 -0
  54. package/dist/bundle/{chunk-LINBDWJK.js → chunk-FRCJHGZM.js} +2 -2
  55. package/dist/bundle/{chunk-RCTOWLCD.js → chunk-FTG5QBSD.js} +41 -33
  56. package/dist/bundle/{chunk-ABZ2NYDT.js → chunk-FUDUXIVG.js} +1 -1
  57. package/dist/bundle/{chunk-NYECVHFH.js → chunk-G4NHRFS7.js} +755 -0
  58. package/dist/bundle/{chunk-PAPY6Q6H.js → chunk-GIEZYBRC.js} +1 -1
  59. package/dist/bundle/chunk-GTPPUBYU.js +1876 -0
  60. package/dist/bundle/chunk-GU6ICH53.js +108 -0
  61. package/dist/bundle/{chunk-REM5WHHQ.js → chunk-GUMKKRE6.js} +107 -71
  62. package/dist/bundle/{chunk-QBAOIMVB.js → chunk-GWCDOYSC.js} +1 -1
  63. package/dist/bundle/{chunk-HHAZ6DCY.js → chunk-GXGSC622.js} +69 -7
  64. package/dist/bundle/chunk-HAGXTGJC.js +188 -0
  65. package/dist/bundle/{chunk-TNKQDS5A.js → chunk-IMAWQC5K.js} +6 -6
  66. package/dist/bundle/{chunk-ZHZYGY5R.js → chunk-IVGVVSPW.js} +4 -4
  67. package/dist/bundle/{chunk-EDO5LZVF.js → chunk-J4NUHSM7.js} +1 -1
  68. package/dist/bundle/{chunk-DVVUJ254.js → chunk-K652FYCO.js} +6 -6
  69. package/dist/bundle/chunk-K6ZWNTXY.js +561 -0
  70. package/dist/bundle/{chunk-FONIFRYI.js → chunk-KF3ZBQJV.js} +4 -4
  71. package/dist/bundle/chunk-KFZCHJRT.js +80 -0
  72. package/dist/bundle/chunk-KLPFDFLI.js +221 -0
  73. package/dist/bundle/{chunk-LMJBQFW6.js → chunk-KP2XMCNT.js} +13 -13
  74. package/dist/bundle/{chunk-FADAOLGB.js → chunk-KWDZ3KVH.js} +4 -4
  75. package/dist/bundle/{chunk-MXNQZAJQ.js → chunk-KX4C32WD.js} +2 -2
  76. package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
  77. package/dist/bundle/{chunk-ILAQIBEO.js → chunk-M2ZWYVWO.js} +1 -1
  78. package/dist/bundle/chunk-MEYYH47C.js +25 -0
  79. package/dist/bundle/{chunk-ZCXWV4XO.js → chunk-ML2QIWX2.js} +4 -4
  80. package/dist/bundle/{chunk-XOL346TJ.js → chunk-MUFF2YTH.js} +2 -2
  81. package/dist/bundle/{chunk-GAHIHE4K.js → chunk-N24YSLED.js} +9166 -9751
  82. package/dist/bundle/chunk-N4GTCPML.js +7 -0
  83. package/dist/bundle/{chunk-DVI72ZQG.js → chunk-NBMGDRP4.js} +1 -1
  84. package/dist/bundle/chunk-NMQRSEZM.js +37 -0
  85. package/dist/bundle/{chunk-I7YSHUPW.js → chunk-NNGA4QDR.js} +13 -26
  86. package/dist/bundle/{chunk-5DPV7X27.js → chunk-NTZWY5R3.js} +321 -0
  87. package/dist/bundle/chunk-O7CZZ36M.js +80 -0
  88. package/dist/bundle/{chunk-HWUPU6WX.js → chunk-OAONP6KI.js} +13 -9
  89. package/dist/bundle/{chunk-3CHW7JGR.js → chunk-OESP4PHB.js} +17 -17
  90. package/dist/bundle/chunk-OHR6IZNH.js +116 -0
  91. package/dist/bundle/{chunk-54NDYVZA.js → chunk-OLCU7Q2B.js} +1 -1
  92. package/dist/bundle/{chunk-FN3RXBO7.js → chunk-OLDQLEPA.js} +6 -6
  93. package/dist/bundle/{chunk-7DJNURKV.js → chunk-OPIPG6AP.js} +16 -9
  94. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  95. package/dist/bundle/chunk-PRYMT3OG.js +30 -0
  96. package/dist/bundle/chunk-QDUIVMEW.js +36 -0
  97. package/dist/bundle/{chunk-66PL7P4C.js → chunk-QKBPCX7Y.js} +1 -1
  98. package/dist/bundle/{chunk-PN4JYURZ.js → chunk-QSLOACDT.js} +201 -423
  99. package/dist/bundle/{chunk-3UWRAIWA.js → chunk-QUZFDU4K.js} +4 -4
  100. package/dist/bundle/{chunk-KSJAFMU5.js → chunk-R32DHS6J.js} +211 -380
  101. package/dist/bundle/{chunk-2SBC4DVV.js → chunk-R57QUYBG.js} +6 -28
  102. package/dist/bundle/{chunk-IFTX7AQU.js → chunk-R64OSDOD.js} +45 -66
  103. package/dist/bundle/{chunk-WJK6KTCS.js → chunk-RSPBVKOC.js} +8 -8
  104. package/dist/bundle/{chunk-GPDPEHYX.js → chunk-SPNPJ3FZ.js} +3 -4
  105. package/dist/bundle/chunk-SQHDSIFL.js +388 -0
  106. package/dist/bundle/{chunk-XZBA6FVH.js → chunk-ST35FIUG.js} +3 -3
  107. package/dist/bundle/{chunk-37MAA6F2.js → chunk-STUPCKAA.js} +11 -2221
  108. package/dist/bundle/chunk-SZ7XJZGH.js +2231 -0
  109. package/dist/bundle/chunk-TRYYWV7J.js +291 -0
  110. package/dist/bundle/{chunk-OY7TNUEC.js → chunk-TTPWKTVR.js} +1 -1
  111. package/dist/bundle/{chunk-3UZ4OH22.js → chunk-U7VEJ3CW.js} +49 -129
  112. package/dist/bundle/{chunk-6Y2BYFXQ.js → chunk-UC7JLE6J.js} +0 -7
  113. package/dist/bundle/{chunk-HK225DAG.js → chunk-UIQ35CA5.js} +1 -1
  114. package/dist/bundle/{chunk-GK3BJMGK.js → chunk-UJY26HW4.js} +1 -1
  115. package/dist/bundle/{chunk-EG62WVR2.js → chunk-UWG3PRY7.js} +9 -60
  116. package/dist/bundle/{chunk-BBRMDMIR.js → chunk-VAR3MJU6.js} +3 -3
  117. package/dist/bundle/{chunk-GJZSVSV3.js → chunk-VPQSI5IU.js} +4 -4
  118. package/dist/bundle/{chunk-YZPE72GE.js → chunk-VQPT3Y7W.js} +12 -12
  119. package/dist/bundle/{chunk-T5D4OGDC.js → chunk-WMG3H2VK.js} +2 -2
  120. package/dist/bundle/{chunk-6DPOWBKA.js → chunk-X5BGAZC5.js} +6 -6
  121. package/dist/bundle/{chunk-DHX27E5M.js → chunk-XC6TRWLZ.js} +3 -3
  122. package/dist/bundle/{chunk-Q5C6YKAY.js → chunk-XQZEMRCU.js} +402 -402
  123. package/dist/bundle/{chunk-54BQWRJL.js → chunk-XZ7MO6EU.js} +7 -7
  124. package/dist/bundle/{chunk-TGS5VPJD.js → chunk-YAIOEPKU.js} +341 -433
  125. package/dist/bundle/chunk-YHWFF6DN.js +39 -0
  126. package/dist/bundle/{chunk-WWE5GO6G.js → chunk-YWOLQEDV.js} +16 -3
  127. package/dist/bundle/{chunk-DR57KDAY.js → chunk-ZFDSJ5YJ.js} +38 -8
  128. package/dist/bundle/{chunk-BBFXQPKD.js → chunk-ZFUZEFU6.js} +3 -3
  129. package/dist/bundle/{chunk-YRUR3E3E.js → chunk-ZJKXSMXK.js} +72 -59
  130. package/dist/bundle/{chunk-BFKFKDPC.js → chunk-ZKWT6HXT.js} +1 -1
  131. package/dist/bundle/chunk-ZPUY3COZ.js +250 -0
  132. package/dist/bundle/{cli-K4D4DIGQ.js → cli-2P5FW2RL.js} +201 -98
  133. package/dist/bundle/command-contract-BMQT2G5X.js +45 -0
  134. package/dist/bundle/{command-server-entry-WREK3QBB.js → command-server-entry-KP2UDGLA.js} +36 -34
  135. package/dist/bundle/{decode-SEETPKBH.js → decode-K2JZ5D6V.js} +10 -10
  136. package/dist/bundle/{dispatch-SQCEURVK.js → dispatch-KOQZA74A.js} +10 -10
  137. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  138. package/dist/bundle/drive.js +11 -11
  139. package/dist/bundle/{echarts-WZ5RKFCX.js → echarts-URO3QGCG.js} +2 -2
  140. package/dist/bundle/{embed-B2UCRZZR.js → embed-JLIPWTNN.js} +10 -10
  141. package/dist/bundle/{embedder-4R6Z7G7L.js → embedder-LUTDO3HS.js} +15 -15
  142. package/dist/bundle/entry-AVF6LMG7.js +25 -0
  143. package/dist/bundle/{failure-CYNXH3RQ.js → failure-GJMQLM7O.js} +4 -4
  144. package/dist/bundle/first-run-VYTIEUDA.js +31 -0
  145. package/dist/bundle/first-screen-QVZPF7KL.js +45 -0
  146. package/dist/bundle/google-VX7IPACN.js +46 -0
  147. package/dist/bundle/{google-api-SAND2F7L.js → google-api-RFXKRLL4.js} +88 -73
  148. package/dist/bundle/grants-4XWJFVD6.js +133 -0
  149. package/dist/bundle/hast-util-from-html-X2DCPS3T.js +10531 -0
  150. package/dist/bundle/hast-util-to-html-VP6XLPKJ.js +998 -0
  151. package/dist/bundle/hast-util-to-mdast-IZ5PRX72.js +2272 -0
  152. package/dist/bundle/{identity-JVVGS4U6.js → identity-FXPB5EMT.js} +7 -6
  153. package/dist/bundle/{instructions-JSMTSB22.js → instructions-IROIUVZI.js} +1 -1
  154. package/dist/bundle/{login-6WG3YBDU.js → login-WIY5VQU7.js} +96 -81
  155. package/dist/bundle/{mcp-VFIOZDVY.js → mcp-NJIOKW3E.js} +2 -2
  156. package/dist/bundle/{mdast-util-from-markdown-FXEPSNER.js → mdast-util-from-markdown-HEZF7KJ4.js} +137 -195
  157. package/dist/bundle/mdast-util-gfm-AQW6R6MG.js +925 -0
  158. package/dist/bundle/mdast-util-to-hast-DF2QVIRV.js +879 -0
  159. package/dist/bundle/mdast-util-to-markdown-XYLXB3Z3.js +18 -0
  160. package/dist/bundle/meeting-combined-JUNV35GM.js +28 -0
  161. package/dist/bundle/meeting-model-XY4UNWWK.js +29 -0
  162. package/dist/bundle/{meeting-semantic-5U7JQCFF.js → meeting-semantic-62QNQMOM.js} +10 -10
  163. package/dist/bundle/{micromark-extension-gfm-GRL24TU6.js → micromark-extension-gfm-OE2GBORZ.js} +11 -78
  164. package/dist/bundle/{node-VJMVHOWD.js → node-IACCI2CW.js} +2 -2
  165. package/dist/bundle/{node-sqlite-DCNT3HVE.js → node-sqlite-WYIRC7C7.js} +10 -10
  166. package/dist/bundle/notes-search-DEDUJKSN.js +70 -0
  167. package/dist/bundle/oauth-HXBXF4VI.js +22 -0
  168. package/dist/bundle/{open-NFOEHVW7.js → open-H32B6BCT.js} +8 -8
  169. package/dist/bundle/{openai-D47WY7EC.js → openai-VHMPJJUG.js} +22 -21
  170. package/dist/bundle/{process-Q2FRU5VA.js → process-RNHPF5OK.js} +1 -1
  171. package/dist/bundle/{program-T2AJJQEM.js → program-GYMJ3DDH.js} +276 -1132
  172. package/dist/bundle/{prompt-YJSDABXN.js → prompt-TOG2CRCE.js} +8 -8
  173. package/dist/bundle/{reasons-WEHPCSJX.js → reasons-TLFQ45YX.js} +6 -5
  174. package/dist/bundle/{recognize-6OBEIEB3.js → recognize-GYGY45EY.js} +7 -7
  175. package/dist/bundle/remote-6XN2QLI5.js +35 -0
  176. package/dist/bundle/{rerank-L6F5SLIB.js → rerank-HJO3O4TW.js} +11 -11
  177. package/dist/bundle/{serve-GYSWIWH4.js → serve-XPCNLHCR.js} +19 -19
  178. package/dist/bundle/server-UBJZ66XE.js +97 -0
  179. package/dist/bundle/{server-GWWP3RIT.js → server-WPT3NC5B.js} +89 -70
  180. package/dist/bundle/{services-BDQBRXT5.js → services-253KKKVU.js} +109 -89
  181. package/dist/bundle/{sqlite-runtime-ZSZGAUYB.js → sqlite-runtime-EZASGJXW.js} +9 -9
  182. package/dist/bundle/{start-BJ275RUK.js → start-UHI35JFL.js} +7 -7
  183. package/dist/bundle/{state-HLNGFI2T.js → state-KJTSPFGK.js} +9 -9
  184. package/dist/bundle/{store-I43KZNJW.js → store-62J2H2A3.js} +36 -25
  185. package/dist/bundle/{store-OSRTGYGI.js → store-G5B7T7M7.js} +38 -23
  186. package/dist/bundle/store-maintenance-command-C6T4YLVF.js +85 -0
  187. package/dist/bundle/surface-3OT64BHS.js +83 -0
  188. package/dist/bundle/tokens-EHYO6D2X.js +133 -0
  189. package/dist/commands/documents.d.ts.map +1 -1
  190. package/dist/commands/documents.js +11 -1
  191. package/dist/commands/documents.js.map +1 -1
  192. package/dist/commands/remote.d.ts.map +1 -1
  193. package/dist/commands/remote.js +8 -22
  194. package/dist/commands/remote.js.map +1 -1
  195. package/dist/commands/sync.d.ts.map +1 -1
  196. package/dist/commands/sync.js +14 -4
  197. package/dist/commands/sync.js.map +1 -1
  198. package/dist/config.d.ts +5 -0
  199. package/dist/config.d.ts.map +1 -1
  200. package/dist/config.js +7 -1
  201. package/dist/config.js.map +1 -1
  202. package/dist/first-screen.d.ts.map +1 -1
  203. package/dist/first-screen.js +2 -1
  204. package/dist/first-screen.js.map +1 -1
  205. package/dist/generated/manifest.d.ts +2 -1
  206. package/dist/generated/manifest.d.ts.map +1 -1
  207. package/dist/generated/manifest.js +782 -0
  208. package/dist/generated/manifest.js.map +1 -1
  209. package/dist/generated/types.d.ts +262 -58
  210. package/dist/generated/types.d.ts.map +1 -1
  211. package/dist/google.d.ts.map +1 -1
  212. package/dist/google.js +5 -5
  213. package/dist/google.js.map +1 -1
  214. package/dist/model.d.ts +5 -2
  215. package/dist/model.d.ts.map +1 -1
  216. package/dist/model.js.map +1 -1
  217. package/dist/policy-keys.js +1 -1
  218. package/dist/policy-keys.js.map +1 -1
  219. package/dist/program.d.ts.map +1 -1
  220. package/dist/program.js +9 -4
  221. package/dist/program.js.map +1 -1
  222. package/dist/state.d.ts.map +1 -1
  223. package/dist/state.js +6 -1
  224. package/dist/state.js.map +1 -1
  225. package/dist/store.d.ts.map +1 -1
  226. package/dist/store.js +2 -7
  227. package/dist/store.js.map +1 -1
  228. package/dist/supported.d.ts +2 -2
  229. package/dist/supported.d.ts.map +1 -1
  230. package/dist/supported.js +2 -3
  231. package/dist/supported.js.map +1 -1
  232. package/dist/sync.d.ts +2 -1
  233. package/dist/sync.d.ts.map +1 -1
  234. package/dist/sync.js +6 -4
  235. package/dist/sync.js.map +1 -1
  236. package/dist/transcripts.d.ts +0 -6
  237. package/dist/transcripts.d.ts.map +1 -1
  238. package/dist/transcripts.js +0 -13
  239. package/dist/transcripts.js.map +1 -1
  240. package/dist/version.d.ts +1 -1
  241. package/dist/version.js +1 -1
  242. package/package.json +3 -3
  243. package/scenarios/find-decision.md +1 -1
  244. package/skills/drive-cli/SKILL.md +4 -2
  245. package/dist/bundle/chunk-AV5UKJZM.js +0 -729
  246. package/dist/bundle/chunk-NP7LJATI.js +0 -598
  247. package/dist/bundle/chunk-P77FL6RY.js +0 -896
  248. package/dist/bundle/chunk-ZI3YTXSF.js +0 -2
  249. package/dist/bundle/command-contract-V3F452QI.js +0 -43
  250. package/dist/bundle/entry-ORZYRJ5N.js +0 -25
  251. package/dist/bundle/first-run-KAKA6KBY.js +0 -31
  252. package/dist/bundle/first-screen-R645UHRH.js +0 -41
  253. package/dist/bundle/google-BSO3YB7N.js +0 -45
  254. package/dist/bundle/grants-PLNFYARD.js +0 -118
  255. package/dist/bundle/mdast-util-gfm-SZM5GBDF.js +0 -2103
  256. package/dist/bundle/meeting-combined-SUKMFK3F.js +0 -27
  257. package/dist/bundle/meeting-model-S4YGKIFI.js +0 -29
  258. package/dist/bundle/oauth-KCMNQ3ZP.js +0 -22
  259. package/dist/bundle/remote-3SL2QJ7T.js +0 -35
  260. package/dist/bundle/server-BI46BSRE.js +0 -80
  261. package/dist/bundle/store-maintenance-command-FO7LEVSL.js +0 -72
  262. package/dist/bundle/tokens-DB7O7QNB.js +0 -118
@@ -10,8 +10,18 @@ import {
10
10
  describeDriveProgram,
11
11
  examples,
12
12
  markProfileFree
13
- } from "./chunk-7C5KENNU.js";
13
+ } from "./chunk-3FRQ6V4T.js";
14
14
  import {
15
+ apiMethod,
16
+ apiMethods,
17
+ jsonObject,
18
+ operationOf,
19
+ schemas,
20
+ validateApiParams,
21
+ validateRequest
22
+ } from "./chunk-R57QUYBG.js";
23
+ import {
24
+ CATALOG_FIELDS,
15
25
  DEFAULTS_ONLY,
16
26
  DEFAULT_LEVELS,
17
27
  FILES_QUERY,
@@ -20,6 +30,14 @@ import {
20
30
  SETTING_NAMES,
21
31
  TRANSCRIPTS_QUERY,
22
32
  activeProfile,
33
+ addDocumentCatalogCommands,
34
+ addDocumentFolderCommands,
35
+ addDocumentHistoryCommands,
36
+ addDocumentKnowledgeCommands,
37
+ addDocumentMirrorCommands,
38
+ addDocumentSearchCommand,
39
+ addDocumentSyncCommands,
40
+ addLocalDocumentCommands,
23
41
  application,
24
42
  bindQuery,
25
43
  checkAddProfiles,
@@ -29,12 +47,15 @@ import {
29
47
  configuration,
30
48
  configuredSessions,
31
49
  driveFileQuery,
50
+ factItem,
32
51
  fileId,
33
52
  fileRow,
34
53
  findTranscripts,
35
54
  googleAppOf,
36
55
  inspectConfig,
56
+ keepVersions,
37
57
  maxAddProfiles,
58
+ memoryItem,
38
59
  methodPolicyKeys,
39
60
  oauthClientReport,
40
61
  paths,
@@ -56,12 +77,14 @@ import {
56
77
  unknownProfile,
57
78
  withDefaults,
58
79
  writeConfig
59
- } from "./chunk-NP7LJATI.js";
80
+ } from "./chunk-ASTKHB6B.js";
81
+ import {
82
+ operations
83
+ } from "./chunk-G4NHRFS7.js";
60
84
  import {
61
85
  MAX_ENTRIES,
62
- supported,
63
- tooManyEntries
64
- } from "./chunk-BXPC5TFG.js";
86
+ supported
87
+ } from "./chunk-A3S7QM5L.js";
65
88
  import {
66
89
  DOC,
67
90
  DOCUMENT_LIST_FIELDS,
@@ -72,43 +95,28 @@ import {
72
95
  diffBlocks,
73
96
  documentIngestion,
74
97
  documentKnowledge,
75
- extractDocumentMemories,
76
98
  fileMirrorState,
77
99
  markdownBlocks,
78
100
  mergeBlocks,
79
101
  metadataJson,
80
- mirrorId,
81
- mirrorStatus,
82
102
  normalizeInlines,
83
103
  spliceMarkdown,
84
- syncDocuments,
85
- syncMirrors,
86
- watchMirrors
87
- } from "./chunk-VVN6GHAZ.js";
88
- import {
89
- apiMethod,
90
- apiMethods,
91
- jsonObject,
92
- operationOf,
93
- schemas,
94
- validateApiParams,
95
- validateRequest
96
- } from "./chunk-2SBC4DVV.js";
104
+ syncDocuments
105
+ } from "./chunk-5BNMWSU2.js";
97
106
  import {
98
- operations
99
- } from "./chunk-NYECVHFH.js";
107
+ googleError,
108
+ offlineRefused
109
+ } from "./chunk-FBQJN74J.js";
100
110
  import {
101
111
  DISCOVERY_DESCRIPTIONS,
102
112
  MEMO_SCENARIOS,
103
113
  accountRemoveCommand,
114
+ actorOf,
104
115
  addContractInfo,
105
116
  answerFields,
106
- apiPlainJson,
107
117
  appCompleteCommand,
108
118
  appDoctorCommand,
109
119
  appMcpCommand,
110
- checkApiBody,
111
- checkApiParameter,
112
120
  checkJson,
113
121
  commandRuns,
114
122
  commandsText,
@@ -116,83 +124,90 @@ import {
116
124
  entityFields,
117
125
  generatedApiCommand,
118
126
  guideCommand,
119
- honoursDryRun,
120
- identifier,
121
127
  inSection,
122
128
  modelCatalogueCommand,
123
- parseApiJson,
124
- readApiBody,
125
129
  run,
126
130
  runsCommand,
127
131
  sharedCommandTemplate,
128
132
  signInSteps,
129
133
  skillCommand,
130
134
  upgradeCommand
131
- } from "./chunk-FVTKFIQH.js";
132
- import {
133
- googleError,
134
- offlineRefused
135
- } from "./chunk-RHSBXOQM.js";
136
- import "./chunk-QBAOIMVB.js";
137
- import "./chunk-YZPE72GE.js";
138
- import "./chunk-GPDPEHYX.js";
139
- import "./chunk-RCTOWLCD.js";
140
- import "./chunk-KSJAFMU5.js";
141
- import "./chunk-ZHZYGY5R.js";
135
+ } from "./chunk-5H747A76.js";
136
+ import "./chunk-GWCDOYSC.js";
137
+ import "./chunk-SPNPJ3FZ.js";
138
+ import "./chunk-FTG5QBSD.js";
139
+ import "./chunk-SQHDSIFL.js";
140
+ import "./chunk-E3VWZC3K.js";
141
+ import "./chunk-VQPT3Y7W.js";
142
+ import "./chunk-IVGVVSPW.js";
143
+ import "./chunk-BO6EDBYJ.js";
144
+ import "./chunk-R32DHS6J.js";
142
145
  import {
143
146
  storeInfo
144
- } from "./chunk-REM5WHHQ.js";
145
- import "./chunk-HWUPU6WX.js";
146
- import "./chunk-3UZ4OH22.js";
147
- import "./chunk-AV5UKJZM.js";
148
- import "./chunk-WWE5GO6G.js";
147
+ } from "./chunk-GUMKKRE6.js";
148
+ import "./chunk-OAONP6KI.js";
149
+ import "./chunk-U7VEJ3CW.js";
150
+ import "./chunk-2Q325BBD.js";
151
+ import "./chunk-YWOLQEDV.js";
152
+ import "./chunk-47L262VI.js";
153
+ import "./chunk-KFZCHJRT.js";
149
154
  import {
150
- LIST_QUERY_GUIDE,
151
155
  RecipientList,
152
156
  SendJournal,
153
- listQuery,
154
- nativeField,
157
+ apiPlainJson,
158
+ checkApiBody,
159
+ checkApiParameter,
160
+ identifier,
155
161
  newOperationId,
156
- queryHelp,
157
- queryTerms,
158
- sendGuard,
159
- termField,
160
- typedQuery,
161
- unfilteredQuery,
162
- withQuery
163
- } from "./chunk-GAHIHE4K.js";
162
+ parseApiJson,
163
+ readApiBody,
164
+ sendGuard
165
+ } from "./chunk-N24YSLED.js";
164
166
  import {
165
167
  columnName,
166
- modelGateway,
167
168
  readSpreadsheet
168
- } from "./chunk-PN4JYURZ.js";
169
- import "./chunk-I7YSHUPW.js";
170
- import "./chunk-7QSRODXM.js";
171
- import "./chunk-3TCMANIM.js";
172
- import "./chunk-RQNRYF6D.js";
173
- import "./chunk-EG62WVR2.js";
174
- import "./chunk-HTQTIKWP.js";
175
- import "./chunk-5JTB4URG.js";
169
+ } from "./chunk-QSLOACDT.js";
170
+ import "./chunk-NNGA4QDR.js";
176
171
  import {
177
172
  latestVersion,
178
173
  runUpdate,
179
174
  updateNotice
180
- } from "./chunk-FADAOLGB.js";
181
- import "./chunk-GA3URWIF.js";
182
- import "./chunk-ZCXWV4XO.js";
183
- import "./chunk-FCSHWUMW.js";
184
- import "./chunk-FN3RXBO7.js";
175
+ } from "./chunk-KWDZ3KVH.js";
176
+ import "./chunk-4HPXWYTE.js";
177
+ import {
178
+ queryTerms,
179
+ termField,
180
+ typedQuery,
181
+ unfilteredQuery,
182
+ withQuery
183
+ } from "./chunk-CKB4XZZJ.js";
184
+ import "./chunk-CIFE4KPX.js";
185
+ import {
186
+ modelGateway
187
+ } from "./chunk-ZPUY3COZ.js";
188
+ import "./chunk-QDUIVMEW.js";
189
+ import "./chunk-PRYMT3OG.js";
190
+ import "./chunk-77OBW43F.js";
191
+ import "./chunk-KLPFDFLI.js";
192
+ import "./chunk-BM6V7456.js";
193
+ import "./chunk-75DAHQOV.js";
194
+ import "./chunk-UWG3PRY7.js";
195
+ import "./chunk-HTQTIKWP.js";
196
+ import "./chunk-OHR6IZNH.js";
197
+ import "./chunk-ML2QIWX2.js";
198
+ import "./chunk-FBEZSA76.js";
199
+ import "./chunk-OLDQLEPA.js";
185
200
  import {
186
201
  applyDocumentTransfer,
187
202
  previewDocumentTransfer
188
- } from "./chunk-3CHW7JGR.js";
189
- import "./chunk-IFTX7AQU.js";
190
- import "./chunk-5DPV7X27.js";
191
- import "./chunk-6BMTW5A6.js";
192
- import "./chunk-DVI72ZQG.js";
193
- import "./chunk-EDO5LZVF.js";
194
- import "./chunk-LINBDWJK.js";
195
- import "./chunk-3UWRAIWA.js";
203
+ } from "./chunk-OESP4PHB.js";
204
+ import "./chunk-R64OSDOD.js";
205
+ import "./chunk-NTZWY5R3.js";
206
+ import "./chunk-D4JNCXS7.js";
207
+ import "./chunk-J4NUHSM7.js";
208
+ import "./chunk-NBMGDRP4.js";
209
+ import "./chunk-FRCJHGZM.js";
210
+ import "./chunk-QUZFDU4K.js";
196
211
  import {
197
212
  CEILING_KEY,
198
213
  FETCH,
@@ -212,10 +227,8 @@ import {
212
227
  fetchesOnly,
213
228
  flatten,
214
229
  grantsAuthority,
215
- guardedWrite,
216
230
  hasSharedContract,
217
231
  itemOf,
218
- jsonlRecords,
219
232
  layerPermissions,
220
233
  levelFor,
221
234
  listOf,
@@ -228,92 +241,81 @@ import {
228
241
  resolveAISettings,
229
242
  rootOf,
230
243
  settingRows,
231
- sharedCommand,
232
244
  sharedContracts,
233
245
  snakeKeys
234
- } from "./chunk-TGS5VPJD.js";
246
+ } from "./chunk-YAIOEPKU.js";
247
+ import "./chunk-XZ7MO6EU.js";
248
+ import {
249
+ setupPermissionCeiling
250
+ } from "./chunk-7EFM6AW3.js";
251
+ import "./chunk-FIZOPJYY.js";
252
+ import {
253
+ guardedWrite
254
+ } from "./chunk-HAGXTGJC.js";
235
255
  import {
236
256
  modelTarget
237
- } from "./chunk-FYPW7NMH.js";
238
- import "./chunk-54BQWRJL.js";
257
+ } from "./chunk-4JS32SRX.js";
239
258
  import {
240
259
  readOnlyLockOf,
241
260
  readOnlyRefusal
242
- } from "./chunk-PR7XD2DI.js";
243
- import "./chunk-4WK26MPY.js";
244
- import "./chunk-TNKQDS5A.js";
245
- import {
246
- setupPermissionCeiling
247
- } from "./chunk-GV5DGHSA.js";
261
+ } from "./chunk-5KWCO56H.js";
262
+ import "./chunk-IMAWQC5K.js";
248
263
  import {
249
264
  hostFetch
250
- } from "./chunk-DR57KDAY.js";
251
- import {
252
- note
253
- } from "./chunk-BBFXQPKD.js";
254
- import "./chunk-FONIFRYI.js";
255
- import "./chunk-XZBA6FVH.js";
256
- import "./chunk-MXNQZAJQ.js";
265
+ } from "./chunk-ZFDSJ5YJ.js";
266
+ import "./chunk-ZFUZEFU6.js";
267
+ import "./chunk-KF3ZBQJV.js";
268
+ import "./chunk-ST35FIUG.js";
269
+ import "./chunk-KX4C32WD.js";
257
270
  import {
258
- CATALOG_QUERY,
259
- IMPORTED_DOCUMENT_QUERY,
260
271
  openStore
261
- } from "./chunk-HYXXMSVD.js";
262
- import "./chunk-BBRMDMIR.js";
263
- import "./chunk-7DJNURKV.js";
264
- import "./chunk-3AHBZP33.js";
265
- import "./chunk-OY7TNUEC.js";
266
- import "./chunk-6DPOWBKA.js";
272
+ } from "./chunk-4IUNYYYL.js";
273
+ import "./chunk-VAR3MJU6.js";
274
+ import "./chunk-O7CZZ36M.js";
275
+ import "./chunk-DCPWZIOV.js";
276
+ import "./chunk-5U3NCE5R.js";
277
+ import "./chunk-OPIPG6AP.js";
278
+ import "./chunk-TTPWKTVR.js";
279
+ import "./chunk-X5BGAZC5.js";
280
+ import "./chunk-FNAYSZWK.js";
281
+ import "./chunk-UJY26HW4.js";
267
282
  import {
268
- FACT_STATUSES,
269
- MEMORY_KINDS,
270
- MEMORY_SCOPES,
271
- MEMORY_STATUSES,
272
283
  inRun
273
- } from "./chunk-YCL3SK4T.js";
274
- import "./chunk-GK3BJMGK.js";
275
- import "./chunk-RLNZ7NX5.js";
276
- import "./chunk-DHX27E5M.js";
284
+ } from "./chunk-COJTCEZP.js";
285
+ import "./chunk-6ZW2ZJYC.js";
286
+ import "./chunk-XC6TRWLZ.js";
287
+ import "./chunk-DHMNCOQI.js";
277
288
  import {
278
- FACT_TYPES
279
- } from "./chunk-P7PLKNPX.js";
280
- import {
281
- defineQuery,
282
- parseLucene,
283
- queryError,
284
- queryFieldsOf,
285
289
  timezoneOf,
286
- validateQuery,
287
290
  zonedMoment
288
- } from "./chunk-Q5C6YKAY.js";
289
- import "./chunk-WJK6KTCS.js";
290
- import "./chunk-PAPY6Q6H.js";
291
+ } from "./chunk-XQZEMRCU.js";
292
+ import "./chunk-RSPBVKOC.js";
293
+ import "./chunk-GIEZYBRC.js";
291
294
  import "./chunk-D72URWJE.js";
292
295
  import {
293
296
  installerOf
294
- } from "./chunk-66PL7P4C.js";
297
+ } from "./chunk-QKBPCX7Y.js";
295
298
  import {
296
299
  DRIVE_APP,
297
300
  PACKAGE,
298
301
  VERSION
299
- } from "./chunk-XOL346TJ.js";
302
+ } from "./chunk-MUFF2YTH.js";
300
303
  import {
301
304
  REASONS
302
- } from "./chunk-ILAQIBEO.js";
303
- import "./chunk-ZI3YTXSF.js";
304
- import "./chunk-HK225DAG.js";
305
+ } from "./chunk-M2ZWYVWO.js";
306
+ import "./chunk-N4GTCPML.js";
307
+ import "./chunk-UIQ35CA5.js";
305
308
  import {
306
309
  storePath
307
- } from "./chunk-T5D4OGDC.js";
310
+ } from "./chunk-WMG3H2VK.js";
308
311
  import {
309
312
  processStreams,
310
313
  saveConfigFile,
311
314
  writeSecurely
312
- } from "./chunk-HRATXUFH.js";
313
- import "./chunk-SONPLYV7.js";
314
- import "./chunk-Y5E2WNWB.js";
315
- import "./chunk-ABZ2NYDT.js";
316
- import "./chunk-7IBENBCK.js";
315
+ } from "./chunk-6CCO3JCM.js";
316
+ import "./chunk-55FH6IEL.js";
317
+ import "./chunk-FUDUXIVG.js";
318
+ import "./chunk-EVG3AA5M.js";
317
319
  import {
318
320
  array,
319
321
  boolean,
@@ -336,11 +338,12 @@ import {
336
338
  string,
337
339
  unknown,
338
340
  writes
339
- } from "./chunk-HHAZ6DCY.js";
341
+ } from "./chunk-GXGSC622.js";
340
342
  import {
341
343
  CliError,
342
344
  isCliError
343
- } from "./chunk-54NDYVZA.js";
345
+ } from "./chunk-OLCU7Q2B.js";
346
+ import "./chunk-Y5E2WNWB.js";
344
347
  import {
345
348
  __commonJS,
346
349
  __name,
@@ -1905,12 +1908,12 @@ var require_adapter = __commonJS({
1905
1908
  }
1906
1909
  __name(createSyncFs, "createSyncFs");
1907
1910
  function toPromise(method) {
1908
- return (...args) => new Promise((resolve7, reject) => {
1911
+ return (...args) => new Promise((resolve6, reject) => {
1909
1912
  args.push((err, result) => {
1910
1913
  if (err) {
1911
1914
  reject(err);
1912
1915
  } else {
1913
- resolve7(result);
1916
+ resolve6(result);
1914
1917
  }
1915
1918
  });
1916
1919
  method(...args);
@@ -2058,7 +2061,12 @@ var State = object({
2058
2061
  cursor: string(),
2059
2062
  scope: string(),
2060
2063
  folders: record(ID, File),
2061
- jobs: array(object({ id: ID, kind: picklist(["save", "remove"]), file: optional(File) })),
2064
+ jobs: array(object({
2065
+ id: ID,
2066
+ kind: picklist(["save", "remove"]),
2067
+ file: optional(File),
2068
+ reason: optional(picklist(["deleted", "unavailable", "unsynced"]))
2069
+ })),
2062
2070
  skipped: array(Skip),
2063
2071
  matched: optional(array(ID))
2064
2072
  }))
@@ -2179,7 +2187,7 @@ var profileLocked2 = /* @__PURE__ */ __name((env, name) => import_proper_lockfil
2179
2187
  var removal = {
2180
2188
  signOut: /* @__PURE__ */ __name(async (profile, { env, keyring, mayRevoke }) => {
2181
2189
  const storage = readConfig(env).profiles[profile]?.storage ?? "keyring";
2182
- const { sessionKeeper } = await import("./tokens-DB7O7QNB.js");
2190
+ const { sessionKeeper } = await import("./tokens-EHYO6D2X.js");
2183
2191
  const { revoked } = await sessionKeeper({
2184
2192
  env,
2185
2193
  name: profile,
@@ -2200,883 +2208,6 @@ var installAccountCommands = /* @__PURE__ */ __name((program, _context) => {
2200
2208
  annotate(program.command("account"), { effects: LOCAL_READ }).description("remove this profile from this computer").addCommand(accountRemoveCommand(DRIVE_APP, removal, { resolveSettings: configuration.resolveSettings }));
2201
2209
  }, "installAccountCommands");
2202
2210
 
2203
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/cli/documents/queries.js
2204
- var registry = /* @__PURE__ */ __name((entity, schema, native, examples3) => ({
2205
- entity,
2206
- backend: "native",
2207
- fields: queryFieldsOf(schema, { native, examples: examples3 }).map((field) => field.native ? { ...field, operators: ["term", "phrase"] } : field)
2208
- }), "registry");
2209
- var folderRow = strictObject({ id: string() });
2210
- var mirrorRow = strictObject({ id: string(), path: string(), folder: string() });
2211
- var tagRow = strictObject({ tag: string() });
2212
- var linkRow = looseObject({
2213
- id: string(),
2214
- from: string(),
2215
- to: nullable(string()),
2216
- kind: string(),
2217
- role: nullable(string()),
2218
- confirmed: boolean(),
2219
- origin: picklist(["file", "owner", "suggested", "message"])
2220
- });
2221
- var IDENTITY_ROLES = ["owner", "last-editor"];
2222
- var identityRow = looseObject({
2223
- remote_id: nullable(string()),
2224
- provider: string(),
2225
- role: picklist(IDENTITY_ROLES),
2226
- person: nullable(record(string(), unknown()))
2227
- });
2228
- var documentQueries = /* @__PURE__ */ __name(() => {
2229
- return {
2230
- folders: registry("selected_folder", folderRow, ["id"], { id: "id:FOLDER_ID" }),
2231
- mirrors: registry("mirror", mirrorRow, ["id", "path", "folder"], {
2232
- id: "id:example",
2233
- path: 'path:"/example/notes"',
2234
- folder: "folder:FOLDER_ID"
2235
- }),
2236
- tags: registry("document_tag", tagRow, ["tag"], { tag: "tag:budget" }),
2237
- notes: registry("note", note, ["text"], { text: "text:review" }),
2238
- links: registry("document_relationship", linkRow, ["id", "role", "origin", "confirmed"], {
2239
- id: "id:1",
2240
- role: "role:reviewer",
2241
- origin: "origin:owner",
2242
- confirmed: "confirmed:true"
2243
- }),
2244
- identities: registry("document_identity", identityRow, ["remote_id", "role"], {
2245
- remote_id: "remote_id:example",
2246
- role: "role:owner"
2247
- })
2248
- };
2249
- }, "documentQueries");
2250
- var bindQuery2 = /* @__PURE__ */ __name((command, query, schema) => answerEntity(withQuery(command, query), query.entity, schema), "bindQuery");
2251
- var termsOf2 = /* @__PURE__ */ __name((words, query, command) => Object.fromEntries(queryTerms(words, query, command)), "termsOf");
2252
- var FACT_QUERY = {
2253
- entity: "fact",
2254
- backend: "native",
2255
- fields: [
2256
- termField("kind", "enum", "kind:decision", { values: FACT_TYPES }),
2257
- termField("status", "enum", "status:proposed", { values: FACT_STATUSES })
2258
- ]
2259
- };
2260
- var MEMORY_QUERY = {
2261
- entity: "memory",
2262
- backend: "native",
2263
- fields: [
2264
- termField("kind", "enum", "kind:preference", { values: MEMORY_KINDS }),
2265
- termField("status", "enum", "status:proposed", { values: MEMORY_STATUSES }),
2266
- termField("scope", "enum", "scope:work", { values: MEMORY_SCOPES })
2267
- ]
2268
- };
2269
- var MEMORY_SEARCH_QUERY = {
2270
- entity: "memory",
2271
- backend: "native",
2272
- fields: [
2273
- nativeField({
2274
- name: "text",
2275
- type: "txt",
2276
- operators: ["term", "phrase"],
2277
- example: "text:reviews",
2278
- relation: "words of the memory; a bare word means the same"
2279
- }),
2280
- termField("scope", "enum", "scope:work", { values: MEMORY_SCOPES })
2281
- ]
2282
- };
2283
- var factItem = /* @__PURE__ */ __name(({ type, statement, source, confirmedBy, ...fact }) => ({
2284
- ref: fact.ref,
2285
- id: fact.id,
2286
- kind: type,
2287
- text: statement,
2288
- status: fact.status,
2289
- project: fact.project,
2290
- subject: fact.subject,
2291
- occurred_at: fact.occurredAt,
2292
- supersedes: fact.supersedes,
2293
- author: fact.author,
2294
- model: fact.model,
2295
- confirmed_by: confirmedBy,
2296
- scope: fact.scope,
2297
- origin: source,
2298
- evidence: fact.evidence,
2299
- created_at: fact.createdAt,
2300
- updated_at: fact.updatedAt
2301
- }), "factItem");
2302
- var memoryItem = /* @__PURE__ */ __name(({ body, ...memory }) => ({
2303
- ref: memory.ref,
2304
- id: memory.id,
2305
- kind: memory.kind,
2306
- text: body,
2307
- subject: memory.subject,
2308
- author: memory.author,
2309
- model: memory.model,
2310
- confidence: memory.confidence,
2311
- status: memory.status,
2312
- scope: memory.scope,
2313
- supersedes: memory.supersedes,
2314
- evidence: memory.evidence,
2315
- last_verified_at: memory.lastVerifiedAt,
2316
- created_at: memory.createdAt,
2317
- updated_at: memory.updatedAt
2318
- }), "memoryItem");
2319
- var memorySearch = /* @__PURE__ */ __name((words) => {
2320
- const command = "memories search";
2321
- const context = { command, guide: LIST_QUERY_GUIDE };
2322
- const ast = validateQuery(parseLucene(typedQuery(words), { defaultField: "text", ...context }), MEMORY_SEARCH_QUERY, context);
2323
- const text = [];
2324
- let scope;
2325
- const add = /* @__PURE__ */ __name((node) => {
2326
- if (node.kind === "boolean") {
2327
- for (const clause of node.clauses) {
2328
- if (clause.occur !== "must")
2329
- queryError("query.unsupported-placement", clause.node.span, "this search joins its terms by AND", context);
2330
- add(clause.node);
2331
- }
2332
- return;
2333
- }
2334
- if (node.field === "text")
2335
- text.push(node.value);
2336
- else if (scope !== void 0)
2337
- queryError("query.unsupported-placement", node.span, "scope only once here", context);
2338
- else
2339
- scope = node.value.toLowerCase();
2340
- }, "add");
2341
- add(ast.root);
2342
- if (text.length === 0)
2343
- queryError("query.missing-value", ast.root.span, "say which words to look for beside scope:", context);
2344
- return { text: text.join(" "), ...scope === void 0 ? {} : { scope } };
2345
- }, "memorySearch");
2346
-
2347
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/cli/documents/words.js
2348
- var wordsOf = /* @__PURE__ */ __name((words) => {
2349
- const profile = words.profile ?? "personal";
2350
- const place = words.place ?? words.provider;
2351
- const { provider } = words;
2352
- return {
2353
- ...words,
2354
- profile,
2355
- place,
2356
- prefix: `${words.app} ${profile}`,
2357
- text: {
2358
- documents: `read imported documents and ${provider} documents`,
2359
- documentsList: `list imported documents with their ${provider} URLs`,
2360
- documentArgument: `document id, ${provider} URL, or a search hit's document: ref`,
2361
- knowledgeArgument: `${provider} file or folder id or URL in the local catalog, or a document:<n> ref`,
2362
- catalog: `browse stored ${place} files and folders offline`,
2363
- catalogArgument: `${provider} file or folder id, or its URL`,
2364
- treeArgument: `${provider} folder id or URL; defaults to the explicitly selected profile's roots`,
2365
- folders: `choose the ${place} folders that sync imports`,
2366
- folderArgument: `folder id or ${place} URL`,
2367
- syncLimit: `how many documents to read from ${provider} in this run`,
2368
- identities: `the ${provider} accounts seen on a document, and the people they belong to`,
2369
- identitiesList: `list the people ${provider} shows for a document`,
2370
- identitiesLink: `record that a ${provider} account belongs to a known person`,
2371
- identityArgument: `${provider} account id, as identities list prints it`,
2372
- mirrors: `keep local folders mirrored into ${place}`,
2373
- mirrorsAdd: `mirror a local folder into ${place}`,
2374
- mirrorsSync: `sync both ways with ${place}; a part changed on both sides is reported`,
2375
- mirrorParent: `the ${place} folder to write into, by id or URL`,
2376
- ...words.text
2377
- }
2378
- };
2379
- }, "wordsOf");
2380
- var examples2 = /* @__PURE__ */ __name((command, lines) => annotate(command, { examples: lines }), "examples");
2381
- var positive = /* @__PURE__ */ __name((input) => {
2382
- const n = Number(input);
2383
- if (!Number.isSafeInteger(n) || n < 1)
2384
- throw new InvalidArgumentError("use a positive integer");
2385
- return n;
2386
- }, "positive");
2387
- var nonnegative = /* @__PURE__ */ __name((input) => {
2388
- const n = Number(input);
2389
- if (!Number.isSafeInteger(n) || n < 0)
2390
- throw new InvalidArgumentError("use a nonnegative integer");
2391
- return n;
2392
- }, "nonnegative");
2393
- var allOf = /* @__PURE__ */ __name((items) => listOf("", { items, limit: Math.max(1, items.length), has_more: false }), "allOf");
2394
- var documentsGroup = /* @__PURE__ */ __name((program, words) => program.commands.find((command) => command.name() === "documents") ?? annotate(program.command("documents"), { effects: { remote: "none", local: "read" } }).description(words.text.documents), "documentsGroup");
2395
- var DAY = 24 * 60 * 60 * 1e3;
2396
- var ageOf = /* @__PURE__ */ __name((lastSync, now = Date.now()) => {
2397
- const at = lastSync ? Date.parse(lastSync) : Number.NaN;
2398
- return Number.isNaN(at) ? { synced_at: null, age_days: null } : { synced_at: lastSync ?? null, age_days: Math.max(0, Math.floor((now - at) / DAY)) };
2399
- }, "ageOf");
2400
- var staleCopy = /* @__PURE__ */ __name((provider, lastSync, now = Date.now()) => {
2401
- const sync2 = defineSteps([
2402
- { id: "sync.run", command: "sync", args: [], why: `copy the changes ${provider} has made into the local store` }
2403
- ])[0];
2404
- const { synced_at, age_days } = ageOf(lastSync, now);
2405
- const old = synced_at === null || now - Date.parse(synced_at) > DAY;
2406
- if (!old)
2407
- return {};
2408
- const why = age_days === null ? `the local copy has no sync time; ${provider} may have changed the document since it was copied` : `the local copy was synced ${age_days} day${age_days === 1 ? "" : "s"} ago; ${provider} may have changed the document since`;
2409
- return {
2410
- missing: [{ field: "synced_at", why, step: sync2.id }],
2411
- next: [stepOf(sync2)],
2412
- meta: { complete: false }
2413
- };
2414
- }, "staleCopy");
2415
-
2416
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/cli/documents/catalog.js
2417
- var CATALOG_TREE_LIMIT = 1e4;
2418
- var CATALOG_PAGE = 1e3;
2419
- var PARENT_BATCH = 200;
2420
- var anyParent = /* @__PURE__ */ __name((ids) => {
2421
- const ast = parseLucene(Array.from({ length: Math.max(2, ids.length) }, () => "parent:x").join(" OR "), {
2422
- defaultField: "none"
2423
- });
2424
- const clauses = ast.root.clauses;
2425
- clauses.forEach((clause, i) => {
2426
- clause.node.value = ids[Math.min(i, ids.length - 1)];
2427
- });
2428
- return validateQuery(ast, CATALOG_QUERY);
2429
- }, "anyParent");
2430
- var catalogSource = /* @__PURE__ */ __name((catalog, principal) => ({
2431
- get: /* @__PURE__ */ __name((externalId) => catalog.get(principal, catalogId({ externalId })), "get"),
2432
- children: /* @__PURE__ */ __name((externalId, page) => catalog.list(principal, { parent: catalogId({ externalId }), ...page }), "children"),
2433
- // Each read scans the account's catalog, so the branches cut at the depth are asked about 200 at a time.
2434
- withChildren: /* @__PURE__ */ __name(async (externalIds) => {
2435
- const found = /* @__PURE__ */ new Set();
2436
- for (let start = 0; start < externalIds.length; start += PARENT_BATCH) {
2437
- const batch = new Set(externalIds.slice(start, start + PARENT_BATCH));
2438
- const ast = anyParent([...batch].map((externalId) => catalogId({ externalId })));
2439
- for (let offset = 0; ; offset += CATALOG_PAGE) {
2440
- const page = await catalog.list(principal, { ast, limit: CATALOG_PAGE, offset });
2441
- for (const item of page.items)
2442
- for (const parent of item.parents)
2443
- if (batch.delete(parent))
2444
- found.add(parent);
2445
- if (!page.hasMore || batch.size === 0)
2446
- break;
2447
- }
2448
- }
2449
- return found;
2450
- }, "withChildren")
2451
- }), "catalogSource");
2452
- var tooLarge = /* @__PURE__ */ __name((limit) => new CliError("validation_error", `the tree is over ${limit} entries; name a smaller FOLDER or lower --depth`, {
2453
- reason: "catalog.tree-limit"
2454
- }), "tooLarge");
2455
- var catalogTree = /* @__PURE__ */ __name(async (source, roots2, depth, limit = CATALOG_TREE_LIMIT) => {
2456
- if (!Number.isSafeInteger(depth) || depth < 0 || depth > 50)
2457
- throw new CliError("validation_error", "tree depth must be between 0 and 50", { reason: "catalog.depth-invalid" });
2458
- let nodes = 0;
2459
- const seen = /* @__PURE__ */ new Set();
2460
- const cut = [];
2461
- const cutIds = [];
2462
- const hasChildren = /* @__PURE__ */ __name(async (externalId) => (await source.children(externalId, { limit: 1, offset: 0 })).items.length > 0, "hasChildren");
2463
- const childrenOf = /* @__PURE__ */ __name(async (externalId) => {
2464
- const items = [];
2465
- for (let offset = 0; ; offset += CATALOG_PAGE) {
2466
- const page = await source.children(externalId, { limit: CATALOG_PAGE, offset });
2467
- for (const item of page.items)
2468
- items.push(item);
2469
- if (nodes + items.length > limit)
2470
- throw tooLarge(limit);
2471
- if (!page.hasMore)
2472
- return items;
2473
- }
2474
- }, "childrenOf");
2475
- const node = /* @__PURE__ */ __name(async (entry, level, ancestors) => {
2476
- if (ancestors.has(entry.externalId))
2477
- throw new CliError("invalid_response", "local folder ancestry contains a cycle", { reason: "catalog.cycle" });
2478
- if (++nodes > limit)
2479
- throw tooLarge(limit);
2480
- const tree = {
2481
- item: {
2482
- id: catalogId(entry),
2483
- ref: entry.ref,
2484
- name: entry.name,
2485
- kind: entry.kind,
2486
- url: entry.url,
2487
- content: entry.content
2488
- },
2489
- children: [],
2490
- truncated: false
2491
- };
2492
- if (seen.has(entry.externalId))
2493
- return { ...tree, repeated: true };
2494
- seen.add(entry.externalId);
2495
- if (level >= depth) {
2496
- cut.push(tree);
2497
- cutIds.push(entry.externalId);
2498
- return tree;
2499
- }
2500
- const next = new Set(ancestors).add(entry.externalId);
2501
- for (const child of await childrenOf(entry.externalId))
2502
- tree.children.push(await node(child, level + 1, next));
2503
- return tree;
2504
- }, "node");
2505
- const trees = [];
2506
- for (const id of roots2) {
2507
- const entry = await source.get(id);
2508
- if (!entry || entry.kind !== "folder" && !await hasChildren(entry.externalId))
2509
- throw new CliError("not_found", "no folder or page with sub-pages by that id in the active local catalog", {
2510
- reason: "catalog.not-found"
2511
- });
2512
- trees.push(await node(entry, 0, /* @__PURE__ */ new Set()));
2513
- }
2514
- const parents = source.withChildren ? await source.withChildren(cutIds) : new Set((await Promise.all(cutIds.map(async (id) => await hasChildren(id) ? id : ""))).filter(Boolean));
2515
- cut.forEach((tree, i) => {
2516
- tree.truncated = parents.has(cutIds[i]);
2517
- });
2518
- return trees;
2519
- }, "catalogTree");
2520
- var catalogId = /* @__PURE__ */ __name((entry) => entry.externalId.replace(/\.md$/, ""), "catalogId");
2521
- var catalogOutput = /* @__PURE__ */ __name((entry) => ({
2522
- id: catalogId(entry),
2523
- ref: entry.ref,
2524
- kind: entry.kind,
2525
- name: entry.name,
2526
- parents: entry.parents.map((id) => id.replace(/\.md$/, "")),
2527
- url: entry.url,
2528
- mime: entry.mime,
2529
- size: entry.size,
2530
- created_at: entry.createdAt,
2531
- modified_at: entry.modifiedAt,
2532
- observed_at: entry.observedAt,
2533
- description: entry.description,
2534
- actors: entry.actors,
2535
- provider_metadata: entry.metadata,
2536
- active: entry.active,
2537
- content: entry.content
2538
- }), "catalogOutput");
2539
- var CATALOG_FIELDS = Object.keys({
2540
- id: true,
2541
- ref: true,
2542
- kind: true,
2543
- name: true,
2544
- parents: true,
2545
- url: true,
2546
- mime: true,
2547
- size: true,
2548
- created_at: true,
2549
- modified_at: true,
2550
- observed_at: true,
2551
- description: true,
2552
- actors: true,
2553
- provider_metadata: true,
2554
- active: true,
2555
- content: true
2556
- });
2557
- var local = /* @__PURE__ */ __name((command, mutates = false) => annotate(command, { effects: mutates ? LOCAL_WRITE : LOCAL_READ }), "local");
2558
- var addDocumentCatalogCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
2559
- const { output } = helpers;
2560
- const wording = wordsOf(helpers.words);
2561
- const { prefix, text } = wording;
2562
- const queries = documentQueries();
2563
- const view = "catalog";
2564
- const catalog = local(program.command("catalog")).description(text.catalog);
2565
- const run3 = /* @__PURE__ */ __name((fn, write = false) => helpers.run(async (index, principal) => {
2566
- if (!index.catalog)
2567
- throw new CliError("configuration_error", "index has no shared catalog adapter", {
2568
- reason: "catalog.unavailable"
2569
- });
2570
- return fn({ ...index, catalog: index.catalog }, principal);
2571
- }, write), "run");
2572
- const entry = /* @__PURE__ */ __name(async (index, principal, id) => {
2573
- const found = await index.catalog?.get(principal, helpers.id(id));
2574
- if (!found)
2575
- throw new CliError("not_found", "file or folder is not in the active local catalog; run catalog import or sync", {
2576
- reason: "catalog.not-found"
2577
- });
2578
- return found;
2579
- }, "entry");
2580
- examples2(local(catalog.command("import").description("put cached file and folder metadata into the shared database"), true), [`${prefix} catalog import --offline`]).action(async () => output(itemOf(await run3((index, principal) => index.catalog.import(principal), true))));
2581
- examples2(annotate(local(catalog.command("show").description("show stored metadata and the stable file or folder reference")), {
2582
- output: { entity: "document", view }
2583
- }), [`${prefix} catalog show FILE_ID --offline`]).argument("<file>", text.catalogArgument).action(async (id) => output(itemOf(await run3(async (index, principal) => catalogOutput(await entry(index, principal, id))))));
2584
- const list = /* @__PURE__ */ __name(async (terms, args, search) => {
2585
- const ast = terms.length ? validateQuery(parseLucene(terms.join(" "), { defaultField: search ? "text" : "none" }), CATALOG_QUERY) : void 0;
2586
- const result = await run3((index, principal) => index.catalog.list(principal, { ast, limit: args.limit, offset: (args.page - 1) * args.limit }));
2587
- output(listOf(`catalog ${search ? "search" : "list"}`, {
2588
- items: result.items.map(catalogOutput),
2589
- limit: args.limit,
2590
- has_more: result.hasMore,
2591
- page: args.page,
2592
- args: { query: terms.length ? terms.join(" ") : void 0 }
2593
- }));
2594
- }, "list");
2595
- for (const action of ["list", "search"]) {
2596
- const command = examples2(local(catalog.command(action).description(action === "list" ? "list cached files and folders using metadata queries" : "search cached names, descriptions, types and observed people")), [
2597
- action === "list" ? `${prefix} catalog list "parent:FOLDER_ID AND kind:file" --offline` : `${prefix} catalog search "budget AND person:Rin*" --offline`
2598
- ]).argument(action === "list" ? "[query...]" : "<query...>", "metadata query: kind, mime, name, parent, person, tag; AND, OR, NOT").option("--limit <n>", "how many entries to return (at most 1000)", positive, 50).option("--page <n>", "which page to return", positive, 1).action(async (terms, args) => list(terms, args, action === "search"));
2599
- annotate(command, { query: CATALOG_QUERY, output: { entity: "document", view } });
2600
- }
2601
- examples2(local(catalog.command("tree").description("show the cached hierarchy below a folder or all selected roots")), [`${prefix} catalog tree --offline`, `${prefix} catalog tree FOLDER_ID --depth 3 --offline`]).argument("[folder]", text.treeArgument).option("--depth <n>", "maximum descendant depth, from 0 to 50", nonnegative, 5).action(async (id, args) => output(await run3(async (index, principal) => {
2602
- const roots2 = id ? [helpers.id(id)] : helpers.roots();
2603
- const tree = await catalogTree(catalogSource(index.catalog, principal), roots2.map((root) => `${root}.md`), args.depth);
2604
- return allOf(tree);
2605
- })));
2606
- const tags = local(catalog.command("tags")).description("add owner tags to cached files or folders");
2607
- for (const action of ["list", "add", "remove"]) {
2608
- const command = examples2(local(tags.command(action).description(`${action} local tags on a cached file or folder`), action !== "list"), [`${prefix} catalog tags ${action} FOLDER_ID${action === "list" ? "" : " project"} --offline`]).argument("<file>", text.catalogArgument);
2609
- if (action === "list")
2610
- bindQuery2(command, queries.tags, tagRow);
2611
- else
2612
- command.argument("<tags...>", "local tag names");
2613
- command.action(async (id, values2 = []) => {
2614
- const filter = action === "list" ? termsOf2(values2, queries.tags, "catalog tags list") : void 0;
2615
- return output(allOf(await run3(async (index, principal) => {
2616
- const found = await entry(index, principal, id);
2617
- if (!index.knowledge)
2618
- throw new CliError("configuration_error", "index has no shared knowledge adapter");
2619
- const tags2 = await index.knowledge.tags(principal, found.ref, action, action === "list" ? void 0 : values2, filter);
2620
- return action === "list" ? tags2.map((tag) => ({ tag })) : tags2;
2621
- }, action !== "list")));
2622
- });
2623
- }
2624
- }, "addDocumentCatalogCommandsDefinition");
2625
- var addDocumentCatalogCommands = honoursDryRun(sharedCommand(addDocumentCatalogCommandsDefinition));
2626
-
2627
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/cli/documents/documents.js
2628
- import { writeFileSync } from "node:fs";
2629
- var addLocalDocumentCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
2630
- const { output, lastSync } = helpers;
2631
- const wording = wordsOf(helpers.words);
2632
- const { prefix, provider, text } = wording;
2633
- const documents = documentsGroup(program, wording);
2634
- annotate(withQuery(examples2(annotate(documents.command("list"), { effects: LOCAL_READ }).description(text.documentsList), [
2635
- `${prefix} documents list`,
2636
- `${prefix} documents list tag:budget`,
2637
- `${prefix} documents list person:PERSON_UID --limit 10`
2638
- ]), IMPORTED_DOCUMENT_QUERY), { output: { entity: "document", view: "imported" }, partial: true }).option("--limit <n>", "how many documents to return", positive, 50).option("--page <n>", "which page to return", positive, 1).action(async (words, { limit, page }) => {
2639
- const query = typedQuery(words);
2640
- const ast = listQuery(query, IMPORTED_DOCUMENT_QUERY, "documents list");
2641
- const found = await helpers.list(ast, { limit, offset: (page - 1) * limit });
2642
- const synced = lastSync();
2643
- const age = ageOf(synced);
2644
- output(listOf("documents list", {
2645
- ...staleCopy(provider, synced),
2646
- items: found.items.map((item) => ({ ...item, ...age })),
2647
- limit,
2648
- has_more: found.hasMore,
2649
- page,
2650
- args: { query: query || void 0 }
2651
- }));
2652
- });
2653
- examples2(annotate(documents.command("show"), { effects: LOCAL_READ, partial: true }).argument("<document>", text.documentArgument).description("show an imported document's text, tabs and metadata"), [`${prefix} documents show DOC_ID`, `${prefix} documents show document:42 --offline`]).action((input) => {
2654
- const { metadata, snapshot } = helpers.document(input);
2655
- const synced = lastSync();
2656
- output(itemOf({
2657
- metadata,
2658
- ...ageOf(synced),
2659
- text: snapshot.text,
2660
- tabs: snapshot.tabs,
2661
- ...snapshot.notRead ? { not_read: snapshot.notRead } : {}
2662
- }, staleCopy(provider, synced)));
2663
- });
2664
- examples2(annotate(documents.command("export"), { effects: LOCAL_WRITE, partial: true }).argument("<document>", text.documentArgument).description("write an imported document to a new Markdown file"), [`${prefix} documents export DOC_ID --output notes.md`]).requiredOption("--output <file>", "path of the Markdown file to write; an existing file is refused").action((input, args) => {
2665
- const { id, snapshot } = helpers.document(input);
2666
- try {
2667
- writeFileSync(args.output, snapshot.markdown, { flag: "wx", mode: 384 });
2668
- } catch (error) {
2669
- if (error.code === "EEXIST")
2670
- throw new CliError("validation_error", "the output file already exists; choose another --output", {
2671
- reason: "export.exists",
2672
- param: "--output"
2673
- });
2674
- throw error;
2675
- }
2676
- const synced = lastSync();
2677
- output(itemOf({ id, path: args.output, format: "markdown", ...ageOf(synced) }, staleCopy(provider, synced)));
2678
- });
2679
- return documents;
2680
- }, "addLocalDocumentCommandsDefinition");
2681
- var addLocalDocumentCommands = honoursDryRun(sharedCommand(addLocalDocumentCommandsDefinition));
2682
-
2683
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/cli/documents/folders.js
2684
- var addDocumentFolderCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
2685
- const { output } = helpers;
2686
- const wording = wordsOf(helpers.words);
2687
- const { prefix, text } = wording;
2688
- const queries = documentQueries();
2689
- const folders = annotate(program.command("folders"), { effects: LOCAL_READ }).description(text.folders);
2690
- examples2(annotate(folders.command("add"), { effects: FETCH }).argument("<folder>", text.folderArgument).description("import a folder and everything under it on the next sync"), [`${prefix} folders add FOLDER_ID`]).action(async (input) => {
2691
- const { id, name } = await helpers.add(input);
2692
- output(itemOf({ id, name, added: true }));
2693
- });
2694
- bindQuery2(examples2(annotate(folders.command("list"), { effects: LOCAL_READ }).description("list the folder ids sync imports"), [`${prefix} folders list`]), queries.folders, folderRow).action((words) => {
2695
- const filter = termsOf2(words, queries.folders, "folders list");
2696
- output(allOf(helpers.list(filter)));
2697
- });
2698
- examples2(annotate(folders.command("remove"), { effects: LOCAL_WRITE }).argument("<folder>", text.folderArgument).description("stop importing a folder; the next sync drops its documents"), [`${prefix} folders remove FOLDER_ID`]).action((input) => {
2699
- output(itemOf({ id: helpers.remove(input), removed: true }));
2700
- });
2701
- return folders;
2702
- }, "addDocumentFolderCommandsDefinition");
2703
- var sharedFolderCommands = honoursDryRun(sharedCommand(addDocumentFolderCommandsDefinition));
2704
- var addDocumentFolderCommands = /* @__PURE__ */ __name((program, helpers) => {
2705
- const folders = sharedFolderCommands(program, helpers);
2706
- if (!helpers.browse)
2707
- return folders;
2708
- const before = new Set(folders.commands);
2709
- helpers.browse(folders);
2710
- const added = folders.commands.filter((command) => !before.has(command));
2711
- const children = folders.commands;
2712
- const rest = children.filter((command) => before.has(command));
2713
- const at = rest.findIndex((command) => command.name() === "remove");
2714
- children.splice(0, children.length, ...rest.slice(0, at), ...added, ...rest.slice(at));
2715
- return folders;
2716
- }, "addDocumentFolderCommands");
2717
-
2718
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/cli/documents/knowledge.js
2719
- var addDocumentKnowledgeCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
2720
- const { run: run3, output, author, decider } = helpers;
2721
- const wording = wordsOf(helpers.words);
2722
- const { prefix, text } = wording;
2723
- const queries = documentQueries();
2724
- const documentArgument = text.knowledgeArgument;
2725
- const scopes = ["personal", "work"];
2726
- const documents = documentsGroup(program, wording);
2727
- examples2(annotate(documents.command("context"), { effects: LOCAL_READ }).argument("<document>", documentArgument).description("show a document with its tags, relationships, notes, memories and editors"), [`${prefix} documents context DOC_ID`]).action(async (doc) => output(itemOf(await run3(doc, (k, p, ref) => k.context(p, ref)))));
2728
- const tags = annotate(program.command("tags"), { effects: LOCAL_READ }).description("label imported documents; labels survive a sync");
2729
- for (const action of ["list", "add", "remove"]) {
2730
- const command = examples2(annotate(tags.command(action), { effects: action === "list" ? LOCAL_READ : LOCAL_WRITE }).description(action === "list" ? "list a document's tags" : action === "add" ? "tag a document" : "untag a document").argument("<document>", documentArgument), [`${prefix} tags ${action} DOC_ID${action === "list" ? "" : " budget q3"}`]);
2731
- if (action === "list") {
2732
- bindQuery2(command, queries.tags, tagRow).action(async (doc, words) => {
2733
- const filter = termsOf2(words, queries.tags, "tags list");
2734
- output(allOf((await run3(doc, (k, p, ref) => k.tags(p, ref, "list", [], filter))).map((tag) => ({ tag }))));
2735
- });
2736
- } else
2737
- command.argument("<tags...>", "one or more tags").action(async (doc, values2) => output(itemOf({ tags: await run3(doc, (k, p, ref) => k.tags(p, ref, action, values2)) })));
2738
- }
2739
- const relationships = annotate(program.command("relationships"), { effects: LOCAL_READ }).description("connect a document to people, projects, notes and other references");
2740
- bindQuery2(examples2(annotate(relationships.command("list"), { effects: LOCAL_READ }).description("list a document's relationships"), [`${prefix} relationships list DOC_ID`]).argument("<document>", documentArgument), queries.links, linkRow).action(async (doc, words) => {
2741
- const { confirmed, ...filter } = termsOf2(words, queries.links, "relationships list");
2742
- output(allOf(await run3(doc, (k, p, ref) => k.links(p, ref, { ...filter, ...confirmed === void 0 ? {} : { confirmed: confirmed === "true" } }))));
2743
- });
2744
- examples2(annotate(relationships.command("add"), { effects: LOCAL_WRITE }).description("connect a document to another reference"), [
2745
- `${prefix} relationships add DOC_ID project:PROJECT_ID --kind about`,
2746
- `${prefix} relationships add DOC_ID person:PERSON_UID --kind assigned-to --role reviewer`
2747
- ]).argument("<document>", documentArgument).argument("<reference>", "what it connects to, such as person:<uid>, project:<id> or note:<id>").addOption(new Option("--kind <kind>", "how the two relate").choices(["links-to", "about", "evidence", "created-from", "related-to", "assigned-to"]).default("related-to")).option("--role <role>", "the part the reference plays, in a word or two").option("--reason <text>", "why the two are connected").action(async (doc, to, { reason, ...args }) => output(itemOf(await run3(doc, (k, p, ref) => k.addLink(p, ref, { to, ...args, by: decider(), ...reason ? { evidence: reason } : {} })))));
2748
- examples2(annotate(relationships.command("remove"), { effects: LOCAL_WRITE }).description("remove one of a document's relationships"), [`${prefix} relationships remove DOC_ID LINK_ID`]).argument("<document>", documentArgument).argument("<relationship-id>", "id, as relationships list prints it").action(async (doc, id) => output(itemOf(await run3(doc, (k, p, ref) => k.removeLink(p, ref, id, decider())))));
2749
- const notes = annotate(program.command("notes"), { effects: LOCAL_READ }).description("write notes about an imported document");
2750
- const noteArgument = "note:<id> reference, as notes list prints it";
2751
- examples2(annotate(notes.command("add"), {
2752
- effects: LOCAL_WRITE,
2753
- output: { entity: "note" },
2754
- literal_after_dashes: true
2755
- }).description("write a note about a document"), [`${prefix} notes add DOC_ID "Check the numbers" --title Review`]).argument("<document>", documentArgument).argument("<text>", "the note's text").option("--title <title>", "a title for the note").action(async (doc, text2, args) => output(itemOf(await run3(doc, (k, p, ref) => k.addNote(p, ref, text2, args.title)))));
2756
- withQuery(examples2(annotate(notes.command("list"), { effects: LOCAL_READ }).description("list a document's notes"), [
2757
- `${prefix} notes list DOC_ID`,
2758
- `${prefix} notes list DOC_ID text:review --limit 10`
2759
- ]).argument("<document>", documentArgument), queries.notes).option("--limit <n>", "how many notes to return", positive, 50).option("--page <n>", "which page to return", positive, 1).action(async (doc, words, { page, limit }) => {
2760
- const query = termsOf2(words, queries.notes, "notes list").text;
2761
- const found = await run3(doc, (k, p, ref) => k.notes(p, ref, { ...query ? { search: query } : {}, limit, offset: (page - 1) * limit }));
2762
- output(listOf("notes list", {
2763
- items: found.items,
2764
- limit,
2765
- has_more: found.hasMore,
2766
- page,
2767
- args: { document: doc, query: words.join(" ") }
2768
- }));
2769
- });
2770
- examples2(annotate(notes.command("show"), { effects: LOCAL_READ, output: { entity: "note" } }).description("show one note"), [`${prefix} notes show DOC_ID note:NOTE_ID`]).argument("<document>", documentArgument).argument("<note>", noteArgument).action(async (doc, noteRef) => output(itemOf(await run3(doc, (k, p, ref) => k.note(p, ref, noteRef)))));
2771
- examples2(annotate(notes.command("edit"), {
2772
- effects: LOCAL_WRITE,
2773
- output: { entity: "note" },
2774
- literal_after_dashes: true
2775
- }).description("replace a note's text"), [`${prefix} notes edit DOC_ID note:NOTE_ID "Numbers checked" --revision 2`]).argument("<document>", documentArgument).argument("<note>", noteArgument).argument("<text>", "the note's new text").requiredOption("--revision <n>", "revision from notes show; a newer note is not overwritten", positive).action(async (doc, noteRef, text2, args) => output(itemOf(await run3(doc, (k, p, ref) => k.editNote(p, ref, noteRef, text2, args.revision)))));
2776
- examples2(annotate(notes.command("remove"), { effects: LOCAL_WRITE }).description("delete one note"), [
2777
- `${prefix} notes remove DOC_ID note:NOTE_ID`
2778
- ]).argument("<document>", documentArgument).argument("<note>", noteArgument).action(async (doc, noteRef) => output(itemOf(await run3(doc, (k, p, ref) => k.removeNote(p, ref, noteRef)))));
2779
- const memories = annotate(program.command("memories"), { effects: LOCAL_READ }).description("keep what was learned from a document, with evidence; an agent's stay proposed");
2780
- const memoryArgument = "memory:<id> reference, as memories list prints it";
2781
- const scope = /* @__PURE__ */ __name((description) => new Option("--scope <scope>", description).choices(scopes), "scope");
2782
- examples2(annotate(memories.command("add"), { effects: LOCAL_WRITE }).description("record a memory about a document"), [`${prefix} memories add DOC_ID "The team prefers async reviews" --scope work --kind preference`]).argument("<document>", documentArgument).argument("<text>", "what to remember").addOption(scope("whose memory it is: personal or work").makeOptionMandatory()).addOption(new Option("--kind <kind>", "what kind of memory it is").choices(MEMORY_KINDS).default("summary")).option("--supersedes <ref>", "a memory:<id> about the same document that this one replaces").action(async (doc, body, args) => output(itemOf(memoryItem(await run3(doc, (k, p, ref) => k.addMemory(p, ref, { body, ...args, status: "proposed", author: author() }))))));
2783
- withQuery(examples2(annotate(memories.command("list"), { effects: LOCAL_READ }).description("list a document's memories"), [
2784
- `${prefix} memories list DOC_ID scope:work`,
2785
- `${prefix} memories list DOC_ID kind:preference status:confirmed`
2786
- ]).argument("<document>", documentArgument), MEMORY_QUERY).option("--limit <n>", "how many memories to return", positive, 50).action(async (doc, words, { limit }) => {
2787
- const terms = queryTerms(words, MEMORY_QUERY, "memories list");
2788
- const filters = {
2789
- ...terms.has("kind") ? { kind: terms.get("kind") } : {},
2790
- ...terms.has("status") ? { status: terms.get("status") } : {},
2791
- ...terms.has("scope") ? { scope: terms.get("scope") } : {}
2792
- };
2793
- output(allOf((await run3(doc, (k, p, ref) => k.memories(p, ref, { ...filters, limit }))).items.map(memoryItem)));
2794
- });
2795
- const memoryActions = {
2796
- show: "show one memory",
2797
- confirm: "confirm a proposed memory as true",
2798
- stale: "mark a memory as out of date"
2799
- };
2800
- for (const [action, description] of Object.entries(memoryActions))
2801
- examples2(annotate(memories.command(action), { effects: action === "show" ? LOCAL_READ : LOCAL_WRITE }).description(description), [`${prefix} memories ${action} DOC_ID memory:MEMORY_ID`]).argument("<document>", documentArgument).argument("<memory>", memoryArgument).action(async (doc, memoryRef) => output(itemOf(memoryItem(await run3(doc, (k, p, ref) => action === "show" ? k.memory(p, ref, memoryRef) : k.memory(p, ref, memoryRef, action, decider()))))));
2802
- const search = examples2(annotate(memories.command("search"), { effects: LOCAL_READ }).description("search a document's memories by words"), [`${prefix} memories search DOC_ID reviews scope:work`, `${prefix} memories search DOC_ID "async reviews"`]).argument("<document>", documentArgument).argument("<query...>", "words to look for, and scope:personal or scope:work \u2014 the fields are below").allowUnknownOption().addHelpText("after", queryHelp(MEMORY_SEARCH_QUERY)).action(async (doc, words) => {
2803
- const { text: text2, scope: scope2 } = memorySearch(words);
2804
- const found = await run3(doc, (k, p, ref) => k.searchMemories(p, ref, text2, scope2));
2805
- output({
2806
- ...allOf(found.items.map(memoryItem)),
2807
- ...found.hasMore ? { meta: { truncated: true } } : {}
2808
- });
2809
- });
2810
- annotate(search, { query: defineQuery(MEMORY_SEARCH_QUERY), output: { entity: "memory" } });
2811
- examples2(annotate(memories.command("extract"), { effects: REMOTE_WRITE }).argument("<document>", documentArgument).description("send a document's text to the model and show the memories it proposes"), [`${prefix} memories extract DOC_ID --scope work`, `${prefix} memories extract DOC_ID --scope work --yes`]).addOption(scope("whose memories they become: personal or work").makeOptionMandatory()).option("--tab <id>", "send only this tab of the document").option("--yes", "save the proposals, each with its quote and the document's version").action(async function(doc) {
2812
- const args = this.opts();
2813
- await run3(doc, async () => void 0);
2814
- const result = await extractDocumentMemories({
2815
- read: /* @__PURE__ */ __name(() => helpers.document(doc), "read"),
2816
- complete: helpers.complete(),
2817
- scope: args.scope,
2818
- author: `${wording.app}-memory`,
2819
- tab: args.tab,
2820
- save: args.yes,
2821
- withWrite: /* @__PURE__ */ __name((write) => run3(doc, write), "withWrite")
2822
- });
2823
- output(itemOf({ ...result, saved: result.saved.map((item) => "type" in item ? factItem(item) : memoryItem(item)) }));
2824
- });
2825
- const facts = annotate(program.command("facts"), { effects: LOCAL_READ }).description("what happened, as a document shows it; an agent's stay proposed until confirmed");
2826
- const factArgument = "fact:<id> reference, as facts list prints it";
2827
- examples2(annotate(facts.command("add"), { effects: LOCAL_WRITE }).description("record a fact a document shows"), [
2828
- `${prefix} facts add DOC_ID "Budget approved" --type decision --scope work`
2829
- ]).argument("<document>", documentArgument).argument("<statement>", "the fact, in one sentence").addOption(new Option("--type <type>", "what kind of fact it is").choices(FACT_TYPES).default("fact")).addOption(scope("whose fact it is: personal or work")).option("--supersedes <ref>", "a decision only: the decision this one replaces").option("--occurred-time <time>", "when it happened, as the evidence shows, ISO 8601; a time without a zone is read in this computer's zone, a date alone as its midnight").action(async (doc, statement, { occurredTime, ...args }) => output(itemOf(factItem(await run3(doc, (k, p, ref) => k.addFact(p, ref, {
2830
- statement,
2831
- ...args,
2832
- by: author(),
2833
- ...occurredTime === void 0 ? {} : { occurredAt: occurredTime }
2834
- }))))));
2835
- withQuery(examples2(annotate(facts.command("list"), { effects: LOCAL_READ }).description("list a document's facts"), [
2836
- `${prefix} facts list DOC_ID status:proposed`,
2837
- `${prefix} facts list DOC_ID kind:decision`
2838
- ]).argument("<document>", documentArgument), FACT_QUERY).option("--limit <n>", "how many facts to return", positive, 50).action(async (doc, words, { limit }) => {
2839
- const terms = queryTerms(words, FACT_QUERY, "facts list");
2840
- const filters = {
2841
- ...terms.has("kind") ? { type: terms.get("kind") } : {},
2842
- ...terms.has("status") ? { status: terms.get("status") } : {}
2843
- };
2844
- output(allOf((await run3(doc, (k, p, ref) => k.facts(p, ref, { ...filters, limit }))).items.map(factItem)));
2845
- });
2846
- const factActions = {
2847
- show: "show one fact",
2848
- confirm: "confirm a proposed fact; a decision it supersedes stops holding",
2849
- reverse: "an accepted decision no longer holds, and nothing replaced it"
2850
- };
2851
- for (const [action, description] of Object.entries(factActions))
2852
- examples2(annotate(facts.command(action), { effects: action === "show" ? LOCAL_READ : LOCAL_WRITE }).description(description), [`${prefix} facts ${action} DOC_ID fact:FACT_ID`]).argument("<document>", documentArgument).argument("<fact>", factArgument).action(async (doc, factRef) => output(itemOf(factItem(await run3(doc, (k, p, ref) => action === "show" ? k.fact(p, ref, factRef) : k.fact(p, ref, factRef, action, decider()))))));
2853
- const identities = annotate(program.command("identities"), { effects: LOCAL_READ }).description(text.identities);
2854
- bindQuery2(examples2(annotate(identities.command("list"), { effects: LOCAL_READ }).description(text.identitiesList), [
2855
- `${prefix} identities list DOC_ID`
2856
- ]).argument("<document>", documentArgument), queries.identities, identityRow).action(async (doc, words) => {
2857
- const filter = termsOf2(words, queries.identities, "identities list");
2858
- output(itemOf(await run3(doc, (k, p, ref) => k.people(p, ref, filter))));
2859
- });
2860
- examples2(annotate(identities.command("link"), { effects: LOCAL_WRITE }).description(text.identitiesLink), [
2861
- `${prefix} identities link DOC_ID ${wording.remote.toUpperCase()}_ID person:PERSON_UID`
2862
- ]).argument("<document>", documentArgument).argument(`<${wording.remote}-id>`, text.identityArgument).argument("<person>", "person:<uid> reference of someone already known").action(async (doc, remoteId, personRef) => output(itemOf(await run3(doc, (k, p, ref) => k.linkPerson(p, ref, remoteId, personRef)))));
2863
- }, "addDocumentKnowledgeCommandsDefinition");
2864
- var addDocumentKnowledgeCommands = honoursDryRun(sharedCommand(addDocumentKnowledgeCommandsDefinition));
2865
-
2866
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/cli/documents/mirrors.js
2867
- import { statSync } from "node:fs";
2868
- import { resolve } from "node:path";
2869
- var addDocumentMirrorCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
2870
- const { output } = helpers;
2871
- const wording = wordsOf(helpers.words);
2872
- const { app, prefix, provider, remote, text } = wording;
2873
- const queries = documentQueries();
2874
- const mirrors = annotate(program.command("mirrors"), { effects: LOCAL_READ }).description(text.mirrors);
2875
- const find = /* @__PURE__ */ __name((id) => {
2876
- const mirror = helpers.mirrors().find((item) => item.id === id);
2877
- if (!mirror)
2878
- throw new CliError("not_found", `no mirror ${id} in profile ${helpers.profile()}; see ${app} ${helpers.profile()} mirrors list`, {
2879
- reason: "mirror.not-found"
2880
- });
2881
- return mirror;
2882
- }, "find");
2883
- const syncing = /* @__PURE__ */ __name((connection) => ({
2884
- ...connection.sync,
2885
- stateOf: /* @__PURE__ */ __name((mirror) => helpers.stateOf(mirror), "stateOf"),
2886
- remote
2887
- }), "syncing");
2888
- const chosenOf = /* @__PURE__ */ __name((id) => {
2889
- const name = helpers.profile();
2890
- const chosen = id ? [find(id)] : helpers.mirrors();
2891
- if (!chosen.length)
2892
- throw new CliError("not_found", `profile ${name} has no mirrors; add one with ${app} ${name} mirrors add`, {
2893
- reason: "mirror.none"
2894
- });
2895
- return chosen;
2896
- }, "chosenOf");
2897
- examples2(annotate(mirrors.command("add"), { effects: FETCH }).argument("<path>", "local folder to mirror").requiredOption("--parent <id>", text.mirrorParent).description(text.mirrorsAdd), [`${prefix} mirrors add ./notes --parent FOLDER_ID`]).action(async (path, args) => {
2898
- const root = resolve(path);
2899
- let directory = false;
2900
- try {
2901
- directory = statSync(root).isDirectory();
2902
- } catch {
2903
- }
2904
- if (!directory)
2905
- throw new CliError("validation_error", "the path to mirror is not a folder", { reason: "mirror.not-folder" });
2906
- const parent = await helpers.parent(args.parent);
2907
- const folder = parent.id;
2908
- const id = mirrorId(root, folder);
2909
- const list = helpers.mirrors();
2910
- if (!list.some((mirror) => mirror.id === id))
2911
- list.push({ id, path: root, folder });
2912
- helpers.save(list);
2913
- output(itemOf({ id, path: root, folder, folder_name: parent.name, added: true }));
2914
- });
2915
- bindQuery2(examples2(annotate(mirrors.command("list"), { effects: LOCAL_READ }).description("list this profile's mirrors"), [
2916
- `${prefix} mirrors list`
2917
- ]), queries.mirrors, mirrorRow).action((words) => {
2918
- const filter = termsOf2(words, queries.mirrors, "mirrors list");
2919
- output(allOf(helpers.mirrors().filter((row) => Object.entries(filter).every(([key, value]) => row[key] === value))));
2920
- });
2921
- examples2(annotate(mirrors.command("remove"), { effects: LOCAL_WRITE }).argument("<id>", "mirror id from mirrors list").description(`stop mirroring a folder; nothing in ${wording.place} is changed or deleted`), [`${prefix} mirrors remove 1a2b3c4d`]).action((id) => {
2922
- find(id);
2923
- helpers.save(helpers.mirrors().filter((mirror) => mirror.id !== id));
2924
- output(itemOf({ id, removed: true }));
2925
- });
2926
- examples2(annotate(mirrors.command("status"), { effects: LOCAL_READ }).argument("[id]", "mirror id; every mirror of the profile when omitted").description(`show which local files the next sync would create or send; ${provider} is not asked`), [`${prefix} mirrors status`]).action(async (id) => {
2927
- const items = await mirrorStatus(id ? [find(id)] : helpers.mirrors(), helpers.kindOf, (mirror) => helpers.stateOf(mirror));
2928
- output(allOf(items.map(({ id: id2, folder, create, update: update2, unchanged, orphans, unsupported, remote_checked }) => ({
2929
- id: id2,
2930
- folder,
2931
- create: create.length,
2932
- update: update2.length,
2933
- unchanged,
2934
- orphans: orphans.length,
2935
- unsupported,
2936
- remote_checked
2937
- }))));
2938
- });
2939
- examples2(annotate(mirrors.command("sync"), { effects: REMOTE_WRITE }).argument("[id]", "mirror id; every mirror of the profile when omitted").addOption(new Option("--keep <side>", "where a part changed on both sides, keep this side").choices([
2940
- "local",
2941
- remote,
2942
- "both"
2943
- ])).option("--replace", `same as --keep local, and create again files deleted in ${provider}`).description(text.mirrorsSync), [
2944
- `${prefix} mirrors sync`,
2945
- `${prefix} mirrors sync 1a2b3c4d --keep ${remote}`,
2946
- `${prefix} mirrors sync 1a2b3c4d --replace`
2947
- ]).action(async (id, args) => {
2948
- const chosen = chosenOf(id);
2949
- if (args.replace && args.keep && args.keep !== "local")
2950
- throw new CliError("validation_error", `--replace keeps the local side; it cannot be combined with --keep ${remote} or both`);
2951
- const keep = args.replace ? "local" : args.keep === remote ? "remote" : args.keep;
2952
- const connection = await helpers.connect();
2953
- const { items, issues } = await syncMirrors({
2954
- ...syncing(connection),
2955
- mirrors: chosen,
2956
- ...keep ? { keep } : {},
2957
- recreate: args.replace === true
2958
- });
2959
- const body = allOf(items);
2960
- if (issues.length)
2961
- body.meta = { complete: false, issues };
2962
- output(body);
2963
- if (issues.length)
2964
- throw new CliError("provider_error", `some files were not synced; see conflicts, missing and errors, then rerun with --keep local, ${remote} or both`, { reason: "mirror.partial" });
2965
- });
2966
- examples2(annotate(mirrors.command("watch"), { effects: REMOTE_WRITE, lifetime: "persistent" }).argument("[id]", "mirror id; every mirror of the profile when omitted").option("--every <duration>", `how often to ask ${provider} for changes`, "60s").summary("keep syncing both ways until Ctrl-C or --timeout").description(`keep syncing both ways until Ctrl-C or --timeout: on each local save and each ${provider} change; a part changed on both sides is reported and left for mirrors sync --keep`), [`${prefix} mirrors watch`, `${prefix} mirrors watch 1a2b3c4d --every 2m --jsonl`]).action(async (id, args) => {
2967
- const pollMs = parseDuration(args.every, "--every");
2968
- if (pollMs < 1e4)
2969
- throw new CliError("validation_error", "--every must be at least 10s");
2970
- const chosen = chosenOf(id);
2971
- const signal = helpers.endsOnStop() ?? new AbortController().signal;
2972
- const connection = await helpers.connect();
2973
- const states = /* @__PURE__ */ __name((mirror) => helpers.stateOf(mirror), "states");
2974
- let token = await connection.startToken();
2975
- const remoteChanges = /* @__PURE__ */ __name(async () => {
2976
- let changed;
2977
- try {
2978
- const feed = await connection.changes(token);
2979
- token = feed.cursor;
2980
- changed = new Set(feed.items.map((item) => item.id));
2981
- } catch (error) {
2982
- if (!isCliError(error) || error.details?.reason !== "listing.too-large")
2983
- throw error;
2984
- token = await connection.startToken();
2985
- return "all";
2986
- }
2987
- return chosen.filter((mirror) => Object.values(states(mirror).read().entries).some((entry) => changed.has(entry.id))).map((mirror) => mirror.id);
2988
- }, "remoteChanges");
2989
- let cycles = 0;
2990
- for await (const event of watchMirrors((mirrors2) => syncMirrors({ ...syncing(connection), mirrors: mirrors2 }), {
2991
- mirrors: chosen,
2992
- signal,
2993
- kindOf: helpers.kindOf,
2994
- stateOf: states,
2995
- remoteChanges,
2996
- pollMs
2997
- })) {
2998
- cycles++;
2999
- const data = {
3000
- at: (/* @__PURE__ */ new Date()).toISOString(),
3001
- triggers: event.triggers,
3002
- mirrors: event.mirrors,
3003
- ..."error" in event ? { error: { code: event.error.code, message: event.error.message } } : { results: event.result.items, ...event.result.issues.length ? { issues: event.result.issues } : {} }
3004
- };
3005
- helpers.print((format, write) => write(format === "pretty" ? describeCycle(data) : JSON.stringify({ type: "item", data })));
3006
- }
3007
- helpers.print((format, write) => {
3008
- if (format === "pretty")
3009
- return;
3010
- const end = listOf("mirrors watch", {
3011
- items: [],
3012
- limit: Math.max(1, cycles),
3013
- has_more: false,
3014
- paging: "cursor",
3015
- meta: { complete: true }
3016
- });
3017
- for (const record2 of jsonlRecords(end))
3018
- write(JSON.stringify(record2));
3019
- });
3020
- });
3021
- }, "addDocumentMirrorCommandsDefinition");
3022
- var describeCycle = /* @__PURE__ */ __name((cycle) => {
3023
- const time = cycle.at.slice(11, 19);
3024
- if (cycle.error)
3025
- return `${time} ${cycle.triggers.join("+")}: ${cycle.error.message}; trying again`;
3026
- const parts = (cycle.results ?? []).map((result) => `${result.id} ${result.created.length} created, ${result.updated.length} sent, ${result.pulled.length} pulled` + (result.conflicts.length ? `, ${result.conflicts.length} conflicts (mirrors sync ${result.id} --keep \u2026)` : ""));
3027
- return `${time} ${cycle.triggers.join("+")}: ${parts.join("; ") || "nothing to do"}`;
3028
- }, "describeCycle");
3029
- var addDocumentMirrorCommands = honoursDryRun(sharedCommand(addDocumentMirrorCommandsDefinition));
3030
-
3031
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/cli/documents/search.js
3032
- var notImported = /* @__PURE__ */ __name((app, { profile, chosen, documents }) => {
3033
- if (documents > 0)
3034
- return void 0;
3035
- return !chosen ? `profile ${profile} has no folders selected, so nothing is imported to search \u2014 ${app} ${profile} folders add FOLDER_ID, then ${app} ${profile} sync` : `profile ${profile} has imported no documents yet \u2014 ${app} ${profile} sync`;
3036
- }, "notImported");
3037
- var addDocumentSearchCommandDefinition = /* @__PURE__ */ __name((program, helpers) => {
3038
- const wording = wordsOf(helpers.words);
3039
- const { prefix } = wording;
3040
- return examples2(annotate(program.command("search"), { effects: LOCAL_READ }).argument("<query>", "words to look for, and fields such as tag: and date: that every hit must match").description("search imported documents by words, and by meaning when indexed"), [`${prefix} search budget`, `${prefix} search "quarterly plan" --exact --limit 5`]).option("--limit <n>", "how many results to return", positive, 20).option("--page <n>", "which page to return", positive, 1).option("--exact", "match the words exactly: no word forms, no meaning").action(async (query, { page, ...args }) => {
3041
- const result = await helpers.search(query, {
3042
- ...args,
3043
- offset: (page - 1) * args.limit,
3044
- exact: args.exact ?? false
3045
- });
3046
- const hint = notImported(wording.app, helpers.imported());
3047
- helpers.output(itemOf(hint ? { ...result, not_imported: hint } : result));
3048
- });
3049
- }, "addDocumentSearchCommandDefinition");
3050
- var addDocumentSearchCommand = honoursDryRun(sharedCommand(addDocumentSearchCommandDefinition));
3051
-
3052
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/cli/documents/sync.js
3053
- var addDocumentSyncCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
3054
- const { output } = helpers;
3055
- const wording = wordsOf(helpers.words);
3056
- const { prefix, text } = wording;
3057
- const sync2 = examples2(annotate(program.command("sync"), { effects: FETCH }).summary("import what changed in the chosen folders, and finish an unfinished sync").description(`import what changed in the chosen folders, and finish an unfinished sync; one sync reads at most ${helpers.maxEntries} entries under the chosen folders, and as many changes`), [`${prefix} sync`, `${prefix} sync --rescan --limit 500`]).option("--limit <n>", text.syncLimit, positive, 200).option("--rescan", "read every chosen folder again instead of only what changed").option("--embed", "also index pending text for meaning search, with a model already downloaded").action(async (args) => {
3058
- const result = await helpers.sync(args);
3059
- output(itemOf(result, {
3060
- meta: result.errors.length ? {
3061
- complete: false,
3062
- issues: [{ code: "provider_error", reason: "sync.partial", source: wording.source }]
3063
- } : {}
3064
- }));
3065
- if (result.errors.length || result.pending)
3066
- helpers.diagnostic(`${result.pending} source operations remain; run ${wording.app} ${helpers.profile()} sync again
3067
- `);
3068
- if (result.errors.length)
3069
- throw new CliError("provider_error", "sync completed partially; failed operations remain pending", {
3070
- reason: "sync.partial"
3071
- });
3072
- });
3073
- const status = examples2(annotate(program.command("status"), { effects: LOCAL_READ }).description("show the last sync, imported documents and pending work"), [`${prefix} status`]).action(async () => {
3074
- output(itemOf(await helpers.status()));
3075
- });
3076
- return [sync2, status];
3077
- }, "addDocumentSyncCommandsDefinition");
3078
- var addDocumentSyncCommands = honoursDryRun(sharedCommand(addDocumentSyncCommandsDefinition));
3079
-
3080
2211
  // dist/catalog.js
3081
2212
  var catalogInput = /* @__PURE__ */ __name((file) => ({
3082
2213
  externalId: `${file.id}.md`,
@@ -3105,7 +2236,7 @@ var catalogInput = /* @__PURE__ */ __name((file) => ({
3105
2236
  }), "catalogInput");
3106
2237
 
3107
2238
  // dist/commands/context.js
3108
- var positive2 = /* @__PURE__ */ __name((input) => {
2239
+ var positive = /* @__PURE__ */ __name((input) => {
3109
2240
  const n = Number(input);
3110
2241
  if (!Number.isSafeInteger(n) || n < 1)
3111
2242
  throw new InvalidArgumentError("use a positive integer");
@@ -3434,7 +2565,7 @@ var installModelCommands = /* @__PURE__ */ __name((program, { env, output, strea
3434
2565
  const download = /* @__PURE__ */ __name(async (kind, id, acceptTerms) => {
3435
2566
  if (policyFlags().offline)
3436
2567
  throw offlineRefused("downloading a model needs the network");
3437
- const { downloadImageModel, downloadTextModel } = await import("./services-BDQBRXT5.js");
2568
+ const { downloadImageModel, downloadTextModel } = await import("./services-253KKKVU.js");
3438
2569
  const progress = /* @__PURE__ */ __name((line) => {
3439
2570
  if (!program.opts().quiet)
3440
2571
  streams.diagnostic(line);
@@ -3698,10 +2829,10 @@ var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
3698
2829
  });
3699
2830
  const state = readState(env, selected(), profile.principal);
3700
2831
  return {
3701
- items: found.items.map((note2) => {
3702
- const id = (note2.path ?? "").replace(/\.md$/, "");
2832
+ items: found.items.map((note) => {
2833
+ const id = (note.path ?? "").replace(/\.md$/, "");
3703
2834
  const doc = state.documents[id];
3704
- return doc ? { ...metadataJson(doc.metadata), reference: doc.reference, tabs: doc.tabs } : { id, name: note2.title, reference: note2.ref, tabs: 0 };
2835
+ return doc ? { ...metadataJson(doc.metadata), reference: doc.reference, tabs: doc.tabs } : { id, name: note.title, reference: note.ref, tabs: 0 };
3705
2836
  }),
3706
2837
  hasMore: found.hasMore
3707
2838
  };
@@ -3712,6 +2843,16 @@ var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
3712
2843
  }, "document"),
3713
2844
  lastSync: /* @__PURE__ */ __name(() => readState(env, selected(), activeProfile(env, selected()).principal).lastSync, "lastSync")
3714
2845
  });
2846
+ addDocumentHistoryCommands(program, {
2847
+ words: DRIVE_WORDS,
2848
+ output,
2849
+ run: /* @__PURE__ */ __name((fn) => withIndex((index) => {
2850
+ if (!index.history)
2851
+ throw new CliError("configuration_error", "index has no document history");
2852
+ return fn(index.history, activeProfile(env, selected()).principal);
2853
+ }), "run"),
2854
+ id: fileId
2855
+ });
3715
2856
  examples(annotate(documents.command("add"), { mcp: false, effects: FETCH }).argument("<url>", "Google Drive or Docs URL, or file id").description("keep a Drive document's text in memory, read by the first profile that opens it"), [
3716
2857
  "drive documents add https://docs.google.com/document/d/DOC_ID/edit --profiles work,personal",
3717
2858
  "drive personal documents add DOC_ID --subject person:PERSON_UID"
@@ -4539,7 +3680,7 @@ var fetchDoc = /* @__PURE__ */ __name(async (call, id) => {
4539
3680
  }, "fetchDoc");
4540
3681
  var docUrl = /* @__PURE__ */ __name((id) => `https://docs.google.com/document/d/${id}/edit`, "docUrl");
4541
3682
  var createDoc = /* @__PURE__ */ __name(async (call, input) => {
4542
- const local2 = await localBlocks(input.file);
3683
+ const local = await localBlocks(input.file);
4543
3684
  const created = await call("drive.files.create", { fields: "id,webViewLink", supportsAllDrives: true }, {
4544
3685
  name: input.name.replace(/\.md$/i, ""),
4545
3686
  mimeType: "application/vnd.google-apps.document",
@@ -4547,14 +3688,14 @@ var createDoc = /* @__PURE__ */ __name(async (call, input) => {
4547
3688
  appProperties: { wirecatOrigin: input.origin }
4548
3689
  });
4549
3690
  const empty = await fetchDoc(call, created.id);
4550
- const requests = editRequests(empty, local2);
3691
+ const requests = editRequests(empty, local);
4551
3692
  if (requests.length)
4552
3693
  await call("docs.documents.batchUpdate", { documentId: created.id }, { requests, writeControl: { requiredRevisionId: empty.revisionId } });
4553
3694
  const written = await fetchDoc(call, created.id);
4554
3695
  return {
4555
3696
  id: created.id,
4556
3697
  url: created.webViewLink ?? docUrl(created.id),
4557
- snapshot: { kind: "doc", written: written.placed.map((item) => item.block), local: local2 }
3698
+ snapshot: { kind: "doc", written: written.placed.map((item) => item.block), local }
4558
3699
  };
4559
3700
  }, "createDoc");
4560
3701
  var recoveredDoc = /* @__PURE__ */ __name(async (call, id) => {
@@ -4568,9 +3709,9 @@ var prepareDoc = /* @__PURE__ */ __name(async (call, input) => {
4568
3709
  if (doc.suggestions)
4569
3710
  return { conflict: "the Doc has pending suggestions; accept or reject them in Google first" };
4570
3711
  const text = readFileSync3(input.file.absolute, "utf8");
4571
- const local2 = representable(await markdownBlocks(text));
3712
+ const local = representable(await markdownBlocks(text));
4572
3713
  const current = doc.placed.map((item) => item.block);
4573
- const merged = mergeBlocks(recorded.local, recorded.written, local2, current, keep);
3714
+ const merged = mergeBlocks(recorded.local, recorded.written, local, current, keep);
4574
3715
  let next;
4575
3716
  if (merged.status === "unaligned") {
4576
3717
  if (!keep)
@@ -4578,7 +3719,7 @@ var prepareDoc = /* @__PURE__ */ __name(async (call, input) => {
4578
3719
  conflict: "the Doc no longer matches what the last sync wrote; choose a side with --keep",
4579
3720
  remote: await lastChange(call, id)
4580
3721
  };
4581
- next = keep === "local" ? local2 : keep === "remote" ? current : [...local2, ...current];
3722
+ next = keep === "local" ? local : keep === "remote" ? current : [...local, ...current];
4582
3723
  } else if (merged.status === "conflict")
4583
3724
  return {
4584
3725
  conflict: "the same part changed here and in Google",
@@ -4592,7 +3733,7 @@ var prepareDoc = /* @__PURE__ */ __name(async (call, input) => {
4592
3733
  else
4593
3734
  next = merged.blocks;
4594
3735
  let content;
4595
- if (!sameBlocks(local2, next)) {
3736
+ if (!sameBlocks(local, next)) {
4596
3737
  content = await spliceMarkdown(text, next, representable);
4597
3738
  if (content === void 0)
4598
3739
  return {
@@ -4727,10 +3868,10 @@ var installMirrorCommands = /* @__PURE__ */ __name((program, context, { call })
4727
3868
  var SYNC = defineSteps([
4728
3869
  { id: "sync.run", command: "sync", args: [], why: "copy the changes Google has made into the local store" }
4729
3870
  ])[0];
4730
- var freshness = /* @__PURE__ */ __name((remote, local2) => ({
4731
- changed: local2 === void 0 || Date.parse(remote) !== Date.parse(local2),
3871
+ var freshness = /* @__PURE__ */ __name((remote, local) => ({
3872
+ changed: local === void 0 || Date.parse(remote) !== Date.parse(local),
4732
3873
  remote_modified_at: remote,
4733
- local_modified_at: local2 ?? null
3874
+ local_modified_at: local ?? null
4734
3875
  }), "freshness");
4735
3876
  var changedCopy = /* @__PURE__ */ __name(({ changed, local_modified_at }) => {
4736
3877
  if (!changed)
@@ -4745,7 +3886,7 @@ var changedCopy = /* @__PURE__ */ __name(({ changed, local_modified_at }) => {
4745
3886
 
4746
3887
  // dist/download.js
4747
3888
  import { randomUUID } from "node:crypto";
4748
- import { closeSync, createWriteStream, linkSync, lstatSync, mkdirSync as mkdirSync2, openSync, renameSync, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
3889
+ import { closeSync, createWriteStream, linkSync, lstatSync, mkdirSync as mkdirSync2, openSync, renameSync, rmSync, writeFileSync } from "node:fs";
4749
3890
  import { dirname, join as join6 } from "node:path";
4750
3891
  import { pipeline } from "node:stream/promises";
4751
3892
  var EXPORT_FORMATS = {
@@ -4779,7 +3920,7 @@ var saveDownload = /* @__PURE__ */ __name(async (path, overwrite, read, createDi
4779
3920
  const fd = openSync(temp, "wx", 384);
4780
3921
  created = true;
4781
3922
  try {
4782
- writeFileSync2(fd, source);
3923
+ writeFileSync(fd, source);
4783
3924
  } finally {
4784
3925
  closeSync(fd);
4785
3926
  }
@@ -4837,7 +3978,7 @@ var snakeKeys2 = /* @__PURE__ */ __name((value, record2 = false) => {
4837
3978
  VERBATIM.has(key) ? item : snakeKeys2(item, RECORDS.has(key))
4838
3979
  ]));
4839
3980
  }, "snakeKeys");
4840
- var allOf2 = /* @__PURE__ */ __name((items) => listOf("", { items, limit: Math.max(1, items.length), has_more: false }), "allOf");
3981
+ var allOf = /* @__PURE__ */ __name((items) => listOf("", { items, limit: Math.max(1, items.length), has_more: false }), "allOf");
4841
3982
 
4842
3983
  // dist/generated/definitions.js
4843
3984
  var definitions = {
@@ -22266,11 +21407,11 @@ var sentParams = /* @__PURE__ */ __name((method, params) => {
22266
21407
  }, "sentParams");
22267
21408
  var zoneMeta = /* @__PURE__ */ __name((meta) => meta ? { meta } : {}, "zoneMeta");
22268
21409
  var installRemoteCommands = /* @__PURE__ */ __name((program, helpers) => {
22269
- const { call, output, positive: positive3 } = helpers;
22270
- const page = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many items one page holds", positive3, 100).option("--cursor <cursor>", "continue from page.next_cursor of the previous answer"), "page");
21410
+ const { call, output, positive: positive2 } = helpers;
21411
+ const page = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many items one page holds", positive2, 100).option("--cursor <cursor>", "continue from page.next_cursor of the previous answer"), "page");
22271
21412
  const fileArgument = "file id or Google Drive URL";
22272
21413
  const api = annotate(program.command("api"), { effects: LOCAL_READ }).description("discover and call the official Drive, Docs, Sheets and Activity API methods");
22273
- withQuery(examples(answerEntity(annotate(api.command("list"), { effects: NO_EFFECTS }).description("list the Google API methods drive can call"), "api_method", strictObject({ name: string(), mutates: boolean(), destructive: boolean(), scope: string() })), ["drive api list", "drive api list service:docs"]), API_METHOD_QUERY).action((words) => output(allOf2(apiMethods(queryTerms(words, API_METHOD_QUERY, "api list").get("service")))));
21414
+ withQuery(examples(answerEntity(annotate(api.command("list"), { effects: NO_EFFECTS }).description("list the Google API methods drive can call"), "api_method", strictObject({ name: string(), mutates: boolean(), destructive: boolean(), scope: string() })), ["drive api list", "drive api list service:docs"]), API_METHOD_QUERY).action((words) => output(allOf(apiMethods(queryTerms(words, API_METHOD_QUERY, "api list").get("service")))));
22274
21415
  examples(annotate(api.command("show"), { effects: NO_EFFECTS }).description("show one method's request schema and contract, without calling Google").argument("<method>", "Google method name, as api list prints it"), ["drive api show docs.documents.batchUpdate --json"]).action((method) => output(itemOf({ operation: operationOf(method), request_schema: requestSchema(method) })));
22275
21416
  examples(annotate(api.command("call"), { mcp: false, effects: GOOGLE_WRITE }).description("call one Google API method by name with JSON parameters").argument("<method>", "Google method name, as api list prints it"), [
22276
21417
  `drive personal api call drive.files.get --params '{"fileId":"FILE_ID"}'`,
@@ -22362,22 +21503,12 @@ var installRemoteCommands = /* @__PURE__ */ __name((program, helpers) => {
22362
21503
  `drive personal documents create --title "Meeting notes"`
22363
21504
  ]).requiredOption("--title <title>", "title of the new document").action(async (args) => output(itemOf(await call("docs.documents.create", {}, { title: args.title }))));
22364
21505
  examples(annotate(documents.command("update"), { effects: GOOGLE_WRITE }).description("change a Google Doc with a Docs batchUpdate request").argument("<document>", documentArgument), [`drive personal documents update DOC_ID --body '{"requests":[]}'`]).requiredOption("--body <json>", "Docs batchUpdate body: requests and an optional writeControl", jsonObject).action(async (id, args) => output(itemOf(await call("docs.documents.batchUpdate", { documentId: fileId(id) }, args.body))));
22365
- page(examples(annotate(documents.command("history"), { effects: GOOGLE_READ }).description("list the revisions Google kept, or who did what with --activity").argument("<document>", documentArgument), ["drive personal documents history DOC_ID", "drive personal documents history DOC_ID --activity"])).option("--activity", "list activity events instead of revisions; needs session start --grant activity").action(async (id, args) => {
22366
- const file = fileId(id);
22367
- const data = args.activity ? await call("driveactivity.activity.query", {}, {
22368
- itemName: `items/${file}`,
22369
- pageSize: args.limit,
22370
- ...args.cursor ? { pageToken: args.cursor } : {}
22371
- }) : await call("drive.revisions.list", {
22372
- fileId: file,
22373
- pageSize: args.limit,
22374
- ...args.cursor ? { pageToken: args.cursor } : {},
22375
- fields: "nextPageToken,revisions(id,mimeType,modifiedTime,lastModifyingUser(permissionId,displayName,emailAddress),size)"
22376
- });
22377
- output(pageOf("documents history", data, args.activity ? "activities" : "revisions", args.limit, {
22378
- document: id,
22379
- activity: args.activity
22380
- }));
21506
+ const activities = annotate(program.command("activities"), { effects: GOOGLE_READ }).description("read who did what with a file in Google Drive");
21507
+ const activityRow = looseObject({ timestamp: optional(string()) });
21508
+ const activityQuery = unfilteredQuery("drive_remote_activity", activityRow);
21509
+ bindQuery(page(examples(annotate(activities.command("list"), { effects: GOOGLE_READ }).description("list who did what with a file (needs session start --grant activity)").argument("<file>", fileArgument), ["drive personal activities list FILE_ID"])), activityQuery, activityRow).action(async (id, words, args) => {
21510
+ queryTerms(words, activityQuery, "activities list");
21511
+ return output(pageOf("activities list", await call("driveactivity.activity.query", {}, { itemName: `items/${fileId(id)}`, pageSize: args.limit, ...args.cursor ? { pageToken: args.cursor } : {} }), "activities", args.limit, { file: id }));
22381
21512
  });
22382
21513
  for (const resource of ["comments", "permissions", "revisions"]) {
22383
21514
  const one = resource.slice(0, -1);
@@ -22470,7 +21601,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
22470
21601
  const app = application(env, { file: args.clientFile, clientId: args.clientId, profile: selected() });
22471
21602
  if (!app.clientSecret)
22472
21603
  streams.diagnostic("your Google app has no secret here, and Google refuses a Desktop app without one: set DRIVE_GOOGLE_CLIENT_SECRET\n");
22473
- const { login } = await import("./login-6WG3YBDU.js");
21604
+ const { login } = await import("./login-WIY5VQU7.js");
22474
21605
  output(itemOf(await login({
22475
21606
  env,
22476
21607
  profile: selected(),
@@ -22501,7 +21632,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
22501
21632
  const name = selected();
22502
21633
  const config = readConfig(env);
22503
21634
  const profile = activeProfile(env, name);
22504
- const { credentials } = await import("./tokens-DB7O7QNB.js");
21635
+ const { credentials } = await import("./tokens-EHYO6D2X.js");
22505
21636
  const store = credentials(env, profile.storage, options.keyring);
22506
21637
  store.remove(name);
22507
21638
  writeConfig(env, config);
@@ -22516,14 +21647,14 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
22516
21647
  }, "installSessionCommands");
22517
21648
 
22518
21649
  // dist/store-import.js
22519
- import { readFileSync as readFileSync4, statSync as statSync2 } from "node:fs";
22520
- import { resolve as resolve2 } from "node:path";
21650
+ import { readFileSync as readFileSync4, statSync } from "node:fs";
21651
+ import { resolve } from "node:path";
22521
21652
  var transferBindings = /* @__PURE__ */ __name((path) => {
22522
21653
  if (path === void 0)
22523
21654
  return {};
22524
21655
  let parsed;
22525
21656
  try {
22526
- const stat = statSync2(path);
21657
+ const stat = statSync(path);
22527
21658
  if (!stat.isFile() || stat.size > 256 * 1024)
22528
21659
  throw new Error("bounds");
22529
21660
  parsed = JSON.parse(readFileSync4(path, "utf8"));
@@ -22537,7 +21668,7 @@ var transferBindings = /* @__PURE__ */ __name((path) => {
22537
21668
  var selection = /* @__PURE__ */ __name((env, name, source) => {
22538
21669
  const profile = activeProfile(env, name);
22539
21670
  const state = readState(env, name, profile.principal);
22540
- const destination = resolve2(storePath(env));
21671
+ const destination = resolve(storePath(env));
22541
21672
  for (const [id] of Object.entries(state.documents)) {
22542
21673
  const snapshot = readSnapshot(env, name, id);
22543
21674
  if (snapshot.metadata.id !== id)
@@ -22548,7 +21679,7 @@ var selection = /* @__PURE__ */ __name((env, name, source) => {
22548
21679
  return { profile, state, options: { source, destination, collection: `google-drive:${profile.principal}`, env } };
22549
21680
  }, "selection");
22550
21681
  var checkStoreImport = /* @__PURE__ */ __name(async (env, name, source, bindings) => {
22551
- const { ensureSqlite } = await import("./sqlite-runtime-ZSZGAUYB.js");
21682
+ const { ensureSqlite } = await import("./sqlite-runtime-EZASGJXW.js");
22552
21683
  await ensureSqlite();
22553
21684
  const { state, options } = selection(env, name, source);
22554
21685
  const preview = await previewDocumentTransfer({ ...options, bindings });
@@ -22557,7 +21688,7 @@ var checkStoreImport = /* @__PURE__ */ __name(async (env, name, source, bindings
22557
21688
  if (!stored || stored.content_hash !== document.hash)
22558
21689
  throw new CliError("configuration_error", "source content does not match the cached profile checkpoint; the original checkpoint was kept");
22559
21690
  }
22560
- if (resolve2(state.store ?? "") === options.destination && !preview.already_transferred)
21691
+ if (resolve(state.store ?? "") === options.destination && !preview.already_transferred)
22561
21692
  throw new CliError("configuration_error", "this profile already uses the selected store; only an existing transfer can be retried");
22562
21693
  return preview;
22563
21694
  }, "checkStoreImport");
@@ -22609,16 +21740,16 @@ var installStoreCommands = /* @__PURE__ */ __name((program, context) => {
22609
21740
 
22610
21741
  // dist/commands/sync.js
22611
21742
  import { existsSync } from "node:fs";
22612
- import { join as join7, resolve as resolve4 } from "node:path";
21743
+ import { join as join7, resolve as resolve3 } from "node:path";
22613
21744
 
22614
21745
  // dist/sync.js
22615
- import { resolve as resolve3 } from "node:path";
21746
+ import { resolve as resolve2 } from "node:path";
22616
21747
  var MESSAGE_LINKS_VERSION = 1;
22617
21748
  var skipReason = /* @__PURE__ */ __name((file) => !file.canDownload ? "downloads restricted" : supported(file) ? void 0 : `unsupported type: ${file.mime}`, "skipReason");
22618
21749
  var retryable = /* @__PURE__ */ __name((skip, limit) => skip.reason === "downloads restricted" || skip.reason.startsWith("unsupported type: ") || skip.textLimit !== void 0 && skip.textLimit < limit || // The store's own bounds change only with the shared package drive pins.
22619
21750
  skip.storeRefusedIn !== void 0 && skip.storeRefusedIn !== VERSION || // 0.2.0 and earlier skipped text over 200 000 characters with this reason and no recorded limit.
22620
21751
  skip.reason.startsWith("document exceeds the ingestion bound") && limit > 2e5, "retryable");
22621
- var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal, rescan = false) => {
21752
+ var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal, rescan = false, run3 = {}) => {
22622
21753
  const profile = activeProfile(env, name);
22623
21754
  const lock = await lockProfile(env, name);
22624
21755
  try {
@@ -22629,6 +21760,8 @@ var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal,
22629
21760
  const query = transcriptQuery(transcripts.mode, transcripts.words, source?.search);
22630
21761
  const result = await syncDocuments({
22631
21762
  ...query ? { query } : {},
21763
+ ...run3.budget ? { budget: run3.budget } : {},
21764
+ ...run3.deadline ? { deadline: run3.deadline } : {},
22632
21765
  source,
22633
21766
  index,
22634
21767
  principal: profile.principal,
@@ -22638,8 +21771,8 @@ var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal,
22638
21771
  rescan,
22639
21772
  pictures: profile.picture_search,
22640
21773
  textLimit: textLimit(env, name),
21774
+ keepVersionsForDays: keepVersions(env, name),
22641
21775
  maxEntries: MAX_ENTRIES,
22642
- limitError: tooManyEntries,
22643
21776
  isFolder: /* @__PURE__ */ __name((file) => file.mime === FOLDER, "isFolder"),
22644
21777
  skipReason,
22645
21778
  retryable,
@@ -22648,7 +21781,7 @@ var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal,
22648
21781
  storeVersion: VERSION,
22649
21782
  state: {
22650
21783
  read: /* @__PURE__ */ __name(() => readState(env, name, profile.principal), "read"),
22651
- save: /* @__PURE__ */ __name((state) => saveState(env, name, { ...state, store: resolve3(storePath(env)) }), "save"),
21784
+ save: /* @__PURE__ */ __name((state) => saveState(env, name, { ...state, store: resolve2(storePath(env)) }), "save"),
22652
21785
  readWalk: /* @__PURE__ */ __name((scope) => readWalk(env, name, scope), "readWalk"),
22653
21786
  saveWalk: /* @__PURE__ */ __name((walk) => saveWalk(env, name, walk), "saveWalk"),
22654
21787
  removeWalk: /* @__PURE__ */ __name(() => removeWalk(env, name), "removeWalk"),
@@ -22689,10 +21822,18 @@ var installSyncCommands = /* @__PURE__ */ __name((program, context) => {
22689
21822
  sync: /* @__PURE__ */ __name(async (args) => {
22690
21823
  const profile = activeProfile(env, selected());
22691
21824
  const remote = profile.roots.length || profile.transcripts === "include" ? await source() : void 0;
22692
- return withIndex(async (index) => ({
22693
- ...await sync(remote, index, env, selected(), args.limit, context.signal(), args.rescan),
22694
- ...args.embed ? { embeddings: await index.embed(600) } : {}
22695
- }));
21825
+ return withIndex(async (index) => {
21826
+ const result = await sync(remote, index, env, selected(), args.limit, context.signal(), args.rescan, {
21827
+ budget: args.budget,
21828
+ deadline: args.deadline
21829
+ });
21830
+ if (!args.embed)
21831
+ return result;
21832
+ const stopped = result.stopped ?? args.budget?.take();
21833
+ if (stopped)
21834
+ return { ...result, embeddings: { skipped: stopped, next: "the next sync --embed goes on" } };
21835
+ return { ...result, embeddings: await index.embed(600) };
21836
+ });
22696
21837
  }, "sync"),
22697
21838
  status: /* @__PURE__ */ __name(() => {
22698
21839
  const name = selected();
@@ -22702,8 +21843,8 @@ var installSyncCommands = /* @__PURE__ */ __name((program, context) => {
22702
21843
  return {
22703
21844
  profile: name,
22704
21845
  store: {
22705
- selected: resolve4(storePath(env)),
22706
- checkpoint: state.store ?? (existsSync(legacyStore) ? resolve4(legacyStore) : null)
21846
+ selected: resolve3(storePath(env)),
21847
+ checkpoint: state.store ?? (existsSync(legacyStore) ? resolve3(legacyStore) : null)
22707
21848
  },
22708
21849
  selected_folders: profile.roots,
22709
21850
  documents: Object.keys(state.documents).length,
@@ -22744,14 +21885,14 @@ var installTranscriptCommands = /* @__PURE__ */ __name((program, context) => {
22744
21885
  owned_by_me: file.providerMetadata?.ownedByMe ?? null,
22745
21886
  modified_at: file.modifiedAt ?? null
22746
21887
  }));
22747
- output(allOf2(rows.filter((row) => filter.owned_by_me === void 0 || String(row.owned_by_me) === filter.owned_by_me)));
21888
+ output(allOf(rows.filter((row) => filter.owned_by_me === void 0 || String(row.owned_by_me) === filter.owned_by_me)));
22748
21889
  });
22749
21890
  }, "installTranscriptCommands");
22750
21891
 
22751
21892
  // dist/commands/upgrade.js
22752
21893
  import { join as join8 } from "node:path";
22753
21894
 
22754
- // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/update/index.js
21895
+ // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.128.0_commander@15.0.0_esbuild@0.28.2_typ_a55806ccf2eb39d6be3eaf4c54d1a60a/node_modules/@wirecat/cli-core/dist/update/index.js
22755
21896
  import { realpathSync } from "node:fs";
22756
21897
  import { fileURLToPath } from "node:url";
22757
21898
  var npmRegistry = /* @__PURE__ */ __name(() => hostFetch({ hosts: ["registry.npmjs.org"] }), "npmRegistry");
@@ -22904,7 +22045,8 @@ var FIRST_SCREEN = {
22904
22045
  { command: "sync --embed", does: "import what changed and index it by meaning" },
22905
22046
  { command: 'search "budget decision"', does: "every imported document, by words and meaning" },
22906
22047
  { command: "documents context <doc>", does: "a document with its tags, notes and editors" },
22907
- { command: "documents history <doc> --activity", does: "who did what (needs --grant activity)" },
22048
+ { command: "documents history <doc>", does: "earlier versions kept by sync" },
22049
+ { command: "activities list <doc>", does: "who did what (needs --grant activity)" },
22908
22050
  { command: "memories extract <doc>", does: "memories with exact quotes, proposed by a model" },
22909
22051
  { command: "documents export <doc>", does: "Markdown in a new file (--output); never overwrites" },
22910
22052
  { command: "--read-only \u2026", does: "this run refuses every change" }
@@ -22963,9 +22105,9 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
22963
22105
  const port = {
22964
22106
  ...shared,
22965
22107
  context: /* @__PURE__ */ __name(async (principal, ref) => {
22966
- const note2 = await document(principal, ref);
22108
+ const note = await document(principal, ref);
22967
22109
  return {
22968
- document: note2,
22110
+ document: note,
22969
22111
  tags: await store.notes.noteTags(ref),
22970
22112
  links: await store.notes.links({ from: ref }),
22971
22113
  notes: await store.notes.notes({ source: "internal", about: ref, limit: 100 }),
@@ -22975,8 +22117,8 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
22975
22117
  };
22976
22118
  }, "context"),
22977
22119
  people: /* @__PURE__ */ __name(async (principal, ref, filter = {}) => {
22978
- const note2 = await document(principal, ref);
22979
- const metadata = note2.frontMatter;
22120
+ const note = await document(principal, ref);
22121
+ const metadata = note.frontMatter;
22980
22122
  const contributors = [
22981
22123
  ...(metadata.owners ?? []).map((user) => ({ ...user, role: "owner" })),
22982
22124
  ...metadata.lastModifiedBy ? [{ ...metadata.lastModifiedBy, role: "last-editor" }] : []
@@ -22996,8 +22138,8 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
22996
22138
  };
22997
22139
  }, "people"),
22998
22140
  linkPerson: /* @__PURE__ */ __name(async (principal, ref, googleId, personRef) => {
22999
- const note2 = await document(principal, ref);
23000
- const metadata = note2.frontMatter;
22141
+ const note = await document(principal, ref);
22142
+ const metadata = note.frontMatter;
23001
22143
  const users = [...metadata.owners ?? [], ...metadata.lastModifiedBy ? [metadata.lastModifiedBy] : []];
23002
22144
  if (!users.some((user) => googleUserId(user) === googleId))
23003
22145
  throw new CliError("not_found", "Google identity was not observed on this document");
@@ -23074,19 +22216,19 @@ var saveContributors = /* @__PURE__ */ __name(async (store, principal, metadata,
23074
22216
 
23075
22217
  // dist/store-transition.js
23076
22218
  import { existsSync as existsSync2 } from "node:fs";
23077
- import { join as join9, resolve as resolve5 } from "node:path";
22219
+ import { join as join9, resolve as resolve4 } from "node:path";
23078
22220
  var prepareStore = /* @__PURE__ */ __name(async (index, env, name, rescan = false) => {
23079
22221
  const profile = activeProfile(env, name);
23080
- const target = resolve5(storePath(env));
22222
+ const target = resolve4(storePath(env));
23081
22223
  const current = readState(env, name, profile.principal);
23082
- if (current.store && resolve5(current.store) === target) {
22224
+ if (current.store && resolve4(current.store) === target) {
23083
22225
  await index.registerProfile?.(name, profile.principal);
23084
22226
  return;
23085
22227
  }
23086
22228
  const lock = await lockProfile(env, name);
23087
22229
  try {
23088
22230
  const state = readState(env, name, profile.principal);
23089
- const previous = resolve5(state.store ?? join9(paths(env).state, "drive.db"));
22231
+ const previous = resolve4(state.store ?? join9(paths(env).state, "drive.db"));
23090
22232
  if (previous !== target && existsSync2(previous)) {
23091
22233
  const old = await openStore({ path: previous, env, command: "drive", version: VERSION });
23092
22234
  try {
@@ -23095,13 +22237,13 @@ var prepareStore = /* @__PURE__ */ __name(async (index, env, name, rescan = fals
23095
22237
  if (folder) {
23096
22238
  for (let offset = 0; ; offset += 500) {
23097
22239
  const page = await old.notes.notes({ folderId: folder.id, source: "file", limit: 500, offset });
23098
- for (const note2 of page.items) {
23099
- counts.tags += (await old.notes.noteTags(note2.ref)).length;
23100
- counts.notes += (await old.notes.notes({ source: "internal", about: note2.ref, limit: 1 })).items.length;
23101
- counts.memories += (await old.memories.list({ subject: note2.ref, limit: 1 })).items.length;
23102
- counts.facts += (await old.facts.list({ subject: note2.ref, limit: 1 })).items.length;
23103
- counts.links += (await old.notes.links({ from: note2.ref })).filter((link) => link.origin !== "file").length;
23104
- counts.links += (await old.notes.links({ to: note2.ref })).length;
22240
+ for (const note of page.items) {
22241
+ counts.tags += (await old.notes.noteTags(note.ref)).length;
22242
+ counts.notes += (await old.notes.notes({ source: "internal", about: note.ref, limit: 1 })).items.length;
22243
+ counts.memories += (await old.memories.list({ subject: note.ref, limit: 1 })).items.length;
22244
+ counts.facts += (await old.facts.list({ subject: note.ref, limit: 1 })).items.length;
22245
+ counts.links += (await old.notes.links({ from: note.ref })).filter((link) => link.origin !== "file").length;
22246
+ counts.links += (await old.notes.links({ to: note.ref })).length;
23105
22247
  }
23106
22248
  if (!page.hasMore)
23107
22249
  break;
@@ -23179,7 +22321,7 @@ var openIndex = /* @__PURE__ */ __name(async (env, name, rescan = false) => {
23179
22321
  activeProfile(env, name);
23180
22322
  if (env.DRIVE_STORE)
23181
22323
  throw new CliError("configuration_error", "DRIVE_STORE has been retired; use MESSAGING_STORE to select the shared database", { reason: "store.override-retired" });
23182
- const { openAppStore } = await import("./cli-K4D4DIGQ.js");
22324
+ const { openAppStore } = await import("./cli-2P5FW2RL.js");
23183
22325
  const store = await openAppStore(env, { app: { command: "drive", version: VERSION }, provider: DRIVE_PROVIDER });
23184
22326
  const index = indexOver(store, env);
23185
22327
  try {
@@ -23194,6 +22336,7 @@ var openIndex = /* @__PURE__ */ __name(async (env, name, rescan = false) => {
23194
22336
  var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23195
22337
  const ingestion = documentIngestion(store, {
23196
22338
  provider: "google-drive",
22339
+ command: "drive",
23197
22340
  externalId: /* @__PURE__ */ __name((id) => `${id}.md`, "externalId"),
23198
22341
  catalogInput,
23199
22342
  observed: /* @__PURE__ */ __name((principal, file, id) => saveContributors(store, principal, file, id), "observed"),
@@ -23214,10 +22357,6 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23214
22357
  const folder = ingestion.collection;
23215
22358
  return {
23216
22359
  ...ingestion,
23217
- registerProfile: /* @__PURE__ */ __name(async (name, principal) => {
23218
- await folder(principal, true);
23219
- await store.accounts.saveProfile("drive", name, { provider: "google-drive", account: principal });
23220
- }, "registerProfile"),
23221
22360
  addSource: /* @__PURE__ */ __name(async (input, driveFileId) => {
23222
22361
  const synced = driveFileId === void 0 ? void 0 : await syncedDocument(store, driveFileId);
23223
22362
  if (!synced)
@@ -23230,7 +22369,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23230
22369
  linkMessages: /* @__PURE__ */ __name((documents, since) => store.notes.linkMessages({ documents, ...since ? { since } : {} }), "linkMessages"),
23231
22370
  knowledge: documentKnowledge2(store, async (principal) => (await folder(principal, false))?.id),
23232
22371
  openPictures: /* @__PURE__ */ __name(async () => {
23233
- const { openPictureEmbedderFor, savePicture } = await import("./services-BDQBRXT5.js");
22372
+ const { openPictureEmbedderFor, savePicture } = await import("./services-253KKKVU.js");
23234
22373
  const embedder = pictureEmbedder ?? await openPictureEmbedderFor({ env, command: "drive" });
23235
22374
  return {
23236
22375
  save: /* @__PURE__ */ __name((reference, bytes) => savePicture(store, { ref: reference }, bytes, { embedder }), "save"),
@@ -23249,7 +22388,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23249
22388
  has_more: false,
23250
22389
  meaning_skipped: "this Google account has no imported sources"
23251
22390
  };
23252
- const { searchNotes } = await import("./services-BDQBRXT5.js");
22391
+ const { searchNotes } = await import("./services-253KKKVU.js");
23253
22392
  const result = await searchNotes(store, query, {
23254
22393
  ...options,
23255
22394
  folderIds: selected ? [selected.id] : [],
@@ -23258,9 +22397,9 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23258
22397
  ...pictureEmbedder ? { pictureEmbedder } : {}
23259
22398
  });
23260
22399
  const pictures = await Promise.all((result.pictures ?? []).map(async (picture) => {
23261
- const note2 = await store.notes.note(picture.ref);
22400
+ const note = await store.notes.note(picture.ref);
23262
22401
  const [file] = await store.files.ofDocument(picture.ref);
23263
- return { ...picture, title: note2.title, url: file?.url ?? null };
22402
+ return { ...picture, title: note.title, url: file?.url ?? null };
23264
22403
  }));
23265
22404
  const { pictures: _, items, hasMore, nextOffset, ...rest } = result;
23266
22405
  return {
@@ -23269,20 +22408,20 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23269
22408
  ...nextOffset === void 0 ? {} : { next_offset: nextOffset },
23270
22409
  ...result.pictures ? { pictures } : {},
23271
22410
  hits: await Promise.all(items.map(async (hit) => {
23272
- const note2 = await store.notes.note(hit.ref);
23273
- const metadata = note2.frontMatter;
23274
- const entry = note2.path ? await store.catalog.get(selected.id, note2.path) : void 0;
22411
+ const note = await store.notes.note(hit.ref);
22412
+ const metadata = note.frontMatter;
22413
+ const entry = note.path ? await store.catalog.get(selected.id, note.path) : void 0;
23275
22414
  return {
23276
22415
  ...hit,
23277
22416
  tabs: Array.isArray(metadata?.tabs) ? metadata.tabs : [],
23278
22417
  content: entry?.content ?? "indexed",
23279
- not_read: typeof metadata?.notRead === "string" ? metadata.notRead : entry?.content === "metadata" ? entry.kind === "folder" ? "folder metadata only" : "content is not indexed yet" : null
22418
+ not_read: typeof metadata?.notRead === "string" ? metadata.notRead : entry?.content === "metadata" ? "content is not indexed yet" : null
23280
22419
  };
23281
22420
  }))
23282
22421
  };
23283
22422
  }, "search"),
23284
22423
  embed: /* @__PURE__ */ __name(async (max) => {
23285
- const { embedNotes } = await import("./services-BDQBRXT5.js");
22424
+ const { embedNotes } = await import("./services-253KKKVU.js");
23286
22425
  return embedNotes(store, { maxChunks: max, env, command: "drive" });
23287
22426
  }, "embed"),
23288
22427
  close: /* @__PURE__ */ __name(() => store.close(), "close")
@@ -23291,9 +22430,9 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23291
22430
 
23292
22431
  // dist/upload.js
23293
22432
  import { createHash as createHash3 } from "node:crypto";
23294
- import { createReadStream, mkdirSync as mkdirSync3, readFileSync as readFileSync5, rmSync as rmSync2, statSync as statSync3, writeFileSync as writeFileSync3 } from "node:fs";
22433
+ import { createReadStream, mkdirSync as mkdirSync3, readFileSync as readFileSync5, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
23295
22434
  import { open } from "node:fs/promises";
23296
- import { basename, join as join10, resolve as resolve6 } from "node:path";
22435
+ import { basename, join as join10, resolve as resolve5 } from "node:path";
23297
22436
  var START = "https://www.googleapis.com/upload/drive/v3/files";
23298
22437
  var FIELDS = "id,name,size,md5Checksum,mimeType,parents";
23299
22438
  var QUANTUM = 256 * 1024;
@@ -23308,10 +22447,10 @@ var nextByte = /* @__PURE__ */ __name((response) => {
23308
22447
  }, "nextByte");
23309
22448
  var done = /* @__PURE__ */ __name((status) => status === 200 || status === 201, "done");
23310
22449
  var uploadFile = /* @__PURE__ */ __name(async (input) => {
23311
- const path = resolve6(input.path);
22450
+ const path = resolve5(input.path);
23312
22451
  let stat;
23313
22452
  try {
23314
- stat = statSync3(path);
22453
+ stat = statSync2(path);
23315
22454
  } catch {
23316
22455
  throw new CliError("validation_error", "the file to upload could not be read", { reason: "file.unreadable" });
23317
22456
  }
@@ -23341,7 +22480,7 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
23341
22480
  modified_ms: stat.mtimeMs,
23342
22481
  saved_at: (/* @__PURE__ */ new Date()).toISOString()
23343
22482
  };
23344
- writeFileSync3(checkpointPath, JSON.stringify(checkpoint), { mode: 384 });
22483
+ writeFileSync2(checkpointPath, JSON.stringify(checkpoint), { mode: 384 });
23345
22484
  }, "saveCheckpoint");
23346
22485
  const clearCheckpoint = /* @__PURE__ */ __name(() => rmSync2(checkpointPath, { force: true }), "clearCheckpoint");
23347
22486
  const start = /* @__PURE__ */ __name(async () => {
@@ -23442,8 +22581,8 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
23442
22581
  }
23443
22582
  clearCheckpoint();
23444
22583
  const file = finished.data;
23445
- const local2 = await md5Of(path);
23446
- if (file.md5Checksum && file.md5Checksum !== local2)
22584
+ const local = await md5Of(path);
22585
+ if (file.md5Checksum && file.md5Checksum !== local)
23447
22586
  throw new CliError("provider_error", `uploaded file ${file.id} differs from the local file (MD5); upload it again`, {
23448
22587
  reason: "upload.checksum-mismatch",
23449
22588
  file_id: file.id
@@ -23452,7 +22591,7 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
23452
22591
  id: String(file.id),
23453
22592
  name: file.name ?? name,
23454
22593
  size: Number(file.size ?? size2),
23455
- md5: file.md5Checksum ?? local2,
22594
+ md5: file.md5Checksum ?? local,
23456
22595
  parents: file.parents ?? [],
23457
22596
  mime_type: file.mimeType ?? input.mime ?? "application/octet-stream",
23458
22597
  resumed
@@ -23468,7 +22607,6 @@ var Preview = class extends Error {
23468
22607
  }
23469
22608
  };
23470
22609
  var EXPORTS = /* @__PURE__ */ new Set(["documents export", "files download", "files export"]);
23471
- var MCP_AGENT = "drive-mcp";
23472
22610
  var googleOnly = /* @__PURE__ */ __name((effects) => effects?.local === "none" && effects.remote !== "none", "googleOnly");
23473
22611
  var lateEnv = /* @__PURE__ */ __name((environment) => {
23474
22612
  const current = /* @__PURE__ */ __name(() => environment().env ?? process.env, "current");
@@ -23562,14 +22700,14 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23562
22700
  if (out.format !== "pretty")
23563
22701
  return renderAnswer(command, out, whole);
23564
22702
  const zone = timezoneOf();
23565
- const local2 = localTimes(whole, zone);
23566
- renderAnswer(command, out, local2.value);
23567
- if (local2.changed || whole.meta.timezone)
22703
+ const local = localTimes(whole, zone);
22704
+ renderAnswer(command, out, local.value);
22705
+ if (local.changed || whole.meta.timezone)
23568
22706
  out.streams.data(`times in ${whole.meta.timezone ?? zone}`);
23569
22707
  }, "output");
23570
22708
  const signal = /* @__PURE__ */ __name(() => environment().signal, "signal");
23571
22709
  const signedIn = /* @__PURE__ */ __name(async (name, scope2) => {
23572
- const { authorizedClient, checkAuthorization } = await import("./tokens-DB7O7QNB.js");
22710
+ const { authorizedClient, checkAuthorization } = await import("./tokens-EHYO6D2X.js");
23573
22711
  const client = authorizedClient(env, name, environment().keyring, signal());
23574
22712
  await checkAuthorization(client, scope2);
23575
22713
  return client;
@@ -23579,7 +22717,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23579
22717
  const fake = environment().source;
23580
22718
  if (fake)
23581
22719
  return fake(name);
23582
- const [{ googleSource }, client] = await Promise.all([import("./google-BSO3YB7N.js"), signedIn(name)]);
22720
+ const [{ googleSource }, client] = await Promise.all([import("./google-VX7IPACN.js"), signedIn(name)]);
23583
22721
  return googleSource(client);
23584
22722
  }, "source");
23585
22723
  const withIndex = /* @__PURE__ */ __name(async (fn, profile) => {
@@ -23658,8 +22796,14 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23658
22796
  document: imported,
23659
22797
  output,
23660
22798
  complete: /* @__PURE__ */ __name(() => environment().complete ?? memoryModel(env, selected(), signal()), "complete"),
23661
- author: /* @__PURE__ */ __name(() => agent() ? { bot: MCP_AGENT, kind: "agent" } : "owner", "author"),
23662
- decider: /* @__PURE__ */ __name(() => agent() ? { bot: MCP_AGENT, reason: "asked over drive's MCP server" } : "owner", "decider"),
22799
+ author: /* @__PURE__ */ __name(() => {
22800
+ const actor = actorOf(program);
22801
+ return actor === "owner" ? "owner" : { bot: actor, kind: "agent" };
22802
+ }, "author"),
22803
+ decider: /* @__PURE__ */ __name(() => {
22804
+ const actor = actorOf(program);
22805
+ return actor === "owner" ? "owner" : { bot: actor, reason: `asked by ${actor} through drive` };
22806
+ }, "decider"),
23663
22807
  run: /* @__PURE__ */ __name(async (input, fn) => withIndex(async (index) => {
23664
22808
  const lock = await lockProfile(env, selected());
23665
22809
  try {
@@ -23667,8 +22811,8 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23667
22811
  if (!index.knowledge)
23668
22812
  throw new CliError("configuration_error", "index has no shared knowledge adapter");
23669
22813
  const principal = activeProfile(env, selected()).principal;
23670
- const local2 = isDocumentRef(input) || /^\d+$/.test(input);
23671
- const found = local2 ? void 0 : await index.catalog?.get(principal, fileId(input));
22814
+ const local = isDocumentRef(input) || /^\d+$/.test(input);
22815
+ const found = local ? void 0 : await index.catalog?.get(principal, fileId(input));
23672
22816
  const ref = found?.ref ?? imported(input).ref;
23673
22817
  const result = await fn(index.knowledge, principal, ref);
23674
22818
  lock.assertHeld();
@@ -23684,7 +22828,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23684
22828
  },
23685
22829
  stored: storedDocument(context),
23686
22830
  output,
23687
- positive: positive2,
22831
+ positive,
23688
22832
  readBody: /* @__PURE__ */ __name((path) => {
23689
22833
  const fake = environment().readBody;
23690
22834
  if (fake)
@@ -23723,7 +22867,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23723
22867
  if (fake)
23724
22868
  return await fake.call(method, params, body);
23725
22869
  const [{ googleApi }, client] = await Promise.all([
23726
- import("./google-api-SAND2F7L.js"),
22870
+ import("./google-api-RFXKRLL4.js"),
23727
22871
  signedIn(selected(), descriptor.scope)
23728
22872
  ]);
23729
22873
  return await googleApi(client).call(method, params, body);
@@ -23749,7 +22893,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23749
22893
  if (fake)
23750
22894
  return fake(id, mime);
23751
22895
  const [{ googleDownload }, client] = await Promise.all([
23752
- import("./google-api-SAND2F7L.js"),
22896
+ import("./google-api-RFXKRLL4.js"),
23753
22897
  signedIn(selected(), apiMethod(method).scope)
23754
22898
  ]);
23755
22899
  return googleDownload(client)(id, mime);
@@ -23767,7 +22911,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23767
22911
  let request = environment().uploadRequest;
23768
22912
  if (!request) {
23769
22913
  const [{ googleUploadRequest }, client] = await Promise.all([
23770
- import("./google-api-SAND2F7L.js"),
22914
+ import("./google-api-RFXKRLL4.js"),
23771
22915
  signedIn(selected(), apiMethod(method).scope)
23772
22916
  ]);
23773
22917
  request = googleUploadRequest(client);
@@ -23980,7 +23124,7 @@ var mcpCommand = /* @__PURE__ */ __name(() => {
23980
23124
  const environment = environmentOf(action);
23981
23125
  if (environment.api)
23982
23126
  return;
23983
- const { grantAvailability } = await import("./grants-PLNFYARD.js");
23127
+ const { grantAvailability } = await import("./grants-4XWJFVD6.js");
23984
23128
  availability = grantAvailability(rootOf(root), environment.env ?? process.env, environment.keyring);
23985
23129
  });
23986
23130
  }, "mcpCommand");