@wirecat/drive-cli 0.50.0 → 0.52.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/dist/bin/drive.js +2 -2
- package/dist/bundle/{all-profiles-WQTVOCIS.js → all-profiles-CYW6XBBS.js} +8 -8
- package/dist/bundle/{anthropic-YCA2AWIJ.js → anthropic-KW6KU36Y.js} +5 -5
- package/dist/bundle/{app-server-ZQOYUQJH.js → app-server-TCJZ333E.js} +53 -52
- package/dist/bundle/{bun-5NFIDHGM.js → bun-7SYKSCLA.js} +2 -2
- package/dist/bundle/{bun-sqlite-OAQE4M2E.js → bun-sqlite-RI7DR6RZ.js} +4 -4
- package/dist/bundle/{chunk-KZEOWOZV.js → chunk-234MHU76.js} +7 -7
- package/dist/bundle/{chunk-IGG4RBIZ.js → chunk-2623YE5I.js} +109 -98
- package/dist/bundle/{chunk-POD2GHQB.js → chunk-2AUXBJRX.js} +19 -19
- package/dist/bundle/{chunk-KEQ35HQQ.js → chunk-2UIMEMWU.js} +3 -3
- package/dist/bundle/{chunk-LNWRRK2H.js → chunk-33NVQGUY.js} +6 -6
- package/dist/bundle/{chunk-ZXD2I5ZQ.js → chunk-43QVYW3K.js} +49 -49
- package/dist/bundle/{chunk-BUALWXBT.js → chunk-4A2PIGC6.js} +1 -1
- package/dist/bundle/{chunk-3HNUH632.js → chunk-4CPLOMRK.js} +6 -6
- package/dist/bundle/{chunk-E656DAZT.js → chunk-4Z6TCU5T.js} +1 -1
- package/dist/bundle/{chunk-INVF3GXW.js → chunk-54O62JWP.js} +10 -10
- package/dist/bundle/{chunk-JA2YY7D4.js → chunk-5PLJKSG4.js} +7 -7
- package/dist/bundle/{chunk-XEETGCOC.js → chunk-6DHQTUB2.js} +1 -1
- package/dist/bundle/{chunk-ZKGYW63J.js → chunk-725OHXKR.js} +9 -9
- package/dist/bundle/chunk-7SH4JHYW.js +379 -0
- package/dist/bundle/{chunk-AO3NCZNT.js → chunk-7XKAVMCF.js} +8 -8
- package/dist/bundle/{chunk-PNUS224S.js → chunk-7YMDL4JQ.js} +8 -6
- package/dist/bundle/{chunk-CEUEXMIR.js → chunk-A4UNTWAX.js} +31 -27
- package/dist/bundle/{chunk-KYMGVMOS.js → chunk-ALJWBGD5.js} +1 -1
- package/dist/bundle/{chunk-QY3LK3OT.js → chunk-BSSCTWWK.js} +12 -12
- package/dist/bundle/{chunk-CCEVICWU.js → chunk-C6Z25IBJ.js} +49 -24
- package/dist/bundle/{chunk-ZJBRKR42.js → chunk-CB7SBYLO.js} +27 -27
- package/dist/bundle/{chunk-4VLUX3V5.js → chunk-CITFEQ6S.js} +1 -1
- package/dist/bundle/{chunk-Y73IZWRI.js → chunk-CKBHR7QO.js} +1 -1
- package/dist/bundle/{chunk-M2D4FXKY.js → chunk-CM7GAXGD.js} +5 -5
- package/dist/bundle/{chunk-OKSS7YUN.js → chunk-DLAFGSTN.js} +1 -1
- package/dist/bundle/{chunk-T7UZHKAS.js → chunk-DO4PDQY5.js} +2 -2
- package/dist/bundle/{chunk-P3T2SZW2.js → chunk-DW46P2DY.js} +1 -1
- package/dist/bundle/{chunk-Q3VG3UYV.js → chunk-F7UUZATI.js} +11 -11
- package/dist/bundle/{chunk-7SYSC7KX.js → chunk-FCJAHD4R.js} +2 -2
- package/dist/bundle/{chunk-QBECV7NO.js → chunk-FDWYPONW.js} +46 -34
- package/dist/bundle/{chunk-4SSUKRO4.js → chunk-FG4XXZZE.js} +2 -2
- package/dist/bundle/{chunk-DTHWL5YU.js → chunk-FJW3DDCF.js} +5 -5
- package/dist/bundle/{chunk-JHBX53SK.js → chunk-G6QF5KWF.js} +35 -35
- package/dist/bundle/{chunk-4J7UGHPK.js → chunk-G7DCVJ4F.js} +5 -5
- package/dist/bundle/{chunk-ZP735UUT.js → chunk-GR5GGZKH.js} +3 -3
- package/dist/bundle/{chunk-OL22OOIW.js → chunk-GVCN3GLZ.js} +16 -4
- package/dist/bundle/{chunk-2M5XEGVE.js → chunk-H47W2J6S.js} +638 -809
- package/dist/bundle/{chunk-HGWMX7BM.js → chunk-HQVJK5E7.js} +44 -22
- package/dist/bundle/{chunk-M6FQOGUW.js → chunk-HX7Y2ASG.js} +351 -282
- package/dist/bundle/{chunk-FSAM4Y2S.js → chunk-I7UH5CTA.js} +8 -8
- package/dist/bundle/{chunk-FABKIQ24.js → chunk-IDUNJCFO.js} +2 -2
- package/dist/bundle/{chunk-652YTDT5.js → chunk-IWFBAWZK.js} +15 -15
- package/dist/bundle/{chunk-3XX52F42.js → chunk-JEOYFKUK.js} +2 -2
- package/dist/bundle/{chunk-RTIMGPLN.js → chunk-KYVXMEBC.js} +3 -3
- package/dist/bundle/{chunk-IFM2APQB.js → chunk-LJAX6YCF.js} +2 -2
- package/dist/bundle/{chunk-R7XMCREL.js → chunk-LONV6HIK.js} +20 -20
- package/dist/bundle/{chunk-G75FZQAZ.js → chunk-NHBUTCNR.js} +10 -10
- package/dist/bundle/{chunk-5ZJHQ4TN.js → chunk-NPSZPUK6.js} +2 -2
- package/dist/bundle/{chunk-53UWCVSU.js → chunk-NSIFQ5OP.js} +1 -1
- package/dist/bundle/{chunk-HURI56SB.js → chunk-O6IOL6RX.js} +21 -21
- package/dist/bundle/{chunk-IA6LNKCF.js → chunk-PAXKALHV.js} +5 -5
- package/dist/bundle/{chunk-Z54E5LKF.js → chunk-PDGECM5D.js} +7 -7
- package/dist/bundle/{chunk-5OMLYNYB.js → chunk-PEOCBV2Z.js} +8 -8
- package/dist/bundle/{chunk-TATRMMOG.js → chunk-PQJYM5ES.js} +3 -3
- package/dist/bundle/{chunk-XGJUEH5C.js → chunk-PQYVPCJ2.js} +26 -26
- package/dist/bundle/{chunk-3CQNJKJT.js → chunk-PSNHPFSK.js} +1 -1
- package/dist/bundle/{chunk-6DDXB5WB.js → chunk-Q765VPZY.js} +2 -2
- package/dist/bundle/{chunk-YOABRW2M.js → chunk-R276546S.js} +1 -1
- package/dist/bundle/{chunk-QSDXVUJG.js → chunk-RNSP57TC.js} +4 -4
- package/dist/bundle/{chunk-VAETCXRI.js → chunk-UC22Q5KU.js} +11 -11
- package/dist/bundle/{chunk-EXYEDKTX.js → chunk-UR32UWTQ.js} +2 -2
- package/dist/bundle/{chunk-YROVFHPJ.js → chunk-VJZST5RD.js} +2 -2
- package/dist/bundle/{chunk-MMOG7ZVF.js → chunk-VSOLLTYT.js} +2 -2
- package/dist/bundle/{chunk-IUZ4PT2V.js → chunk-VZ2I62HN.js} +2 -2
- package/dist/bundle/{chunk-CTIQ77AB.js → chunk-W7IK7E4B.js} +17 -17
- package/dist/bundle/{chunk-C4PNAHI4.js → chunk-WBTVGFXI.js} +11 -11
- package/dist/bundle/{chunk-P6VN5UB4.js → chunk-WLFUBNFX.js} +4 -4
- package/dist/bundle/{chunk-Q27HCATD.js → chunk-WQJBAWQP.js} +534 -348
- package/dist/bundle/{chunk-4OLWMHS6.js → chunk-WQRGA75U.js} +15 -3
- package/dist/bundle/{chunk-5WN7JHQE.js → chunk-WUX7AUOQ.js} +26 -26
- package/dist/bundle/{chunk-VAK2Q2XG.js → chunk-X6ID5EAR.js} +16 -16
- package/dist/bundle/{chunk-5Z63NTC7.js → chunk-XOLQSCMF.js} +6 -6
- package/dist/bundle/{chunk-EY4CUQW2.js → chunk-YKZ4IPLB.js} +26 -9
- package/dist/bundle/{chunk-24TOKSZE.js → chunk-YNFELLNQ.js} +2 -2
- package/dist/bundle/{chunk-JSMPSOEM.js → chunk-YVPHJHIL.js} +3 -3
- package/dist/bundle/{chunk-QNLD7Y6Z.js → chunk-Z47LOJUS.js} +7 -7
- package/dist/bundle/{chunk-NHRJW3PH.js → chunk-ZDLIO76S.js} +2 -2
- package/dist/bundle/{chunk-OQEBGY74.js → chunk-ZNZUZGSV.js} +54 -47
- package/dist/bundle/{chunk-6E4PFCQ4.js → chunk-ZSXRDF6I.js} +1 -1
- package/dist/bundle/{chunk-UVPKSZSC.js → chunk-ZWSG7OCA.js} +4 -4
- package/dist/bundle/command-contract-I2YB5IXI.js +38 -0
- package/dist/bundle/{decode-YZRTP54O.js → decode-EDN2ARXZ.js} +19 -17
- package/dist/bundle/drive.js +7 -7
- package/dist/bundle/{echarts-C6HUK2FL.js → echarts-GXY34GHA.js} +2 -2
- package/dist/bundle/{embed-QRQ7ITFC.js → embed-3GSQIQXE.js} +5 -5
- package/dist/bundle/{embedder-EZDB3JPA.js → embedder-6ULWRG3R.js} +8 -8
- package/dist/bundle/{entry-4WQQKSYG.js → entry-IPRJLFHO.js} +6 -6
- package/dist/bundle/failure-4CVEVY45.js +37 -0
- package/dist/bundle/{first-run-ZAS4OV3T.js → first-run-FGHGWHC2.js} +9 -9
- package/dist/bundle/first-screen-M62KTPZG.js +36 -0
- package/dist/bundle/{google-KNILTIDW.js → google-BD3ZNFVJ.js} +9 -9
- package/dist/bundle/google-api-BDUWZMRV.js +83 -0
- package/dist/bundle/{identity-VBCGUXT5.js → identity-QLBSASO5.js} +2 -2
- package/dist/bundle/{instructions-II4M2WL3.js → instructions-K5BEQM4C.js} +1 -1
- package/dist/bundle/{login-4JACQVMD.js → login-VNZKRSAD.js} +65 -64
- package/dist/bundle/{mcp-6ZIAWU3N.js → mcp-5SNSMI2M.js} +82 -81
- package/dist/bundle/mcp-JZSYPQA4.js +96 -0
- package/dist/bundle/{mcp-ZYZ4DFW2.js → mcp-WSGVVZWI.js} +2 -2
- package/dist/bundle/{node-LIN7L4VQ.js → node-ZYWB7IET.js} +2 -2
- package/dist/bundle/{node-sqlite-VAH4KZN3.js → node-sqlite-J3OODPYK.js} +4 -4
- package/dist/bundle/{oauth-QUE3VCTU.js → oauth-L4VTCBLF.js} +6 -6
- package/dist/bundle/{open-DQ3EVYPB.js → open-SGUN7ZVF.js} +3 -3
- package/dist/bundle/openai-RLVISEDH.js +251 -0
- package/dist/bundle/{process-46XDWPVW.js → process-ZXO2MWRJ.js} +1 -1
- package/dist/bundle/{program-X3CZ4XDN.js → program-6S5EH7BS.js} +105 -103
- package/dist/bundle/{prompt-SAZYCZV3.js → prompt-AUWTBLO7.js} +4 -4
- package/dist/bundle/{reasons-366PI7OV.js → reasons-M5AKCNCU.js} +3 -3
- package/dist/bundle/{recognize-SSBOHOTW.js → recognize-ORX2UBQW.js} +5 -3
- package/dist/bundle/{remote-EL3FWCQE.js → remote-AGIJY73X.js} +6 -6
- package/dist/bundle/{rerank-RPIQRJIW.js → rerank-R6PE44M5.js} +6 -6
- package/dist/bundle/{serve-AX44DIKK.js → serve-VOBAQHAQ.js} +8 -8
- package/dist/bundle/server-24PS4M7U.js +70 -0
- package/dist/bundle/server-G6HFZ2CK.js +57 -0
- package/dist/bundle/{services-K4UOEMQD.js → services-HZFTTZSF.js} +35 -28
- package/dist/bundle/{sqlite-runtime-N7N3EYGH.js → sqlite-runtime-DTGPR2T2.js} +4 -4
- package/dist/bundle/{state-C3S5FD7V.js → state-WG3JKJM3.js} +5 -5
- package/dist/bundle/{store-4N3NBUGX.js → store-33VHIMEO.js} +14 -14
- package/dist/bundle/{store-QV4ZNEQ3.js → store-EV72MT5U.js} +16 -16
- package/dist/bundle/store-maintenance-command-ZTUEI4EC.js +58 -0
- package/dist/bundle/tokens-XDQXUFDQ.js +104 -0
- package/dist/commands/search.js +1 -1
- package/dist/commands/search.js.map +1 -1
- package/dist/contract-overrides.js +1 -1
- package/dist/contract-overrides.js.map +1 -1
- package/dist/knowledge-query.d.ts +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +1 -0
- package/dist/store.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/command-contract-TAWVO2G3.js +0 -38
- package/dist/bundle/failure-EEJGMWEP.js +0 -37
- package/dist/bundle/first-screen-6ICWD2N3.js +0 -36
- package/dist/bundle/google-api-CZACYX5T.js +0 -82
- package/dist/bundle/mcp-2BR2EX7L.js +0 -95
- package/dist/bundle/server-DCJIGUW2.js +0 -56
- package/dist/bundle/server-WWQSQBFT.js +0 -69
- package/dist/bundle/store-maintenance-command-QL4AECBD.js +0 -57
- package/dist/bundle/tokens-Y7HCOXOA.js +0 -103
- /package/dist/bundle/{chunk-2WNDZFGG.js → chunk-62EDJKGP.js} +0 -0
- /package/dist/bundle/{chunk-VDZZ46RT.js → chunk-FQRJWVEB.js} +0 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
covers,
|
|
5
|
+
grantedScopes
|
|
6
|
+
} from "./chunk-UC22Q5KU.js";
|
|
3
7
|
import {
|
|
4
8
|
GOOGLE_WRITE,
|
|
5
9
|
describeDriveProgram,
|
|
@@ -9,126 +13,123 @@ import {
|
|
|
9
13
|
policySettings,
|
|
10
14
|
profileSetLabel,
|
|
11
15
|
profileSetTokenFile
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-VDZZ46RT.js";
|
|
14
|
-
import "./chunk-ZP735UUT.js";
|
|
15
|
-
import {
|
|
16
|
-
apiMethod
|
|
17
|
-
} from "./chunk-JSMPSOEM.js";
|
|
18
|
-
import {
|
|
19
|
-
covers,
|
|
20
|
-
grantedScopes
|
|
21
|
-
} from "./chunk-VAETCXRI.js";
|
|
16
|
+
} from "./chunk-X6ID5EAR.js";
|
|
22
17
|
import {
|
|
23
18
|
paths
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-PAXKALHV.js";
|
|
20
|
+
import "./chunk-O6IOL6RX.js";
|
|
21
|
+
import "./chunk-FQRJWVEB.js";
|
|
22
|
+
import "./chunk-GR5GGZKH.js";
|
|
23
|
+
import {
|
|
24
|
+
apiMethod
|
|
25
|
+
} from "./chunk-YVPHJHIL.js";
|
|
26
26
|
import {
|
|
27
27
|
READ_SCOPE,
|
|
28
28
|
WRITE_SCOPE
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-HX7Y2ASG.js";
|
|
30
|
+
import "./chunk-R276546S.js";
|
|
31
31
|
import {
|
|
32
32
|
serveOverHttp
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-G7DCVJ4F.js";
|
|
34
|
+
import "./chunk-6DHQTUB2.js";
|
|
35
|
+
import "./chunk-ZWSG7OCA.js";
|
|
36
|
+
import "./chunk-A4UNTWAX.js";
|
|
37
37
|
import {
|
|
38
38
|
mcpUrlOf
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
42
|
-
import "./chunk-
|
|
39
|
+
} from "./chunk-DO4PDQY5.js";
|
|
40
|
+
import "./chunk-CITFEQ6S.js";
|
|
41
|
+
import "./chunk-F7UUZATI.js";
|
|
42
|
+
import "./chunk-PSNHPFSK.js";
|
|
43
43
|
import {
|
|
44
44
|
registerCommands
|
|
45
|
-
} from "./chunk-
|
|
46
|
-
import "./chunk-
|
|
45
|
+
} from "./chunk-PQYVPCJ2.js";
|
|
46
|
+
import "./chunk-IWFBAWZK.js";
|
|
47
47
|
import {
|
|
48
48
|
StdioServerTransport
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-FCJAHD4R.js";
|
|
50
50
|
import "./chunk-SBZB7HMU.js";
|
|
51
51
|
import {
|
|
52
52
|
DRIVE_APP
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-4A2PIGC6.js";
|
|
54
54
|
import {
|
|
55
55
|
mcpFailure
|
|
56
|
-
} from "./chunk-
|
|
57
|
-
import "./chunk-
|
|
56
|
+
} from "./chunk-4CPLOMRK.js";
|
|
57
|
+
import "./chunk-WQRGA75U.js";
|
|
58
58
|
import {
|
|
59
59
|
VERSION
|
|
60
|
-
} from "./chunk-
|
|
61
|
-
import "./chunk-
|
|
60
|
+
} from "./chunk-4Z6TCU5T.js";
|
|
61
|
+
import "./chunk-DW46P2DY.js";
|
|
62
62
|
import "./chunk-GNI7INK6.js";
|
|
63
|
-
import "./chunk-
|
|
63
|
+
import "./chunk-YNFELLNQ.js";
|
|
64
64
|
import {
|
|
65
65
|
McpServer,
|
|
66
66
|
fromJsonSchema
|
|
67
67
|
} from "./chunk-5FONRUG6.js";
|
|
68
68
|
import {
|
|
69
69
|
httpLockFile
|
|
70
|
-
} from "./chunk-
|
|
71
|
-
import "./chunk-
|
|
72
|
-
import "./chunk-
|
|
73
|
-
import "./chunk-
|
|
74
|
-
import "./chunk-
|
|
75
|
-
import "./chunk-
|
|
76
|
-
import "./chunk-
|
|
77
|
-
import "./chunk-
|
|
78
|
-
import "./chunk-
|
|
79
|
-
import "./chunk-
|
|
80
|
-
import "./chunk-
|
|
70
|
+
} from "./chunk-RNSP57TC.js";
|
|
71
|
+
import "./chunk-43QVYW3K.js";
|
|
72
|
+
import "./chunk-CB7SBYLO.js";
|
|
73
|
+
import "./chunk-2AUXBJRX.js";
|
|
74
|
+
import "./chunk-NPSZPUK6.js";
|
|
75
|
+
import "./chunk-KYVXMEBC.js";
|
|
76
|
+
import "./chunk-H47W2J6S.js";
|
|
77
|
+
import "./chunk-WUX7AUOQ.js";
|
|
78
|
+
import "./chunk-7SH4JHYW.js";
|
|
79
|
+
import "./chunk-Z47LOJUS.js";
|
|
80
|
+
import "./chunk-W7IK7E4B.js";
|
|
81
|
+
import "./chunk-I7UH5CTA.js";
|
|
81
82
|
import "./chunk-HTQTIKWP.js";
|
|
82
|
-
import "./chunk-
|
|
83
|
-
import "./chunk-
|
|
83
|
+
import "./chunk-5PLJKSG4.js";
|
|
84
|
+
import "./chunk-2623YE5I.js";
|
|
84
85
|
import {
|
|
85
86
|
changesAuthorityAt
|
|
86
|
-
} from "./chunk-
|
|
87
|
-
import "./chunk-
|
|
87
|
+
} from "./chunk-FDWYPONW.js";
|
|
88
|
+
import "./chunk-PEOCBV2Z.js";
|
|
88
89
|
import {
|
|
89
90
|
flatten
|
|
90
|
-
} from "./chunk-
|
|
91
|
-
import "./chunk-
|
|
92
|
-
import "./chunk-
|
|
93
|
-
import "./chunk-
|
|
94
|
-
import "./chunk-
|
|
95
|
-
import "./chunk-
|
|
96
|
-
import "./chunk-
|
|
97
|
-
import "./chunk-
|
|
98
|
-
import "./chunk-
|
|
99
|
-
import "./chunk-
|
|
100
|
-
import "./chunk-
|
|
101
|
-
import "./chunk-
|
|
102
|
-
import "./chunk-
|
|
103
|
-
import "./chunk-
|
|
104
|
-
import "./chunk-
|
|
105
|
-
import "./chunk-
|
|
106
|
-
import "./chunk-
|
|
107
|
-
import "./chunk-
|
|
91
|
+
} from "./chunk-725OHXKR.js";
|
|
92
|
+
import "./chunk-NSIFQ5OP.js";
|
|
93
|
+
import "./chunk-LONV6HIK.js";
|
|
94
|
+
import "./chunk-VSOLLTYT.js";
|
|
95
|
+
import "./chunk-Q765VPZY.js";
|
|
96
|
+
import "./chunk-GVCN3GLZ.js";
|
|
97
|
+
import "./chunk-WBTVGFXI.js";
|
|
98
|
+
import "./chunk-7YMDL4JQ.js";
|
|
99
|
+
import "./chunk-DLAFGSTN.js";
|
|
100
|
+
import "./chunk-WLFUBNFX.js";
|
|
101
|
+
import "./chunk-54O62JWP.js";
|
|
102
|
+
import "./chunk-ZDLIO76S.js";
|
|
103
|
+
import "./chunk-PQJYM5ES.js";
|
|
104
|
+
import "./chunk-UR32UWTQ.js";
|
|
105
|
+
import "./chunk-LJAX6YCF.js";
|
|
106
|
+
import "./chunk-VZ2I62HN.js";
|
|
107
|
+
import "./chunk-2UIMEMWU.js";
|
|
108
|
+
import "./chunk-CM7GAXGD.js";
|
|
108
109
|
import "./chunk-5DPV7X27.js";
|
|
109
|
-
import "./chunk-
|
|
110
|
-
import "./chunk-
|
|
110
|
+
import "./chunk-BSSCTWWK.js";
|
|
111
|
+
import "./chunk-IDUNJCFO.js";
|
|
111
112
|
import {
|
|
112
113
|
openStore
|
|
113
|
-
} from "./chunk-
|
|
114
|
-
import "./chunk-
|
|
115
|
-
import "./chunk-
|
|
116
|
-
import "./chunk-
|
|
117
|
-
import "./chunk-
|
|
114
|
+
} from "./chunk-WQJBAWQP.js";
|
|
115
|
+
import "./chunk-JEOYFKUK.js";
|
|
116
|
+
import "./chunk-234MHU76.js";
|
|
117
|
+
import "./chunk-PDGECM5D.js";
|
|
118
|
+
import "./chunk-ZNZUZGSV.js";
|
|
118
119
|
import {
|
|
119
120
|
QUERY_LIMITS
|
|
120
|
-
} from "./chunk-
|
|
121
|
-
import "./chunk-
|
|
122
|
-
import "./chunk-
|
|
123
|
-
import "./chunk-
|
|
121
|
+
} from "./chunk-NHBUTCNR.js";
|
|
122
|
+
import "./chunk-62EDJKGP.js";
|
|
123
|
+
import "./chunk-7XKAVMCF.js";
|
|
124
|
+
import "./chunk-XOLQSCMF.js";
|
|
124
125
|
import {
|
|
125
126
|
storePath
|
|
126
|
-
} from "./chunk-
|
|
127
|
-
import "./chunk-
|
|
127
|
+
} from "./chunk-VJZST5RD.js";
|
|
128
|
+
import "./chunk-33NVQGUY.js";
|
|
128
129
|
import {
|
|
129
130
|
captureStreams,
|
|
130
131
|
visibleControls
|
|
131
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-HQVJK5E7.js";
|
|
132
133
|
import {
|
|
133
134
|
CliError,
|
|
134
135
|
array,
|
|
@@ -141,9 +142,9 @@ import {
|
|
|
141
142
|
pipe,
|
|
142
143
|
string,
|
|
143
144
|
writes
|
|
144
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-YKZ4IPLB.js";
|
|
145
146
|
import "./chunk-Y5E2WNWB.js";
|
|
146
|
-
import "./chunk-
|
|
147
|
+
import "./chunk-ALJWBGD5.js";
|
|
147
148
|
import {
|
|
148
149
|
__name
|
|
149
150
|
} from "./chunk-ZVVMGPBJ.js";
|
|
@@ -443,7 +444,7 @@ var serveProfiles = /* @__PURE__ */ __name(async ({ env, set, permissions, note,
|
|
|
443
444
|
const { profiles } = set;
|
|
444
445
|
if (profiles().length === 0)
|
|
445
446
|
throw new CliError("configuration_error", "no drive profile here yet; create one with drive personal session start, then run drive mcp serve --profiles all again");
|
|
446
|
-
const { serveAllProfilesOverHttp, serveAllProfilesOverStdio } = await import("./mcp-
|
|
447
|
+
const { serveAllProfilesOverHttp, serveAllProfilesOverStdio } = await import("./mcp-JZSYPQA4.js");
|
|
447
448
|
const script = realpathSync(process.argv[1] ?? "");
|
|
448
449
|
const tightened = permissions.flatMap((entry) => ["--permission", entry]);
|
|
449
450
|
const options = {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import "./chunk-FQRJWVEB.js";
|
|
4
|
+
import {
|
|
5
|
+
MCP_PATH,
|
|
6
|
+
serveOverHttp
|
|
7
|
+
} from "./chunk-G7DCVJ4F.js";
|
|
8
|
+
import "./chunk-6DHQTUB2.js";
|
|
9
|
+
import {
|
|
10
|
+
allProfilesServer,
|
|
11
|
+
serveAllProfilesOverHttp,
|
|
12
|
+
serveAllProfilesOverStdio
|
|
13
|
+
} from "./chunk-ZWSG7OCA.js";
|
|
14
|
+
import {
|
|
15
|
+
mcpUrlOf,
|
|
16
|
+
portOf,
|
|
17
|
+
publicUrlOf
|
|
18
|
+
} from "./chunk-DO4PDQY5.js";
|
|
19
|
+
import "./chunk-CITFEQ6S.js";
|
|
20
|
+
import {
|
|
21
|
+
createBotServer
|
|
22
|
+
} from "./chunk-F7UUZATI.js";
|
|
23
|
+
import "./chunk-PSNHPFSK.js";
|
|
24
|
+
import {
|
|
25
|
+
registerCommands,
|
|
26
|
+
runCommandForAgent,
|
|
27
|
+
toolsFromCommands
|
|
28
|
+
} from "./chunk-PQYVPCJ2.js";
|
|
29
|
+
import "./chunk-IWFBAWZK.js";
|
|
30
|
+
import "./chunk-FCJAHD4R.js";
|
|
31
|
+
import "./chunk-WQRGA75U.js";
|
|
32
|
+
import {
|
|
33
|
+
revokeAll
|
|
34
|
+
} from "./chunk-YNFELLNQ.js";
|
|
35
|
+
import "./chunk-5FONRUG6.js";
|
|
36
|
+
import {
|
|
37
|
+
httpLockFile
|
|
38
|
+
} from "./chunk-RNSP57TC.js";
|
|
39
|
+
import "./chunk-2AUXBJRX.js";
|
|
40
|
+
import "./chunk-KYVXMEBC.js";
|
|
41
|
+
import "./chunk-H47W2J6S.js";
|
|
42
|
+
import "./chunk-WUX7AUOQ.js";
|
|
43
|
+
import "./chunk-7SH4JHYW.js";
|
|
44
|
+
import "./chunk-Z47LOJUS.js";
|
|
45
|
+
import "./chunk-W7IK7E4B.js";
|
|
46
|
+
import "./chunk-2623YE5I.js";
|
|
47
|
+
import "./chunk-FDWYPONW.js";
|
|
48
|
+
import "./chunk-PEOCBV2Z.js";
|
|
49
|
+
import "./chunk-725OHXKR.js";
|
|
50
|
+
import "./chunk-NSIFQ5OP.js";
|
|
51
|
+
import "./chunk-LONV6HIK.js";
|
|
52
|
+
import "./chunk-VSOLLTYT.js";
|
|
53
|
+
import "./chunk-Q765VPZY.js";
|
|
54
|
+
import "./chunk-GVCN3GLZ.js";
|
|
55
|
+
import "./chunk-7YMDL4JQ.js";
|
|
56
|
+
import "./chunk-DLAFGSTN.js";
|
|
57
|
+
import "./chunk-WLFUBNFX.js";
|
|
58
|
+
import "./chunk-ZDLIO76S.js";
|
|
59
|
+
import "./chunk-UR32UWTQ.js";
|
|
60
|
+
import "./chunk-VZ2I62HN.js";
|
|
61
|
+
import "./chunk-2UIMEMWU.js";
|
|
62
|
+
import "./chunk-CM7GAXGD.js";
|
|
63
|
+
import "./chunk-5DPV7X27.js";
|
|
64
|
+
import "./chunk-BSSCTWWK.js";
|
|
65
|
+
import "./chunk-WQJBAWQP.js";
|
|
66
|
+
import "./chunk-JEOYFKUK.js";
|
|
67
|
+
import "./chunk-234MHU76.js";
|
|
68
|
+
import "./chunk-PDGECM5D.js";
|
|
69
|
+
import "./chunk-ZNZUZGSV.js";
|
|
70
|
+
import "./chunk-NHBUTCNR.js";
|
|
71
|
+
import "./chunk-62EDJKGP.js";
|
|
72
|
+
import "./chunk-7XKAVMCF.js";
|
|
73
|
+
import "./chunk-XOLQSCMF.js";
|
|
74
|
+
import "./chunk-VJZST5RD.js";
|
|
75
|
+
import "./chunk-33NVQGUY.js";
|
|
76
|
+
import "./chunk-HQVJK5E7.js";
|
|
77
|
+
import "./chunk-YKZ4IPLB.js";
|
|
78
|
+
import "./chunk-Y5E2WNWB.js";
|
|
79
|
+
import "./chunk-ALJWBGD5.js";
|
|
80
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
81
|
+
export {
|
|
82
|
+
MCP_PATH,
|
|
83
|
+
allProfilesServer,
|
|
84
|
+
createBotServer,
|
|
85
|
+
httpLockFile,
|
|
86
|
+
mcpUrlOf,
|
|
87
|
+
portOf,
|
|
88
|
+
publicUrlOf,
|
|
89
|
+
registerCommands,
|
|
90
|
+
revokeAll,
|
|
91
|
+
runCommandForAgent,
|
|
92
|
+
serveAllProfilesOverHttp,
|
|
93
|
+
serveAllProfilesOverStdio,
|
|
94
|
+
serveOverHttp,
|
|
95
|
+
toolsFromCommands
|
|
96
|
+
};
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
executableEnvironment,
|
|
5
5
|
executableOnPath,
|
|
6
6
|
require_cross_spawn
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DLAFGSTN.js";
|
|
8
8
|
import {
|
|
9
9
|
__name,
|
|
10
10
|
__toESM
|
|
11
11
|
} from "./chunk-ZVVMGPBJ.js";
|
|
12
12
|
|
|
13
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/mcp/index.js
|
|
14
14
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
15
15
|
var realRun = /* @__PURE__ */ __name((file, args) => {
|
|
16
16
|
const result = import_cross_spawn.default.sync(executableOnPath(file, process.env), args, {
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
jitCompatCheck,
|
|
19
19
|
refineSqliteCodecs,
|
|
20
20
|
sql
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ALJWBGD5.js";
|
|
22
22
|
import {
|
|
23
23
|
__name
|
|
24
24
|
} from "./chunk-ZVVMGPBJ.js";
|
|
25
25
|
|
|
26
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/node.js
|
|
27
27
|
import { DatabaseSync } from "node:sqlite";
|
|
28
28
|
var nodeSQLiteCodecs = refineSqliteCodecs({
|
|
29
29
|
"integer:boolean": { normalize: booleanFromInteger },
|
|
@@ -3,15 +3,15 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
loadVectorExtension,
|
|
5
5
|
vectorExtension
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-FG4XXZZE.js";
|
|
7
|
+
import "./chunk-HQVJK5E7.js";
|
|
8
|
+
import "./chunk-YKZ4IPLB.js";
|
|
9
9
|
import "./chunk-Y5E2WNWB.js";
|
|
10
10
|
import {
|
|
11
11
|
__name
|
|
12
12
|
} from "./chunk-ZVVMGPBJ.js";
|
|
13
13
|
|
|
14
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/drivers/node-sqlite.js
|
|
15
15
|
import { DatabaseSync } from "node:sqlite";
|
|
16
16
|
var openWithNodeSqlite = /* @__PURE__ */ __name(async (path) => cacheOverNodeSqlite(await nodeClient(path)), "openWithNodeSqlite");
|
|
17
17
|
var nodeClient = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
@@ -3,13 +3,13 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
ownerLogin,
|
|
5
5
|
revokeAll
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YNFELLNQ.js";
|
|
7
7
|
import "./chunk-5FONRUG6.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-RNSP57TC.js";
|
|
9
|
+
import "./chunk-KYVXMEBC.js";
|
|
10
|
+
import "./chunk-NSIFQ5OP.js";
|
|
11
|
+
import "./chunk-HQVJK5E7.js";
|
|
12
|
+
import "./chunk-YKZ4IPLB.js";
|
|
13
13
|
import "./chunk-Y5E2WNWB.js";
|
|
14
14
|
import "./chunk-ZVVMGPBJ.js";
|
|
15
15
|
export {
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
openCache,
|
|
7
7
|
openFile,
|
|
8
8
|
storeCapable
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-33NVQGUY.js";
|
|
10
|
+
import "./chunk-HQVJK5E7.js";
|
|
11
|
+
import "./chunk-YKZ4IPLB.js";
|
|
12
12
|
import "./chunk-Y5E2WNWB.js";
|
|
13
13
|
import "./chunk-ZVVMGPBJ.js";
|
|
14
14
|
export {
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
SAMPLE_RATE,
|
|
5
|
+
toModelRate
|
|
6
|
+
} from "./chunk-C6Z25IBJ.js";
|
|
7
|
+
import "./chunk-7SH4JHYW.js";
|
|
8
|
+
import {
|
|
9
|
+
OPENAI_URL
|
|
10
|
+
} from "./chunk-2UIMEMWU.js";
|
|
11
|
+
import "./chunk-CM7GAXGD.js";
|
|
12
|
+
import "./chunk-5DPV7X27.js";
|
|
13
|
+
import {
|
|
14
|
+
OPENAI_TRANSCRIBE_MODEL,
|
|
15
|
+
VAD,
|
|
16
|
+
filesPresent,
|
|
17
|
+
modelsDirectory,
|
|
18
|
+
vadPath
|
|
19
|
+
} from "./chunk-BSSCTWWK.js";
|
|
20
|
+
import "./chunk-VJZST5RD.js";
|
|
21
|
+
import {
|
|
22
|
+
DEFAULT_RETRY,
|
|
23
|
+
backoffMs
|
|
24
|
+
} from "./chunk-HQVJK5E7.js";
|
|
25
|
+
import {
|
|
26
|
+
CliError
|
|
27
|
+
} from "./chunk-YKZ4IPLB.js";
|
|
28
|
+
import "./chunk-Y5E2WNWB.js";
|
|
29
|
+
import {
|
|
30
|
+
__name
|
|
31
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
32
|
+
|
|
33
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/speech/openai.js
|
|
34
|
+
import { setTimeout as wait } from "node:timers/promises";
|
|
35
|
+
|
|
36
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/index.js
|
|
37
|
+
var parseRetryAfter = /* @__PURE__ */ __name((header, now) => {
|
|
38
|
+
if (!header)
|
|
39
|
+
return void 0;
|
|
40
|
+
const trimmed = header.trim();
|
|
41
|
+
if (/^\d+$/.test(trimmed))
|
|
42
|
+
return Number(trimmed) * 1e3;
|
|
43
|
+
const at = Date.parse(trimmed);
|
|
44
|
+
if (Number.isNaN(at))
|
|
45
|
+
return void 0;
|
|
46
|
+
const delta = at - now().getTime();
|
|
47
|
+
return delta > 0 ? delta : void 0;
|
|
48
|
+
}, "parseRetryAfter");
|
|
49
|
+
var parseRateLimitReset = /* @__PURE__ */ __name((header, now) => {
|
|
50
|
+
if (!header)
|
|
51
|
+
return void 0;
|
|
52
|
+
const seconds = Number(header.trim());
|
|
53
|
+
if (!Number.isFinite(seconds))
|
|
54
|
+
return void 0;
|
|
55
|
+
const delta = seconds * 1e3 - now().getTime();
|
|
56
|
+
return delta > 0 ? delta : void 0;
|
|
57
|
+
}, "parseRateLimitReset");
|
|
58
|
+
var providerWaitMs = /* @__PURE__ */ __name((headers, now) => parseRetryAfter(headers.get("retry-after"), now) ?? parseRateLimitReset(headers.get("x-ratelimit-reset"), now), "providerWaitMs");
|
|
59
|
+
|
|
60
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/speech/wav.js
|
|
61
|
+
var encodeWav = /* @__PURE__ */ __name((samples, sampleRate = 16e3) => {
|
|
62
|
+
const bytes = Buffer.alloc(44 + samples.length * 2);
|
|
63
|
+
bytes.write("RIFF", 0, "ascii");
|
|
64
|
+
bytes.writeUInt32LE(bytes.length - 8, 4);
|
|
65
|
+
bytes.write("WAVEfmt ", 8, "ascii");
|
|
66
|
+
bytes.writeUInt32LE(16, 16);
|
|
67
|
+
bytes.writeUInt16LE(1, 20);
|
|
68
|
+
bytes.writeUInt16LE(1, 22);
|
|
69
|
+
bytes.writeUInt32LE(sampleRate, 24);
|
|
70
|
+
bytes.writeUInt32LE(sampleRate * 2, 28);
|
|
71
|
+
bytes.writeUInt16LE(2, 32);
|
|
72
|
+
bytes.writeUInt16LE(16, 34);
|
|
73
|
+
bytes.write("data", 36, "ascii");
|
|
74
|
+
bytes.writeUInt32LE(samples.length * 2, 40);
|
|
75
|
+
samples.forEach((sample, index) => {
|
|
76
|
+
bytes.writeInt16LE(Math.round(Math.max(-1, Math.min(1, sample || 0)) * 32767), 44 + index * 2);
|
|
77
|
+
});
|
|
78
|
+
return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
79
|
+
}, "encodeWav");
|
|
80
|
+
|
|
81
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/speech/openai.js
|
|
82
|
+
var LONGEST_REQUEST_SECONDS = 600;
|
|
83
|
+
var JOINED_SECONDS = 0.2;
|
|
84
|
+
var PAD_SECONDS = 0.2;
|
|
85
|
+
var LEAD = SAMPLE_RATE / 2;
|
|
86
|
+
var EXHAUSTED = /* @__PURE__ */ new Set([
|
|
87
|
+
"insufficient_quota",
|
|
88
|
+
"credit_balance_exhausted",
|
|
89
|
+
"organization_spend_limit_exceeded",
|
|
90
|
+
"project_spend_limit_exceeded",
|
|
91
|
+
"organization_usage_limit_exceeded"
|
|
92
|
+
]);
|
|
93
|
+
var RETRY = { ...DEFAULT_RETRY, retries: 4 };
|
|
94
|
+
var interrupted = /* @__PURE__ */ __name((signal) => {
|
|
95
|
+
if (!signal?.aborted)
|
|
96
|
+
return;
|
|
97
|
+
if (signal.reason instanceof CliError)
|
|
98
|
+
throw signal.reason;
|
|
99
|
+
const timeout = signal.reason instanceof Error && signal.reason.name === "TimeoutError";
|
|
100
|
+
throw new CliError(timeout ? "timeout" : "cancelled", "the transcription was interrupted");
|
|
101
|
+
}, "interrupted");
|
|
102
|
+
var sleeping = /* @__PURE__ */ __name((ms, signal) => wait(ms, void 0, signal ? { signal } : {}).then(() => void 0, (error) => {
|
|
103
|
+
interrupted(signal);
|
|
104
|
+
throw error;
|
|
105
|
+
}), "sleeping");
|
|
106
|
+
var formOf = /* @__PURE__ */ __name((wav, options) => {
|
|
107
|
+
const form = new FormData();
|
|
108
|
+
form.append("file", new Blob([wav], { type: "audio/wav" }), "audio.wav");
|
|
109
|
+
form.append("model", options.model ?? OPENAI_TRANSCRIBE_MODEL);
|
|
110
|
+
for (const language of options.languages ?? [])
|
|
111
|
+
form.append("languages[]", language);
|
|
112
|
+
for (const keyword of options.keywords ?? [])
|
|
113
|
+
form.append("keywords[]", keyword);
|
|
114
|
+
if (options.prompt)
|
|
115
|
+
form.append("prompt", options.prompt);
|
|
116
|
+
return form;
|
|
117
|
+
}, "formOf");
|
|
118
|
+
var safe = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[\w.-]{1,64}$/.test(value) ? value : void 0, "safe");
|
|
119
|
+
var failureOf = /* @__PURE__ */ __name(async (response) => {
|
|
120
|
+
try {
|
|
121
|
+
const body = await response.json();
|
|
122
|
+
const code = safe(body.error?.code);
|
|
123
|
+
const type = safe(body.error?.type);
|
|
124
|
+
return { ...code ? { code } : {}, ...type ? { type } : {} };
|
|
125
|
+
} catch {
|
|
126
|
+
return {};
|
|
127
|
+
}
|
|
128
|
+
}, "failureOf");
|
|
129
|
+
var send = /* @__PURE__ */ __name(async (wav, options) => {
|
|
130
|
+
const post = options.fetch ?? fetch;
|
|
131
|
+
const retry = options.retry ?? RETRY;
|
|
132
|
+
const sleep = options.sleep ?? sleeping;
|
|
133
|
+
const random = options.random ?? Math.random;
|
|
134
|
+
const url = `${(options.baseUrl ?? OPENAI_URL).replace(/\/+$/, "")}/audio/transcriptions`;
|
|
135
|
+
for (let attempt = 1; ; attempt++) {
|
|
136
|
+
interrupted(options.signal);
|
|
137
|
+
let response;
|
|
138
|
+
try {
|
|
139
|
+
response = await post(url, {
|
|
140
|
+
method: "POST",
|
|
141
|
+
headers: { authorization: `Bearer ${options.apiKey}` },
|
|
142
|
+
body: formOf(wav, options),
|
|
143
|
+
...options.signal ? { signal: options.signal } : {}
|
|
144
|
+
});
|
|
145
|
+
} catch {
|
|
146
|
+
interrupted(options.signal);
|
|
147
|
+
if (attempt > retry.retries)
|
|
148
|
+
throw new CliError("network_error", "OpenAI could not be reached", { reason: "network.failed" });
|
|
149
|
+
await sleep(backoffMs(attempt, retry, random), options.signal);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (response.ok) {
|
|
153
|
+
const body = await response.json().catch(() => interrupted(options.signal));
|
|
154
|
+
if (typeof body?.text !== "string")
|
|
155
|
+
throw new CliError("invalid_response", "OpenAI answered without a transcript", {
|
|
156
|
+
reason: "provider.invalid-response"
|
|
157
|
+
});
|
|
158
|
+
return body.text.trim();
|
|
159
|
+
}
|
|
160
|
+
const { code, type } = await failureOf(response);
|
|
161
|
+
const status = response.status;
|
|
162
|
+
const said = `HTTP ${status}${code ? `, ${code}` : type ? `, ${type}` : ""}`;
|
|
163
|
+
if (status === 401)
|
|
164
|
+
throw new CliError("authentication_error", `OpenAI refused the key (${said}) \u2014 set it again with \`models keys set openai\``, { reason: "auth.failed" });
|
|
165
|
+
if (status === 403)
|
|
166
|
+
throw new CliError("permission_error", `OpenAI refused the request (${said}) \u2014 it answers this when the country or region is not supported, or the key's project may not use the model`, { reason: "access.denied" });
|
|
167
|
+
if (status === 413)
|
|
168
|
+
throw new CliError("validation_error", `OpenAI refused the audio as too large (${said})`, {
|
|
169
|
+
reason: "transcription.too-large"
|
|
170
|
+
});
|
|
171
|
+
if (EXHAUSTED.has(code ?? "") || EXHAUSTED.has(type ?? ""))
|
|
172
|
+
throw new CliError("permission_error", `OpenAI refused: the account's credit, spend limit or usage limit is used up (${said}) \u2014 see the billing page`, { reason: "transcription.quota-exhausted" });
|
|
173
|
+
const again = status === 408 || status === 429 || status >= 500;
|
|
174
|
+
const asked = providerWaitMs(response.headers, () => /* @__PURE__ */ new Date());
|
|
175
|
+
if (again && attempt <= retry.retries && (asked === void 0 || asked <= retry.maxRetryAfterMs)) {
|
|
176
|
+
await sleep(asked ?? backoffMs(attempt, retry, random), options.signal);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (status === 429)
|
|
180
|
+
throw new CliError("rate_limited", `OpenAI answered ${said}`, {
|
|
181
|
+
reason: "provider.rate-limited",
|
|
182
|
+
...asked === void 0 ? {} : { retry_after_ms: asked }
|
|
183
|
+
});
|
|
184
|
+
if (status >= 500)
|
|
185
|
+
throw new CliError([502, 503, 504].includes(status) ? "provider_unavailable" : "provider_error", `OpenAI answered ${said}`, { reason: [502, 503, 504].includes(status) ? "provider.unavailable" : "provider.refused" });
|
|
186
|
+
throw new CliError("provider_error", `OpenAI answered ${said}`, { reason: "provider.refused" });
|
|
187
|
+
}
|
|
188
|
+
}, "send");
|
|
189
|
+
var piecesOf = /* @__PURE__ */ __name((spans, limit) => {
|
|
190
|
+
const pieces = [];
|
|
191
|
+
for (const span of spans) {
|
|
192
|
+
const last = pieces.at(-1);
|
|
193
|
+
const joined = last !== void 0 && span.start - last.end < JOINED_SECONDS;
|
|
194
|
+
const fits = last !== void 0 && limit !== void 0 && span.end - last.start <= limit;
|
|
195
|
+
if (last && (fits || joined && span.end - last.start <= LONGEST_REQUEST_SECONDS))
|
|
196
|
+
last.end = span.end;
|
|
197
|
+
else
|
|
198
|
+
pieces.push({ start: span.start, end: span.end });
|
|
199
|
+
}
|
|
200
|
+
return pieces;
|
|
201
|
+
}, "piecesOf");
|
|
202
|
+
var openCutter = /* @__PURE__ */ __name(async (vadModel) => {
|
|
203
|
+
const { openSpeechCutter } = await import("./recognize-ORX2UBQW.js");
|
|
204
|
+
return openSpeechCutter(vadModel);
|
|
205
|
+
}, "openCutter");
|
|
206
|
+
var checkKeywords = /* @__PURE__ */ __name((keywords = []) => {
|
|
207
|
+
const bad = keywords.find((keyword) => typeof keyword !== "string" || !keyword.trim() || /[<>\r\n]/.test(keyword));
|
|
208
|
+
if (bad !== void 0)
|
|
209
|
+
throw new CliError("validation_error", "a keyword must be a non-empty single line without < or > \u2014 OpenAI refuses the whole request otherwise");
|
|
210
|
+
}, "checkKeywords");
|
|
211
|
+
var transcribeOpenAI = /* @__PURE__ */ __name(async (audio, options) => {
|
|
212
|
+
if (!options.apiKey)
|
|
213
|
+
throw new CliError("authentication_error", "no OpenAI key \u2014 `models keys set openai`, or OPENAI_API_KEY", {
|
|
214
|
+
reason: "transcription.no-key"
|
|
215
|
+
});
|
|
216
|
+
checkKeywords(options.keywords);
|
|
217
|
+
interrupted(options.signal);
|
|
218
|
+
const pcm = toModelRate(audio.samples, audio.rate);
|
|
219
|
+
const duration = (pcm.length - LEAD) / SAMPLE_RATE;
|
|
220
|
+
if (options.bundle && duration <= LONGEST_REQUEST_SECONDS) {
|
|
221
|
+
const text = await send(encodeWav(pcm.subarray(LEAD)), options);
|
|
222
|
+
return text ? [{ start: 0, end: duration, text }] : [];
|
|
223
|
+
}
|
|
224
|
+
const vadModel = options.vadModel ?? vadPath(modelsDirectory(options.env));
|
|
225
|
+
if (!options.cutter && !filesPresent([[VAD, vadModel]]))
|
|
226
|
+
throw new CliError("not_found", "the voice detector that finds the speech is not on this machine \u2014 it comes with any speech model: `models download`", { reason: "model.not-downloaded", model: "silero_vad" });
|
|
227
|
+
const cutter = await (options.cutter ?? openCutter)(vadModel);
|
|
228
|
+
let spans;
|
|
229
|
+
try {
|
|
230
|
+
spans = cutter.cut(pcm);
|
|
231
|
+
} finally {
|
|
232
|
+
cutter.free();
|
|
233
|
+
}
|
|
234
|
+
const pieces = piecesOf(spans, options.bundle ? LONGEST_REQUEST_SECONDS : void 0);
|
|
235
|
+
const heard = [];
|
|
236
|
+
for (const [index, piece] of pieces.entries()) {
|
|
237
|
+
const end = Math.min(piece.end, duration);
|
|
238
|
+
const from = Math.max(piece.start - PAD_SECONDS, pieces[index - 1]?.end ?? 0);
|
|
239
|
+
const to = Math.min(end + PAD_SECONDS, pieces[index + 1]?.start ?? duration);
|
|
240
|
+
const samples = pcm.subarray(LEAD + Math.floor(from * SAMPLE_RATE), LEAD + Math.ceil(to * SAMPLE_RATE));
|
|
241
|
+
const text = await send(encodeWav(samples), options);
|
|
242
|
+
if (text)
|
|
243
|
+
heard.push({ start: Math.min(piece.start, end), end, text });
|
|
244
|
+
}
|
|
245
|
+
return heard;
|
|
246
|
+
}, "transcribeOpenAI");
|
|
247
|
+
export {
|
|
248
|
+
LONGEST_REQUEST_SECONDS,
|
|
249
|
+
piecesOf,
|
|
250
|
+
transcribeOpenAI
|
|
251
|
+
};
|