@wirecat/drive-cli 0.69.0 → 0.71.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.
- package/README.md +3 -2
- package/contracts/wirecat.json +14 -13
- package/dist/age.d.ts +0 -36
- package/dist/age.d.ts.map +1 -1
- package/dist/age.js +0 -22
- package/dist/age.js.map +1 -1
- package/dist/bin/drive.js +2 -2
- package/dist/bundle/{all-profiles-B4A737YW.js → all-profiles-3QJG2NAN.js} +13 -13
- package/dist/bundle/{anthropic-RZGPDESM.js → anthropic-PSWTEU6G.js} +8 -8
- package/dist/bundle/{app-server-OWEW7DY5.js → app-server-PVTA6ABR.js} +66 -58
- package/dist/bundle/{bun-V5QLYBZU.js → bun-LU5LP3JI.js} +2 -2
- package/dist/bundle/{bun-sqlite-KHLHXXGH.js → bun-sqlite-PYMKLBRU.js} +9 -9
- package/dist/bundle/{chunk-CAQ5GW3A.js → chunk-22QQUKWA.js} +1 -1
- package/dist/bundle/{chunk-3YKAFLXY.js → chunk-26DHFMGZ.js} +2 -2
- package/dist/bundle/{chunk-Y2QVNVHK.js → chunk-2BVVU7GG.js} +1 -1
- package/dist/bundle/{chunk-7JKECODO.js → chunk-2LHAVY4U.js} +1 -11
- package/dist/bundle/{chunk-HEBZCKMU.js → chunk-2PUNKUYJ.js} +4389 -4709
- package/dist/bundle/chunk-2UUWXPOB.js +31 -0
- package/dist/bundle/{chunk-KUQDBWPU.js → chunk-35SCQ4VI.js} +31 -32
- package/dist/bundle/{chunk-O6PD7RZY.js → chunk-3EBBLKIT.js} +4 -4
- package/dist/bundle/{chunk-PV3AWPHR.js → chunk-3N2OFXB5.js} +5 -5
- package/dist/bundle/{chunk-SY2HLH5R.js → chunk-3UGYFXH6.js} +82 -25
- package/dist/bundle/{chunk-OUM4ZO53.js → chunk-4HWJOU7N.js} +1 -1
- package/dist/bundle/{chunk-6D44YQ5X.js → chunk-4PA4DHYV.js} +6 -6
- package/dist/bundle/{chunk-EA2OB75T.js → chunk-4QNW4NK6.js} +1 -1
- package/dist/bundle/{chunk-GK6KXBL6.js → chunk-6SJOTNHF.js} +4 -4
- package/dist/bundle/{chunk-NVDR72GP.js → chunk-6TNNT2MQ.js} +250 -174
- package/dist/bundle/{chunk-4YECZ6CN.js → chunk-6W763DZN.js} +12 -12
- package/dist/bundle/{chunk-IQ2QU2X6.js → chunk-6XFIITOG.js} +1024 -598
- package/dist/bundle/{chunk-AD7VI3XU.js → chunk-72C4YOCH.js} +7 -7
- package/dist/bundle/{chunk-6EL5AVXX.js → chunk-7PDHGZN4.js} +4 -4
- package/dist/bundle/{chunk-22SH77TG.js → chunk-ACUAV6VX.js} +64 -64
- package/dist/bundle/{chunk-BBJVV4E2.js → chunk-ASMMG72J.js} +68 -38
- package/dist/bundle/{chunk-XUHQ7DVT.js → chunk-B5KSXHJ7.js} +1 -1
- package/dist/bundle/{chunk-BVVXYZSU.js → chunk-BKSQBBYG.js} +9 -9
- package/dist/bundle/{chunk-5SJZDEIO.js → chunk-CJLVYIOP.js} +21 -21
- package/dist/bundle/chunk-COJSWDNU.js +170 -0
- package/dist/bundle/{chunk-GTDCP5OG.js → chunk-COOOO5B3.js} +4 -4
- package/dist/bundle/{chunk-LUZRVBQR.js → chunk-D5TGYUVU.js} +6 -6
- package/dist/bundle/{chunk-CZ4UEXCE.js → chunk-EOEU3AZN.js} +6 -6
- package/dist/bundle/{chunk-CU6RATZH.js → chunk-FCS26CYQ.js} +4 -4
- package/dist/bundle/{chunk-LRCSDAYK.js → chunk-FJH7DJWK.js} +4 -4
- package/dist/bundle/{chunk-U3RXH6RY.js → chunk-FP54WSIR.js} +4 -4
- package/dist/bundle/{chunk-3URYKAJP.js → chunk-FT3LN3HP.js} +1 -1
- package/dist/bundle/{chunk-CDSB7WVG.js → chunk-GBKNJWOZ.js} +8 -8
- package/dist/bundle/{chunk-4J5GJJ2I.js → chunk-GOWXXYEF.js} +2 -2
- package/dist/bundle/{chunk-PB6NWKH3.js → chunk-GPQ44Y2R.js} +2 -2
- package/dist/bundle/{chunk-E7URRFBB.js → chunk-GZ2D4KXG.js} +10 -15
- package/dist/bundle/{chunk-376ZGVUZ.js → chunk-HKY7X6NY.js} +4 -4
- package/dist/bundle/{chunk-6XNTELM5.js → chunk-HL52XXZX.js} +1 -1
- package/dist/bundle/{chunk-533XOW74.js → chunk-HMS6EEQL.js} +3 -3
- package/dist/bundle/{chunk-F5UUJU6R.js → chunk-I4RWW3UD.js} +49 -4
- package/dist/bundle/{chunk-TZ75K6R7.js → chunk-ICDCAQ6K.js} +8 -8
- package/dist/bundle/{chunk-WOUIHZRI.js → chunk-J5Q5FS2N.js} +18 -75
- package/dist/bundle/{chunk-EL2E3ABX.js → chunk-JDV7HNNQ.js} +13 -13
- package/dist/bundle/{chunk-ZUG67442.js → chunk-JZHBZOJR.js} +3 -3
- package/dist/bundle/{chunk-SEJBS7SI.js → chunk-KGERXYTV.js} +1 -1
- package/dist/bundle/{chunk-5TK2YQCO.js → chunk-KGYVHPGE.js} +2 -2
- package/dist/bundle/{chunk-HCZYJMBP.js → chunk-KYKW2W6X.js} +1 -1
- package/dist/bundle/{chunk-RLGQMMYE.js → chunk-L46C6HQ7.js} +35 -13
- package/dist/bundle/chunk-LXKYKRHD.js +387 -0
- package/dist/bundle/{chunk-N4ACIIQB.js → chunk-MIA7P6FZ.js} +2 -2
- package/dist/bundle/{chunk-ZBYKCVSV.js → chunk-MNLL5YLM.js} +2 -2
- package/dist/bundle/{chunk-UPCEHSIZ.js → chunk-OF422U5D.js} +21 -16
- package/dist/bundle/{chunk-JRFKCYMW.js → chunk-OJSBWP3F.js} +23 -6
- package/dist/bundle/{chunk-MHXZ62CU.js → chunk-P7CUM5IB.js} +1 -1
- package/dist/bundle/{chunk-I55XYREN.js → chunk-PRW6SYA3.js} +1094 -2526
- package/dist/bundle/chunk-Q7DOMFJ4.js +259 -0
- package/dist/bundle/{chunk-3RLRJHAI.js → chunk-QETR5HIZ.js} +12081 -12607
- package/dist/bundle/{chunk-QJGFQRTL.js → chunk-QFR2PNJN.js} +12 -12
- package/dist/bundle/{chunk-2Q4CB4EI.js → chunk-QNRRK3CN.js} +2 -2
- package/dist/bundle/{chunk-5B5NOAIA.js → chunk-QXC6IEH6.js} +45 -45
- package/dist/bundle/{chunk-T6X6EZ5N.js → chunk-RESDD3Q4.js} +3 -3
- package/dist/bundle/chunk-RJOQH5YY.js +1979 -0
- package/dist/bundle/{chunk-AMQGKMLZ.js → chunk-RWDKMU74.js} +3 -3
- package/dist/bundle/{chunk-VUPWDCYV.js → chunk-SAKO3P4H.js} +1 -1
- package/dist/bundle/{chunk-GHFBT2ZM.js → chunk-SDKQNOL5.js} +6 -6
- package/dist/bundle/{chunk-25FT44S3.js → chunk-SERXSCN3.js} +287 -569
- package/dist/bundle/{chunk-2DS2TDGW.js → chunk-TAFHYHKA.js} +20 -118
- package/dist/bundle/{chunk-XVH3WZSZ.js → chunk-TAUBRNC5.js} +53 -53
- package/dist/bundle/{chunk-2VFAXC6O.js → chunk-UDMNY63V.js} +22 -19
- package/dist/bundle/{chunk-EWUQIUTB.js → chunk-UTO2GO4P.js} +5 -5
- package/dist/bundle/{chunk-V4FMN5A6.js → chunk-WVDCCYS3.js} +17 -17
- package/dist/bundle/chunk-X4TIMMKJ.js +16 -0
- package/dist/bundle/chunk-XF4EXO2C.js +335 -0
- package/dist/bundle/{chunk-OOIAJRKQ.js → chunk-XMMFBPGC.js} +2 -2
- package/dist/bundle/{chunk-4ZFO2CVH.js → chunk-Y2NWGNUB.js} +5 -5
- package/dist/bundle/{chunk-IJCUAKR5.js → chunk-YJIGGUPI.js} +4 -4
- package/dist/bundle/{chunk-L342KHIZ.js → chunk-YMJ6IDGT.js} +6 -6
- package/dist/bundle/{chunk-WNMPIRRF.js → chunk-YPFWNVHV.js} +3 -3
- package/dist/bundle/{chunk-T4FMXDDV.js → chunk-YPNWIB6H.js} +3 -3
- package/dist/bundle/{chunk-FIVFP53N.js → chunk-YVI5SQPY.js} +1 -1
- package/dist/bundle/{chunk-RWQ7T4Y5.js → chunk-Z3KUSRCF.js} +2 -2
- package/dist/bundle/{chunk-WQOGHND4.js → chunk-Z56QFOBR.js} +1 -1
- package/dist/bundle/chunk-ZCR3IRZ2.js +823 -0
- package/dist/bundle/{chunk-SYUXKV2E.js → chunk-ZM63SUHG.js} +2 -2
- package/dist/bundle/{chunk-M4OP5ASJ.js → chunk-ZZ32DXTH.js} +1 -1
- package/dist/bundle/{cli-BS4L3HAP.js → cli-556DERZL.js} +88 -69
- package/dist/bundle/command-contract-VRTOAV6W.js +43 -0
- package/dist/bundle/{command-server-entry-CJ2CV7ZV.js → command-server-entry-AYLGNZWD.js} +33 -30
- package/dist/bundle/decode-QU24MWMN.js +299 -0
- package/dist/bundle/{dispatch-WBEOHZDV.js → dispatch-4KODNOXV.js} +9 -9
- package/dist/bundle/drive.js +11 -11
- package/dist/bundle/{echarts-QIXLXS3G.js → echarts-BXX4OQWC.js} +2 -2
- package/dist/bundle/{embed-YNZW5X6M.js → embed-KG27KG3D.js} +9 -9
- package/dist/bundle/{embedder-LRC2PKTS.js → embedder-IPAVUQUV.js} +12 -12
- package/dist/bundle/entry-MVXQETWS.js +25 -0
- package/dist/bundle/{failure-X6PSLVSO.js → failure-ESL7ETL4.js} +4 -4
- package/dist/bundle/first-run-4UVLW2WR.js +31 -0
- package/dist/bundle/first-screen-JAKAIINI.js +41 -0
- package/dist/bundle/google-22NXXJX5.js +45 -0
- package/dist/bundle/{google-api-7JDZDCWE.js → google-api-VCDBSNOW.js} +70 -62
- package/dist/bundle/grants-MQMTVCRQ.js +118 -0
- package/dist/bundle/{identity-E43WKN5F.js → identity-LOWMVGZY.js} +6 -6
- package/dist/bundle/{instructions-MD2RZT5Z.js → instructions-2VECIDXF.js} +1 -1
- package/dist/bundle/{login-RBDJPQAG.js → login-7GBONT7V.js} +78 -70
- package/dist/bundle/{mcp-TDKGDB4V.js → mcp-O6ACR2DX.js} +2 -2
- package/dist/bundle/meeting-combined-LVP4AZKA.js +27 -0
- package/dist/bundle/meeting-model-RAY5XDXZ.js +29 -0
- package/dist/bundle/meeting-semantic-G7PFOKU7.js +25 -0
- package/dist/bundle/{node-IEVT2FSJ.js → node-MPEQSFI3.js} +2 -2
- package/dist/bundle/{node-sqlite-IENH4TRX.js → node-sqlite-OLQMAYB4.js} +10 -10
- package/dist/bundle/oauth-SGH2I2BY.js +22 -0
- package/dist/bundle/{open-TZ5H7NYM.js → open-OXTE672W.js} +8 -8
- package/dist/bundle/{openai-XF2KB7W2.js → openai-EB3TPIZY.js} +32 -30
- package/dist/bundle/{process-6Q23D3TO.js → process-F6TKXWWA.js} +1 -1
- package/dist/bundle/{program-D5XWOHV5.js → program-4IFDZ7FM.js} +1356 -1338
- package/dist/bundle/{prompt-KUC5D4GX.js → prompt-F5RRHPN2.js} +8 -8
- package/dist/bundle/{reasons-KSYP5VDJ.js → reasons-UORHJDHK.js} +5 -5
- package/dist/bundle/{recognize-DPFW7HO3.js → recognize-DAVNZND3.js} +7 -7
- package/dist/bundle/{remote-MODTSUNH.js → remote-D5EYYIAU.js} +13 -13
- package/dist/bundle/{rerank-JK7SERLE.js → rerank-CND2GVLZ.js} +10 -10
- package/dist/bundle/{serve-BV2WHZLW.js → serve-ZHSPUIGX.js} +12 -12
- package/dist/bundle/server-DUVJWP3Q.js +80 -0
- package/dist/bundle/{server-N3WPEU7Z.js → server-YMAK4LHC.js} +54 -46
- package/dist/bundle/{services-SV6CFUCS.js → services-ZILSFJ6E.js} +79 -54
- package/dist/bundle/{sqlite-runtime-RZ5PLZVQ.js → sqlite-runtime-S5VPMZQH.js} +9 -9
- package/dist/bundle/{start-C6EXYXAL.js → start-CR6X25RT.js} +7 -7
- package/dist/bundle/{state-RAZIREVG.js → state-YFPHVIIJ.js} +9 -9
- package/dist/bundle/{store-DQKJKX2G.js → store-CL4ZJZRI.js} +23 -19
- package/dist/bundle/{store-2DLGLYS6.js → store-UODRT6X4.js} +31 -26
- package/dist/bundle/store-maintenance-command-DY5XIBWR.js +72 -0
- package/dist/bundle/tokens-AF7QOFOF.js +118 -0
- package/dist/catalog.d.ts +0 -28
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +0 -82
- package/dist/catalog.js.map +1 -1
- package/dist/commands/catalog.d.ts +3 -8
- package/dist/commands/catalog.d.ts.map +1 -1
- package/dist/commands/catalog.js +36 -109
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/context.d.ts +3 -0
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +20 -0
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +30 -72
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/folders.d.ts +1 -1
- package/dist/commands/folders.d.ts.map +1 -1
- package/dist/commands/folders.js +45 -48
- package/dist/commands/folders.js.map +1 -1
- package/dist/commands/knowledge.d.ts +4 -21
- package/dist/commands/knowledge.d.ts.map +1 -1
- package/dist/commands/knowledge.js +3 -241
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/commands/mirrors.d.ts +2 -2
- package/dist/commands/mirrors.d.ts.map +1 -1
- package/dist/commands/mirrors.js +46 -202
- package/dist/commands/mirrors.js.map +1 -1
- package/dist/commands/search.d.ts +1 -3
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +20 -42
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +36 -53
- package/dist/commands/sync.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/contract-overrides.d.ts +0 -2
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +0 -317
- package/dist/contract-overrides.js.map +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.d.ts.map +1 -1
- package/dist/knowledge.js +4 -3
- package/dist/knowledge.js.map +1 -1
- package/dist/list-queries.d.ts +0 -31
- package/dist/list-queries.d.ts.map +1 -1
- package/dist/list-queries.js +0 -36
- package/dist/list-queries.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +2 -3
- package/dist/program.js.map +1 -1
- package/dist/provider-json.d.ts.map +1 -1
- package/dist/provider-json.js +5 -5
- package/dist/provider-json.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +0 -10
- package/dist/reasons.js.map +1 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +1 -2
- package/dist/sync.js.map +1 -1
- package/dist/transcripts.d.ts +0 -6
- package/dist/transcripts.d.ts.map +1 -1
- package/dist/transcripts.js +0 -13
- package/dist/transcripts.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/command-contract-HYURWSD6.js +0 -40
- package/dist/bundle/decode-E2NM5SSM.js +0 -165
- package/dist/bundle/entry-2IMSWRJU.js +0 -25
- package/dist/bundle/first-run-7CPHQDM5.js +0 -30
- package/dist/bundle/first-screen-OKZ7GMFR.js +0 -38
- package/dist/bundle/google-WDKDBDD4.js +0 -45
- package/dist/bundle/grants-AU25GWKF.js +0 -110
- package/dist/bundle/oauth-3JGSN47Z.js +0 -22
- package/dist/bundle/server-6YDI4Y36.js +0 -72
- package/dist/bundle/store-maintenance-command-UJ5F5L4H.js +0 -64
- package/dist/bundle/tokens-LY3WML55.js +0 -110
- package/dist/knowledge-query.d.ts +0 -77
- package/dist/knowledge-query.d.ts.map +0 -1
- package/dist/knowledge-query.js +0 -104
- package/dist/knowledge-query.js.map +0 -1
- package/dist/bundle/{chunk-XWBPP2HX.js → chunk-VKE77B3F.js} +0 -0
- package/dist/bundle/{mdast-util-from-markdown-CE73EWJ2.js → mdast-util-from-markdown-FXEPSNER.js} +3 -3
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
MAX_ENTRIES,
|
|
5
|
-
supported,
|
|
6
|
-
tooManyEntries
|
|
7
|
-
} from "./chunk-OOIAJRKQ.js";
|
|
8
3
|
import {
|
|
9
4
|
ACCOUNT_FREE_COMMANDS,
|
|
10
5
|
ANY_PROFILE_COMMANDS,
|
|
@@ -15,20 +10,14 @@ import {
|
|
|
15
10
|
describeDriveProgram,
|
|
16
11
|
examples,
|
|
17
12
|
markProfileFree
|
|
18
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RWDKMU74.js";
|
|
19
14
|
import {
|
|
20
15
|
DEFAULTS_ONLY,
|
|
21
16
|
DEFAULT_LEVELS,
|
|
22
17
|
FILES_QUERY,
|
|
23
|
-
FOLDERS_QUERY,
|
|
24
|
-
IDENTITIES_QUERY,
|
|
25
|
-
LINKS_QUERY,
|
|
26
|
-
MIRRORS_QUERY,
|
|
27
|
-
NOTES_QUERY,
|
|
28
18
|
PROFILE_ONLY,
|
|
29
19
|
SESSIONS_QUERY,
|
|
30
20
|
SETTING_NAMES,
|
|
31
|
-
TAGS_QUERY,
|
|
32
21
|
TRANSCRIPTS_QUERY,
|
|
33
22
|
activeProfile,
|
|
34
23
|
application,
|
|
@@ -38,20 +27,15 @@ import {
|
|
|
38
27
|
configIssues,
|
|
39
28
|
configPath,
|
|
40
29
|
configuration,
|
|
41
|
-
configuredMirrors,
|
|
42
30
|
configuredSessions,
|
|
43
31
|
driveFileQuery,
|
|
44
32
|
fileId,
|
|
45
33
|
fileRow,
|
|
46
34
|
findTranscripts,
|
|
47
|
-
folderRow,
|
|
48
35
|
googleAppOf,
|
|
49
|
-
identityRow,
|
|
50
36
|
inspectConfig,
|
|
51
|
-
linkRow,
|
|
52
37
|
maxAddProfiles,
|
|
53
38
|
methodPolicyKeys,
|
|
54
|
-
mirrorRow,
|
|
55
39
|
oauthClientReport,
|
|
56
40
|
paths,
|
|
57
41
|
permissionKeys,
|
|
@@ -64,7 +48,6 @@ import {
|
|
|
64
48
|
refusal,
|
|
65
49
|
selectedFolders,
|
|
66
50
|
sessionRow,
|
|
67
|
-
tagRow,
|
|
68
51
|
termsOf,
|
|
69
52
|
textLimit,
|
|
70
53
|
transcriptQuery,
|
|
@@ -73,7 +56,11 @@ import {
|
|
|
73
56
|
unknownProfile,
|
|
74
57
|
withDefaults,
|
|
75
58
|
writeConfig
|
|
76
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-J5Q5FS2N.js";
|
|
60
|
+
import {
|
|
61
|
+
MAX_ENTRIES,
|
|
62
|
+
supported
|
|
63
|
+
} from "./chunk-XMMFBPGC.js";
|
|
77
64
|
import {
|
|
78
65
|
DOC,
|
|
79
66
|
DOCUMENT_LIST_FIELDS,
|
|
@@ -96,7 +83,7 @@ import {
|
|
|
96
83
|
syncDocuments,
|
|
97
84
|
syncMirrors,
|
|
98
85
|
watchMirrors
|
|
99
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-6TNNT2MQ.js";
|
|
100
87
|
import {
|
|
101
88
|
apiMethod,
|
|
102
89
|
apiMethods,
|
|
@@ -105,14 +92,10 @@ import {
|
|
|
105
92
|
schemas,
|
|
106
93
|
validateApiParams,
|
|
107
94
|
validateRequest
|
|
108
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-6SJOTNHF.js";
|
|
109
96
|
import {
|
|
110
97
|
operations
|
|
111
98
|
} from "./chunk-NYECVHFH.js";
|
|
112
|
-
import {
|
|
113
|
-
googleError,
|
|
114
|
-
offlineRefused
|
|
115
|
-
} from "./chunk-Y2QVNVHK.js";
|
|
116
99
|
import {
|
|
117
100
|
DISCOVERY_DESCRIPTIONS,
|
|
118
101
|
MEMO_SCENARIOS,
|
|
@@ -132,6 +115,7 @@ import {
|
|
|
132
115
|
entityFields,
|
|
133
116
|
generatedApiCommand,
|
|
134
117
|
guideCommand,
|
|
118
|
+
honoursDryRun,
|
|
135
119
|
identifier,
|
|
136
120
|
inSection,
|
|
137
121
|
modelCatalogueCommand,
|
|
@@ -143,17 +127,24 @@ import {
|
|
|
143
127
|
signInSteps,
|
|
144
128
|
skillCommand,
|
|
145
129
|
upgradeCommand
|
|
146
|
-
} from "./chunk-
|
|
147
|
-
import
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
130
|
+
} from "./chunk-6XFIITOG.js";
|
|
131
|
+
import {
|
|
132
|
+
googleError,
|
|
133
|
+
offlineRefused
|
|
134
|
+
} from "./chunk-2BVVU7GG.js";
|
|
135
|
+
import "./chunk-KGERXYTV.js";
|
|
136
|
+
import "./chunk-QFR2PNJN.js";
|
|
137
|
+
import "./chunk-HL52XXZX.js";
|
|
138
|
+
import "./chunk-35SCQ4VI.js";
|
|
139
|
+
import "./chunk-3UGYFXH6.js";
|
|
140
|
+
import "./chunk-HKY7X6NY.js";
|
|
151
141
|
import {
|
|
152
142
|
storeInfo
|
|
153
|
-
} from "./chunk-
|
|
154
|
-
import "./chunk-
|
|
155
|
-
import "./chunk-
|
|
156
|
-
import "./chunk-
|
|
143
|
+
} from "./chunk-ACUAV6VX.js";
|
|
144
|
+
import "./chunk-ICDCAQ6K.js";
|
|
145
|
+
import "./chunk-TAFHYHKA.js";
|
|
146
|
+
import "./chunk-L46C6HQ7.js";
|
|
147
|
+
import "./chunk-RESDD3Q4.js";
|
|
157
148
|
import {
|
|
158
149
|
LIST_QUERY_GUIDE,
|
|
159
150
|
RecipientList,
|
|
@@ -168,39 +159,39 @@ import {
|
|
|
168
159
|
typedQuery,
|
|
169
160
|
unfilteredQuery,
|
|
170
161
|
withQuery
|
|
171
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-2PUNKUYJ.js";
|
|
172
163
|
import {
|
|
173
164
|
columnName,
|
|
174
165
|
modelGateway,
|
|
175
166
|
readSpreadsheet
|
|
176
|
-
} from "./chunk-
|
|
177
|
-
import "./chunk-
|
|
178
|
-
import "./chunk-
|
|
167
|
+
} from "./chunk-QXC6IEH6.js";
|
|
168
|
+
import "./chunk-JDV7HNNQ.js";
|
|
169
|
+
import "./chunk-Q7DOMFJ4.js";
|
|
170
|
+
import "./chunk-LXKYKRHD.js";
|
|
171
|
+
import "./chunk-COJSWDNU.js";
|
|
172
|
+
import "./chunk-D5TGYUVU.js";
|
|
179
173
|
import "./chunk-HTQTIKWP.js";
|
|
180
|
-
import "./chunk-
|
|
174
|
+
import "./chunk-6W763DZN.js";
|
|
181
175
|
import {
|
|
182
176
|
latestVersion,
|
|
183
177
|
runUpdate,
|
|
184
178
|
updateNotice
|
|
185
|
-
} from "./chunk-
|
|
186
|
-
import "./chunk-
|
|
187
|
-
import "./chunk-
|
|
188
|
-
import "./chunk-
|
|
189
|
-
import "./chunk-
|
|
190
|
-
import "./chunk-O6PD7RZY.js";
|
|
191
|
-
import "./chunk-4ZFO2CVH.js";
|
|
192
|
-
import "./chunk-GHFBT2ZM.js";
|
|
179
|
+
} from "./chunk-FP54WSIR.js";
|
|
180
|
+
import "./chunk-YVI5SQPY.js";
|
|
181
|
+
import "./chunk-3EBBLKIT.js";
|
|
182
|
+
import "./chunk-Y2NWGNUB.js";
|
|
183
|
+
import "./chunk-SDKQNOL5.js";
|
|
193
184
|
import {
|
|
194
185
|
applyDocumentTransfer,
|
|
195
186
|
previewDocumentTransfer
|
|
196
|
-
} from "./chunk-
|
|
197
|
-
import "./chunk-
|
|
187
|
+
} from "./chunk-WVDCCYS3.js";
|
|
188
|
+
import "./chunk-UTO2GO4P.js";
|
|
198
189
|
import "./chunk-5DPV7X27.js";
|
|
199
|
-
import "./chunk-
|
|
200
|
-
import "./chunk-
|
|
201
|
-
import "./chunk-
|
|
202
|
-
import "./chunk-
|
|
203
|
-
import "./chunk-
|
|
190
|
+
import "./chunk-BKSQBBYG.js";
|
|
191
|
+
import "./chunk-B5KSXHJ7.js";
|
|
192
|
+
import "./chunk-P7CUM5IB.js";
|
|
193
|
+
import "./chunk-GPQ44Y2R.js";
|
|
194
|
+
import "./chunk-7PDHGZN4.js";
|
|
204
195
|
import {
|
|
205
196
|
CEILING_KEY,
|
|
206
197
|
FETCH,
|
|
@@ -235,83 +226,94 @@ import {
|
|
|
235
226
|
renderAnswer,
|
|
236
227
|
resolveAISettings,
|
|
237
228
|
rootOf,
|
|
229
|
+
runBudgetOf,
|
|
238
230
|
settingRows,
|
|
231
|
+
sharedCommand,
|
|
239
232
|
sharedContracts,
|
|
240
233
|
snakeKeys
|
|
241
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-SERXSCN3.js";
|
|
242
235
|
import {
|
|
243
236
|
modelTarget
|
|
244
|
-
} from "./chunk-
|
|
245
|
-
import "./chunk-
|
|
246
|
-
import {
|
|
247
|
-
setupPermissionCeiling
|
|
248
|
-
} from "./chunk-CU6RATZH.js";
|
|
237
|
+
} from "./chunk-I4RWW3UD.js";
|
|
238
|
+
import "./chunk-72C4YOCH.js";
|
|
249
239
|
import {
|
|
250
240
|
readOnlyLockOf,
|
|
251
241
|
readOnlyRefusal
|
|
252
|
-
} from "./chunk-
|
|
253
|
-
import "./chunk-
|
|
242
|
+
} from "./chunk-MNLL5YLM.js";
|
|
243
|
+
import "./chunk-Z56QFOBR.js";
|
|
244
|
+
import "./chunk-XF4EXO2C.js";
|
|
245
|
+
import {
|
|
246
|
+
setupPermissionCeiling
|
|
247
|
+
} from "./chunk-FCS26CYQ.js";
|
|
254
248
|
import {
|
|
255
249
|
hostFetch
|
|
256
|
-
} from "./chunk-
|
|
257
|
-
import
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
import "./chunk-
|
|
250
|
+
} from "./chunk-YMJ6IDGT.js";
|
|
251
|
+
import {
|
|
252
|
+
note
|
|
253
|
+
} from "./chunk-HMS6EEQL.js";
|
|
254
|
+
import "./chunk-COOOO5B3.js";
|
|
255
|
+
import "./chunk-YPNWIB6H.js";
|
|
256
|
+
import "./chunk-QNRRK3CN.js";
|
|
261
257
|
import {
|
|
262
258
|
CATALOG_QUERY,
|
|
263
259
|
IMPORTED_DOCUMENT_QUERY,
|
|
264
260
|
openStore
|
|
265
|
-
} from "./chunk-
|
|
266
|
-
import "./chunk-
|
|
267
|
-
import "./chunk-
|
|
268
|
-
import "./chunk-
|
|
261
|
+
} from "./chunk-QETR5HIZ.js";
|
|
262
|
+
import "./chunk-JZHBZOJR.js";
|
|
263
|
+
import "./chunk-ZCR3IRZ2.js";
|
|
264
|
+
import "./chunk-GZ2D4KXG.js";
|
|
265
|
+
import "./chunk-X4TIMMKJ.js";
|
|
266
|
+
import "./chunk-4PA4DHYV.js";
|
|
269
267
|
import {
|
|
270
268
|
FACT_STATUSES,
|
|
271
|
-
FACT_TYPES,
|
|
272
269
|
MEMORY_KINDS,
|
|
273
270
|
MEMORY_SCOPES,
|
|
274
271
|
MEMORY_STATUSES,
|
|
275
272
|
inRun
|
|
276
|
-
} from "./chunk-
|
|
273
|
+
} from "./chunk-RJOQH5YY.js";
|
|
274
|
+
import "./chunk-SAKO3P4H.js";
|
|
275
|
+
import "./chunk-26DHFMGZ.js";
|
|
276
|
+
import "./chunk-2UUWXPOB.js";
|
|
277
|
+
import {
|
|
278
|
+
FACT_TYPES
|
|
279
|
+
} from "./chunk-PRW6SYA3.js";
|
|
277
280
|
import {
|
|
278
281
|
defineQuery,
|
|
279
282
|
parseLucene,
|
|
280
283
|
queryError,
|
|
284
|
+
queryFieldsOf,
|
|
281
285
|
timezoneOf,
|
|
282
286
|
validateQuery,
|
|
283
287
|
zonedMoment
|
|
284
|
-
} from "./chunk-
|
|
285
|
-
import "./chunk-
|
|
286
|
-
import "./chunk-
|
|
287
|
-
import "./chunk-CDSB7WVG.js";
|
|
288
|
-
import "./chunk-3URYKAJP.js";
|
|
288
|
+
} from "./chunk-OF422U5D.js";
|
|
289
|
+
import "./chunk-GBKNJWOZ.js";
|
|
290
|
+
import "./chunk-FT3LN3HP.js";
|
|
289
291
|
import "./chunk-D72URWJE.js";
|
|
290
292
|
import {
|
|
291
293
|
installerOf
|
|
292
|
-
} from "./chunk-
|
|
294
|
+
} from "./chunk-ZZ32DXTH.js";
|
|
293
295
|
import {
|
|
294
296
|
DRIVE_APP,
|
|
295
297
|
PACKAGE,
|
|
296
298
|
VERSION
|
|
297
|
-
} from "./chunk-
|
|
299
|
+
} from "./chunk-ZM63SUHG.js";
|
|
298
300
|
import {
|
|
299
301
|
REASONS
|
|
300
|
-
} from "./chunk-
|
|
301
|
-
import "./chunk-
|
|
302
|
-
import "./chunk-
|
|
302
|
+
} from "./chunk-2LHAVY4U.js";
|
|
303
|
+
import "./chunk-VKE77B3F.js";
|
|
304
|
+
import "./chunk-4HWJOU7N.js";
|
|
303
305
|
import {
|
|
304
306
|
storePath
|
|
305
|
-
} from "./chunk-
|
|
307
|
+
} from "./chunk-Z3KUSRCF.js";
|
|
306
308
|
import {
|
|
307
309
|
processStreams,
|
|
308
310
|
saveConfigFile,
|
|
309
311
|
writeSecurely
|
|
310
|
-
} from "./chunk-
|
|
311
|
-
import "./chunk-
|
|
312
|
+
} from "./chunk-CJLVYIOP.js";
|
|
313
|
+
import "./chunk-3N2OFXB5.js";
|
|
312
314
|
import "./chunk-Y5E2WNWB.js";
|
|
313
|
-
import "./chunk-
|
|
314
|
-
import "./chunk-
|
|
315
|
+
import "./chunk-KYKW2W6X.js";
|
|
316
|
+
import "./chunk-KGYVHPGE.js";
|
|
315
317
|
import {
|
|
316
318
|
array,
|
|
317
319
|
boolean,
|
|
@@ -334,11 +336,11 @@ import {
|
|
|
334
336
|
string,
|
|
335
337
|
unknown,
|
|
336
338
|
writes
|
|
337
|
-
} from "./chunk-
|
|
339
|
+
} from "./chunk-OJSBWP3F.js";
|
|
338
340
|
import {
|
|
339
341
|
CliError,
|
|
340
342
|
isCliError
|
|
341
|
-
} from "./chunk-
|
|
343
|
+
} from "./chunk-4QNW4NK6.js";
|
|
342
344
|
import {
|
|
343
345
|
__commonJS,
|
|
344
346
|
__name,
|
|
@@ -439,30 +441,30 @@ var require_polyfills = __commonJS({
|
|
|
439
441
|
})(fs.rename);
|
|
440
442
|
}
|
|
441
443
|
fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
|
|
442
|
-
function read(fd, buffer,
|
|
444
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
443
445
|
var callback;
|
|
444
446
|
if (callback_ && typeof callback_ === "function") {
|
|
445
447
|
var eagCounter = 0;
|
|
446
448
|
callback = /* @__PURE__ */ __name(function(er, _, __) {
|
|
447
449
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
448
450
|
eagCounter++;
|
|
449
|
-
return fs$read.call(fs, fd, buffer,
|
|
451
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
450
452
|
}
|
|
451
453
|
callback_.apply(this, arguments);
|
|
452
454
|
}, "callback");
|
|
453
455
|
}
|
|
454
|
-
return fs$read.call(fs, fd, buffer,
|
|
456
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
455
457
|
}
|
|
456
458
|
__name(read, "read");
|
|
457
459
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
458
460
|
return read;
|
|
459
461
|
})(fs.read);
|
|
460
462
|
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
461
|
-
return function(fd, buffer,
|
|
463
|
+
return function(fd, buffer, offset, length, position) {
|
|
462
464
|
var eagCounter = 0;
|
|
463
465
|
while (true) {
|
|
464
466
|
try {
|
|
465
|
-
return fs$readSync.call(fs, fd, buffer,
|
|
467
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
466
468
|
} catch (er) {
|
|
467
469
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
468
470
|
eagCounter++;
|
|
@@ -2177,7 +2179,7 @@ var profileLocked2 = /* @__PURE__ */ __name((env, name) => import_proper_lockfil
|
|
|
2177
2179
|
var removal = {
|
|
2178
2180
|
signOut: /* @__PURE__ */ __name(async (profile, { env, keyring, mayRevoke }) => {
|
|
2179
2181
|
const storage = readConfig(env).profiles[profile]?.storage ?? "keyring";
|
|
2180
|
-
const { sessionKeeper } = await import("./tokens-
|
|
2182
|
+
const { sessionKeeper } = await import("./tokens-AF7QOFOF.js");
|
|
2181
2183
|
const { revoked } = await sessionKeeper({
|
|
2182
2184
|
env,
|
|
2183
2185
|
name: profile,
|
|
@@ -2198,74 +2200,312 @@ var installAccountCommands = /* @__PURE__ */ __name((program, _context) => {
|
|
|
2198
2200
|
annotate(program.command("account"), { effects: LOCAL_READ }).description("remove this profile from this computer").addCommand(accountRemoveCommand(DRIVE_APP, removal, { resolveSettings: configuration.resolveSettings }));
|
|
2199
2201
|
}, "installAccountCommands");
|
|
2200
2202
|
|
|
2201
|
-
// dist/
|
|
2202
|
-
var
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2203
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/documents/queries.js
|
|
2204
|
+
var registry = /* @__PURE__ */ __name((entity, schema, native, examples3) => ({
|
|
2205
|
+
entity,
|
|
2206
|
+
backend: "native",
|
|
2207
|
+
fields: queryFieldsOf(schema, { native, examples: examples3 }).map((field) => field.native ? { ...field, operators: ["term", "phrase"] } : field)
|
|
2208
|
+
}), "registry");
|
|
2209
|
+
var folderRow = strictObject({ id: string() });
|
|
2210
|
+
var mirrorRow = strictObject({ id: string(), path: string(), folder: string() });
|
|
2211
|
+
var tagRow = strictObject({ tag: string() });
|
|
2212
|
+
var linkRow = looseObject({
|
|
2213
|
+
id: string(),
|
|
2214
|
+
from: string(),
|
|
2215
|
+
to: nullable(string()),
|
|
2216
|
+
kind: string(),
|
|
2217
|
+
role: nullable(string()),
|
|
2218
|
+
confirmed: boolean(),
|
|
2219
|
+
origin: picklist(["file", "owner", "suggested", "message"])
|
|
2220
|
+
});
|
|
2221
|
+
var IDENTITY_ROLES = ["owner", "last-editor"];
|
|
2222
|
+
var identityRow = looseObject({
|
|
2223
|
+
remote_id: nullable(string()),
|
|
2224
|
+
provider: string(),
|
|
2225
|
+
role: picklist(IDENTITY_ROLES),
|
|
2226
|
+
person: nullable(record(string(), unknown()))
|
|
2227
|
+
});
|
|
2228
|
+
var documentQueries = /* @__PURE__ */ __name(() => {
|
|
2229
|
+
return {
|
|
2230
|
+
folders: registry("selected_folder", folderRow, ["id"], { id: "id:FOLDER_ID" }),
|
|
2231
|
+
mirrors: registry("mirror", mirrorRow, ["id", "path", "folder"], {
|
|
2232
|
+
id: "id:example",
|
|
2233
|
+
path: 'path:"/example/notes"',
|
|
2234
|
+
folder: "folder:FOLDER_ID"
|
|
2235
|
+
}),
|
|
2236
|
+
tags: registry("document_tag", tagRow, ["tag"], { tag: "tag:budget" }),
|
|
2237
|
+
notes: registry("note", note, ["text"], { text: "text:review" }),
|
|
2238
|
+
links: registry("document_relationship", linkRow, ["id", "role", "origin", "confirmed"], {
|
|
2239
|
+
id: "id:1",
|
|
2240
|
+
role: "role:reviewer",
|
|
2241
|
+
origin: "origin:owner",
|
|
2242
|
+
confirmed: "confirmed:true"
|
|
2243
|
+
}),
|
|
2244
|
+
identities: registry("document_identity", identityRow, ["remote_id", "role"], {
|
|
2245
|
+
remote_id: "remote_id:example",
|
|
2246
|
+
role: "role:owner"
|
|
2247
|
+
})
|
|
2248
|
+
};
|
|
2249
|
+
}, "documentQueries");
|
|
2250
|
+
var bindQuery2 = /* @__PURE__ */ __name((command, query, schema) => answerEntity(withQuery(command, query), query.entity, schema), "bindQuery");
|
|
2251
|
+
var termsOf2 = /* @__PURE__ */ __name((words, query, command) => Object.fromEntries(queryTerms(words, query, command)), "termsOf");
|
|
2252
|
+
var FACT_QUERY = {
|
|
2253
|
+
entity: "fact",
|
|
2254
|
+
backend: "native",
|
|
2255
|
+
fields: [
|
|
2256
|
+
termField("kind", "enum", "kind:decision", { values: FACT_TYPES }),
|
|
2257
|
+
termField("status", "enum", "status:proposed", { values: FACT_STATUSES })
|
|
2258
|
+
]
|
|
2259
|
+
};
|
|
2260
|
+
var MEMORY_QUERY = {
|
|
2261
|
+
entity: "memory",
|
|
2262
|
+
backend: "native",
|
|
2263
|
+
fields: [
|
|
2264
|
+
termField("kind", "enum", "kind:preference", { values: MEMORY_KINDS }),
|
|
2265
|
+
termField("status", "enum", "status:proposed", { values: MEMORY_STATUSES }),
|
|
2266
|
+
termField("scope", "enum", "scope:work", { values: MEMORY_SCOPES })
|
|
2267
|
+
]
|
|
2268
|
+
};
|
|
2269
|
+
var MEMORY_SEARCH_QUERY = {
|
|
2270
|
+
entity: "memory",
|
|
2271
|
+
backend: "native",
|
|
2272
|
+
fields: [
|
|
2273
|
+
nativeField({
|
|
2274
|
+
name: "text",
|
|
2275
|
+
type: "txt",
|
|
2276
|
+
operators: ["term", "phrase"],
|
|
2277
|
+
example: "text:reviews",
|
|
2278
|
+
relation: "words of the memory; a bare word means the same"
|
|
2279
|
+
}),
|
|
2280
|
+
termField("scope", "enum", "scope:work", { values: MEMORY_SCOPES })
|
|
2281
|
+
]
|
|
2282
|
+
};
|
|
2283
|
+
var factItem = /* @__PURE__ */ __name(({ type, statement, source, confirmedBy, ...fact }) => ({
|
|
2284
|
+
ref: fact.ref,
|
|
2285
|
+
id: fact.id,
|
|
2286
|
+
kind: type,
|
|
2287
|
+
text: statement,
|
|
2288
|
+
status: fact.status,
|
|
2289
|
+
project: fact.project,
|
|
2290
|
+
subject: fact.subject,
|
|
2291
|
+
occurred_at: fact.occurredAt,
|
|
2292
|
+
supersedes: fact.supersedes,
|
|
2293
|
+
author: fact.author,
|
|
2294
|
+
model: fact.model,
|
|
2295
|
+
confirmed_by: confirmedBy,
|
|
2296
|
+
scope: fact.scope,
|
|
2297
|
+
origin: source,
|
|
2298
|
+
evidence: fact.evidence,
|
|
2299
|
+
created_at: fact.createdAt,
|
|
2300
|
+
updated_at: fact.updatedAt
|
|
2301
|
+
}), "factItem");
|
|
2302
|
+
var memoryItem = /* @__PURE__ */ __name(({ body, ...memory }) => ({
|
|
2303
|
+
ref: memory.ref,
|
|
2304
|
+
id: memory.id,
|
|
2305
|
+
kind: memory.kind,
|
|
2306
|
+
text: body,
|
|
2307
|
+
subject: memory.subject,
|
|
2308
|
+
author: memory.author,
|
|
2309
|
+
model: memory.model,
|
|
2310
|
+
confidence: memory.confidence,
|
|
2311
|
+
status: memory.status,
|
|
2312
|
+
scope: memory.scope,
|
|
2313
|
+
supersedes: memory.supersedes,
|
|
2314
|
+
evidence: memory.evidence,
|
|
2315
|
+
last_verified_at: memory.lastVerifiedAt,
|
|
2316
|
+
created_at: memory.createdAt,
|
|
2317
|
+
updated_at: memory.updatedAt
|
|
2318
|
+
}), "memoryItem");
|
|
2319
|
+
var memorySearch = /* @__PURE__ */ __name((words) => {
|
|
2320
|
+
const command = "memories search";
|
|
2321
|
+
const context = { command, guide: LIST_QUERY_GUIDE };
|
|
2322
|
+
const ast = validateQuery(parseLucene(typedQuery(words), { defaultField: "text", ...context }), MEMORY_SEARCH_QUERY, context);
|
|
2323
|
+
const text = [];
|
|
2324
|
+
let scope;
|
|
2325
|
+
const add = /* @__PURE__ */ __name((node) => {
|
|
2326
|
+
if (node.kind === "boolean") {
|
|
2327
|
+
for (const clause of node.clauses) {
|
|
2328
|
+
if (clause.occur !== "must")
|
|
2329
|
+
queryError("query.unsupported-placement", clause.node.span, "this search joins its terms by AND", context);
|
|
2330
|
+
add(clause.node);
|
|
2331
|
+
}
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
if (node.field === "text")
|
|
2335
|
+
text.push(node.value);
|
|
2336
|
+
else if (scope !== void 0)
|
|
2337
|
+
queryError("query.unsupported-placement", node.span, "scope only once here", context);
|
|
2338
|
+
else
|
|
2339
|
+
scope = node.value.toLowerCase();
|
|
2340
|
+
}, "add");
|
|
2341
|
+
add(ast.root);
|
|
2342
|
+
if (text.length === 0)
|
|
2343
|
+
queryError("query.missing-value", ast.root.span, "say which words to look for beside scope:", context);
|
|
2344
|
+
return { text: text.join(" "), ...scope === void 0 ? {} : { scope } };
|
|
2345
|
+
}, "memorySearch");
|
|
2346
|
+
|
|
2347
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/documents/words.js
|
|
2348
|
+
var wordsOf = /* @__PURE__ */ __name((words) => {
|
|
2349
|
+
const profile = words.profile ?? "personal";
|
|
2350
|
+
const place = words.place ?? words.provider;
|
|
2351
|
+
const { provider } = words;
|
|
2352
|
+
return {
|
|
2353
|
+
...words,
|
|
2354
|
+
profile,
|
|
2355
|
+
place,
|
|
2356
|
+
prefix: `${words.app} ${profile}`,
|
|
2357
|
+
text: {
|
|
2358
|
+
documents: `read imported documents and ${provider} documents`,
|
|
2359
|
+
documentsList: `list imported documents with their ${provider} URLs`,
|
|
2360
|
+
documentArgument: `document id, ${provider} URL, or a search hit's document: ref`,
|
|
2361
|
+
knowledgeArgument: `${provider} file or folder id or URL in the local catalog, or a document:<n> ref`,
|
|
2362
|
+
catalog: `browse stored ${place} files and folders offline`,
|
|
2363
|
+
catalogArgument: `${provider} file or folder id, or its URL`,
|
|
2364
|
+
treeArgument: `${provider} folder id or URL; defaults to the explicitly selected profile's roots`,
|
|
2365
|
+
folders: `choose the ${place} folders that sync imports`,
|
|
2366
|
+
folderArgument: `folder id or ${place} URL`,
|
|
2367
|
+
syncLimit: `how many documents to read from ${provider} in this run`,
|
|
2368
|
+
identities: `the ${provider} accounts seen on a document, and the people they belong to`,
|
|
2369
|
+
identitiesList: `list the people ${provider} shows for a document`,
|
|
2370
|
+
identitiesLink: `record that a ${provider} account belongs to a known person`,
|
|
2371
|
+
identityArgument: `${provider} account id, as identities list prints it`,
|
|
2372
|
+
mirrors: `keep local folders mirrored into ${place}`,
|
|
2373
|
+
mirrorsAdd: `mirror a local folder into ${place}`,
|
|
2374
|
+
mirrorsSync: `sync both ways with ${place}; a part changed on both sides is reported`,
|
|
2375
|
+
mirrorParent: `the ${place} folder to write into, by id or URL`,
|
|
2376
|
+
...words.text
|
|
2377
|
+
}
|
|
2378
|
+
};
|
|
2379
|
+
}, "wordsOf");
|
|
2380
|
+
var examples2 = /* @__PURE__ */ __name((command, lines) => annotate(command, { examples: lines }), "examples");
|
|
2381
|
+
var positive = /* @__PURE__ */ __name((input) => {
|
|
2382
|
+
const n = Number(input);
|
|
2383
|
+
if (!Number.isSafeInteger(n) || n < 1)
|
|
2384
|
+
throw new InvalidArgumentError("use a positive integer");
|
|
2385
|
+
return n;
|
|
2386
|
+
}, "positive");
|
|
2387
|
+
var nonnegative = /* @__PURE__ */ __name((input) => {
|
|
2388
|
+
const n = Number(input);
|
|
2389
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
2390
|
+
throw new InvalidArgumentError("use a nonnegative integer");
|
|
2391
|
+
return n;
|
|
2392
|
+
}, "nonnegative");
|
|
2393
|
+
var allOf = /* @__PURE__ */ __name((items) => listOf("", { items, limit: Math.max(1, items.length), has_more: false }), "allOf");
|
|
2394
|
+
var documentsGroup = /* @__PURE__ */ __name((program, words) => program.commands.find((command) => command.name() === "documents") ?? annotate(program.command("documents"), { effects: { remote: "none", local: "read" } }).description(words.text.documents), "documentsGroup");
|
|
2395
|
+
var DAY = 24 * 60 * 60 * 1e3;
|
|
2396
|
+
var ageOf = /* @__PURE__ */ __name((lastSync, now = Date.now()) => {
|
|
2397
|
+
const at = lastSync ? Date.parse(lastSync) : Number.NaN;
|
|
2398
|
+
return Number.isNaN(at) ? { synced_at: null, age_days: null } : { synced_at: lastSync ?? null, age_days: Math.max(0, Math.floor((now - at) / DAY)) };
|
|
2399
|
+
}, "ageOf");
|
|
2400
|
+
var staleCopy = /* @__PURE__ */ __name((provider, lastSync, now = Date.now()) => {
|
|
2401
|
+
const sync2 = defineSteps([
|
|
2402
|
+
{ id: "sync.run", command: "sync", args: [], why: `copy the changes ${provider} has made into the local store` }
|
|
2403
|
+
])[0];
|
|
2404
|
+
const { synced_at, age_days } = ageOf(lastSync, now);
|
|
2405
|
+
const old = synced_at === null || now - Date.parse(synced_at) > DAY;
|
|
2406
|
+
if (!old)
|
|
2407
|
+
return {};
|
|
2408
|
+
const why = age_days === null ? `the local copy has no sync time; ${provider} may have changed the document since it was copied` : `the local copy was synced ${age_days} day${age_days === 1 ? "" : "s"} ago; ${provider} may have changed the document since`;
|
|
2409
|
+
return {
|
|
2410
|
+
missing: [{ field: "synced_at", why, step: sync2.id }],
|
|
2411
|
+
next: [stepOf(sync2)],
|
|
2412
|
+
meta: { complete: false }
|
|
2413
|
+
};
|
|
2414
|
+
}, "staleCopy");
|
|
2415
|
+
|
|
2416
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/documents/catalog.js
|
|
2417
|
+
var CATALOG_TREE_LIMIT = 1e4;
|
|
2418
|
+
var CATALOG_PAGE = 1e3;
|
|
2419
|
+
var PARENT_BATCH = 200;
|
|
2420
|
+
var catalogSource = /* @__PURE__ */ __name((catalog, principal) => ({
|
|
2421
|
+
get: /* @__PURE__ */ __name((externalId) => catalog.get(principal, catalogId({ externalId })), "get"),
|
|
2422
|
+
children: /* @__PURE__ */ __name((externalId, page) => catalog.list(principal, { parent: catalogId({ externalId }), ...page }), "children"),
|
|
2423
|
+
// Each read scans the account's catalog, so the branches cut at the depth are asked about 200 at a time, in one read.
|
|
2424
|
+
withChildren: /* @__PURE__ */ __name(async (externalIds) => {
|
|
2425
|
+
const found = /* @__PURE__ */ new Set();
|
|
2426
|
+
for (let start = 0; start < externalIds.length; start += PARENT_BATCH) {
|
|
2427
|
+
const batch = new Set(externalIds.slice(start, start + PARENT_BATCH));
|
|
2428
|
+
const parent = [...batch].map((externalId) => catalogId({ externalId }));
|
|
2429
|
+
for (let offset = 0; ; offset += CATALOG_PAGE) {
|
|
2430
|
+
const page = await catalog.list(principal, { parent, limit: CATALOG_PAGE, offset });
|
|
2431
|
+
for (const item of page.items)
|
|
2432
|
+
for (const parent2 of item.parents)
|
|
2433
|
+
if (batch.delete(parent2))
|
|
2434
|
+
found.add(parent2);
|
|
2435
|
+
if (!page.hasMore || batch.size === 0)
|
|
2436
|
+
break;
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
return found;
|
|
2440
|
+
}, "withChildren")
|
|
2441
|
+
}), "catalogSource");
|
|
2442
|
+
var tooLarge = /* @__PURE__ */ __name((limit) => new CliError("validation_error", `the tree is over ${limit} entries; name a smaller FOLDER or lower --depth`, {
|
|
2443
|
+
reason: "catalog.tree-limit"
|
|
2444
|
+
}), "tooLarge");
|
|
2445
|
+
var catalogTree = /* @__PURE__ */ __name(async (source, roots2, depth, limit = CATALOG_TREE_LIMIT) => {
|
|
2228
2446
|
if (!Number.isSafeInteger(depth) || depth < 0 || depth > 50)
|
|
2229
2447
|
throw new CliError("validation_error", "tree depth must be between 0 and 50", { reason: "catalog.depth-invalid" });
|
|
2230
|
-
|
|
2231
|
-
const
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2448
|
+
let nodes = 0;
|
|
2449
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2450
|
+
const cut = [];
|
|
2451
|
+
const cutIds = [];
|
|
2452
|
+
const hasChildren = /* @__PURE__ */ __name(async (externalId) => (await source.children(externalId, { limit: 1, offset: 0 })).items.length > 0, "hasChildren");
|
|
2453
|
+
const childrenOf = /* @__PURE__ */ __name(async (externalId) => {
|
|
2454
|
+
const items = [];
|
|
2455
|
+
for (let offset = 0; ; offset += CATALOG_PAGE) {
|
|
2456
|
+
const page = await source.children(externalId, { limit: CATALOG_PAGE, offset });
|
|
2457
|
+
for (const item of page.items)
|
|
2458
|
+
items.push(item);
|
|
2459
|
+
if (nodes + items.length > limit)
|
|
2460
|
+
throw tooLarge(limit);
|
|
2461
|
+
if (!page.hasMore)
|
|
2462
|
+
return items;
|
|
2237
2463
|
}
|
|
2238
|
-
|
|
2239
|
-
const node = /* @__PURE__ */ __name((
|
|
2240
|
-
if (ancestors.has(
|
|
2464
|
+
}, "childrenOf");
|
|
2465
|
+
const node = /* @__PURE__ */ __name(async (entry, level, ancestors) => {
|
|
2466
|
+
if (ancestors.has(entry.externalId))
|
|
2241
2467
|
throw new CliError("invalid_response", "local folder ancestry contains a cycle", { reason: "catalog.cycle" });
|
|
2242
|
-
if (++
|
|
2243
|
-
throw
|
|
2244
|
-
|
|
2245
|
-
});
|
|
2246
|
-
const found = children.get(item.externalId) ?? [];
|
|
2247
|
-
const next = /* @__PURE__ */ new Set([...ancestors, item.externalId]);
|
|
2248
|
-
return {
|
|
2468
|
+
if (++nodes > limit)
|
|
2469
|
+
throw tooLarge(limit);
|
|
2470
|
+
const tree = {
|
|
2249
2471
|
item: {
|
|
2250
|
-
id: catalogId(
|
|
2251
|
-
ref:
|
|
2252
|
-
name:
|
|
2253
|
-
kind:
|
|
2254
|
-
url:
|
|
2255
|
-
content:
|
|
2256
|
-
},
|
|
2257
|
-
children:
|
|
2258
|
-
truncated:
|
|
2472
|
+
id: catalogId(entry),
|
|
2473
|
+
ref: entry.ref,
|
|
2474
|
+
name: entry.name,
|
|
2475
|
+
kind: entry.kind,
|
|
2476
|
+
url: entry.url,
|
|
2477
|
+
content: entry.content
|
|
2478
|
+
},
|
|
2479
|
+
children: [],
|
|
2480
|
+
truncated: false
|
|
2259
2481
|
};
|
|
2482
|
+
if (seen.has(entry.externalId))
|
|
2483
|
+
return { ...tree, repeated: true };
|
|
2484
|
+
seen.add(entry.externalId);
|
|
2485
|
+
if (level >= depth) {
|
|
2486
|
+
cut.push(tree);
|
|
2487
|
+
cutIds.push(entry.externalId);
|
|
2488
|
+
return tree;
|
|
2489
|
+
}
|
|
2490
|
+
const next = new Set(ancestors).add(entry.externalId);
|
|
2491
|
+
for (const child of await childrenOf(entry.externalId))
|
|
2492
|
+
tree.children.push(await node(child, level + 1, next));
|
|
2493
|
+
return tree;
|
|
2260
2494
|
}, "node");
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2495
|
+
const trees = [];
|
|
2496
|
+
for (const id of roots2) {
|
|
2497
|
+
const entry = await source.get(id);
|
|
2498
|
+
if (!entry || entry.kind !== "folder" && !await hasChildren(entry.externalId))
|
|
2499
|
+
throw new CliError("not_found", "no folder or page with sub-pages by that id in the active local catalog", {
|
|
2265
2500
|
reason: "catalog.not-found"
|
|
2266
2501
|
});
|
|
2267
|
-
|
|
2502
|
+
trees.push(await node(entry, 0, /* @__PURE__ */ new Set()));
|
|
2503
|
+
}
|
|
2504
|
+
const parents = source.withChildren ? await source.withChildren(cutIds) : new Set((await Promise.all(cutIds.map(async (id) => await hasChildren(id) ? id : ""))).filter(Boolean));
|
|
2505
|
+
cut.forEach((tree, i) => {
|
|
2506
|
+
tree.truncated = parents.has(cutIds[i]);
|
|
2268
2507
|
});
|
|
2508
|
+
return trees;
|
|
2269
2509
|
}, "catalogTree");
|
|
2270
2510
|
var catalogId = /* @__PURE__ */ __name((entry) => entry.externalId.replace(/\.md$/, ""), "catalogId");
|
|
2271
2511
|
var catalogOutput = /* @__PURE__ */ __name((entry) => ({
|
|
@@ -2304,116 +2544,64 @@ var CATALOG_FIELDS = Object.keys({
|
|
|
2304
2544
|
active: true,
|
|
2305
2545
|
content: true
|
|
2306
2546
|
});
|
|
2307
|
-
|
|
2308
|
-
// dist/output.js
|
|
2309
|
-
var VERBATIM = /* @__PURE__ */ new Set([
|
|
2310
|
-
"frontMatter",
|
|
2311
|
-
"front_matter",
|
|
2312
|
-
"provider_metadata",
|
|
2313
|
-
"metadata",
|
|
2314
|
-
"headers",
|
|
2315
|
-
"properties",
|
|
2316
|
-
"appProperties",
|
|
2317
|
-
"app_properties",
|
|
2318
|
-
"request_schema",
|
|
2319
|
-
"response_schema",
|
|
2320
|
-
"body_schema",
|
|
2321
|
-
"schema",
|
|
2322
|
-
"inputSchema",
|
|
2323
|
-
"input_schema",
|
|
2324
|
-
"outputSchema",
|
|
2325
|
-
"output_schema"
|
|
2326
|
-
]);
|
|
2327
|
-
var RECORDS = /* @__PURE__ */ new Set(["profiles", "permissions", "models"]);
|
|
2328
|
-
var keyOf = /* @__PURE__ */ __name((key) => /^[a-z][a-zA-Z0-9]*$/.test(key) ? key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase() : key, "keyOf");
|
|
2329
|
-
var snakeKeys2 = /* @__PURE__ */ __name((value, record2 = false) => {
|
|
2330
|
-
if (Array.isArray(value))
|
|
2331
|
-
return value.map((item) => snakeKeys2(item));
|
|
2332
|
-
if (!value || typeof value !== "object" || value instanceof Date)
|
|
2333
|
-
return value;
|
|
2334
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
2335
|
-
record2 ? key : keyOf(key),
|
|
2336
|
-
VERBATIM.has(key) ? item : snakeKeys2(item, RECORDS.has(key))
|
|
2337
|
-
]));
|
|
2338
|
-
}, "snakeKeys");
|
|
2339
|
-
var allOf = /* @__PURE__ */ __name((items) => listOf("", { items, limit: Math.max(1, items.length), has_more: false }), "allOf");
|
|
2340
|
-
|
|
2341
|
-
// dist/commands/catalog.js
|
|
2342
2547
|
var local = /* @__PURE__ */ __name((command, mutates = false) => annotate(command, { effects: mutates ? LOCAL_WRITE : LOCAL_READ }), "local");
|
|
2343
|
-
var
|
|
2344
|
-
const {
|
|
2345
|
-
const
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
lock?.assertHeld();
|
|
2358
|
-
return value;
|
|
2359
|
-
} finally {
|
|
2360
|
-
await lock?.release();
|
|
2361
|
-
}
|
|
2362
|
-
});
|
|
2363
|
-
}, "run");
|
|
2548
|
+
var addDocumentCatalogCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
|
|
2549
|
+
const { output } = helpers;
|
|
2550
|
+
const wording = wordsOf(helpers.words);
|
|
2551
|
+
const { prefix, text } = wording;
|
|
2552
|
+
const queries = documentQueries();
|
|
2553
|
+
const view = "catalog";
|
|
2554
|
+
const catalog = local(program.command("catalog")).description(text.catalog);
|
|
2555
|
+
const run3 = /* @__PURE__ */ __name((fn, write = false) => helpers.run(async (index, principal) => {
|
|
2556
|
+
if (!index.catalog)
|
|
2557
|
+
throw new CliError("configuration_error", "index has no shared catalog adapter", {
|
|
2558
|
+
reason: "catalog.unavailable"
|
|
2559
|
+
});
|
|
2560
|
+
return fn({ ...index, catalog: index.catalog }, principal);
|
|
2561
|
+
}, write), "run");
|
|
2364
2562
|
const entry = /* @__PURE__ */ __name(async (index, principal, id) => {
|
|
2365
|
-
const found = await index.catalog?.get(principal,
|
|
2563
|
+
const found = await index.catalog?.get(principal, helpers.id(id));
|
|
2366
2564
|
if (!found)
|
|
2367
2565
|
throw new CliError("not_found", "file or folder is not in the active local catalog; run catalog import or sync", {
|
|
2368
2566
|
reason: "catalog.not-found"
|
|
2369
2567
|
});
|
|
2370
2568
|
return found;
|
|
2371
2569
|
}, "entry");
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
},
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
}), ["drive personal catalog show FILE_ID --offline"]).argument("<file>", "Google file or folder id, or its Drive URL").action(async (id) => output(itemOf(await run3(async (index, principal) => catalogOutput(await entry(index, principal, id))))));
|
|
2379
|
-
const list = /* @__PURE__ */ __name(async (words, args, search) => {
|
|
2380
|
-
const ast = words.length ? validateQuery(parseLucene(words.join(" "), { defaultField: search ? "text" : "none" }), CATALOG_QUERY) : void 0;
|
|
2570
|
+
examples2(local(catalog.command("import").description("put cached file and folder metadata into the shared database"), true), [`${prefix} catalog import --offline`]).action(async () => output(itemOf(await run3((index, principal) => index.catalog.import(principal), true))));
|
|
2571
|
+
examples2(annotate(local(catalog.command("show").description("show stored metadata and the stable file or folder reference")), {
|
|
2572
|
+
output: { entity: "document", view }
|
|
2573
|
+
}), [`${prefix} catalog show FILE_ID --offline`]).argument("<file>", text.catalogArgument).action(async (id) => output(itemOf(await run3(async (index, principal) => catalogOutput(await entry(index, principal, id))))));
|
|
2574
|
+
const list = /* @__PURE__ */ __name(async (terms, args, search) => {
|
|
2575
|
+
const ast = terms.length ? validateQuery(parseLucene(terms.join(" "), { defaultField: search ? "text" : "none" }), CATALOG_QUERY) : void 0;
|
|
2381
2576
|
const result = await run3((index, principal) => index.catalog.list(principal, { ast, limit: args.limit, offset: (args.page - 1) * args.limit }));
|
|
2382
2577
|
output(listOf(`catalog ${search ? "search" : "list"}`, {
|
|
2383
2578
|
items: result.items.map(catalogOutput),
|
|
2384
2579
|
limit: args.limit,
|
|
2385
2580
|
has_more: result.hasMore,
|
|
2386
2581
|
page: args.page,
|
|
2387
|
-
args: { query:
|
|
2582
|
+
args: { query: terms.length ? terms.join(" ") : void 0 }
|
|
2388
2583
|
}));
|
|
2389
2584
|
}, "list");
|
|
2390
2585
|
for (const action of ["list", "search"]) {
|
|
2391
|
-
const command =
|
|
2392
|
-
action === "list" ?
|
|
2393
|
-
]).argument(action === "list" ? "[query...]" : "<query...>", "metadata query: kind, mime, name, parent, person, tag; AND, OR, NOT").option("--limit <n>", "how many entries to return (at most 1000)",
|
|
2394
|
-
annotate(command, { query: CATALOG_QUERY, output: { entity: "document", view
|
|
2586
|
+
const command = examples2(local(catalog.command(action).description(action === "list" ? "list cached files and folders using metadata queries" : "search cached names, descriptions, types and observed people")), [
|
|
2587
|
+
action === "list" ? `${prefix} catalog list "parent:FOLDER_ID AND kind:file" --offline` : `${prefix} catalog search "budget AND person:Rin*" --offline`
|
|
2588
|
+
]).argument(action === "list" ? "[query...]" : "<query...>", "metadata query: kind, mime, name, parent, person, tag; AND, OR, NOT").option("--limit <n>", "how many entries to return (at most 1000)", positive, 50).option("--page <n>", "which page to return", positive, 1).action(async (terms, args) => list(terms, args, action === "search"));
|
|
2589
|
+
annotate(command, { query: CATALOG_QUERY, output: { entity: "document", view } });
|
|
2395
2590
|
}
|
|
2396
|
-
|
|
2397
|
-
const
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
for (const item of page.items)
|
|
2401
|
-
items.push(item);
|
|
2402
|
-
if (!page.hasMore)
|
|
2403
|
-
break;
|
|
2404
|
-
}
|
|
2405
|
-
const roots2 = id ? [fileId(id)] : activeProfile(env, selected()).roots;
|
|
2406
|
-
return allOf(catalogTree(items, roots2.map((root) => `${root}.md`), args.depth));
|
|
2591
|
+
examples2(local(catalog.command("tree").description("show the cached hierarchy below a folder or all selected roots")), [`${prefix} catalog tree --offline`, `${prefix} catalog tree FOLDER_ID --depth 3 --offline`]).argument("[folder]", text.treeArgument).option("--depth <n>", "maximum descendant depth, from 0 to 50", nonnegative, 5).action(async (id, args) => output(await run3(async (index, principal) => {
|
|
2592
|
+
const roots2 = id ? [helpers.id(id)] : helpers.roots();
|
|
2593
|
+
const tree = await catalogTree(catalogSource(index.catalog, principal), roots2.map((root) => `${root}.md`), args.depth);
|
|
2594
|
+
return allOf(tree);
|
|
2407
2595
|
})));
|
|
2408
2596
|
const tags = local(catalog.command("tags")).description("add owner tags to cached files or folders");
|
|
2409
2597
|
for (const action of ["list", "add", "remove"]) {
|
|
2410
|
-
const command =
|
|
2598
|
+
const command = examples2(local(tags.command(action).description(`${action} local tags on a cached file or folder`), action !== "list"), [`${prefix} catalog tags ${action} FOLDER_ID${action === "list" ? "" : " project"} --offline`]).argument("<file>", text.catalogArgument);
|
|
2411
2599
|
if (action === "list")
|
|
2412
|
-
|
|
2600
|
+
bindQuery2(command, queries.tags, tagRow);
|
|
2413
2601
|
else
|
|
2414
2602
|
command.argument("<tags...>", "local tag names");
|
|
2415
2603
|
command.action(async (id, values2 = []) => {
|
|
2416
|
-
const filter = action === "list" ?
|
|
2604
|
+
const filter = action === "list" ? termsOf2(values2, queries.tags, "catalog tags list") : void 0;
|
|
2417
2605
|
return output(allOf(await run3(async (index, principal) => {
|
|
2418
2606
|
const found = await entry(index, principal, id);
|
|
2419
2607
|
if (!index.knowledge)
|
|
@@ -2423,32 +2611,603 @@ var installCatalogCommands = /* @__PURE__ */ __name((program, helpers) => {
|
|
|
2423
2611
|
}, action !== "list")));
|
|
2424
2612
|
});
|
|
2425
2613
|
}
|
|
2426
|
-
}, "
|
|
2614
|
+
}, "addDocumentCatalogCommandsDefinition");
|
|
2615
|
+
var addDocumentCatalogCommands = honoursDryRun(sharedCommand(addDocumentCatalogCommandsDefinition));
|
|
2427
2616
|
|
|
2428
|
-
// dist/
|
|
2429
|
-
import {
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2617
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/documents/documents.js
|
|
2618
|
+
import { writeFileSync } from "node:fs";
|
|
2619
|
+
var addLocalDocumentCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
|
|
2620
|
+
const { output, lastSync } = helpers;
|
|
2621
|
+
const wording = wordsOf(helpers.words);
|
|
2622
|
+
const { prefix, provider, text } = wording;
|
|
2623
|
+
const documents = documentsGroup(program, wording);
|
|
2624
|
+
annotate(withQuery(examples2(annotate(documents.command("list"), { effects: LOCAL_READ }).description(text.documentsList), [
|
|
2625
|
+
`${prefix} documents list`,
|
|
2626
|
+
`${prefix} documents list tag:budget`,
|
|
2627
|
+
`${prefix} documents list person:PERSON_UID --limit 10`
|
|
2628
|
+
]), IMPORTED_DOCUMENT_QUERY), { output: { entity: "document", view: "imported" }, partial: true }).option("--limit <n>", "how many documents to return", positive, 50).option("--page <n>", "which page to return", positive, 1).action(async (words, { limit, page }) => {
|
|
2629
|
+
const query = typedQuery(words);
|
|
2630
|
+
const ast = listQuery(query, IMPORTED_DOCUMENT_QUERY, "documents list");
|
|
2631
|
+
const found = await helpers.list(ast, { limit, offset: (page - 1) * limit });
|
|
2632
|
+
const synced = lastSync();
|
|
2633
|
+
const age = ageOf(synced);
|
|
2634
|
+
output(listOf("documents list", {
|
|
2635
|
+
...staleCopy(provider, synced),
|
|
2636
|
+
items: found.items.map((item) => ({ ...item, ...age })),
|
|
2637
|
+
limit,
|
|
2638
|
+
has_more: found.hasMore,
|
|
2639
|
+
page,
|
|
2640
|
+
args: { query: query || void 0 }
|
|
2641
|
+
}));
|
|
2642
|
+
});
|
|
2643
|
+
examples2(annotate(documents.command("show"), { effects: LOCAL_READ, partial: true }).argument("<document>", text.documentArgument).description("show an imported document's text, tabs and metadata"), [`${prefix} documents show DOC_ID`, `${prefix} documents show document:42 --offline`]).action((input) => {
|
|
2644
|
+
const { metadata, snapshot } = helpers.document(input);
|
|
2645
|
+
const synced = lastSync();
|
|
2646
|
+
output(itemOf({
|
|
2647
|
+
metadata,
|
|
2648
|
+
...ageOf(synced),
|
|
2649
|
+
text: snapshot.text,
|
|
2650
|
+
tabs: snapshot.tabs,
|
|
2651
|
+
...snapshot.notRead ? { not_read: snapshot.notRead } : {}
|
|
2652
|
+
}, staleCopy(provider, synced)));
|
|
2653
|
+
});
|
|
2654
|
+
examples2(annotate(documents.command("export"), { effects: LOCAL_WRITE, partial: true }).argument("<document>", text.documentArgument).description("write an imported document to a new Markdown file"), [`${prefix} documents export DOC_ID --output notes.md`]).requiredOption("--output <file>", "path of the Markdown file to write; an existing file is refused").action((input, args) => {
|
|
2655
|
+
const { id, snapshot } = helpers.document(input);
|
|
2656
|
+
try {
|
|
2657
|
+
writeFileSync(args.output, snapshot.markdown, { flag: "wx", mode: 384 });
|
|
2658
|
+
} catch (error) {
|
|
2659
|
+
if (error.code === "EEXIST")
|
|
2660
|
+
throw new CliError("validation_error", "the output file already exists; choose another --output", {
|
|
2661
|
+
reason: "export.exists",
|
|
2662
|
+
param: "--output"
|
|
2663
|
+
});
|
|
2664
|
+
throw error;
|
|
2665
|
+
}
|
|
2666
|
+
const synced = lastSync();
|
|
2667
|
+
output(itemOf({ id, path: args.output, format: "markdown", ...ageOf(synced) }, staleCopy(provider, synced)));
|
|
2668
|
+
});
|
|
2669
|
+
return documents;
|
|
2670
|
+
}, "addLocalDocumentCommandsDefinition");
|
|
2671
|
+
var addLocalDocumentCommands = honoursDryRun(sharedCommand(addLocalDocumentCommandsDefinition));
|
|
2672
|
+
|
|
2673
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/documents/folders.js
|
|
2674
|
+
var addDocumentFolderCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
|
|
2675
|
+
const { output } = helpers;
|
|
2676
|
+
const wording = wordsOf(helpers.words);
|
|
2677
|
+
const { prefix, text } = wording;
|
|
2678
|
+
const queries = documentQueries();
|
|
2679
|
+
const folders = annotate(program.command("folders"), { effects: LOCAL_READ }).description(text.folders);
|
|
2680
|
+
examples2(annotate(folders.command("add"), { effects: FETCH }).argument("<folder>", text.folderArgument).description("import a folder and everything under it on the next sync"), [`${prefix} folders add FOLDER_ID`]).action(async (input) => {
|
|
2681
|
+
const { id, name } = await helpers.add(input);
|
|
2682
|
+
output(itemOf({ id, name, added: true }));
|
|
2683
|
+
});
|
|
2684
|
+
bindQuery2(examples2(annotate(folders.command("list"), { effects: LOCAL_READ }).description("list the folder ids sync imports"), [`${prefix} folders list`]), queries.folders, folderRow).action((words) => {
|
|
2685
|
+
const filter = termsOf2(words, queries.folders, "folders list");
|
|
2686
|
+
output(allOf(helpers.list(filter)));
|
|
2687
|
+
});
|
|
2688
|
+
examples2(annotate(folders.command("remove"), { effects: LOCAL_WRITE }).argument("<folder>", text.folderArgument).description("stop importing a folder; the next sync drops its documents"), [`${prefix} folders remove FOLDER_ID`]).action((input) => {
|
|
2689
|
+
output(itemOf({ id: helpers.remove(input), removed: true }));
|
|
2690
|
+
});
|
|
2691
|
+
return folders;
|
|
2692
|
+
}, "addDocumentFolderCommandsDefinition");
|
|
2693
|
+
var sharedFolderCommands = honoursDryRun(sharedCommand(addDocumentFolderCommandsDefinition));
|
|
2694
|
+
var addDocumentFolderCommands = /* @__PURE__ */ __name((program, helpers) => {
|
|
2695
|
+
const folders = sharedFolderCommands(program, helpers);
|
|
2696
|
+
if (!helpers.browse)
|
|
2697
|
+
return folders;
|
|
2698
|
+
const before = new Set(folders.commands);
|
|
2699
|
+
helpers.browse(folders);
|
|
2700
|
+
const added = folders.commands.filter((command) => !before.has(command));
|
|
2701
|
+
const children = folders.commands;
|
|
2702
|
+
const rest = children.filter((command) => before.has(command));
|
|
2703
|
+
const at = rest.findIndex((command) => command.name() === "remove");
|
|
2704
|
+
children.splice(0, children.length, ...rest.slice(0, at), ...added, ...rest.slice(at));
|
|
2705
|
+
return folders;
|
|
2706
|
+
}, "addDocumentFolderCommands");
|
|
2707
|
+
|
|
2708
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/documents/knowledge.js
|
|
2709
|
+
var addDocumentKnowledgeCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
|
|
2710
|
+
const { run: run3, output, author, decider } = helpers;
|
|
2711
|
+
const wording = wordsOf(helpers.words);
|
|
2712
|
+
const { prefix, text } = wording;
|
|
2713
|
+
const queries = documentQueries();
|
|
2714
|
+
const documentArgument = text.knowledgeArgument;
|
|
2715
|
+
const scopes = ["personal", "work"];
|
|
2716
|
+
const documents = documentsGroup(program, wording);
|
|
2717
|
+
examples2(annotate(documents.command("context"), { effects: LOCAL_READ }).argument("<document>", documentArgument).description("show a document with its tags, relationships, notes, memories and editors"), [`${prefix} documents context DOC_ID`]).action(async (doc) => output(itemOf(await run3(doc, (k, p, ref) => k.context(p, ref)))));
|
|
2718
|
+
const tags = annotate(program.command("tags"), { effects: LOCAL_READ }).description("label imported documents; labels survive a sync");
|
|
2719
|
+
for (const action of ["list", "add", "remove"]) {
|
|
2720
|
+
const command = examples2(annotate(tags.command(action), { effects: action === "list" ? LOCAL_READ : LOCAL_WRITE }).description(action === "list" ? "list a document's tags" : action === "add" ? "tag a document" : "untag a document").argument("<document>", documentArgument), [`${prefix} tags ${action} DOC_ID${action === "list" ? "" : " budget q3"}`]);
|
|
2721
|
+
if (action === "list") {
|
|
2722
|
+
bindQuery2(command, queries.tags, tagRow).action(async (doc, words) => {
|
|
2723
|
+
const filter = termsOf2(words, queries.tags, "tags list");
|
|
2724
|
+
output(allOf((await run3(doc, (k, p, ref) => k.tags(p, ref, "list", [], filter))).map((tag) => ({ tag }))));
|
|
2725
|
+
});
|
|
2726
|
+
} else
|
|
2727
|
+
command.argument("<tags...>", "one or more tags").action(async (doc, values2) => output(itemOf({ tags: await run3(doc, (k, p, ref) => k.tags(p, ref, action, values2)) })));
|
|
2728
|
+
}
|
|
2729
|
+
const relationships = annotate(program.command("relationships"), { effects: LOCAL_READ }).description("connect a document to people, projects, notes and other references");
|
|
2730
|
+
bindQuery2(examples2(annotate(relationships.command("list"), { effects: LOCAL_READ }).description("list a document's relationships"), [`${prefix} relationships list DOC_ID`]).argument("<document>", documentArgument), queries.links, linkRow).action(async (doc, words) => {
|
|
2731
|
+
const { confirmed, ...filter } = termsOf2(words, queries.links, "relationships list");
|
|
2732
|
+
output(allOf(await run3(doc, (k, p, ref) => k.links(p, ref, { ...filter, ...confirmed === void 0 ? {} : { confirmed: confirmed === "true" } }))));
|
|
2733
|
+
});
|
|
2734
|
+
examples2(annotate(relationships.command("add"), { effects: LOCAL_WRITE }).description("connect a document to another reference"), [
|
|
2735
|
+
`${prefix} relationships add DOC_ID project:PROJECT_ID --kind about`,
|
|
2736
|
+
`${prefix} relationships add DOC_ID person:PERSON_UID --kind assigned-to --role reviewer`
|
|
2737
|
+
]).argument("<document>", documentArgument).argument("<reference>", "what it connects to, such as person:<uid>, project:<id> or note:<id>").addOption(new Option("--kind <kind>", "how the two relate").choices(["links-to", "about", "evidence", "created-from", "related-to", "assigned-to"]).default("related-to")).option("--role <role>", "the part the reference plays, in a word or two").option("--reason <text>", "why the two are connected").action(async (doc, to, { reason, ...args }) => output(itemOf(await run3(doc, (k, p, ref) => k.addLink(p, ref, { to, ...args, by: decider(), ...reason ? { evidence: reason } : {} })))));
|
|
2738
|
+
examples2(annotate(relationships.command("remove"), { effects: LOCAL_WRITE }).description("remove one of a document's relationships"), [`${prefix} relationships remove DOC_ID LINK_ID`]).argument("<document>", documentArgument).argument("<relationship-id>", "id, as relationships list prints it").action(async (doc, id) => output(itemOf(await run3(doc, (k, p, ref) => k.removeLink(p, ref, id, decider())))));
|
|
2739
|
+
const notes = annotate(program.command("notes"), { effects: LOCAL_READ }).description("write notes about an imported document");
|
|
2740
|
+
const noteArgument = "note:<id> reference, as notes list prints it";
|
|
2741
|
+
examples2(annotate(notes.command("add"), {
|
|
2742
|
+
effects: LOCAL_WRITE,
|
|
2743
|
+
output: { entity: "note" },
|
|
2744
|
+
literal_after_dashes: true
|
|
2745
|
+
}).description("write a note about a document"), [`${prefix} notes add DOC_ID "Check the numbers" --title Review`]).argument("<document>", documentArgument).argument("<text>", "the note's text").option("--title <title>", "a title for the note").action(async (doc, text2, args) => output(itemOf(await run3(doc, (k, p, ref) => k.addNote(p, ref, text2, args.title)))));
|
|
2746
|
+
withQuery(examples2(annotate(notes.command("list"), { effects: LOCAL_READ }).description("list a document's notes"), [
|
|
2747
|
+
`${prefix} notes list DOC_ID`,
|
|
2748
|
+
`${prefix} notes list DOC_ID text:review --limit 10`
|
|
2749
|
+
]).argument("<document>", documentArgument), queries.notes).option("--limit <n>", "how many notes to return", positive, 50).option("--page <n>", "which page to return", positive, 1).action(async (doc, words, { page, limit }) => {
|
|
2750
|
+
const query = termsOf2(words, queries.notes, "notes list").text;
|
|
2751
|
+
const found = await run3(doc, (k, p, ref) => k.notes(p, ref, { ...query ? { search: query } : {}, limit, offset: (page - 1) * limit }));
|
|
2752
|
+
output(listOf("notes list", {
|
|
2753
|
+
items: found.items,
|
|
2754
|
+
limit,
|
|
2755
|
+
has_more: found.hasMore,
|
|
2756
|
+
page,
|
|
2757
|
+
args: { document: doc, query: words.join(" ") }
|
|
2758
|
+
}));
|
|
2759
|
+
});
|
|
2760
|
+
examples2(annotate(notes.command("show"), { effects: LOCAL_READ, output: { entity: "note" } }).description("show one note"), [`${prefix} notes show DOC_ID note:NOTE_ID`]).argument("<document>", documentArgument).argument("<note>", noteArgument).action(async (doc, noteRef) => output(itemOf(await run3(doc, (k, p, ref) => k.note(p, ref, noteRef)))));
|
|
2761
|
+
examples2(annotate(notes.command("edit"), {
|
|
2762
|
+
effects: LOCAL_WRITE,
|
|
2763
|
+
output: { entity: "note" },
|
|
2764
|
+
literal_after_dashes: true
|
|
2765
|
+
}).description("replace a note's text"), [`${prefix} notes edit DOC_ID note:NOTE_ID "Numbers checked" --revision 2`]).argument("<document>", documentArgument).argument("<note>", noteArgument).argument("<text>", "the note's new text").requiredOption("--revision <n>", "revision from notes show; a newer note is not overwritten", positive).action(async (doc, noteRef, text2, args) => output(itemOf(await run3(doc, (k, p, ref) => k.editNote(p, ref, noteRef, text2, args.revision)))));
|
|
2766
|
+
examples2(annotate(notes.command("remove"), { effects: LOCAL_WRITE }).description("delete one note"), [
|
|
2767
|
+
`${prefix} notes remove DOC_ID note:NOTE_ID`
|
|
2768
|
+
]).argument("<document>", documentArgument).argument("<note>", noteArgument).action(async (doc, noteRef) => output(itemOf(await run3(doc, (k, p, ref) => k.removeNote(p, ref, noteRef)))));
|
|
2769
|
+
const memories = annotate(program.command("memories"), { effects: LOCAL_READ }).description("keep what was learned from a document, with evidence; an agent's stay proposed");
|
|
2770
|
+
const memoryArgument = "memory:<id> reference, as memories list prints it";
|
|
2771
|
+
const scope = /* @__PURE__ */ __name((description) => new Option("--scope <scope>", description).choices(scopes), "scope");
|
|
2772
|
+
examples2(annotate(memories.command("add"), { effects: LOCAL_WRITE }).description("record a memory about a document"), [`${prefix} memories add DOC_ID "The team prefers async reviews" --scope work --kind preference`]).argument("<document>", documentArgument).argument("<text>", "what to remember").addOption(scope("whose memory it is: personal or work").makeOptionMandatory()).addOption(new Option("--kind <kind>", "what kind of memory it is").choices(MEMORY_KINDS).default("summary")).option("--supersedes <ref>", "a memory:<id> about the same document that this one replaces").action(async (doc, body, args) => output(itemOf(memoryItem(await run3(doc, (k, p, ref) => k.addMemory(p, ref, { body, ...args, status: "proposed", author: author() }))))));
|
|
2773
|
+
withQuery(examples2(annotate(memories.command("list"), { effects: LOCAL_READ }).description("list a document's memories"), [
|
|
2774
|
+
`${prefix} memories list DOC_ID scope:work`,
|
|
2775
|
+
`${prefix} memories list DOC_ID kind:preference status:confirmed`
|
|
2776
|
+
]).argument("<document>", documentArgument), MEMORY_QUERY).option("--limit <n>", "how many memories to return", positive, 50).action(async (doc, words, { limit }) => {
|
|
2777
|
+
const terms = queryTerms(words, MEMORY_QUERY, "memories list");
|
|
2778
|
+
const filters = {
|
|
2779
|
+
...terms.has("kind") ? { kind: terms.get("kind") } : {},
|
|
2780
|
+
...terms.has("status") ? { status: terms.get("status") } : {},
|
|
2781
|
+
...terms.has("scope") ? { scope: terms.get("scope") } : {}
|
|
2782
|
+
};
|
|
2783
|
+
output(allOf((await run3(doc, (k, p, ref) => k.memories(p, ref, { ...filters, limit }))).items.map(memoryItem)));
|
|
2784
|
+
});
|
|
2785
|
+
const memoryActions = {
|
|
2786
|
+
show: "show one memory",
|
|
2787
|
+
confirm: "confirm a proposed memory as true",
|
|
2788
|
+
stale: "mark a memory as out of date"
|
|
2789
|
+
};
|
|
2790
|
+
for (const [action, description] of Object.entries(memoryActions))
|
|
2791
|
+
examples2(annotate(memories.command(action), { effects: action === "show" ? LOCAL_READ : LOCAL_WRITE }).description(description), [`${prefix} memories ${action} DOC_ID memory:MEMORY_ID`]).argument("<document>", documentArgument).argument("<memory>", memoryArgument).action(async (doc, memoryRef) => output(itemOf(memoryItem(await run3(doc, (k, p, ref) => action === "show" ? k.memory(p, ref, memoryRef) : k.memory(p, ref, memoryRef, action, decider()))))));
|
|
2792
|
+
const search = examples2(annotate(memories.command("search"), { effects: LOCAL_READ }).description("search a document's memories by words"), [`${prefix} memories search DOC_ID reviews scope:work`, `${prefix} memories search DOC_ID "async reviews"`]).argument("<document>", documentArgument).argument("<query...>", "words to look for, and scope:personal or scope:work \u2014 the fields are below").allowUnknownOption().addHelpText("after", queryHelp(MEMORY_SEARCH_QUERY)).action(async (doc, words) => {
|
|
2793
|
+
const { text: text2, scope: scope2 } = memorySearch(words);
|
|
2794
|
+
const found = await run3(doc, (k, p, ref) => k.searchMemories(p, ref, text2, scope2));
|
|
2795
|
+
output({
|
|
2796
|
+
...allOf(found.items.map(memoryItem)),
|
|
2797
|
+
...found.hasMore ? { meta: { truncated: true } } : {}
|
|
2798
|
+
});
|
|
2799
|
+
});
|
|
2800
|
+
annotate(search, { query: defineQuery(MEMORY_SEARCH_QUERY), output: { entity: "memory" } });
|
|
2801
|
+
examples2(annotate(memories.command("extract"), { effects: REMOTE_WRITE }).argument("<document>", documentArgument).description("send a document's text to the model and show the memories it proposes"), [`${prefix} memories extract DOC_ID --scope work`, `${prefix} memories extract DOC_ID --scope work --yes`]).addOption(scope("whose memories they become: personal or work").makeOptionMandatory()).option("--tab <id>", "send only this tab of the document").option("--yes", "save the proposals, each with its quote and the document's version").action(async function(doc) {
|
|
2802
|
+
const args = this.opts();
|
|
2803
|
+
await run3(doc, async () => void 0);
|
|
2804
|
+
const result = await extractDocumentMemories({
|
|
2805
|
+
read: /* @__PURE__ */ __name(() => helpers.document(doc), "read"),
|
|
2806
|
+
complete: helpers.complete(),
|
|
2807
|
+
scope: args.scope,
|
|
2808
|
+
author: `${wording.app}-memory`,
|
|
2809
|
+
tab: args.tab,
|
|
2810
|
+
save: args.yes,
|
|
2811
|
+
withWrite: /* @__PURE__ */ __name((write) => run3(doc, write), "withWrite")
|
|
2812
|
+
});
|
|
2813
|
+
output(itemOf({ ...result, saved: result.saved.map((item) => "type" in item ? factItem(item) : memoryItem(item)) }));
|
|
2814
|
+
});
|
|
2815
|
+
const facts = annotate(program.command("facts"), { effects: LOCAL_READ }).description("what happened, as a document shows it; an agent's stay proposed until confirmed");
|
|
2816
|
+
const factArgument = "fact:<id> reference, as facts list prints it";
|
|
2817
|
+
examples2(annotate(facts.command("add"), { effects: LOCAL_WRITE }).description("record a fact a document shows"), [
|
|
2818
|
+
`${prefix} facts add DOC_ID "Budget approved" --type decision --scope work`
|
|
2819
|
+
]).argument("<document>", documentArgument).argument("<statement>", "the fact, in one sentence").addOption(new Option("--type <type>", "what kind of fact it is").choices(FACT_TYPES).default("fact")).addOption(scope("whose fact it is: personal or work")).option("--supersedes <ref>", "a decision only: the decision this one replaces").option("--occurred-time <time>", "when it happened, as the evidence shows, ISO 8601; a time without a zone is read in this computer's zone, a date alone as its midnight").action(async (doc, statement, { occurredTime, ...args }) => output(itemOf(factItem(await run3(doc, (k, p, ref) => k.addFact(p, ref, {
|
|
2820
|
+
statement,
|
|
2821
|
+
...args,
|
|
2822
|
+
by: author(),
|
|
2823
|
+
...occurredTime === void 0 ? {} : { occurredAt: occurredTime }
|
|
2824
|
+
}))))));
|
|
2825
|
+
withQuery(examples2(annotate(facts.command("list"), { effects: LOCAL_READ }).description("list a document's facts"), [
|
|
2826
|
+
`${prefix} facts list DOC_ID status:proposed`,
|
|
2827
|
+
`${prefix} facts list DOC_ID kind:decision`
|
|
2828
|
+
]).argument("<document>", documentArgument), FACT_QUERY).option("--limit <n>", "how many facts to return", positive, 50).action(async (doc, words, { limit }) => {
|
|
2829
|
+
const terms = queryTerms(words, FACT_QUERY, "facts list");
|
|
2830
|
+
const filters = {
|
|
2831
|
+
...terms.has("kind") ? { type: terms.get("kind") } : {},
|
|
2832
|
+
...terms.has("status") ? { status: terms.get("status") } : {}
|
|
2833
|
+
};
|
|
2834
|
+
output(allOf((await run3(doc, (k, p, ref) => k.facts(p, ref, { ...filters, limit }))).items.map(factItem)));
|
|
2835
|
+
});
|
|
2836
|
+
const factActions = {
|
|
2837
|
+
show: "show one fact",
|
|
2838
|
+
confirm: "confirm a proposed fact; a decision it supersedes stops holding",
|
|
2839
|
+
reverse: "an accepted decision no longer holds, and nothing replaced it"
|
|
2840
|
+
};
|
|
2841
|
+
for (const [action, description] of Object.entries(factActions))
|
|
2842
|
+
examples2(annotate(facts.command(action), { effects: action === "show" ? LOCAL_READ : LOCAL_WRITE }).description(description), [`${prefix} facts ${action} DOC_ID fact:FACT_ID`]).argument("<document>", documentArgument).argument("<fact>", factArgument).action(async (doc, factRef) => output(itemOf(factItem(await run3(doc, (k, p, ref) => action === "show" ? k.fact(p, ref, factRef) : k.fact(p, ref, factRef, action, decider()))))));
|
|
2843
|
+
const identities = annotate(program.command("identities"), { effects: LOCAL_READ }).description(text.identities);
|
|
2844
|
+
bindQuery2(examples2(annotate(identities.command("list"), { effects: LOCAL_READ }).description(text.identitiesList), [
|
|
2845
|
+
`${prefix} identities list DOC_ID`
|
|
2846
|
+
]).argument("<document>", documentArgument), queries.identities, identityRow).action(async (doc, words) => {
|
|
2847
|
+
const filter = termsOf2(words, queries.identities, "identities list");
|
|
2848
|
+
output(itemOf(await run3(doc, (k, p, ref) => k.people(p, ref, filter))));
|
|
2849
|
+
});
|
|
2850
|
+
examples2(annotate(identities.command("link"), { effects: LOCAL_WRITE }).description(text.identitiesLink), [
|
|
2851
|
+
`${prefix} identities link DOC_ID ${wording.remote.toUpperCase()}_ID person:PERSON_UID`
|
|
2852
|
+
]).argument("<document>", documentArgument).argument(`<${wording.remote}-id>`, text.identityArgument).argument("<person>", "person:<uid> reference of someone already known").action(async (doc, remoteId, personRef) => output(itemOf(await run3(doc, (k, p, ref) => k.linkPerson(p, ref, remoteId, personRef)))));
|
|
2853
|
+
}, "addDocumentKnowledgeCommandsDefinition");
|
|
2854
|
+
var addDocumentKnowledgeCommands = honoursDryRun(sharedCommand(addDocumentKnowledgeCommandsDefinition));
|
|
2855
|
+
|
|
2856
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/documents/mirrors.js
|
|
2857
|
+
import { statSync } from "node:fs";
|
|
2858
|
+
import { resolve } from "node:path";
|
|
2859
|
+
var addDocumentMirrorCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
|
|
2860
|
+
const { output } = helpers;
|
|
2861
|
+
const wording = wordsOf(helpers.words);
|
|
2862
|
+
const { app, prefix, provider, remote, text } = wording;
|
|
2863
|
+
const queries = documentQueries();
|
|
2864
|
+
const mirrors = annotate(program.command("mirrors"), { effects: LOCAL_READ }).description(text.mirrors);
|
|
2865
|
+
const find = /* @__PURE__ */ __name((id) => {
|
|
2866
|
+
const mirror = helpers.mirrors().find((item) => item.id === id);
|
|
2867
|
+
if (!mirror)
|
|
2868
|
+
throw new CliError("not_found", `no mirror ${id} in profile ${helpers.profile()}; see ${app} ${helpers.profile()} mirrors list`, {
|
|
2869
|
+
reason: "mirror.not-found"
|
|
2870
|
+
});
|
|
2871
|
+
return mirror;
|
|
2872
|
+
}, "find");
|
|
2873
|
+
const syncing = /* @__PURE__ */ __name((connection) => ({
|
|
2874
|
+
...connection.sync,
|
|
2875
|
+
stateOf: /* @__PURE__ */ __name((mirror) => helpers.stateOf(mirror), "stateOf"),
|
|
2876
|
+
remote
|
|
2877
|
+
}), "syncing");
|
|
2878
|
+
const chosenOf = /* @__PURE__ */ __name((id) => {
|
|
2879
|
+
const name = helpers.profile();
|
|
2880
|
+
const chosen = id ? [find(id)] : helpers.mirrors();
|
|
2881
|
+
if (!chosen.length)
|
|
2882
|
+
throw new CliError("not_found", `profile ${name} has no mirrors; add one with ${app} ${name} mirrors add`, {
|
|
2883
|
+
reason: "mirror.none"
|
|
2884
|
+
});
|
|
2885
|
+
return chosen;
|
|
2886
|
+
}, "chosenOf");
|
|
2887
|
+
examples2(annotate(mirrors.command("add"), { effects: FETCH }).argument("<path>", "local folder to mirror").requiredOption("--parent <id>", text.mirrorParent).description(text.mirrorsAdd), [`${prefix} mirrors add ./notes --parent FOLDER_ID`]).action(async (path, args) => {
|
|
2888
|
+
const root = resolve(path);
|
|
2889
|
+
let directory = false;
|
|
2890
|
+
try {
|
|
2891
|
+
directory = statSync(root).isDirectory();
|
|
2892
|
+
} catch {
|
|
2893
|
+
}
|
|
2894
|
+
if (!directory)
|
|
2895
|
+
throw new CliError("validation_error", "the path to mirror is not a folder", { reason: "mirror.not-folder" });
|
|
2896
|
+
const parent = await helpers.parent(args.parent);
|
|
2897
|
+
const folder = parent.id;
|
|
2898
|
+
const id = mirrorId(root, folder);
|
|
2899
|
+
const list = helpers.mirrors();
|
|
2900
|
+
if (!list.some((mirror) => mirror.id === id))
|
|
2901
|
+
list.push({ id, path: root, folder });
|
|
2902
|
+
helpers.save(list);
|
|
2903
|
+
output(itemOf({ id, path: root, folder, folder_name: parent.name, added: true }));
|
|
2904
|
+
});
|
|
2905
|
+
bindQuery2(examples2(annotate(mirrors.command("list"), { effects: LOCAL_READ }).description("list this profile's mirrors"), [
|
|
2906
|
+
`${prefix} mirrors list`
|
|
2907
|
+
]), queries.mirrors, mirrorRow).action((words) => {
|
|
2908
|
+
const filter = termsOf2(words, queries.mirrors, "mirrors list");
|
|
2909
|
+
output(allOf(helpers.mirrors().filter((row) => Object.entries(filter).every(([key, value]) => row[key] === value))));
|
|
2910
|
+
});
|
|
2911
|
+
examples2(annotate(mirrors.command("remove"), { effects: LOCAL_WRITE }).argument("<id>", "mirror id from mirrors list").description(`stop mirroring a folder; nothing in ${wording.place} is changed or deleted`), [`${prefix} mirrors remove 1a2b3c4d`]).action((id) => {
|
|
2912
|
+
find(id);
|
|
2913
|
+
helpers.save(helpers.mirrors().filter((mirror) => mirror.id !== id));
|
|
2914
|
+
output(itemOf({ id, removed: true }));
|
|
2915
|
+
});
|
|
2916
|
+
examples2(annotate(mirrors.command("status"), { effects: LOCAL_READ }).argument("[id]", "mirror id; every mirror of the profile when omitted").description(`show which local files the next sync would create or send; ${provider} is not asked`), [`${prefix} mirrors status`]).action(async (id) => {
|
|
2917
|
+
const items = await mirrorStatus(id ? [find(id)] : helpers.mirrors(), helpers.kindOf, (mirror) => helpers.stateOf(mirror));
|
|
2918
|
+
output(allOf(items.map(({ id: id2, folder, create, update: update2, unchanged, orphans, unsupported, remote_checked }) => ({
|
|
2919
|
+
id: id2,
|
|
2920
|
+
folder,
|
|
2921
|
+
create: create.length,
|
|
2922
|
+
update: update2.length,
|
|
2923
|
+
unchanged,
|
|
2924
|
+
orphans: orphans.length,
|
|
2925
|
+
unsupported,
|
|
2926
|
+
remote_checked
|
|
2927
|
+
}))));
|
|
2928
|
+
});
|
|
2929
|
+
examples2(annotate(mirrors.command("sync"), { effects: REMOTE_WRITE }).argument("[id]", "mirror id; every mirror of the profile when omitted").addOption(new Option("--keep <side>", "where a part changed on both sides, keep this side").choices([
|
|
2930
|
+
"local",
|
|
2931
|
+
remote,
|
|
2932
|
+
"both"
|
|
2933
|
+
])).option("--replace", `same as --keep local, and create again files deleted in ${provider}`).description(text.mirrorsSync), [
|
|
2934
|
+
`${prefix} mirrors sync`,
|
|
2935
|
+
`${prefix} mirrors sync 1a2b3c4d --keep ${remote}`,
|
|
2936
|
+
`${prefix} mirrors sync 1a2b3c4d --replace`
|
|
2937
|
+
]).action(async (id, args) => {
|
|
2938
|
+
const chosen = chosenOf(id);
|
|
2939
|
+
if (args.replace && args.keep && args.keep !== "local")
|
|
2940
|
+
throw new CliError("validation_error", `--replace keeps the local side; it cannot be combined with --keep ${remote} or both`);
|
|
2941
|
+
const keep = args.replace ? "local" : args.keep === remote ? "remote" : args.keep;
|
|
2942
|
+
const connection = await helpers.connect();
|
|
2943
|
+
const { items, issues } = await syncMirrors({
|
|
2944
|
+
...syncing(connection),
|
|
2945
|
+
mirrors: chosen,
|
|
2946
|
+
...keep ? { keep } : {},
|
|
2947
|
+
recreate: args.replace === true
|
|
2948
|
+
});
|
|
2949
|
+
const body = allOf(items);
|
|
2950
|
+
if (issues.length)
|
|
2951
|
+
body.meta = { complete: false, issues };
|
|
2952
|
+
output(body);
|
|
2953
|
+
if (issues.length)
|
|
2954
|
+
throw new CliError("provider_error", `some files were not synced; see conflicts, missing and errors, then rerun with --keep local, ${remote} or both`, { reason: "mirror.partial" });
|
|
2955
|
+
});
|
|
2956
|
+
examples2(annotate(mirrors.command("watch"), { effects: REMOTE_WRITE, lifetime: "persistent" }).argument("[id]", "mirror id; every mirror of the profile when omitted").option("--every <duration>", `how often to ask ${provider} for changes`, "60s").summary("keep syncing both ways until Ctrl-C or --timeout").description(`keep syncing both ways until Ctrl-C or --timeout: on each local save and each ${provider} change; a part changed on both sides is reported and left for mirrors sync --keep`), [`${prefix} mirrors watch`, `${prefix} mirrors watch 1a2b3c4d --every 2m --jsonl`]).action(async (id, args) => {
|
|
2957
|
+
const pollMs = parseDuration(args.every, "--every");
|
|
2958
|
+
if (pollMs < 1e4)
|
|
2959
|
+
throw new CliError("validation_error", "--every must be at least 10s");
|
|
2960
|
+
const chosen = chosenOf(id);
|
|
2961
|
+
const signal = helpers.endsOnStop() ?? new AbortController().signal;
|
|
2962
|
+
const connection = await helpers.connect();
|
|
2963
|
+
const states = /* @__PURE__ */ __name((mirror) => helpers.stateOf(mirror), "states");
|
|
2964
|
+
let token = await connection.startToken();
|
|
2965
|
+
const remoteChanges = /* @__PURE__ */ __name(async () => {
|
|
2966
|
+
let changed;
|
|
2967
|
+
try {
|
|
2968
|
+
const feed = await connection.changes(token);
|
|
2969
|
+
token = feed.cursor;
|
|
2970
|
+
changed = new Set(feed.items.map((item) => item.id));
|
|
2971
|
+
} catch (error) {
|
|
2972
|
+
if (!isCliError(error) || error.details?.reason !== "listing.too-large")
|
|
2973
|
+
throw error;
|
|
2974
|
+
token = await connection.startToken();
|
|
2975
|
+
return "all";
|
|
2976
|
+
}
|
|
2977
|
+
return chosen.filter((mirror) => Object.values(states(mirror).read().entries).some((entry) => changed.has(entry.id))).map((mirror) => mirror.id);
|
|
2978
|
+
}, "remoteChanges");
|
|
2979
|
+
let cycles = 0;
|
|
2980
|
+
for await (const event of watchMirrors((mirrors2) => syncMirrors({ ...syncing(connection), mirrors: mirrors2 }), {
|
|
2981
|
+
mirrors: chosen,
|
|
2982
|
+
signal,
|
|
2983
|
+
kindOf: helpers.kindOf,
|
|
2984
|
+
stateOf: states,
|
|
2985
|
+
remoteChanges,
|
|
2986
|
+
pollMs
|
|
2987
|
+
})) {
|
|
2988
|
+
cycles++;
|
|
2989
|
+
const data = {
|
|
2990
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2991
|
+
triggers: event.triggers,
|
|
2992
|
+
mirrors: event.mirrors,
|
|
2993
|
+
..."error" in event ? { error: { code: event.error.code, message: event.error.message } } : { results: event.result.items, ...event.result.issues.length ? { issues: event.result.issues } : {} }
|
|
2994
|
+
};
|
|
2995
|
+
helpers.print((format, write) => write(format === "pretty" ? describeCycle(data) : JSON.stringify({ type: "item", data })));
|
|
2996
|
+
}
|
|
2997
|
+
helpers.print((format, write) => {
|
|
2998
|
+
if (format === "pretty")
|
|
2999
|
+
return;
|
|
3000
|
+
const end = listOf("mirrors watch", {
|
|
3001
|
+
items: [],
|
|
3002
|
+
limit: Math.max(1, cycles),
|
|
3003
|
+
has_more: false,
|
|
3004
|
+
paging: "cursor",
|
|
3005
|
+
meta: { complete: true }
|
|
3006
|
+
});
|
|
3007
|
+
for (const record2 of jsonlRecords(end))
|
|
3008
|
+
write(JSON.stringify(record2));
|
|
3009
|
+
});
|
|
3010
|
+
});
|
|
3011
|
+
}, "addDocumentMirrorCommandsDefinition");
|
|
3012
|
+
var describeCycle = /* @__PURE__ */ __name((cycle) => {
|
|
3013
|
+
const time = cycle.at.slice(11, 19);
|
|
3014
|
+
if (cycle.error)
|
|
3015
|
+
return `${time} ${cycle.triggers.join("+")}: ${cycle.error.message}; trying again`;
|
|
3016
|
+
const parts = (cycle.results ?? []).map((result) => `${result.id} ${result.created.length} created, ${result.updated.length} sent, ${result.pulled.length} pulled` + (result.conflicts.length ? `, ${result.conflicts.length} conflicts (mirrors sync ${result.id} --keep \u2026)` : ""));
|
|
3017
|
+
return `${time} ${cycle.triggers.join("+")}: ${parts.join("; ") || "nothing to do"}`;
|
|
3018
|
+
}, "describeCycle");
|
|
3019
|
+
var addDocumentMirrorCommands = honoursDryRun(sharedCommand(addDocumentMirrorCommandsDefinition));
|
|
3020
|
+
|
|
3021
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/documents/search.js
|
|
3022
|
+
var notImported = /* @__PURE__ */ __name((app, { profile, chosen, documents }) => {
|
|
3023
|
+
if (documents > 0)
|
|
3024
|
+
return void 0;
|
|
3025
|
+
return !chosen ? `profile ${profile} has no folders selected, so nothing is imported to search \u2014 ${app} ${profile} folders add FOLDER_ID, then ${app} ${profile} sync` : `profile ${profile} has imported no documents yet \u2014 ${app} ${profile} sync`;
|
|
3026
|
+
}, "notImported");
|
|
3027
|
+
var addDocumentSearchCommandDefinition = /* @__PURE__ */ __name((program, helpers) => {
|
|
3028
|
+
const wording = wordsOf(helpers.words);
|
|
3029
|
+
const { prefix } = wording;
|
|
3030
|
+
return examples2(annotate(program.command("search"), { effects: LOCAL_READ }).argument("<query>", "words to look for, and fields such as tag: and date: that every hit must match").description("search imported documents by words, and by meaning when indexed"), [`${prefix} search budget`, `${prefix} search "quarterly plan" --exact --limit 5`]).option("--limit <n>", "how many results to return", positive, 20).option("--page <n>", "which page to return", positive, 1).option("--exact", "match the words exactly: no word forms, no meaning").action(async (query, { page, ...args }) => {
|
|
3031
|
+
const result = await helpers.search(query, {
|
|
3032
|
+
...args,
|
|
3033
|
+
offset: (page - 1) * args.limit,
|
|
3034
|
+
exact: args.exact ?? false
|
|
3035
|
+
});
|
|
3036
|
+
const hint = notImported(wording.app, helpers.imported());
|
|
3037
|
+
helpers.output(itemOf(hint ? { ...result, not_imported: hint } : result));
|
|
3038
|
+
});
|
|
3039
|
+
}, "addDocumentSearchCommandDefinition");
|
|
3040
|
+
var addDocumentSearchCommand = honoursDryRun(sharedCommand(addDocumentSearchCommandDefinition));
|
|
3041
|
+
|
|
3042
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/documents/sync.js
|
|
3043
|
+
var addDocumentSyncCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
|
|
3044
|
+
const { output } = helpers;
|
|
3045
|
+
const wording = wordsOf(helpers.words);
|
|
3046
|
+
const { prefix, text } = wording;
|
|
3047
|
+
const sync2 = examples2(
|
|
3048
|
+
// Cooperative: it stops on its own at its budget, its deadline or a cancel and keeps its work, so it gets a sync's
|
|
3049
|
+
// deadline (15 min in a terminal, 45 s over MCP) instead of a one-shot's 30 s.
|
|
3050
|
+
annotate(program.command("sync"), { effects: FETCH, cooperative: true, partial: true }).summary("import what changed in the chosen folders, and finish an unfinished sync").description(`import what changed in the chosen folders, and finish an unfinished sync; one sync walks about ${helpers.maxEntries} entries under the chosen folders, saves where it stopped, and the next sync goes on from there`),
|
|
3051
|
+
[`${prefix} sync`, `${prefix} sync --rescan --limit 500`]
|
|
3052
|
+
).option("--limit <n>", text.syncLimit, positive, 200).option("--rescan", "read every chosen folder again instead of only what changed; each --rescan starts the walk over, so run it once and continue with a plain sync").option("--embed", "also index pending text for meaning search, with a model already downloaded").action(async (args, command) => {
|
|
3053
|
+
const deadline = environmentOf(command).deadline?.();
|
|
3054
|
+
const result = await helpers.sync({ ...args, budget: runBudgetOf(command), ...deadline ? { deadline } : {} });
|
|
3055
|
+
const unfinished = result.complete === false || result.pending > 0;
|
|
3056
|
+
const moved = (result.walk?.listed ?? 0) > 0 || [result.saved, result.names_only, result.removed, result.unchanged].some((count) => (count ?? 0) > 0);
|
|
3057
|
+
const again = `${wording.app} ${helpers.profile()} sync`;
|
|
3058
|
+
const timeout = command.optsWithGlobals().timeout;
|
|
3059
|
+
const next = unfinished && !result.errors.length && moved ? [
|
|
3060
|
+
{
|
|
3061
|
+
kind: "command",
|
|
3062
|
+
step: "sync.run",
|
|
3063
|
+
command: "sync",
|
|
3064
|
+
args: {
|
|
3065
|
+
limit: args.limit,
|
|
3066
|
+
...timeout === void 0 ? {} : { timeout },
|
|
3067
|
+
...args.embed ? { embed: true } : {}
|
|
3068
|
+
},
|
|
3069
|
+
why: "the sync stopped before the end of its pass; running it again goes on from there",
|
|
3070
|
+
safe_to_auto_execute: true
|
|
3071
|
+
}
|
|
3072
|
+
] : [];
|
|
3073
|
+
output(itemOf(result, {
|
|
3074
|
+
meta: result.errors.length ? {
|
|
3075
|
+
complete: false,
|
|
3076
|
+
issues: [{ code: "provider_error", reason: "sync.partial", source: wording.source }]
|
|
3077
|
+
} : unfinished ? { complete: false } : {},
|
|
3078
|
+
next
|
|
3079
|
+
}));
|
|
3080
|
+
if (result.walk)
|
|
3081
|
+
helpers.diagnostic(`${result.walk.folders_left} folders remain to list; run ${again} again
|
|
3082
|
+
`);
|
|
3083
|
+
else if (result.errors.length || result.pending)
|
|
3084
|
+
helpers.diagnostic(`${result.pending} source operations remain; run ${again} again
|
|
3085
|
+
`);
|
|
3086
|
+
if (result.errors.length)
|
|
3087
|
+
throw new CliError("provider_error", "sync completed partially; failed operations remain pending", {
|
|
3088
|
+
reason: "sync.partial"
|
|
3089
|
+
});
|
|
3090
|
+
});
|
|
3091
|
+
const status = examples2(annotate(program.command("status"), { effects: LOCAL_READ }).description("show the last sync, imported documents and pending work"), [`${prefix} status`]).action(async () => {
|
|
3092
|
+
output(itemOf(await helpers.status()));
|
|
3093
|
+
});
|
|
3094
|
+
return [sync2, status];
|
|
3095
|
+
}, "addDocumentSyncCommandsDefinition");
|
|
3096
|
+
var addDocumentSyncCommands = honoursDryRun(sharedCommand(addDocumentSyncCommandsDefinition));
|
|
3097
|
+
|
|
3098
|
+
// dist/catalog.js
|
|
3099
|
+
var catalogInput = /* @__PURE__ */ __name((file) => ({
|
|
3100
|
+
externalId: `${file.id}.md`,
|
|
3101
|
+
kind: file.mime === FOLDER ? "folder" : "file",
|
|
3102
|
+
name: file.name,
|
|
3103
|
+
parents: file.parents.map((id) => `${id}.md`),
|
|
3104
|
+
url: file.url,
|
|
3105
|
+
mime: file.mime,
|
|
3106
|
+
size: file.size,
|
|
3107
|
+
createdAt: file.createdAt,
|
|
3108
|
+
modifiedAt: file.modifiedAt,
|
|
3109
|
+
description: file.description,
|
|
3110
|
+
actors: [
|
|
3111
|
+
...(file.owners ?? []).map((actor) => ({ ...actor, role: "owner" })),
|
|
3112
|
+
...file.lastModifiedBy ? [{ ...file.lastModifiedBy, role: "editor" }] : []
|
|
3113
|
+
],
|
|
3114
|
+
metadata: file.providerMetadata ?? file,
|
|
3115
|
+
frontMatter: {
|
|
3116
|
+
source: "google-drive",
|
|
3117
|
+
sourceUrl: file.url,
|
|
3118
|
+
fileId: file.id,
|
|
3119
|
+
mime: file.mime,
|
|
3120
|
+
owners: file.owners ?? [],
|
|
3121
|
+
lastModifiedBy: file.lastModifiedBy ?? null
|
|
3122
|
+
}
|
|
3123
|
+
}), "catalogInput");
|
|
3124
|
+
|
|
3125
|
+
// dist/commands/context.js
|
|
3126
|
+
var positive2 = /* @__PURE__ */ __name((input) => {
|
|
3127
|
+
const n = Number(input);
|
|
3128
|
+
if (!Number.isSafeInteger(n) || n < 1)
|
|
3129
|
+
throw new InvalidArgumentError("use a positive integer");
|
|
3130
|
+
return n;
|
|
3131
|
+
}, "positive");
|
|
3132
|
+
var DRIVE_WORDS = {
|
|
3133
|
+
app: "drive",
|
|
3134
|
+
remote: "google",
|
|
3135
|
+
provider: "Google",
|
|
3136
|
+
place: "Google Drive",
|
|
3137
|
+
source: "google-drive",
|
|
3138
|
+
text: {
|
|
3139
|
+
documents: "read imported documents and Google Docs",
|
|
3140
|
+
documentArgument: "document id, Google Docs URL, or a search hit's document: ref",
|
|
3141
|
+
knowledgeArgument: "Google file or folder id or URL in the local catalog, or a document:<n> ref",
|
|
3142
|
+
catalog: "browse stored Drive files and folders offline",
|
|
3143
|
+
catalogArgument: "Google file or folder id, or its Drive URL",
|
|
3144
|
+
treeArgument: "Google folder id or URL; defaults to the explicitly selected profile's roots",
|
|
3145
|
+
identitiesList: "list the owners and last editor Google shows for a document",
|
|
3146
|
+
mirrors: "keep local folders mirrored into Google Docs and Sheets",
|
|
3147
|
+
mirrorsAdd: "mirror a local folder: Markdown to Google Docs, CSV/TSV/XLSX to Sheets",
|
|
3148
|
+
mirrorsSync: "sync both ways with Docs and Sheets; a part changed on both sides is reported"
|
|
3149
|
+
}
|
|
3150
|
+
};
|
|
3151
|
+
|
|
3152
|
+
// dist/commands/catalog.js
|
|
3153
|
+
var installCatalogCommands = /* @__PURE__ */ __name((program, helpers) => {
|
|
3154
|
+
const { env, selected, output, withIndex } = helpers;
|
|
3155
|
+
addDocumentCatalogCommands(program, {
|
|
3156
|
+
words: DRIVE_WORDS,
|
|
3157
|
+
output,
|
|
3158
|
+
run: /* @__PURE__ */ __name(async (fn, write) => {
|
|
3159
|
+
const profile = activeProfile(env, selected());
|
|
3160
|
+
return withIndex(async (index) => {
|
|
3161
|
+
const lock = write ? await lockProfile(env, selected()) : void 0;
|
|
3162
|
+
try {
|
|
3163
|
+
lock?.assertHeld();
|
|
3164
|
+
const { catalog } = index;
|
|
3165
|
+
const value = await fn({
|
|
3166
|
+
...catalog ? {
|
|
3167
|
+
catalog: {
|
|
3168
|
+
import: /* @__PURE__ */ __name((principal) => catalog.import(principal, catalogFiles(readState(env, selected(), principal), activeProfile(env, selected()).roots)), "import"),
|
|
3169
|
+
get: /* @__PURE__ */ __name((principal, id) => catalog.get(principal, id), "get"),
|
|
3170
|
+
list: /* @__PURE__ */ __name((principal, query) => catalog.list(principal, query), "list")
|
|
3171
|
+
}
|
|
3172
|
+
} : {},
|
|
3173
|
+
...index.knowledge ? { knowledge: index.knowledge } : {}
|
|
3174
|
+
}, profile.principal);
|
|
3175
|
+
lock?.assertHeld();
|
|
3176
|
+
return value;
|
|
3177
|
+
} finally {
|
|
3178
|
+
await lock?.release();
|
|
3179
|
+
}
|
|
3180
|
+
});
|
|
3181
|
+
}, "run"),
|
|
3182
|
+
id: fileId,
|
|
3183
|
+
roots: /* @__PURE__ */ __name(() => activeProfile(env, selected()).roots, "roots")
|
|
3184
|
+
});
|
|
3185
|
+
}, "installCatalogCommands");
|
|
3186
|
+
|
|
3187
|
+
// dist/commands/config.js
|
|
3188
|
+
import { join as join4 } from "node:path";
|
|
3189
|
+
|
|
3190
|
+
// dist/policy.js
|
|
3191
|
+
import { join as join3 } from "node:path";
|
|
3192
|
+
var ORDER = { deny: 0, readonly: 1, ask: 2, allow: 3 };
|
|
3193
|
+
var overridesOf = /* @__PURE__ */ __name((entries = []) => {
|
|
3194
|
+
const levels = {};
|
|
3195
|
+
for (const entry of entries) {
|
|
3196
|
+
const [key = "", level = "", extra] = entry.split("=");
|
|
3197
|
+
if (!/^[a-z][a-z-]*(\.[a-zA-Z][a-zA-Z-]*)*$/.test(key) || !LEVELS.includes(level) || extra)
|
|
3198
|
+
throw new CliError("validation_error", "--permission takes a command path and level, e.g. files.trash=deny (deny, readonly, ask, allow)");
|
|
3199
|
+
levels[key] = level;
|
|
3200
|
+
}
|
|
3201
|
+
return levels;
|
|
3202
|
+
}, "overridesOf");
|
|
3203
|
+
var policySettings = /* @__PURE__ */ __name((env, profile, flags = {}) => {
|
|
3204
|
+
const keys = flags.permissionKeys;
|
|
3205
|
+
const names = keys && permissionNames(keys);
|
|
3206
|
+
const { config, issues } = inspectConfig(env, names);
|
|
3207
|
+
const [first] = issues;
|
|
3208
|
+
if (first)
|
|
3209
|
+
throw first.kind === "unknown_permission" ? new CliError("configuration_error", refusal(issues).message, {
|
|
3210
|
+
reason: "policy.unknown-key",
|
|
2452
3211
|
permission: first.key?.slice("permissions.".length)
|
|
2453
3212
|
}) : refusal(issues);
|
|
2454
3213
|
const own = config.profiles[profile];
|
|
@@ -2693,7 +3452,7 @@ var installModelCommands = /* @__PURE__ */ __name((program, { env, output, strea
|
|
|
2693
3452
|
const download = /* @__PURE__ */ __name(async (kind, id, acceptTerms) => {
|
|
2694
3453
|
if (policyFlags().offline)
|
|
2695
3454
|
throw offlineRefused("downloading a model needs the network");
|
|
2696
|
-
const { downloadImageModel, downloadTextModel } = await import("./services-
|
|
3455
|
+
const { downloadImageModel, downloadTextModel } = await import("./services-ZILSFJ6E.js");
|
|
2697
3456
|
const progress = /* @__PURE__ */ __name((line) => {
|
|
2698
3457
|
if (!program.opts().quiet)
|
|
2699
3458
|
streams.diagnostic(line);
|
|
@@ -2726,24 +3485,8 @@ var installModelCommands = /* @__PURE__ */ __name((program, { env, output, strea
|
|
|
2726
3485
|
examples(annotate(imageModels.command("download"), { effects: FETCH, output: { entity: "model" } }).description("download a picture model once into the folder every WireCat CLI shares"), ["drive images models download clip-b32"]).argument("<model>", "model id, such as clip-b32").action((id) => download("image", id, false));
|
|
2727
3486
|
}, "installModelCommands");
|
|
2728
3487
|
|
|
2729
|
-
// dist/commands/context.js
|
|
2730
|
-
var positive = /* @__PURE__ */ __name((input) => {
|
|
2731
|
-
const n = Number(input);
|
|
2732
|
-
if (!Number.isSafeInteger(n) || n < 1)
|
|
2733
|
-
throw new InvalidArgumentError("use a positive integer");
|
|
2734
|
-
return n;
|
|
2735
|
-
}, "positive");
|
|
2736
|
-
var offset = /* @__PURE__ */ __name((input) => {
|
|
2737
|
-
const n = Number(input);
|
|
2738
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
|
2739
|
-
throw new InvalidArgumentError("use a nonnegative integer");
|
|
2740
|
-
return n;
|
|
2741
|
-
}, "offset");
|
|
2742
|
-
|
|
2743
3488
|
// dist/contract-overrides.js
|
|
2744
3489
|
import { createHash } from "node:crypto";
|
|
2745
|
-
var NOTES_REASON = "Drive notes annotate one explicitly selected imported document; document-bound arguments and receipts replace the generic note scope.";
|
|
2746
|
-
var SEARCH_REASON = "Drive searches imported documents and embeddings rather than live messenger messages; its default action and pagination are explicitly provider-specific.";
|
|
2747
3490
|
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");
|
|
2748
3491
|
var fingerprint = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(canonical(value ?? null))).digest("hex").slice(0, 16), "fingerprint");
|
|
2749
3492
|
var reviewedOverrides = /* @__PURE__ */ __name((reference, reviewed) => reviewed.map((override) => {
|
|
@@ -2754,248 +3497,6 @@ var reviewedOverrides = /* @__PURE__ */ __name((reference, reviewed) => reviewed
|
|
|
2754
3497
|
return { ...override, before: fingerprint(before) === override.before ? before : override.before };
|
|
2755
3498
|
}), "reviewedOverrides");
|
|
2756
3499
|
var SHELL_OVERRIDES = {
|
|
2757
|
-
notes: [
|
|
2758
|
-
{
|
|
2759
|
-
command: ["notes"],
|
|
2760
|
-
field: "description",
|
|
2761
|
-
before: "073d38b6d7256579",
|
|
2762
|
-
after: "write notes about an imported document",
|
|
2763
|
-
reason: NOTES_REASON
|
|
2764
|
-
},
|
|
2765
|
-
{
|
|
2766
|
-
command: ["notes"],
|
|
2767
|
-
field: "effects",
|
|
2768
|
-
before: "b98c7b06ed808dfb",
|
|
2769
|
-
after: { remote: "none", local: "read" },
|
|
2770
|
-
reason: NOTES_REASON
|
|
2771
|
-
},
|
|
2772
|
-
{
|
|
2773
|
-
command: ["notes"],
|
|
2774
|
-
field: "children",
|
|
2775
|
-
before: "6cfec8425c19582f",
|
|
2776
|
-
after: ["add", "list", "show", "edit", "remove"],
|
|
2777
|
-
reason: NOTES_REASON
|
|
2778
|
-
},
|
|
2779
|
-
{
|
|
2780
|
-
command: ["notes", "add"],
|
|
2781
|
-
field: "description",
|
|
2782
|
-
before: "98b319044cba6b7f",
|
|
2783
|
-
after: "write a note about a document",
|
|
2784
|
-
reason: NOTES_REASON
|
|
2785
|
-
},
|
|
2786
|
-
{
|
|
2787
|
-
command: ["notes", "add"],
|
|
2788
|
-
field: "arguments",
|
|
2789
|
-
before: "d5010f078464b8d0",
|
|
2790
|
-
after: [
|
|
2791
|
-
{
|
|
2792
|
-
name: "document",
|
|
2793
|
-
required: true,
|
|
2794
|
-
variadic: false,
|
|
2795
|
-
description: "Google file or folder id or URL in the local catalog, or a document:<n> ref"
|
|
2796
|
-
},
|
|
2797
|
-
{ name: "text", required: true, variadic: false, description: "the note's text" }
|
|
2798
|
-
],
|
|
2799
|
-
reason: NOTES_REASON
|
|
2800
|
-
},
|
|
2801
|
-
{
|
|
2802
|
-
command: ["notes", "add"],
|
|
2803
|
-
field: "options",
|
|
2804
|
-
before: "213adb539c248d7f",
|
|
2805
|
-
after: [{ flags: "--title <title>", description: "a title for the note", takes_value: true, mandatory: false }],
|
|
2806
|
-
reason: NOTES_REASON
|
|
2807
|
-
},
|
|
2808
|
-
{
|
|
2809
|
-
command: ["notes", "add"],
|
|
2810
|
-
field: "examples",
|
|
2811
|
-
before: "74234e98afe7498f",
|
|
2812
|
-
after: ['drive personal notes add DOC_ID "Check the numbers" --title Review'],
|
|
2813
|
-
reason: NOTES_REASON
|
|
2814
|
-
},
|
|
2815
|
-
{
|
|
2816
|
-
command: ["notes", "list"],
|
|
2817
|
-
field: "description",
|
|
2818
|
-
before: "6b866a022b5e84ce",
|
|
2819
|
-
after: "list a document's notes",
|
|
2820
|
-
reason: NOTES_REASON
|
|
2821
|
-
},
|
|
2822
|
-
{
|
|
2823
|
-
command: ["notes", "list"],
|
|
2824
|
-
field: "query",
|
|
2825
|
-
before: "0b0517429a4f9613",
|
|
2826
|
-
after: {
|
|
2827
|
-
entity: "note",
|
|
2828
|
-
backend: "native",
|
|
2829
|
-
fields: [
|
|
2830
|
-
{ name: "ref", type: "ref", operators: ["term", "phrase"], example: 'ref:"note:42"' },
|
|
2831
|
-
{ name: "kind", type: "enum", values: ["note", "document"], operators: ["term"], example: "kind:note" },
|
|
2832
|
-
{ name: "provider", type: "kw", operators: ["term", "phrase", "wildcard"], example: "provider:abc" },
|
|
2833
|
-
{ name: "account", type: "kw", operators: ["term", "phrase", "wildcard"], example: "account:abc" },
|
|
2834
|
-
{ name: "url", type: "kw", operators: ["term", "phrase", "wildcard"], example: "url:abc" },
|
|
2835
|
-
{ name: "id", type: "kw", operators: ["term", "phrase", "wildcard"], example: "id:abc" },
|
|
2836
|
-
{ name: "source", type: "enum", values: ["file", "internal"], operators: ["term"], example: "source:file" },
|
|
2837
|
-
{ name: "folder_id", type: "kw", operators: ["term", "phrase", "wildcard"], example: "folder_id:abc" },
|
|
2838
|
-
{ name: "path", type: "kw", operators: ["term", "phrase", "wildcard"], example: "path:abc" },
|
|
2839
|
-
{ name: "title", type: "kw", operators: ["term", "phrase", "wildcard"], example: "title:abc" },
|
|
2840
|
-
{ name: "text", type: "kw", operators: ["term", "phrase"], example: "text:review", native: true },
|
|
2841
|
-
{ name: "revision", type: "num", operators: ["term", "range"], example: "revision>0" },
|
|
2842
|
-
{ name: "content_hash", type: "kw", operators: ["term", "phrase", "wildcard"], example: "content_hash:abc" },
|
|
2843
|
-
{ name: "export_path", type: "kw", operators: ["term", "phrase", "wildcard"], example: "export_path:abc" },
|
|
2844
|
-
{ name: "created_at", type: "time", operators: ["term", "range"], example: "created_at>=7d" },
|
|
2845
|
-
{ name: "updated_at", type: "time", operators: ["term", "range"], example: "updated_at>=7d" },
|
|
2846
|
-
{ name: "deleted_at", type: "time", operators: ["term", "range"], example: "deleted_at>=7d" },
|
|
2847
|
-
{ name: "tags", type: "kw", operators: ["term", "phrase", "wildcard"], example: "tags:abc" },
|
|
2848
|
-
{ name: "excerpt", type: "kw", operators: ["term", "phrase", "wildcard"], example: "excerpt:abc" },
|
|
2849
|
-
{
|
|
2850
|
-
name: "found_by",
|
|
2851
|
-
type: "enum",
|
|
2852
|
-
values: ["title", "words", "meaning"],
|
|
2853
|
-
operators: ["term"],
|
|
2854
|
-
example: "found_by:title"
|
|
2855
|
-
}
|
|
2856
|
-
]
|
|
2857
|
-
},
|
|
2858
|
-
reason: NOTES_REASON
|
|
2859
|
-
},
|
|
2860
|
-
{
|
|
2861
|
-
command: ["notes", "list"],
|
|
2862
|
-
field: "arguments",
|
|
2863
|
-
before: "350998d1fcef909c",
|
|
2864
|
-
after: [
|
|
2865
|
-
{
|
|
2866
|
-
name: "document",
|
|
2867
|
-
required: true,
|
|
2868
|
-
variadic: false,
|
|
2869
|
-
description: "Google file or folder id or URL in the local catalog, or a document:<n> ref"
|
|
2870
|
-
},
|
|
2871
|
-
{
|
|
2872
|
-
name: "query",
|
|
2873
|
-
required: false,
|
|
2874
|
-
variadic: true,
|
|
2875
|
-
description: "field:value terms that narrow the list \u2014 the fields are below"
|
|
2876
|
-
}
|
|
2877
|
-
],
|
|
2878
|
-
reason: NOTES_REASON
|
|
2879
|
-
},
|
|
2880
|
-
{
|
|
2881
|
-
command: ["notes", "list"],
|
|
2882
|
-
field: "options",
|
|
2883
|
-
before: "4f53cda18c2baa0c",
|
|
2884
|
-
after: [
|
|
2885
|
-
{
|
|
2886
|
-
flags: "--limit <n>",
|
|
2887
|
-
description: "how many notes to return",
|
|
2888
|
-
takes_value: true,
|
|
2889
|
-
mandatory: false,
|
|
2890
|
-
default: 50
|
|
2891
|
-
},
|
|
2892
|
-
{ flags: "--page <n>", description: "which page to return", takes_value: true, mandatory: false, default: 1 }
|
|
2893
|
-
],
|
|
2894
|
-
reason: NOTES_REASON
|
|
2895
|
-
},
|
|
2896
|
-
{
|
|
2897
|
-
command: ["notes", "list"],
|
|
2898
|
-
field: "examples",
|
|
2899
|
-
before: "74234e98afe7498f",
|
|
2900
|
-
after: ["drive personal notes list DOC_ID", "drive personal notes list DOC_ID text:review --limit 10"],
|
|
2901
|
-
reason: NOTES_REASON
|
|
2902
|
-
},
|
|
2903
|
-
{
|
|
2904
|
-
command: ["notes", "show"],
|
|
2905
|
-
field: "arguments",
|
|
2906
|
-
before: "ae549d47fb4ad5ab",
|
|
2907
|
-
after: [
|
|
2908
|
-
{
|
|
2909
|
-
name: "document",
|
|
2910
|
-
required: true,
|
|
2911
|
-
variadic: false,
|
|
2912
|
-
description: "Google file or folder id or URL in the local catalog, or a document:<n> ref"
|
|
2913
|
-
},
|
|
2914
|
-
{ name: "note", required: true, variadic: false, description: "note:<id> reference, as notes list prints it" }
|
|
2915
|
-
],
|
|
2916
|
-
reason: NOTES_REASON
|
|
2917
|
-
},
|
|
2918
|
-
{
|
|
2919
|
-
command: ["notes", "show"],
|
|
2920
|
-
field: "examples",
|
|
2921
|
-
before: "74234e98afe7498f",
|
|
2922
|
-
after: ["drive personal notes show DOC_ID note:NOTE_ID"],
|
|
2923
|
-
reason: NOTES_REASON
|
|
2924
|
-
},
|
|
2925
|
-
{
|
|
2926
|
-
command: ["notes", "edit"],
|
|
2927
|
-
field: "description",
|
|
2928
|
-
before: "e67289f2731a50ff",
|
|
2929
|
-
after: "replace a note's text",
|
|
2930
|
-
reason: NOTES_REASON
|
|
2931
|
-
},
|
|
2932
|
-
{
|
|
2933
|
-
command: ["notes", "edit"],
|
|
2934
|
-
field: "arguments",
|
|
2935
|
-
before: "c7d2686d3041bb14",
|
|
2936
|
-
after: [
|
|
2937
|
-
{
|
|
2938
|
-
name: "document",
|
|
2939
|
-
required: true,
|
|
2940
|
-
variadic: false,
|
|
2941
|
-
description: "Google file or folder id or URL in the local catalog, or a document:<n> ref"
|
|
2942
|
-
},
|
|
2943
|
-
{ name: "note", required: true, variadic: false, description: "note:<id> reference, as notes list prints it" },
|
|
2944
|
-
{ name: "text", required: true, variadic: false, description: "the note's new text" }
|
|
2945
|
-
],
|
|
2946
|
-
reason: NOTES_REASON
|
|
2947
|
-
},
|
|
2948
|
-
{
|
|
2949
|
-
command: ["notes", "edit"],
|
|
2950
|
-
field: "options",
|
|
2951
|
-
before: "4f53cda18c2baa0c",
|
|
2952
|
-
after: [
|
|
2953
|
-
{
|
|
2954
|
-
flags: "--revision <n>",
|
|
2955
|
-
description: "revision from notes show; a newer note is not overwritten",
|
|
2956
|
-
takes_value: true,
|
|
2957
|
-
mandatory: true
|
|
2958
|
-
}
|
|
2959
|
-
],
|
|
2960
|
-
reason: NOTES_REASON
|
|
2961
|
-
},
|
|
2962
|
-
{
|
|
2963
|
-
command: ["notes", "edit"],
|
|
2964
|
-
field: "examples",
|
|
2965
|
-
before: "74234e98afe7498f",
|
|
2966
|
-
after: ['drive personal notes edit DOC_ID note:NOTE_ID "Numbers checked" --revision 2'],
|
|
2967
|
-
reason: NOTES_REASON
|
|
2968
|
-
},
|
|
2969
|
-
{
|
|
2970
|
-
command: ["notes", "remove"],
|
|
2971
|
-
field: "description",
|
|
2972
|
-
before: "aa644f1603858b41",
|
|
2973
|
-
after: "delete one note",
|
|
2974
|
-
reason: NOTES_REASON
|
|
2975
|
-
},
|
|
2976
|
-
{
|
|
2977
|
-
command: ["notes", "remove"],
|
|
2978
|
-
field: "arguments",
|
|
2979
|
-
before: "ae549d47fb4ad5ab",
|
|
2980
|
-
after: [
|
|
2981
|
-
{
|
|
2982
|
-
name: "document",
|
|
2983
|
-
required: true,
|
|
2984
|
-
variadic: false,
|
|
2985
|
-
description: "Google file or folder id or URL in the local catalog, or a document:<n> ref"
|
|
2986
|
-
},
|
|
2987
|
-
{ name: "note", required: true, variadic: false, description: "note:<id> reference, as notes list prints it" }
|
|
2988
|
-
],
|
|
2989
|
-
reason: NOTES_REASON
|
|
2990
|
-
},
|
|
2991
|
-
{
|
|
2992
|
-
command: ["notes", "remove"],
|
|
2993
|
-
field: "examples",
|
|
2994
|
-
before: "74234e98afe7498f",
|
|
2995
|
-
after: ["drive personal notes remove DOC_ID note:NOTE_ID"],
|
|
2996
|
-
reason: NOTES_REASON
|
|
2997
|
-
}
|
|
2998
|
-
],
|
|
2999
3500
|
commands: [
|
|
3000
3501
|
{
|
|
3001
3502
|
command: ["commands"],
|
|
@@ -3032,79 +3533,6 @@ var SHELL_OVERRIDES = {
|
|
|
3032
3533
|
],
|
|
3033
3534
|
reason: "Drive binds discovery to its profile-aware usage renderer while retaining the shared command document and evidence endpoint."
|
|
3034
3535
|
}
|
|
3035
|
-
],
|
|
3036
|
-
search: [
|
|
3037
|
-
{
|
|
3038
|
-
command: ["search"],
|
|
3039
|
-
field: "summary",
|
|
3040
|
-
before: "d8f6dac5b4fe912b",
|
|
3041
|
-
after: null,
|
|
3042
|
-
reason: SEARCH_REASON
|
|
3043
|
-
},
|
|
3044
|
-
{
|
|
3045
|
-
command: ["search"],
|
|
3046
|
-
field: "description",
|
|
3047
|
-
before: "600ae3fd56e9ef36",
|
|
3048
|
-
after: "search imported documents by words, and by meaning when indexed",
|
|
3049
|
-
reason: SEARCH_REASON
|
|
3050
|
-
},
|
|
3051
|
-
{
|
|
3052
|
-
command: ["search"],
|
|
3053
|
-
field: "arguments",
|
|
3054
|
-
before: "4f53cda18c2baa0c",
|
|
3055
|
-
after: [
|
|
3056
|
-
{
|
|
3057
|
-
name: "query",
|
|
3058
|
-
required: true,
|
|
3059
|
-
variadic: false,
|
|
3060
|
-
description: "words to look for, and fields such as tag: and date: that every hit must match"
|
|
3061
|
-
}
|
|
3062
|
-
],
|
|
3063
|
-
reason: SEARCH_REASON
|
|
3064
|
-
},
|
|
3065
|
-
{
|
|
3066
|
-
command: ["search"],
|
|
3067
|
-
field: "options",
|
|
3068
|
-
before: "4f53cda18c2baa0c",
|
|
3069
|
-
after: [
|
|
3070
|
-
{
|
|
3071
|
-
flags: "--limit <n>",
|
|
3072
|
-
description: "how many results to return",
|
|
3073
|
-
takes_value: true,
|
|
3074
|
-
mandatory: false,
|
|
3075
|
-
default: 20
|
|
3076
|
-
},
|
|
3077
|
-
{ flags: "--page <n>", description: "which page to return", takes_value: true, mandatory: false, default: 1 },
|
|
3078
|
-
{
|
|
3079
|
-
flags: "--exact",
|
|
3080
|
-
description: "match the words exactly: no word forms, no meaning",
|
|
3081
|
-
takes_value: false,
|
|
3082
|
-
mandatory: false
|
|
3083
|
-
}
|
|
3084
|
-
],
|
|
3085
|
-
reason: SEARCH_REASON
|
|
3086
|
-
},
|
|
3087
|
-
{
|
|
3088
|
-
command: ["search"],
|
|
3089
|
-
field: "children",
|
|
3090
|
-
before: "595cc576273270f2",
|
|
3091
|
-
after: [],
|
|
3092
|
-
reason: SEARCH_REASON
|
|
3093
|
-
},
|
|
3094
|
-
{
|
|
3095
|
-
command: ["search"],
|
|
3096
|
-
field: "effects",
|
|
3097
|
-
before: "74234e98afe7498f",
|
|
3098
|
-
after: { remote: "none", local: "read" },
|
|
3099
|
-
reason: SEARCH_REASON
|
|
3100
|
-
},
|
|
3101
|
-
{
|
|
3102
|
-
command: ["search"],
|
|
3103
|
-
field: "examples",
|
|
3104
|
-
before: "74234e98afe7498f",
|
|
3105
|
-
after: ["drive personal search budget", 'drive personal search "quarterly plan" --exact --limit 5'],
|
|
3106
|
-
reason: SEARCH_REASON
|
|
3107
|
-
}
|
|
3108
3536
|
]
|
|
3109
3537
|
};
|
|
3110
3538
|
|
|
@@ -3140,46 +3568,6 @@ var installCommandsCommand = /* @__PURE__ */ __name((...args) => {
|
|
|
3140
3568
|
}, reviewedOverrides(reference, SHELL_OVERRIDES.commands));
|
|
3141
3569
|
}, "installCommandsCommand");
|
|
3142
3570
|
|
|
3143
|
-
// dist/commands/documents.js
|
|
3144
|
-
import { writeFileSync } from "node:fs";
|
|
3145
|
-
|
|
3146
|
-
// dist/age.js
|
|
3147
|
-
var DAY = 24 * 60 * 60 * 1e3;
|
|
3148
|
-
var SYNC = defineSteps([
|
|
3149
|
-
{ id: "sync.run", command: "sync", args: [], why: "copy the changes Google has made into the local store" }
|
|
3150
|
-
])[0];
|
|
3151
|
-
var ageOf = /* @__PURE__ */ __name((state, now = Date.now()) => {
|
|
3152
|
-
const at = state.lastSync ? Date.parse(state.lastSync) : Number.NaN;
|
|
3153
|
-
return Number.isNaN(at) ? { synced_at: null, age_days: null } : { synced_at: state.lastSync ?? null, age_days: Math.max(0, Math.floor((now - at) / DAY)) };
|
|
3154
|
-
}, "ageOf");
|
|
3155
|
-
var staleCopy = /* @__PURE__ */ __name((state, now = Date.now()) => {
|
|
3156
|
-
const { synced_at, age_days } = ageOf(state, now);
|
|
3157
|
-
const old = synced_at === null || now - Date.parse(synced_at) > DAY;
|
|
3158
|
-
if (!old)
|
|
3159
|
-
return {};
|
|
3160
|
-
const why = age_days === null ? "the local copy has no sync time; Google may have changed the document since it was copied" : `the local copy was synced ${age_days} day${age_days === 1 ? "" : "s"} ago; Google may have changed the document since`;
|
|
3161
|
-
return {
|
|
3162
|
-
missing: [{ field: "synced_at", why, step: SYNC.id }],
|
|
3163
|
-
next: [stepOf(SYNC)],
|
|
3164
|
-
meta: { complete: false }
|
|
3165
|
-
};
|
|
3166
|
-
}, "staleCopy");
|
|
3167
|
-
var freshness = /* @__PURE__ */ __name((remote, local2) => ({
|
|
3168
|
-
changed: local2 === void 0 || Date.parse(remote) !== Date.parse(local2),
|
|
3169
|
-
remote_modified_at: remote,
|
|
3170
|
-
local_modified_at: local2 ?? null
|
|
3171
|
-
}), "freshness");
|
|
3172
|
-
var changedCopy = /* @__PURE__ */ __name(({ changed, local_modified_at }) => {
|
|
3173
|
-
if (!changed)
|
|
3174
|
-
return {};
|
|
3175
|
-
const why = local_modified_at === null ? "the local copy has no modified time, so it cannot be compared with Google" : `Google changed the document after the local copy was made (${local_modified_at})`;
|
|
3176
|
-
return {
|
|
3177
|
-
missing: [{ field: "modified_at", why, step: SYNC.id }],
|
|
3178
|
-
next: [stepOf(SYNC)],
|
|
3179
|
-
meta: { complete: false }
|
|
3180
|
-
};
|
|
3181
|
-
}, "changedCopy");
|
|
3182
|
-
|
|
3183
3571
|
// dist/documents-add.js
|
|
3184
3572
|
var PASSES_ON = /* @__PURE__ */ new Set(["not_found", "permission_error", "authentication_error"]);
|
|
3185
3573
|
var HOW = "drive <profile> documents add <url>, or --profiles <a,b|all>";
|
|
@@ -3313,64 +3701,34 @@ var addProfilesOf = /* @__PURE__ */ __name((env, command, word) => profilesToAdd
|
|
|
3313
3701
|
chosen: env.DRIVE_PROFILE || void 0,
|
|
3314
3702
|
lock: env.DRIVE_PROFILE_LOCK || void 0
|
|
3315
3703
|
}), "addProfilesOf");
|
|
3316
|
-
var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
|
|
3317
|
-
const { env, selected, output, withIndex, source, profileWord } = context;
|
|
3318
|
-
const imported = importedDocument(context);
|
|
3319
|
-
const documents =
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
has_more: found.hasMore,
|
|
3345
|
-
page,
|
|
3346
|
-
args: { query: query || void 0 }
|
|
3347
|
-
}));
|
|
3348
|
-
});
|
|
3349
|
-
examples(annotate(documents.command("show"), { effects: LOCAL_READ, partial: true }).argument("<document>", documentArgument).description("show an imported document's text, tabs and metadata"), ["drive personal documents show DOC_ID", "drive personal documents show document:42 --offline"]).action((input) => {
|
|
3350
|
-
const { snapshot } = imported(input);
|
|
3351
|
-
const state = readState(env, selected(), activeProfile(env, selected()).principal);
|
|
3352
|
-
output(itemOf({
|
|
3353
|
-
metadata: metadataJson(snapshot.metadata),
|
|
3354
|
-
...ageOf(state),
|
|
3355
|
-
text: snapshot.text,
|
|
3356
|
-
tabs: snapshot.tabs,
|
|
3357
|
-
...snapshot.notRead ? { not_read: snapshot.notRead } : {}
|
|
3358
|
-
}, staleCopy(state)));
|
|
3359
|
-
});
|
|
3360
|
-
examples(annotate(documents.command("export"), { effects: LOCAL_WRITE, partial: true }).argument("<document>", documentArgument).description("write an imported document to a new Markdown file"), ["drive personal documents export DOC_ID --output notes.md"]).requiredOption("--output <file>", "path of the Markdown file to write; an existing file is refused").action((input, args) => {
|
|
3361
|
-
const { id, snapshot } = imported(input);
|
|
3362
|
-
try {
|
|
3363
|
-
writeFileSync(args.output, snapshot.markdown, { flag: "wx", mode: 384 });
|
|
3364
|
-
} catch (error) {
|
|
3365
|
-
if (error.code === "EEXIST")
|
|
3366
|
-
throw new CliError("validation_error", "the output file already exists; choose another --output", {
|
|
3367
|
-
reason: "export.exists",
|
|
3368
|
-
param: "--output"
|
|
3369
|
-
});
|
|
3370
|
-
throw error;
|
|
3371
|
-
}
|
|
3372
|
-
const state = readState(env, selected(), activeProfile(env, selected()).principal);
|
|
3373
|
-
output(itemOf({ id, path: args.output, format: "markdown", ...ageOf(state) }, staleCopy(state)));
|
|
3704
|
+
var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
|
|
3705
|
+
const { env, selected, output, withIndex, source, profileWord } = context;
|
|
3706
|
+
const imported = importedDocument(context);
|
|
3707
|
+
const documents = addLocalDocumentCommands(program, {
|
|
3708
|
+
words: DRIVE_WORDS,
|
|
3709
|
+
output,
|
|
3710
|
+
list: /* @__PURE__ */ __name(async (query, page) => {
|
|
3711
|
+
const profile = activeProfile(env, selected());
|
|
3712
|
+
const found = await withIndex(async (index) => {
|
|
3713
|
+
if (!index.knowledge)
|
|
3714
|
+
throw new CliError("configuration_error", "index has no shared knowledge adapter");
|
|
3715
|
+
return index.knowledge.documents(profile.principal, query, page);
|
|
3716
|
+
});
|
|
3717
|
+
const state = readState(env, selected(), profile.principal);
|
|
3718
|
+
return {
|
|
3719
|
+
items: found.items.map((note2) => {
|
|
3720
|
+
const id = (note2.path ?? "").replace(/\.md$/, "");
|
|
3721
|
+
const doc = state.documents[id];
|
|
3722
|
+
return doc ? { ...metadataJson(doc.metadata), reference: doc.reference, tabs: doc.tabs } : { id, name: note2.title, reference: note2.ref, tabs: 0 };
|
|
3723
|
+
}),
|
|
3724
|
+
hasMore: found.hasMore
|
|
3725
|
+
};
|
|
3726
|
+
}, "list"),
|
|
3727
|
+
document: /* @__PURE__ */ __name((input) => {
|
|
3728
|
+
const { id, snapshot } = imported(input);
|
|
3729
|
+
return { id, metadata: metadataJson(snapshot.metadata), snapshot };
|
|
3730
|
+
}, "document"),
|
|
3731
|
+
lastSync: /* @__PURE__ */ __name(() => readState(env, selected(), activeProfile(env, selected()).principal).lastSync, "lastSync")
|
|
3374
3732
|
});
|
|
3375
3733
|
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"), [
|
|
3376
3734
|
"drive documents add https://docs.google.com/document/d/DOC_ID/edit --profiles work,personal",
|
|
@@ -3485,350 +3843,101 @@ var listed = /* @__PURE__ */ __name((items, incomplete) => listOf("", {
|
|
|
3485
3843
|
var roots = /* @__PURE__ */ __name(async (call, added) => {
|
|
3486
3844
|
const myDrive = await call("drive.files.get", { fileId: "root", fields: "id" }) ?? {};
|
|
3487
3845
|
if (!myDrive.id)
|
|
3488
|
-
throw new CliError("invalid_response", "Google did not return the My Drive folder");
|
|
3489
|
-
const { rows: drives } = await everyPage(call, "drive.drives.list", { pageSize: 100, fields: "nextPageToken,drives(id,name)" }, "drives");
|
|
3490
|
-
const shared = drives.flatMap((drive) => drive.id ? [{ id: drive.id, name: drive.name ?? "" }] : []);
|
|
3491
|
-
const counts = await childCounts(call, [myDrive.id, ...shared.map((drive) => drive.id)]);
|
|
3492
|
-
const top = /* @__PURE__ */ __name((id, name, kind) => ({
|
|
3493
|
-
id,
|
|
3494
|
-
name,
|
|
3495
|
-
kind,
|
|
3496
|
-
parent: null,
|
|
3497
|
-
location: kind,
|
|
3498
|
-
drive_id: kind === "shared_drive" ? id : null,
|
|
3499
|
-
child_folders: kind === "shared_with_me" ? null : counts?.get(id) ?? null,
|
|
3500
|
-
added: added(id) || kind === "my_drive" && added("root")
|
|
3501
|
-
}), "top");
|
|
3502
|
-
return listed([
|
|
3503
|
-
top(myDrive.id, "My Drive", "my_drive"),
|
|
3504
|
-
top(SHARED_WITH_ME, "Shared with me", "shared_with_me"),
|
|
3505
|
-
...shared.map((drive) => top(drive.id, drive.name, "shared_drive")).sort(byName)
|
|
3506
|
-
], false);
|
|
3507
|
-
}, "roots");
|
|
3508
|
-
var browseFolders = /* @__PURE__ */ __name(async (call, parent, selected) => {
|
|
3509
|
-
const added = /* @__PURE__ */ __name((id) => selected.includes(id), "added");
|
|
3510
|
-
if (parent === void 0)
|
|
3511
|
-
return roots(call, added);
|
|
3512
|
-
const { rows, incomplete } = await everyPage(call, "drive.files.list", {
|
|
3513
|
-
q: parent === SHARED_WITH_ME ? `sharedWithMe = true and ${NOT_TRASHED_FOLDER}` : `'${parent}' in parents and ${NOT_TRASHED_FOLDER}`,
|
|
3514
|
-
fields: "nextPageToken,incompleteSearch,files(id,name,driveId,ownedByMe)",
|
|
3515
|
-
pageSize: 1e3,
|
|
3516
|
-
...ACROSS_DRIVES
|
|
3517
|
-
}, "files");
|
|
3518
|
-
const folders = rows.filter((row) => Boolean(row.id));
|
|
3519
|
-
const counts = await childCounts(call, folders.map((folder) => folder.id));
|
|
3520
|
-
const items = folders.map((folder) => ({
|
|
3521
|
-
id: folder.id,
|
|
3522
|
-
name: folder.name ?? "",
|
|
3523
|
-
kind: "folder",
|
|
3524
|
-
parent,
|
|
3525
|
-
location: folder.driveId ? "shared_drive" : folder.ownedByMe === false ? "shared_with_me" : "my_drive",
|
|
3526
|
-
drive_id: folder.driveId ?? null,
|
|
3527
|
-
child_folders: counts?.get(folder.id) ?? null,
|
|
3528
|
-
added: added(folder.id)
|
|
3529
|
-
}));
|
|
3530
|
-
return listed(items.sort(byName), incomplete);
|
|
3531
|
-
}, "browseFolders");
|
|
3532
|
-
|
|
3533
|
-
// dist/commands/folders.js
|
|
3534
|
-
var installFolderCommands = /* @__PURE__ */ __name((program, context, call) => {
|
|
3535
|
-
const { env, selected, output, source } = context;
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
profile.roots.
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
}, "installFolderCommands");
|
|
3576
|
-
|
|
3577
|
-
// dist/knowledge-query.js
|
|
3578
|
-
var FACT_QUERY = {
|
|
3579
|
-
entity: "fact",
|
|
3580
|
-
backend: "native",
|
|
3581
|
-
fields: [
|
|
3582
|
-
termField("kind", "enum", "kind:decision", { values: FACT_TYPES }),
|
|
3583
|
-
termField("status", "enum", "status:proposed", { values: FACT_STATUSES })
|
|
3584
|
-
]
|
|
3585
|
-
};
|
|
3586
|
-
var MEMORY_QUERY = {
|
|
3587
|
-
entity: "memory",
|
|
3588
|
-
backend: "native",
|
|
3589
|
-
fields: [
|
|
3590
|
-
termField("kind", "enum", "kind:preference", { values: MEMORY_KINDS }),
|
|
3591
|
-
termField("status", "enum", "status:proposed", { values: MEMORY_STATUSES }),
|
|
3592
|
-
termField("scope", "enum", "scope:work", { values: MEMORY_SCOPES })
|
|
3593
|
-
]
|
|
3594
|
-
};
|
|
3595
|
-
var MEMORY_SEARCH_QUERY = {
|
|
3596
|
-
entity: "memory",
|
|
3597
|
-
backend: "native",
|
|
3598
|
-
fields: [
|
|
3599
|
-
nativeField({
|
|
3600
|
-
name: "text",
|
|
3601
|
-
type: "txt",
|
|
3602
|
-
operators: ["term", "phrase"],
|
|
3603
|
-
example: "text:reviews",
|
|
3604
|
-
relation: "words of the memory; a bare word means the same"
|
|
3605
|
-
}),
|
|
3606
|
-
termField("scope", "enum", "scope:work", { values: MEMORY_SCOPES })
|
|
3607
|
-
]
|
|
3608
|
-
};
|
|
3609
|
-
var factItem = /* @__PURE__ */ __name(({ type, statement, source, confirmedBy, ...fact }) => ({
|
|
3610
|
-
ref: fact.ref,
|
|
3611
|
-
id: fact.id,
|
|
3612
|
-
kind: type,
|
|
3613
|
-
text: statement,
|
|
3614
|
-
status: fact.status,
|
|
3615
|
-
project: fact.project,
|
|
3616
|
-
subject: fact.subject,
|
|
3617
|
-
occurred_at: fact.occurredAt,
|
|
3618
|
-
supersedes: fact.supersedes,
|
|
3619
|
-
author: fact.author,
|
|
3620
|
-
model: fact.model,
|
|
3621
|
-
confirmed_by: confirmedBy,
|
|
3622
|
-
scope: fact.scope,
|
|
3623
|
-
origin: source,
|
|
3624
|
-
evidence: fact.evidence,
|
|
3625
|
-
created_at: fact.createdAt,
|
|
3626
|
-
updated_at: fact.updatedAt
|
|
3627
|
-
}), "factItem");
|
|
3628
|
-
var memoryItem = /* @__PURE__ */ __name(({ body, ...memory }) => ({
|
|
3629
|
-
ref: memory.ref,
|
|
3630
|
-
id: memory.id,
|
|
3631
|
-
kind: memory.kind,
|
|
3632
|
-
text: body,
|
|
3633
|
-
subject: memory.subject,
|
|
3634
|
-
author: memory.author,
|
|
3635
|
-
model: memory.model,
|
|
3636
|
-
confidence: memory.confidence,
|
|
3637
|
-
status: memory.status,
|
|
3638
|
-
scope: memory.scope,
|
|
3639
|
-
supersedes: memory.supersedes,
|
|
3640
|
-
evidence: memory.evidence,
|
|
3641
|
-
last_verified_at: memory.lastVerifiedAt,
|
|
3642
|
-
created_at: memory.createdAt,
|
|
3643
|
-
updated_at: memory.updatedAt
|
|
3644
|
-
}), "memoryItem");
|
|
3645
|
-
var memorySearch = /* @__PURE__ */ __name((words) => {
|
|
3646
|
-
const command = "memories search";
|
|
3647
|
-
const context = { command, guide: LIST_QUERY_GUIDE };
|
|
3648
|
-
const ast = validateQuery(parseLucene(typedQuery(words), { defaultField: "text", ...context }), MEMORY_SEARCH_QUERY, context);
|
|
3649
|
-
const text = [];
|
|
3650
|
-
let scope;
|
|
3651
|
-
const add = /* @__PURE__ */ __name((node) => {
|
|
3652
|
-
if (node.kind === "boolean") {
|
|
3653
|
-
for (const clause of node.clauses) {
|
|
3654
|
-
if (clause.occur !== "must")
|
|
3655
|
-
queryError("query.unsupported-placement", clause.node.span, "this search joins its terms by AND", context);
|
|
3656
|
-
add(clause.node);
|
|
3657
|
-
}
|
|
3658
|
-
return;
|
|
3659
|
-
}
|
|
3660
|
-
if (node.field === "text")
|
|
3661
|
-
text.push(node.value);
|
|
3662
|
-
else if (scope !== void 0)
|
|
3663
|
-
queryError("query.unsupported-placement", node.span, "scope only once here", context);
|
|
3664
|
-
else
|
|
3665
|
-
scope = node.value.toLowerCase();
|
|
3666
|
-
}, "add");
|
|
3667
|
-
add(ast.root);
|
|
3668
|
-
if (text.length === 0)
|
|
3669
|
-
queryError("query.missing-value", ast.root.span, "say which words to look for beside scope:", context);
|
|
3670
|
-
return { text: text.join(" "), ...scope === void 0 ? {} : { scope } };
|
|
3671
|
-
}, "memorySearch");
|
|
3672
|
-
|
|
3673
|
-
// dist/commands/knowledge.js
|
|
3674
|
-
var installKnowledgeCommandsDefinition = /* @__PURE__ */ __name((program, helpers) => {
|
|
3675
|
-
const { run: run3, output, positive: positive2, author, decider } = helpers;
|
|
3676
|
-
const documentArgument = "Google file or folder id or URL in the local catalog, or a document:<n> ref";
|
|
3677
|
-
const scopes = ["personal", "work"];
|
|
3678
|
-
const documents = program.commands.find((command) => command.name() === "documents");
|
|
3679
|
-
examples(annotate(documents.command("context"), { effects: LOCAL_READ }).argument("<document>", documentArgument).description("show a document with its tags, relationships, notes, memories and editors"), ["drive personal documents context DOC_ID"]).action(async (doc) => output(itemOf(await run3(doc, (k, p, ref) => k.context(p, ref)))));
|
|
3680
|
-
const tags = annotate(program.command("tags"), { effects: LOCAL_READ }).description("label imported documents; labels survive a sync");
|
|
3681
|
-
for (const action of ["list", "add", "remove"]) {
|
|
3682
|
-
const command = examples(annotate(tags.command(action), { effects: action === "list" ? LOCAL_READ : LOCAL_WRITE }).description(action === "list" ? "list a document's tags" : action === "add" ? "tag a document" : "untag a document").argument("<document>", documentArgument), [`drive personal tags ${action} DOC_ID${action === "list" ? "" : " budget q3"}`]);
|
|
3683
|
-
if (action === "list") {
|
|
3684
|
-
bindQuery(command, TAGS_QUERY, tagRow).action(async (doc, words) => {
|
|
3685
|
-
const filter = termsOf(words, TAGS_QUERY, "tags list");
|
|
3686
|
-
output(allOf((await run3(doc, (k, p, ref) => k.tags(p, ref, "list", [], filter))).map((tag) => ({ tag }))));
|
|
3687
|
-
});
|
|
3688
|
-
} else
|
|
3689
|
-
command.argument("<tags...>", "one or more tags").action(async (doc, values2) => output(itemOf({ tags: await run3(doc, (k, p, ref) => k.tags(p, ref, action, values2)) })));
|
|
3690
|
-
}
|
|
3691
|
-
const relationships = annotate(program.command("relationships"), { effects: LOCAL_READ }).description("connect a document to people, projects, notes and other references");
|
|
3692
|
-
bindQuery(examples(annotate(relationships.command("list"), { effects: LOCAL_READ }).description("list a document's relationships"), ["drive personal relationships list DOC_ID"]).argument("<document>", documentArgument), LINKS_QUERY, linkRow).action(async (doc, words) => {
|
|
3693
|
-
const { confirmed, ...filter } = termsOf(words, LINKS_QUERY, "relationships list");
|
|
3694
|
-
output(allOf(await run3(doc, (k, p, ref) => k.links(p, ref, { ...filter, ...confirmed === void 0 ? {} : { confirmed: confirmed === "true" } }))));
|
|
3695
|
-
});
|
|
3696
|
-
examples(annotate(relationships.command("add"), { effects: LOCAL_WRITE }).description("connect a document to another reference"), [
|
|
3697
|
-
"drive personal relationships add DOC_ID project:PROJECT_ID --kind about",
|
|
3698
|
-
"drive personal relationships add DOC_ID person:PERSON_UID --kind assigned-to --role reviewer"
|
|
3699
|
-
]).argument("<document>", documentArgument).argument("<reference>", "what it connects to, such as person:<uid>, project:<id> or note:<id>").addOption(new Option("--kind <kind>", "how the two relate").choices(["links-to", "about", "evidence", "created-from", "related-to", "assigned-to"]).default("related-to")).option("--role <role>", "the part the reference plays, in a word or two").option("--reason <text>", "why the two are connected").action(async (doc, to, { reason, ...args }) => output(itemOf(await run3(doc, (k, p, ref) => k.addLink(p, ref, { to, ...args, by: decider(), ...reason ? { evidence: reason } : {} })))));
|
|
3700
|
-
examples(annotate(relationships.command("remove"), { effects: LOCAL_WRITE }).description("remove one of a document's relationships"), ["drive personal relationships remove DOC_ID LINK_ID"]).argument("<document>", documentArgument).argument("<relationship-id>", "id, as relationships list prints it").action(async (doc, id) => output(itemOf(await run3(doc, (k, p, ref) => k.removeLink(p, ref, id, decider())))));
|
|
3701
|
-
const notes = annotate(program.command("notes"), { effects: LOCAL_READ }).description("write notes about an imported document");
|
|
3702
|
-
const noteArgument = "note:<id> reference, as notes list prints it";
|
|
3703
|
-
examples(annotate(notes.command("add"), {
|
|
3704
|
-
effects: LOCAL_WRITE,
|
|
3705
|
-
output: { entity: "note" },
|
|
3706
|
-
literal_after_dashes: true
|
|
3707
|
-
}).description("write a note about a document"), [`drive personal notes add DOC_ID "Check the numbers" --title Review`]).argument("<document>", documentArgument).argument("<text>", "the note's text").option("--title <title>", "a title for the note").action(async (doc, text, args) => output(itemOf(await run3(doc, (k, p, ref) => k.addNote(p, ref, text, args.title)))));
|
|
3708
|
-
withQuery(examples(annotate(notes.command("list"), { effects: LOCAL_READ }).description("list a document's notes"), [
|
|
3709
|
-
"drive personal notes list DOC_ID",
|
|
3710
|
-
"drive personal notes list DOC_ID text:review --limit 10"
|
|
3711
|
-
]).argument("<document>", documentArgument), NOTES_QUERY).option("--limit <n>", "how many notes to return", positive2, 50).option("--page <n>", "which page to return", positive2, 1).action(async (doc, words, { page, limit }) => {
|
|
3712
|
-
const query = termsOf(words, NOTES_QUERY, "notes list").text;
|
|
3713
|
-
const found = await run3(doc, (k, p, ref) => k.notes(p, ref, { ...query ? { search: query } : {}, limit, offset: (page - 1) * limit }));
|
|
3714
|
-
output(listOf("notes list", {
|
|
3715
|
-
items: found.items,
|
|
3716
|
-
limit,
|
|
3717
|
-
has_more: found.hasMore,
|
|
3718
|
-
page,
|
|
3719
|
-
args: { document: doc, query: words.join(" ") }
|
|
3720
|
-
}));
|
|
3721
|
-
});
|
|
3722
|
-
examples(annotate(notes.command("show"), { effects: LOCAL_READ, output: { entity: "note" } }).description("show one note"), ["drive personal notes show DOC_ID note:NOTE_ID"]).argument("<document>", documentArgument).argument("<note>", noteArgument).action(async (doc, noteRef) => output(itemOf(await run3(doc, (k, p, ref) => k.note(p, ref, noteRef)))));
|
|
3723
|
-
examples(annotate(notes.command("edit"), {
|
|
3724
|
-
effects: LOCAL_WRITE,
|
|
3725
|
-
output: { entity: "note" },
|
|
3726
|
-
literal_after_dashes: true
|
|
3727
|
-
}).description("replace a note's text"), [`drive personal notes edit DOC_ID note:NOTE_ID "Numbers checked" --revision 2`]).argument("<document>", documentArgument).argument("<note>", noteArgument).argument("<text>", "the note's new text").requiredOption("--revision <n>", "revision from notes show; a newer note is not overwritten", positive2).action(async (doc, noteRef, text, args) => output(itemOf(await run3(doc, (k, p, ref) => k.editNote(p, ref, noteRef, text, args.revision)))));
|
|
3728
|
-
examples(annotate(notes.command("remove"), { effects: LOCAL_WRITE }).description("delete one note"), [
|
|
3729
|
-
"drive personal notes remove DOC_ID note:NOTE_ID"
|
|
3730
|
-
]).argument("<document>", documentArgument).argument("<note>", noteArgument).action(async (doc, noteRef) => output(itemOf(await run3(doc, (k, p, ref) => k.removeNote(p, ref, noteRef)))));
|
|
3731
|
-
const memories = annotate(program.command("memories"), { effects: LOCAL_READ }).description("keep what was learned from a document, with evidence; an agent's stay proposed");
|
|
3732
|
-
const memoryArgument = "memory:<id> reference, as memories list prints it";
|
|
3733
|
-
const scope = /* @__PURE__ */ __name((description) => new Option("--scope <scope>", description).choices(scopes), "scope");
|
|
3734
|
-
examples(annotate(memories.command("add"), { effects: LOCAL_WRITE }).description("record a memory about a document"), [`drive personal memories add DOC_ID "The team prefers async reviews" --scope work --kind preference`]).argument("<document>", documentArgument).argument("<text>", "what to remember").addOption(scope("whose memory it is: personal or work").makeOptionMandatory()).addOption(new Option("--kind <kind>", "what kind of memory it is").choices(MEMORY_KINDS).default("summary")).option("--supersedes <ref>", "a memory:<id> about the same document that this one replaces").action(async (doc, body, args) => output(itemOf(memoryItem(await run3(doc, (k, p, ref) => k.addMemory(p, ref, { body, ...args, status: "proposed", author: author() }))))));
|
|
3735
|
-
withQuery(examples(annotate(memories.command("list"), { effects: LOCAL_READ }).description("list a document's memories"), [
|
|
3736
|
-
"drive personal memories list DOC_ID scope:work",
|
|
3737
|
-
"drive personal memories list DOC_ID kind:preference status:confirmed"
|
|
3738
|
-
]).argument("<document>", documentArgument), MEMORY_QUERY).option("--limit <n>", "how many memories to return", positive2, 50).action(async (doc, words, { limit }) => {
|
|
3739
|
-
const terms = queryTerms(words, MEMORY_QUERY, "memories list");
|
|
3740
|
-
const filters = {
|
|
3741
|
-
...terms.has("kind") ? { kind: terms.get("kind") } : {},
|
|
3742
|
-
...terms.has("status") ? { status: terms.get("status") } : {},
|
|
3743
|
-
...terms.has("scope") ? { scope: terms.get("scope") } : {}
|
|
3744
|
-
};
|
|
3745
|
-
output(allOf((await run3(doc, (k, p, ref) => k.memories(p, ref, { ...filters, limit }))).items.map(memoryItem)));
|
|
3746
|
-
});
|
|
3747
|
-
const memoryActions = {
|
|
3748
|
-
show: "show one memory",
|
|
3749
|
-
confirm: "confirm a proposed memory as true",
|
|
3750
|
-
stale: "mark a memory as out of date"
|
|
3751
|
-
};
|
|
3752
|
-
for (const [action, description] of Object.entries(memoryActions))
|
|
3753
|
-
examples(annotate(memories.command(action), { effects: action === "show" ? LOCAL_READ : LOCAL_WRITE }).description(description), [`drive personal memories ${action} DOC_ID memory:MEMORY_ID`]).argument("<document>", documentArgument).argument("<memory>", memoryArgument).action(async (doc, memoryRef) => output(itemOf(memoryItem(await run3(doc, (k, p, ref) => action === "show" ? k.memory(p, ref, memoryRef) : k.memory(p, ref, memoryRef, action, decider()))))));
|
|
3754
|
-
const search = examples(annotate(memories.command("search"), { effects: LOCAL_READ }).description("search a document's memories by words"), [
|
|
3755
|
-
"drive personal memories search DOC_ID reviews scope:work",
|
|
3756
|
-
`drive personal memories search DOC_ID "async reviews"`
|
|
3757
|
-
]).argument("<document>", documentArgument).argument("<query...>", "words to look for, and scope:personal or scope:work \u2014 the fields are below").allowUnknownOption().addHelpText("after", queryHelp(MEMORY_SEARCH_QUERY)).action(async (doc, words) => {
|
|
3758
|
-
const { text, scope: scope2 } = memorySearch(words);
|
|
3759
|
-
const found = await run3(doc, (k, p, ref) => k.searchMemories(p, ref, text, scope2));
|
|
3760
|
-
output({
|
|
3761
|
-
...allOf(found.items.map(memoryItem)),
|
|
3762
|
-
...found.hasMore ? { meta: { truncated: true } } : {}
|
|
3763
|
-
});
|
|
3764
|
-
});
|
|
3765
|
-
annotate(search, { query: defineQuery(MEMORY_SEARCH_QUERY), output: { entity: "memory" } });
|
|
3766
|
-
examples(annotate(memories.command("extract"), { effects: REMOTE_WRITE }).argument("<document>", documentArgument).description("send a document's text to the model and show the memories it proposes"), [
|
|
3767
|
-
"drive personal memories extract DOC_ID --scope work",
|
|
3768
|
-
"drive personal memories extract DOC_ID --scope work --yes"
|
|
3769
|
-
]).addOption(scope("whose memories they become: personal or work").makeOptionMandatory()).option("--tab <id>", "send only this tab of the document").option("--yes", "save the proposals, each with its quote and the document's version").action(async function(doc) {
|
|
3770
|
-
const args = this.optsWithGlobals();
|
|
3771
|
-
await run3(doc, async () => void 0);
|
|
3772
|
-
const result = await extractDocumentMemories({
|
|
3773
|
-
read: /* @__PURE__ */ __name(() => helpers.document(doc), "read"),
|
|
3774
|
-
complete: helpers.complete(),
|
|
3775
|
-
scope: args.scope,
|
|
3776
|
-
author: "drive-memory",
|
|
3777
|
-
tab: args.tab,
|
|
3778
|
-
save: args.yes,
|
|
3779
|
-
withWrite: /* @__PURE__ */ __name((write) => run3(doc, write), "withWrite")
|
|
3780
|
-
});
|
|
3781
|
-
output(itemOf({ ...result, saved: result.saved.map((item) => "type" in item ? factItem(item) : memoryItem(item)) }));
|
|
3782
|
-
});
|
|
3783
|
-
const facts = annotate(program.command("facts"), { effects: LOCAL_READ }).description("what happened, as a document shows it; an agent's stay proposed until confirmed");
|
|
3784
|
-
const factArgument = "fact:<id> reference, as facts list prints it";
|
|
3785
|
-
examples(annotate(facts.command("add"), { effects: LOCAL_WRITE }).description("record a fact a document shows"), [
|
|
3786
|
-
`drive personal facts add DOC_ID "Budget approved" --type decision --scope work`
|
|
3787
|
-
]).argument("<document>", documentArgument).argument("<statement>", "the fact, in one sentence").addOption(new Option("--type <type>", "what kind of fact it is").choices(FACT_TYPES).default("fact")).addOption(scope("whose fact it is: personal or work")).option("--supersedes <ref>", "a decision only: the decision this one replaces").option("--occurred-time <time>", "when it happened, as the evidence shows, ISO 8601; a time without a zone is read in this computer's zone, a date alone as its midnight").action(async (doc, statement, { occurredTime, ...args }) => output(itemOf(factItem(await run3(doc, (k, p, ref) => k.addFact(p, ref, {
|
|
3788
|
-
statement,
|
|
3789
|
-
...args,
|
|
3790
|
-
by: author(),
|
|
3791
|
-
...occurredTime === void 0 ? {} : { occurredAt: occurredTime }
|
|
3792
|
-
}))))));
|
|
3793
|
-
withQuery(examples(annotate(facts.command("list"), { effects: LOCAL_READ }).description("list a document's facts"), [
|
|
3794
|
-
"drive personal facts list DOC_ID status:proposed",
|
|
3795
|
-
"drive personal facts list DOC_ID kind:decision"
|
|
3796
|
-
]).argument("<document>", documentArgument), FACT_QUERY).option("--limit <n>", "how many facts to return", positive2, 50).action(async (doc, words, { limit }) => {
|
|
3797
|
-
const terms = queryTerms(words, FACT_QUERY, "facts list");
|
|
3798
|
-
const filters = {
|
|
3799
|
-
...terms.has("kind") ? { type: terms.get("kind") } : {},
|
|
3800
|
-
...terms.has("status") ? { status: terms.get("status") } : {}
|
|
3801
|
-
};
|
|
3802
|
-
output(allOf((await run3(doc, (k, p, ref) => k.facts(p, ref, { ...filters, limit }))).items.map(factItem)));
|
|
3803
|
-
});
|
|
3804
|
-
const factActions = {
|
|
3805
|
-
show: "show one fact",
|
|
3806
|
-
confirm: "confirm a proposed fact; a decision it supersedes stops holding",
|
|
3807
|
-
reverse: "an accepted decision no longer holds, and nothing replaced it"
|
|
3808
|
-
};
|
|
3809
|
-
for (const [action, description] of Object.entries(factActions))
|
|
3810
|
-
examples(annotate(facts.command(action), { effects: action === "show" ? LOCAL_READ : LOCAL_WRITE }).description(description), [`drive personal facts ${action} DOC_ID fact:FACT_ID`]).argument("<document>", documentArgument).argument("<fact>", factArgument).action(async (doc, factRef) => output(itemOf(factItem(await run3(doc, (k, p, ref) => action === "show" ? k.fact(p, ref, factRef) : k.fact(p, ref, factRef, action, decider()))))));
|
|
3811
|
-
const identities = annotate(program.command("identities"), { effects: LOCAL_READ }).description("the Google accounts seen on a document, and the people they belong to");
|
|
3812
|
-
bindQuery(examples(annotate(identities.command("list"), { effects: LOCAL_READ }).description("list the owners and last editor Google shows for a document"), ["drive personal identities list DOC_ID"]).argument("<document>", documentArgument), IDENTITIES_QUERY, identityRow).action(async (doc, words) => {
|
|
3813
|
-
const filter = termsOf(words, IDENTITIES_QUERY, "identities list");
|
|
3814
|
-
output(itemOf(await run3(doc, (k, p, ref) => k.people(p, ref, filter))));
|
|
3846
|
+
throw new CliError("invalid_response", "Google did not return the My Drive folder");
|
|
3847
|
+
const { rows: drives } = await everyPage(call, "drive.drives.list", { pageSize: 100, fields: "nextPageToken,drives(id,name)" }, "drives");
|
|
3848
|
+
const shared = drives.flatMap((drive) => drive.id ? [{ id: drive.id, name: drive.name ?? "" }] : []);
|
|
3849
|
+
const counts = await childCounts(call, [myDrive.id, ...shared.map((drive) => drive.id)]);
|
|
3850
|
+
const top = /* @__PURE__ */ __name((id, name, kind) => ({
|
|
3851
|
+
id,
|
|
3852
|
+
name,
|
|
3853
|
+
kind,
|
|
3854
|
+
parent: null,
|
|
3855
|
+
location: kind,
|
|
3856
|
+
drive_id: kind === "shared_drive" ? id : null,
|
|
3857
|
+
child_folders: kind === "shared_with_me" ? null : counts?.get(id) ?? null,
|
|
3858
|
+
added: added(id) || kind === "my_drive" && added("root")
|
|
3859
|
+
}), "top");
|
|
3860
|
+
return listed([
|
|
3861
|
+
top(myDrive.id, "My Drive", "my_drive"),
|
|
3862
|
+
top(SHARED_WITH_ME, "Shared with me", "shared_with_me"),
|
|
3863
|
+
...shared.map((drive) => top(drive.id, drive.name, "shared_drive")).sort(byName)
|
|
3864
|
+
], false);
|
|
3865
|
+
}, "roots");
|
|
3866
|
+
var browseFolders = /* @__PURE__ */ __name(async (call, parent, selected) => {
|
|
3867
|
+
const added = /* @__PURE__ */ __name((id) => selected.includes(id), "added");
|
|
3868
|
+
if (parent === void 0)
|
|
3869
|
+
return roots(call, added);
|
|
3870
|
+
const { rows, incomplete } = await everyPage(call, "drive.files.list", {
|
|
3871
|
+
q: parent === SHARED_WITH_ME ? `sharedWithMe = true and ${NOT_TRASHED_FOLDER}` : `'${parent}' in parents and ${NOT_TRASHED_FOLDER}`,
|
|
3872
|
+
fields: "nextPageToken,incompleteSearch,files(id,name,driveId,ownedByMe)",
|
|
3873
|
+
pageSize: 1e3,
|
|
3874
|
+
...ACROSS_DRIVES
|
|
3875
|
+
}, "files");
|
|
3876
|
+
const folders = rows.filter((row) => Boolean(row.id));
|
|
3877
|
+
const counts = await childCounts(call, folders.map((folder) => folder.id));
|
|
3878
|
+
const items = folders.map((folder) => ({
|
|
3879
|
+
id: folder.id,
|
|
3880
|
+
name: folder.name ?? "",
|
|
3881
|
+
kind: "folder",
|
|
3882
|
+
parent,
|
|
3883
|
+
location: folder.driveId ? "shared_drive" : folder.ownedByMe === false ? "shared_with_me" : "my_drive",
|
|
3884
|
+
drive_id: folder.driveId ?? null,
|
|
3885
|
+
child_folders: counts?.get(folder.id) ?? null,
|
|
3886
|
+
added: added(folder.id)
|
|
3887
|
+
}));
|
|
3888
|
+
return listed(items.sort(byName), incomplete);
|
|
3889
|
+
}, "browseFolders");
|
|
3890
|
+
|
|
3891
|
+
// dist/commands/folders.js
|
|
3892
|
+
var installFolderCommands = /* @__PURE__ */ __name((program, context, call) => {
|
|
3893
|
+
const { env, selected, output, source } = context;
|
|
3894
|
+
addDocumentFolderCommands(program, {
|
|
3895
|
+
words: DRIVE_WORDS,
|
|
3896
|
+
output,
|
|
3897
|
+
add: /* @__PURE__ */ __name(async (input) => {
|
|
3898
|
+
const id = fileId(input);
|
|
3899
|
+
const config = readConfig(env);
|
|
3900
|
+
const name = selected();
|
|
3901
|
+
const profile = activeProfile(env, name);
|
|
3902
|
+
const metadata = await (await source()).metadata(id);
|
|
3903
|
+
if (metadata.mime !== FOLDER || metadata.trashed)
|
|
3904
|
+
throw new CliError("validation_error", "source is not an accessible Google folder");
|
|
3905
|
+
if (!profile.roots.includes(metadata.id))
|
|
3906
|
+
profile.roots.push(metadata.id);
|
|
3907
|
+
config.profiles[name] = profile;
|
|
3908
|
+
writeConfig(env, config);
|
|
3909
|
+
return { id: metadata.id, name: metadata.name };
|
|
3910
|
+
}, "add"),
|
|
3911
|
+
list: /* @__PURE__ */ __name((filter) => selectedFolders(env, selected(), filter), "list"),
|
|
3912
|
+
browse: /* @__PURE__ */ __name((folders) => {
|
|
3913
|
+
examples(answerEntity(annotate(folders.command("browse"), { effects: GOOGLE_READ }).description("list Google Drive folders one level at a time, to choose one for folders add"), "drive_remote_folder", browseRow), [
|
|
3914
|
+
"drive personal folders browse",
|
|
3915
|
+
"drive personal folders browse --parent FOLDER_ID --json",
|
|
3916
|
+
`drive personal folders browse --parent ${SHARED_WITH_ME}`
|
|
3917
|
+
]).option("--parent <id>", `folder id or URL to list inside, or ${SHARED_WITH_ME}; the top level without it`).addHelpText("after", BROWSE_HELP).action(async (args) => {
|
|
3918
|
+
const parent = args.parent === void 0 || args.parent === SHARED_WITH_ME ? args.parent : fileId(args.parent);
|
|
3919
|
+
const roots2 = activeProfile(env, selected()).roots;
|
|
3920
|
+
output(await browseFolders(call, parent, roots2));
|
|
3921
|
+
});
|
|
3922
|
+
}, "browse"),
|
|
3923
|
+
remove: /* @__PURE__ */ __name((input) => {
|
|
3924
|
+
const id = fileId(input);
|
|
3925
|
+
const config = readConfig(env);
|
|
3926
|
+
const name = selected();
|
|
3927
|
+
const profile = activeProfile(env, name);
|
|
3928
|
+
profile.roots = profile.roots.filter((root) => root !== id);
|
|
3929
|
+
config.profiles[name] = profile;
|
|
3930
|
+
writeConfig(env, config);
|
|
3931
|
+
return id;
|
|
3932
|
+
}, "remove")
|
|
3815
3933
|
});
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
customizeSharedCommand(reference, "Drive notes annotate one explicitly selected imported document; document-bound arguments and receipts replace the generic note scope.", () => {
|
|
3821
|
-
installKnowledgeCommandsDefinition(...args);
|
|
3822
|
-
const command = args[0].commands.find((command2) => command2.name() === "notes");
|
|
3823
|
-
if (!command)
|
|
3824
|
-
throw new Error("notes builder did not install its command");
|
|
3825
|
-
return command;
|
|
3826
|
-
}, reviewedOverrides(reference, SHELL_OVERRIDES.notes));
|
|
3827
|
-
}, "installKnowledgeCommands");
|
|
3934
|
+
}, "installFolderCommands");
|
|
3935
|
+
|
|
3936
|
+
// dist/commands/knowledge.js
|
|
3937
|
+
var installKnowledgeCommands = /* @__PURE__ */ __name((program, helpers) => addDocumentKnowledgeCommands(program, { ...helpers, words: DRIVE_WORDS }), "installKnowledgeCommands");
|
|
3828
3938
|
|
|
3829
3939
|
// dist/commands/mirrors.js
|
|
3830
|
-
import {
|
|
3831
|
-
import { join as join5, resolve } from "node:path";
|
|
3940
|
+
import { join as join5 } from "node:path";
|
|
3832
3941
|
|
|
3833
3942
|
// dist/mirror-docs.js
|
|
3834
3943
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
@@ -4300,10 +4409,10 @@ var PLAIN_PARAGRAPH = {
|
|
|
4300
4409
|
};
|
|
4301
4410
|
var textRequests = /* @__PURE__ */ __name((inlines, at, extra = {}) => {
|
|
4302
4411
|
const requests = [];
|
|
4303
|
-
let
|
|
4412
|
+
let offset = at;
|
|
4304
4413
|
for (const inline of inlines) {
|
|
4305
4414
|
const length = inline.text.length;
|
|
4306
|
-
const range2 = { startIndex:
|
|
4415
|
+
const range2 = { startIndex: offset, endIndex: offset + length };
|
|
4307
4416
|
const style = {
|
|
4308
4417
|
...inline.bold ? { bold: true } : {},
|
|
4309
4418
|
...inline.italic ? { italic: true } : {},
|
|
@@ -4314,7 +4423,7 @@ var textRequests = /* @__PURE__ */ __name((inlines, at, extra = {}) => {
|
|
|
4314
4423
|
const fields = Object.keys(style);
|
|
4315
4424
|
if (fields.length && length)
|
|
4316
4425
|
requests.push({ updateTextStyle: { range: range2, textStyle: style, fields: fields.join(",") } });
|
|
4317
|
-
|
|
4426
|
+
offset += length;
|
|
4318
4427
|
}
|
|
4319
4428
|
return requests;
|
|
4320
4429
|
}, "textRequests");
|
|
@@ -4395,24 +4504,24 @@ var insertRequests = /* @__PURE__ */ __name((blocks, at) => {
|
|
|
4395
4504
|
}
|
|
4396
4505
|
});
|
|
4397
4506
|
requests.push({ deleteParagraphBullets: { range: range2 } });
|
|
4398
|
-
let
|
|
4507
|
+
let offset = at;
|
|
4399
4508
|
group.forEach((block, index) => {
|
|
4400
4509
|
const line = lines[index] ?? "";
|
|
4401
4510
|
if (block.kind === "item") {
|
|
4402
4511
|
const done2 = block.list === "check" && block.checked;
|
|
4403
|
-
requests.push(...textRequests(block.inlines,
|
|
4512
|
+
requests.push(...textRequests(block.inlines, offset + block.depth, done2 ? { strike: true } : {}));
|
|
4404
4513
|
} else if (block.kind === "code") {
|
|
4405
4514
|
if (line)
|
|
4406
4515
|
requests.push({
|
|
4407
4516
|
updateTextStyle: {
|
|
4408
|
-
range: { startIndex:
|
|
4517
|
+
range: { startIndex: offset, endIndex: offset + line.length },
|
|
4409
4518
|
textStyle: { weightedFontFamily: { fontFamily: MONO } },
|
|
4410
4519
|
fields: "weightedFontFamily"
|
|
4411
4520
|
}
|
|
4412
4521
|
});
|
|
4413
4522
|
} else if (block.kind === "heading" || block.kind === "paragraph" || block.kind === "quote")
|
|
4414
|
-
requests.push(...textRequests(block.inlines,
|
|
4415
|
-
|
|
4523
|
+
requests.push(...textRequests(block.inlines, offset));
|
|
4524
|
+
offset += line.length + 1;
|
|
4416
4525
|
});
|
|
4417
4526
|
if (first.kind === "item")
|
|
4418
4527
|
requests.push({ createParagraphBullets: { range: range2, bulletPreset: PRESETS[first.list] } });
|
|
@@ -4588,178 +4697,69 @@ var googleTarget = /* @__PURE__ */ __name((call, identity) => ({
|
|
|
4588
4697
|
// dist/commands/mirrors.js
|
|
4589
4698
|
var installMirrorCommands = /* @__PURE__ */ __name((program, context, { call }) => {
|
|
4590
4699
|
const { env, selected, output, source } = context;
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
if (!directory)
|
|
4630
|
-
throw new CliError("validation_error", "the path to mirror is not a folder", { reason: "mirror.not-folder" });
|
|
4631
|
-
const folder = fileId(args.parent);
|
|
4632
|
-
const metadata = await (await source()).metadata(folder);
|
|
4633
|
-
if (metadata.mime !== FOLDER || metadata.trashed)
|
|
4634
|
-
throw new CliError("validation_error", "--parent is not an accessible Google folder");
|
|
4635
|
-
const config = readConfig(env);
|
|
4636
|
-
const name = selected();
|
|
4637
|
-
const profile = activeProfile(env, name);
|
|
4638
|
-
const id = mirrorId(root, folder);
|
|
4639
|
-
const list = profile.mirrors ?? [];
|
|
4640
|
-
if (!list.some((mirror) => mirror.id === id))
|
|
4641
|
-
list.push({ id, path: root, folder });
|
|
4642
|
-
config.profiles[name] = { ...profile, mirrors: list };
|
|
4643
|
-
writeConfig(env, config);
|
|
4644
|
-
output(itemOf({ id, path: root, folder, folder_name: metadata.name, added: true }));
|
|
4645
|
-
});
|
|
4646
|
-
bindQuery(examples(annotate(mirrors.command("list"), { effects: LOCAL_READ }).description("list this profile's mirrors"), [
|
|
4647
|
-
"drive personal mirrors list"
|
|
4648
|
-
]), MIRRORS_QUERY, mirrorRow).action((words) => {
|
|
4649
|
-
const filter = termsOf(words, MIRRORS_QUERY, "mirrors list");
|
|
4650
|
-
output(allOf(configuredMirrors(env, selected(), filter)));
|
|
4651
|
-
});
|
|
4652
|
-
examples(annotate(mirrors.command("remove"), { effects: LOCAL_WRITE }).argument("<id>", "mirror id from mirrors list").description("stop mirroring a folder; nothing in Google Drive is changed or deleted"), ["drive personal mirrors remove 1a2b3c4d"]).action((id) => {
|
|
4653
|
-
find(id);
|
|
4654
|
-
const config = readConfig(env);
|
|
4655
|
-
const name = selected();
|
|
4656
|
-
const profile = activeProfile(env, name);
|
|
4657
|
-
config.profiles[name] = { ...profile, mirrors: (profile.mirrors ?? []).filter((mirror) => mirror.id !== id) };
|
|
4658
|
-
writeConfig(env, config);
|
|
4659
|
-
output(itemOf({ id, removed: true }));
|
|
4660
|
-
});
|
|
4661
|
-
examples(annotate(mirrors.command("status"), { effects: LOCAL_READ }).argument("[id]", "mirror id; every mirror of the profile when omitted").description("show which local files the next sync would create or send; Google is not asked"), ["drive personal mirrors status"]).action(async (id) => {
|
|
4662
|
-
const name = selected();
|
|
4663
|
-
const { principal } = activeProfile(env, name);
|
|
4664
|
-
const items = await mirrorStatus(id ? [find(id)] : mirrorsOf(), mirrorKind, stateOf(name, principal));
|
|
4665
|
-
output(allOf(items.map(({ id: id2, folder, create, update: update2, unchanged, orphans, unsupported, remote_checked }) => ({
|
|
4666
|
-
id: id2,
|
|
4667
|
-
folder,
|
|
4668
|
-
create: create.length,
|
|
4669
|
-
update: update2.length,
|
|
4670
|
-
unchanged,
|
|
4671
|
-
orphans: orphans.length,
|
|
4672
|
-
unsupported,
|
|
4673
|
-
remote_checked
|
|
4674
|
-
}))));
|
|
4675
|
-
});
|
|
4676
|
-
examples(annotate(mirrors.command("sync"), { effects: REMOTE_WRITE }).argument("[id]", "mirror id; every mirror of the profile when omitted").addOption(new Option("--keep <side>", "where a part changed on both sides, keep this side").choices([
|
|
4677
|
-
"local",
|
|
4678
|
-
"google",
|
|
4679
|
-
"both"
|
|
4680
|
-
])).option("--replace", "same as --keep local, and create again files deleted in Google").description("sync both ways with Docs and Sheets; a part changed on both sides is reported"), [
|
|
4681
|
-
"drive personal mirrors sync",
|
|
4682
|
-
"drive personal mirrors sync 1a2b3c4d --keep google",
|
|
4683
|
-
"drive personal mirrors sync 1a2b3c4d --replace"
|
|
4684
|
-
]).action(async (id, args) => {
|
|
4685
|
-
const name = selected();
|
|
4686
|
-
const profile = activeProfile(env, name);
|
|
4687
|
-
const chosen = chosenOf(name, id);
|
|
4688
|
-
if (args.replace && args.keep && args.keep !== "local")
|
|
4689
|
-
throw new CliError("validation_error", "--replace keeps the local side; it cannot be combined with --keep google or both");
|
|
4690
|
-
const keep = args.replace ? "local" : args.keep === "google" ? "remote" : args.keep;
|
|
4691
|
-
const google = await source();
|
|
4692
|
-
const { items, issues } = await syncMirrors({
|
|
4693
|
-
...syncing(name, profile.principal, google),
|
|
4694
|
-
mirrors: chosen,
|
|
4695
|
-
...keep ? { keep } : {},
|
|
4696
|
-
recreate: args.replace === true
|
|
4697
|
-
});
|
|
4698
|
-
const body = allOf(items);
|
|
4699
|
-
if (issues.length)
|
|
4700
|
-
body.meta = { complete: false, issues };
|
|
4701
|
-
output(body);
|
|
4702
|
-
if (issues.length)
|
|
4703
|
-
throw new CliError("provider_error", `some files were not synced; see conflicts, missing and errors, then rerun with --keep local, google or both`, { reason: "mirror.partial" });
|
|
4704
|
-
});
|
|
4705
|
-
examples(annotate(mirrors.command("watch"), { effects: REMOTE_WRITE, lifetime: "persistent" }).argument("[id]", "mirror id; every mirror of the profile when omitted").option("--every <duration>", "how often to ask Google for changes", "60s").summary("keep syncing both ways until Ctrl-C or --timeout").description("keep syncing both ways until Ctrl-C or --timeout: on each local save and each Google change; a part changed on both sides is reported and left for mirrors sync --keep"), ["drive personal mirrors watch", "drive personal mirrors watch 1a2b3c4d --every 2m --jsonl"]).action(async (id, args) => {
|
|
4706
|
-
const pollMs = parseDuration(args.every, "--every");
|
|
4707
|
-
if (pollMs < 1e4)
|
|
4708
|
-
throw new CliError("validation_error", "--every must be at least 10s");
|
|
4709
|
-
const name = selected();
|
|
4710
|
-
const profile = activeProfile(env, name);
|
|
4711
|
-
const chosen = chosenOf(name, id);
|
|
4712
|
-
const signal = context.endsOnStop() ?? new AbortController().signal;
|
|
4713
|
-
const google = await source();
|
|
4714
|
-
const states = stateOf(name, profile.principal);
|
|
4715
|
-
let token = await google.startToken();
|
|
4716
|
-
const remoteChanges = /* @__PURE__ */ __name(async () => {
|
|
4717
|
-
let changed;
|
|
4718
|
-
try {
|
|
4719
|
-
const feed = await google.changes(token);
|
|
4720
|
-
token = feed.cursor;
|
|
4721
|
-
changed = new Set(feed.items.map((item) => item.id));
|
|
4722
|
-
} catch (error) {
|
|
4723
|
-
if (!isCliError(error) || error.details?.reason !== "listing.too-large")
|
|
4724
|
-
throw error;
|
|
4725
|
-
token = await google.startToken();
|
|
4726
|
-
return "all";
|
|
4727
|
-
}
|
|
4728
|
-
return chosen.filter((mirror) => Object.values(states(mirror).read().entries).some((entry) => changed.has(entry.id))).map((mirror) => mirror.id);
|
|
4729
|
-
}, "remoteChanges");
|
|
4730
|
-
let cycles = 0;
|
|
4731
|
-
for await (const event of watchMirrors((mirrors2) => syncMirrors({ ...syncing(name, profile.principal, google), mirrors: mirrors2 }), { mirrors: chosen, signal, kindOf: mirrorKind, stateOf: states, remoteChanges, pollMs })) {
|
|
4732
|
-
cycles++;
|
|
4733
|
-
const data = {
|
|
4734
|
-
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4735
|
-
triggers: event.triggers,
|
|
4736
|
-
mirrors: event.mirrors,
|
|
4737
|
-
..."error" in event ? { error: { code: event.error.code, message: event.error.message } } : { results: event.result.items, ...event.result.issues.length ? { issues: event.result.issues } : {} }
|
|
4700
|
+
addDocumentMirrorCommands(program, {
|
|
4701
|
+
words: DRIVE_WORDS,
|
|
4702
|
+
output,
|
|
4703
|
+
print: /* @__PURE__ */ __name((render) => context.print((_renderer, format, streams) => render(format, (text) => streams.data(text))), "print"),
|
|
4704
|
+
profile: selected,
|
|
4705
|
+
mirrors: /* @__PURE__ */ __name(() => activeProfile(env, selected()).mirrors ?? [], "mirrors"),
|
|
4706
|
+
save: /* @__PURE__ */ __name((mirrors) => {
|
|
4707
|
+
const config = readConfig(env);
|
|
4708
|
+
const name = selected();
|
|
4709
|
+
config.profiles[name] = { ...activeProfile(env, name), mirrors };
|
|
4710
|
+
writeConfig(env, config);
|
|
4711
|
+
}, "save"),
|
|
4712
|
+
parent: /* @__PURE__ */ __name(async (input) => {
|
|
4713
|
+
const folder = fileId(input);
|
|
4714
|
+
const metadata = await (await source()).metadata(folder);
|
|
4715
|
+
if (metadata.mime !== FOLDER || metadata.trashed)
|
|
4716
|
+
throw new CliError("validation_error", "--parent is not an accessible Google folder");
|
|
4717
|
+
return { id: folder, name: metadata.name };
|
|
4718
|
+
}, "parent"),
|
|
4719
|
+
kindOf: mirrorKind,
|
|
4720
|
+
stateOf: /* @__PURE__ */ __name((mirror) => fileMirrorState(join5(profileDir(env, selected()), "mirrors"), mirror, activeProfile(env, selected()).principal, ["doc", "sheet"]), "stateOf"),
|
|
4721
|
+
connect: /* @__PURE__ */ __name(async () => {
|
|
4722
|
+
const name = selected();
|
|
4723
|
+
const { principal } = activeProfile(env, name);
|
|
4724
|
+
const google = await source();
|
|
4725
|
+
return {
|
|
4726
|
+
sync: {
|
|
4727
|
+
target: googleTarget(call, () => google.identity()),
|
|
4728
|
+
principal,
|
|
4729
|
+
// `call` already checks policy and journals each Google write it makes.
|
|
4730
|
+
guard: /* @__PURE__ */ __name((_attempt, act) => act(), "guard"),
|
|
4731
|
+
operationId: newOperationId,
|
|
4732
|
+
errorOf: googleError,
|
|
4733
|
+
lock: /* @__PURE__ */ __name(() => lockProfile(env, name), "lock"),
|
|
4734
|
+
...context.signal() ? { signal: context.signal() } : {}
|
|
4735
|
+
},
|
|
4736
|
+
startToken: /* @__PURE__ */ __name(() => google.startToken(), "startToken"),
|
|
4737
|
+
changes: /* @__PURE__ */ __name((token) => google.changes(token), "changes")
|
|
4738
4738
|
};
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
context.print((_renderer, format, streams) => {
|
|
4742
|
-
if (format === "pretty")
|
|
4743
|
-
return;
|
|
4744
|
-
const end = listOf("mirrors watch", {
|
|
4745
|
-
items: [],
|
|
4746
|
-
limit: Math.max(1, cycles),
|
|
4747
|
-
has_more: false,
|
|
4748
|
-
paging: "cursor",
|
|
4749
|
-
meta: { complete: true }
|
|
4750
|
-
});
|
|
4751
|
-
for (const record2 of jsonlRecords(end))
|
|
4752
|
-
streams.data(JSON.stringify(record2));
|
|
4753
|
-
});
|
|
4739
|
+
}, "connect"),
|
|
4740
|
+
endsOnStop: /* @__PURE__ */ __name(() => context.endsOnStop(), "endsOnStop")
|
|
4754
4741
|
});
|
|
4755
4742
|
}, "installMirrorCommands");
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4743
|
+
|
|
4744
|
+
// dist/age.js
|
|
4745
|
+
var SYNC = defineSteps([
|
|
4746
|
+
{ id: "sync.run", command: "sync", args: [], why: "copy the changes Google has made into the local store" }
|
|
4747
|
+
])[0];
|
|
4748
|
+
var freshness = /* @__PURE__ */ __name((remote, local2) => ({
|
|
4749
|
+
changed: local2 === void 0 || Date.parse(remote) !== Date.parse(local2),
|
|
4750
|
+
remote_modified_at: remote,
|
|
4751
|
+
local_modified_at: local2 ?? null
|
|
4752
|
+
}), "freshness");
|
|
4753
|
+
var changedCopy = /* @__PURE__ */ __name(({ changed, local_modified_at }) => {
|
|
4754
|
+
if (!changed)
|
|
4755
|
+
return {};
|
|
4756
|
+
const why = local_modified_at === null ? "the local copy has no modified time, so it cannot be compared with Google" : `Google changed the document after the local copy was made (${local_modified_at})`;
|
|
4757
|
+
return {
|
|
4758
|
+
missing: [{ field: "modified_at", why, step: SYNC.id }],
|
|
4759
|
+
next: [stepOf(SYNC)],
|
|
4760
|
+
meta: { complete: false }
|
|
4761
|
+
};
|
|
4762
|
+
}, "changedCopy");
|
|
4763
4763
|
|
|
4764
4764
|
// dist/download.js
|
|
4765
4765
|
import { randomUUID } from "node:crypto";
|
|
@@ -4824,6 +4824,39 @@ var saveDownload = /* @__PURE__ */ __name(async (path, overwrite, read, createDi
|
|
|
4824
4824
|
return size2;
|
|
4825
4825
|
}, "saveDownload");
|
|
4826
4826
|
|
|
4827
|
+
// dist/output.js
|
|
4828
|
+
var VERBATIM = /* @__PURE__ */ new Set([
|
|
4829
|
+
"frontMatter",
|
|
4830
|
+
"front_matter",
|
|
4831
|
+
"provider_metadata",
|
|
4832
|
+
"metadata",
|
|
4833
|
+
"headers",
|
|
4834
|
+
"properties",
|
|
4835
|
+
"appProperties",
|
|
4836
|
+
"app_properties",
|
|
4837
|
+
"request_schema",
|
|
4838
|
+
"response_schema",
|
|
4839
|
+
"body_schema",
|
|
4840
|
+
"schema",
|
|
4841
|
+
"inputSchema",
|
|
4842
|
+
"input_schema",
|
|
4843
|
+
"outputSchema",
|
|
4844
|
+
"output_schema"
|
|
4845
|
+
]);
|
|
4846
|
+
var RECORDS = /* @__PURE__ */ new Set(["profiles", "permissions", "models"]);
|
|
4847
|
+
var keyOf = /* @__PURE__ */ __name((key) => /^[a-z][a-zA-Z0-9]*$/.test(key) ? key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase() : key, "keyOf");
|
|
4848
|
+
var snakeKeys2 = /* @__PURE__ */ __name((value, record2 = false) => {
|
|
4849
|
+
if (Array.isArray(value))
|
|
4850
|
+
return value.map((item) => snakeKeys2(item));
|
|
4851
|
+
if (!value || typeof value !== "object" || value instanceof Date)
|
|
4852
|
+
return value;
|
|
4853
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
4854
|
+
record2 ? key : keyOf(key),
|
|
4855
|
+
VERBATIM.has(key) ? item : snakeKeys2(item, RECORDS.has(key))
|
|
4856
|
+
]));
|
|
4857
|
+
}, "snakeKeys");
|
|
4858
|
+
var allOf2 = /* @__PURE__ */ __name((items) => listOf("", { items, limit: Math.max(1, items.length), has_more: false }), "allOf");
|
|
4859
|
+
|
|
4827
4860
|
// dist/generated/definitions.js
|
|
4828
4861
|
var definitions = {
|
|
4829
4862
|
DriveOperation: {
|
|
@@ -22010,10 +22043,10 @@ var DRIVE_TIME = /\b(modifiedTime|createdTime|viewedByMeTime|sharedWithMeTime)(\
|
|
|
22010
22043
|
var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
22011
22044
|
var utcDriveQuery = /* @__PURE__ */ __name((query, zone = timezoneOf()) => {
|
|
22012
22045
|
let changed = false;
|
|
22013
|
-
const sent = query.replace(DRIVE_TIME, (whole, field, before, operator, after, value,
|
|
22046
|
+
const sent = query.replace(DRIVE_TIME, (whole, field, before, operator, after, value, offset) => {
|
|
22014
22047
|
if (ZONED.test(value))
|
|
22015
22048
|
return whole;
|
|
22016
|
-
const start =
|
|
22049
|
+
const start = offset + whole.length - value.length - 1;
|
|
22017
22050
|
const end = operator === "<=" || operator === ">";
|
|
22018
22051
|
const time = zonedMoment(value, zone, { start, end: start + value.length }, { end });
|
|
22019
22052
|
changed = true;
|
|
@@ -22251,11 +22284,11 @@ var sentParams = /* @__PURE__ */ __name((method, params) => {
|
|
|
22251
22284
|
}, "sentParams");
|
|
22252
22285
|
var zoneMeta = /* @__PURE__ */ __name((meta) => meta ? { meta } : {}, "zoneMeta");
|
|
22253
22286
|
var installRemoteCommands = /* @__PURE__ */ __name((program, helpers) => {
|
|
22254
|
-
const { call, output, positive:
|
|
22255
|
-
const page = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many items one page holds",
|
|
22287
|
+
const { call, output, positive: positive3 } = helpers;
|
|
22288
|
+
const page = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many items one page holds", positive3, 100).option("--cursor <cursor>", "continue from page.next_cursor of the previous answer"), "page");
|
|
22256
22289
|
const fileArgument = "file id or Google Drive URL";
|
|
22257
22290
|
const api = annotate(program.command("api"), { effects: LOCAL_READ }).description("discover and call the official Drive, Docs, Sheets and Activity API methods");
|
|
22258
|
-
withQuery(examples(answerEntity(annotate(api.command("list"), { effects: NO_EFFECTS }).description("list the Google API methods drive can call"), "api_method", strictObject({ name: string(), mutates: boolean(), destructive: boolean(), scope: string() })), ["drive api list", "drive api list service:docs"]), API_METHOD_QUERY).action((words) => output(
|
|
22291
|
+
withQuery(examples(answerEntity(annotate(api.command("list"), { effects: NO_EFFECTS }).description("list the Google API methods drive can call"), "api_method", strictObject({ name: string(), mutates: boolean(), destructive: boolean(), scope: string() })), ["drive api list", "drive api list service:docs"]), API_METHOD_QUERY).action((words) => output(allOf2(apiMethods(queryTerms(words, API_METHOD_QUERY, "api list").get("service")))));
|
|
22259
22292
|
examples(annotate(api.command("show"), { effects: NO_EFFECTS }).description("show one method's request schema and contract, without calling Google").argument("<method>", "Google method name, as api list prints it"), ["drive api show docs.documents.batchUpdate --json"]).action((method) => output(itemOf({ operation: operationOf(method), request_schema: requestSchema(method) })));
|
|
22260
22293
|
examples(annotate(api.command("call"), { mcp: false, effects: GOOGLE_WRITE }).description("call one Google API method by name with JSON parameters").argument("<method>", "Google method name, as api list prints it"), [
|
|
22261
22294
|
`drive personal api call drive.files.get --params '{"fileId":"FILE_ID"}'`,
|
|
@@ -22404,35 +22437,27 @@ var installRemoteCommands = /* @__PURE__ */ __name((program, helpers) => {
|
|
|
22404
22437
|
}, "installRemoteCommands");
|
|
22405
22438
|
|
|
22406
22439
|
// dist/commands/search.js
|
|
22407
|
-
var
|
|
22408
|
-
|
|
22440
|
+
var installSearchCommand = /* @__PURE__ */ __name((program, { env, selected, output, withIndex }) => addDocumentSearchCommand(program, {
|
|
22441
|
+
words: DRIVE_WORDS,
|
|
22442
|
+
output,
|
|
22443
|
+
search: /* @__PURE__ */ __name(async (query, options) => {
|
|
22409
22444
|
const name = selected();
|
|
22410
22445
|
const profile = activeProfile(env, name);
|
|
22411
|
-
|
|
22412
|
-
...
|
|
22413
|
-
offset: (page - 1) * args.limit,
|
|
22414
|
-
exact: args.exact ?? false,
|
|
22446
|
+
return withIndex(async (index) => await index.search(profile.principal, query, {
|
|
22447
|
+
...options,
|
|
22415
22448
|
...pictureSearch(env, name) ? { pictures: true } : {}
|
|
22416
22449
|
}));
|
|
22417
|
-
|
|
22418
|
-
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
}
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
return customizeSharedCommand(reference, "Drive searches imported documents and embeddings rather than live messenger messages; its default action and pagination are explicitly provider-specific.", () => {
|
|
22429
|
-
installSearchCommandDefinition(...args);
|
|
22430
|
-
const command = args[0].commands.find((command2) => command2.name() === "search");
|
|
22431
|
-
if (!command)
|
|
22432
|
-
throw new Error("search builder did not install its command");
|
|
22433
|
-
return command;
|
|
22434
|
-
}, reviewedOverrides(reference, SHELL_OVERRIDES.search));
|
|
22435
|
-
}, "installSearchCommand");
|
|
22450
|
+
}, "search"),
|
|
22451
|
+
imported: /* @__PURE__ */ __name(() => {
|
|
22452
|
+
const name = selected();
|
|
22453
|
+
const profile = activeProfile(env, name);
|
|
22454
|
+
return {
|
|
22455
|
+
profile: name,
|
|
22456
|
+
chosen: profile.roots.length > 0 || transcriptsOf(env, name).mode === "include",
|
|
22457
|
+
documents: Object.keys(readState(env, name, profile.principal).documents).length
|
|
22458
|
+
};
|
|
22459
|
+
}, "imported")
|
|
22460
|
+
}), "installSearchCommand");
|
|
22436
22461
|
|
|
22437
22462
|
// dist/commands/session.js
|
|
22438
22463
|
var GRANTS = ["write", "activity", "apps"];
|
|
@@ -22463,7 +22488,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22463
22488
|
const app = application(env, { file: args.clientFile, clientId: args.clientId, profile: selected() });
|
|
22464
22489
|
if (!app.clientSecret)
|
|
22465
22490
|
streams.diagnostic("your Google app has no secret here, and Google refuses a Desktop app without one: set DRIVE_GOOGLE_CLIENT_SECRET\n");
|
|
22466
|
-
const { login } = await import("./login-
|
|
22491
|
+
const { login } = await import("./login-7GBONT7V.js");
|
|
22467
22492
|
output(itemOf(await login({
|
|
22468
22493
|
env,
|
|
22469
22494
|
profile: selected(),
|
|
@@ -22494,7 +22519,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22494
22519
|
const name = selected();
|
|
22495
22520
|
const config = readConfig(env);
|
|
22496
22521
|
const profile = activeProfile(env, name);
|
|
22497
|
-
const { credentials } = await import("./tokens-
|
|
22522
|
+
const { credentials } = await import("./tokens-AF7QOFOF.js");
|
|
22498
22523
|
const store = credentials(env, profile.storage, options.keyring);
|
|
22499
22524
|
store.remove(name);
|
|
22500
22525
|
writeConfig(env, config);
|
|
@@ -22541,7 +22566,7 @@ var selection = /* @__PURE__ */ __name((env, name, source) => {
|
|
|
22541
22566
|
return { profile, state, options: { source, destination, collection: `google-drive:${profile.principal}`, env } };
|
|
22542
22567
|
}, "selection");
|
|
22543
22568
|
var checkStoreImport = /* @__PURE__ */ __name(async (env, name, source, bindings) => {
|
|
22544
|
-
const { ensureSqlite } = await import("./sqlite-runtime-
|
|
22569
|
+
const { ensureSqlite } = await import("./sqlite-runtime-S5VPMZQH.js");
|
|
22545
22570
|
await ensureSqlite();
|
|
22546
22571
|
const { state, options } = selection(env, name, source);
|
|
22547
22572
|
const preview = await previewDocumentTransfer({ ...options, bindings });
|
|
@@ -22632,7 +22657,6 @@ var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal,
|
|
|
22632
22657
|
pictures: profile.picture_search,
|
|
22633
22658
|
textLimit: textLimit(env, name),
|
|
22634
22659
|
maxEntries: MAX_ENTRIES,
|
|
22635
|
-
limitError: tooManyEntries,
|
|
22636
22660
|
isFolder: /* @__PURE__ */ __name((file) => file.mime === FOLDER, "isFolder"),
|
|
22637
22661
|
skipReason,
|
|
22638
22662
|
retryable,
|
|
@@ -22673,46 +22697,40 @@ var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal,
|
|
|
22673
22697
|
// dist/commands/sync.js
|
|
22674
22698
|
var installSyncCommands = /* @__PURE__ */ __name((program, context) => {
|
|
22675
22699
|
const { env, streams, selected, output, source, withIndex } = context;
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
|
|
22694
|
-
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
pending: state.pending?.jobs.length ?? 0,
|
|
22711
|
-
skipped: state.skipped.map(({ id, reason }) => ({ id, reason })),
|
|
22712
|
-
last_sync: state.lastSync ?? null,
|
|
22713
|
-
coverage: "Google Docs/Sheets, PDF/DOCX/XLSX and Markdown/TXT/CSV/TSV; native export layout, tab fidelity and assets are not verified",
|
|
22714
|
-
remote_checked: false
|
|
22715
|
-
}));
|
|
22700
|
+
addDocumentSyncCommands(program, {
|
|
22701
|
+
words: DRIVE_WORDS,
|
|
22702
|
+
output,
|
|
22703
|
+
diagnostic: /* @__PURE__ */ __name((text) => streams.diagnostic(text), "diagnostic"),
|
|
22704
|
+
profile: selected,
|
|
22705
|
+
maxEntries: MAX_ENTRIES,
|
|
22706
|
+
sync: /* @__PURE__ */ __name(async (args) => {
|
|
22707
|
+
const profile = activeProfile(env, selected());
|
|
22708
|
+
const remote = profile.roots.length || profile.transcripts === "include" ? await source() : void 0;
|
|
22709
|
+
return withIndex(async (index) => ({
|
|
22710
|
+
...await sync(remote, index, env, selected(), args.limit, context.signal(), args.rescan),
|
|
22711
|
+
...args.embed ? { embeddings: await index.embed(600) } : {}
|
|
22712
|
+
}));
|
|
22713
|
+
}, "sync"),
|
|
22714
|
+
status: /* @__PURE__ */ __name(() => {
|
|
22715
|
+
const name = selected();
|
|
22716
|
+
const profile = activeProfile(env, name);
|
|
22717
|
+
const state = readState(env, name, profile.principal);
|
|
22718
|
+
const legacyStore = join7(paths(env).state, "drive.db");
|
|
22719
|
+
return {
|
|
22720
|
+
profile: name,
|
|
22721
|
+
store: {
|
|
22722
|
+
selected: resolve4(storePath(env)),
|
|
22723
|
+
checkpoint: state.store ?? (existsSync(legacyStore) ? resolve4(legacyStore) : null)
|
|
22724
|
+
},
|
|
22725
|
+
selected_folders: profile.roots,
|
|
22726
|
+
documents: Object.keys(state.documents).length,
|
|
22727
|
+
pending: state.pending?.jobs.length ?? 0,
|
|
22728
|
+
skipped: state.skipped.map(({ id, reason }) => ({ id, reason })),
|
|
22729
|
+
last_sync: state.lastSync ?? null,
|
|
22730
|
+
coverage: "Google Docs/Sheets, PDF/DOCX/XLSX and Markdown/TXT/CSV/TSV; native export layout, tab fidelity and assets are not verified",
|
|
22731
|
+
remote_checked: false
|
|
22732
|
+
};
|
|
22733
|
+
}, "status")
|
|
22716
22734
|
});
|
|
22717
22735
|
}, "installSyncCommands");
|
|
22718
22736
|
|
|
@@ -22743,14 +22761,14 @@ var installTranscriptCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22743
22761
|
owned_by_me: file.providerMetadata?.ownedByMe ?? null,
|
|
22744
22762
|
modified_at: file.modifiedAt ?? null
|
|
22745
22763
|
}));
|
|
22746
|
-
output(
|
|
22764
|
+
output(allOf2(rows.filter((row) => filter.owned_by_me === void 0 || String(row.owned_by_me) === filter.owned_by_me)));
|
|
22747
22765
|
});
|
|
22748
22766
|
}, "installTranscriptCommands");
|
|
22749
22767
|
|
|
22750
22768
|
// dist/commands/upgrade.js
|
|
22751
22769
|
import { join as join8 } from "node:path";
|
|
22752
22770
|
|
|
22753
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22771
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/update/index.js
|
|
22754
22772
|
import { realpathSync } from "node:fs";
|
|
22755
22773
|
import { fileURLToPath } from "node:url";
|
|
22756
22774
|
var npmRegistry = /* @__PURE__ */ __name(() => hostFetch({ hosts: ["registry.npmjs.org"] }), "npmRegistry");
|
|
@@ -22923,11 +22941,11 @@ var placeInSections = /* @__PURE__ */ __name((program) => {
|
|
|
22923
22941
|
|
|
22924
22942
|
// dist/provider-json.js
|
|
22925
22943
|
var providerJsonFields = entityFields({
|
|
22926
|
-
"document.
|
|
22927
|
-
|
|
22944
|
+
"document.catalog": CATALOG_FIELDS,
|
|
22945
|
+
"document.imported": DOCUMENT_LIST_FIELDS
|
|
22928
22946
|
});
|
|
22929
22947
|
var DRIVE_ROWS = {
|
|
22930
|
-
|
|
22948
|
+
"document.imported": {
|
|
22931
22949
|
columns: [
|
|
22932
22950
|
{ field: "reference" },
|
|
22933
22951
|
{ field: "name" },
|
|
@@ -22935,7 +22953,7 @@ var DRIVE_ROWS = {
|
|
|
22935
22953
|
{ field: "age_days", as: "count", tag: "days since sync" }
|
|
22936
22954
|
]
|
|
22937
22955
|
},
|
|
22938
|
-
"document.
|
|
22956
|
+
"document.catalog": {
|
|
22939
22957
|
columns: [{ field: "ref" }, { field: "name" }, { field: "kind" }, { field: "modified_at", as: "time" }]
|
|
22940
22958
|
}
|
|
22941
22959
|
};
|
|
@@ -22962,9 +22980,9 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
|
|
|
22962
22980
|
const port = {
|
|
22963
22981
|
...shared,
|
|
22964
22982
|
context: /* @__PURE__ */ __name(async (principal, ref) => {
|
|
22965
|
-
const
|
|
22983
|
+
const note2 = await document(principal, ref);
|
|
22966
22984
|
return {
|
|
22967
|
-
document:
|
|
22985
|
+
document: note2,
|
|
22968
22986
|
tags: await store.notes.noteTags(ref),
|
|
22969
22987
|
links: await store.notes.links({ from: ref }),
|
|
22970
22988
|
notes: await store.notes.notes({ source: "internal", about: ref, limit: 100 }),
|
|
@@ -22974,19 +22992,20 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
|
|
|
22974
22992
|
};
|
|
22975
22993
|
}, "context"),
|
|
22976
22994
|
people: /* @__PURE__ */ __name(async (principal, ref, filter = {}) => {
|
|
22977
|
-
const
|
|
22978
|
-
const metadata =
|
|
22995
|
+
const note2 = await document(principal, ref);
|
|
22996
|
+
const metadata = note2.frontMatter;
|
|
22979
22997
|
const contributors = [
|
|
22980
22998
|
...(metadata.owners ?? []).map((user) => ({ ...user, role: "owner" })),
|
|
22981
22999
|
...metadata.lastModifiedBy ? [{ ...metadata.lastModifiedBy, role: "last-editor" }] : []
|
|
22982
|
-
].filter((user) => (filter.role === void 0 || user.role === filter.role) && (filter.
|
|
23000
|
+
].filter((user) => (filter.role === void 0 || user.role === filter.role) && (filter.remote_id === void 0 || googleUserId(user) === filter.remote_id));
|
|
22983
23001
|
return {
|
|
22984
23002
|
items: await Promise.all(contributors.map(async (user) => {
|
|
22985
23003
|
const id = googleUserId(user);
|
|
22986
23004
|
const person = id ? await store.people.personOf({ provider: "google-drive", id }) : void 0;
|
|
22987
23005
|
return {
|
|
22988
23006
|
...user,
|
|
22989
|
-
|
|
23007
|
+
remote_id: id ?? null,
|
|
23008
|
+
provider: "google-drive",
|
|
22990
23009
|
person: person ? { ref: `person:${person.uid}`, ...person } : null
|
|
22991
23010
|
};
|
|
22992
23011
|
})),
|
|
@@ -22994,8 +23013,8 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
|
|
|
22994
23013
|
};
|
|
22995
23014
|
}, "people"),
|
|
22996
23015
|
linkPerson: /* @__PURE__ */ __name(async (principal, ref, googleId, personRef) => {
|
|
22997
|
-
const
|
|
22998
|
-
const metadata =
|
|
23016
|
+
const note2 = await document(principal, ref);
|
|
23017
|
+
const metadata = note2.frontMatter;
|
|
22999
23018
|
const users = [...metadata.owners ?? [], ...metadata.lastModifiedBy ? [metadata.lastModifiedBy] : []];
|
|
23000
23019
|
if (!users.some((user) => googleUserId(user) === googleId))
|
|
23001
23020
|
throw new CliError("not_found", "Google identity was not observed on this document");
|
|
@@ -23012,8 +23031,8 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
|
|
|
23012
23031
|
if (sourceFolder.account?.provider !== "google-drive")
|
|
23013
23032
|
continue;
|
|
23014
23033
|
const principal2 = sourceFolder.account.account;
|
|
23015
|
-
for (let
|
|
23016
|
-
const page = await store.notes.notes({ folderId: sourceFolder.id, source: "file", limit: 500, offset
|
|
23034
|
+
for (let offset = 0; offset <= 1e4; offset += 500) {
|
|
23035
|
+
const page = await store.notes.notes({ folderId: sourceFolder.id, source: "file", limit: 500, offset });
|
|
23017
23036
|
for (const source of page.items) {
|
|
23018
23037
|
const data = source.frontMatter;
|
|
23019
23038
|
if (data?.source !== "google-drive" || !data.fileId)
|
|
@@ -23029,7 +23048,7 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
|
|
|
23029
23048
|
}
|
|
23030
23049
|
if (!page.hasMore)
|
|
23031
23050
|
break;
|
|
23032
|
-
if (
|
|
23051
|
+
if (offset === 1e4)
|
|
23033
23052
|
throw new CliError("provider_error", "identity linked; document relationship refresh exceeded its bound");
|
|
23034
23053
|
}
|
|
23035
23054
|
}
|
|
@@ -23091,15 +23110,15 @@ var prepareStore = /* @__PURE__ */ __name(async (index, env, name, rescan = fals
|
|
|
23091
23110
|
const folder = await old.notes.documentsAccount({ provider: "google-drive", account: profile.principal });
|
|
23092
23111
|
const counts = { tags: 0, notes: 0, memories: 0, facts: 0, links: 0 };
|
|
23093
23112
|
if (folder) {
|
|
23094
|
-
for (let
|
|
23095
|
-
const page = await old.notes.notes({ folderId: folder.id, source: "file", limit: 500, offset
|
|
23096
|
-
for (const
|
|
23097
|
-
counts.tags += (await old.notes.noteTags(
|
|
23098
|
-
counts.notes += (await old.notes.notes({ source: "internal", about:
|
|
23099
|
-
counts.memories += (await old.memories.list({ subject:
|
|
23100
|
-
counts.facts += (await old.facts.list({ subject:
|
|
23101
|
-
counts.links += (await old.notes.links({ from:
|
|
23102
|
-
counts.links += (await old.notes.links({ to:
|
|
23113
|
+
for (let offset = 0; ; offset += 500) {
|
|
23114
|
+
const page = await old.notes.notes({ folderId: folder.id, source: "file", limit: 500, offset });
|
|
23115
|
+
for (const note2 of page.items) {
|
|
23116
|
+
counts.tags += (await old.notes.noteTags(note2.ref)).length;
|
|
23117
|
+
counts.notes += (await old.notes.notes({ source: "internal", about: note2.ref, limit: 1 })).items.length;
|
|
23118
|
+
counts.memories += (await old.memories.list({ subject: note2.ref, limit: 1 })).items.length;
|
|
23119
|
+
counts.facts += (await old.facts.list({ subject: note2.ref, limit: 1 })).items.length;
|
|
23120
|
+
counts.links += (await old.notes.links({ from: note2.ref })).filter((link) => link.origin !== "file").length;
|
|
23121
|
+
counts.links += (await old.notes.links({ to: note2.ref })).length;
|
|
23103
23122
|
}
|
|
23104
23123
|
if (!page.hasMore)
|
|
23105
23124
|
break;
|
|
@@ -23177,7 +23196,7 @@ var openIndex = /* @__PURE__ */ __name(async (env, name, rescan = false) => {
|
|
|
23177
23196
|
activeProfile(env, name);
|
|
23178
23197
|
if (env.DRIVE_STORE)
|
|
23179
23198
|
throw new CliError("configuration_error", "DRIVE_STORE has been retired; use MESSAGING_STORE to select the shared database", { reason: "store.override-retired" });
|
|
23180
|
-
const { openAppStore } = await import("./cli-
|
|
23199
|
+
const { openAppStore } = await import("./cli-556DERZL.js");
|
|
23181
23200
|
const store = await openAppStore(env, { app: { command: "drive", version: VERSION }, provider: DRIVE_PROVIDER });
|
|
23182
23201
|
const index = indexOver(store, env);
|
|
23183
23202
|
try {
|
|
@@ -23228,7 +23247,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23228
23247
|
linkMessages: /* @__PURE__ */ __name((documents, since) => store.notes.linkMessages({ documents, ...since ? { since } : {} }), "linkMessages"),
|
|
23229
23248
|
knowledge: documentKnowledge2(store, async (principal) => (await folder(principal, false))?.id),
|
|
23230
23249
|
openPictures: /* @__PURE__ */ __name(async () => {
|
|
23231
|
-
const { openPictureEmbedderFor, savePicture } = await import("./services-
|
|
23250
|
+
const { openPictureEmbedderFor, savePicture } = await import("./services-ZILSFJ6E.js");
|
|
23232
23251
|
const embedder = pictureEmbedder ?? await openPictureEmbedderFor({ env, command: "drive" });
|
|
23233
23252
|
return {
|
|
23234
23253
|
save: /* @__PURE__ */ __name((reference, bytes) => savePicture(store, { ref: reference }, bytes, { embedder }), "save"),
|
|
@@ -23247,7 +23266,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23247
23266
|
has_more: false,
|
|
23248
23267
|
meaning_skipped: "this Google account has no imported sources"
|
|
23249
23268
|
};
|
|
23250
|
-
const { searchNotes } = await import("./services-
|
|
23269
|
+
const { searchNotes } = await import("./services-ZILSFJ6E.js");
|
|
23251
23270
|
const result = await searchNotes(store, query, {
|
|
23252
23271
|
...options,
|
|
23253
23272
|
folderIds: selected ? [selected.id] : [],
|
|
@@ -23256,9 +23275,9 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23256
23275
|
...pictureEmbedder ? { pictureEmbedder } : {}
|
|
23257
23276
|
});
|
|
23258
23277
|
const pictures = await Promise.all((result.pictures ?? []).map(async (picture) => {
|
|
23259
|
-
const
|
|
23278
|
+
const note2 = await store.notes.note(picture.ref);
|
|
23260
23279
|
const [file] = await store.files.ofDocument(picture.ref);
|
|
23261
|
-
return { ...picture, title:
|
|
23280
|
+
return { ...picture, title: note2.title, url: file?.url ?? null };
|
|
23262
23281
|
}));
|
|
23263
23282
|
const { pictures: _, items, hasMore, nextOffset, ...rest } = result;
|
|
23264
23283
|
return {
|
|
@@ -23267,9 +23286,9 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23267
23286
|
...nextOffset === void 0 ? {} : { next_offset: nextOffset },
|
|
23268
23287
|
...result.pictures ? { pictures } : {},
|
|
23269
23288
|
hits: await Promise.all(items.map(async (hit) => {
|
|
23270
|
-
const
|
|
23271
|
-
const metadata =
|
|
23272
|
-
const entry =
|
|
23289
|
+
const note2 = await store.notes.note(hit.ref);
|
|
23290
|
+
const metadata = note2.frontMatter;
|
|
23291
|
+
const entry = note2.path ? await store.catalog.get(selected.id, note2.path) : void 0;
|
|
23273
23292
|
return {
|
|
23274
23293
|
...hit,
|
|
23275
23294
|
tabs: Array.isArray(metadata?.tabs) ? metadata.tabs : [],
|
|
@@ -23280,7 +23299,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23280
23299
|
};
|
|
23281
23300
|
}, "search"),
|
|
23282
23301
|
embed: /* @__PURE__ */ __name(async (max) => {
|
|
23283
|
-
const { embedNotes } = await import("./services-
|
|
23302
|
+
const { embedNotes } = await import("./services-ZILSFJ6E.js");
|
|
23284
23303
|
return embedNotes(store, { maxChunks: max, env, command: "drive" });
|
|
23285
23304
|
}, "embed"),
|
|
23286
23305
|
close: /* @__PURE__ */ __name(() => store.close(), "close")
|
|
@@ -23364,7 +23383,7 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
|
|
|
23364
23383
|
}, "start");
|
|
23365
23384
|
const status = /* @__PURE__ */ __name((session2) => input.request({ url: session2, method: "PUT", headers: { "Content-Range": `bytes */${size2}` } }), "status");
|
|
23366
23385
|
let session = "";
|
|
23367
|
-
let
|
|
23386
|
+
let offset = 0;
|
|
23368
23387
|
let resumed = false;
|
|
23369
23388
|
let finished;
|
|
23370
23389
|
const saved = readCheckpoint();
|
|
@@ -23374,7 +23393,7 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
|
|
|
23374
23393
|
finished = answer;
|
|
23375
23394
|
if (answer?.status === 308) {
|
|
23376
23395
|
session = saved.session_uri;
|
|
23377
|
-
|
|
23396
|
+
offset = nextByte(answer);
|
|
23378
23397
|
resumed = true;
|
|
23379
23398
|
} else if (!finished) {
|
|
23380
23399
|
clearCheckpoint();
|
|
@@ -23386,11 +23405,11 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
|
|
|
23386
23405
|
try {
|
|
23387
23406
|
let failures = 0;
|
|
23388
23407
|
while (!finished) {
|
|
23389
|
-
const end = Math.min(
|
|
23390
|
-
const body = Buffer.alloc(end -
|
|
23408
|
+
const end = Math.min(offset + chunk, size2);
|
|
23409
|
+
const body = Buffer.alloc(end - offset);
|
|
23391
23410
|
if (body.length)
|
|
23392
|
-
await handle.read(body, 0, body.length,
|
|
23393
|
-
const range2 = size2 === 0 ? `bytes */0` : `bytes ${
|
|
23411
|
+
await handle.read(body, 0, body.length, offset);
|
|
23412
|
+
const range2 = size2 === 0 ? `bytes */0` : `bytes ${offset}-${end - 1}/${size2}`;
|
|
23394
23413
|
let response;
|
|
23395
23414
|
try {
|
|
23396
23415
|
response = await input.request({
|
|
@@ -23407,7 +23426,7 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
|
|
|
23407
23426
|
break;
|
|
23408
23427
|
}
|
|
23409
23428
|
if (response?.status === 308) {
|
|
23410
|
-
|
|
23429
|
+
offset = nextByte(response);
|
|
23411
23430
|
failures = 0;
|
|
23412
23431
|
continue;
|
|
23413
23432
|
}
|
|
@@ -23433,7 +23452,7 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
|
|
|
23433
23452
|
if (answer && done(answer.status))
|
|
23434
23453
|
finished = answer;
|
|
23435
23454
|
else if (answer?.status === 308)
|
|
23436
|
-
|
|
23455
|
+
offset = nextByte(answer);
|
|
23437
23456
|
}
|
|
23438
23457
|
} finally {
|
|
23439
23458
|
await handle.close();
|
|
@@ -23567,7 +23586,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23567
23586
|
}, "output");
|
|
23568
23587
|
const signal = /* @__PURE__ */ __name(() => environment().signal, "signal");
|
|
23569
23588
|
const signedIn = /* @__PURE__ */ __name(async (name, scope2) => {
|
|
23570
|
-
const { authorizedClient, checkAuthorization } = await import("./tokens-
|
|
23589
|
+
const { authorizedClient, checkAuthorization } = await import("./tokens-AF7QOFOF.js");
|
|
23571
23590
|
const client = authorizedClient(env, name, environment().keyring, signal());
|
|
23572
23591
|
await checkAuthorization(client, scope2);
|
|
23573
23592
|
return client;
|
|
@@ -23577,7 +23596,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23577
23596
|
const fake = environment().source;
|
|
23578
23597
|
if (fake)
|
|
23579
23598
|
return fake(name);
|
|
23580
|
-
const [{ googleSource }, client] = await Promise.all([import("./google-
|
|
23599
|
+
const [{ googleSource }, client] = await Promise.all([import("./google-22NXXJX5.js"), signedIn(name)]);
|
|
23581
23600
|
return googleSource(client);
|
|
23582
23601
|
}, "source");
|
|
23583
23602
|
const withIndex = /* @__PURE__ */ __name(async (fn, profile) => {
|
|
@@ -23651,11 +23670,10 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23651
23670
|
installStoreCommands(program, context);
|
|
23652
23671
|
installDocumentCommands(program, context);
|
|
23653
23672
|
installSearchCommand(program, context);
|
|
23654
|
-
installCatalogCommands(program, { env, selected, output,
|
|
23673
|
+
installCatalogCommands(program, { env, selected, output, withIndex });
|
|
23655
23674
|
installKnowledgeCommands(program, {
|
|
23656
23675
|
document: imported,
|
|
23657
23676
|
output,
|
|
23658
|
-
positive,
|
|
23659
23677
|
complete: /* @__PURE__ */ __name(() => environment().complete ?? memoryModel(env, selected(), signal()), "complete"),
|
|
23660
23678
|
author: /* @__PURE__ */ __name(() => agent() ? { bot: MCP_AGENT, kind: "agent" } : "owner", "author"),
|
|
23661
23679
|
decider: /* @__PURE__ */ __name(() => agent() ? { bot: MCP_AGENT, reason: "asked over drive's MCP server" } : "owner", "decider"),
|
|
@@ -23683,7 +23701,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23683
23701
|
},
|
|
23684
23702
|
stored: storedDocument(context),
|
|
23685
23703
|
output,
|
|
23686
|
-
positive,
|
|
23704
|
+
positive: positive2,
|
|
23687
23705
|
readBody: /* @__PURE__ */ __name((path) => {
|
|
23688
23706
|
const fake = environment().readBody;
|
|
23689
23707
|
if (fake)
|
|
@@ -23722,7 +23740,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23722
23740
|
if (fake)
|
|
23723
23741
|
return await fake.call(method, params, body);
|
|
23724
23742
|
const [{ googleApi }, client] = await Promise.all([
|
|
23725
|
-
import("./google-api-
|
|
23743
|
+
import("./google-api-VCDBSNOW.js"),
|
|
23726
23744
|
signedIn(selected(), descriptor.scope)
|
|
23727
23745
|
]);
|
|
23728
23746
|
return await googleApi(client).call(method, params, body);
|
|
@@ -23748,7 +23766,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23748
23766
|
if (fake)
|
|
23749
23767
|
return fake(id, mime);
|
|
23750
23768
|
const [{ googleDownload }, client] = await Promise.all([
|
|
23751
|
-
import("./google-api-
|
|
23769
|
+
import("./google-api-VCDBSNOW.js"),
|
|
23752
23770
|
signedIn(selected(), apiMethod(method).scope)
|
|
23753
23771
|
]);
|
|
23754
23772
|
return googleDownload(client)(id, mime);
|
|
@@ -23766,7 +23784,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23766
23784
|
let request = environment().uploadRequest;
|
|
23767
23785
|
if (!request) {
|
|
23768
23786
|
const [{ googleUploadRequest }, client] = await Promise.all([
|
|
23769
|
-
import("./google-api-
|
|
23787
|
+
import("./google-api-VCDBSNOW.js"),
|
|
23770
23788
|
signedIn(selected(), apiMethod(method).scope)
|
|
23771
23789
|
]);
|
|
23772
23790
|
request = googleUploadRequest(client);
|
|
@@ -23979,7 +23997,7 @@ var mcpCommand = /* @__PURE__ */ __name(() => {
|
|
|
23979
23997
|
const environment = environmentOf(action);
|
|
23980
23998
|
if (environment.api)
|
|
23981
23999
|
return;
|
|
23982
|
-
const { grantAvailability } = await import("./grants-
|
|
24000
|
+
const { grantAvailability } = await import("./grants-MQMTVCRQ.js");
|
|
23983
24001
|
availability = grantAvailability(rootOf(root), environment.env ?? process.env, environment.keyring);
|
|
23984
24002
|
});
|
|
23985
24003
|
}, "mcpCommand");
|