@wirecat/drive-cli 0.64.0 → 0.66.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 (228) hide show
  1. package/contracts/wirecat.json +2871 -0
  2. package/dist/bin/drive.js +2 -2
  3. package/dist/bin/drive.js.map +1 -1
  4. package/dist/browse.d.ts +1 -1
  5. package/dist/browse.d.ts.map +1 -1
  6. package/dist/browse.js +1 -1
  7. package/dist/bundle/{all-profiles-BPPT2AK5.js → all-profiles-WCQLIHUG.js} +14 -13
  8. package/dist/bundle/{anthropic-JW6GOJUD.js → anthropic-5RJMB6O7.js} +32 -16
  9. package/dist/bundle/{app-server-KAQIOJMZ.js → app-server-3RGYXPKG.js} +72 -58
  10. package/dist/bundle/{bun-UT7GNTPV.js → bun-L34VEKGG.js} +2 -2
  11. package/dist/bundle/{bun-sqlite-2OIVV3LS.js → bun-sqlite-H6IAXQXI.js} +12 -8
  12. package/dist/bundle/chunk-2AF77WMH.js +13 -0
  13. package/dist/bundle/{chunk-KVW4XNKB.js → chunk-2S3E2HVV.js} +107 -48
  14. package/dist/bundle/{chunk-IX7NQJLY.js → chunk-3NYH756U.js} +49 -116
  15. package/dist/bundle/chunk-3QFUDXMQ.js +53 -0
  16. package/dist/bundle/{chunk-5ZBR55US.js → chunk-3SDJIMZB.js} +1 -1
  17. package/dist/bundle/{chunk-AHB4OJCI.js → chunk-4UHBJSMI.js} +21735 -27143
  18. package/dist/bundle/chunk-5HVJK3ZJ.js +101 -0
  19. package/dist/bundle/{chunk-GSMYXGFR.js → chunk-5K54RZBK.js} +13 -5
  20. package/dist/bundle/{chunk-LOMW6F2E.js → chunk-5PLINHEY.js} +5403 -4847
  21. package/dist/bundle/{chunk-J62DI53V.js → chunk-5VDVGDOC.js} +1 -1
  22. package/dist/bundle/{chunk-66AF4FBW.js → chunk-5XLU4NN6.js} +4 -4
  23. package/dist/bundle/{chunk-4CNTID2X.js → chunk-6UJCCOZC.js} +4 -4
  24. package/dist/bundle/{chunk-G4KEKKDE.js → chunk-6X3KUFRQ.js} +60 -29
  25. package/dist/bundle/{chunk-QEAD2LF4.js → chunk-7EP4AU6A.js} +3 -3
  26. package/dist/bundle/{chunk-ZRZ4HTCK.js → chunk-7LT2G5BC.js} +171 -174
  27. package/dist/bundle/{chunk-2W464HAE.js → chunk-7ZGJRVBH.js} +7 -5
  28. package/dist/bundle/{chunk-FXBHOCJK.js → chunk-ADLS6FVG.js} +1 -1
  29. package/dist/bundle/{chunk-KG2XKEHL.js → chunk-ALE67WRR.js} +5 -5
  30. package/dist/bundle/{chunk-ZSZJLJIA.js → chunk-AP4MX247.js} +38 -28
  31. package/dist/bundle/{chunk-EWGVDFPT.js → chunk-BIJW6AYA.js} +41873 -36466
  32. package/dist/bundle/{chunk-B7XBIOMR.js → chunk-BQXSE645.js} +16 -16
  33. package/dist/bundle/{chunk-F2VDAG32.js → chunk-COGWKO2T.js} +3 -3
  34. package/dist/bundle/{chunk-EZ6O3ST3.js → chunk-D4MIMH2N.js} +12 -6
  35. package/dist/bundle/{chunk-4YRENUB5.js → chunk-D7KOAPG6.js} +2 -2
  36. package/dist/bundle/chunk-E2F2XIX6.js +224 -0
  37. package/dist/bundle/{chunk-36GPBPWM.js → chunk-FA2TNA5X.js} +3 -1
  38. package/dist/bundle/{chunk-SIOIMO62.js → chunk-FHBTQPA3.js} +69 -63
  39. package/dist/bundle/{chunk-34BIDKF4.js → chunk-FKKPVPZR.js} +649 -212
  40. package/dist/bundle/chunk-G4TNKBDX.js +185 -0
  41. package/dist/bundle/{chunk-2FEZ24DK.js → chunk-GVA3KTCD.js} +20 -20
  42. package/dist/bundle/chunk-GY4DAJSK.js +167 -0
  43. package/dist/bundle/{chunk-5OFA5EXE.js → chunk-H7XL6WTW.js} +2 -2
  44. package/dist/bundle/{chunk-K6BSB53R.js → chunk-HHRJPLFO.js} +1 -1
  45. package/dist/bundle/{chunk-P7DEGRZA.js → chunk-HPKE2GDP.js} +49 -28
  46. package/dist/bundle/{chunk-QXCKJUZY.js → chunk-HPSHQVJU.js} +633 -465
  47. package/dist/bundle/{chunk-BEZJA44H.js → chunk-HQBLJLYH.js} +7 -7
  48. package/dist/bundle/{chunk-JRXFW7HE.js → chunk-I5R5CMQR.js} +5 -5
  49. package/dist/bundle/{chunk-EJ4PNHPP.js → chunk-IIHZTV6V.js} +1 -1
  50. package/dist/bundle/{chunk-G3NULXOM.js → chunk-IRNDYNQX.js} +4 -4
  51. package/dist/bundle/{chunk-N622LRPM.js → chunk-JCHF7LZT.js} +4 -4
  52. package/dist/bundle/{chunk-WWCYTMAV.js → chunk-JHMEETXI.js} +2 -2
  53. package/dist/bundle/{chunk-ZF6GUZCE.js → chunk-JLCR24UM.js} +1 -1
  54. package/dist/bundle/{chunk-IDAK4DDK.js → chunk-JQXK3M5M.js} +1 -1
  55. package/dist/bundle/{chunk-KIN6PDFE.js → chunk-KOY5HUBY.js} +14 -5
  56. package/dist/bundle/{chunk-5HSRQ53R.js → chunk-KRG5X5PH.js} +2 -2
  57. package/dist/bundle/{chunk-VIJ6ACYB.js → chunk-LVAPSAHF.js} +8 -8
  58. package/dist/bundle/{chunk-OEVHZOHC.js → chunk-M7543RUJ.js} +50 -18
  59. package/dist/bundle/{chunk-BZ2ZKILM.js → chunk-MZWXTJ4O.js} +3 -3
  60. package/dist/bundle/{chunk-EC2XGDKJ.js → chunk-NK4GVFJH.js} +4 -4
  61. package/dist/bundle/chunk-NYECVHFH.js +10283 -0
  62. package/dist/bundle/{chunk-HW4UPST2.js → chunk-NYZS2LKF.js} +2 -2
  63. package/dist/bundle/chunk-O53WLYX3.js +72 -0
  64. package/dist/bundle/{chunk-IK6KH3RE.js → chunk-OIF4B526.js} +1 -1
  65. package/dist/bundle/{chunk-UJR272CP.js → chunk-OT7SQQJK.js} +359 -903
  66. package/dist/bundle/chunk-OZOQLAWK.js +72 -0
  67. package/dist/bundle/{chunk-VT2UFYPJ.js → chunk-P7HQFII6.js} +22 -15
  68. package/dist/bundle/{chunk-6G53ZFUT.js → chunk-PJGOQSE5.js} +1 -1
  69. package/dist/bundle/{chunk-OH3K2E7X.js → chunk-PKM55ZRR.js} +704 -1214
  70. package/dist/bundle/{chunk-GW3U6OLD.js → chunk-PUMDOCAF.js} +1 -1
  71. package/dist/bundle/{chunk-EQEGJVO2.js → chunk-QF7VL4C3.js} +1 -1
  72. package/dist/bundle/{chunk-CPMRM3GQ.js → chunk-QJ57PV55.js} +1941 -662
  73. package/dist/bundle/{chunk-O2QO5UZC.js → chunk-QSELSDWE.js} +13 -13
  74. package/dist/bundle/{chunk-BEUAICUD.js → chunk-SOOU5WO6.js} +2 -2
  75. package/dist/bundle/{chunk-46CD64J2.js → chunk-SZ6JFOL4.js} +269 -64
  76. package/dist/bundle/{chunk-UD55VB2N.js → chunk-T3ULDA7C.js} +3 -3
  77. package/dist/bundle/{chunk-E2LBCCTG.js → chunk-TAHISPDE.js} +5 -5
  78. package/dist/bundle/{chunk-6B37XO6B.js → chunk-TYLEICTX.js} +3 -3
  79. package/dist/bundle/{chunk-TNV2FXVK.js → chunk-UAKX6DP4.js} +5 -5
  80. package/dist/bundle/{chunk-VPLFD5RJ.js → chunk-UG3GHFGY.js} +4 -4
  81. package/dist/bundle/{chunk-B67BLRAI.js → chunk-ULXEW6FT.js} +3 -60
  82. package/dist/bundle/{chunk-C7WBNOYW.js → chunk-UNTIVT47.js} +26 -2
  83. package/dist/bundle/chunk-UQPW42HF.js +18 -0
  84. package/dist/bundle/{chunk-USLZE36C.js → chunk-V2WXTILT.js} +6 -6
  85. package/dist/bundle/{chunk-BDYWZ7JE.js → chunk-VQKNKJYL.js} +46 -7
  86. package/dist/bundle/{chunk-XPXKD63J.js → chunk-VR3YKXHL.js} +93 -31
  87. package/dist/bundle/{chunk-UIEA6FIV.js → chunk-VUUPFDRU.js} +27 -28
  88. package/dist/bundle/{chunk-KE4XPPRQ.js → chunk-WYTYHUFH.js} +1750 -138
  89. package/dist/bundle/{chunk-PBMSBCVB.js → chunk-XLGDNI4S.js} +1 -1
  90. package/dist/bundle/{chunk-3J5KAFNA.js → chunk-XVZNFA2P.js} +4935 -3623
  91. package/dist/bundle/chunk-Y5U4HIZS.js +71 -0
  92. package/dist/bundle/chunk-YTIPTHEE.js +47 -0
  93. package/dist/bundle/cli-KW6QQVS5.js +1101 -0
  94. package/dist/bundle/command-contract-CE543JBN.js +41 -0
  95. package/dist/bundle/command-server-entry-OC4E4DED.js +171 -0
  96. package/dist/bundle/{decode-HTOQ6S3V.js → decode-AH5ZLLDK.js} +8 -8
  97. package/dist/bundle/{dispatch-SH5SP6LA.js → dispatch-CDWZZ54Q.js} +9 -9
  98. package/dist/bundle/drive.js +13 -13
  99. package/dist/bundle/{echarts-KFHB6SLX.js → echarts-VC7MTXWY.js} +2 -2
  100. package/dist/bundle/{embed-YATFB2PN.js → embed-EPSQY6QG.js} +9 -9
  101. package/dist/bundle/{embedder-MQPDFGTJ.js → embedder-TK4U4TJR.js} +12 -12
  102. package/dist/bundle/entry-3VN23M7M.js +25 -0
  103. package/dist/bundle/{failure-4FQL4XJI.js → failure-WSVZOPFE.js} +4 -4
  104. package/dist/bundle/first-run-7ZYJ7EB3.js +30 -0
  105. package/dist/bundle/first-screen-CZDH7QY3.js +39 -0
  106. package/dist/bundle/google-OBZMWA7J.js +45 -0
  107. package/dist/bundle/{google-api-QMFGCXBM.js → google-api-AV4X2JH3.js} +68 -57
  108. package/dist/bundle/grants-WTRLN4ZI.js +111 -0
  109. package/dist/bundle/{identity-FYVDK4M2.js → identity-CGHHF7AK.js} +8 -6
  110. package/dist/bundle/{instructions-D3GF3B7M.js → instructions-24PHDBBE.js} +1 -1
  111. package/dist/bundle/{login-COFZ2IWP.js → login-XHFESAFM.js} +73 -64
  112. package/dist/bundle/{mcp-RKJG22KM.js → mcp-M5YCSWJJ.js} +2 -2
  113. package/dist/bundle/{node-OFICOKX3.js → node-GIDULTV5.js} +2 -2
  114. package/dist/bundle/{node-KM3CUABH.js → node-P4E63KXA.js} +9 -9
  115. package/dist/bundle/{node-sqlite-DNBTDOXD.js → node-sqlite-LINBOAWK.js} +13 -9
  116. package/dist/bundle/oauth-JHUX3KE3.js +22 -0
  117. package/dist/bundle/{open-PTPR2YWX.js → open-RYFKPNCJ.js} +8 -8
  118. package/dist/bundle/{openai-2KV5LUW4.js → openai-Q7YYUHJF.js} +28 -42
  119. package/dist/bundle/{process-EAW6NST2.js → process-VPIZTIJR.js} +1 -1
  120. package/dist/bundle/{program-6UV5Q5YN.js → program-IUXFRBZA.js} +419 -604
  121. package/dist/bundle/{prompt-634TPMJK.js → prompt-LF4KX3XL.js} +8 -8
  122. package/dist/bundle/{reasons-DDWCEYSQ.js → reasons-JPYOU5GV.js} +5 -5
  123. package/dist/bundle/{recognize-SJO6QUDW.js → recognize-KEWTJXFH.js} +7 -7
  124. package/dist/bundle/{remote-6JXZITKF.js → remote-HGGLB76S.js} +13 -10
  125. package/dist/bundle/{rerank-MD5VOPQ6.js → rerank-TDUKETFT.js} +10 -10
  126. package/dist/bundle/{serve-LZTROA2M.js → serve-XFYMKW5W.js} +12 -12
  127. package/dist/bundle/server-BDEV3CZJ.js +74 -0
  128. package/dist/bundle/{server-NSA3UAFY.js → server-PXIPSGFP.js} +48 -44
  129. package/dist/bundle/{services-F5A6XQCV.js → services-2BOCGMJU.js} +111 -41
  130. package/dist/bundle/{sqlite-runtime-7YF6REKS.js → sqlite-runtime-R7M5XUMW.js} +9 -9
  131. package/dist/bundle/{start-MUFLE6FA.js → start-YRLT4MQZ.js} +7 -7
  132. package/dist/bundle/{state-UC54F3YZ.js → state-NZ7WRJWH.js} +9 -9
  133. package/dist/bundle/{store-F5FJGWMR.js → store-7LCVDO7G.js} +63 -28
  134. package/dist/bundle/{store-J53YNAH6.js → store-ICDGPSEN.js} +27 -18
  135. package/dist/bundle/store-maintenance-command-SJPLY6IH.js +65 -0
  136. package/dist/bundle/tokens-FGTBE7VW.js +111 -0
  137. package/dist/commands/config.d.ts.map +1 -1
  138. package/dist/commands/config.js +6 -5
  139. package/dist/commands/config.js.map +1 -1
  140. package/dist/commands/context.d.ts +4 -2
  141. package/dist/commands/context.d.ts.map +1 -1
  142. package/dist/commands/context.js.map +1 -1
  143. package/dist/commands/discovery.d.ts +0 -1
  144. package/dist/commands/discovery.d.ts.map +1 -1
  145. package/dist/commands/discovery.js +6 -26
  146. package/dist/commands/discovery.js.map +1 -1
  147. package/dist/commands/documents.d.ts +2 -0
  148. package/dist/commands/documents.d.ts.map +1 -1
  149. package/dist/commands/documents.js +39 -3
  150. package/dist/commands/documents.js.map +1 -1
  151. package/dist/commands/knowledge.d.ts.map +1 -1
  152. package/dist/commands/knowledge.js +7 -6
  153. package/dist/commands/knowledge.js.map +1 -1
  154. package/dist/commands/search.d.ts.map +1 -1
  155. package/dist/commands/search.js +11 -8
  156. package/dist/commands/search.js.map +1 -1
  157. package/dist/config.d.ts +14 -0
  158. package/dist/config.d.ts.map +1 -1
  159. package/dist/config.js +35 -4
  160. package/dist/config.js.map +1 -1
  161. package/dist/contract-overrides.d.ts +16 -4
  162. package/dist/contract-overrides.d.ts.map +1 -1
  163. package/dist/contract-overrides.js +86 -410
  164. package/dist/contract-overrides.js.map +1 -1
  165. package/dist/documents-add.d.ts +49 -0
  166. package/dist/documents-add.d.ts.map +1 -0
  167. package/dist/documents-add.js +122 -0
  168. package/dist/documents-add.js.map +1 -0
  169. package/dist/errors.d.ts +1 -0
  170. package/dist/errors.d.ts.map +1 -1
  171. package/dist/errors.js +13 -1
  172. package/dist/errors.js.map +1 -1
  173. package/dist/google-api.d.ts.map +1 -1
  174. package/dist/google-api.js +4 -1
  175. package/dist/google-api.js.map +1 -1
  176. package/dist/identity.d.ts +4 -0
  177. package/dist/identity.d.ts.map +1 -1
  178. package/dist/identity.js +22 -0
  179. package/dist/identity.js.map +1 -1
  180. package/dist/knowledge.d.ts +1 -1
  181. package/dist/knowledge.d.ts.map +1 -1
  182. package/dist/knowledge.js +17 -19
  183. package/dist/knowledge.js.map +1 -1
  184. package/dist/login.d.ts.map +1 -1
  185. package/dist/login.js +2 -2
  186. package/dist/login.js.map +1 -1
  187. package/dist/model.d.ts +3 -0
  188. package/dist/model.d.ts.map +1 -1
  189. package/dist/model.js.map +1 -1
  190. package/dist/program.d.ts.map +1 -1
  191. package/dist/program.js +30 -21
  192. package/dist/program.js.map +1 -1
  193. package/dist/reasons.d.ts.map +1 -1
  194. package/dist/reasons.js +25 -1
  195. package/dist/reasons.js.map +1 -1
  196. package/dist/store-transition.js +2 -2
  197. package/dist/store-transition.js.map +1 -1
  198. package/dist/store.d.ts.map +1 -1
  199. package/dist/store.js +27 -7
  200. package/dist/store.js.map +1 -1
  201. package/dist/tokens.d.ts +9 -2
  202. package/dist/tokens.d.ts.map +1 -1
  203. package/dist/tokens.js +18 -15
  204. package/dist/tokens.js.map +1 -1
  205. package/dist/version.d.ts +1 -1
  206. package/dist/version.js +1 -1
  207. package/dist/wcat.d.ts +3 -0
  208. package/dist/wcat.d.ts.map +1 -0
  209. package/dist/wcat.js +4 -0
  210. package/dist/wcat.js.map +1 -0
  211. package/package.json +8 -8
  212. package/dist/bundle/chunk-3NULZGQU.js +0 -27
  213. package/dist/bundle/chunk-DD7EFG6B.js +0 -35
  214. package/dist/bundle/chunk-M73NNJ3X.js +0 -26
  215. package/dist/bundle/chunk-SBZB7HMU.js +0 -1055
  216. package/dist/bundle/command-contract-H5OYJOPF.js +0 -38
  217. package/dist/bundle/dist-PY3MVR3G.js +0 -21
  218. package/dist/bundle/entry-YZBB647C.js +0 -22
  219. package/dist/bundle/first-run-5JT3UQZB.js +0 -30
  220. package/dist/bundle/first-screen-BEMDEWO7.js +0 -36
  221. package/dist/bundle/google-DVADVICN.js +0 -36
  222. package/dist/bundle/grants-WKB2E4TA.js +0 -103
  223. package/dist/bundle/oauth-PDQHWFBF.js +0 -22
  224. package/dist/bundle/server-GT7X666D.js +0 -69
  225. package/dist/bundle/store-maintenance-command-GJVXLBAB.js +0 -58
  226. package/dist/bundle/tokens-H2EJKGA5.js +0 -101
  227. package/dist/bundle/{chunk-SW6C6WH5.js → chunk-HVJJWJYQ.js} +0 -0
  228. package/dist/bundle/{mdast-util-from-markdown-FXEPSNER.js → mdast-util-from-markdown-CE73EWJ2.js} +3 -3
@@ -8,7 +8,7 @@ import {
8
8
  metadataJson,
9
9
  supported,
10
10
  tooManyEntries
11
- } from "./chunk-PBMSBCVB.js";
11
+ } from "./chunk-XLGDNI4S.js";
12
12
  import {
13
13
  ACCOUNT_FREE_COMMANDS,
14
14
  ANY_PROFILE_COMMANDS,
@@ -19,13 +19,14 @@ import {
19
19
  describeDriveProgram,
20
20
  examples,
21
21
  markProfileFree
22
- } from "./chunk-QEAD2LF4.js";
22
+ } from "./chunk-7EP4AU6A.js";
23
23
  import {
24
24
  DEFAULTS_ONLY,
25
25
  DEFAULT_LEVELS,
26
26
  SETTING_NAMES,
27
27
  activeProfile,
28
28
  application,
29
+ checkAddProfiles,
29
30
  checkTextLimit,
30
31
  configIssues,
31
32
  configPath,
@@ -35,13 +36,16 @@ import {
35
36
  fileId,
36
37
  googleAppOf,
37
38
  inspectConfig,
39
+ maxAddProfiles,
38
40
  methodPolicyKeys,
39
41
  oauthClientReport,
40
42
  paths,
41
43
  permissionKeys,
42
44
  permissionNames,
43
45
  pictureSearch,
46
+ profileLocked,
44
47
  profileName,
48
+ profileRequired,
45
49
  readConfig,
46
50
  refusal,
47
51
  selectedFolders,
@@ -49,7 +53,7 @@ import {
49
53
  unknownProfile,
50
54
  withDefaults,
51
55
  writeConfig
52
- } from "./chunk-OEVHZOHC.js";
56
+ } from "./chunk-M7543RUJ.js";
53
57
  import {
54
58
  blockKey,
55
59
  blocksMarkdown,
@@ -68,7 +72,7 @@ import {
68
72
  syncDocuments,
69
73
  syncMirrors,
70
74
  watchMirrors
71
- } from "./chunk-UIEA6FIV.js";
75
+ } from "./chunk-VUUPFDRU.js";
72
76
  import {
73
77
  apiMethod,
74
78
  apiMethods,
@@ -77,7 +81,14 @@ import {
77
81
  schemas,
78
82
  validateApiParams,
79
83
  validateRequest
80
- } from "./chunk-2W464HAE.js";
84
+ } from "./chunk-7ZGJRVBH.js";
85
+ import {
86
+ operations
87
+ } from "./chunk-NYECVHFH.js";
88
+ import {
89
+ googleError,
90
+ offlineRefused
91
+ } from "./chunk-5K54RZBK.js";
81
92
  import {
82
93
  DISCOVERY_DESCRIPTIONS,
83
94
  MEMO_SCENARIOS,
@@ -85,20 +96,21 @@ import {
85
96
  addContractInfo,
86
97
  answerFields,
87
98
  apiPlainJson,
99
+ appCompleteCommand,
88
100
  appDoctorCommand,
89
101
  appMcpCommand,
90
102
  checkApiBody,
91
103
  checkApiParameter,
92
104
  checkJson,
93
105
  commandRuns,
106
+ commandsText,
94
107
  createProgram,
95
108
  entityFields,
96
- formatSuggestions,
97
109
  generatedApiCommand,
98
110
  guideCommand,
99
111
  identifier,
112
+ inSection,
100
113
  modelCatalogueCommand,
101
- operations,
102
114
  parseApiJson,
103
115
  readApiBody,
104
116
  run,
@@ -106,25 +118,17 @@ import {
106
118
  sharedCommandTemplate,
107
119
  signInSteps,
108
120
  skillCommand,
109
- suggest,
110
121
  upgradeCommand
111
- } from "./chunk-AHB4OJCI.js";
112
- import {
113
- googleError
114
- } from "./chunk-GSMYXGFR.js";
115
- import "./chunk-K6BSB53R.js";
116
- import "./chunk-SBZB7HMU.js";
117
- import "./chunk-GW3U6OLD.js";
118
- import "./chunk-ZRZ4HTCK.js";
119
- import "./chunk-QXCKJUZY.js";
122
+ } from "./chunk-4UHBJSMI.js";
123
+ import "./chunk-HHRJPLFO.js";
124
+ import "./chunk-PUMDOCAF.js";
125
+ import "./chunk-7LT2G5BC.js";
126
+ import "./chunk-HPSHQVJU.js";
120
127
  import {
121
128
  storeInfo
122
- } from "./chunk-34BIDKF4.js";
123
- import {
124
- RecipientList,
125
- SendJournal,
126
- sendGuard
127
- } from "./chunk-UJR272CP.js";
129
+ } from "./chunk-FKKPVPZR.js";
130
+ import "./chunk-E2F2XIX6.js";
131
+ import "./chunk-OT7SQQJK.js";
128
132
  import {
129
133
  LIST_QUERY_GUIDE,
130
134
  listQuery,
@@ -135,13 +139,45 @@ import {
135
139
  typedQuery,
136
140
  unfilteredQuery,
137
141
  withQuery
138
- } from "./chunk-P7DEGRZA.js";
142
+ } from "./chunk-HPKE2GDP.js";
139
143
  import {
140
- commandsText,
141
- inSection
142
- } from "./chunk-IX7NQJLY.js";
144
+ RecipientList,
145
+ SendJournal,
146
+ newOperationId,
147
+ sendGuard
148
+ } from "./chunk-XVZNFA2P.js";
149
+ import {
150
+ columnName,
151
+ modelGateway,
152
+ readSpreadsheet
153
+ } from "./chunk-WYTYHUFH.js";
154
+ import "./chunk-QSELSDWE.js";
155
+ import "./chunk-3NYH756U.js";
143
156
  import "./chunk-HTQTIKWP.js";
144
- import "./chunk-TNV2FXVK.js";
157
+ import "./chunk-BQXSE645.js";
158
+ import {
159
+ latestVersion,
160
+ runUpdate,
161
+ updateNotice
162
+ } from "./chunk-JCHF7LZT.js";
163
+ import "./chunk-PJGOQSE5.js";
164
+ import "./chunk-AP4MX247.js";
165
+ import "./chunk-6UJCCOZC.js";
166
+ import "./chunk-COGWKO2T.js";
167
+ import "./chunk-KOY5HUBY.js";
168
+ import "./chunk-D4MIMH2N.js";
169
+ import "./chunk-OZOQLAWK.js";
170
+ import {
171
+ applyDocumentTransfer,
172
+ previewDocumentTransfer
173
+ } from "./chunk-2S3E2HVV.js";
174
+ import "./chunk-I5R5CMQR.js";
175
+ import "./chunk-5DPV7X27.js";
176
+ import "./chunk-G4TNKBDX.js";
177
+ import "./chunk-UQPW42HF.js";
178
+ import "./chunk-2AF77WMH.js";
179
+ import "./chunk-SOOU5WO6.js";
180
+ import "./chunk-UAKX6DP4.js";
145
181
  import {
146
182
  FETCH,
147
183
  InvalidArgumentError,
@@ -155,7 +191,6 @@ import {
155
191
  changesAuthority,
156
192
  commandWords,
157
193
  customizeSharedCommand,
158
- describeOptions,
159
194
  environmentOf,
160
195
  flatten,
161
196
  grantsAuthority,
@@ -171,72 +206,54 @@ import {
171
206
  resolveAISettings,
172
207
  rootOf,
173
208
  settingRows,
209
+ sharedContracts,
174
210
  snakeKeys
175
- } from "./chunk-LOMW6F2E.js";
176
- import "./chunk-VT2UFYPJ.js";
177
- import "./chunk-B7XBIOMR.js";
178
- import {
179
- setupPermissionCeiling
180
- } from "./chunk-VPLFD5RJ.js";
181
- import "./chunk-ZSZJLJIA.js";
182
- import "./chunk-4CNTID2X.js";
183
- import "./chunk-F2VDAG32.js";
184
- import "./chunk-J62DI53V.js";
185
- import {
186
- modelGateway,
187
- newOperationId
188
- } from "./chunk-3J5KAFNA.js";
189
- import {
190
- columnName,
191
- readSpreadsheet
192
- } from "./chunk-KE4XPPRQ.js";
193
- import "./chunk-O2QO5UZC.js";
211
+ } from "./chunk-5PLINHEY.js";
212
+ import "./chunk-P7HQFII6.js";
194
213
  import {
195
214
  CEILING_KEY,
196
215
  LEVELS,
197
216
  guardedWrite,
198
- inRun,
199
217
  layerPermissions,
200
218
  levelFor,
201
- modelTarget,
202
219
  parseDuration
203
- } from "./chunk-OH3K2E7X.js";
220
+ } from "./chunk-PKM55ZRR.js";
204
221
  import {
205
- latestVersion,
206
- runUpdate,
207
- updateNotice
208
- } from "./chunk-N622LRPM.js";
209
- import "./chunk-6G53ZFUT.js";
222
+ modelTarget
223
+ } from "./chunk-5HVJK3ZJ.js";
224
+ import {
225
+ setupPermissionCeiling
226
+ } from "./chunk-UG3GHFGY.js";
210
227
  import {
211
228
  readOnlyLockOf,
212
229
  readOnlyRefusal
213
- } from "./chunk-3NULZGQU.js";
214
- import "./chunk-KIN6PDFE.js";
215
- import "./chunk-EZ6O3ST3.js";
230
+ } from "./chunk-Y5U4HIZS.js";
231
+ import "./chunk-5VDVGDOC.js";
216
232
  import {
217
- applyDocumentTransfer,
218
- previewDocumentTransfer
219
- } from "./chunk-KVW4XNKB.js";
233
+ hostFetch
234
+ } from "./chunk-GY4DAJSK.js";
220
235
  import {
221
236
  note
222
- } from "./chunk-BZ2ZKILM.js";
223
- import "./chunk-JRXFW7HE.js";
224
- import "./chunk-5DPV7X27.js";
225
- import "./chunk-66AF4FBW.js";
226
- import "./chunk-BEUAICUD.js";
237
+ } from "./chunk-MZWXTJ4O.js";
238
+ import "./chunk-5XLU4NN6.js";
239
+ import "./chunk-TYLEICTX.js";
240
+ import "./chunk-H7XL6WTW.js";
227
241
  import {
228
242
  CATALOG_QUERY,
229
243
  IMPORTED_DOCUMENT_QUERY,
230
244
  openStore
231
- } from "./chunk-EWGVDFPT.js";
232
- import "./chunk-UD55VB2N.js";
245
+ } from "./chunk-BIJW6AYA.js";
246
+ import "./chunk-T3ULDA7C.js";
247
+ import "./chunk-LVAPSAHF.js";
248
+ import "./chunk-V2WXTILT.js";
233
249
  import {
234
250
  FACT_STATUSES,
235
251
  FACT_TYPES,
236
252
  MEMORY_KINDS,
237
253
  MEMORY_SCOPES,
238
- MEMORY_STATUSES
239
- } from "./chunk-CPMRM3GQ.js";
254
+ MEMORY_STATUSES,
255
+ inRun
256
+ } from "./chunk-QJ57PV55.js";
240
257
  import {
241
258
  dateRange,
242
259
  defineQuery,
@@ -246,40 +263,37 @@ import {
246
263
  timezoneOf,
247
264
  validateQuery,
248
265
  zonedMoment
249
- } from "./chunk-2FEZ24DK.js";
250
- import "./chunk-B67BLRAI.js";
251
- import "./chunk-VIJ6ACYB.js";
252
- import "./chunk-BEZJA44H.js";
253
- import {
254
- storePath
255
- } from "./chunk-DD7EFG6B.js";
256
- import "./chunk-USLZE36C.js";
257
- import "./chunk-EQEGJVO2.js";
258
- import "./chunk-6B37XO6B.js";
259
- import "./chunk-5OFA5EXE.js";
266
+ } from "./chunk-GVA3KTCD.js";
267
+ import "./chunk-ULXEW6FT.js";
268
+ import "./chunk-O53WLYX3.js";
269
+ import "./chunk-HQBLJLYH.js";
270
+ import "./chunk-QF7VL4C3.js";
260
271
  import "./chunk-D72URWJE.js";
261
272
  import {
262
273
  installerOf
263
- } from "./chunk-IK6KH3RE.js";
274
+ } from "./chunk-OIF4B526.js";
264
275
  import {
265
276
  DRIVE_APP,
266
277
  PACKAGE,
267
278
  VERSION
268
- } from "./chunk-M73NNJ3X.js";
279
+ } from "./chunk-YTIPTHEE.js";
269
280
  import {
270
281
  REASONS
271
- } from "./chunk-C7WBNOYW.js";
272
- import "./chunk-SW6C6WH5.js";
273
- import "./chunk-36GPBPWM.js";
282
+ } from "./chunk-UNTIVT47.js";
283
+ import "./chunk-HVJJWJYQ.js";
284
+ import "./chunk-FA2TNA5X.js";
285
+ import {
286
+ storePath
287
+ } from "./chunk-3QFUDXMQ.js";
274
288
  import {
275
289
  processStreams,
276
290
  saveConfigFile,
277
291
  writeSecurely
278
- } from "./chunk-G4KEKKDE.js";
279
- import "./chunk-KG2XKEHL.js";
292
+ } from "./chunk-6X3KUFRQ.js";
293
+ import "./chunk-ALE67WRR.js";
280
294
  import "./chunk-Y5E2WNWB.js";
281
- import "./chunk-IDAK4DDK.js";
282
- import "./chunk-HW4UPST2.js";
295
+ import "./chunk-JQXK3M5M.js";
296
+ import "./chunk-NYZS2LKF.js";
283
297
  import {
284
298
  array,
285
299
  boolean,
@@ -303,11 +317,11 @@ import {
303
317
  string,
304
318
  unknown,
305
319
  writes
306
- } from "./chunk-BDYWZ7JE.js";
320
+ } from "./chunk-VQKNKJYL.js";
307
321
  import {
308
322
  CliError,
309
323
  isCliError
310
- } from "./chunk-EJ4PNHPP.js";
324
+ } from "./chunk-IIHZTV6V.js";
311
325
  import {
312
326
  __commonJS,
313
327
  __name,
@@ -2138,13 +2152,13 @@ var lockProfile = /* @__PURE__ */ __name(async (env, name) => {
2138
2152
  throw new CliError("provider_unavailable", "another sync or knowledge operation holds this profile's lock; retry later", { reason: "profile.busy" });
2139
2153
  }
2140
2154
  }, "lockProfile");
2141
- var profileLocked = /* @__PURE__ */ __name((env, name) => import_proper_lockfile.default.checkSync(profileDir(env, name), { stale: 3e4, realpath: false }), "profileLocked");
2155
+ var profileLocked2 = /* @__PURE__ */ __name((env, name) => import_proper_lockfile.default.checkSync(profileDir(env, name), { stale: 3e4, realpath: false }), "profileLocked");
2142
2156
 
2143
2157
  // dist/commands/account.js
2144
2158
  var removal = {
2145
2159
  signOut: /* @__PURE__ */ __name(async (profile, { env, keyring, mayRevoke }) => {
2146
2160
  const storage = readConfig(env).profiles[profile]?.storage ?? "keyring";
2147
- const { sessionKeeper } = await import("./tokens-H2EJKGA5.js");
2161
+ const { sessionKeeper } = await import("./tokens-FGTBE7VW.js");
2148
2162
  const { revoked } = await sessionKeeper({
2149
2163
  env,
2150
2164
  name: profile,
@@ -2159,7 +2173,7 @@ var removal = {
2159
2173
  return principal ? { provider: "google-drive", account: principal } : void 0;
2160
2174
  }, "account"),
2161
2175
  dataFiles: /* @__PURE__ */ __name((profile, { env }) => [profileDir(env, profile), join2(paths(env).cache, "exports", profile)], "dataFiles"),
2162
- busy: /* @__PURE__ */ __name((profile, { env }) => profileLocked(env, profile) ? "a sync or knowledge operation" : void 0, "busy")
2176
+ busy: /* @__PURE__ */ __name((profile, { env }) => profileLocked2(env, profile) ? "a sync or knowledge operation" : void 0, "busy")
2163
2177
  };
2164
2178
  var installAccountCommands = /* @__PURE__ */ __name((program, _context) => {
2165
2179
  annotate(program.command("account"), { effects: LOCAL_READ }).description("remove this profile from this computer").addCommand(accountRemoveCommand(DRIVE_APP, removal, { resolveSettings: configuration.resolveSettings }));
@@ -2661,7 +2675,7 @@ var installConfigCommands = /* @__PURE__ */ __name((program, { env, selected, ou
2661
2675
  "drive personal config set max_text_chars 100000",
2662
2676
  `drive personal config set permissions.files '"readonly"' --defaults`,
2663
2677
  "drive personal config set record true --defaults"
2664
- ]).argument("<key>", "max_text_chars, picture_search, google_client_id, record, record_input, keep_runs_for_days, keep_successful_runs_for_days, runs_size_limit_mb, shared AI settings, permissions.<key> or models.<purpose>.<field>").argument("<json-value>", "the new value, as JSON").option("--defaults", "change the defaults instead of this profile").action((key, raw, args) => {
2678
+ ]).argument("<key>", "max_text_chars, picture_search, google_client_id, max_add_profiles, record, record_input, keep_runs_for_days, keep_successful_runs_for_days, runs_size_limit_mb, shared AI settings, permissions.<key> or models.<purpose>.<field>").argument("<json-value>", "the new value, as JSON").option("--defaults", "change the defaults instead of this profile").action((key, raw, args) => {
2665
2679
  const file = editable();
2666
2680
  const { at: scope, scope: name } = scopeOf(file, args.defaults);
2667
2681
  const setting = settingAt(key);
@@ -2683,6 +2697,8 @@ var installConfigCommands = /* @__PURE__ */ __name((program, { env, selected, ou
2683
2697
  throw new CliError("validation_error", "picture_search is true or false, set per profile");
2684
2698
  if (head === "max_text_chars")
2685
2699
  parsed = checkTextLimit(parsed);
2700
+ if (head === "max_add_profiles")
2701
+ parsed = checkAddProfiles(parsed);
2686
2702
  const at = [...scope, ...setting];
2687
2703
  const next = isNode(file.raw) ? structuredClone(file.raw) : {};
2688
2704
  let node = next;
@@ -2757,10 +2773,8 @@ var installModelCommands = /* @__PURE__ */ __name((program, { env, output, strea
2757
2773
  });
2758
2774
  const download = /* @__PURE__ */ __name(async (kind, id, acceptTerms) => {
2759
2775
  if (policyFlags().offline)
2760
- throw new CliError("permission_error", "downloading a model needs the network; --offline was requested", {
2761
- reason: "offline.refused"
2762
- });
2763
- const { downloadImageModel, downloadTextModel } = await import("./services-F5A6XQCV.js");
2776
+ throw offlineRefused("downloading a model needs the network");
2777
+ const { downloadImageModel, downloadTextModel } = await import("./services-2BOCGMJU.js");
2764
2778
  const progress = /* @__PURE__ */ __name((line) => {
2765
2779
  if (!program.opts().quiet)
2766
2780
  streams.diagnostic(line);
@@ -2808,55 +2822,52 @@ var offset = /* @__PURE__ */ __name((input) => {
2808
2822
  }, "offset");
2809
2823
 
2810
2824
  // dist/contract-overrides.js
2825
+ import { createHash } from "node:crypto";
2811
2826
  var NOTES_REASON = "Drive notes annotate one explicitly selected imported document; document-bound arguments and receipts replace the generic note scope.";
2812
2827
  var SEARCH_REASON = "Drive searches imported documents and embeddings rather than live messenger messages; its default action and pagination are explicitly provider-specific.";
2828
+ var canonical = /* @__PURE__ */ __name((value) => Array.isArray(value) ? value.map(canonical) : value && typeof value === "object" ? Object.fromEntries(Object.keys(value).sort().map((key) => [key, canonical(value[key])])) : value, "canonical");
2829
+ var fingerprint = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(canonical(value ?? null))).digest("hex").slice(0, 16), "fingerprint");
2830
+ var reviewedOverrides = /* @__PURE__ */ __name((reference, reviewed) => reviewed.map((override) => {
2831
+ let node = reference;
2832
+ for (const name of override.command.slice(1))
2833
+ node = node.commands.find((child) => child.name() === name) ?? node;
2834
+ const before = sharedContracts(node)[node.name()]?.[override.field] ?? null;
2835
+ return { ...override, before: fingerprint(before) === override.before ? before : override.before };
2836
+ }), "reviewedOverrides");
2813
2837
  var SHELL_OVERRIDES = {
2814
2838
  notes: [
2815
2839
  {
2816
2840
  command: ["notes"],
2817
2841
  field: "description",
2818
- before: "notes kept in the shared store",
2842
+ before: "073d38b6d7256579",
2819
2843
  after: "write notes about an imported document",
2820
2844
  reason: NOTES_REASON
2821
2845
  },
2822
2846
  {
2823
2847
  command: ["notes"],
2824
2848
  field: "effects",
2825
- before: {
2826
- remote: "none",
2827
- local: "none"
2828
- },
2829
- after: {
2830
- remote: "none",
2831
- local: "read"
2832
- },
2849
+ before: "b98c7b06ed808dfb",
2850
+ after: { remote: "none", local: "read" },
2833
2851
  reason: NOTES_REASON
2834
2852
  },
2835
2853
  {
2836
2854
  command: ["notes"],
2837
2855
  field: "children",
2838
- before: ["list", "show", "add", "edit", "remove"],
2856
+ before: "6cfec8425c19582f",
2839
2857
  after: ["add", "list", "show", "edit", "remove"],
2840
2858
  reason: NOTES_REASON
2841
2859
  },
2842
2860
  {
2843
2861
  command: ["notes", "add"],
2844
2862
  field: "description",
2845
- before: "write a note",
2863
+ before: "98b319044cba6b7f",
2846
2864
  after: "write a note about a document",
2847
2865
  reason: NOTES_REASON
2848
2866
  },
2849
2867
  {
2850
2868
  command: ["notes", "add"],
2851
2869
  field: "arguments",
2852
- before: [
2853
- {
2854
- name: "text",
2855
- required: true,
2856
- variadic: false,
2857
- description: "note text"
2858
- }
2859
- ],
2870
+ before: "d5010f078464b8d0",
2860
2871
  after: [
2861
2872
  {
2862
2873
  name: "document",
@@ -2864,303 +2875,58 @@ var SHELL_OVERRIDES = {
2864
2875
  variadic: false,
2865
2876
  description: "Google file or folder id or URL in the local catalog, or a document:<n> ref"
2866
2877
  },
2867
- {
2868
- name: "text",
2869
- required: true,
2870
- variadic: false,
2871
- description: "the note's text"
2872
- }
2878
+ { name: "text", required: true, variadic: false, description: "the note's text" }
2873
2879
  ],
2874
2880
  reason: NOTES_REASON
2875
2881
  },
2876
2882
  {
2877
2883
  command: ["notes", "add"],
2878
2884
  field: "options",
2879
- before: [
2880
- {
2881
- flags: "--subject <ref>",
2882
- description: "stored resource the note describes",
2883
- takes_value: true,
2884
- mandatory: false
2885
- }
2886
- ],
2887
- after: [
2888
- {
2889
- flags: "--title <title>",
2890
- description: "a title for the note",
2891
- takes_value: true,
2892
- mandatory: false
2893
- }
2894
- ],
2885
+ before: "213adb539c248d7f",
2886
+ after: [{ flags: "--title <title>", description: "a title for the note", takes_value: true, mandatory: false }],
2895
2887
  reason: NOTES_REASON
2896
2888
  },
2897
2889
  {
2898
2890
  command: ["notes", "add"],
2899
2891
  field: "examples",
2900
- before: null,
2892
+ before: "74234e98afe7498f",
2901
2893
  after: ['drive personal notes add DOC_ID "Check the numbers" --title Review'],
2902
2894
  reason: NOTES_REASON
2903
2895
  },
2904
2896
  {
2905
2897
  command: ["notes", "list"],
2906
2898
  field: "description",
2907
- before: "list stored notes",
2899
+ before: "6b866a022b5e84ce",
2908
2900
  after: "list a document's notes",
2909
2901
  reason: NOTES_REASON
2910
2902
  },
2911
2903
  {
2912
2904
  command: ["notes", "list"],
2913
2905
  field: "query",
2914
- before: {
2915
- entity: "note",
2916
- backend: "native",
2917
- fields: [
2918
- {
2919
- name: "ref",
2920
- type: "ref",
2921
- operators: ["term", "phrase"],
2922
- example: 'ref:"note:42"'
2923
- },
2924
- {
2925
- name: "kind",
2926
- type: "enum",
2927
- values: ["note", "document"],
2928
- operators: ["term"],
2929
- example: "kind:note"
2930
- },
2931
- {
2932
- name: "provider",
2933
- type: "kw",
2934
- operators: ["term", "phrase", "wildcard"],
2935
- example: "provider:abc"
2936
- },
2937
- {
2938
- name: "account",
2939
- type: "kw",
2940
- operators: ["term", "phrase", "wildcard"],
2941
- example: "account:abc"
2942
- },
2943
- {
2944
- name: "url",
2945
- type: "kw",
2946
- operators: ["term", "phrase", "wildcard"],
2947
- example: "url:abc"
2948
- },
2949
- {
2950
- name: "id",
2951
- type: "kw",
2952
- operators: ["term", "phrase", "wildcard"],
2953
- example: "id:abc"
2954
- },
2955
- {
2956
- name: "source",
2957
- type: "enum",
2958
- values: ["file", "internal"],
2959
- operators: ["term"],
2960
- example: "source:file"
2961
- },
2962
- {
2963
- name: "folder_id",
2964
- type: "kw",
2965
- operators: ["term", "phrase", "wildcard"],
2966
- example: "folder_id:abc"
2967
- },
2968
- {
2969
- name: "path",
2970
- type: "kw",
2971
- operators: ["term", "phrase", "wildcard"],
2972
- example: "path:abc"
2973
- },
2974
- {
2975
- name: "title",
2976
- type: "kw",
2977
- operators: ["term", "phrase", "wildcard"],
2978
- example: "title:abc"
2979
- },
2980
- {
2981
- name: "text",
2982
- type: "kw",
2983
- operators: ["term", "phrase", "wildcard"],
2984
- example: "text:abc"
2985
- },
2986
- {
2987
- name: "revision",
2988
- type: "num",
2989
- operators: ["term", "range"],
2990
- example: "revision>0"
2991
- },
2992
- {
2993
- name: "content_hash",
2994
- type: "kw",
2995
- operators: ["term", "phrase", "wildcard"],
2996
- example: "content_hash:abc"
2997
- },
2998
- {
2999
- name: "export_path",
3000
- type: "kw",
3001
- operators: ["term", "phrase", "wildcard"],
3002
- example: "export_path:abc"
3003
- },
3004
- {
3005
- name: "created_at",
3006
- type: "time",
3007
- operators: ["term", "range"],
3008
- example: "created_at>=7d"
3009
- },
3010
- {
3011
- name: "updated_at",
3012
- type: "time",
3013
- operators: ["term", "range"],
3014
- example: "updated_at>=7d"
3015
- },
3016
- {
3017
- name: "deleted_at",
3018
- type: "time",
3019
- operators: ["term", "range"],
3020
- example: "deleted_at>=7d"
3021
- },
3022
- {
3023
- name: "tags",
3024
- type: "kw",
3025
- operators: ["term", "phrase", "wildcard"],
3026
- example: "tags:abc"
3027
- },
3028
- {
3029
- name: "excerpt",
3030
- type: "kw",
3031
- operators: ["term", "phrase", "wildcard"],
3032
- example: "excerpt:abc"
3033
- },
3034
- {
3035
- name: "found_by",
3036
- type: "enum",
3037
- values: ["title", "words", "meaning"],
3038
- operators: ["term"],
3039
- example: "found_by:title"
3040
- }
3041
- ]
3042
- },
2906
+ before: "0b0517429a4f9613",
3043
2907
  after: {
3044
2908
  entity: "note",
3045
2909
  backend: "native",
3046
2910
  fields: [
3047
- {
3048
- name: "ref",
3049
- type: "ref",
3050
- operators: ["term", "phrase"],
3051
- example: 'ref:"note:42"'
3052
- },
3053
- {
3054
- name: "kind",
3055
- type: "enum",
3056
- values: ["note", "document"],
3057
- operators: ["term"],
3058
- example: "kind:note"
3059
- },
3060
- {
3061
- name: "provider",
3062
- type: "kw",
3063
- operators: ["term", "phrase", "wildcard"],
3064
- example: "provider:abc"
3065
- },
3066
- {
3067
- name: "account",
3068
- type: "kw",
3069
- operators: ["term", "phrase", "wildcard"],
3070
- example: "account:abc"
3071
- },
3072
- {
3073
- name: "url",
3074
- type: "kw",
3075
- operators: ["term", "phrase", "wildcard"],
3076
- example: "url:abc"
3077
- },
3078
- {
3079
- name: "id",
3080
- type: "kw",
3081
- operators: ["term", "phrase", "wildcard"],
3082
- example: "id:abc"
3083
- },
3084
- {
3085
- name: "source",
3086
- type: "enum",
3087
- values: ["file", "internal"],
3088
- operators: ["term"],
3089
- example: "source:file"
3090
- },
3091
- {
3092
- name: "folder_id",
3093
- type: "kw",
3094
- operators: ["term", "phrase", "wildcard"],
3095
- example: "folder_id:abc"
3096
- },
3097
- {
3098
- name: "path",
3099
- type: "kw",
3100
- operators: ["term", "phrase", "wildcard"],
3101
- example: "path:abc"
3102
- },
3103
- {
3104
- name: "title",
3105
- type: "kw",
3106
- operators: ["term", "phrase", "wildcard"],
3107
- example: "title:abc"
3108
- },
3109
- {
3110
- name: "text",
3111
- type: "kw",
3112
- operators: ["term", "phrase"],
3113
- example: "text:review",
3114
- native: true
3115
- },
3116
- {
3117
- name: "revision",
3118
- type: "num",
3119
- operators: ["term", "range"],
3120
- example: "revision>0"
3121
- },
3122
- {
3123
- name: "content_hash",
3124
- type: "kw",
3125
- operators: ["term", "phrase", "wildcard"],
3126
- example: "content_hash:abc"
3127
- },
3128
- {
3129
- name: "export_path",
3130
- type: "kw",
3131
- operators: ["term", "phrase", "wildcard"],
3132
- example: "export_path:abc"
3133
- },
3134
- {
3135
- name: "created_at",
3136
- type: "time",
3137
- operators: ["term", "range"],
3138
- example: "created_at>=7d"
3139
- },
3140
- {
3141
- name: "updated_at",
3142
- type: "time",
3143
- operators: ["term", "range"],
3144
- example: "updated_at>=7d"
3145
- },
3146
- {
3147
- name: "deleted_at",
3148
- type: "time",
3149
- operators: ["term", "range"],
3150
- example: "deleted_at>=7d"
3151
- },
3152
- {
3153
- name: "tags",
3154
- type: "kw",
3155
- operators: ["term", "phrase", "wildcard"],
3156
- example: "tags:abc"
3157
- },
3158
- {
3159
- name: "excerpt",
3160
- type: "kw",
3161
- operators: ["term", "phrase", "wildcard"],
3162
- example: "excerpt:abc"
3163
- },
2911
+ { name: "ref", type: "ref", operators: ["term", "phrase"], example: 'ref:"note:42"' },
2912
+ { name: "kind", type: "enum", values: ["note", "document"], operators: ["term"], example: "kind:note" },
2913
+ { name: "provider", type: "kw", operators: ["term", "phrase", "wildcard"], example: "provider:abc" },
2914
+ { name: "account", type: "kw", operators: ["term", "phrase", "wildcard"], example: "account:abc" },
2915
+ { name: "url", type: "kw", operators: ["term", "phrase", "wildcard"], example: "url:abc" },
2916
+ { name: "id", type: "kw", operators: ["term", "phrase", "wildcard"], example: "id:abc" },
2917
+ { name: "source", type: "enum", values: ["file", "internal"], operators: ["term"], example: "source:file" },
2918
+ { name: "folder_id", type: "kw", operators: ["term", "phrase", "wildcard"], example: "folder_id:abc" },
2919
+ { name: "path", type: "kw", operators: ["term", "phrase", "wildcard"], example: "path:abc" },
2920
+ { name: "title", type: "kw", operators: ["term", "phrase", "wildcard"], example: "title:abc" },
2921
+ { name: "text", type: "kw", operators: ["term", "phrase"], example: "text:review", native: true },
2922
+ { name: "revision", type: "num", operators: ["term", "range"], example: "revision>0" },
2923
+ { name: "content_hash", type: "kw", operators: ["term", "phrase", "wildcard"], example: "content_hash:abc" },
2924
+ { name: "export_path", type: "kw", operators: ["term", "phrase", "wildcard"], example: "export_path:abc" },
2925
+ { name: "created_at", type: "time", operators: ["term", "range"], example: "created_at>=7d" },
2926
+ { name: "updated_at", type: "time", operators: ["term", "range"], example: "updated_at>=7d" },
2927
+ { name: "deleted_at", type: "time", operators: ["term", "range"], example: "deleted_at>=7d" },
2928
+ { name: "tags", type: "kw", operators: ["term", "phrase", "wildcard"], example: "tags:abc" },
2929
+ { name: "excerpt", type: "kw", operators: ["term", "phrase", "wildcard"], example: "excerpt:abc" },
3164
2930
  {
3165
2931
  name: "found_by",
3166
2932
  type: "enum",
@@ -3175,14 +2941,7 @@ var SHELL_OVERRIDES = {
3175
2941
  {
3176
2942
  command: ["notes", "list"],
3177
2943
  field: "arguments",
3178
- before: [
3179
- {
3180
- name: "query",
3181
- required: false,
3182
- variadic: true,
3183
- description: "field:value terms; this list filters by none yet"
3184
- }
3185
- ],
2944
+ before: "350998d1fcef909c",
3186
2945
  after: [
3187
2946
  {
3188
2947
  name: "document",
@@ -3202,7 +2961,7 @@ var SHELL_OVERRIDES = {
3202
2961
  {
3203
2962
  command: ["notes", "list"],
3204
2963
  field: "options",
3205
- before: [],
2964
+ before: "4f53cda18c2baa0c",
3206
2965
  after: [
3207
2966
  {
3208
2967
  flags: "--limit <n>",
@@ -3211,34 +2970,21 @@ var SHELL_OVERRIDES = {
3211
2970
  mandatory: false,
3212
2971
  default: 50
3213
2972
  },
3214
- {
3215
- flags: "--page <n>",
3216
- description: "which page to return",
3217
- takes_value: true,
3218
- mandatory: false,
3219
- default: 1
3220
- }
2973
+ { flags: "--page <n>", description: "which page to return", takes_value: true, mandatory: false, default: 1 }
3221
2974
  ],
3222
2975
  reason: NOTES_REASON
3223
2976
  },
3224
2977
  {
3225
2978
  command: ["notes", "list"],
3226
2979
  field: "examples",
3227
- before: null,
2980
+ before: "74234e98afe7498f",
3228
2981
  after: ["drive personal notes list DOC_ID", "drive personal notes list DOC_ID text:review --limit 10"],
3229
2982
  reason: NOTES_REASON
3230
2983
  },
3231
2984
  {
3232
2985
  command: ["notes", "show"],
3233
2986
  field: "arguments",
3234
- before: [
3235
- {
3236
- name: "note",
3237
- required: true,
3238
- variadic: false,
3239
- description: "stored note reference"
3240
- }
3241
- ],
2987
+ before: "ae549d47fb4ad5ab",
3242
2988
  after: [
3243
2989
  {
3244
2990
  name: "document",
@@ -3246,46 +2992,28 @@ var SHELL_OVERRIDES = {
3246
2992
  variadic: false,
3247
2993
  description: "Google file or folder id or URL in the local catalog, or a document:<n> ref"
3248
2994
  },
3249
- {
3250
- name: "note",
3251
- required: true,
3252
- variadic: false,
3253
- description: "note:<id> reference, as notes list prints it"
3254
- }
2995
+ { name: "note", required: true, variadic: false, description: "note:<id> reference, as notes list prints it" }
3255
2996
  ],
3256
2997
  reason: NOTES_REASON
3257
2998
  },
3258
2999
  {
3259
3000
  command: ["notes", "show"],
3260
3001
  field: "examples",
3261
- before: null,
3002
+ before: "74234e98afe7498f",
3262
3003
  after: ["drive personal notes show DOC_ID note:NOTE_ID"],
3263
3004
  reason: NOTES_REASON
3264
3005
  },
3265
3006
  {
3266
3007
  command: ["notes", "edit"],
3267
3008
  field: "description",
3268
- before: "change a note",
3009
+ before: "e67289f2731a50ff",
3269
3010
  after: "replace a note's text",
3270
3011
  reason: NOTES_REASON
3271
3012
  },
3272
3013
  {
3273
3014
  command: ["notes", "edit"],
3274
3015
  field: "arguments",
3275
- before: [
3276
- {
3277
- name: "note",
3278
- required: true,
3279
- variadic: false,
3280
- description: "stored note reference"
3281
- },
3282
- {
3283
- name: "text",
3284
- required: true,
3285
- variadic: false,
3286
- description: "replacement text"
3287
- }
3288
- ],
3016
+ before: "c7d2686d3041bb14",
3289
3017
  after: [
3290
3018
  {
3291
3019
  name: "document",
@@ -3293,25 +3021,15 @@ var SHELL_OVERRIDES = {
3293
3021
  variadic: false,
3294
3022
  description: "Google file or folder id or URL in the local catalog, or a document:<n> ref"
3295
3023
  },
3296
- {
3297
- name: "note",
3298
- required: true,
3299
- variadic: false,
3300
- description: "note:<id> reference, as notes list prints it"
3301
- },
3302
- {
3303
- name: "text",
3304
- required: true,
3305
- variadic: false,
3306
- description: "the note's new text"
3307
- }
3024
+ { name: "note", required: true, variadic: false, description: "note:<id> reference, as notes list prints it" },
3025
+ { name: "text", required: true, variadic: false, description: "the note's new text" }
3308
3026
  ],
3309
3027
  reason: NOTES_REASON
3310
3028
  },
3311
3029
  {
3312
3030
  command: ["notes", "edit"],
3313
3031
  field: "options",
3314
- before: [],
3032
+ before: "4f53cda18c2baa0c",
3315
3033
  after: [
3316
3034
  {
3317
3035
  flags: "--revision <n>",
@@ -3325,28 +3043,21 @@ var SHELL_OVERRIDES = {
3325
3043
  {
3326
3044
  command: ["notes", "edit"],
3327
3045
  field: "examples",
3328
- before: null,
3046
+ before: "74234e98afe7498f",
3329
3047
  after: ['drive personal notes edit DOC_ID note:NOTE_ID "Numbers checked" --revision 2'],
3330
3048
  reason: NOTES_REASON
3331
3049
  },
3332
3050
  {
3333
3051
  command: ["notes", "remove"],
3334
3052
  field: "description",
3335
- before: "remove a note",
3053
+ before: "aa644f1603858b41",
3336
3054
  after: "delete one note",
3337
3055
  reason: NOTES_REASON
3338
3056
  },
3339
3057
  {
3340
3058
  command: ["notes", "remove"],
3341
3059
  field: "arguments",
3342
- before: [
3343
- {
3344
- name: "note",
3345
- required: true,
3346
- variadic: false,
3347
- description: "stored note reference"
3348
- }
3349
- ],
3060
+ before: "ae549d47fb4ad5ab",
3350
3061
  after: [
3351
3062
  {
3352
3063
  name: "document",
@@ -3354,19 +3065,14 @@ var SHELL_OVERRIDES = {
3354
3065
  variadic: false,
3355
3066
  description: "Google file or folder id or URL in the local catalog, or a document:<n> ref"
3356
3067
  },
3357
- {
3358
- name: "note",
3359
- required: true,
3360
- variadic: false,
3361
- description: "note:<id> reference, as notes list prints it"
3362
- }
3068
+ { name: "note", required: true, variadic: false, description: "note:<id> reference, as notes list prints it" }
3363
3069
  ],
3364
3070
  reason: NOTES_REASON
3365
3071
  },
3366
3072
  {
3367
3073
  command: ["notes", "remove"],
3368
3074
  field: "examples",
3369
- before: null,
3075
+ before: "74234e98afe7498f",
3370
3076
  after: ["drive personal notes remove DOC_ID note:NOTE_ID"],
3371
3077
  reason: NOTES_REASON
3372
3078
  }
@@ -3375,49 +3081,28 @@ var SHELL_OVERRIDES = {
3375
3081
  {
3376
3082
  command: ["commands"],
3377
3083
  field: "arguments",
3378
- before: [
3379
- {
3380
- name: "path",
3381
- required: false,
3382
- variadic: true,
3383
- description: "one command path, for example: commands info; inspect other groups in separate calls"
3384
- }
3385
- ],
3386
- after: [
3387
- {
3388
- name: "path",
3389
- required: false,
3390
- variadic: true,
3391
- description: "only this command or group, as words"
3392
- }
3393
- ],
3084
+ before: "2a309b1318d3ae57",
3085
+ after: [{ name: "path", required: false, variadic: true, description: "only this command or group, as words" }],
3394
3086
  reason: "Drive binds discovery to its profile-aware usage renderer while retaining the shared command document and evidence endpoint."
3395
3087
  },
3396
3088
  {
3397
3089
  command: ["commands"],
3398
3090
  field: "examples",
3399
- before: null,
3091
+ before: "74234e98afe7498f",
3400
3092
  after: ["drive commands", "drive commands files copy --json"],
3401
3093
  reason: "Drive binds discovery to its profile-aware usage renderer while retaining the shared command document and evidence endpoint."
3402
3094
  },
3403
3095
  {
3404
3096
  command: ["commands", "info"],
3405
3097
  field: "examples",
3406
- before: ["drive commands info commands"],
3098
+ before: "b5111d1de1d39c3d",
3407
3099
  after: ["drive commands info --json"],
3408
3100
  reason: "Drive binds discovery to its profile-aware usage renderer while retaining the shared command document and evidence endpoint."
3409
3101
  },
3410
3102
  {
3411
3103
  command: ["commands", "info"],
3412
3104
  field: "arguments",
3413
- before: [
3414
- {
3415
- name: "path",
3416
- required: false,
3417
- variadic: true,
3418
- description: "one command path; without one, export schemas, error reasons and explicit overrides"
3419
- }
3420
- ],
3105
+ before: "51e2a792c77a31bd",
3421
3106
  after: [
3422
3107
  {
3423
3108
  name: "path",
@@ -3433,21 +3118,21 @@ var SHELL_OVERRIDES = {
3433
3118
  {
3434
3119
  command: ["search"],
3435
3120
  field: "summary",
3436
- before: "search the local archive",
3121
+ before: "d8f6dac5b4fe912b",
3437
3122
  after: null,
3438
3123
  reason: SEARCH_REASON
3439
3124
  },
3440
3125
  {
3441
3126
  command: ["search"],
3442
3127
  field: "description",
3443
- before: "find things by text: one resource when you know it (messages, notes), or search all across messages and notes; for mail, the separate memo CLI: memo search mail",
3128
+ before: "600ae3fd56e9ef36",
3444
3129
  after: "search imported documents by words, and by meaning when indexed",
3445
3130
  reason: SEARCH_REASON
3446
3131
  },
3447
3132
  {
3448
3133
  command: ["search"],
3449
3134
  field: "arguments",
3450
- before: [],
3135
+ before: "4f53cda18c2baa0c",
3451
3136
  after: [
3452
3137
  {
3453
3138
  name: "query",
@@ -3461,7 +3146,7 @@ var SHELL_OVERRIDES = {
3461
3146
  {
3462
3147
  command: ["search"],
3463
3148
  field: "options",
3464
- before: [],
3149
+ before: "4f53cda18c2baa0c",
3465
3150
  after: [
3466
3151
  {
3467
3152
  flags: "--limit <n>",
@@ -3470,13 +3155,7 @@ var SHELL_OVERRIDES = {
3470
3155
  mandatory: false,
3471
3156
  default: 20
3472
3157
  },
3473
- {
3474
- flags: "--page <n>",
3475
- description: "which page to return",
3476
- takes_value: true,
3477
- mandatory: false,
3478
- default: 1
3479
- },
3158
+ { flags: "--page <n>", description: "which page to return", takes_value: true, mandatory: false, default: 1 },
3480
3159
  {
3481
3160
  flags: "--exact",
3482
3161
  description: "match the words exactly: no word forms, no meaning",
@@ -3489,24 +3168,21 @@ var SHELL_OVERRIDES = {
3489
3168
  {
3490
3169
  command: ["search"],
3491
3170
  field: "children",
3492
- before: ["all", "messages", "notes", "conversations", "runs"],
3171
+ before: "595cc576273270f2",
3493
3172
  after: [],
3494
3173
  reason: SEARCH_REASON
3495
3174
  },
3496
3175
  {
3497
3176
  command: ["search"],
3498
3177
  field: "effects",
3499
- before: null,
3500
- after: {
3501
- remote: "none",
3502
- local: "read"
3503
- },
3178
+ before: "74234e98afe7498f",
3179
+ after: { remote: "none", local: "read" },
3504
3180
  reason: SEARCH_REASON
3505
3181
  },
3506
3182
  {
3507
3183
  command: ["search"],
3508
3184
  field: "examples",
3509
- before: null,
3185
+ before: "74234e98afe7498f",
3510
3186
  after: ["drive personal search budget", 'drive personal search "quarterly plan" --exact --limit 5'],
3511
3187
  reason: SEARCH_REASON
3512
3188
  }
@@ -3514,19 +3190,6 @@ var SHELL_OVERRIDES = {
3514
3190
  };
3515
3191
 
3516
3192
  // dist/commands/discovery.js
3517
- var installCompleteCommand = /* @__PURE__ */ __name((program, { streams }) => {
3518
- examples(annotate(program.command("complete"), { mcp: false, effects: NO_EFFECTS }).description("print a shell completion script, or complete words"), ["drive complete zsh"]).argument("[words...]", "a shell name, or after -- the words typed so far").allowUnknownOption().helpOption(false).action(async function(words) {
3519
- if (!program.rawArgs.includes("--")) {
3520
- if (words[0] === "--help" || words[0] === "-h")
3521
- return streams.data(this.helpInformation());
3522
- if (!["bash", "zsh", "fish", "powershell"].includes(words[0] ?? ""))
3523
- throw new CliError("validation_error", "choose a supported shell");
3524
- const { script } = await import("./dist-PY3MVR3G.js");
3525
- script(words[0], "drive", "drive");
3526
- } else
3527
- streams.data(formatSuggestions(suggest({ commands: describeDriveProgram(program), globalOptions: describeOptions(program), words })));
3528
- });
3529
- }, "installCompleteCommand");
3530
3193
  var installCommandsCommandDefinition = /* @__PURE__ */ __name((program, { print, streams }) => {
3531
3194
  examples(annotate(program.command("commands"), { effects: NO_EFFECTS }).description(DISCOVERY_DESCRIPTIONS.commands), ["drive commands", "drive commands files copy --json"]).argument("[path...]", "only this command or group, as words").action((path) => {
3532
3195
  const document = commandsDocument(program, path);
@@ -3547,14 +3210,15 @@ var installCommandsCommandDefinition = /* @__PURE__ */ __name((program, { print,
3547
3210
  }, "installCommandsCommandDefinition");
3548
3211
  var installCommandsCommand = /* @__PURE__ */ __name((...args) => {
3549
3212
  const [program, context] = args;
3550
- customizeSharedCommand(sharedCommandTemplate(DRIVE_APP, "commands"), "Drive binds discovery to its profile-aware usage renderer while retaining the shared command document and evidence endpoint.", () => {
3213
+ const reference = sharedCommandTemplate(DRIVE_APP, "commands");
3214
+ customizeSharedCommand(reference, "Drive binds discovery to its profile-aware usage renderer while retaining the shared command document and evidence endpoint.", () => {
3551
3215
  installCommandsCommandDefinition(...args);
3552
3216
  addContractInfo(program, (value) => context.streams.data(JSON.stringify(value)));
3553
3217
  const command = program.commands.find((command2) => command2.name() === "commands");
3554
3218
  if (!command)
3555
3219
  throw new Error("discovery builder did not install its command");
3556
3220
  return command;
3557
- }, SHELL_OVERRIDES.commands);
3221
+ }, reviewedOverrides(reference, SHELL_OVERRIDES.commands));
3558
3222
  }, "installCommandsCommand");
3559
3223
 
3560
3224
  // dist/commands/documents.js
@@ -3597,6 +3261,102 @@ var changedCopy = /* @__PURE__ */ __name(({ changed, local_modified_at }) => {
3597
3261
  };
3598
3262
  }, "changedCopy");
3599
3263
 
3264
+ // dist/documents-add.js
3265
+ var PASSES_ON = /* @__PURE__ */ new Set(["not_found", "permission_error", "authentication_error"]);
3266
+ var HOW = "drive <profile> documents add <url>, or --profiles <a,b|all>";
3267
+ var profilesToAdd = /* @__PURE__ */ __name((env, { option, word, chosen, lock }) => {
3268
+ if (option !== void 0 && word !== void 0)
3269
+ throw new CliError("validation_error", "name the profiles once: a profile word or --profiles, not both", {
3270
+ reason: "profile.conflict",
3271
+ param: "--profiles"
3272
+ });
3273
+ const listed2 = option === void 0 ? void 0 : option.trim() === "all" ? "all" : option.split(",").map((one) => one.trim()).filter(Boolean);
3274
+ if (lock !== void 0) {
3275
+ const locked = profileName(lock);
3276
+ if (listed2 === "all")
3277
+ throw profileLocked(locked, "every profile (all)");
3278
+ for (const name of listed2 ?? [word ?? chosen ?? locked])
3279
+ if (name !== locked)
3280
+ throw profileLocked(locked, "any other profile");
3281
+ return [locked];
3282
+ }
3283
+ const choices = Object.keys(readConfig(env).profiles).sort();
3284
+ const single = word ?? chosen;
3285
+ const names = listed2 === "all" ? choices : listed2 ?? (single === void 0 ? [] : [single]);
3286
+ if (names.length === 0)
3287
+ throw profileRequired(choices, HOW);
3288
+ const unique = [...new Set(names.map(profileName))];
3289
+ const most = maxAddProfiles(env);
3290
+ if (unique.length > most)
3291
+ throw new CliError("validation_error", `documents add tries at most ${most} profiles (max_add_profiles); name fewer with --profiles \u2014 profiles here: ${choices.join(", ")}`, { reason: "profile.too-many", profiles: choices, max_add_profiles: most });
3292
+ for (const name of unique)
3293
+ activeProfile(env, name);
3294
+ return unique;
3295
+ }, "profilesToAdd");
3296
+ var missOf = /* @__PURE__ */ __name((profile, error) => {
3297
+ if (!isCliError(error) || !PASSES_ON.has(error.code))
3298
+ return void 0;
3299
+ const told = error.details.google_reason;
3300
+ return {
3301
+ profile,
3302
+ code: error.code,
3303
+ reason: error.details.reason ?? null,
3304
+ ...typeof told === "string" ? { google_reason: told } : {}
3305
+ };
3306
+ }, "missOf");
3307
+ var stoppedAt = /* @__PURE__ */ __name((error, profile, tried) => isCliError(error) ? new CliError(error.code, error.message, { ...error.details, profile, tried }) : error, "stoppedAt");
3308
+ var notOpened = /* @__PURE__ */ __name((tried) => {
3309
+ const codes = new Set(tried.map((one) => one.code));
3310
+ const [only] = codes.size === 1 ? codes : [];
3311
+ const [code, reason] = only === "authentication_error" ? ["authentication_error", "document.signed-out"] : only === "permission_error" ? ["permission_error", "document.no-access"] : ["not_found", "document.not-opened"];
3312
+ const signIn = codes.has("authentication_error") ? "; sign in again with drive <profile> session start" : "";
3313
+ return new CliError(code, `no profile opened this document: ${tried.map((one) => `${one.profile} (${one.reason ?? one.code})`).join(", ")}${signIn}`, { reason, profiles: tried.map((one) => one.profile), tried });
3314
+ }, "notOpened");
3315
+ var addDocument = /* @__PURE__ */ __name(async (input) => {
3316
+ const id = fileId(input.url);
3317
+ const tried = [];
3318
+ for (const profile of input.profiles) {
3319
+ let content;
3320
+ try {
3321
+ content = await (await input.source(profile)).content(id, input.maxChars(profile));
3322
+ } catch (error) {
3323
+ const missed = missOf(profile, error);
3324
+ if (!missed)
3325
+ throw stoppedAt(error, profile, tried);
3326
+ tried.push(missed);
3327
+ continue;
3328
+ }
3329
+ const url = content.metadata.url;
3330
+ const added = await input.save({
3331
+ kind: "page",
3332
+ text: content.text,
3333
+ read: content.text.trim() ? "extracted" : "no-text",
3334
+ title: input.title ?? content.metadata.name,
3335
+ url,
3336
+ mime: content.metadata.mime,
3337
+ size: content.metadata.size ?? null,
3338
+ metadata: { source: "google-drive", google_file_id: id },
3339
+ ...input.subjects?.length ? { subjects: input.subjects } : {},
3340
+ by: input.by
3341
+ }, id);
3342
+ return {
3343
+ ref: added.note.ref,
3344
+ created: added.created,
3345
+ duplicate_of: added.duplicateOf,
3346
+ title: added.note.title,
3347
+ url,
3348
+ file_id: id,
3349
+ mime: content.metadata.mime,
3350
+ chars: content.text.length,
3351
+ kept: added.kept,
3352
+ subjects: added.subjects,
3353
+ profile,
3354
+ tried
3355
+ };
3356
+ }
3357
+ throw notOpened(tried);
3358
+ }, "addDocument");
3359
+
3600
3360
  // dist/commands/documents.js
3601
3361
  var DOCUMENT_REF = /^document:[1-9]\d*$/;
3602
3362
  var isDocumentRef = /* @__PURE__ */ __name((input) => DOCUMENT_REF.test(input), "isDocumentRef");
@@ -3628,8 +3388,14 @@ var importedDocument = /* @__PURE__ */ __name((context) => {
3628
3388
  return { id, ref: doc.reference, hash: doc.hash, snapshot: readSnapshot(context.env, context.selected(), id) };
3629
3389
  };
3630
3390
  }, "importedDocument");
3391
+ var addProfilesOf = /* @__PURE__ */ __name((env, command, word) => profilesToAdd(env, {
3392
+ option: command.opts().profiles,
3393
+ word,
3394
+ chosen: env.DRIVE_PROFILE || void 0,
3395
+ lock: env.DRIVE_PROFILE_LOCK || void 0
3396
+ }), "addProfilesOf");
3631
3397
  var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
3632
- const { env, selected, output, withIndex } = context;
3398
+ const { env, selected, output, withIndex, source, profileWord } = context;
3633
3399
  const imported = importedDocument(context);
3634
3400
  const documents = annotate(program.command("documents"), { effects: LOCAL_READ }).description("read imported documents and Google Docs");
3635
3401
  const documentArgument = "document id, Google Docs URL, or a search hit's document: ref";
@@ -3687,6 +3453,28 @@ var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
3687
3453
  const state = readState(env, selected(), activeProfile(env, selected()).principal);
3688
3454
  output(itemOf({ id, path: args.output, format: "markdown", ...ageOf(state) }, staleCopy(state)));
3689
3455
  });
3456
+ 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"), [
3457
+ "drive documents add https://docs.google.com/document/d/DOC_ID/edit --profiles work,personal",
3458
+ "drive personal documents add DOC_ID --subject person:PERSON_UID"
3459
+ ]).option("--profiles <names|all>", "profiles to try in this order, comma-separated, or all; at most max_add_profiles, in place of a profile word").option("--title <title>", "title to keep it under; the document's name when omitted").option("--subject <ref>", "a person, organization, project, task or meeting it is about; repeat to add more", (value, previous = []) => [...previous, value]).action(async (url, args, command) => {
3460
+ const profiles = addProfilesOf(env, command, profileWord());
3461
+ const added = await addDocument({
3462
+ url,
3463
+ profiles,
3464
+ source,
3465
+ maxChars: /* @__PURE__ */ __name((profile) => textLimit(env, profile), "maxChars"),
3466
+ // Opened only once a profile has read the document, so no Google call waits with the store open.
3467
+ save: /* @__PURE__ */ __name((input, driveFileId) => withIndex(async (index) => {
3468
+ if (!index.addSource)
3469
+ throw new CliError("configuration_error", "index cannot keep sources added by hand");
3470
+ return index.addSource(input, driveFileId);
3471
+ }, null), "save"),
3472
+ ...args.title ? { title: args.title } : {},
3473
+ ...args.subject ? { subjects: args.subject } : {},
3474
+ by: "owner"
3475
+ });
3476
+ output(itemOf(added));
3477
+ });
3690
3478
  }, "installDocumentCommands");
3691
3479
 
3692
3480
  // dist/browse.js
@@ -3712,7 +3500,7 @@ Each item, one level of the tree (--json prints them under "items"):
3712
3500
  child_folders folders directly inside it, or null when not counted (Shared with me, a level of over 1000 folders)
3713
3501
  added whether sync already imports this folder (folders add)
3714
3502
  Folders are listed by name. Only folders are listed; files inside them are not.
3715
- Failures carry error.reason: oauth.missing (not signed in), oauth.expired (sign in again),
3503
+ Failures carry error.reason: session.missing (not signed in), oauth.expired (sign in again),
3716
3504
  provider.rate-limited (retry later), not_found code (no such folder).`;
3717
3505
  var PAGE_BOUND = 1e3;
3718
3506
  var COUNTED_LEVEL = 1e3;
@@ -4035,7 +3823,7 @@ var installKnowledgeCommandsDefinition = /* @__PURE__ */ __name((program, helper
4035
3823
  ...terms.has("status") ? { status: terms.get("status") } : {},
4036
3824
  ...terms.has("scope") ? { scope: terms.get("scope") } : {}
4037
3825
  };
4038
- output(allOf((await run3(doc, (k, p, ref) => k.memories(p, ref, { ...filters, limit }))).map(memoryItem)));
3826
+ output(allOf((await run3(doc, (k, p, ref) => k.memories(p, ref, { ...filters, limit }))).items.map(memoryItem)));
4039
3827
  });
4040
3828
  const memoryActions = {
4041
3829
  show: "show one memory",
@@ -4052,7 +3840,7 @@ var installKnowledgeCommandsDefinition = /* @__PURE__ */ __name((program, helper
4052
3840
  const found = await run3(doc, (k, p, ref) => k.searchMemories(p, ref, text, scope2));
4053
3841
  output({
4054
3842
  ...allOf(found.items.map(memoryItem)),
4055
- ...found.limit_reached ? { meta: { truncated: true } } : {}
3843
+ ...found.hasMore ? { meta: { truncated: true } } : {}
4056
3844
  });
4057
3845
  });
4058
3846
  annotate(search, { query: defineQuery(MEMORY_SEARCH_QUERY), output: { entity: "memory" } });
@@ -4092,7 +3880,7 @@ var installKnowledgeCommandsDefinition = /* @__PURE__ */ __name((program, helper
4092
3880
  ...terms.has("kind") ? { type: terms.get("kind") } : {},
4093
3881
  ...terms.has("status") ? { status: terms.get("status") } : {}
4094
3882
  };
4095
- output(allOf((await run3(doc, (k, p, ref) => k.facts(p, ref, { ...filters, limit }))).map(factItem)));
3883
+ output(allOf((await run3(doc, (k, p, ref) => k.facts(p, ref, { ...filters, limit }))).items.map(factItem)));
4096
3884
  });
4097
3885
  const factActions = {
4098
3886
  show: "show one fact",
@@ -4109,13 +3897,14 @@ var installKnowledgeCommandsDefinition = /* @__PURE__ */ __name((program, helper
4109
3897
  examples(annotate(identities.command("link"), { effects: LOCAL_WRITE }).description("record that a Google account belongs to a known person"), ["drive personal identities link DOC_ID GOOGLE_ID person:PERSON_UID"]).argument("<document>", documentArgument).argument("<google-id>", "Google account id, as identities list prints it").argument("<person>", "person:<uid> reference of someone already known").action(async (doc, googleId, personRef) => output(itemOf(await run3(doc, (k, p, ref) => k.linkPerson(p, ref, googleId, personRef)))));
4110
3898
  }, "installKnowledgeCommandsDefinition");
4111
3899
  var installKnowledgeCommands = /* @__PURE__ */ __name((...args) => {
4112
- customizeSharedCommand(sharedCommandTemplate(DRIVE_APP, "notes"), "Drive notes annotate one explicitly selected imported document; document-bound arguments and receipts replace the generic note scope.", () => {
3900
+ const reference = sharedCommandTemplate(DRIVE_APP, "notes");
3901
+ customizeSharedCommand(reference, "Drive notes annotate one explicitly selected imported document; document-bound arguments and receipts replace the generic note scope.", () => {
4113
3902
  installKnowledgeCommandsDefinition(...args);
4114
3903
  const command = args[0].commands.find((command2) => command2.name() === "notes");
4115
3904
  if (!command)
4116
3905
  throw new Error("notes builder did not install its command");
4117
3906
  return command;
4118
- }, SHELL_OVERRIDES.notes);
3907
+ }, reviewedOverrides(reference, SHELL_OVERRIDES.notes));
4119
3908
  }, "installKnowledgeCommands");
4120
3909
 
4121
3910
  // dist/commands/mirrors.js
@@ -4126,7 +3915,7 @@ import { join as join5, resolve } from "node:path";
4126
3915
  import { readFileSync as readFileSync3 } from "node:fs";
4127
3916
 
4128
3917
  // dist/mirror-sheets.js
4129
- import { createHash } from "node:crypto";
3918
+ import { createHash as createHash2 } from "node:crypto";
4130
3919
  import { readFileSync as readFileSync2 } from "node:fs";
4131
3920
  var lastChange = /* @__PURE__ */ __name(async (call, id) => {
4132
3921
  try {
@@ -4234,7 +4023,7 @@ var trimmed = /* @__PURE__ */ __name((rows) => {
4234
4023
  out.pop();
4235
4024
  return out;
4236
4025
  }, "trimmed");
4237
- var hashRows = /* @__PURE__ */ __name((rows) => createHash("sha256").update(JSON.stringify(trimmed(rows))).digest("hex"), "hashRows");
4026
+ var hashRows = /* @__PURE__ */ __name((rows) => createHash2("sha256").update(JSON.stringify(trimmed(rows))).digest("hex"), "hashRows");
4238
4027
  var size = /* @__PURE__ */ __name((rows) => ({ rows: rows.length, columns: Math.max(0, ...rows.map((row) => row.length)) }), "size");
4239
4028
  var quoted = /* @__PURE__ */ __name((title2) => `'${title2.replace(/'/g, "''")}'`, "quoted");
4240
4029
  var range = /* @__PURE__ */ __name((title2, rows, columns) => `${quoted(title2)}!A1:${columnName(Math.max(columns, 1))}${Math.max(rows, 1)}`, "range");
@@ -22715,13 +22504,16 @@ var notImported = /* @__PURE__ */ __name((name, folders, documents) => {
22715
22504
  return void 0;
22716
22505
  return folders === 0 ? `profile ${name} has no folders selected, so nothing is imported to search \u2014 drive ${name} folders add FOLDER_ID, then drive ${name} sync` : `profile ${name} has imported no documents yet \u2014 drive ${name} sync`;
22717
22506
  }, "notImported");
22718
- var installSearchCommand = /* @__PURE__ */ __name((...args) => customizeSharedCommand(sharedCommandTemplate(DRIVE_APP, "search"), "Drive searches imported documents and embeddings rather than live messenger messages; its default action and pagination are explicitly provider-specific.", () => {
22719
- installSearchCommandDefinition(...args);
22720
- const command = args[0].commands.find((command2) => command2.name() === "search");
22721
- if (!command)
22722
- throw new Error("search builder did not install its command");
22723
- return command;
22724
- }, SHELL_OVERRIDES.search), "installSearchCommand");
22507
+ var installSearchCommand = /* @__PURE__ */ __name((...args) => {
22508
+ const reference = sharedCommandTemplate(DRIVE_APP, "search");
22509
+ return customizeSharedCommand(reference, "Drive searches imported documents and embeddings rather than live messenger messages; its default action and pagination are explicitly provider-specific.", () => {
22510
+ installSearchCommandDefinition(...args);
22511
+ const command = args[0].commands.find((command2) => command2.name() === "search");
22512
+ if (!command)
22513
+ throw new Error("search builder did not install its command");
22514
+ return command;
22515
+ }, reviewedOverrides(reference, SHELL_OVERRIDES.search));
22516
+ }, "installSearchCommand");
22725
22517
 
22726
22518
  // dist/commands/session.js
22727
22519
  var GRANTS = ["write", "activity", "apps"];
@@ -22752,7 +22544,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
22752
22544
  const app = application(env, { file: args.clientFile, clientId: args.clientId, profile: selected() });
22753
22545
  if (!app.clientSecret)
22754
22546
  streams.diagnostic("your Google app has no secret here, and Google refuses a Desktop app without one: set DRIVE_GOOGLE_CLIENT_SECRET\n");
22755
- const { login } = await import("./login-COFZ2IWP.js");
22547
+ const { login } = await import("./login-XHFESAFM.js");
22756
22548
  output(itemOf(await login({
22757
22549
  env,
22758
22550
  profile: selected(),
@@ -22783,7 +22575,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
22783
22575
  const name = selected();
22784
22576
  const config = readConfig(env);
22785
22577
  const profile = activeProfile(env, name);
22786
- const { credentials } = await import("./tokens-H2EJKGA5.js");
22578
+ const { credentials } = await import("./tokens-FGTBE7VW.js");
22787
22579
  const store = credentials(env, profile.storage, options.keyring);
22788
22580
  store.remove(name);
22789
22581
  writeConfig(env, config);
@@ -22830,7 +22622,7 @@ var selection = /* @__PURE__ */ __name((env, name, source) => {
22830
22622
  return { profile, state, options: { source, destination, collection: `google-drive:${profile.principal}`, env } };
22831
22623
  }, "selection");
22832
22624
  var checkStoreImport = /* @__PURE__ */ __name(async (env, name, source, bindings) => {
22833
- const { ensureSqlite } = await import("./sqlite-runtime-7YF6REKS.js");
22625
+ const { ensureSqlite } = await import("./sqlite-runtime-R7M5XUMW.js");
22834
22626
  await ensureSqlite();
22835
22627
  const { state, options } = selection(env, name, source);
22836
22628
  const preview = await previewDocumentTransfer({ ...options, bindings });
@@ -22843,14 +22635,14 @@ var checkStoreImport = /* @__PURE__ */ __name(async (env, name, source, bindings
22843
22635
  throw new CliError("configuration_error", "this profile already uses the selected store; only an existing transfer can be retried");
22844
22636
  return preview;
22845
22637
  }, "checkStoreImport");
22846
- var importStore = /* @__PURE__ */ __name(async (env, name, source, fingerprint, bindings) => {
22638
+ var importStore = /* @__PURE__ */ __name(async (env, name, source, fingerprint2, bindings) => {
22847
22639
  await checkStoreImport(env, name, source, bindings);
22848
22640
  const lock = await lockProfile(env, name);
22849
22641
  try {
22850
22642
  const { profile, state, options } = selection(env, name, source);
22851
22643
  lock.assertHeld();
22852
22644
  await checkStoreImport(env, name, source, bindings);
22853
- const receipt = await applyDocumentTransfer({ ...options, bindings, expected_fingerprint: fingerprint });
22645
+ const receipt = await applyDocumentTransfer({ ...options, bindings, expected_fingerprint: fingerprint2 });
22854
22646
  for (const [id, document] of Object.entries(state.documents)) {
22855
22647
  const reference = receipt.documents[`${id}.md`];
22856
22648
  if (!reference)
@@ -23004,9 +22796,10 @@ var installSyncCommands = /* @__PURE__ */ __name((program, context) => {
23004
22796
  // dist/commands/upgrade.js
23005
22797
  import { join as join8 } from "node:path";
23006
22798
 
23007
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/update/index.js
22799
+ // node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/update/index.js
23008
22800
  import { realpathSync } from "node:fs";
23009
22801
  import { fileURLToPath } from "node:url";
22802
+ var npmRegistry = /* @__PURE__ */ __name(() => hostFetch({ hosts: ["registry.npmjs.org"] }), "npmRegistry");
23010
22803
  var QUIET_WORDS = [
23011
22804
  "--help",
23012
22805
  "-h",
@@ -23030,7 +22823,7 @@ var appUpdate = /* @__PURE__ */ __name((app) => {
23030
22823
  }, "enabled");
23031
22824
  return {
23032
22825
  installer,
23033
- latest: /* @__PURE__ */ __name((environment = {}) => latestVersion(app.packageName, environment.fetch ?? fetch, { timeoutMs: 3e3 }), "latest"),
22826
+ latest: /* @__PURE__ */ __name((environment = {}) => latestVersion(app.packageName, environment.fetch ?? npmRegistry(), { timeoutMs: 3e3 }), "latest"),
23034
22827
  /** The package manager's output goes to stderr, so stdout stays one result. */
23035
22828
  runUpdate: /* @__PURE__ */ __name((argv, environment = {}) => environment.spawn ? environment.spawn(argv) : runUpdate(argv), "runUpdate"),
23036
22829
  /**
@@ -23051,7 +22844,7 @@ var appUpdate = /* @__PURE__ */ __name((app) => {
23051
22844
  command: app.command,
23052
22845
  version: app.version,
23053
22846
  statePath: app.statePath(env),
23054
- fetch: environment.fetch ?? fetch,
22847
+ fetch: environment.fetch ?? npmRegistry(),
23055
22848
  ...environment.now ? { now: environment.now } : {},
23056
22849
  format: pretty ? "pretty" : "json",
23057
22850
  stderrIsTTY: environment.stderrIsTTY ?? process.stderr.isTTY === true,
@@ -23221,8 +23014,8 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
23221
23014
  tags: await store.notes.noteTags(ref),
23222
23015
  links: await store.notes.links({ from: ref }),
23223
23016
  notes: await store.notes.notes({ source: "internal", about: ref, limit: 100 }),
23224
- memories: (await store.memories.list({ subject: ref, limit: 100 })).map(memoryItem),
23225
- facts: (await store.facts.list({ subject: ref, limit: 100 })).map(factItem),
23017
+ memories: (await store.memories.list({ subject: ref, limit: 100 })).items.map(memoryItem),
23018
+ facts: (await store.facts.list({ subject: ref, limit: 100 })).items.map(factItem),
23226
23019
  people: await port.people(principal, ref)
23227
23020
  };
23228
23021
  }, "context"),
@@ -23271,13 +23064,11 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
23271
23064
  const data = source.frontMatter;
23272
23065
  if (data?.source !== "google-drive" || !data.fileId)
23273
23066
  continue;
23274
- const contributors = [...data.owners ?? [], ...data.lastModifiedBy ? [data.lastModifiedBy] : []];
23275
- if (!contributors.some((user) => googleUserId(user) === googleId))
23067
+ if (!(data.owners ?? []).some((user) => googleUserId(user) === googleId))
23276
23068
  continue;
23277
23069
  await saveContributors(store, principal2, {
23278
23070
  id: data.fileId,
23279
23071
  owners: data.owners,
23280
- lastModifiedBy: data.lastModifiedBy,
23281
23072
  version: data.sourceVersion,
23282
23073
  modifiedAt: data.modifiedAt
23283
23074
  }, source.id, false);
@@ -23293,35 +23084,32 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
23293
23084
  };
23294
23085
  return port;
23295
23086
  }, "documentKnowledge");
23087
+ var ownerEvidence = /* @__PURE__ */ __name((metadata) => [
23088
+ "Google Drive lists this person as the document's owner",
23089
+ metadata.version && `version ${metadata.version}`,
23090
+ metadata.modifiedAt && `changed ${metadata.modifiedAt.slice(0, 10)}`
23091
+ ].filter(Boolean).join(", "), "ownerEvidence");
23296
23092
  var saveContributors = /* @__PURE__ */ __name(async (store, principal, metadata, documentId, register = true) => {
23297
- const users = [
23298
- ...(metadata.owners ?? []).map((user) => ({ user, role: "owner" })),
23299
- ...metadata.lastModifiedBy ? [{ user: metadata.lastModifiedBy, role: "last-editor" }] : []
23300
- ];
23301
23093
  const key = { provider: "google-drive", account: principal };
23302
- const identified = users.flatMap(({ user, role }) => {
23094
+ const identified = (metadata.owners ?? []).flatMap((user) => {
23303
23095
  const id = googleUserId(user);
23304
- return id ? [{ id, user, role }] : [];
23096
+ return id ? [{ id, user }] : [];
23305
23097
  });
23306
23098
  if (register && identified.length) {
23307
23099
  await store.accounts.saveAccount(key, { name: "Google Drive" });
23308
23100
  await store.people.savePeople(key, identified.map(({ id, user }) => ({ id, name: user.name ?? user.email ?? null, email: user.email ?? null })));
23309
23101
  }
23310
23102
  const links = [];
23311
- for (const { id, user, role } of identified) {
23103
+ for (const { id } of identified) {
23312
23104
  const person = await store.people.personOf({ provider: "google-drive", id });
23313
23105
  if (person)
23314
23106
  links.push({
23315
23107
  kind: "related-to",
23316
23108
  to: `person:${person.uid}`,
23317
- role,
23318
- evidence: JSON.stringify({
23319
- fileId: metadata.id,
23320
- version: metadata.version,
23321
- modifiedAt: metadata.modifiedAt,
23322
- user
23323
- }),
23109
+ role: "owner",
23110
+ evidence: ownerEvidence(metadata),
23324
23111
  provenance: "google-drive:files.get",
23112
+ // Google's word, not the owner's: the store files it as the account's report, never in his memory or review.
23325
23113
  confirmed: false
23326
23114
  });
23327
23115
  }
@@ -23354,8 +23142,8 @@ var prepareStore = /* @__PURE__ */ __name(async (index, env, name, rescan = fals
23354
23142
  for (const note2 of page.items) {
23355
23143
  counts.tags += (await old.notes.noteTags(note2.ref)).length;
23356
23144
  counts.notes += (await old.notes.notes({ source: "internal", about: note2.ref, limit: 1 })).items.length;
23357
- counts.memories += (await old.memories.list({ subject: note2.ref, limit: 1 })).length;
23358
- counts.facts += (await old.facts.list({ subject: note2.ref, limit: 1 })).length;
23145
+ counts.memories += (await old.memories.list({ subject: note2.ref, limit: 1 })).items.length;
23146
+ counts.facts += (await old.facts.list({ subject: note2.ref, limit: 1 })).items.length;
23359
23147
  counts.links += (await old.notes.links({ from: note2.ref })).filter((link) => link.origin !== "file").length;
23360
23148
  counts.links += (await old.notes.links({ to: note2.ref })).length;
23361
23149
  }
@@ -23420,18 +23208,25 @@ var DRIVE_PROVIDER = {
23420
23208
  command: "drive",
23421
23209
  opens: { document: "documents show" }
23422
23210
  };
23211
+ var syncedDocument = /* @__PURE__ */ __name(async (store, driveFileId) => {
23212
+ for (const account of await store.notes.documentsAccounts()) {
23213
+ if (account.account?.provider !== DRIVE_PROVIDER.name)
23214
+ continue;
23215
+ const entry = await store.catalog.get(account.id, `${driveFileId}.md`);
23216
+ if (entry?.active && entry.content === "indexed")
23217
+ return entry.ref;
23218
+ }
23219
+ return void 0;
23220
+ }, "syncedDocument");
23423
23221
  var openIndex = /* @__PURE__ */ __name(async (env, name, rescan = false) => {
23424
23222
  if (name)
23425
23223
  activeProfile(env, name);
23426
- const { ensureSqlite } = await import("./sqlite-runtime-7YF6REKS.js");
23427
- await ensureSqlite();
23428
- const { openStore: openStore2, storePath: storePath2 } = await import("./store-F5FJGWMR.js");
23429
23224
  if (env.DRIVE_STORE)
23430
23225
  throw new CliError("configuration_error", "DRIVE_STORE has been retired; use MESSAGING_STORE to select the shared database", { reason: "store.override-retired" });
23431
- const store = await openStore2({ path: storePath2(env), env, command: "drive", version: VERSION });
23226
+ const { openAppStore } = await import("./cli-KW6QQVS5.js");
23227
+ const store = await openAppStore(env, { app: { command: "drive", version: VERSION }, provider: DRIVE_PROVIDER });
23432
23228
  const index = indexOver(store, env);
23433
23229
  try {
23434
- await store.accounts.registerProvider(DRIVE_PROVIDER);
23435
23230
  if (name)
23436
23231
  await prepareStore(index, env, name, rescan);
23437
23232
  return index;
@@ -23467,10 +23262,19 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23467
23262
  await folder(principal, true);
23468
23263
  await store.accounts.saveProfile("drive", name, { provider: "google-drive", account: principal });
23469
23264
  }, "registerProfile"),
23265
+ addSource: /* @__PURE__ */ __name(async (input, driveFileId) => {
23266
+ const synced = driveFileId === void 0 ? void 0 : await syncedDocument(store, driveFileId);
23267
+ if (!synced)
23268
+ return store.notes.saveAddedSource(input);
23269
+ for (const subject of input.subjects ?? [])
23270
+ await store.notes.addLink({ from: synced, to: subject, kind: "about", origin: "owner", by: input.by });
23271
+ const subjects = (await store.notes.links({ from: synced, kind: "about" })).flatMap((link) => link.to ?? []);
23272
+ return { note: await store.notes.note(synced), created: false, duplicateOf: synced, kept: null, subjects };
23273
+ }, "addSource"),
23470
23274
  linkMessages: /* @__PURE__ */ __name((documents, since) => store.notes.linkMessages({ documents, ...since ? { since } : {} }), "linkMessages"),
23471
23275
  knowledge: documentKnowledge2(store, async (principal) => (await folder(principal, false))?.id),
23472
23276
  openPictures: /* @__PURE__ */ __name(async () => {
23473
- const { openPictureEmbedderFor, savePicture } = await import("./services-F5A6XQCV.js");
23277
+ const { openPictureEmbedderFor, savePicture } = await import("./services-2BOCGMJU.js");
23474
23278
  const embedder = pictureEmbedder ?? await openPictureEmbedderFor({ env, command: "drive" });
23475
23279
  return {
23476
23280
  save: /* @__PURE__ */ __name((reference, bytes) => savePicture(store, { ref: reference }, bytes, { embedder }), "save"),
@@ -23489,7 +23293,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23489
23293
  has_more: false,
23490
23294
  meaning_skipped: "this Google account has no imported sources"
23491
23295
  };
23492
- const { searchNotes } = await import("./services-F5A6XQCV.js");
23296
+ const { searchNotes } = await import("./services-2BOCGMJU.js");
23493
23297
  const result = await searchNotes(store, query, {
23494
23298
  ...options,
23495
23299
  folderIds: selected ? [selected.id] : [],
@@ -23502,11 +23306,13 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23502
23306
  const [file] = await store.files.ofDocument(picture.ref);
23503
23307
  return { ...picture, title: note2.title, url: file?.url ?? null };
23504
23308
  }));
23505
- const { pictures: _, ...rest } = result;
23309
+ const { pictures: _, items, hasMore, nextOffset, ...rest } = result;
23506
23310
  return {
23507
23311
  ...rest,
23312
+ has_more: hasMore,
23313
+ ...nextOffset === void 0 ? {} : { next_offset: nextOffset },
23508
23314
  ...result.pictures ? { pictures } : {},
23509
- hits: await Promise.all(result.hits.map(async (hit) => {
23315
+ hits: await Promise.all(items.map(async (hit) => {
23510
23316
  const note2 = await store.notes.note(hit.ref);
23511
23317
  const metadata = note2.frontMatter;
23512
23318
  const entry = note2.path ? await store.catalog.get(selected.id, note2.path) : void 0;
@@ -23520,7 +23326,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23520
23326
  };
23521
23327
  }, "search"),
23522
23328
  embed: /* @__PURE__ */ __name(async (max) => {
23523
- const { embedNotes } = await import("./services-F5A6XQCV.js");
23329
+ const { embedNotes } = await import("./services-2BOCGMJU.js");
23524
23330
  return embedNotes(store, { maxChunks: max, env, command: "drive" });
23525
23331
  }, "embed"),
23526
23332
  close: /* @__PURE__ */ __name(() => store.close(), "close")
@@ -23528,7 +23334,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23528
23334
  }, "indexOver");
23529
23335
 
23530
23336
  // dist/upload.js
23531
- import { createHash as createHash2 } from "node:crypto";
23337
+ import { createHash as createHash3 } from "node:crypto";
23532
23338
  import { createReadStream, mkdirSync as mkdirSync3, readFileSync as readFileSync5, rmSync as rmSync2, statSync as statSync3, writeFileSync as writeFileSync3 } from "node:fs";
23533
23339
  import { open } from "node:fs/promises";
23534
23340
  import { basename, join as join10, resolve as resolve6 } from "node:path";
@@ -23537,7 +23343,7 @@ var FIELDS = "id,name,size,md5Checksum,mimeType,parents";
23537
23343
  var QUANTUM = 256 * 1024;
23538
23344
  var CHUNK_BYTES = 32 * QUANTUM;
23539
23345
  var md5Of = /* @__PURE__ */ __name((path) => new Promise((done2, fail) => {
23540
- const hash = createHash2("md5");
23346
+ const hash = createHash3("md5");
23541
23347
  createReadStream(path).on("data", (chunk) => hash.update(chunk)).on("error", fail).on("end", () => done2(hash.digest("hex")));
23542
23348
  }), "md5Of");
23543
23349
  var nextByte = /* @__PURE__ */ __name((response) => {
@@ -23561,7 +23367,7 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
23561
23367
  if (chunk % QUANTUM !== 0)
23562
23368
  throw new CliError("validation_error", "a chunk must be a multiple of 256 KiB");
23563
23369
  const sleep = input.sleep ?? ((ms) => new Promise((wake) => setTimeout(wake, ms)));
23564
- const key = createHash2("sha256").update(JSON.stringify([path, size2, stat.mtimeMs, name, input.parent ?? ""])).digest("hex").slice(0, 24);
23370
+ const key = createHash3("sha256").update(JSON.stringify([path, size2, stat.mtimeMs, name, input.parent ?? ""])).digest("hex").slice(0, 24);
23565
23371
  const checkpointPath = join10(input.stateDir, "uploads", `${key}.json`);
23566
23372
  const readCheckpoint = /* @__PURE__ */ __name(() => {
23567
23373
  try {
@@ -23738,14 +23544,13 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23738
23544
  if (lock !== void 0) {
23739
23545
  profileName(lock);
23740
23546
  if (named !== void 0 && profileName(named) !== lock)
23741
- throw new CliError("permission_error", `this process is locked to profile ${lock} (DRIVE_PROFILE_LOCK) \u2014 profile ${named} is refused`, { reason: "profile.locked" });
23547
+ throw profileLocked(lock, `profile ${named}`);
23742
23548
  return lock;
23743
23549
  }
23744
23550
  if (named)
23745
23551
  return profileName(named);
23746
23552
  const config = readConfig(env, permissionNames(policyFlags().permissionKeys ?? /* @__PURE__ */ new Set()));
23747
- const choices = Object.keys(config.profiles).sort();
23748
- throw new CliError("validation_error", choices.length ? `name a profile: drive <profile> \u2026 \u2014 profiles here: ${choices.join(", ")} (or set DRIVE_PROFILE)` : "no profiles here yet; create one with drive personal session start (any name in place of personal)", { reason: "profile.required", profiles: choices });
23553
+ throw profileRequired(Object.keys(config.profiles).sort());
23749
23554
  }, "selected");
23750
23555
  let currentAction;
23751
23556
  let checkedMethod;
@@ -23775,7 +23580,8 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23775
23580
  permissionKeys: knownKeys
23776
23581
  };
23777
23582
  }, "policyFlags");
23778
- const runId = randomUUID2();
23583
+ const fallbackRunId = randomUUID2();
23584
+ const runId = /* @__PURE__ */ __name(() => runs.runId() ?? fallbackRunId, "runId");
23779
23585
  const shown = /* @__PURE__ */ __name(() => outputFor(currentAction ?? program), "shown");
23780
23586
  const print = /* @__PURE__ */ __name((render) => {
23781
23587
  const { renderer, format, streams: out } = shown();
@@ -23786,7 +23592,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23786
23592
  const whole = {
23787
23593
  ...snaked,
23788
23594
  meta: {
23789
- run_id: runId,
23595
+ run_id: runId(),
23790
23596
  duration_ms: Math.max(0, Math.round(Date.now() - startedAt)),
23791
23597
  complete: true,
23792
23598
  ...body.meta
@@ -23807,21 +23613,22 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23807
23613
  }, "output");
23808
23614
  const signal = /* @__PURE__ */ __name(() => environment().signal, "signal");
23809
23615
  const signedIn = /* @__PURE__ */ __name(async (name, scope2) => {
23810
- const { authorizedClient, checkAuthorization } = await import("./tokens-H2EJKGA5.js");
23616
+ const { authorizedClient, checkAuthorization } = await import("./tokens-FGTBE7VW.js");
23811
23617
  const client = authorizedClient(env, name, environment().keyring, signal());
23812
23618
  await checkAuthorization(client, scope2);
23813
23619
  return client;
23814
23620
  }, "signedIn");
23815
- const source = /* @__PURE__ */ __name(async () => {
23816
- const name = selected();
23621
+ const source = /* @__PURE__ */ __name(async (profile) => {
23622
+ const name = profile ?? selected();
23817
23623
  const fake = environment().source;
23818
23624
  if (fake)
23819
23625
  return fake(name);
23820
- const [{ googleSource }, client] = await Promise.all([import("./google-DVADVICN.js"), signedIn(name)]);
23626
+ const [{ googleSource }, client] = await Promise.all([import("./google-OBZMWA7J.js"), signedIn(name)]);
23821
23627
  return googleSource(client);
23822
23628
  }, "source");
23823
- const withIndex = /* @__PURE__ */ __name(async (fn) => {
23824
- const index = await (environment().index?.() ?? openIndex(env, selected(), currentAction?.opts().rescan === true));
23629
+ const withIndex = /* @__PURE__ */ __name(async (fn, profile) => {
23630
+ const name = profile === void 0 ? selected() : profile ?? void 0;
23631
+ const index = await (environment().index?.() ?? openIndex(env, name, currentAction?.opts().rescan === true));
23825
23632
  try {
23826
23633
  return await fn(index);
23827
23634
  } finally {
@@ -23960,7 +23767,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23960
23767
  if (fake)
23961
23768
  return await fake.call(method, params, body);
23962
23769
  const [{ googleApi }, client] = await Promise.all([
23963
- import("./google-api-QMFGCXBM.js"),
23770
+ import("./google-api-AV4X2JH3.js"),
23964
23771
  signedIn(selected(), descriptor.scope)
23965
23772
  ]);
23966
23773
  return await googleApi(client).call(method, params, body);
@@ -23986,7 +23793,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23986
23793
  if (fake)
23987
23794
  return fake(id, mime);
23988
23795
  const [{ googleDownload }, client] = await Promise.all([
23989
- import("./google-api-QMFGCXBM.js"),
23796
+ import("./google-api-AV4X2JH3.js"),
23990
23797
  signedIn(selected(), apiMethod(method).scope)
23991
23798
  ]);
23992
23799
  return googleDownload(client)(id, mime);
@@ -24004,7 +23811,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
24004
23811
  let request = environment().uploadRequest;
24005
23812
  if (!request) {
24006
23813
  const [{ googleUploadRequest }, client] = await Promise.all([
24007
- import("./google-api-QMFGCXBM.js"),
23814
+ import("./google-api-AV4X2JH3.js"),
24008
23815
  signedIn(selected(), apiMethod(method).scope)
24009
23816
  ]);
24010
23817
  request = googleUploadRequest(client);
@@ -24022,7 +23829,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
24022
23829
  installRemoteCommands(program, remote);
24023
23830
  installMirrorCommands(program, context, remote);
24024
23831
  installConfigCommands(program, context);
24025
- installCompleteCommand(program, context);
23832
+ program.addCommand(appCompleteCommand(DRIVE_APP, configuration));
24026
23833
  installModelCommands(program, context);
24027
23834
  installCommandsCommand(program, context);
24028
23835
  installUpgradeCommand(program, context);
@@ -24094,6 +23901,16 @@ Availability: unavailable \u2014 ${availability.reason}
24094
23901
  }
24095
23902
  if (words === "mcp revoke" && program.opts().readOnly)
24096
23903
  throw readOnlyRefusal("--read-only", "forget the browser logins");
23904
+ if (words === "documents add") {
23905
+ const flags2 = policyFlags();
23906
+ for (const name of addProfilesOf(env, action, profileWord()))
23907
+ await checkPolicy(env, name, "documents.add", true, flags2, askOnce);
23908
+ if (flags2.offline)
23909
+ throw offlineRefused();
23910
+ if (flags2.dryRun)
23911
+ preview();
23912
+ return;
23913
+ }
24097
23914
  if (PROFILE_SET_COMMANDS.has(words) || path[0] === "mcp") {
24098
23915
  const named = profileWord() ?? env.DRIVE_PROFILE ?? env.DRIVE_PROFILE_LOCK;
24099
23916
  if (words === "mcp serve" && named && action.opts().profiles === void 0)
@@ -24145,9 +23962,7 @@ Availability: unavailable \u2014 ${availability.reason}
24145
23962
  await checkPolicy(env, selected(), permission, mutates, flags, askOnce);
24146
23963
  checkedMethod = method;
24147
23964
  if (flags.offline && (method || metadata.effects?.remote !== "none"))
24148
- throw new CliError("permission_error", "this command may require network access; --offline was requested", {
24149
- reason: "offline.refused"
24150
- });
23965
+ throw offlineRefused();
24151
23966
  if (flags.dryRun && !googleOnly(metadata.effects))
24152
23967
  preview();
24153
23968
  if (flags.dryRun) {
@@ -24161,7 +23976,7 @@ Availability: unavailable \u2014 ${availability.reason}
24161
23976
  const parse = program.parseAsync.bind(program);
24162
23977
  const scope = {
24163
23978
  get runId() {
24164
- return runs.runId() ?? runId;
23979
+ return runId();
24165
23980
  },
24166
23981
  command: "",
24167
23982
  startedAt,
@@ -24208,7 +24023,7 @@ var mcpCommand = /* @__PURE__ */ __name(() => {
24208
24023
  const environment = environmentOf(action);
24209
24024
  if (environment.api)
24210
24025
  return;
24211
- const { grantAvailability } = await import("./grants-WKB2E4TA.js");
24026
+ const { grantAvailability } = await import("./grants-WTRLN4ZI.js");
24212
24027
  availability = grantAvailability(rootOf(root), environment.env ?? process.env, environment.keyring);
24213
24028
  });
24214
24029
  }, "mcpCommand");