@wirecat/drive-cli 0.51.0 → 0.52.1
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 +2 -2
- package/dist/bin/drive.js +2 -2
- package/dist/bundle/{all-profiles-H3APJWSO.js → all-profiles-CYW6XBBS.js} +8 -8
- package/dist/bundle/{anthropic-P7DXFYFE.js → anthropic-KW6KU36Y.js} +5 -5
- package/dist/bundle/{app-server-IQUR7ZC2.js → app-server-TCJZ333E.js} +53 -52
- package/dist/bundle/{bun-LZUEW2ML.js → bun-7SYKSCLA.js} +2 -2
- package/dist/bundle/{bun-sqlite-6LUE7UA6.js → bun-sqlite-RI7DR6RZ.js} +4 -4
- package/dist/bundle/{chunk-7ZNM6KXP.js → chunk-234MHU76.js} +7 -7
- package/dist/bundle/{chunk-U7DPS46V.js → chunk-2623YE5I.js} +107 -96
- package/dist/bundle/{chunk-UW7VXKKZ.js → chunk-2AUXBJRX.js} +19 -19
- package/dist/bundle/{chunk-OQVJQSEH.js → chunk-2UIMEMWU.js} +3 -3
- package/dist/bundle/{chunk-NO34DAIB.js → chunk-33NVQGUY.js} +6 -6
- package/dist/bundle/{chunk-D3UFQC7K.js → chunk-43QVYW3K.js} +49 -49
- package/dist/bundle/{chunk-POFLDSTX.js → chunk-54O62JWP.js} +10 -10
- package/dist/bundle/{chunk-HBRTKJ3J.js → chunk-5PLJKSG4.js} +7 -7
- package/dist/bundle/{chunk-PRBPVOW4.js → chunk-6DHQTUB2.js} +1 -1
- package/dist/bundle/{chunk-BVDAP3FQ.js → chunk-725OHXKR.js} +9 -9
- package/dist/bundle/chunk-7SH4JHYW.js +379 -0
- package/dist/bundle/{chunk-FCZ762RV.js → chunk-7XKAVMCF.js} +8 -8
- package/dist/bundle/{chunk-PNUS224S.js → chunk-7YMDL4JQ.js} +8 -6
- package/dist/bundle/{chunk-FV5WG4WU.js → chunk-A4UNTWAX.js} +29 -25
- package/dist/bundle/{chunk-I7EP3VPJ.js → chunk-ALJWBGD5.js} +1 -1
- package/dist/bundle/{chunk-U3OS6V6S.js → chunk-BBYD2FA3.js} +1 -1
- package/dist/bundle/{chunk-CX7HQ6KK.js → chunk-BSSCTWWK.js} +12 -12
- package/dist/bundle/{chunk-HYT3FJVB.js → chunk-C6Z25IBJ.js} +49 -24
- package/dist/bundle/{chunk-XCXUP76D.js → chunk-CB7SBYLO.js} +27 -27
- package/dist/bundle/{chunk-YXHMEFL7.js → chunk-CITFEQ6S.js} +1 -1
- package/dist/bundle/{chunk-Y73IZWRI.js → chunk-CKBHR7QO.js} +1 -1
- package/dist/bundle/{chunk-AKW5MNQP.js → chunk-CM7GAXGD.js} +5 -5
- package/dist/bundle/{chunk-OKSS7YUN.js → chunk-DLAFGSTN.js} +1 -1
- package/dist/bundle/{chunk-MPTD5P53.js → chunk-DO4PDQY5.js} +2 -2
- package/dist/bundle/{chunk-P3T2SZW2.js → chunk-EKFEY3KP.js} +2 -2
- package/dist/bundle/{chunk-ZKAAFY4C.js → chunk-F7UUZATI.js} +11 -11
- package/dist/bundle/{chunk-XBENRRBS.js → chunk-FCJAHD4R.js} +2 -2
- package/dist/bundle/{chunk-5C7RKU7O.js → chunk-FDWYPONW.js} +46 -34
- package/dist/bundle/{chunk-TVJU245P.js → chunk-FG4XXZZE.js} +2 -2
- package/dist/bundle/{chunk-BMI5VCR4.js → chunk-FJW3DDCF.js} +5 -5
- package/dist/bundle/{chunk-LZKPT7GY.js → chunk-G6QF5KWF.js} +35 -35
- package/dist/bundle/{chunk-K6JSVXDN.js → chunk-G7DCVJ4F.js} +5 -5
- package/dist/bundle/{chunk-J2S7QDOP.js → chunk-GJN5B5JK.js} +16 -16
- package/dist/bundle/{chunk-Q5CLTK5R.js → chunk-GR5GGZKH.js} +3 -3
- package/dist/bundle/{chunk-SZWQFR5X.js → chunk-GVCN3GLZ.js} +16 -4
- package/dist/bundle/{chunk-CT6Z6Z64.js → chunk-H47W2J6S.js} +523 -778
- package/dist/bundle/{chunk-HGWMX7BM.js → chunk-HQVJK5E7.js} +44 -22
- package/dist/bundle/{chunk-35IHF562.js → chunk-HX7Y2ASG.js} +350 -281
- package/dist/bundle/{chunk-7LYVWMKD.js → chunk-I7UH5CTA.js} +8 -8
- package/dist/bundle/{chunk-YVQJPLPU.js → chunk-IDUNJCFO.js} +2 -2
- package/dist/bundle/{chunk-WACVI3CS.js → chunk-IEXPOEEO.js} +24 -24
- package/dist/bundle/{chunk-6FXFYXTR.js → chunk-IWFBAWZK.js} +15 -15
- package/dist/bundle/{chunk-3KTDFSSK.js → chunk-JEOYFKUK.js} +2 -2
- package/dist/bundle/{chunk-4GFAOETW.js → chunk-KYVXMEBC.js} +3 -3
- package/dist/bundle/{chunk-PT6XDCOY.js → chunk-LJAX6YCF.js} +2 -2
- package/dist/bundle/{chunk-XXLTVVMT.js → chunk-LONV6HIK.js} +20 -20
- package/dist/bundle/{chunk-G75FZQAZ.js → chunk-NHBUTCNR.js} +10 -10
- package/dist/bundle/{chunk-OASIFIXM.js → chunk-NPSZPUK6.js} +2 -2
- package/dist/bundle/{chunk-Z3GWVRW3.js → chunk-NSIFQ5OP.js} +1 -1
- package/dist/bundle/{chunk-WX2NQO2D.js → chunk-NYOPEHEU.js} +1 -1
- package/dist/bundle/{chunk-TSZJXI4N.js → chunk-O6IOL6RX.js} +21 -21
- package/dist/bundle/{chunk-YLC4JVQZ.js → chunk-PAXKALHV.js} +5 -5
- package/dist/bundle/{chunk-AUW45JPI.js → chunk-PDGECM5D.js} +7 -7
- package/dist/bundle/{chunk-NRWDEBJB.js → chunk-PEOCBV2Z.js} +8 -8
- package/dist/bundle/{chunk-VCPS7Q2W.js → chunk-PQJYM5ES.js} +3 -3
- package/dist/bundle/{chunk-TEH76MZK.js → chunk-PQYVPCJ2.js} +26 -26
- package/dist/bundle/{chunk-WYWXOIGT.js → chunk-PSNHPFSK.js} +1 -1
- package/dist/bundle/{chunk-Y4YBW5S4.js → chunk-Q765VPZY.js} +2 -2
- package/dist/bundle/{chunk-D222O57O.js → chunk-QYUHS6DE.js} +6 -6
- package/dist/bundle/{chunk-YOABRW2M.js → chunk-R276546S.js} +1 -1
- package/dist/bundle/{chunk-SRIPLP7N.js → chunk-RNSP57TC.js} +4 -4
- package/dist/bundle/{chunk-VH4GVA2N.js → chunk-UR32UWTQ.js} +2 -2
- package/dist/bundle/{chunk-Z6KTSXE3.js → chunk-VJZST5RD.js} +2 -2
- package/dist/bundle/{chunk-LLMHJE5Q.js → chunk-VSOLLTYT.js} +2 -2
- package/dist/bundle/{chunk-PQGIV36R.js → chunk-VZ2I62HN.js} +2 -2
- package/dist/bundle/{chunk-DEVPGI27.js → chunk-W7IK7E4B.js} +17 -17
- package/dist/bundle/{chunk-NVHPYKYC.js → chunk-WBTVGFXI.js} +11 -11
- package/dist/bundle/{chunk-2TPENYCK.js → chunk-WLFUBNFX.js} +4 -4
- package/dist/bundle/{chunk-SRONUWOM.js → chunk-WQJBAWQP.js} +515 -344
- package/dist/bundle/{chunk-K3EK4MTU.js → chunk-WQRGA75U.js} +15 -3
- package/dist/bundle/{chunk-XE2GEE3E.js → chunk-WUX7AUOQ.js} +26 -26
- package/dist/bundle/{chunk-JI5KFKTL.js → chunk-XOLQSCMF.js} +6 -6
- package/dist/bundle/{chunk-EY4CUQW2.js → chunk-YKZ4IPLB.js} +26 -9
- package/dist/bundle/{chunk-GK2VUKQY.js → chunk-YNFELLNQ.js} +2 -2
- package/dist/bundle/{chunk-F3PPSIKI.js → chunk-YVPHJHIL.js} +3 -3
- package/dist/bundle/{chunk-4YG2FZ53.js → chunk-Z47LOJUS.js} +7 -7
- package/dist/bundle/{chunk-DDD3FS6G.js → chunk-ZDLIO76S.js} +2 -2
- package/dist/bundle/{chunk-UMY4IQE2.js → chunk-ZNZUZGSV.js} +54 -47
- package/dist/bundle/{chunk-UM4E2OFL.js → chunk-ZSXRDF6I.js} +1 -1
- package/dist/bundle/{chunk-N33EOINW.js → chunk-ZWSG7OCA.js} +4 -4
- package/dist/bundle/command-contract-I2YB5IXI.js +38 -0
- package/dist/bundle/{decode-4EENADOV.js → decode-EDN2ARXZ.js} +19 -17
- package/dist/bundle/drive.js +7 -7
- package/dist/bundle/{echarts-ZFC37XW7.js → echarts-GXY34GHA.js} +2 -2
- package/dist/bundle/{embed-UZMNP26C.js → embed-3GSQIQXE.js} +5 -5
- package/dist/bundle/{embedder-7VDWDBKF.js → embedder-6ULWRG3R.js} +8 -8
- package/dist/bundle/{entry-JJKCHVIK.js → entry-IPRJLFHO.js} +6 -6
- package/dist/bundle/failure-IXS2ZHA5.js +37 -0
- package/dist/bundle/{first-run-FJTEUJBF.js → first-run-FGHGWHC2.js} +9 -9
- package/dist/bundle/first-screen-M62KTPZG.js +36 -0
- package/dist/bundle/{google-JBJASYKY.js → google-BD3ZNFVJ.js} +9 -9
- package/dist/bundle/google-api-BDUWZMRV.js +83 -0
- package/dist/bundle/{identity-XE73ALJH.js → identity-U7IHZEMR.js} +2 -2
- package/dist/bundle/{instructions-Q4ASITKO.js → instructions-K5BEQM4C.js} +1 -1
- package/dist/bundle/{login-BD2WQT5F.js → login-7HRYPZMM.js} +71 -66
- package/dist/bundle/{mcp-G6U2Q63E.js → mcp-F67RATLF.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-CYM7VXFR.js → node-ZYWB7IET.js} +2 -2
- package/dist/bundle/{node-sqlite-RK4MHW57.js → node-sqlite-J3OODPYK.js} +4 -4
- package/dist/bundle/{oauth-CQXQRHJR.js → oauth-L4VTCBLF.js} +6 -6
- package/dist/bundle/{open-WSE4NBD2.js → open-SGUN7ZVF.js} +3 -3
- package/dist/bundle/openai-RLVISEDH.js +251 -0
- package/dist/bundle/{process-7HHZZZLA.js → process-ZXO2MWRJ.js} +1 -1
- package/dist/bundle/{program-ZMQYZNV5.js → program-YVLXSKZV.js} +104 -102
- package/dist/bundle/{prompt-YSBBQJGF.js → prompt-AUWTBLO7.js} +4 -4
- package/dist/bundle/{reasons-366PI7OV.js → reasons-J57GSRWN.js} +3 -3
- package/dist/bundle/{recognize-AZKGPCAS.js → recognize-ORX2UBQW.js} +5 -3
- package/dist/bundle/{remote-EYSK3XKD.js → remote-AGIJY73X.js} +6 -6
- package/dist/bundle/{rerank-LOW6VIDF.js → rerank-R6PE44M5.js} +6 -6
- package/dist/bundle/{serve-UJ52HGA7.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-B4QUSCFN.js → services-HZFTTZSF.js} +35 -28
- package/dist/bundle/{sqlite-runtime-GEURBVK5.js → sqlite-runtime-DTGPR2T2.js} +4 -4
- package/dist/bundle/{state-OJNSKOXO.js → state-WG3JKJM3.js} +5 -5
- package/dist/bundle/{store-62SBP45X.js → store-33VHIMEO.js} +14 -14
- package/dist/bundle/{store-FTS2HVVB.js → store-EV72MT5U.js} +16 -16
- package/dist/bundle/store-maintenance-command-ZTUEI4EC.js +58 -0
- package/dist/bundle/tokens-XMOGQFI6.js +102 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +2 -1
- package/dist/commands/session.js.map +1 -1
- package/dist/knowledge-query.d.ts +1 -1
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +7 -3
- package/dist/login.js.map +1 -1
- package/dist/reasons.js +1 -1
- package/dist/reasons.js.map +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/tokens.d.ts +0 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +12 -13
- package/dist/tokens.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-R6CGYG7L.js +0 -38
- package/dist/bundle/failure-VBQBKCD5.js +0 -37
- package/dist/bundle/first-screen-NSPQWNMQ.js +0 -36
- package/dist/bundle/google-api-2FKF4UUN.js +0 -82
- package/dist/bundle/mcp-H3XD47NW.js +0 -95
- package/dist/bundle/server-CA2VLY25.js +0 -56
- package/dist/bundle/server-TW75RDEP.js +0 -69
- package/dist/bundle/store-maintenance-command-FQMB3R4E.js +0 -57
- package/dist/bundle/tokens-JALZUGEM.js +0 -103
- /package/dist/bundle/{chunk-2WNDZFGG.js → chunk-62EDJKGP.js} +0 -0
- /package/dist/bundle/{chunk-UO5O3665.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-IEXPOEEO.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-UO5O3665.js";
|
|
14
|
-
import "./chunk-Q5CLTK5R.js";
|
|
15
|
-
import {
|
|
16
|
-
apiMethod
|
|
17
|
-
} from "./chunk-F3PPSIKI.js";
|
|
18
|
-
import {
|
|
19
|
-
covers,
|
|
20
|
-
grantedScopes
|
|
21
|
-
} from "./chunk-WACVI3CS.js";
|
|
16
|
+
} from "./chunk-GJN5B5JK.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-NYOPEHEU.js";
|
|
54
54
|
import {
|
|
55
55
|
mcpFailure
|
|
56
|
-
} from "./chunk-
|
|
57
|
-
import "./chunk-
|
|
56
|
+
} from "./chunk-QYUHS6DE.js";
|
|
57
|
+
import "./chunk-WQRGA75U.js";
|
|
58
58
|
import {
|
|
59
59
|
VERSION
|
|
60
|
-
} from "./chunk-
|
|
61
|
-
import "./chunk-
|
|
60
|
+
} from "./chunk-BBYD2FA3.js";
|
|
61
|
+
import "./chunk-EKFEY3KP.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
|
+
};
|