@wirecat/drive-cli 0.71.0 → 0.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -71
- package/contracts/wirecat.json +77 -8
- package/dist/bin/drive.js +2 -2
- package/dist/bundle/agent-23OB2NZP.js +46 -0
- package/dist/bundle/{all-profiles-3QJG2NAN.js → all-profiles-GXGDVNQJ.js} +67 -25
- package/dist/bundle/{anthropic-PSWTEU6G.js → anthropic-H5C4GQHC.js} +9 -9
- package/dist/bundle/{app-server-PVTA6ABR.js → app-server-EQ3UK4C7.js} +97 -79
- package/dist/bundle/{bun-LU5LP3JI.js → bun-DTJVSRY3.js} +2 -2
- package/dist/bundle/{bun-sqlite-PYMKLBRU.js → bun-sqlite-JIFY7MAE.js} +9 -9
- package/dist/bundle/chunk-2Q325BBD.js +353 -0
- package/dist/bundle/chunk-35FIJGTT.js +52 -0
- package/dist/bundle/{chunk-RWDKMU74.js → chunk-3FRQ6V4T.js} +3 -3
- package/dist/bundle/chunk-47L262VI.js +340 -0
- package/dist/bundle/chunk-4HP6KGBI.js +32 -0
- package/dist/bundle/{chunk-YVI5SQPY.js → chunk-4HPXWYTE.js} +1 -1
- package/dist/bundle/{chunk-QETR5HIZ.js → chunk-4IUNYYYL.js} +4385 -2684
- package/dist/bundle/{chunk-I4RWW3UD.js → chunk-4JS32SRX.js} +20 -5
- package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
- package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
- package/dist/bundle/{chunk-3N2OFXB5.js → chunk-55FH6IEL.js} +5 -5
- package/dist/bundle/{chunk-6TNNT2MQ.js → chunk-5BNMWSU2.js} +483 -176
- package/dist/bundle/{chunk-6XFIITOG.js → chunk-5H747A76.js} +5532 -3265
- package/dist/bundle/{chunk-MNLL5YLM.js → chunk-5KWCO56H.js} +2 -2
- package/dist/bundle/{chunk-GZ2D4KXG.js → chunk-5U3NCE5R.js} +35 -12
- package/dist/bundle/{chunk-CJLVYIOP.js → chunk-6CCO3JCM.js} +30 -21
- package/dist/bundle/{chunk-26DHFMGZ.js → chunk-6ZW2ZJYC.js} +2 -2
- package/dist/bundle/{chunk-COJSWDNU.js → chunk-75DAHQOV.js} +3 -3
- package/dist/bundle/{chunk-Q7DOMFJ4.js → chunk-77OBW43F.js} +6 -6
- package/dist/bundle/{chunk-FCS26CYQ.js → chunk-7EFM6AW3.js} +4 -4
- package/dist/bundle/{chunk-XMMFBPGC.js → chunk-A3S7QM5L.js} +3 -3
- package/dist/bundle/{chunk-ASMMG72J.js → chunk-AA4LKC6W.js} +244 -565
- package/dist/bundle/chunk-ASTKHB6B.js +3233 -0
- package/dist/bundle/{chunk-LXKYKRHD.js → chunk-BM6V7456.js} +8 -227
- package/dist/bundle/chunk-BO6EDBYJ.js +50 -0
- package/dist/bundle/{chunk-YPFWNVHV.js → chunk-BPA3R4KN.js} +2 -100
- package/dist/bundle/chunk-CIFE4KPX.js +2159 -0
- package/dist/bundle/chunk-CKB4XZZJ.js +730 -0
- package/dist/bundle/{chunk-RJOQH5YY.js → chunk-COJTCEZP.js} +111 -859
- package/dist/bundle/{chunk-FJH7DJWK.js → chunk-CWPYDT73.js} +6 -6
- package/dist/bundle/{chunk-BKSQBBYG.js → chunk-D4JNCXS7.js} +9 -9
- package/dist/bundle/chunk-DCPWZIOV.js +696 -0
- package/dist/bundle/{chunk-PRW6SYA3.js → chunk-DHMNCOQI.js} +313 -257
- package/dist/bundle/chunk-DOQMH4DC.js +280 -0
- package/dist/bundle/chunk-DQSOYH6N.js +20 -0
- package/dist/bundle/{chunk-YJIGGUPI.js → chunk-DWRUOLBF.js} +4 -4
- package/dist/bundle/{chunk-6W763DZN.js → chunk-E3VWZC3K.js} +14 -13
- package/dist/bundle/chunk-ECYOTDJM.js +14 -0
- package/dist/bundle/{chunk-KGYVHPGE.js → chunk-EVG3AA5M.js} +2 -2
- package/dist/bundle/chunk-F4BX7TH2.js +15 -0
- package/dist/bundle/{chunk-Y2NWGNUB.js → chunk-FBEZSA76.js} +5 -5
- package/dist/bundle/{chunk-2BVVU7GG.js → chunk-FBQJN74J.js} +1 -1
- package/dist/bundle/{chunk-Z56QFOBR.js → chunk-FIZOPJYY.js} +1 -1
- package/dist/bundle/chunk-FNAYSZWK.js +783 -0
- package/dist/bundle/{chunk-GPQ44Y2R.js → chunk-FRCJHGZM.js} +2 -2
- package/dist/bundle/{chunk-35SCQ4VI.js → chunk-FTG5QBSD.js} +41 -33
- package/dist/bundle/{chunk-KYKW2W6X.js → chunk-FUDUXIVG.js} +1 -1
- package/dist/bundle/{chunk-NYECVHFH.js → chunk-G4NHRFS7.js} +755 -0
- package/dist/bundle/{chunk-FT3LN3HP.js → chunk-GIEZYBRC.js} +1 -1
- package/dist/bundle/chunk-GTPPUBYU.js +1876 -0
- package/dist/bundle/chunk-GU6ICH53.js +108 -0
- package/dist/bundle/{chunk-ACUAV6VX.js → chunk-GUMKKRE6.js} +107 -71
- package/dist/bundle/{chunk-KGERXYTV.js → chunk-GWCDOYSC.js} +1 -1
- package/dist/bundle/{chunk-OJSBWP3F.js → chunk-GXGSC622.js} +69 -7
- package/dist/bundle/chunk-HAGXTGJC.js +188 -0
- package/dist/bundle/{chunk-XF4EXO2C.js → chunk-IMAWQC5K.js} +6 -6
- package/dist/bundle/{chunk-HKY7X6NY.js → chunk-IVGVVSPW.js} +4 -4
- package/dist/bundle/{chunk-P7CUM5IB.js → chunk-J4NUHSM7.js} +1 -1
- package/dist/bundle/{chunk-MIA7P6FZ.js → chunk-K652FYCO.js} +6 -6
- package/dist/bundle/chunk-K6ZWNTXY.js +561 -0
- package/dist/bundle/{chunk-COOOO5B3.js → chunk-KF3ZBQJV.js} +4 -4
- package/dist/bundle/chunk-KFZCHJRT.js +80 -0
- package/dist/bundle/chunk-KLPFDFLI.js +221 -0
- package/dist/bundle/{chunk-EOEU3AZN.js → chunk-KP2XMCNT.js} +13 -13
- package/dist/bundle/{chunk-FP54WSIR.js → chunk-KWDZ3KVH.js} +4 -4
- package/dist/bundle/{chunk-QNRRK3CN.js → chunk-KX4C32WD.js} +2 -2
- package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
- package/dist/bundle/{chunk-2LHAVY4U.js → chunk-M2ZWYVWO.js} +1 -1
- package/dist/bundle/chunk-MEYYH47C.js +25 -0
- package/dist/bundle/{chunk-3EBBLKIT.js → chunk-ML2QIWX2.js} +4 -4
- package/dist/bundle/{chunk-ZM63SUHG.js → chunk-MUFF2YTH.js} +2 -2
- package/dist/bundle/{chunk-2PUNKUYJ.js → chunk-N24YSLED.js} +9150 -9869
- package/dist/bundle/chunk-N4GTCPML.js +7 -0
- package/dist/bundle/{chunk-B5KSXHJ7.js → chunk-NBMGDRP4.js} +1 -1
- package/dist/bundle/chunk-NMQRSEZM.js +37 -0
- package/dist/bundle/{chunk-JDV7HNNQ.js → chunk-NNGA4QDR.js} +13 -26
- package/dist/bundle/{chunk-5DPV7X27.js → chunk-NTZWY5R3.js} +321 -0
- package/dist/bundle/chunk-O7CZZ36M.js +80 -0
- package/dist/bundle/{chunk-ICDCAQ6K.js → chunk-OAONP6KI.js} +13 -9
- package/dist/bundle/{chunk-WVDCCYS3.js → chunk-OESP4PHB.js} +17 -17
- package/dist/bundle/chunk-OHR6IZNH.js +116 -0
- package/dist/bundle/{chunk-4QNW4NK6.js → chunk-OLCU7Q2B.js} +1 -1
- package/dist/bundle/{chunk-SDKQNOL5.js → chunk-OLDQLEPA.js} +6 -6
- package/dist/bundle/{chunk-ZCR3IRZ2.js → chunk-OPIPG6AP.js} +16 -9
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/chunk-PRYMT3OG.js +30 -0
- package/dist/bundle/chunk-QDUIVMEW.js +36 -0
- package/dist/bundle/{chunk-ZZ32DXTH.js → chunk-QKBPCX7Y.js} +1 -1
- package/dist/bundle/{chunk-QXC6IEH6.js → chunk-QSLOACDT.js} +201 -423
- package/dist/bundle/{chunk-7PDHGZN4.js → chunk-QUZFDU4K.js} +4 -4
- package/dist/bundle/{chunk-3UGYFXH6.js → chunk-R32DHS6J.js} +187 -379
- package/dist/bundle/{chunk-6SJOTNHF.js → chunk-R57QUYBG.js} +6 -28
- package/dist/bundle/{chunk-UTO2GO4P.js → chunk-R64OSDOD.js} +45 -66
- package/dist/bundle/{chunk-GBKNJWOZ.js → chunk-RSPBVKOC.js} +8 -8
- package/dist/bundle/{chunk-HL52XXZX.js → chunk-SPNPJ3FZ.js} +3 -4
- package/dist/bundle/chunk-SQHDSIFL.js +388 -0
- package/dist/bundle/{chunk-YPNWIB6H.js → chunk-ST35FIUG.js} +3 -3
- package/dist/bundle/{chunk-37MAA6F2.js → chunk-STUPCKAA.js} +11 -2221
- package/dist/bundle/chunk-SZ7XJZGH.js +2231 -0
- package/dist/bundle/chunk-TRYYWV7J.js +291 -0
- package/dist/bundle/{chunk-X4TIMMKJ.js → chunk-TTPWKTVR.js} +1 -1
- package/dist/bundle/{chunk-TAFHYHKA.js → chunk-U7VEJ3CW.js} +45 -27
- package/dist/bundle/{chunk-6Y2BYFXQ.js → chunk-UC7JLE6J.js} +0 -7
- package/dist/bundle/{chunk-4HWJOU7N.js → chunk-UIQ35CA5.js} +1 -1
- package/dist/bundle/{chunk-SAKO3P4H.js → chunk-UJY26HW4.js} +1 -1
- package/dist/bundle/{chunk-D5TGYUVU.js → chunk-UWG3PRY7.js} +9 -60
- package/dist/bundle/{chunk-JZHBZOJR.js → chunk-VAR3MJU6.js} +3 -3
- package/dist/bundle/{chunk-GOWXXYEF.js → chunk-VPQSI5IU.js} +4 -4
- package/dist/bundle/{chunk-QFR2PNJN.js → chunk-VQPT3Y7W.js} +12 -12
- package/dist/bundle/{chunk-Z3KUSRCF.js → chunk-WMG3H2VK.js} +2 -2
- package/dist/bundle/{chunk-4PA4DHYV.js → chunk-X5BGAZC5.js} +6 -6
- package/dist/bundle/{chunk-2UUWXPOB.js → chunk-XC6TRWLZ.js} +3 -3
- package/dist/bundle/{chunk-OF422U5D.js → chunk-XQZEMRCU.js} +402 -402
- package/dist/bundle/{chunk-72C4YOCH.js → chunk-XZ7MO6EU.js} +7 -7
- package/dist/bundle/{chunk-SERXSCN3.js → chunk-YAIOEPKU.js} +337 -390
- package/dist/bundle/chunk-YHWFF6DN.js +39 -0
- package/dist/bundle/{chunk-RESDD3Q4.js → chunk-YWOLQEDV.js} +16 -3
- package/dist/bundle/{chunk-YMJ6IDGT.js → chunk-ZFDSJ5YJ.js} +38 -8
- package/dist/bundle/{chunk-HMS6EEQL.js → chunk-ZFUZEFU6.js} +3 -3
- package/dist/bundle/{chunk-TAUBRNC5.js → chunk-ZJKXSMXK.js} +72 -59
- package/dist/bundle/{chunk-22QQUKWA.js → chunk-ZKWT6HXT.js} +1 -1
- package/dist/bundle/chunk-ZPUY3COZ.js +250 -0
- package/dist/bundle/{cli-556DERZL.js → cli-2P5FW2RL.js} +201 -98
- package/dist/bundle/command-contract-BMQT2G5X.js +45 -0
- package/dist/bundle/{command-server-entry-AYLGNZWD.js → command-server-entry-KP2UDGLA.js} +36 -34
- package/dist/bundle/{decode-QU24MWMN.js → decode-K2JZ5D6V.js} +10 -10
- package/dist/bundle/{dispatch-4KODNOXV.js → dispatch-KOQZA74A.js} +10 -10
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/drive.js +11 -11
- package/dist/bundle/{echarts-BXX4OQWC.js → echarts-URO3QGCG.js} +2 -2
- package/dist/bundle/{embed-KG27KG3D.js → embed-JLIPWTNN.js} +10 -10
- package/dist/bundle/{embedder-IPAVUQUV.js → embedder-LUTDO3HS.js} +15 -15
- package/dist/bundle/entry-AVF6LMG7.js +25 -0
- package/dist/bundle/{failure-ESL7ETL4.js → failure-GJMQLM7O.js} +4 -4
- package/dist/bundle/first-run-VYTIEUDA.js +31 -0
- package/dist/bundle/first-screen-QVZPF7KL.js +45 -0
- package/dist/bundle/google-VX7IPACN.js +46 -0
- package/dist/bundle/{google-api-VCDBSNOW.js → google-api-RFXKRLL4.js} +88 -73
- package/dist/bundle/grants-4XWJFVD6.js +133 -0
- package/dist/bundle/hast-util-from-html-X2DCPS3T.js +10531 -0
- package/dist/bundle/hast-util-to-html-VP6XLPKJ.js +998 -0
- package/dist/bundle/hast-util-to-mdast-IZ5PRX72.js +2272 -0
- package/dist/bundle/{identity-LOWMVGZY.js → identity-FXPB5EMT.js} +7 -6
- package/dist/bundle/{instructions-2VECIDXF.js → instructions-IROIUVZI.js} +1 -1
- package/dist/bundle/{login-7GBONT7V.js → login-WIY5VQU7.js} +96 -81
- package/dist/bundle/{mcp-O6ACR2DX.js → mcp-NJIOKW3E.js} +2 -2
- package/dist/bundle/{mdast-util-from-markdown-FXEPSNER.js → mdast-util-from-markdown-HEZF7KJ4.js} +137 -195
- package/dist/bundle/mdast-util-gfm-AQW6R6MG.js +925 -0
- package/dist/bundle/mdast-util-to-hast-DF2QVIRV.js +879 -0
- package/dist/bundle/mdast-util-to-markdown-XYLXB3Z3.js +18 -0
- package/dist/bundle/meeting-combined-JUNV35GM.js +28 -0
- package/dist/bundle/meeting-model-XY4UNWWK.js +29 -0
- package/dist/bundle/{meeting-semantic-G7PFOKU7.js → meeting-semantic-62QNQMOM.js} +10 -10
- package/dist/bundle/{micromark-extension-gfm-GRL24TU6.js → micromark-extension-gfm-OE2GBORZ.js} +11 -78
- package/dist/bundle/{node-MPEQSFI3.js → node-IACCI2CW.js} +2 -2
- package/dist/bundle/{node-sqlite-OLQMAYB4.js → node-sqlite-WYIRC7C7.js} +10 -10
- package/dist/bundle/notes-search-DEDUJKSN.js +70 -0
- package/dist/bundle/oauth-HXBXF4VI.js +22 -0
- package/dist/bundle/{open-OXTE672W.js → open-H32B6BCT.js} +8 -8
- package/dist/bundle/{openai-EB3TPIZY.js → openai-VHMPJJUG.js} +22 -21
- package/dist/bundle/{process-F6TKXWWA.js → process-RNHPF5OK.js} +1 -1
- package/dist/bundle/{program-4IFDZ7FM.js → program-GYMJ3DDH.js} +275 -1148
- package/dist/bundle/{prompt-F5RRHPN2.js → prompt-TOG2CRCE.js} +8 -8
- package/dist/bundle/{reasons-UORHJDHK.js → reasons-TLFQ45YX.js} +6 -5
- package/dist/bundle/{recognize-DAVNZND3.js → recognize-GYGY45EY.js} +7 -7
- package/dist/bundle/remote-6XN2QLI5.js +35 -0
- package/dist/bundle/{rerank-CND2GVLZ.js → rerank-HJO3O4TW.js} +11 -11
- package/dist/bundle/{serve-ZHSPUIGX.js → serve-XPCNLHCR.js} +19 -19
- package/dist/bundle/server-UBJZ66XE.js +97 -0
- package/dist/bundle/{server-YMAK4LHC.js → server-WPT3NC5B.js} +89 -70
- package/dist/bundle/{services-ZILSFJ6E.js → services-253KKKVU.js} +109 -89
- package/dist/bundle/{sqlite-runtime-S5VPMZQH.js → sqlite-runtime-EZASGJXW.js} +9 -9
- package/dist/bundle/{start-CR6X25RT.js → start-UHI35JFL.js} +7 -7
- package/dist/bundle/{state-YFPHVIIJ.js → state-KJTSPFGK.js} +9 -9
- package/dist/bundle/{store-UODRT6X4.js → store-62J2H2A3.js} +36 -25
- package/dist/bundle/{store-CL4ZJZRI.js → store-G5B7T7M7.js} +38 -23
- package/dist/bundle/store-maintenance-command-C6T4YLVF.js +85 -0
- package/dist/bundle/surface-3OT64BHS.js +83 -0
- package/dist/bundle/tokens-EHYO6D2X.js +133 -0
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +11 -1
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/remote.d.ts.map +1 -1
- package/dist/commands/remote.js +8 -22
- package/dist/commands/remote.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +14 -4
- package/dist/commands/sync.js.map +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -1
- package/dist/first-screen.d.ts.map +1 -1
- package/dist/first-screen.js +2 -1
- package/dist/first-screen.js.map +1 -1
- package/dist/generated/manifest.d.ts +2 -1
- package/dist/generated/manifest.d.ts.map +1 -1
- package/dist/generated/manifest.js +782 -0
- package/dist/generated/manifest.js.map +1 -1
- package/dist/generated/types.d.ts +262 -58
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/google.d.ts.map +1 -1
- package/dist/google.js +5 -5
- package/dist/google.js.map +1 -1
- package/dist/model.d.ts +5 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js.map +1 -1
- package/dist/policy-keys.js +1 -1
- package/dist/policy-keys.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +9 -4
- package/dist/program.js.map +1 -1
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +6 -1
- package/dist/state.js.map +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +2 -7
- package/dist/store.js.map +1 -1
- package/dist/supported.d.ts +2 -2
- package/dist/supported.d.ts.map +1 -1
- package/dist/supported.js +2 -3
- package/dist/supported.js.map +1 -1
- package/dist/sync.d.ts +2 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +5 -2
- package/dist/sync.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/scenarios/find-decision.md +1 -1
- package/skills/drive-cli/SKILL.md +4 -2
- package/dist/bundle/chunk-J5Q5FS2N.js +0 -593
- package/dist/bundle/chunk-L46C6HQ7.js +0 -729
- package/dist/bundle/chunk-UDMNY63V.js +0 -899
- package/dist/bundle/chunk-VKE77B3F.js +0 -2
- package/dist/bundle/command-contract-VRTOAV6W.js +0 -43
- package/dist/bundle/entry-MVXQETWS.js +0 -25
- package/dist/bundle/first-run-4UVLW2WR.js +0 -31
- package/dist/bundle/first-screen-JAKAIINI.js +0 -41
- package/dist/bundle/google-22NXXJX5.js +0 -45
- package/dist/bundle/grants-MQMTVCRQ.js +0 -118
- package/dist/bundle/mdast-util-gfm-SZM5GBDF.js +0 -2103
- package/dist/bundle/meeting-combined-LVP4AZKA.js +0 -27
- package/dist/bundle/meeting-model-RAY5XDXZ.js +0 -29
- package/dist/bundle/oauth-SGH2I2BY.js +0 -22
- package/dist/bundle/remote-D5EYYIAU.js +0 -35
- package/dist/bundle/server-DUVJWP3Q.js +0 -80
- package/dist/bundle/store-maintenance-command-DY5XIBWR.js +0 -72
- package/dist/bundle/tokens-AF7QOFOF.js +0 -118
|
@@ -10,8 +10,18 @@ import {
|
|
|
10
10
|
describeDriveProgram,
|
|
11
11
|
examples,
|
|
12
12
|
markProfileFree
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3FRQ6V4T.js";
|
|
14
14
|
import {
|
|
15
|
+
apiMethod,
|
|
16
|
+
apiMethods,
|
|
17
|
+
jsonObject,
|
|
18
|
+
operationOf,
|
|
19
|
+
schemas,
|
|
20
|
+
validateApiParams,
|
|
21
|
+
validateRequest
|
|
22
|
+
} from "./chunk-R57QUYBG.js";
|
|
23
|
+
import {
|
|
24
|
+
CATALOG_FIELDS,
|
|
15
25
|
DEFAULTS_ONLY,
|
|
16
26
|
DEFAULT_LEVELS,
|
|
17
27
|
FILES_QUERY,
|
|
@@ -20,6 +30,14 @@ import {
|
|
|
20
30
|
SETTING_NAMES,
|
|
21
31
|
TRANSCRIPTS_QUERY,
|
|
22
32
|
activeProfile,
|
|
33
|
+
addDocumentCatalogCommands,
|
|
34
|
+
addDocumentFolderCommands,
|
|
35
|
+
addDocumentHistoryCommands,
|
|
36
|
+
addDocumentKnowledgeCommands,
|
|
37
|
+
addDocumentMirrorCommands,
|
|
38
|
+
addDocumentSearchCommand,
|
|
39
|
+
addDocumentSyncCommands,
|
|
40
|
+
addLocalDocumentCommands,
|
|
23
41
|
application,
|
|
24
42
|
bindQuery,
|
|
25
43
|
checkAddProfiles,
|
|
@@ -29,12 +47,15 @@ import {
|
|
|
29
47
|
configuration,
|
|
30
48
|
configuredSessions,
|
|
31
49
|
driveFileQuery,
|
|
50
|
+
factItem,
|
|
32
51
|
fileId,
|
|
33
52
|
fileRow,
|
|
34
53
|
findTranscripts,
|
|
35
54
|
googleAppOf,
|
|
36
55
|
inspectConfig,
|
|
56
|
+
keepVersions,
|
|
37
57
|
maxAddProfiles,
|
|
58
|
+
memoryItem,
|
|
38
59
|
methodPolicyKeys,
|
|
39
60
|
oauthClientReport,
|
|
40
61
|
paths,
|
|
@@ -56,11 +77,14 @@ import {
|
|
|
56
77
|
unknownProfile,
|
|
57
78
|
withDefaults,
|
|
58
79
|
writeConfig
|
|
59
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-ASTKHB6B.js";
|
|
81
|
+
import {
|
|
82
|
+
operations
|
|
83
|
+
} from "./chunk-G4NHRFS7.js";
|
|
60
84
|
import {
|
|
61
85
|
MAX_ENTRIES,
|
|
62
86
|
supported
|
|
63
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-A3S7QM5L.js";
|
|
64
88
|
import {
|
|
65
89
|
DOC,
|
|
66
90
|
DOCUMENT_LIST_FIELDS,
|
|
@@ -71,43 +95,28 @@ import {
|
|
|
71
95
|
diffBlocks,
|
|
72
96
|
documentIngestion,
|
|
73
97
|
documentKnowledge,
|
|
74
|
-
extractDocumentMemories,
|
|
75
98
|
fileMirrorState,
|
|
76
99
|
markdownBlocks,
|
|
77
100
|
mergeBlocks,
|
|
78
101
|
metadataJson,
|
|
79
|
-
mirrorId,
|
|
80
|
-
mirrorStatus,
|
|
81
102
|
normalizeInlines,
|
|
82
103
|
spliceMarkdown,
|
|
83
|
-
syncDocuments
|
|
84
|
-
|
|
85
|
-
watchMirrors
|
|
86
|
-
} from "./chunk-6TNNT2MQ.js";
|
|
87
|
-
import {
|
|
88
|
-
apiMethod,
|
|
89
|
-
apiMethods,
|
|
90
|
-
jsonObject,
|
|
91
|
-
operationOf,
|
|
92
|
-
schemas,
|
|
93
|
-
validateApiParams,
|
|
94
|
-
validateRequest
|
|
95
|
-
} from "./chunk-6SJOTNHF.js";
|
|
104
|
+
syncDocuments
|
|
105
|
+
} from "./chunk-5BNMWSU2.js";
|
|
96
106
|
import {
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
googleError,
|
|
108
|
+
offlineRefused
|
|
109
|
+
} from "./chunk-FBQJN74J.js";
|
|
99
110
|
import {
|
|
100
111
|
DISCOVERY_DESCRIPTIONS,
|
|
101
112
|
MEMO_SCENARIOS,
|
|
102
113
|
accountRemoveCommand,
|
|
114
|
+
actorOf,
|
|
103
115
|
addContractInfo,
|
|
104
116
|
answerFields,
|
|
105
|
-
apiPlainJson,
|
|
106
117
|
appCompleteCommand,
|
|
107
118
|
appDoctorCommand,
|
|
108
119
|
appMcpCommand,
|
|
109
|
-
checkApiBody,
|
|
110
|
-
checkApiParameter,
|
|
111
120
|
checkJson,
|
|
112
121
|
commandRuns,
|
|
113
122
|
commandsText,
|
|
@@ -115,83 +124,90 @@ import {
|
|
|
115
124
|
entityFields,
|
|
116
125
|
generatedApiCommand,
|
|
117
126
|
guideCommand,
|
|
118
|
-
honoursDryRun,
|
|
119
|
-
identifier,
|
|
120
127
|
inSection,
|
|
121
128
|
modelCatalogueCommand,
|
|
122
|
-
parseApiJson,
|
|
123
|
-
readApiBody,
|
|
124
129
|
run,
|
|
125
130
|
runsCommand,
|
|
126
131
|
sharedCommandTemplate,
|
|
127
132
|
signInSteps,
|
|
128
133
|
skillCommand,
|
|
129
134
|
upgradeCommand
|
|
130
|
-
} from "./chunk-
|
|
131
|
-
import
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
import "./chunk-
|
|
136
|
-
import "./chunk-
|
|
137
|
-
import "./chunk-
|
|
138
|
-
import "./chunk-
|
|
139
|
-
import "./chunk-
|
|
140
|
-
import "./chunk-HKY7X6NY.js";
|
|
135
|
+
} from "./chunk-5H747A76.js";
|
|
136
|
+
import "./chunk-GWCDOYSC.js";
|
|
137
|
+
import "./chunk-SPNPJ3FZ.js";
|
|
138
|
+
import "./chunk-FTG5QBSD.js";
|
|
139
|
+
import "./chunk-SQHDSIFL.js";
|
|
140
|
+
import "./chunk-E3VWZC3K.js";
|
|
141
|
+
import "./chunk-VQPT3Y7W.js";
|
|
142
|
+
import "./chunk-IVGVVSPW.js";
|
|
143
|
+
import "./chunk-BO6EDBYJ.js";
|
|
144
|
+
import "./chunk-R32DHS6J.js";
|
|
141
145
|
import {
|
|
142
146
|
storeInfo
|
|
143
|
-
} from "./chunk-
|
|
144
|
-
import "./chunk-
|
|
145
|
-
import "./chunk-
|
|
146
|
-
import "./chunk-
|
|
147
|
-
import "./chunk-
|
|
147
|
+
} from "./chunk-GUMKKRE6.js";
|
|
148
|
+
import "./chunk-OAONP6KI.js";
|
|
149
|
+
import "./chunk-U7VEJ3CW.js";
|
|
150
|
+
import "./chunk-2Q325BBD.js";
|
|
151
|
+
import "./chunk-YWOLQEDV.js";
|
|
152
|
+
import "./chunk-47L262VI.js";
|
|
153
|
+
import "./chunk-KFZCHJRT.js";
|
|
148
154
|
import {
|
|
149
|
-
LIST_QUERY_GUIDE,
|
|
150
155
|
RecipientList,
|
|
151
156
|
SendJournal,
|
|
152
|
-
|
|
153
|
-
|
|
157
|
+
apiPlainJson,
|
|
158
|
+
checkApiBody,
|
|
159
|
+
checkApiParameter,
|
|
160
|
+
identifier,
|
|
154
161
|
newOperationId,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
sendGuard
|
|
158
|
-
|
|
159
|
-
typedQuery,
|
|
160
|
-
unfilteredQuery,
|
|
161
|
-
withQuery
|
|
162
|
-
} from "./chunk-2PUNKUYJ.js";
|
|
162
|
+
parseApiJson,
|
|
163
|
+
readApiBody,
|
|
164
|
+
sendGuard
|
|
165
|
+
} from "./chunk-N24YSLED.js";
|
|
163
166
|
import {
|
|
164
167
|
columnName,
|
|
165
|
-
modelGateway,
|
|
166
168
|
readSpreadsheet
|
|
167
|
-
} from "./chunk-
|
|
168
|
-
import "./chunk-
|
|
169
|
-
import "./chunk-Q7DOMFJ4.js";
|
|
170
|
-
import "./chunk-LXKYKRHD.js";
|
|
171
|
-
import "./chunk-COJSWDNU.js";
|
|
172
|
-
import "./chunk-D5TGYUVU.js";
|
|
173
|
-
import "./chunk-HTQTIKWP.js";
|
|
174
|
-
import "./chunk-6W763DZN.js";
|
|
169
|
+
} from "./chunk-QSLOACDT.js";
|
|
170
|
+
import "./chunk-NNGA4QDR.js";
|
|
175
171
|
import {
|
|
176
172
|
latestVersion,
|
|
177
173
|
runUpdate,
|
|
178
174
|
updateNotice
|
|
179
|
-
} from "./chunk-
|
|
180
|
-
import "./chunk-
|
|
181
|
-
import
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
} from "./chunk-KWDZ3KVH.js";
|
|
176
|
+
import "./chunk-4HPXWYTE.js";
|
|
177
|
+
import {
|
|
178
|
+
queryTerms,
|
|
179
|
+
termField,
|
|
180
|
+
typedQuery,
|
|
181
|
+
unfilteredQuery,
|
|
182
|
+
withQuery
|
|
183
|
+
} from "./chunk-CKB4XZZJ.js";
|
|
184
|
+
import "./chunk-CIFE4KPX.js";
|
|
185
|
+
import {
|
|
186
|
+
modelGateway
|
|
187
|
+
} from "./chunk-ZPUY3COZ.js";
|
|
188
|
+
import "./chunk-QDUIVMEW.js";
|
|
189
|
+
import "./chunk-PRYMT3OG.js";
|
|
190
|
+
import "./chunk-77OBW43F.js";
|
|
191
|
+
import "./chunk-KLPFDFLI.js";
|
|
192
|
+
import "./chunk-BM6V7456.js";
|
|
193
|
+
import "./chunk-75DAHQOV.js";
|
|
194
|
+
import "./chunk-UWG3PRY7.js";
|
|
195
|
+
import "./chunk-HTQTIKWP.js";
|
|
196
|
+
import "./chunk-OHR6IZNH.js";
|
|
197
|
+
import "./chunk-ML2QIWX2.js";
|
|
198
|
+
import "./chunk-FBEZSA76.js";
|
|
199
|
+
import "./chunk-OLDQLEPA.js";
|
|
184
200
|
import {
|
|
185
201
|
applyDocumentTransfer,
|
|
186
202
|
previewDocumentTransfer
|
|
187
|
-
} from "./chunk-
|
|
188
|
-
import "./chunk-
|
|
189
|
-
import "./chunk-
|
|
190
|
-
import "./chunk-
|
|
191
|
-
import "./chunk-
|
|
192
|
-
import "./chunk-
|
|
193
|
-
import "./chunk-
|
|
194
|
-
import "./chunk-
|
|
203
|
+
} from "./chunk-OESP4PHB.js";
|
|
204
|
+
import "./chunk-R64OSDOD.js";
|
|
205
|
+
import "./chunk-NTZWY5R3.js";
|
|
206
|
+
import "./chunk-D4JNCXS7.js";
|
|
207
|
+
import "./chunk-J4NUHSM7.js";
|
|
208
|
+
import "./chunk-NBMGDRP4.js";
|
|
209
|
+
import "./chunk-FRCJHGZM.js";
|
|
210
|
+
import "./chunk-QUZFDU4K.js";
|
|
195
211
|
import {
|
|
196
212
|
CEILING_KEY,
|
|
197
213
|
FETCH,
|
|
@@ -211,10 +227,8 @@ import {
|
|
|
211
227
|
fetchesOnly,
|
|
212
228
|
flatten,
|
|
213
229
|
grantsAuthority,
|
|
214
|
-
guardedWrite,
|
|
215
230
|
hasSharedContract,
|
|
216
231
|
itemOf,
|
|
217
|
-
jsonlRecords,
|
|
218
232
|
layerPermissions,
|
|
219
233
|
levelFor,
|
|
220
234
|
listOf,
|
|
@@ -226,94 +240,82 @@ import {
|
|
|
226
240
|
renderAnswer,
|
|
227
241
|
resolveAISettings,
|
|
228
242
|
rootOf,
|
|
229
|
-
runBudgetOf,
|
|
230
243
|
settingRows,
|
|
231
|
-
sharedCommand,
|
|
232
244
|
sharedContracts,
|
|
233
245
|
snakeKeys
|
|
234
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-YAIOEPKU.js";
|
|
247
|
+
import "./chunk-XZ7MO6EU.js";
|
|
248
|
+
import {
|
|
249
|
+
setupPermissionCeiling
|
|
250
|
+
} from "./chunk-7EFM6AW3.js";
|
|
251
|
+
import "./chunk-FIZOPJYY.js";
|
|
252
|
+
import {
|
|
253
|
+
guardedWrite
|
|
254
|
+
} from "./chunk-HAGXTGJC.js";
|
|
235
255
|
import {
|
|
236
256
|
modelTarget
|
|
237
|
-
} from "./chunk-
|
|
238
|
-
import "./chunk-72C4YOCH.js";
|
|
257
|
+
} from "./chunk-4JS32SRX.js";
|
|
239
258
|
import {
|
|
240
259
|
readOnlyLockOf,
|
|
241
260
|
readOnlyRefusal
|
|
242
|
-
} from "./chunk-
|
|
243
|
-
import "./chunk-
|
|
244
|
-
import "./chunk-XF4EXO2C.js";
|
|
245
|
-
import {
|
|
246
|
-
setupPermissionCeiling
|
|
247
|
-
} from "./chunk-FCS26CYQ.js";
|
|
261
|
+
} from "./chunk-5KWCO56H.js";
|
|
262
|
+
import "./chunk-IMAWQC5K.js";
|
|
248
263
|
import {
|
|
249
264
|
hostFetch
|
|
250
|
-
} from "./chunk-
|
|
251
|
-
import
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
import "./chunk-
|
|
255
|
-
import "./chunk-YPNWIB6H.js";
|
|
256
|
-
import "./chunk-QNRRK3CN.js";
|
|
265
|
+
} from "./chunk-ZFDSJ5YJ.js";
|
|
266
|
+
import "./chunk-ZFUZEFU6.js";
|
|
267
|
+
import "./chunk-KF3ZBQJV.js";
|
|
268
|
+
import "./chunk-ST35FIUG.js";
|
|
269
|
+
import "./chunk-KX4C32WD.js";
|
|
257
270
|
import {
|
|
258
|
-
CATALOG_QUERY,
|
|
259
|
-
IMPORTED_DOCUMENT_QUERY,
|
|
260
271
|
openStore
|
|
261
|
-
} from "./chunk-
|
|
262
|
-
import "./chunk-
|
|
263
|
-
import "./chunk-
|
|
264
|
-
import "./chunk-
|
|
265
|
-
import "./chunk-
|
|
266
|
-
import "./chunk-
|
|
272
|
+
} from "./chunk-4IUNYYYL.js";
|
|
273
|
+
import "./chunk-VAR3MJU6.js";
|
|
274
|
+
import "./chunk-O7CZZ36M.js";
|
|
275
|
+
import "./chunk-DCPWZIOV.js";
|
|
276
|
+
import "./chunk-5U3NCE5R.js";
|
|
277
|
+
import "./chunk-OPIPG6AP.js";
|
|
278
|
+
import "./chunk-TTPWKTVR.js";
|
|
279
|
+
import "./chunk-X5BGAZC5.js";
|
|
280
|
+
import "./chunk-FNAYSZWK.js";
|
|
281
|
+
import "./chunk-UJY26HW4.js";
|
|
267
282
|
import {
|
|
268
|
-
FACT_STATUSES,
|
|
269
|
-
MEMORY_KINDS,
|
|
270
|
-
MEMORY_SCOPES,
|
|
271
|
-
MEMORY_STATUSES,
|
|
272
283
|
inRun
|
|
273
|
-
} from "./chunk-
|
|
274
|
-
import "./chunk-
|
|
275
|
-
import "./chunk-
|
|
276
|
-
import "./chunk-
|
|
284
|
+
} from "./chunk-COJTCEZP.js";
|
|
285
|
+
import "./chunk-6ZW2ZJYC.js";
|
|
286
|
+
import "./chunk-XC6TRWLZ.js";
|
|
287
|
+
import "./chunk-DHMNCOQI.js";
|
|
277
288
|
import {
|
|
278
|
-
FACT_TYPES
|
|
279
|
-
} from "./chunk-PRW6SYA3.js";
|
|
280
|
-
import {
|
|
281
|
-
defineQuery,
|
|
282
|
-
parseLucene,
|
|
283
|
-
queryError,
|
|
284
|
-
queryFieldsOf,
|
|
285
289
|
timezoneOf,
|
|
286
|
-
validateQuery,
|
|
287
290
|
zonedMoment
|
|
288
|
-
} from "./chunk-
|
|
289
|
-
import "./chunk-
|
|
290
|
-
import "./chunk-
|
|
291
|
+
} from "./chunk-XQZEMRCU.js";
|
|
292
|
+
import "./chunk-RSPBVKOC.js";
|
|
293
|
+
import "./chunk-GIEZYBRC.js";
|
|
291
294
|
import "./chunk-D72URWJE.js";
|
|
292
295
|
import {
|
|
293
296
|
installerOf
|
|
294
|
-
} from "./chunk-
|
|
297
|
+
} from "./chunk-QKBPCX7Y.js";
|
|
295
298
|
import {
|
|
296
299
|
DRIVE_APP,
|
|
297
300
|
PACKAGE,
|
|
298
301
|
VERSION
|
|
299
|
-
} from "./chunk-
|
|
302
|
+
} from "./chunk-MUFF2YTH.js";
|
|
300
303
|
import {
|
|
301
304
|
REASONS
|
|
302
|
-
} from "./chunk-
|
|
303
|
-
import "./chunk-
|
|
304
|
-
import "./chunk-
|
|
305
|
+
} from "./chunk-M2ZWYVWO.js";
|
|
306
|
+
import "./chunk-N4GTCPML.js";
|
|
307
|
+
import "./chunk-UIQ35CA5.js";
|
|
305
308
|
import {
|
|
306
309
|
storePath
|
|
307
|
-
} from "./chunk-
|
|
310
|
+
} from "./chunk-WMG3H2VK.js";
|
|
308
311
|
import {
|
|
309
312
|
processStreams,
|
|
310
313
|
saveConfigFile,
|
|
311
314
|
writeSecurely
|
|
312
|
-
} from "./chunk-
|
|
313
|
-
import "./chunk-
|
|
314
|
-
import "./chunk-
|
|
315
|
-
import "./chunk-
|
|
316
|
-
import "./chunk-KGYVHPGE.js";
|
|
315
|
+
} from "./chunk-6CCO3JCM.js";
|
|
316
|
+
import "./chunk-55FH6IEL.js";
|
|
317
|
+
import "./chunk-FUDUXIVG.js";
|
|
318
|
+
import "./chunk-EVG3AA5M.js";
|
|
317
319
|
import {
|
|
318
320
|
array,
|
|
319
321
|
boolean,
|
|
@@ -336,11 +338,12 @@ import {
|
|
|
336
338
|
string,
|
|
337
339
|
unknown,
|
|
338
340
|
writes
|
|
339
|
-
} from "./chunk-
|
|
341
|
+
} from "./chunk-GXGSC622.js";
|
|
340
342
|
import {
|
|
341
343
|
CliError,
|
|
342
344
|
isCliError
|
|
343
|
-
} from "./chunk-
|
|
345
|
+
} from "./chunk-OLCU7Q2B.js";
|
|
346
|
+
import "./chunk-Y5E2WNWB.js";
|
|
344
347
|
import {
|
|
345
348
|
__commonJS,
|
|
346
349
|
__name,
|
|
@@ -1905,12 +1908,12 @@ var require_adapter = __commonJS({
|
|
|
1905
1908
|
}
|
|
1906
1909
|
__name(createSyncFs, "createSyncFs");
|
|
1907
1910
|
function toPromise(method) {
|
|
1908
|
-
return (...args) => new Promise((
|
|
1911
|
+
return (...args) => new Promise((resolve6, reject) => {
|
|
1909
1912
|
args.push((err, result) => {
|
|
1910
1913
|
if (err) {
|
|
1911
1914
|
reject(err);
|
|
1912
1915
|
} else {
|
|
1913
|
-
|
|
1916
|
+
resolve6(result);
|
|
1914
1917
|
}
|
|
1915
1918
|
});
|
|
1916
1919
|
method(...args);
|
|
@@ -2058,7 +2061,12 @@ var State = object({
|
|
|
2058
2061
|
cursor: string(),
|
|
2059
2062
|
scope: string(),
|
|
2060
2063
|
folders: record(ID, File),
|
|
2061
|
-
jobs: array(object({
|
|
2064
|
+
jobs: array(object({
|
|
2065
|
+
id: ID,
|
|
2066
|
+
kind: picklist(["save", "remove"]),
|
|
2067
|
+
file: optional(File),
|
|
2068
|
+
reason: optional(picklist(["deleted", "unavailable", "unsynced"]))
|
|
2069
|
+
})),
|
|
2062
2070
|
skipped: array(Skip),
|
|
2063
2071
|
matched: optional(array(ID))
|
|
2064
2072
|
}))
|
|
@@ -2179,7 +2187,7 @@ var profileLocked2 = /* @__PURE__ */ __name((env, name) => import_proper_lockfil
|
|
|
2179
2187
|
var removal = {
|
|
2180
2188
|
signOut: /* @__PURE__ */ __name(async (profile, { env, keyring, mayRevoke }) => {
|
|
2181
2189
|
const storage = readConfig(env).profiles[profile]?.storage ?? "keyring";
|
|
2182
|
-
const { sessionKeeper } = await import("./tokens-
|
|
2190
|
+
const { sessionKeeper } = await import("./tokens-EHYO6D2X.js");
|
|
2183
2191
|
const { revoked } = await sessionKeeper({
|
|
2184
2192
|
env,
|
|
2185
2193
|
name: profile,
|
|
@@ -2200,901 +2208,6 @@ var installAccountCommands = /* @__PURE__ */ __name((program, _context) => {
|
|
|
2200
2208
|
annotate(program.command("account"), { effects: LOCAL_READ }).description("remove this profile from this computer").addCommand(accountRemoveCommand(DRIVE_APP, removal, { resolveSettings: configuration.resolveSettings }));
|
|
2201
2209
|
}, "installAccountCommands");
|
|
2202
2210
|
|
|
2203
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.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) => {
|
|
2446
|
-
if (!Number.isSafeInteger(depth) || depth < 0 || depth > 50)
|
|
2447
|
-
throw new CliError("validation_error", "tree depth must be between 0 and 50", { reason: "catalog.depth-invalid" });
|
|
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;
|
|
2463
|
-
}
|
|
2464
|
-
}, "childrenOf");
|
|
2465
|
-
const node = /* @__PURE__ */ __name(async (entry, level, ancestors) => {
|
|
2466
|
-
if (ancestors.has(entry.externalId))
|
|
2467
|
-
throw new CliError("invalid_response", "local folder ancestry contains a cycle", { reason: "catalog.cycle" });
|
|
2468
|
-
if (++nodes > limit)
|
|
2469
|
-
throw tooLarge(limit);
|
|
2470
|
-
const tree = {
|
|
2471
|
-
item: {
|
|
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
|
|
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;
|
|
2494
|
-
}, "node");
|
|
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", {
|
|
2500
|
-
reason: "catalog.not-found"
|
|
2501
|
-
});
|
|
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]);
|
|
2507
|
-
});
|
|
2508
|
-
return trees;
|
|
2509
|
-
}, "catalogTree");
|
|
2510
|
-
var catalogId = /* @__PURE__ */ __name((entry) => entry.externalId.replace(/\.md$/, ""), "catalogId");
|
|
2511
|
-
var catalogOutput = /* @__PURE__ */ __name((entry) => ({
|
|
2512
|
-
id: catalogId(entry),
|
|
2513
|
-
ref: entry.ref,
|
|
2514
|
-
kind: entry.kind,
|
|
2515
|
-
name: entry.name,
|
|
2516
|
-
parents: entry.parents.map((id) => id.replace(/\.md$/, "")),
|
|
2517
|
-
url: entry.url,
|
|
2518
|
-
mime: entry.mime,
|
|
2519
|
-
size: entry.size,
|
|
2520
|
-
created_at: entry.createdAt,
|
|
2521
|
-
modified_at: entry.modifiedAt,
|
|
2522
|
-
observed_at: entry.observedAt,
|
|
2523
|
-
description: entry.description,
|
|
2524
|
-
actors: entry.actors,
|
|
2525
|
-
provider_metadata: entry.metadata,
|
|
2526
|
-
active: entry.active,
|
|
2527
|
-
content: entry.content
|
|
2528
|
-
}), "catalogOutput");
|
|
2529
|
-
var CATALOG_FIELDS = Object.keys({
|
|
2530
|
-
id: true,
|
|
2531
|
-
ref: true,
|
|
2532
|
-
kind: true,
|
|
2533
|
-
name: true,
|
|
2534
|
-
parents: true,
|
|
2535
|
-
url: true,
|
|
2536
|
-
mime: true,
|
|
2537
|
-
size: true,
|
|
2538
|
-
created_at: true,
|
|
2539
|
-
modified_at: true,
|
|
2540
|
-
observed_at: true,
|
|
2541
|
-
description: true,
|
|
2542
|
-
actors: true,
|
|
2543
|
-
provider_metadata: true,
|
|
2544
|
-
active: true,
|
|
2545
|
-
content: true
|
|
2546
|
-
});
|
|
2547
|
-
var local = /* @__PURE__ */ __name((command, mutates = false) => annotate(command, { effects: mutates ? LOCAL_WRITE : LOCAL_READ }), "local");
|
|
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");
|
|
2562
|
-
const entry = /* @__PURE__ */ __name(async (index, principal, id) => {
|
|
2563
|
-
const found = await index.catalog?.get(principal, helpers.id(id));
|
|
2564
|
-
if (!found)
|
|
2565
|
-
throw new CliError("not_found", "file or folder is not in the active local catalog; run catalog import or sync", {
|
|
2566
|
-
reason: "catalog.not-found"
|
|
2567
|
-
});
|
|
2568
|
-
return found;
|
|
2569
|
-
}, "entry");
|
|
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;
|
|
2576
|
-
const result = await run3((index, principal) => index.catalog.list(principal, { ast, limit: args.limit, offset: (args.page - 1) * args.limit }));
|
|
2577
|
-
output(listOf(`catalog ${search ? "search" : "list"}`, {
|
|
2578
|
-
items: result.items.map(catalogOutput),
|
|
2579
|
-
limit: args.limit,
|
|
2580
|
-
has_more: result.hasMore,
|
|
2581
|
-
page: args.page,
|
|
2582
|
-
args: { query: terms.length ? terms.join(" ") : void 0 }
|
|
2583
|
-
}));
|
|
2584
|
-
}, "list");
|
|
2585
|
-
for (const action of ["list", "search"]) {
|
|
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 } });
|
|
2590
|
-
}
|
|
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);
|
|
2595
|
-
})));
|
|
2596
|
-
const tags = local(catalog.command("tags")).description("add owner tags to cached files or folders");
|
|
2597
|
-
for (const action of ["list", "add", "remove"]) {
|
|
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);
|
|
2599
|
-
if (action === "list")
|
|
2600
|
-
bindQuery2(command, queries.tags, tagRow);
|
|
2601
|
-
else
|
|
2602
|
-
command.argument("<tags...>", "local tag names");
|
|
2603
|
-
command.action(async (id, values2 = []) => {
|
|
2604
|
-
const filter = action === "list" ? termsOf2(values2, queries.tags, "catalog tags list") : void 0;
|
|
2605
|
-
return output(allOf(await run3(async (index, principal) => {
|
|
2606
|
-
const found = await entry(index, principal, id);
|
|
2607
|
-
if (!index.knowledge)
|
|
2608
|
-
throw new CliError("configuration_error", "index has no shared knowledge adapter");
|
|
2609
|
-
const tags2 = await index.knowledge.tags(principal, found.ref, action, action === "list" ? void 0 : values2, filter);
|
|
2610
|
-
return action === "list" ? tags2.map((tag) => ({ tag })) : tags2;
|
|
2611
|
-
}, action !== "list")));
|
|
2612
|
-
});
|
|
2613
|
-
}
|
|
2614
|
-
}, "addDocumentCatalogCommandsDefinition");
|
|
2615
|
-
var addDocumentCatalogCommands = honoursDryRun(sharedCommand(addDocumentCatalogCommandsDefinition));
|
|
2616
|
-
|
|
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
2211
|
// dist/catalog.js
|
|
3099
2212
|
var catalogInput = /* @__PURE__ */ __name((file) => ({
|
|
3100
2213
|
externalId: `${file.id}.md`,
|
|
@@ -3123,7 +2236,7 @@ var catalogInput = /* @__PURE__ */ __name((file) => ({
|
|
|
3123
2236
|
}), "catalogInput");
|
|
3124
2237
|
|
|
3125
2238
|
// dist/commands/context.js
|
|
3126
|
-
var
|
|
2239
|
+
var positive = /* @__PURE__ */ __name((input) => {
|
|
3127
2240
|
const n = Number(input);
|
|
3128
2241
|
if (!Number.isSafeInteger(n) || n < 1)
|
|
3129
2242
|
throw new InvalidArgumentError("use a positive integer");
|
|
@@ -3452,7 +2565,7 @@ var installModelCommands = /* @__PURE__ */ __name((program, { env, output, strea
|
|
|
3452
2565
|
const download = /* @__PURE__ */ __name(async (kind, id, acceptTerms) => {
|
|
3453
2566
|
if (policyFlags().offline)
|
|
3454
2567
|
throw offlineRefused("downloading a model needs the network");
|
|
3455
|
-
const { downloadImageModel, downloadTextModel } = await import("./services-
|
|
2568
|
+
const { downloadImageModel, downloadTextModel } = await import("./services-253KKKVU.js");
|
|
3456
2569
|
const progress = /* @__PURE__ */ __name((line) => {
|
|
3457
2570
|
if (!program.opts().quiet)
|
|
3458
2571
|
streams.diagnostic(line);
|
|
@@ -3716,10 +2829,10 @@ var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
3716
2829
|
});
|
|
3717
2830
|
const state = readState(env, selected(), profile.principal);
|
|
3718
2831
|
return {
|
|
3719
|
-
items: found.items.map((
|
|
3720
|
-
const id = (
|
|
2832
|
+
items: found.items.map((note) => {
|
|
2833
|
+
const id = (note.path ?? "").replace(/\.md$/, "");
|
|
3721
2834
|
const doc = state.documents[id];
|
|
3722
|
-
return doc ? { ...metadataJson(doc.metadata), reference: doc.reference, tabs: doc.tabs } : { id, name:
|
|
2835
|
+
return doc ? { ...metadataJson(doc.metadata), reference: doc.reference, tabs: doc.tabs } : { id, name: note.title, reference: note.ref, tabs: 0 };
|
|
3723
2836
|
}),
|
|
3724
2837
|
hasMore: found.hasMore
|
|
3725
2838
|
};
|
|
@@ -3730,6 +2843,16 @@ var installDocumentCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
3730
2843
|
}, "document"),
|
|
3731
2844
|
lastSync: /* @__PURE__ */ __name(() => readState(env, selected(), activeProfile(env, selected()).principal).lastSync, "lastSync")
|
|
3732
2845
|
});
|
|
2846
|
+
addDocumentHistoryCommands(program, {
|
|
2847
|
+
words: DRIVE_WORDS,
|
|
2848
|
+
output,
|
|
2849
|
+
run: /* @__PURE__ */ __name((fn) => withIndex((index) => {
|
|
2850
|
+
if (!index.history)
|
|
2851
|
+
throw new CliError("configuration_error", "index has no document history");
|
|
2852
|
+
return fn(index.history, activeProfile(env, selected()).principal);
|
|
2853
|
+
}), "run"),
|
|
2854
|
+
id: fileId
|
|
2855
|
+
});
|
|
3733
2856
|
examples(annotate(documents.command("add"), { mcp: false, effects: FETCH }).argument("<url>", "Google Drive or Docs URL, or file id").description("keep a Drive document's text in memory, read by the first profile that opens it"), [
|
|
3734
2857
|
"drive documents add https://docs.google.com/document/d/DOC_ID/edit --profiles work,personal",
|
|
3735
2858
|
"drive personal documents add DOC_ID --subject person:PERSON_UID"
|
|
@@ -4557,7 +3680,7 @@ var fetchDoc = /* @__PURE__ */ __name(async (call, id) => {
|
|
|
4557
3680
|
}, "fetchDoc");
|
|
4558
3681
|
var docUrl = /* @__PURE__ */ __name((id) => `https://docs.google.com/document/d/${id}/edit`, "docUrl");
|
|
4559
3682
|
var createDoc = /* @__PURE__ */ __name(async (call, input) => {
|
|
4560
|
-
const
|
|
3683
|
+
const local = await localBlocks(input.file);
|
|
4561
3684
|
const created = await call("drive.files.create", { fields: "id,webViewLink", supportsAllDrives: true }, {
|
|
4562
3685
|
name: input.name.replace(/\.md$/i, ""),
|
|
4563
3686
|
mimeType: "application/vnd.google-apps.document",
|
|
@@ -4565,14 +3688,14 @@ var createDoc = /* @__PURE__ */ __name(async (call, input) => {
|
|
|
4565
3688
|
appProperties: { wirecatOrigin: input.origin }
|
|
4566
3689
|
});
|
|
4567
3690
|
const empty = await fetchDoc(call, created.id);
|
|
4568
|
-
const requests = editRequests(empty,
|
|
3691
|
+
const requests = editRequests(empty, local);
|
|
4569
3692
|
if (requests.length)
|
|
4570
3693
|
await call("docs.documents.batchUpdate", { documentId: created.id }, { requests, writeControl: { requiredRevisionId: empty.revisionId } });
|
|
4571
3694
|
const written = await fetchDoc(call, created.id);
|
|
4572
3695
|
return {
|
|
4573
3696
|
id: created.id,
|
|
4574
3697
|
url: created.webViewLink ?? docUrl(created.id),
|
|
4575
|
-
snapshot: { kind: "doc", written: written.placed.map((item) => item.block), local
|
|
3698
|
+
snapshot: { kind: "doc", written: written.placed.map((item) => item.block), local }
|
|
4576
3699
|
};
|
|
4577
3700
|
}, "createDoc");
|
|
4578
3701
|
var recoveredDoc = /* @__PURE__ */ __name(async (call, id) => {
|
|
@@ -4586,9 +3709,9 @@ var prepareDoc = /* @__PURE__ */ __name(async (call, input) => {
|
|
|
4586
3709
|
if (doc.suggestions)
|
|
4587
3710
|
return { conflict: "the Doc has pending suggestions; accept or reject them in Google first" };
|
|
4588
3711
|
const text = readFileSync3(input.file.absolute, "utf8");
|
|
4589
|
-
const
|
|
3712
|
+
const local = representable(await markdownBlocks(text));
|
|
4590
3713
|
const current = doc.placed.map((item) => item.block);
|
|
4591
|
-
const merged = mergeBlocks(recorded.local, recorded.written,
|
|
3714
|
+
const merged = mergeBlocks(recorded.local, recorded.written, local, current, keep);
|
|
4592
3715
|
let next;
|
|
4593
3716
|
if (merged.status === "unaligned") {
|
|
4594
3717
|
if (!keep)
|
|
@@ -4596,7 +3719,7 @@ var prepareDoc = /* @__PURE__ */ __name(async (call, input) => {
|
|
|
4596
3719
|
conflict: "the Doc no longer matches what the last sync wrote; choose a side with --keep",
|
|
4597
3720
|
remote: await lastChange(call, id)
|
|
4598
3721
|
};
|
|
4599
|
-
next = keep === "local" ?
|
|
3722
|
+
next = keep === "local" ? local : keep === "remote" ? current : [...local, ...current];
|
|
4600
3723
|
} else if (merged.status === "conflict")
|
|
4601
3724
|
return {
|
|
4602
3725
|
conflict: "the same part changed here and in Google",
|
|
@@ -4610,7 +3733,7 @@ var prepareDoc = /* @__PURE__ */ __name(async (call, input) => {
|
|
|
4610
3733
|
else
|
|
4611
3734
|
next = merged.blocks;
|
|
4612
3735
|
let content;
|
|
4613
|
-
if (!sameBlocks(
|
|
3736
|
+
if (!sameBlocks(local, next)) {
|
|
4614
3737
|
content = await spliceMarkdown(text, next, representable);
|
|
4615
3738
|
if (content === void 0)
|
|
4616
3739
|
return {
|
|
@@ -4745,10 +3868,10 @@ var installMirrorCommands = /* @__PURE__ */ __name((program, context, { call })
|
|
|
4745
3868
|
var SYNC = defineSteps([
|
|
4746
3869
|
{ id: "sync.run", command: "sync", args: [], why: "copy the changes Google has made into the local store" }
|
|
4747
3870
|
])[0];
|
|
4748
|
-
var freshness = /* @__PURE__ */ __name((remote,
|
|
4749
|
-
changed:
|
|
3871
|
+
var freshness = /* @__PURE__ */ __name((remote, local) => ({
|
|
3872
|
+
changed: local === void 0 || Date.parse(remote) !== Date.parse(local),
|
|
4750
3873
|
remote_modified_at: remote,
|
|
4751
|
-
local_modified_at:
|
|
3874
|
+
local_modified_at: local ?? null
|
|
4752
3875
|
}), "freshness");
|
|
4753
3876
|
var changedCopy = /* @__PURE__ */ __name(({ changed, local_modified_at }) => {
|
|
4754
3877
|
if (!changed)
|
|
@@ -4763,7 +3886,7 @@ var changedCopy = /* @__PURE__ */ __name(({ changed, local_modified_at }) => {
|
|
|
4763
3886
|
|
|
4764
3887
|
// dist/download.js
|
|
4765
3888
|
import { randomUUID } from "node:crypto";
|
|
4766
|
-
import { closeSync, createWriteStream, linkSync, lstatSync, mkdirSync as mkdirSync2, openSync, renameSync, rmSync, writeFileSync
|
|
3889
|
+
import { closeSync, createWriteStream, linkSync, lstatSync, mkdirSync as mkdirSync2, openSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
4767
3890
|
import { dirname, join as join6 } from "node:path";
|
|
4768
3891
|
import { pipeline } from "node:stream/promises";
|
|
4769
3892
|
var EXPORT_FORMATS = {
|
|
@@ -4797,7 +3920,7 @@ var saveDownload = /* @__PURE__ */ __name(async (path, overwrite, read, createDi
|
|
|
4797
3920
|
const fd = openSync(temp, "wx", 384);
|
|
4798
3921
|
created = true;
|
|
4799
3922
|
try {
|
|
4800
|
-
|
|
3923
|
+
writeFileSync(fd, source);
|
|
4801
3924
|
} finally {
|
|
4802
3925
|
closeSync(fd);
|
|
4803
3926
|
}
|
|
@@ -4855,7 +3978,7 @@ var snakeKeys2 = /* @__PURE__ */ __name((value, record2 = false) => {
|
|
|
4855
3978
|
VERBATIM.has(key) ? item : snakeKeys2(item, RECORDS.has(key))
|
|
4856
3979
|
]));
|
|
4857
3980
|
}, "snakeKeys");
|
|
4858
|
-
var
|
|
3981
|
+
var allOf = /* @__PURE__ */ __name((items) => listOf("", { items, limit: Math.max(1, items.length), has_more: false }), "allOf");
|
|
4859
3982
|
|
|
4860
3983
|
// dist/generated/definitions.js
|
|
4861
3984
|
var definitions = {
|
|
@@ -22284,11 +21407,11 @@ var sentParams = /* @__PURE__ */ __name((method, params) => {
|
|
|
22284
21407
|
}, "sentParams");
|
|
22285
21408
|
var zoneMeta = /* @__PURE__ */ __name((meta) => meta ? { meta } : {}, "zoneMeta");
|
|
22286
21409
|
var installRemoteCommands = /* @__PURE__ */ __name((program, helpers) => {
|
|
22287
|
-
const { call, output, positive:
|
|
22288
|
-
const page = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many items one page holds",
|
|
21410
|
+
const { call, output, positive: positive2 } = helpers;
|
|
21411
|
+
const page = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many items one page holds", positive2, 100).option("--cursor <cursor>", "continue from page.next_cursor of the previous answer"), "page");
|
|
22289
21412
|
const fileArgument = "file id or Google Drive URL";
|
|
22290
21413
|
const api = annotate(program.command("api"), { effects: LOCAL_READ }).description("discover and call the official Drive, Docs, Sheets and Activity API methods");
|
|
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(
|
|
21414
|
+
withQuery(examples(answerEntity(annotate(api.command("list"), { effects: NO_EFFECTS }).description("list the Google API methods drive can call"), "api_method", strictObject({ name: string(), mutates: boolean(), destructive: boolean(), scope: string() })), ["drive api list", "drive api list service:docs"]), API_METHOD_QUERY).action((words) => output(allOf(apiMethods(queryTerms(words, API_METHOD_QUERY, "api list").get("service")))));
|
|
22292
21415
|
examples(annotate(api.command("show"), { effects: NO_EFFECTS }).description("show one method's request schema and contract, without calling Google").argument("<method>", "Google method name, as api list prints it"), ["drive api show docs.documents.batchUpdate --json"]).action((method) => output(itemOf({ operation: operationOf(method), request_schema: requestSchema(method) })));
|
|
22293
21416
|
examples(annotate(api.command("call"), { mcp: false, effects: GOOGLE_WRITE }).description("call one Google API method by name with JSON parameters").argument("<method>", "Google method name, as api list prints it"), [
|
|
22294
21417
|
`drive personal api call drive.files.get --params '{"fileId":"FILE_ID"}'`,
|
|
@@ -22380,22 +21503,12 @@ var installRemoteCommands = /* @__PURE__ */ __name((program, helpers) => {
|
|
|
22380
21503
|
`drive personal documents create --title "Meeting notes"`
|
|
22381
21504
|
]).requiredOption("--title <title>", "title of the new document").action(async (args) => output(itemOf(await call("docs.documents.create", {}, { title: args.title }))));
|
|
22382
21505
|
examples(annotate(documents.command("update"), { effects: GOOGLE_WRITE }).description("change a Google Doc with a Docs batchUpdate request").argument("<document>", documentArgument), [`drive personal documents update DOC_ID --body '{"requests":[]}'`]).requiredOption("--body <json>", "Docs batchUpdate body: requests and an optional writeControl", jsonObject).action(async (id, args) => output(itemOf(await call("docs.documents.batchUpdate", { documentId: fileId(id) }, args.body))));
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
}) : await call("drive.revisions.list", {
|
|
22390
|
-
fileId: file,
|
|
22391
|
-
pageSize: args.limit,
|
|
22392
|
-
...args.cursor ? { pageToken: args.cursor } : {},
|
|
22393
|
-
fields: "nextPageToken,revisions(id,mimeType,modifiedTime,lastModifyingUser(permissionId,displayName,emailAddress),size)"
|
|
22394
|
-
});
|
|
22395
|
-
output(pageOf("documents history", data, args.activity ? "activities" : "revisions", args.limit, {
|
|
22396
|
-
document: id,
|
|
22397
|
-
activity: args.activity
|
|
22398
|
-
}));
|
|
21506
|
+
const activities = annotate(program.command("activities"), { effects: GOOGLE_READ }).description("read who did what with a file in Google Drive");
|
|
21507
|
+
const activityRow = looseObject({ timestamp: optional(string()) });
|
|
21508
|
+
const activityQuery = unfilteredQuery("drive_remote_activity", activityRow);
|
|
21509
|
+
bindQuery(page(examples(annotate(activities.command("list"), { effects: GOOGLE_READ }).description("list who did what with a file (needs session start --grant activity)").argument("<file>", fileArgument), ["drive personal activities list FILE_ID"])), activityQuery, activityRow).action(async (id, words, args) => {
|
|
21510
|
+
queryTerms(words, activityQuery, "activities list");
|
|
21511
|
+
return output(pageOf("activities list", await call("driveactivity.activity.query", {}, { itemName: `items/${fileId(id)}`, pageSize: args.limit, ...args.cursor ? { pageToken: args.cursor } : {} }), "activities", args.limit, { file: id }));
|
|
22399
21512
|
});
|
|
22400
21513
|
for (const resource of ["comments", "permissions", "revisions"]) {
|
|
22401
21514
|
const one = resource.slice(0, -1);
|
|
@@ -22488,7 +21601,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22488
21601
|
const app = application(env, { file: args.clientFile, clientId: args.clientId, profile: selected() });
|
|
22489
21602
|
if (!app.clientSecret)
|
|
22490
21603
|
streams.diagnostic("your Google app has no secret here, and Google refuses a Desktop app without one: set DRIVE_GOOGLE_CLIENT_SECRET\n");
|
|
22491
|
-
const { login } = await import("./login-
|
|
21604
|
+
const { login } = await import("./login-WIY5VQU7.js");
|
|
22492
21605
|
output(itemOf(await login({
|
|
22493
21606
|
env,
|
|
22494
21607
|
profile: selected(),
|
|
@@ -22519,7 +21632,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22519
21632
|
const name = selected();
|
|
22520
21633
|
const config = readConfig(env);
|
|
22521
21634
|
const profile = activeProfile(env, name);
|
|
22522
|
-
const { credentials } = await import("./tokens-
|
|
21635
|
+
const { credentials } = await import("./tokens-EHYO6D2X.js");
|
|
22523
21636
|
const store = credentials(env, profile.storage, options.keyring);
|
|
22524
21637
|
store.remove(name);
|
|
22525
21638
|
writeConfig(env, config);
|
|
@@ -22534,14 +21647,14 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22534
21647
|
}, "installSessionCommands");
|
|
22535
21648
|
|
|
22536
21649
|
// dist/store-import.js
|
|
22537
|
-
import { readFileSync as readFileSync4, statSync
|
|
22538
|
-
import { resolve
|
|
21650
|
+
import { readFileSync as readFileSync4, statSync } from "node:fs";
|
|
21651
|
+
import { resolve } from "node:path";
|
|
22539
21652
|
var transferBindings = /* @__PURE__ */ __name((path) => {
|
|
22540
21653
|
if (path === void 0)
|
|
22541
21654
|
return {};
|
|
22542
21655
|
let parsed;
|
|
22543
21656
|
try {
|
|
22544
|
-
const stat =
|
|
21657
|
+
const stat = statSync(path);
|
|
22545
21658
|
if (!stat.isFile() || stat.size > 256 * 1024)
|
|
22546
21659
|
throw new Error("bounds");
|
|
22547
21660
|
parsed = JSON.parse(readFileSync4(path, "utf8"));
|
|
@@ -22555,7 +21668,7 @@ var transferBindings = /* @__PURE__ */ __name((path) => {
|
|
|
22555
21668
|
var selection = /* @__PURE__ */ __name((env, name, source) => {
|
|
22556
21669
|
const profile = activeProfile(env, name);
|
|
22557
21670
|
const state = readState(env, name, profile.principal);
|
|
22558
|
-
const destination =
|
|
21671
|
+
const destination = resolve(storePath(env));
|
|
22559
21672
|
for (const [id] of Object.entries(state.documents)) {
|
|
22560
21673
|
const snapshot = readSnapshot(env, name, id);
|
|
22561
21674
|
if (snapshot.metadata.id !== id)
|
|
@@ -22566,7 +21679,7 @@ var selection = /* @__PURE__ */ __name((env, name, source) => {
|
|
|
22566
21679
|
return { profile, state, options: { source, destination, collection: `google-drive:${profile.principal}`, env } };
|
|
22567
21680
|
}, "selection");
|
|
22568
21681
|
var checkStoreImport = /* @__PURE__ */ __name(async (env, name, source, bindings) => {
|
|
22569
|
-
const { ensureSqlite } = await import("./sqlite-runtime-
|
|
21682
|
+
const { ensureSqlite } = await import("./sqlite-runtime-EZASGJXW.js");
|
|
22570
21683
|
await ensureSqlite();
|
|
22571
21684
|
const { state, options } = selection(env, name, source);
|
|
22572
21685
|
const preview = await previewDocumentTransfer({ ...options, bindings });
|
|
@@ -22575,7 +21688,7 @@ var checkStoreImport = /* @__PURE__ */ __name(async (env, name, source, bindings
|
|
|
22575
21688
|
if (!stored || stored.content_hash !== document.hash)
|
|
22576
21689
|
throw new CliError("configuration_error", "source content does not match the cached profile checkpoint; the original checkpoint was kept");
|
|
22577
21690
|
}
|
|
22578
|
-
if (
|
|
21691
|
+
if (resolve(state.store ?? "") === options.destination && !preview.already_transferred)
|
|
22579
21692
|
throw new CliError("configuration_error", "this profile already uses the selected store; only an existing transfer can be retried");
|
|
22580
21693
|
return preview;
|
|
22581
21694
|
}, "checkStoreImport");
|
|
@@ -22627,16 +21740,16 @@ var installStoreCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22627
21740
|
|
|
22628
21741
|
// dist/commands/sync.js
|
|
22629
21742
|
import { existsSync } from "node:fs";
|
|
22630
|
-
import { join as join7, resolve as
|
|
21743
|
+
import { join as join7, resolve as resolve3 } from "node:path";
|
|
22631
21744
|
|
|
22632
21745
|
// dist/sync.js
|
|
22633
|
-
import { resolve as
|
|
21746
|
+
import { resolve as resolve2 } from "node:path";
|
|
22634
21747
|
var MESSAGE_LINKS_VERSION = 1;
|
|
22635
21748
|
var skipReason = /* @__PURE__ */ __name((file) => !file.canDownload ? "downloads restricted" : supported(file) ? void 0 : `unsupported type: ${file.mime}`, "skipReason");
|
|
22636
21749
|
var retryable = /* @__PURE__ */ __name((skip, limit) => skip.reason === "downloads restricted" || skip.reason.startsWith("unsupported type: ") || skip.textLimit !== void 0 && skip.textLimit < limit || // The store's own bounds change only with the shared package drive pins.
|
|
22637
21750
|
skip.storeRefusedIn !== void 0 && skip.storeRefusedIn !== VERSION || // 0.2.0 and earlier skipped text over 200 000 characters with this reason and no recorded limit.
|
|
22638
21751
|
skip.reason.startsWith("document exceeds the ingestion bound") && limit > 2e5, "retryable");
|
|
22639
|
-
var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal, rescan = false) => {
|
|
21752
|
+
var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal, rescan = false, run3 = {}) => {
|
|
22640
21753
|
const profile = activeProfile(env, name);
|
|
22641
21754
|
const lock = await lockProfile(env, name);
|
|
22642
21755
|
try {
|
|
@@ -22647,6 +21760,8 @@ var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal,
|
|
|
22647
21760
|
const query = transcriptQuery(transcripts.mode, transcripts.words, source?.search);
|
|
22648
21761
|
const result = await syncDocuments({
|
|
22649
21762
|
...query ? { query } : {},
|
|
21763
|
+
...run3.budget ? { budget: run3.budget } : {},
|
|
21764
|
+
...run3.deadline ? { deadline: run3.deadline } : {},
|
|
22650
21765
|
source,
|
|
22651
21766
|
index,
|
|
22652
21767
|
principal: profile.principal,
|
|
@@ -22656,6 +21771,7 @@ var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal,
|
|
|
22656
21771
|
rescan,
|
|
22657
21772
|
pictures: profile.picture_search,
|
|
22658
21773
|
textLimit: textLimit(env, name),
|
|
21774
|
+
keepVersionsForDays: keepVersions(env, name),
|
|
22659
21775
|
maxEntries: MAX_ENTRIES,
|
|
22660
21776
|
isFolder: /* @__PURE__ */ __name((file) => file.mime === FOLDER, "isFolder"),
|
|
22661
21777
|
skipReason,
|
|
@@ -22665,7 +21781,7 @@ var sync = /* @__PURE__ */ __name(async (source, index, env, name, max, signal,
|
|
|
22665
21781
|
storeVersion: VERSION,
|
|
22666
21782
|
state: {
|
|
22667
21783
|
read: /* @__PURE__ */ __name(() => readState(env, name, profile.principal), "read"),
|
|
22668
|
-
save: /* @__PURE__ */ __name((state) => saveState(env, name, { ...state, store:
|
|
21784
|
+
save: /* @__PURE__ */ __name((state) => saveState(env, name, { ...state, store: resolve2(storePath(env)) }), "save"),
|
|
22669
21785
|
readWalk: /* @__PURE__ */ __name((scope) => readWalk(env, name, scope), "readWalk"),
|
|
22670
21786
|
saveWalk: /* @__PURE__ */ __name((walk) => saveWalk(env, name, walk), "saveWalk"),
|
|
22671
21787
|
removeWalk: /* @__PURE__ */ __name(() => removeWalk(env, name), "removeWalk"),
|
|
@@ -22706,10 +21822,18 @@ var installSyncCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22706
21822
|
sync: /* @__PURE__ */ __name(async (args) => {
|
|
22707
21823
|
const profile = activeProfile(env, selected());
|
|
22708
21824
|
const remote = profile.roots.length || profile.transcripts === "include" ? await source() : void 0;
|
|
22709
|
-
return withIndex(async (index) =>
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
21825
|
+
return withIndex(async (index) => {
|
|
21826
|
+
const result = await sync(remote, index, env, selected(), args.limit, context.signal(), args.rescan, {
|
|
21827
|
+
budget: args.budget,
|
|
21828
|
+
deadline: args.deadline
|
|
21829
|
+
});
|
|
21830
|
+
if (!args.embed)
|
|
21831
|
+
return result;
|
|
21832
|
+
const stopped = result.stopped ?? args.budget?.take();
|
|
21833
|
+
if (stopped)
|
|
21834
|
+
return { ...result, embeddings: { skipped: stopped, next: "the next sync --embed goes on" } };
|
|
21835
|
+
return { ...result, embeddings: await index.embed(600) };
|
|
21836
|
+
});
|
|
22713
21837
|
}, "sync"),
|
|
22714
21838
|
status: /* @__PURE__ */ __name(() => {
|
|
22715
21839
|
const name = selected();
|
|
@@ -22719,8 +21843,8 @@ var installSyncCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22719
21843
|
return {
|
|
22720
21844
|
profile: name,
|
|
22721
21845
|
store: {
|
|
22722
|
-
selected:
|
|
22723
|
-
checkpoint: state.store ?? (existsSync(legacyStore) ?
|
|
21846
|
+
selected: resolve3(storePath(env)),
|
|
21847
|
+
checkpoint: state.store ?? (existsSync(legacyStore) ? resolve3(legacyStore) : null)
|
|
22724
21848
|
},
|
|
22725
21849
|
selected_folders: profile.roots,
|
|
22726
21850
|
documents: Object.keys(state.documents).length,
|
|
@@ -22761,14 +21885,14 @@ var installTranscriptCommands = /* @__PURE__ */ __name((program, context) => {
|
|
|
22761
21885
|
owned_by_me: file.providerMetadata?.ownedByMe ?? null,
|
|
22762
21886
|
modified_at: file.modifiedAt ?? null
|
|
22763
21887
|
}));
|
|
22764
|
-
output(
|
|
21888
|
+
output(allOf(rows.filter((row) => filter.owned_by_me === void 0 || String(row.owned_by_me) === filter.owned_by_me)));
|
|
22765
21889
|
});
|
|
22766
21890
|
}, "installTranscriptCommands");
|
|
22767
21891
|
|
|
22768
21892
|
// dist/commands/upgrade.js
|
|
22769
21893
|
import { join as join8 } from "node:path";
|
|
22770
21894
|
|
|
22771
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21895
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.128.0_commander@15.0.0_esbuild@0.28.2_typ_a55806ccf2eb39d6be3eaf4c54d1a60a/node_modules/@wirecat/cli-core/dist/update/index.js
|
|
22772
21896
|
import { realpathSync } from "node:fs";
|
|
22773
21897
|
import { fileURLToPath } from "node:url";
|
|
22774
21898
|
var npmRegistry = /* @__PURE__ */ __name(() => hostFetch({ hosts: ["registry.npmjs.org"] }), "npmRegistry");
|
|
@@ -22921,7 +22045,8 @@ var FIRST_SCREEN = {
|
|
|
22921
22045
|
{ command: "sync --embed", does: "import what changed and index it by meaning" },
|
|
22922
22046
|
{ command: 'search "budget decision"', does: "every imported document, by words and meaning" },
|
|
22923
22047
|
{ command: "documents context <doc>", does: "a document with its tags, notes and editors" },
|
|
22924
|
-
{ command: "documents history <doc>
|
|
22048
|
+
{ command: "documents history <doc>", does: "earlier versions kept by sync" },
|
|
22049
|
+
{ command: "activities list <doc>", does: "who did what (needs --grant activity)" },
|
|
22925
22050
|
{ command: "memories extract <doc>", does: "memories with exact quotes, proposed by a model" },
|
|
22926
22051
|
{ command: "documents export <doc>", does: "Markdown in a new file (--output); never overwrites" },
|
|
22927
22052
|
{ command: "--read-only \u2026", does: "this run refuses every change" }
|
|
@@ -22980,9 +22105,9 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
|
|
|
22980
22105
|
const port = {
|
|
22981
22106
|
...shared,
|
|
22982
22107
|
context: /* @__PURE__ */ __name(async (principal, ref) => {
|
|
22983
|
-
const
|
|
22108
|
+
const note = await document(principal, ref);
|
|
22984
22109
|
return {
|
|
22985
|
-
document:
|
|
22110
|
+
document: note,
|
|
22986
22111
|
tags: await store.notes.noteTags(ref),
|
|
22987
22112
|
links: await store.notes.links({ from: ref }),
|
|
22988
22113
|
notes: await store.notes.notes({ source: "internal", about: ref, limit: 100 }),
|
|
@@ -22992,8 +22117,8 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
|
|
|
22992
22117
|
};
|
|
22993
22118
|
}, "context"),
|
|
22994
22119
|
people: /* @__PURE__ */ __name(async (principal, ref, filter = {}) => {
|
|
22995
|
-
const
|
|
22996
|
-
const metadata =
|
|
22120
|
+
const note = await document(principal, ref);
|
|
22121
|
+
const metadata = note.frontMatter;
|
|
22997
22122
|
const contributors = [
|
|
22998
22123
|
...(metadata.owners ?? []).map((user) => ({ ...user, role: "owner" })),
|
|
22999
22124
|
...metadata.lastModifiedBy ? [{ ...metadata.lastModifiedBy, role: "last-editor" }] : []
|
|
@@ -23013,8 +22138,8 @@ var documentKnowledge2 = /* @__PURE__ */ __name((store, folder) => {
|
|
|
23013
22138
|
};
|
|
23014
22139
|
}, "people"),
|
|
23015
22140
|
linkPerson: /* @__PURE__ */ __name(async (principal, ref, googleId, personRef) => {
|
|
23016
|
-
const
|
|
23017
|
-
const metadata =
|
|
22141
|
+
const note = await document(principal, ref);
|
|
22142
|
+
const metadata = note.frontMatter;
|
|
23018
22143
|
const users = [...metadata.owners ?? [], ...metadata.lastModifiedBy ? [metadata.lastModifiedBy] : []];
|
|
23019
22144
|
if (!users.some((user) => googleUserId(user) === googleId))
|
|
23020
22145
|
throw new CliError("not_found", "Google identity was not observed on this document");
|
|
@@ -23091,19 +22216,19 @@ var saveContributors = /* @__PURE__ */ __name(async (store, principal, metadata,
|
|
|
23091
22216
|
|
|
23092
22217
|
// dist/store-transition.js
|
|
23093
22218
|
import { existsSync as existsSync2 } from "node:fs";
|
|
23094
|
-
import { join as join9, resolve as
|
|
22219
|
+
import { join as join9, resolve as resolve4 } from "node:path";
|
|
23095
22220
|
var prepareStore = /* @__PURE__ */ __name(async (index, env, name, rescan = false) => {
|
|
23096
22221
|
const profile = activeProfile(env, name);
|
|
23097
|
-
const target =
|
|
22222
|
+
const target = resolve4(storePath(env));
|
|
23098
22223
|
const current = readState(env, name, profile.principal);
|
|
23099
|
-
if (current.store &&
|
|
22224
|
+
if (current.store && resolve4(current.store) === target) {
|
|
23100
22225
|
await index.registerProfile?.(name, profile.principal);
|
|
23101
22226
|
return;
|
|
23102
22227
|
}
|
|
23103
22228
|
const lock = await lockProfile(env, name);
|
|
23104
22229
|
try {
|
|
23105
22230
|
const state = readState(env, name, profile.principal);
|
|
23106
|
-
const previous =
|
|
22231
|
+
const previous = resolve4(state.store ?? join9(paths(env).state, "drive.db"));
|
|
23107
22232
|
if (previous !== target && existsSync2(previous)) {
|
|
23108
22233
|
const old = await openStore({ path: previous, env, command: "drive", version: VERSION });
|
|
23109
22234
|
try {
|
|
@@ -23112,13 +22237,13 @@ var prepareStore = /* @__PURE__ */ __name(async (index, env, name, rescan = fals
|
|
|
23112
22237
|
if (folder) {
|
|
23113
22238
|
for (let offset = 0; ; offset += 500) {
|
|
23114
22239
|
const page = await old.notes.notes({ folderId: folder.id, source: "file", limit: 500, offset });
|
|
23115
|
-
for (const
|
|
23116
|
-
counts.tags += (await old.notes.noteTags(
|
|
23117
|
-
counts.notes += (await old.notes.notes({ source: "internal", about:
|
|
23118
|
-
counts.memories += (await old.memories.list({ subject:
|
|
23119
|
-
counts.facts += (await old.facts.list({ subject:
|
|
23120
|
-
counts.links += (await old.notes.links({ from:
|
|
23121
|
-
counts.links += (await old.notes.links({ to:
|
|
22240
|
+
for (const note of page.items) {
|
|
22241
|
+
counts.tags += (await old.notes.noteTags(note.ref)).length;
|
|
22242
|
+
counts.notes += (await old.notes.notes({ source: "internal", about: note.ref, limit: 1 })).items.length;
|
|
22243
|
+
counts.memories += (await old.memories.list({ subject: note.ref, limit: 1 })).items.length;
|
|
22244
|
+
counts.facts += (await old.facts.list({ subject: note.ref, limit: 1 })).items.length;
|
|
22245
|
+
counts.links += (await old.notes.links({ from: note.ref })).filter((link) => link.origin !== "file").length;
|
|
22246
|
+
counts.links += (await old.notes.links({ to: note.ref })).length;
|
|
23122
22247
|
}
|
|
23123
22248
|
if (!page.hasMore)
|
|
23124
22249
|
break;
|
|
@@ -23196,7 +22321,7 @@ var openIndex = /* @__PURE__ */ __name(async (env, name, rescan = false) => {
|
|
|
23196
22321
|
activeProfile(env, name);
|
|
23197
22322
|
if (env.DRIVE_STORE)
|
|
23198
22323
|
throw new CliError("configuration_error", "DRIVE_STORE has been retired; use MESSAGING_STORE to select the shared database", { reason: "store.override-retired" });
|
|
23199
|
-
const { openAppStore } = await import("./cli-
|
|
22324
|
+
const { openAppStore } = await import("./cli-2P5FW2RL.js");
|
|
23200
22325
|
const store = await openAppStore(env, { app: { command: "drive", version: VERSION }, provider: DRIVE_PROVIDER });
|
|
23201
22326
|
const index = indexOver(store, env);
|
|
23202
22327
|
try {
|
|
@@ -23211,6 +22336,7 @@ var openIndex = /* @__PURE__ */ __name(async (env, name, rescan = false) => {
|
|
|
23211
22336
|
var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
23212
22337
|
const ingestion = documentIngestion(store, {
|
|
23213
22338
|
provider: "google-drive",
|
|
22339
|
+
command: "drive",
|
|
23214
22340
|
externalId: /* @__PURE__ */ __name((id) => `${id}.md`, "externalId"),
|
|
23215
22341
|
catalogInput,
|
|
23216
22342
|
observed: /* @__PURE__ */ __name((principal, file, id) => saveContributors(store, principal, file, id), "observed"),
|
|
@@ -23231,10 +22357,6 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23231
22357
|
const folder = ingestion.collection;
|
|
23232
22358
|
return {
|
|
23233
22359
|
...ingestion,
|
|
23234
|
-
registerProfile: /* @__PURE__ */ __name(async (name, principal) => {
|
|
23235
|
-
await folder(principal, true);
|
|
23236
|
-
await store.accounts.saveProfile("drive", name, { provider: "google-drive", account: principal });
|
|
23237
|
-
}, "registerProfile"),
|
|
23238
22360
|
addSource: /* @__PURE__ */ __name(async (input, driveFileId) => {
|
|
23239
22361
|
const synced = driveFileId === void 0 ? void 0 : await syncedDocument(store, driveFileId);
|
|
23240
22362
|
if (!synced)
|
|
@@ -23247,7 +22369,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23247
22369
|
linkMessages: /* @__PURE__ */ __name((documents, since) => store.notes.linkMessages({ documents, ...since ? { since } : {} }), "linkMessages"),
|
|
23248
22370
|
knowledge: documentKnowledge2(store, async (principal) => (await folder(principal, false))?.id),
|
|
23249
22371
|
openPictures: /* @__PURE__ */ __name(async () => {
|
|
23250
|
-
const { openPictureEmbedderFor, savePicture } = await import("./services-
|
|
22372
|
+
const { openPictureEmbedderFor, savePicture } = await import("./services-253KKKVU.js");
|
|
23251
22373
|
const embedder = pictureEmbedder ?? await openPictureEmbedderFor({ env, command: "drive" });
|
|
23252
22374
|
return {
|
|
23253
22375
|
save: /* @__PURE__ */ __name((reference, bytes) => savePicture(store, { ref: reference }, bytes, { embedder }), "save"),
|
|
@@ -23266,7 +22388,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23266
22388
|
has_more: false,
|
|
23267
22389
|
meaning_skipped: "this Google account has no imported sources"
|
|
23268
22390
|
};
|
|
23269
|
-
const { searchNotes } = await import("./services-
|
|
22391
|
+
const { searchNotes } = await import("./services-253KKKVU.js");
|
|
23270
22392
|
const result = await searchNotes(store, query, {
|
|
23271
22393
|
...options,
|
|
23272
22394
|
folderIds: selected ? [selected.id] : [],
|
|
@@ -23275,9 +22397,9 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23275
22397
|
...pictureEmbedder ? { pictureEmbedder } : {}
|
|
23276
22398
|
});
|
|
23277
22399
|
const pictures = await Promise.all((result.pictures ?? []).map(async (picture) => {
|
|
23278
|
-
const
|
|
22400
|
+
const note = await store.notes.note(picture.ref);
|
|
23279
22401
|
const [file] = await store.files.ofDocument(picture.ref);
|
|
23280
|
-
return { ...picture, title:
|
|
22402
|
+
return { ...picture, title: note.title, url: file?.url ?? null };
|
|
23281
22403
|
}));
|
|
23282
22404
|
const { pictures: _, items, hasMore, nextOffset, ...rest } = result;
|
|
23283
22405
|
return {
|
|
@@ -23286,20 +22408,20 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23286
22408
|
...nextOffset === void 0 ? {} : { next_offset: nextOffset },
|
|
23287
22409
|
...result.pictures ? { pictures } : {},
|
|
23288
22410
|
hits: await Promise.all(items.map(async (hit) => {
|
|
23289
|
-
const
|
|
23290
|
-
const metadata =
|
|
23291
|
-
const entry =
|
|
22411
|
+
const note = await store.notes.note(hit.ref);
|
|
22412
|
+
const metadata = note.frontMatter;
|
|
22413
|
+
const entry = note.path ? await store.catalog.get(selected.id, note.path) : void 0;
|
|
23292
22414
|
return {
|
|
23293
22415
|
...hit,
|
|
23294
22416
|
tabs: Array.isArray(metadata?.tabs) ? metadata.tabs : [],
|
|
23295
22417
|
content: entry?.content ?? "indexed",
|
|
23296
|
-
not_read: typeof metadata?.notRead === "string" ? metadata.notRead : entry?.content === "metadata" ?
|
|
22418
|
+
not_read: typeof metadata?.notRead === "string" ? metadata.notRead : entry?.content === "metadata" ? "content is not indexed yet" : null
|
|
23297
22419
|
};
|
|
23298
22420
|
}))
|
|
23299
22421
|
};
|
|
23300
22422
|
}, "search"),
|
|
23301
22423
|
embed: /* @__PURE__ */ __name(async (max) => {
|
|
23302
|
-
const { embedNotes } = await import("./services-
|
|
22424
|
+
const { embedNotes } = await import("./services-253KKKVU.js");
|
|
23303
22425
|
return embedNotes(store, { maxChunks: max, env, command: "drive" });
|
|
23304
22426
|
}, "embed"),
|
|
23305
22427
|
close: /* @__PURE__ */ __name(() => store.close(), "close")
|
|
@@ -23308,9 +22430,9 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
|
|
|
23308
22430
|
|
|
23309
22431
|
// dist/upload.js
|
|
23310
22432
|
import { createHash as createHash3 } from "node:crypto";
|
|
23311
|
-
import { createReadStream, mkdirSync as mkdirSync3, readFileSync as readFileSync5, rmSync as rmSync2, statSync as
|
|
22433
|
+
import { createReadStream, mkdirSync as mkdirSync3, readFileSync as readFileSync5, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
23312
22434
|
import { open } from "node:fs/promises";
|
|
23313
|
-
import { basename, join as join10, resolve as
|
|
22435
|
+
import { basename, join as join10, resolve as resolve5 } from "node:path";
|
|
23314
22436
|
var START = "https://www.googleapis.com/upload/drive/v3/files";
|
|
23315
22437
|
var FIELDS = "id,name,size,md5Checksum,mimeType,parents";
|
|
23316
22438
|
var QUANTUM = 256 * 1024;
|
|
@@ -23325,10 +22447,10 @@ var nextByte = /* @__PURE__ */ __name((response) => {
|
|
|
23325
22447
|
}, "nextByte");
|
|
23326
22448
|
var done = /* @__PURE__ */ __name((status) => status === 200 || status === 201, "done");
|
|
23327
22449
|
var uploadFile = /* @__PURE__ */ __name(async (input) => {
|
|
23328
|
-
const path =
|
|
22450
|
+
const path = resolve5(input.path);
|
|
23329
22451
|
let stat;
|
|
23330
22452
|
try {
|
|
23331
|
-
stat =
|
|
22453
|
+
stat = statSync2(path);
|
|
23332
22454
|
} catch {
|
|
23333
22455
|
throw new CliError("validation_error", "the file to upload could not be read", { reason: "file.unreadable" });
|
|
23334
22456
|
}
|
|
@@ -23358,7 +22480,7 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
|
|
|
23358
22480
|
modified_ms: stat.mtimeMs,
|
|
23359
22481
|
saved_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
23360
22482
|
};
|
|
23361
|
-
|
|
22483
|
+
writeFileSync2(checkpointPath, JSON.stringify(checkpoint), { mode: 384 });
|
|
23362
22484
|
}, "saveCheckpoint");
|
|
23363
22485
|
const clearCheckpoint = /* @__PURE__ */ __name(() => rmSync2(checkpointPath, { force: true }), "clearCheckpoint");
|
|
23364
22486
|
const start = /* @__PURE__ */ __name(async () => {
|
|
@@ -23459,8 +22581,8 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
|
|
|
23459
22581
|
}
|
|
23460
22582
|
clearCheckpoint();
|
|
23461
22583
|
const file = finished.data;
|
|
23462
|
-
const
|
|
23463
|
-
if (file.md5Checksum && file.md5Checksum !==
|
|
22584
|
+
const local = await md5Of(path);
|
|
22585
|
+
if (file.md5Checksum && file.md5Checksum !== local)
|
|
23464
22586
|
throw new CliError("provider_error", `uploaded file ${file.id} differs from the local file (MD5); upload it again`, {
|
|
23465
22587
|
reason: "upload.checksum-mismatch",
|
|
23466
22588
|
file_id: file.id
|
|
@@ -23469,7 +22591,7 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
|
|
|
23469
22591
|
id: String(file.id),
|
|
23470
22592
|
name: file.name ?? name,
|
|
23471
22593
|
size: Number(file.size ?? size2),
|
|
23472
|
-
md5: file.md5Checksum ??
|
|
22594
|
+
md5: file.md5Checksum ?? local,
|
|
23473
22595
|
parents: file.parents ?? [],
|
|
23474
22596
|
mime_type: file.mimeType ?? input.mime ?? "application/octet-stream",
|
|
23475
22597
|
resumed
|
|
@@ -23485,7 +22607,6 @@ var Preview = class extends Error {
|
|
|
23485
22607
|
}
|
|
23486
22608
|
};
|
|
23487
22609
|
var EXPORTS = /* @__PURE__ */ new Set(["documents export", "files download", "files export"]);
|
|
23488
|
-
var MCP_AGENT = "drive-mcp";
|
|
23489
22610
|
var googleOnly = /* @__PURE__ */ __name((effects) => effects?.local === "none" && effects.remote !== "none", "googleOnly");
|
|
23490
22611
|
var lateEnv = /* @__PURE__ */ __name((environment) => {
|
|
23491
22612
|
const current = /* @__PURE__ */ __name(() => environment().env ?? process.env, "current");
|
|
@@ -23579,14 +22700,14 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23579
22700
|
if (out.format !== "pretty")
|
|
23580
22701
|
return renderAnswer(command, out, whole);
|
|
23581
22702
|
const zone = timezoneOf();
|
|
23582
|
-
const
|
|
23583
|
-
renderAnswer(command, out,
|
|
23584
|
-
if (
|
|
22703
|
+
const local = localTimes(whole, zone);
|
|
22704
|
+
renderAnswer(command, out, local.value);
|
|
22705
|
+
if (local.changed || whole.meta.timezone)
|
|
23585
22706
|
out.streams.data(`times in ${whole.meta.timezone ?? zone}`);
|
|
23586
22707
|
}, "output");
|
|
23587
22708
|
const signal = /* @__PURE__ */ __name(() => environment().signal, "signal");
|
|
23588
22709
|
const signedIn = /* @__PURE__ */ __name(async (name, scope2) => {
|
|
23589
|
-
const { authorizedClient, checkAuthorization } = await import("./tokens-
|
|
22710
|
+
const { authorizedClient, checkAuthorization } = await import("./tokens-EHYO6D2X.js");
|
|
23590
22711
|
const client = authorizedClient(env, name, environment().keyring, signal());
|
|
23591
22712
|
await checkAuthorization(client, scope2);
|
|
23592
22713
|
return client;
|
|
@@ -23596,7 +22717,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23596
22717
|
const fake = environment().source;
|
|
23597
22718
|
if (fake)
|
|
23598
22719
|
return fake(name);
|
|
23599
|
-
const [{ googleSource }, client] = await Promise.all([import("./google-
|
|
22720
|
+
const [{ googleSource }, client] = await Promise.all([import("./google-VX7IPACN.js"), signedIn(name)]);
|
|
23600
22721
|
return googleSource(client);
|
|
23601
22722
|
}, "source");
|
|
23602
22723
|
const withIndex = /* @__PURE__ */ __name(async (fn, profile) => {
|
|
@@ -23675,8 +22796,14 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23675
22796
|
document: imported,
|
|
23676
22797
|
output,
|
|
23677
22798
|
complete: /* @__PURE__ */ __name(() => environment().complete ?? memoryModel(env, selected(), signal()), "complete"),
|
|
23678
|
-
author: /* @__PURE__ */ __name(() =>
|
|
23679
|
-
|
|
22799
|
+
author: /* @__PURE__ */ __name(() => {
|
|
22800
|
+
const actor = actorOf(program);
|
|
22801
|
+
return actor === "owner" ? "owner" : { bot: actor, kind: "agent" };
|
|
22802
|
+
}, "author"),
|
|
22803
|
+
decider: /* @__PURE__ */ __name(() => {
|
|
22804
|
+
const actor = actorOf(program);
|
|
22805
|
+
return actor === "owner" ? "owner" : { bot: actor, reason: `asked by ${actor} through drive` };
|
|
22806
|
+
}, "decider"),
|
|
23680
22807
|
run: /* @__PURE__ */ __name(async (input, fn) => withIndex(async (index) => {
|
|
23681
22808
|
const lock = await lockProfile(env, selected());
|
|
23682
22809
|
try {
|
|
@@ -23684,8 +22811,8 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23684
22811
|
if (!index.knowledge)
|
|
23685
22812
|
throw new CliError("configuration_error", "index has no shared knowledge adapter");
|
|
23686
22813
|
const principal = activeProfile(env, selected()).principal;
|
|
23687
|
-
const
|
|
23688
|
-
const found =
|
|
22814
|
+
const local = isDocumentRef(input) || /^\d+$/.test(input);
|
|
22815
|
+
const found = local ? void 0 : await index.catalog?.get(principal, fileId(input));
|
|
23689
22816
|
const ref = found?.ref ?? imported(input).ref;
|
|
23690
22817
|
const result = await fn(index.knowledge, principal, ref);
|
|
23691
22818
|
lock.assertHeld();
|
|
@@ -23701,7 +22828,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23701
22828
|
},
|
|
23702
22829
|
stored: storedDocument(context),
|
|
23703
22830
|
output,
|
|
23704
|
-
positive
|
|
22831
|
+
positive,
|
|
23705
22832
|
readBody: /* @__PURE__ */ __name((path) => {
|
|
23706
22833
|
const fake = environment().readBody;
|
|
23707
22834
|
if (fake)
|
|
@@ -23740,7 +22867,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23740
22867
|
if (fake)
|
|
23741
22868
|
return await fake.call(method, params, body);
|
|
23742
22869
|
const [{ googleApi }, client] = await Promise.all([
|
|
23743
|
-
import("./google-api-
|
|
22870
|
+
import("./google-api-RFXKRLL4.js"),
|
|
23744
22871
|
signedIn(selected(), descriptor.scope)
|
|
23745
22872
|
]);
|
|
23746
22873
|
return await googleApi(client).call(method, params, body);
|
|
@@ -23766,7 +22893,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23766
22893
|
if (fake)
|
|
23767
22894
|
return fake(id, mime);
|
|
23768
22895
|
const [{ googleDownload }, client] = await Promise.all([
|
|
23769
|
-
import("./google-api-
|
|
22896
|
+
import("./google-api-RFXKRLL4.js"),
|
|
23770
22897
|
signedIn(selected(), apiMethod(method).scope)
|
|
23771
22898
|
]);
|
|
23772
22899
|
return googleDownload(client)(id, mime);
|
|
@@ -23784,7 +22911,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
|
|
|
23784
22911
|
let request = environment().uploadRequest;
|
|
23785
22912
|
if (!request) {
|
|
23786
22913
|
const [{ googleUploadRequest }, client] = await Promise.all([
|
|
23787
|
-
import("./google-api-
|
|
22914
|
+
import("./google-api-RFXKRLL4.js"),
|
|
23788
22915
|
signedIn(selected(), apiMethod(method).scope)
|
|
23789
22916
|
]);
|
|
23790
22917
|
request = googleUploadRequest(client);
|
|
@@ -23997,7 +23124,7 @@ var mcpCommand = /* @__PURE__ */ __name(() => {
|
|
|
23997
23124
|
const environment = environmentOf(action);
|
|
23998
23125
|
if (environment.api)
|
|
23999
23126
|
return;
|
|
24000
|
-
const { grantAvailability } = await import("./grants-
|
|
23127
|
+
const { grantAvailability } = await import("./grants-4XWJFVD6.js");
|
|
24001
23128
|
availability = grantAvailability(rootOf(root), environment.env ?? process.env, environment.keyring);
|
|
24002
23129
|
});
|
|
24003
23130
|
}, "mcpCommand");
|