@wirecat/drive-cli 0.64.0 → 0.65.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 (182) hide show
  1. package/dist/bin/drive.js +2 -2
  2. package/dist/bundle/{all-profiles-BPPT2AK5.js → all-profiles-PD7GJHFA.js} +14 -13
  3. package/dist/bundle/{anthropic-JW6GOJUD.js → anthropic-PJKFON5H.js} +20 -11
  4. package/dist/bundle/{app-server-KAQIOJMZ.js → app-server-6ELQA6FJ.js} +59 -56
  5. package/dist/bundle/{bun-UT7GNTPV.js → bun-P54TGES2.js} +2 -2
  6. package/dist/bundle/{bun-sqlite-2OIVV3LS.js → bun-sqlite-TND5ZRJH.js} +12 -8
  7. package/dist/bundle/chunk-2AFI4KGI.js +185 -0
  8. package/dist/bundle/{chunk-WWCYTMAV.js → chunk-3HXNDF6Q.js} +2 -2
  9. package/dist/bundle/{chunk-46CD64J2.js → chunk-3ONWN3IA.js} +166 -53
  10. package/dist/bundle/{chunk-4YRENUB5.js → chunk-42G2XNPN.js} +2 -2
  11. package/dist/bundle/chunk-4AOINPN2.js +66 -0
  12. package/dist/bundle/{chunk-ZF6GUZCE.js → chunk-4EDWLR22.js} +1 -1
  13. package/dist/bundle/{chunk-BEZJA44H.js → chunk-4Y5YBFMS.js} +7 -7
  14. package/dist/bundle/{chunk-B7XBIOMR.js → chunk-54V4H6PM.js} +16 -16
  15. package/dist/bundle/{chunk-4CNTID2X.js → chunk-5XSBCMAF.js} +4 -4
  16. package/dist/bundle/{chunk-IDAK4DDK.js → chunk-6DCLZLGX.js} +1 -1
  17. package/dist/bundle/{chunk-G4KEKKDE.js → chunk-7AQGVX5O.js} +20 -20
  18. package/dist/bundle/{chunk-34BIDKF4.js → chunk-7TAP7Y2E.js} +508 -155
  19. package/dist/bundle/{chunk-BZ2ZKILM.js → chunk-A27UVLPK.js} +3 -3
  20. package/dist/bundle/{chunk-SIOIMO62.js → chunk-A4QNADEX.js} +57 -51
  21. package/dist/bundle/{chunk-FXBHOCJK.js → chunk-ADLS6FVG.js} +1 -1
  22. package/dist/bundle/{chunk-66AF4FBW.js → chunk-B2LPCHQN.js} +4 -4
  23. package/dist/bundle/{chunk-M73NNJ3X.js → chunk-CGQRZRTH.js} +2 -2
  24. package/dist/bundle/{chunk-KVW4XNKB.js → chunk-CWLL63JD.js} +107 -48
  25. package/dist/bundle/{chunk-CPMRM3GQ.js → chunk-D6Z43SOG.js} +1592 -335
  26. package/dist/bundle/{chunk-QXCKJUZY.js → chunk-D7WB54P7.js} +111 -27
  27. package/dist/bundle/{chunk-VT2UFYPJ.js → chunk-DA63E2UM.js} +13 -9
  28. package/dist/bundle/{chunk-2FEZ24DK.js → chunk-ECEP4SO3.js} +20 -20
  29. package/dist/bundle/{chunk-ZSZJLJIA.js → chunk-EHU6EYGO.js} +38 -28
  30. package/dist/bundle/{chunk-EJ4PNHPP.js → chunk-ELJUBPY4.js} +1 -1
  31. package/dist/bundle/{chunk-F2VDAG32.js → chunk-EM7NL5ES.js} +3 -3
  32. package/dist/bundle/{chunk-O2QO5UZC.js → chunk-EU5MD24W.js} +13 -13
  33. package/dist/bundle/{chunk-KIN6PDFE.js → chunk-EZ2OLYEK.js} +4 -4
  34. package/dist/bundle/{chunk-OH3K2E7X.js → chunk-F56DRBGY.js} +655 -1220
  35. package/dist/bundle/{chunk-VIJ6ACYB.js → chunk-FA6JNXCC.js} +8 -8
  36. package/dist/bundle/{chunk-KE4XPPRQ.js → chunk-FBHSWQU7.js} +1531 -136
  37. package/dist/bundle/{chunk-ZRZ4HTCK.js → chunk-GW3LBY3T.js} +51 -67
  38. package/dist/bundle/{chunk-6B37XO6B.js → chunk-HP3NT6JJ.js} +3 -3
  39. package/dist/bundle/{chunk-IX7NQJLY.js → chunk-I272E6UR.js} +9 -8
  40. package/dist/bundle/{chunk-5HSRQ53R.js → chunk-IBO23OID.js} +2 -2
  41. package/dist/bundle/{chunk-EZ6O3ST3.js → chunk-II4S2DBJ.js} +3 -3
  42. package/dist/bundle/{chunk-3NULZGQU.js → chunk-IKHOIXJR.js} +2 -2
  43. package/dist/bundle/{chunk-JRXFW7HE.js → chunk-IMHW7VIV.js} +5 -5
  44. package/dist/bundle/{chunk-USLZE36C.js → chunk-JMJIH6JH.js} +6 -6
  45. package/dist/bundle/{chunk-C7WBNOYW.js → chunk-JPPPLKAO.js} +26 -1
  46. package/dist/bundle/{chunk-EQEGJVO2.js → chunk-LMKPP2JP.js} +1 -1
  47. package/dist/bundle/{chunk-G3NULXOM.js → chunk-M7ELUGU6.js} +4 -4
  48. package/dist/bundle/{chunk-6G53ZFUT.js → chunk-MCPOZNWG.js} +1 -1
  49. package/dist/bundle/{chunk-EWGVDFPT.js → chunk-NI5PD5KM.js} +39203 -35871
  50. package/dist/bundle/{chunk-AHB4OJCI.js → chunk-NQ5XMSLA.js} +3678 -2049
  51. package/dist/bundle/chunk-NQRTKYJB.js +257 -0
  52. package/dist/bundle/{chunk-3J5KAFNA.js → chunk-O6K2E7OA.js} +3917 -3005
  53. package/dist/bundle/{chunk-J62DI53V.js → chunk-O7ZDCOZE.js} +1 -1
  54. package/dist/bundle/{chunk-XPXKD63J.js → chunk-OFJXHEFT.js} +13 -13
  55. package/dist/bundle/chunk-OWMZUWCM.js +109 -0
  56. package/dist/bundle/chunk-PHOL2DZM.js +138 -0
  57. package/dist/bundle/{chunk-KG2XKEHL.js → chunk-PLP5527C.js} +5 -5
  58. package/dist/bundle/{chunk-5ZBR55US.js → chunk-RNHGQ35R.js} +1 -1
  59. package/dist/bundle/{chunk-IK6KH3RE.js → chunk-RX5CJ55S.js} +1 -1
  60. package/dist/bundle/{chunk-K6BSB53R.js → chunk-SE352DBY.js} +1 -1
  61. package/dist/bundle/chunk-SEQWBZYH.js +18 -0
  62. package/dist/bundle/{chunk-LOMW6F2E.js → chunk-SIWXYB4E.js} +3734 -3448
  63. package/dist/bundle/{chunk-GW3U6OLD.js → chunk-SNLSEYJO.js} +1 -1
  64. package/dist/bundle/{chunk-UJR272CP.js → chunk-SS4LKLD7.js} +52 -605
  65. package/dist/bundle/{chunk-BEUAICUD.js → chunk-TMHF4BCL.js} +2 -2
  66. package/dist/bundle/{chunk-BDYWZ7JE.js → chunk-TOVWMURV.js} +30 -6
  67. package/dist/bundle/{chunk-N622LRPM.js → chunk-TTP4NOP3.js} +4 -4
  68. package/dist/bundle/chunk-UTNRBOEN.js +53 -0
  69. package/dist/bundle/{chunk-36GPBPWM.js → chunk-VDZY3L7U.js} +3 -1
  70. package/dist/bundle/chunk-VHQYWFWV.js +13 -0
  71. package/dist/bundle/{chunk-VPLFD5RJ.js → chunk-VLXWAH5E.js} +4 -4
  72. package/dist/bundle/{chunk-UIEA6FIV.js → chunk-VMAMRFFC.js} +23 -23
  73. package/dist/bundle/{chunk-HW4UPST2.js → chunk-W2XY6C5S.js} +2 -2
  74. package/dist/bundle/{chunk-P7DEGRZA.js → chunk-WRAUO5EJ.js} +22 -24
  75. package/dist/bundle/{chunk-QEAD2LF4.js → chunk-WRMJN6UQ.js} +3 -3
  76. package/dist/bundle/{chunk-UD55VB2N.js → chunk-WVJHZIDH.js} +3 -3
  77. package/dist/bundle/{chunk-B67BLRAI.js → chunk-X7YGGWXI.js} +1 -59
  78. package/dist/bundle/{chunk-EC2XGDKJ.js → chunk-XPWZSW6Y.js} +4 -4
  79. package/dist/bundle/{chunk-E2LBCCTG.js → chunk-XYE7XZPB.js} +5 -5
  80. package/dist/bundle/{chunk-TNV2FXVK.js → chunk-Y5PKRITX.js} +5 -5
  81. package/dist/bundle/{chunk-5OFA5EXE.js → chunk-Z2ADO6UA.js} +2 -2
  82. package/dist/bundle/{chunk-PBMSBCVB.js → chunk-ZD4MB7NH.js} +1 -1
  83. package/dist/bundle/{chunk-2W464HAE.js → chunk-ZILALBYQ.js} +4 -4
  84. package/dist/bundle/{chunk-OEVHZOHC.js → chunk-ZR2EJPMQ.js} +44 -15
  85. package/dist/bundle/command-contract-25E4PYMD.js +40 -0
  86. package/dist/bundle/command-server-entry-36JXYIJB.js +170 -0
  87. package/dist/bundle/{decode-HTOQ6S3V.js → decode-T5ZW57WZ.js} +8 -8
  88. package/dist/bundle/{dispatch-SH5SP6LA.js → dispatch-RMA2XFYA.js} +9 -9
  89. package/dist/bundle/drive.js +11 -11
  90. package/dist/bundle/{echarts-KFHB6SLX.js → echarts-KQ44LPSF.js} +2 -2
  91. package/dist/bundle/{embed-YATFB2PN.js → embed-Q7XST53J.js} +9 -9
  92. package/dist/bundle/{embedder-MQPDFGTJ.js → embedder-RWZSBVW2.js} +12 -12
  93. package/dist/bundle/entry-HPLW4QL2.js +25 -0
  94. package/dist/bundle/{failure-4FQL4XJI.js → failure-7NP4QPIN.js} +4 -4
  95. package/dist/bundle/first-run-RL3RKYZW.js +30 -0
  96. package/dist/bundle/first-screen-NX3TM2VJ.js +38 -0
  97. package/dist/bundle/google-DPD5N6AQ.js +42 -0
  98. package/dist/bundle/{google-api-QMFGCXBM.js → google-api-P5DRHD7L.js} +61 -55
  99. package/dist/bundle/grants-TX4MHLI4.js +109 -0
  100. package/dist/bundle/{identity-FYVDK4M2.js → identity-VDV6CHRW.js} +6 -6
  101. package/dist/bundle/{instructions-D3GF3B7M.js → instructions-Q45FVY6H.js} +1 -1
  102. package/dist/bundle/{login-COFZ2IWP.js → login-XKN3NI6X.js} +67 -61
  103. package/dist/bundle/{mcp-RKJG22KM.js → mcp-7KQUJNFN.js} +2 -2
  104. package/dist/bundle/{node-OFICOKX3.js → node-MSW565D3.js} +2 -2
  105. package/dist/bundle/{node-KM3CUABH.js → node-P4E63KXA.js} +9 -9
  106. package/dist/bundle/{node-sqlite-DNBTDOXD.js → node-sqlite-S74XVVHL.js} +13 -9
  107. package/dist/bundle/oauth-6R7AWAES.js +22 -0
  108. package/dist/bundle/{open-PTPR2YWX.js → open-P7UQG7XJ.js} +8 -8
  109. package/dist/bundle/{openai-2KV5LUW4.js → openai-DDHJ57KZ.js} +19 -40
  110. package/dist/bundle/{process-EAW6NST2.js → process-NMUB5SHK.js} +1 -1
  111. package/dist/bundle/{program-6UV5Q5YN.js → program-PJNWP6JW.js} +294 -137
  112. package/dist/bundle/{prompt-634TPMJK.js → prompt-VOSMK4C2.js} +8 -8
  113. package/dist/bundle/{reasons-DDWCEYSQ.js → reasons-KDAXOC5S.js} +5 -5
  114. package/dist/bundle/{recognize-SJO6QUDW.js → recognize-GZIY63HS.js} +7 -7
  115. package/dist/bundle/{remote-6JXZITKF.js → remote-V3YGN7LN.js} +10 -10
  116. package/dist/bundle/{rerank-MD5VOPQ6.js → rerank-XRU6AVN7.js} +10 -10
  117. package/dist/bundle/{serve-LZTROA2M.js → serve-NDOAFA57.js} +12 -12
  118. package/dist/bundle/{server-NSA3UAFY.js → server-BKGWJYMC.js} +46 -44
  119. package/dist/bundle/server-QD2MUJJZ.js +72 -0
  120. package/dist/bundle/{services-F5A6XQCV.js → services-TYDMFQCA.js} +101 -41
  121. package/dist/bundle/{sqlite-runtime-7YF6REKS.js → sqlite-runtime-UAFJKSJR.js} +9 -9
  122. package/dist/bundle/{start-MUFLE6FA.js → start-2ZLDP2OE.js} +7 -7
  123. package/dist/bundle/{state-UC54F3YZ.js → state-6SP27J2K.js} +9 -9
  124. package/dist/bundle/{store-J53YNAH6.js → store-4UUY545Q.js} +25 -18
  125. package/dist/bundle/{store-F5FJGWMR.js → store-EJN27MXI.js} +61 -28
  126. package/dist/bundle/store-maintenance-command-LETURZDC.js +60 -0
  127. package/dist/bundle/tokens-MTFJPTYT.js +107 -0
  128. package/dist/commands/config.d.ts.map +1 -1
  129. package/dist/commands/config.js +6 -5
  130. package/dist/commands/config.js.map +1 -1
  131. package/dist/commands/context.d.ts +4 -2
  132. package/dist/commands/context.d.ts.map +1 -1
  133. package/dist/commands/context.js.map +1 -1
  134. package/dist/commands/documents.d.ts +2 -0
  135. package/dist/commands/documents.d.ts.map +1 -1
  136. package/dist/commands/documents.js +39 -3
  137. package/dist/commands/documents.js.map +1 -1
  138. package/dist/config.d.ts +13 -0
  139. package/dist/config.d.ts.map +1 -1
  140. package/dist/config.js +32 -2
  141. package/dist/config.js.map +1 -1
  142. package/dist/documents-add.d.ts +49 -0
  143. package/dist/documents-add.d.ts.map +1 -0
  144. package/dist/documents-add.js +122 -0
  145. package/dist/documents-add.js.map +1 -0
  146. package/dist/errors.d.ts +1 -0
  147. package/dist/errors.d.ts.map +1 -1
  148. package/dist/errors.js +9 -1
  149. package/dist/errors.js.map +1 -1
  150. package/dist/knowledge.d.ts +1 -1
  151. package/dist/knowledge.d.ts.map +1 -1
  152. package/dist/knowledge.js +15 -17
  153. package/dist/knowledge.js.map +1 -1
  154. package/dist/model.d.ts +3 -0
  155. package/dist/model.d.ts.map +1 -1
  156. package/dist/model.js.map +1 -1
  157. package/dist/program.d.ts.map +1 -1
  158. package/dist/program.js +22 -15
  159. package/dist/program.js.map +1 -1
  160. package/dist/reasons.d.ts.map +1 -1
  161. package/dist/reasons.js +25 -0
  162. package/dist/reasons.js.map +1 -1
  163. package/dist/store.d.ts.map +1 -1
  164. package/dist/store.js +20 -0
  165. package/dist/store.js.map +1 -1
  166. package/dist/version.d.ts +1 -1
  167. package/dist/version.js +1 -1
  168. package/package.json +4 -4
  169. package/dist/bundle/chunk-DD7EFG6B.js +0 -35
  170. package/dist/bundle/chunk-GSMYXGFR.js +0 -62
  171. package/dist/bundle/command-contract-H5OYJOPF.js +0 -38
  172. package/dist/bundle/entry-YZBB647C.js +0 -22
  173. package/dist/bundle/first-run-5JT3UQZB.js +0 -30
  174. package/dist/bundle/first-screen-BEMDEWO7.js +0 -36
  175. package/dist/bundle/google-DVADVICN.js +0 -36
  176. package/dist/bundle/grants-WKB2E4TA.js +0 -103
  177. package/dist/bundle/oauth-PDQHWFBF.js +0 -22
  178. package/dist/bundle/server-GT7X666D.js +0 -69
  179. package/dist/bundle/store-maintenance-command-GJVXLBAB.js +0 -58
  180. package/dist/bundle/tokens-H2EJKGA5.js +0 -101
  181. package/dist/bundle/{chunk-SW6C6WH5.js → chunk-YVNHQFLC.js} +0 -0
  182. 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-ZD4MB7NH.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-WRMJN6UQ.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-ZR2EJPMQ.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-VMAMRFFC.js";
72
76
  import {
73
77
  apiMethod,
74
78
  apiMethods,
@@ -77,7 +81,7 @@ import {
77
81
  schemas,
78
82
  validateApiParams,
79
83
  validateRequest
80
- } from "./chunk-2W464HAE.js";
84
+ } from "./chunk-ZILALBYQ.js";
81
85
  import {
82
86
  DISCOVERY_DESCRIPTIONS,
83
87
  MEMO_SCENARIOS,
@@ -108,23 +112,21 @@ import {
108
112
  skillCommand,
109
113
  suggest,
110
114
  upgradeCommand
111
- } from "./chunk-AHB4OJCI.js";
115
+ } from "./chunk-NQ5XMSLA.js";
112
116
  import {
113
- googleError
114
- } from "./chunk-GSMYXGFR.js";
115
- import "./chunk-K6BSB53R.js";
117
+ googleError,
118
+ offlineRefused
119
+ } from "./chunk-NQRTKYJB.js";
120
+ import "./chunk-SE352DBY.js";
116
121
  import "./chunk-SBZB7HMU.js";
117
- import "./chunk-GW3U6OLD.js";
118
- import "./chunk-ZRZ4HTCK.js";
119
- import "./chunk-QXCKJUZY.js";
122
+ import "./chunk-PHOL2DZM.js";
123
+ import "./chunk-SNLSEYJO.js";
124
+ import "./chunk-GW3LBY3T.js";
125
+ import "./chunk-D7WB54P7.js";
120
126
  import {
121
127
  storeInfo
122
- } from "./chunk-34BIDKF4.js";
123
- import {
124
- RecipientList,
125
- SendJournal,
126
- sendGuard
127
- } from "./chunk-UJR272CP.js";
128
+ } from "./chunk-7TAP7Y2E.js";
129
+ import "./chunk-SS4LKLD7.js";
128
130
  import {
129
131
  LIST_QUERY_GUIDE,
130
132
  listQuery,
@@ -135,13 +137,47 @@ import {
135
137
  typedQuery,
136
138
  unfilteredQuery,
137
139
  withQuery
138
- } from "./chunk-P7DEGRZA.js";
140
+ } from "./chunk-WRAUO5EJ.js";
141
+ import {
142
+ RecipientList,
143
+ SendJournal,
144
+ newOperationId,
145
+ sendGuard
146
+ } from "./chunk-O6K2E7OA.js";
147
+ import {
148
+ columnName,
149
+ modelGateway,
150
+ readSpreadsheet
151
+ } from "./chunk-FBHSWQU7.js";
152
+ import "./chunk-EU5MD24W.js";
139
153
  import {
140
154
  commandsText,
141
155
  inSection
142
- } from "./chunk-IX7NQJLY.js";
156
+ } from "./chunk-I272E6UR.js";
143
157
  import "./chunk-HTQTIKWP.js";
144
- import "./chunk-TNV2FXVK.js";
158
+ import "./chunk-54V4H6PM.js";
159
+ import {
160
+ latestVersion,
161
+ runUpdate,
162
+ updateNotice
163
+ } from "./chunk-TTP4NOP3.js";
164
+ import "./chunk-MCPOZNWG.js";
165
+ import "./chunk-EHU6EYGO.js";
166
+ import "./chunk-5XSBCMAF.js";
167
+ import "./chunk-EM7NL5ES.js";
168
+ import "./chunk-EZ2OLYEK.js";
169
+ import "./chunk-II4S2DBJ.js";
170
+ import {
171
+ applyDocumentTransfer,
172
+ previewDocumentTransfer
173
+ } from "./chunk-CWLL63JD.js";
174
+ import "./chunk-IMHW7VIV.js";
175
+ import "./chunk-5DPV7X27.js";
176
+ import "./chunk-2AFI4KGI.js";
177
+ import "./chunk-SEQWBZYH.js";
178
+ import "./chunk-VHQYWFWV.js";
179
+ import "./chunk-TMHF4BCL.js";
180
+ import "./chunk-Y5PKRITX.js";
145
181
  import {
146
182
  FETCH,
147
183
  InvalidArgumentError,
@@ -172,71 +208,49 @@ import {
172
208
  rootOf,
173
209
  settingRows,
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-SIWXYB4E.js";
212
+ import "./chunk-DA63E2UM.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-F56DRBGY.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-OWMZUWCM.js";
224
+ import {
225
+ setupPermissionCeiling
226
+ } from "./chunk-VLXWAH5E.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";
216
- import {
217
- applyDocumentTransfer,
218
- previewDocumentTransfer
219
- } from "./chunk-KVW4XNKB.js";
230
+ } from "./chunk-IKHOIXJR.js";
231
+ import "./chunk-O7ZDCOZE.js";
220
232
  import {
221
233
  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";
234
+ } from "./chunk-A27UVLPK.js";
235
+ import "./chunk-B2LPCHQN.js";
236
+ import "./chunk-HP3NT6JJ.js";
237
+ import "./chunk-Z2ADO6UA.js";
227
238
  import {
228
239
  CATALOG_QUERY,
229
240
  IMPORTED_DOCUMENT_QUERY,
230
241
  openStore
231
- } from "./chunk-EWGVDFPT.js";
232
- import "./chunk-UD55VB2N.js";
242
+ } from "./chunk-NI5PD5KM.js";
243
+ import "./chunk-WVJHZIDH.js";
244
+ import "./chunk-FA6JNXCC.js";
245
+ import "./chunk-JMJIH6JH.js";
233
246
  import {
234
247
  FACT_STATUSES,
235
248
  FACT_TYPES,
236
249
  MEMORY_KINDS,
237
250
  MEMORY_SCOPES,
238
- MEMORY_STATUSES
239
- } from "./chunk-CPMRM3GQ.js";
251
+ MEMORY_STATUSES,
252
+ inRun
253
+ } from "./chunk-D6Z43SOG.js";
240
254
  import {
241
255
  dateRange,
242
256
  defineQuery,
@@ -246,40 +260,37 @@ import {
246
260
  timezoneOf,
247
261
  validateQuery,
248
262
  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";
263
+ } from "./chunk-ECEP4SO3.js";
264
+ import "./chunk-X7YGGWXI.js";
265
+ import "./chunk-4AOINPN2.js";
266
+ import "./chunk-4Y5YBFMS.js";
267
+ import "./chunk-LMKPP2JP.js";
260
268
  import "./chunk-D72URWJE.js";
261
269
  import {
262
270
  installerOf
263
- } from "./chunk-IK6KH3RE.js";
271
+ } from "./chunk-RX5CJ55S.js";
264
272
  import {
265
273
  DRIVE_APP,
266
274
  PACKAGE,
267
275
  VERSION
268
- } from "./chunk-M73NNJ3X.js";
276
+ } from "./chunk-CGQRZRTH.js";
269
277
  import {
270
278
  REASONS
271
- } from "./chunk-C7WBNOYW.js";
272
- import "./chunk-SW6C6WH5.js";
273
- import "./chunk-36GPBPWM.js";
279
+ } from "./chunk-JPPPLKAO.js";
280
+ import "./chunk-YVNHQFLC.js";
281
+ import "./chunk-VDZY3L7U.js";
282
+ import {
283
+ storePath
284
+ } from "./chunk-UTNRBOEN.js";
274
285
  import {
275
286
  processStreams,
276
287
  saveConfigFile,
277
288
  writeSecurely
278
- } from "./chunk-G4KEKKDE.js";
279
- import "./chunk-KG2XKEHL.js";
289
+ } from "./chunk-7AQGVX5O.js";
290
+ import "./chunk-PLP5527C.js";
280
291
  import "./chunk-Y5E2WNWB.js";
281
- import "./chunk-IDAK4DDK.js";
282
- import "./chunk-HW4UPST2.js";
292
+ import "./chunk-6DCLZLGX.js";
293
+ import "./chunk-W2XY6C5S.js";
283
294
  import {
284
295
  array,
285
296
  boolean,
@@ -303,11 +314,11 @@ import {
303
314
  string,
304
315
  unknown,
305
316
  writes
306
- } from "./chunk-BDYWZ7JE.js";
317
+ } from "./chunk-TOVWMURV.js";
307
318
  import {
308
319
  CliError,
309
320
  isCliError
310
- } from "./chunk-EJ4PNHPP.js";
321
+ } from "./chunk-ELJUBPY4.js";
311
322
  import {
312
323
  __commonJS,
313
324
  __name,
@@ -2138,13 +2149,13 @@ var lockProfile = /* @__PURE__ */ __name(async (env, name) => {
2138
2149
  throw new CliError("provider_unavailable", "another sync or knowledge operation holds this profile's lock; retry later", { reason: "profile.busy" });
2139
2150
  }
2140
2151
  }, "lockProfile");
2141
- var profileLocked = /* @__PURE__ */ __name((env, name) => import_proper_lockfile.default.checkSync(profileDir(env, name), { stale: 3e4, realpath: false }), "profileLocked");
2152
+ var profileLocked2 = /* @__PURE__ */ __name((env, name) => import_proper_lockfile.default.checkSync(profileDir(env, name), { stale: 3e4, realpath: false }), "profileLocked");
2142
2153
 
2143
2154
  // dist/commands/account.js
2144
2155
  var removal = {
2145
2156
  signOut: /* @__PURE__ */ __name(async (profile, { env, keyring, mayRevoke }) => {
2146
2157
  const storage = readConfig(env).profiles[profile]?.storage ?? "keyring";
2147
- const { sessionKeeper } = await import("./tokens-H2EJKGA5.js");
2158
+ const { sessionKeeper } = await import("./tokens-MTFJPTYT.js");
2148
2159
  const { revoked } = await sessionKeeper({
2149
2160
  env,
2150
2161
  name: profile,
@@ -2159,7 +2170,7 @@ var removal = {
2159
2170
  return principal ? { provider: "google-drive", account: principal } : void 0;
2160
2171
  }, "account"),
2161
2172
  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")
2173
+ busy: /* @__PURE__ */ __name((profile, { env }) => profileLocked2(env, profile) ? "a sync or knowledge operation" : void 0, "busy")
2163
2174
  };
2164
2175
  var installAccountCommands = /* @__PURE__ */ __name((program, _context) => {
2165
2176
  annotate(program.command("account"), { effects: LOCAL_READ }).description("remove this profile from this computer").addCommand(accountRemoveCommand(DRIVE_APP, removal, { resolveSettings: configuration.resolveSettings }));
@@ -2661,7 +2672,7 @@ var installConfigCommands = /* @__PURE__ */ __name((program, { env, selected, ou
2661
2672
  "drive personal config set max_text_chars 100000",
2662
2673
  `drive personal config set permissions.files '"readonly"' --defaults`,
2663
2674
  "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) => {
2675
+ ]).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
2676
  const file = editable();
2666
2677
  const { at: scope, scope: name } = scopeOf(file, args.defaults);
2667
2678
  const setting = settingAt(key);
@@ -2683,6 +2694,8 @@ var installConfigCommands = /* @__PURE__ */ __name((program, { env, selected, ou
2683
2694
  throw new CliError("validation_error", "picture_search is true or false, set per profile");
2684
2695
  if (head === "max_text_chars")
2685
2696
  parsed = checkTextLimit(parsed);
2697
+ if (head === "max_add_profiles")
2698
+ parsed = checkAddProfiles(parsed);
2686
2699
  const at = [...scope, ...setting];
2687
2700
  const next = isNode(file.raw) ? structuredClone(file.raw) : {};
2688
2701
  let node = next;
@@ -2757,10 +2770,8 @@ var installModelCommands = /* @__PURE__ */ __name((program, { env, output, strea
2757
2770
  });
2758
2771
  const download = /* @__PURE__ */ __name(async (kind, id, acceptTerms) => {
2759
2772
  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");
2773
+ throw offlineRefused("downloading a model needs the network");
2774
+ const { downloadImageModel, downloadTextModel } = await import("./services-TYDMFQCA.js");
2764
2775
  const progress = /* @__PURE__ */ __name((line) => {
2765
2776
  if (!program.opts().quiet)
2766
2777
  streams.diagnostic(line);
@@ -3597,6 +3608,102 @@ var changedCopy = /* @__PURE__ */ __name(({ changed, local_modified_at }) => {
3597
3608
  };
3598
3609
  }, "changedCopy");
3599
3610
 
3611
+ // dist/documents-add.js
3612
+ var PASSES_ON = /* @__PURE__ */ new Set(["not_found", "permission_error", "authentication_error"]);
3613
+ var HOW = "drive <profile> documents add <url>, or --profiles <a,b|all>";
3614
+ var profilesToAdd = /* @__PURE__ */ __name((env, { option, word, chosen, lock }) => {
3615
+ if (option !== void 0 && word !== void 0)
3616
+ throw new CliError("validation_error", "name the profiles once: a profile word or --profiles, not both", {
3617
+ reason: "profile.conflict",
3618
+ param: "--profiles"
3619
+ });
3620
+ const listed2 = option === void 0 ? void 0 : option.trim() === "all" ? "all" : option.split(",").map((one) => one.trim()).filter(Boolean);
3621
+ if (lock !== void 0) {
3622
+ const locked = profileName(lock);
3623
+ if (listed2 === "all")
3624
+ throw profileLocked(locked, "every profile (all)");
3625
+ for (const name of listed2 ?? [word ?? chosen ?? locked])
3626
+ if (name !== locked)
3627
+ throw profileLocked(locked, "any other profile");
3628
+ return [locked];
3629
+ }
3630
+ const choices = Object.keys(readConfig(env).profiles).sort();
3631
+ const single = word ?? chosen;
3632
+ const names = listed2 === "all" ? choices : listed2 ?? (single === void 0 ? [] : [single]);
3633
+ if (names.length === 0)
3634
+ throw profileRequired(choices, HOW);
3635
+ const unique = [...new Set(names.map(profileName))];
3636
+ const most = maxAddProfiles(env);
3637
+ if (unique.length > most)
3638
+ 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 });
3639
+ for (const name of unique)
3640
+ activeProfile(env, name);
3641
+ return unique;
3642
+ }, "profilesToAdd");
3643
+ var missOf = /* @__PURE__ */ __name((profile, error) => {
3644
+ if (!isCliError(error) || !PASSES_ON.has(error.code))
3645
+ return void 0;
3646
+ const told = error.details.google_reason;
3647
+ return {
3648
+ profile,
3649
+ code: error.code,
3650
+ reason: error.details.reason ?? null,
3651
+ ...typeof told === "string" ? { google_reason: told } : {}
3652
+ };
3653
+ }, "missOf");
3654
+ var stoppedAt = /* @__PURE__ */ __name((error, profile, tried) => isCliError(error) ? new CliError(error.code, error.message, { ...error.details, profile, tried }) : error, "stoppedAt");
3655
+ var notOpened = /* @__PURE__ */ __name((tried) => {
3656
+ const codes = new Set(tried.map((one) => one.code));
3657
+ const [only] = codes.size === 1 ? codes : [];
3658
+ const [code, reason] = only === "authentication_error" ? ["authentication_error", "document.signed-out"] : only === "permission_error" ? ["permission_error", "document.no-access"] : ["not_found", "document.not-opened"];
3659
+ const signIn = codes.has("authentication_error") ? "; sign in again with drive <profile> session start" : "";
3660
+ 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 });
3661
+ }, "notOpened");
3662
+ var addDocument = /* @__PURE__ */ __name(async (input) => {
3663
+ const id = fileId(input.url);
3664
+ const tried = [];
3665
+ for (const profile of input.profiles) {
3666
+ let content;
3667
+ try {
3668
+ content = await (await input.source(profile)).content(id, input.maxChars(profile));
3669
+ } catch (error) {
3670
+ const missed = missOf(profile, error);
3671
+ if (!missed)
3672
+ throw stoppedAt(error, profile, tried);
3673
+ tried.push(missed);
3674
+ continue;
3675
+ }
3676
+ const url = content.metadata.url;
3677
+ const added = await input.save({
3678
+ kind: "page",
3679
+ text: content.text,
3680
+ read: content.text.trim() ? "extracted" : "no-text",
3681
+ title: input.title ?? content.metadata.name,
3682
+ url,
3683
+ mime: content.metadata.mime,
3684
+ size: content.metadata.size ?? null,
3685
+ metadata: { source: "google-drive", google_file_id: id },
3686
+ ...input.subjects?.length ? { subjects: input.subjects } : {},
3687
+ by: input.by
3688
+ }, id);
3689
+ return {
3690
+ ref: added.note.ref,
3691
+ created: added.created,
3692
+ duplicate_of: added.duplicateOf,
3693
+ title: added.note.title,
3694
+ url,
3695
+ file_id: id,
3696
+ mime: content.metadata.mime,
3697
+ chars: content.text.length,
3698
+ kept: added.kept,
3699
+ subjects: added.subjects,
3700
+ profile,
3701
+ tried
3702
+ };
3703
+ }
3704
+ throw notOpened(tried);
3705
+ }, "addDocument");
3706
+
3600
3707
  // dist/commands/documents.js
3601
3708
  var DOCUMENT_REF = /^document:[1-9]\d*$/;
3602
3709
  var isDocumentRef = /* @__PURE__ */ __name((input) => DOCUMENT_REF.test(input), "isDocumentRef");
@@ -3628,8 +3735,14 @@ var importedDocument = /* @__PURE__ */ __name((context) => {
3628
3735
  return { id, ref: doc.reference, hash: doc.hash, snapshot: readSnapshot(context.env, context.selected(), id) };
3629
3736
  };
3630
3737
  }, "importedDocument");
3738
+ var addProfilesOf = /* @__PURE__ */ __name((env, command, word) => profilesToAdd(env, {
3739
+ option: command.opts().profiles,
3740
+ word,
3741
+ chosen: env.DRIVE_PROFILE || void 0,
3742
+ lock: env.DRIVE_PROFILE_LOCK || void 0
3743
+ }), "addProfilesOf");
3631
3744
  var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
3632
- const { env, selected, output, withIndex } = context;
3745
+ const { env, selected, output, withIndex, source, profileWord } = context;
3633
3746
  const imported = importedDocument(context);
3634
3747
  const documents = annotate(program.command("documents"), { effects: LOCAL_READ }).description("read imported documents and Google Docs");
3635
3748
  const documentArgument = "document id, Google Docs URL, or a search hit's document: ref";
@@ -3687,6 +3800,28 @@ var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
3687
3800
  const state = readState(env, selected(), activeProfile(env, selected()).principal);
3688
3801
  output(itemOf({ id, path: args.output, format: "markdown", ...ageOf(state) }, staleCopy(state)));
3689
3802
  });
3803
+ 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"), [
3804
+ "drive documents add https://docs.google.com/document/d/DOC_ID/edit --profiles work,personal",
3805
+ "drive personal documents add DOC_ID --subject person:PERSON_UID"
3806
+ ]).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) => {
3807
+ const profiles = addProfilesOf(env, command, profileWord());
3808
+ const added = await addDocument({
3809
+ url,
3810
+ profiles,
3811
+ source,
3812
+ maxChars: /* @__PURE__ */ __name((profile) => textLimit(env, profile), "maxChars"),
3813
+ // Opened only once a profile has read the document, so no Google call waits with the store open.
3814
+ save: /* @__PURE__ */ __name((input, driveFileId) => withIndex(async (index) => {
3815
+ if (!index.addSource)
3816
+ throw new CliError("configuration_error", "index cannot keep sources added by hand");
3817
+ return index.addSource(input, driveFileId);
3818
+ }, null), "save"),
3819
+ ...args.title ? { title: args.title } : {},
3820
+ ...args.subject ? { subjects: args.subject } : {},
3821
+ by: "owner"
3822
+ });
3823
+ output(itemOf(added));
3824
+ });
3690
3825
  }, "installDocumentCommands");
3691
3826
 
3692
3827
  // dist/browse.js
@@ -22752,7 +22887,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
22752
22887
  const app = application(env, { file: args.clientFile, clientId: args.clientId, profile: selected() });
22753
22888
  if (!app.clientSecret)
22754
22889
  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");
22890
+ const { login } = await import("./login-XKN3NI6X.js");
22756
22891
  output(itemOf(await login({
22757
22892
  env,
22758
22893
  profile: selected(),
@@ -22783,7 +22918,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
22783
22918
  const name = selected();
22784
22919
  const config = readConfig(env);
22785
22920
  const profile = activeProfile(env, name);
22786
- const { credentials } = await import("./tokens-H2EJKGA5.js");
22921
+ const { credentials } = await import("./tokens-MTFJPTYT.js");
22787
22922
  const store = credentials(env, profile.storage, options.keyring);
22788
22923
  store.remove(name);
22789
22924
  writeConfig(env, config);
@@ -22830,7 +22965,7 @@ var selection = /* @__PURE__ */ __name((env, name, source) => {
22830
22965
  return { profile, state, options: { source, destination, collection: `google-drive:${profile.principal}`, env } };
22831
22966
  }, "selection");
22832
22967
  var checkStoreImport = /* @__PURE__ */ __name(async (env, name, source, bindings) => {
22833
- const { ensureSqlite } = await import("./sqlite-runtime-7YF6REKS.js");
22968
+ const { ensureSqlite } = await import("./sqlite-runtime-UAFJKSJR.js");
22834
22969
  await ensureSqlite();
22835
22970
  const { state, options } = selection(env, name, source);
22836
22971
  const preview = await previewDocumentTransfer({ ...options, bindings });
@@ -23004,7 +23139,7 @@ var installSyncCommands = /* @__PURE__ */ __name((program, context) => {
23004
23139
  // dist/commands/upgrade.js
23005
23140
  import { join as join8 } from "node:path";
23006
23141
 
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
23142
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/update/index.js
23008
23143
  import { realpathSync } from "node:fs";
23009
23144
  import { fileURLToPath } from "node:url";
23010
23145
  var QUIET_WORDS = [
@@ -23271,13 +23406,11 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
23271
23406
  const data = source.frontMatter;
23272
23407
  if (data?.source !== "google-drive" || !data.fileId)
23273
23408
  continue;
23274
- const contributors = [...data.owners ?? [], ...data.lastModifiedBy ? [data.lastModifiedBy] : []];
23275
- if (!contributors.some((user) => googleUserId(user) === googleId))
23409
+ if (!(data.owners ?? []).some((user) => googleUserId(user) === googleId))
23276
23410
  continue;
23277
23411
  await saveContributors(store, principal2, {
23278
23412
  id: data.fileId,
23279
23413
  owners: data.owners,
23280
- lastModifiedBy: data.lastModifiedBy,
23281
23414
  version: data.sourceVersion,
23282
23415
  modifiedAt: data.modifiedAt
23283
23416
  }, source.id, false);
@@ -23293,35 +23426,32 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
23293
23426
  };
23294
23427
  return port;
23295
23428
  }, "documentKnowledge");
23429
+ var ownerEvidence = /* @__PURE__ */ __name((metadata) => [
23430
+ "Google Drive lists this person as the document's owner",
23431
+ metadata.version && `version ${metadata.version}`,
23432
+ metadata.modifiedAt && `changed ${metadata.modifiedAt.slice(0, 10)}`
23433
+ ].filter(Boolean).join(", "), "ownerEvidence");
23296
23434
  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
23435
  const key = { provider: "google-drive", account: principal };
23302
- const identified = users.flatMap(({ user, role }) => {
23436
+ const identified = (metadata.owners ?? []).flatMap((user) => {
23303
23437
  const id = googleUserId(user);
23304
- return id ? [{ id, user, role }] : [];
23438
+ return id ? [{ id, user }] : [];
23305
23439
  });
23306
23440
  if (register && identified.length) {
23307
23441
  await store.accounts.saveAccount(key, { name: "Google Drive" });
23308
23442
  await store.people.savePeople(key, identified.map(({ id, user }) => ({ id, name: user.name ?? user.email ?? null, email: user.email ?? null })));
23309
23443
  }
23310
23444
  const links = [];
23311
- for (const { id, user, role } of identified) {
23445
+ for (const { id } of identified) {
23312
23446
  const person = await store.people.personOf({ provider: "google-drive", id });
23313
23447
  if (person)
23314
23448
  links.push({
23315
23449
  kind: "related-to",
23316
23450
  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
- }),
23451
+ role: "owner",
23452
+ evidence: ownerEvidence(metadata),
23324
23453
  provenance: "google-drive:files.get",
23454
+ // Google's word, not the owner's: the store files it as the account's report, never in his memory or review.
23325
23455
  confirmed: false
23326
23456
  });
23327
23457
  }
@@ -23420,12 +23550,22 @@ var DRIVE_PROVIDER = {
23420
23550
  command: "drive",
23421
23551
  opens: { document: "documents show" }
23422
23552
  };
23553
+ var syncedDocument = /* @__PURE__ */ __name(async (store, driveFileId) => {
23554
+ for (const account of await store.notes.documentsAccounts()) {
23555
+ if (account.account?.provider !== DRIVE_PROVIDER.name)
23556
+ continue;
23557
+ const entry = await store.catalog.get(account.id, `${driveFileId}.md`);
23558
+ if (entry?.active && entry.content === "indexed")
23559
+ return entry.ref;
23560
+ }
23561
+ return void 0;
23562
+ }, "syncedDocument");
23423
23563
  var openIndex = /* @__PURE__ */ __name(async (env, name, rescan = false) => {
23424
23564
  if (name)
23425
23565
  activeProfile(env, name);
23426
- const { ensureSqlite } = await import("./sqlite-runtime-7YF6REKS.js");
23566
+ const { ensureSqlite } = await import("./sqlite-runtime-UAFJKSJR.js");
23427
23567
  await ensureSqlite();
23428
- const { openStore: openStore2, storePath: storePath2 } = await import("./store-F5FJGWMR.js");
23568
+ const { openStore: openStore2, storePath: storePath2 } = await import("./store-EJN27MXI.js");
23429
23569
  if (env.DRIVE_STORE)
23430
23570
  throw new CliError("configuration_error", "DRIVE_STORE has been retired; use MESSAGING_STORE to select the shared database", { reason: "store.override-retired" });
23431
23571
  const store = await openStore2({ path: storePath2(env), env, command: "drive", version: VERSION });
@@ -23467,10 +23607,19 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23467
23607
  await folder(principal, true);
23468
23608
  await store.accounts.saveProfile("drive", name, { provider: "google-drive", account: principal });
23469
23609
  }, "registerProfile"),
23610
+ addSource: /* @__PURE__ */ __name(async (input, driveFileId) => {
23611
+ const synced = driveFileId === void 0 ? void 0 : await syncedDocument(store, driveFileId);
23612
+ if (!synced)
23613
+ return store.notes.saveAddedSource(input);
23614
+ for (const subject of input.subjects ?? [])
23615
+ await store.notes.addLink({ from: synced, to: subject, kind: "about", origin: "owner", by: input.by });
23616
+ const subjects = (await store.notes.links({ from: synced, kind: "about" })).flatMap((link) => link.to ?? []);
23617
+ return { note: await store.notes.note(synced), created: false, duplicateOf: synced, kept: null, subjects };
23618
+ }, "addSource"),
23470
23619
  linkMessages: /* @__PURE__ */ __name((documents, since) => store.notes.linkMessages({ documents, ...since ? { since } : {} }), "linkMessages"),
23471
23620
  knowledge: documentKnowledge2(store, async (principal) => (await folder(principal, false))?.id),
23472
23621
  openPictures: /* @__PURE__ */ __name(async () => {
23473
- const { openPictureEmbedderFor, savePicture } = await import("./services-F5A6XQCV.js");
23622
+ const { openPictureEmbedderFor, savePicture } = await import("./services-TYDMFQCA.js");
23474
23623
  const embedder = pictureEmbedder ?? await openPictureEmbedderFor({ env, command: "drive" });
23475
23624
  return {
23476
23625
  save: /* @__PURE__ */ __name((reference, bytes) => savePicture(store, { ref: reference }, bytes, { embedder }), "save"),
@@ -23489,7 +23638,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23489
23638
  has_more: false,
23490
23639
  meaning_skipped: "this Google account has no imported sources"
23491
23640
  };
23492
- const { searchNotes } = await import("./services-F5A6XQCV.js");
23641
+ const { searchNotes } = await import("./services-TYDMFQCA.js");
23493
23642
  const result = await searchNotes(store, query, {
23494
23643
  ...options,
23495
23644
  folderIds: selected ? [selected.id] : [],
@@ -23520,7 +23669,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
23520
23669
  };
23521
23670
  }, "search"),
23522
23671
  embed: /* @__PURE__ */ __name(async (max) => {
23523
- const { embedNotes } = await import("./services-F5A6XQCV.js");
23672
+ const { embedNotes } = await import("./services-TYDMFQCA.js");
23524
23673
  return embedNotes(store, { maxChunks: max, env, command: "drive" });
23525
23674
  }, "embed"),
23526
23675
  close: /* @__PURE__ */ __name(() => store.close(), "close")
@@ -23738,14 +23887,13 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23738
23887
  if (lock !== void 0) {
23739
23888
  profileName(lock);
23740
23889
  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" });
23890
+ throw profileLocked(lock, `profile ${named}`);
23742
23891
  return lock;
23743
23892
  }
23744
23893
  if (named)
23745
23894
  return profileName(named);
23746
23895
  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 });
23896
+ throw profileRequired(Object.keys(config.profiles).sort());
23749
23897
  }, "selected");
23750
23898
  let currentAction;
23751
23899
  let checkedMethod;
@@ -23807,21 +23955,22 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23807
23955
  }, "output");
23808
23956
  const signal = /* @__PURE__ */ __name(() => environment().signal, "signal");
23809
23957
  const signedIn = /* @__PURE__ */ __name(async (name, scope2) => {
23810
- const { authorizedClient, checkAuthorization } = await import("./tokens-H2EJKGA5.js");
23958
+ const { authorizedClient, checkAuthorization } = await import("./tokens-MTFJPTYT.js");
23811
23959
  const client = authorizedClient(env, name, environment().keyring, signal());
23812
23960
  await checkAuthorization(client, scope2);
23813
23961
  return client;
23814
23962
  }, "signedIn");
23815
- const source = /* @__PURE__ */ __name(async () => {
23816
- const name = selected();
23963
+ const source = /* @__PURE__ */ __name(async (profile) => {
23964
+ const name = profile ?? selected();
23817
23965
  const fake = environment().source;
23818
23966
  if (fake)
23819
23967
  return fake(name);
23820
- const [{ googleSource }, client] = await Promise.all([import("./google-DVADVICN.js"), signedIn(name)]);
23968
+ const [{ googleSource }, client] = await Promise.all([import("./google-DPD5N6AQ.js"), signedIn(name)]);
23821
23969
  return googleSource(client);
23822
23970
  }, "source");
23823
- const withIndex = /* @__PURE__ */ __name(async (fn) => {
23824
- const index = await (environment().index?.() ?? openIndex(env, selected(), currentAction?.opts().rescan === true));
23971
+ const withIndex = /* @__PURE__ */ __name(async (fn, profile) => {
23972
+ const name = profile === void 0 ? selected() : profile ?? void 0;
23973
+ const index = await (environment().index?.() ?? openIndex(env, name, currentAction?.opts().rescan === true));
23825
23974
  try {
23826
23975
  return await fn(index);
23827
23976
  } finally {
@@ -23960,7 +24109,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23960
24109
  if (fake)
23961
24110
  return await fake.call(method, params, body);
23962
24111
  const [{ googleApi }, client] = await Promise.all([
23963
- import("./google-api-QMFGCXBM.js"),
24112
+ import("./google-api-P5DRHD7L.js"),
23964
24113
  signedIn(selected(), descriptor.scope)
23965
24114
  ]);
23966
24115
  return await googleApi(client).call(method, params, body);
@@ -23986,7 +24135,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
23986
24135
  if (fake)
23987
24136
  return fake(id, mime);
23988
24137
  const [{ googleDownload }, client] = await Promise.all([
23989
- import("./google-api-QMFGCXBM.js"),
24138
+ import("./google-api-P5DRHD7L.js"),
23990
24139
  signedIn(selected(), apiMethod(method).scope)
23991
24140
  ]);
23992
24141
  return googleDownload(client)(id, mime);
@@ -24004,7 +24153,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
24004
24153
  let request = environment().uploadRequest;
24005
24154
  if (!request) {
24006
24155
  const [{ googleUploadRequest }, client] = await Promise.all([
24007
- import("./google-api-QMFGCXBM.js"),
24156
+ import("./google-api-P5DRHD7L.js"),
24008
24157
  signedIn(selected(), apiMethod(method).scope)
24009
24158
  ]);
24010
24159
  request = googleUploadRequest(client);
@@ -24094,6 +24243,16 @@ Availability: unavailable \u2014 ${availability.reason}
24094
24243
  }
24095
24244
  if (words === "mcp revoke" && program.opts().readOnly)
24096
24245
  throw readOnlyRefusal("--read-only", "forget the browser logins");
24246
+ if (words === "documents add") {
24247
+ const flags2 = policyFlags();
24248
+ for (const name of addProfilesOf(env, action, profileWord()))
24249
+ await checkPolicy(env, name, "documents.add", true, flags2, askOnce);
24250
+ if (flags2.offline)
24251
+ throw offlineRefused();
24252
+ if (flags2.dryRun)
24253
+ preview();
24254
+ return;
24255
+ }
24097
24256
  if (PROFILE_SET_COMMANDS.has(words) || path[0] === "mcp") {
24098
24257
  const named = profileWord() ?? env.DRIVE_PROFILE ?? env.DRIVE_PROFILE_LOCK;
24099
24258
  if (words === "mcp serve" && named && action.opts().profiles === void 0)
@@ -24145,9 +24304,7 @@ Availability: unavailable \u2014 ${availability.reason}
24145
24304
  await checkPolicy(env, selected(), permission, mutates, flags, askOnce);
24146
24305
  checkedMethod = method;
24147
24306
  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
- });
24307
+ throw offlineRefused();
24151
24308
  if (flags.dryRun && !googleOnly(metadata.effects))
24152
24309
  preview();
24153
24310
  if (flags.dryRun) {
@@ -24208,7 +24365,7 @@ var mcpCommand = /* @__PURE__ */ __name(() => {
24208
24365
  const environment = environmentOf(action);
24209
24366
  if (environment.api)
24210
24367
  return;
24211
- const { grantAvailability } = await import("./grants-WKB2E4TA.js");
24368
+ const { grantAvailability } = await import("./grants-TX4MHLI4.js");
24212
24369
  availability = grantAvailability(rootOf(root), environment.env ?? process.env, environment.keyring);
24213
24370
  });
24214
24371
  }, "mcpCommand");