@wirecat/zoom-cli 0.71.0 → 0.73.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/contracts/wirecat.json +1478 -0
- package/dist/account-removal.d.ts.map +1 -1
- package/dist/account-removal.js +0 -2
- package/dist/account-removal.js.map +1 -1
- package/dist/answers.d.ts +57 -3
- package/dist/answers.d.ts.map +1 -1
- package/dist/answers.js +0 -3
- package/dist/answers.js.map +1 -1
- package/dist/bin/main.js +13 -5
- package/dist/bin/main.js.map +1 -1
- package/dist/bin/zm.js +2 -2
- package/dist/bundle/{all-profiles-O4YNVPZX.js → all-profiles-V47CUJFK.js} +12 -12
- package/dist/bundle/answer-policy-W6H72X2R.js +112 -0
- package/dist/bundle/{anthropic-7GGRX3RX.js → anthropic-SID7Z3QN.js} +19 -12
- package/dist/bundle/{app-server-CPMKM3HI.js → app-server-KCMUSY4A.js} +75 -57
- package/dist/bundle/{bun-POHZKEPV.js → bun-PWMM6L45.js} +2 -2
- package/dist/bundle/{bun-sqlite-PGYMBPEL.js → bun-sqlite-3TLKUN5A.js} +10 -6
- package/dist/bundle/{chunk-Q3XLZIY3.js → chunk-2BAZRRJP.js} +29 -23
- package/dist/bundle/{chunk-OWEBWDHV.js → chunk-2NQPB6MT.js} +103 -9
- package/dist/bundle/chunk-2PYZTRRC.js +84 -0
- package/dist/bundle/chunk-2VYEGKQ3.js +13 -0
- package/dist/bundle/{chunk-I4DFFR7F.js → chunk-35CYSRGJ.js} +14 -5
- package/dist/bundle/{chunk-GGS6D4W4.js → chunk-3ADFJ3UP.js} +3 -3
- package/dist/bundle/{chunk-EOSVN2ER.js → chunk-3HTJBGNP.js} +242 -242
- package/dist/bundle/{chunk-2KESWII5.js → chunk-44YVZIA4.js} +3 -3
- package/dist/bundle/{chunk-GXF5HFFP.js → chunk-4LFFDUUW.js} +4 -4
- package/dist/bundle/{chunk-WOIHSQAL.js → chunk-4RJL32PF.js} +49 -10
- package/dist/bundle/{chunk-7ROXXRGG.js → chunk-6AO2RSYH.js} +7031 -5279
- package/dist/bundle/{chunk-DIQLXAAZ.js → chunk-6NI4FE5G.js} +6 -8
- package/dist/bundle/{chunk-X277FBTF.js → chunk-6WUTUCKH.js} +3 -3
- package/dist/bundle/{chunk-77TCCHMP.js → chunk-AIEMFRBU.js} +1 -1
- package/dist/bundle/{chunk-MRI6QMZ3.js → chunk-CIUJEQH4.js} +27 -19
- package/dist/bundle/{chunk-CRFOGYDG.js → chunk-CMWFYZ45.js} +2 -2
- package/dist/bundle/{chunk-LE7MDAQG.js → chunk-CQBLPBZU.js} +2 -2
- package/dist/bundle/{chunk-RQG5VOGH.js → chunk-DPSTOVKC.js} +185 -34
- package/dist/bundle/{chunk-4QUFFB2U.js → chunk-DYLYH7VE.js} +4 -4
- package/dist/bundle/{chunk-FEM2JQN2.js → chunk-EA2OB75T.js} +1 -1
- package/dist/bundle/chunk-ERQRY6WZ.js +54 -0
- package/dist/bundle/{chunk-P3XC6EDU.js → chunk-ETQNHS3A.js} +10 -129
- package/dist/bundle/{chunk-IAV5BG3I.js → chunk-EXWZCI5G.js} +1 -1
- package/dist/bundle/{chunk-VW6BF6M7.js → chunk-FIVFP53N.js} +1 -1
- package/dist/bundle/{chunk-DSVZEXYJ.js → chunk-FJMRDRPN.js} +3573 -3347
- package/dist/bundle/{chunk-7QC4M4HS.js → chunk-FT7X74RT.js} +4 -4
- package/dist/bundle/{chunk-ADLS6FVG.js → chunk-FXBHOCJK.js} +1 -1
- package/dist/bundle/{chunk-ZBFL5JPT.js → chunk-FZLJ2G7A.js} +22 -120
- package/dist/bundle/{chunk-GL3MYFMX.js → chunk-G2TSDMTA.js} +5 -5
- package/dist/bundle/{chunk-2FV5JUQU.js → chunk-G3SIY4MQ.js} +47 -40
- package/dist/bundle/{chunk-2U27KIKU.js → chunk-GCZMYDKU.js} +6 -6
- package/dist/bundle/{chunk-CKPCVEXU.js → chunk-HAMDPWEZ.js} +6 -6
- package/dist/bundle/{chunk-OE7EIP5L.js → chunk-HCZYJMBP.js} +1 -1
- package/dist/bundle/{chunk-OORMSM6O.js → chunk-HNWDEDMU.js} +61 -30
- package/dist/bundle/{chunk-FSHCAWZS.js → chunk-HO3GBTIT.js} +13464 -10422
- package/dist/bundle/chunk-IE7YBRUO.js +25 -0
- package/dist/bundle/{chunk-RGJ7OWHU.js → chunk-IJCUAKR5.js} +61 -21
- package/dist/bundle/{chunk-ULDXZ6LH.js → chunk-IKNOTHG2.js} +116 -70
- package/dist/bundle/{chunk-633QXP57.js → chunk-ILDGZBZD.js} +14 -9
- package/dist/bundle/{chunk-CFQF6IGY.js → chunk-JIS34MLC.js} +69 -6
- package/dist/bundle/{chunk-DHWBSXG3.js → chunk-JQF4LM3V.js} +415 -66
- package/dist/bundle/{chunk-4LAQDZXU.js → chunk-K5JFX5TK.js} +953 -210
- package/dist/bundle/{chunk-5LJTU4LY.js → chunk-K7EMVFJ7.js} +115 -113
- package/dist/bundle/chunk-KHBZ4OEP.js +16 -0
- package/dist/bundle/chunk-KK2IVZUQ.js +185 -0
- package/dist/bundle/{chunk-SELXER2Q.js → chunk-KQD4ZVNC.js} +7 -7
- package/dist/bundle/{chunk-VJXHIUFP.js → chunk-KSNJK4QM.js} +13 -13
- package/dist/bundle/{chunk-X4GWR6GO.js → chunk-KUL7S5Y3.js} +376 -10
- package/dist/bundle/{chunk-M76MXMLY.js → chunk-L6YSKCC3.js} +1 -1
- package/dist/bundle/chunk-LQYMN36C.js +73 -0
- package/dist/bundle/{chunk-USQ23X5V.js → chunk-LSVQCI6V.js} +751 -735
- package/dist/bundle/{chunk-DRBQDCDU.js → chunk-LVDTSCIN.js} +39 -122
- package/dist/bundle/{chunk-P3ASN72F.js → chunk-M4OP5ASJ.js} +1 -1
- package/dist/bundle/chunk-MAE5UGRQ.js +301 -0
- package/dist/bundle/{chunk-CT4WVR4N.js → chunk-MG2CCAVG.js} +3 -3
- package/dist/bundle/chunk-MOKEB656.js +71 -0
- package/dist/bundle/{chunk-BGTEVIW4.js → chunk-N3SOTKXC.js} +6 -6
- package/dist/bundle/{chunk-VRH7VRTK.js → chunk-NBA2V6LB.js} +10 -15
- package/dist/bundle/{chunk-5J4AMBMM.js → chunk-OFA22L4G.js} +4 -4
- package/dist/bundle/chunk-OKOJEBHK.js +106 -0
- package/dist/bundle/{chunk-Q5PI72CR.js → chunk-OMLVWOEF.js} +7 -2
- package/dist/bundle/{chunk-DK6ICIGL.js → chunk-OU5OXA6Q.js} +2150 -1312
- package/dist/bundle/{chunk-QVSLSWAL.js → chunk-P4FU6R3Z.js} +27 -152
- package/dist/bundle/{chunk-YPO2U2YB.js → chunk-PACLT6IW.js} +363 -115
- package/dist/bundle/{chunk-BBTQIVFP.js → chunk-PGPHEC2X.js} +2 -2
- package/dist/bundle/chunk-PJ3FKBXG.js +18 -0
- package/dist/bundle/{chunk-X3ZDN3U7.js → chunk-PKON63JH.js} +2 -2
- package/dist/bundle/{chunk-Q2SUFGSH.js → chunk-Q43KX56Z.js} +2 -2
- package/dist/bundle/{chunk-XI3VIQKW.js → chunk-QS6DWXDB.js} +569 -537
- package/dist/bundle/{chunk-INVTDIF6.js → chunk-QVJMFZFW.js} +1 -1
- package/dist/bundle/{chunk-QTHIU7CO.js → chunk-QWGEOQHA.js} +3 -2
- package/dist/bundle/{chunk-N2FNMION.js → chunk-R5FTCNLJ.js} +1 -1
- package/dist/bundle/{chunk-MW4EGDDV.js → chunk-SO52EJ2W.js} +2 -2
- package/dist/bundle/{chunk-HB6XJQ3Y.js → chunk-SYIOT45G.js} +5 -5
- package/dist/bundle/{chunk-4QPQ7MDA.js → chunk-TI2OANJZ.js} +1 -1
- package/dist/bundle/{chunk-ALIT5QFT.js → chunk-UIKVP23D.js} +1 -1
- package/dist/bundle/{chunk-OHWMIUCT.js → chunk-USIMMGWS.js} +244 -245
- package/dist/bundle/{chunk-MEED7YFG.js → chunk-UYBLNGZ2.js} +8 -2
- package/dist/bundle/{chunk-IED3NS7G.js → chunk-V5Q2QKYM.js} +29 -36
- package/dist/bundle/{chunk-54YDWBYG.js → chunk-VJVYGTPM.js} +15 -2
- package/dist/bundle/{chunk-5K7OGPGA.js → chunk-VPPNYUQM.js} +8 -8
- package/dist/bundle/{chunk-ZBKWRYRS.js → chunk-X2FILY5F.js} +3 -3
- package/dist/bundle/{chunk-2RUAMDVV.js → chunk-XLY7V2LB.js} +14 -14
- package/dist/bundle/chunk-XWBPP2HX.js +2 -0
- package/dist/bundle/{chunk-ZVI6TFQR.js → chunk-Y3IH7EZC.js} +17 -17
- package/dist/bundle/{chunk-YD2RYVMK.js → chunk-Z5XCU4S7.js} +46 -40
- package/dist/bundle/{chunk-RN4EHCC5.js → chunk-ZAIE3G5I.js} +3 -3
- package/dist/bundle/{chunk-2U6SER67.js → chunk-ZMHZ6CQS.js} +2 -2
- package/dist/bundle/{chunk-64ZHF6PJ.js → chunk-ZVQDOKDY.js} +3 -1
- package/dist/bundle/{chunk-TM4JSVGQ.js → chunk-ZX4QWTMQ.js} +42 -43
- package/dist/bundle/{cli-KHMEUXNG.js → cli-4ZYJ6OZE.js} +158 -88
- package/dist/bundle/command-contract-FJDDCHYP.js +43 -0
- package/dist/bundle/command-server-entry-CASONRIJ.js +173 -0
- package/dist/bundle/config-4DZHX2WX.js +99 -0
- package/dist/bundle/{decode-7RP4HSVE.js → decode-KEFCVGEB.js} +6 -6
- package/dist/bundle/{dispatch-IZCAK47P.js → dispatch-EU67WGME.js} +11 -11
- package/dist/bundle/{dist-BFT2SUBV.js → dist-GCQ7KCKN.js} +55 -30
- package/dist/bundle/{echarts-T2BSQ2YV.js → echarts-SDZA2SWG.js} +2 -2
- package/dist/bundle/{embed-BAS6YPDT.js → embed-43VJEPM6.js} +7 -7
- package/dist/bundle/{embedder-5XD5FCAO.js → embedder-Q4ZHAGRP.js} +10 -10
- package/dist/bundle/{failure-R2OIHCE5.js → failure-CTJLEB2R.js} +3 -3
- package/dist/bundle/first-run-CPOLQVNA.js +29 -0
- package/dist/bundle/first-screen-XYESRGWW.js +41 -0
- package/dist/bundle/folders-MSBTAPAG.js +24 -0
- package/dist/bundle/{instructions-XZPROPKY.js → instructions-7T6JJIFS.js} +1 -1
- package/dist/bundle/{main-TZXKGL3L.js → main-NA3QVPXS.js} +39 -25
- package/dist/bundle/{mcp-M4QN2E7R.js → mcp-TDKGDB4V.js} +2 -2
- package/dist/bundle/{meetings-JB2ISPND.js → meetings-7CVIQJTA.js} +9 -7
- package/dist/bundle/{node-A3B3MJWX.js → node-BZDMUFTW.js} +2 -2
- package/dist/bundle/{node-P4E63KXA.js → node-KM3CUABH.js} +9 -9
- package/dist/bundle/{node-sqlite-QVWDLGDX.js → node-sqlite-QHGB23B4.js} +11 -7
- package/dist/bundle/{oauth-YA6IYV4O.js → oauth-BMEMCM2I.js} +8 -8
- package/dist/bundle/{open-SY7TXJBS.js → open-JGU2NRJP.js} +6 -6
- package/dist/bundle/openai-VTXXFNCS.js +28 -0
- package/dist/bundle/{output-file-YGQYZCBJ.js → output-file-VDOCYH2G.js} +6 -6
- package/dist/bundle/{process-6HNBTJIY.js → process-756VBE7E.js} +1 -1
- package/dist/bundle/{program-77BUCJ4H.js → program-XM6CDIJ2.js} +134 -129
- package/dist/bundle/{prompt-YDG73YDS.js → prompt-2IPFXJ4B.js} +6 -6
- package/dist/bundle/{recognize-ECXDGTB7.js → recognize-672E2RIB.js} +5 -5
- package/dist/bundle/{remote-K4JHGBVJ.js → remote-YLHRVPDS.js} +11 -8
- package/dist/bundle/{rerank-IU2YYD4T.js → rerank-NBXQG3OS.js} +8 -8
- package/dist/bundle/run-log-3WITBT2F.js +126 -0
- package/dist/bundle/{serve-3XWIF3HI.js → serve-FNLOUMYP.js} +10 -10
- package/dist/bundle/{server-56VYOHWP.js → server-7ZB5AK5H.js} +53 -47
- package/dist/bundle/server-GGRGD4SH.js +77 -0
- package/dist/bundle/{services-X7IPEGQ5.js → services-Z4UWN64R.js} +56 -37
- package/dist/bundle/{speech-E2OBQWYA.js → speech-XSYVCKR3.js} +17 -14
- package/dist/bundle/sqlite-runtime-GAPXJNWU.js +20 -0
- package/dist/bundle/{state-4GMJYK4H.js → state-QSA53EF5.js} +7 -7
- package/dist/bundle/{store-LA4TV4DM.js → store-EKI4OAJH.js} +22 -19
- package/dist/bundle/{store-KPI7GB5Y.js → store-NOF5EYUC.js} +38 -21
- package/dist/bundle/store-connection-2OZQGEIO.js +92 -0
- package/dist/bundle/store-maintenance-command-GNX3SOZ6.js +67 -0
- package/dist/bundle/{streaming-EJ3NM2C2.js → streaming-PQEXKTE5.js} +7 -7
- package/dist/bundle/tokens-WJQYQ3FK.js +24 -0
- package/dist/bundle/zm.js +34 -10
- package/dist/bundle/{zoom-app-QEJBTIJ4.js → zoom-app-Y7RMWLVU.js} +9 -8
- package/dist/folders.d.ts +12 -2
- package/dist/folders.d.ts.map +1 -1
- package/dist/folders.js +81 -3
- package/dist/folders.js.map +1 -1
- package/dist/identity.d.ts +5 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +14 -0
- package/dist/identity.js.map +1 -1
- package/dist/recording-schedule-setup.d.ts.map +1 -1
- package/dist/recording-schedule-setup.js +4 -7
- package/dist/recording-schedule-setup.js.map +1 -1
- package/dist/remote-http.d.ts +1 -1
- package/dist/remote-http.d.ts.map +1 -1
- package/dist/remote-http.js +21 -23
- package/dist/remote-http.js.map +1 -1
- package/dist/setup-commands.d.ts.map +1 -1
- package/dist/setup-commands.js +2 -4
- package/dist/setup-commands.js.map +1 -1
- package/dist/tokens.d.ts +17 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +109 -29
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/package.json +15 -14
- package/dist/bundle/answer-policy-PPSPMCLH.js +0 -104
- package/dist/bundle/chunk-KMV7GZB6.js +0 -35
- package/dist/bundle/chunk-UG447QY2.js +0 -27
- package/dist/bundle/chunk-XRFHQGOD.js +0 -17
- package/dist/bundle/command-contract-4K6XXZYE.js +0 -41
- package/dist/bundle/config-EEDB632I.js +0 -90
- package/dist/bundle/first-run-23WWZ2PW.js +0 -28
- package/dist/bundle/first-screen-6HFUYVFR.js +0 -39
- package/dist/bundle/folders-ZXTOFY4T.js +0 -16
- package/dist/bundle/openai-2AU24NRN.js +0 -25
- package/dist/bundle/run-log-LFEXNZ74.js +0 -118
- package/dist/bundle/server-YSTMUZ22.js +0 -72
- package/dist/bundle/store-connection-AZTIF6IH.js +0 -83
- package/dist/bundle/store-maintenance-command-LR572PS4.js +0 -61
- package/dist/bundle/tokens-BE6CJMR5.js +0 -20
- /package/dist/bundle/{chunk-VOXIGICJ.js → chunk-7O7XM37N.js} +0 -0
|
@@ -2,164 +2,41 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
encodeWav
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MG2CCAVG.js";
|
|
6
6
|
import {
|
|
7
7
|
SAMPLE_RATE,
|
|
8
8
|
toModelRate
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DYLYH7VE.js";
|
|
10
10
|
import {
|
|
11
|
-
OPENAI_URL
|
|
12
|
-
|
|
11
|
+
OPENAI_URL,
|
|
12
|
+
refuseModelAddress
|
|
13
|
+
} from "./chunk-JIS34MLC.js";
|
|
14
|
+
import {
|
|
15
|
+
endpointFetch
|
|
16
|
+
} from "./chunk-LQYMN36C.js";
|
|
17
|
+
import {
|
|
18
|
+
providerWaitMs
|
|
19
|
+
} from "./chunk-MAE5UGRQ.js";
|
|
13
20
|
import {
|
|
14
21
|
OPENAI_TRANSCRIBE_MODEL,
|
|
15
22
|
VAD,
|
|
16
23
|
filesPresent,
|
|
17
24
|
modelsDirectory,
|
|
18
25
|
vadPath
|
|
19
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-4LFFDUUW.js";
|
|
20
27
|
import {
|
|
21
28
|
DEFAULT_RETRY,
|
|
22
29
|
backoffMs
|
|
23
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HNWDEDMU.js";
|
|
24
31
|
import {
|
|
25
|
-
CliError
|
|
26
|
-
|
|
27
|
-
} from "./chunk-FEM2JQN2.js";
|
|
32
|
+
CliError
|
|
33
|
+
} from "./chunk-EA2OB75T.js";
|
|
28
34
|
import {
|
|
29
35
|
__name
|
|
30
36
|
} from "./chunk-ZVVMGPBJ.js";
|
|
31
37
|
|
|
32
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/speech/openai.js
|
|
33
39
|
import { setTimeout as wait } from "node:timers/promises";
|
|
34
|
-
|
|
35
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/body.js
|
|
36
|
-
var interrupted = /* @__PURE__ */ __name((signal) => isCliError(signal.reason) ? signal.reason : new CliError(signal.reason instanceof Error && signal.reason.name === "TimeoutError" ? "timeout" : "cancelled", "HTTP response read was interrupted"), "interrupted");
|
|
37
|
-
var checked = /* @__PURE__ */ __name((signal) => {
|
|
38
|
-
if (signal?.aborted)
|
|
39
|
-
throw interrupted(signal);
|
|
40
|
-
}, "checked");
|
|
41
|
-
var abortable = /* @__PURE__ */ __name(async (pending, signal) => {
|
|
42
|
-
if (!signal)
|
|
43
|
-
return pending;
|
|
44
|
-
let abort = /* @__PURE__ */ __name(() => {
|
|
45
|
-
}, "abort");
|
|
46
|
-
const stopped = new Promise((_, reject) => {
|
|
47
|
-
abort = /* @__PURE__ */ __name(() => reject(interrupted(signal)), "abort");
|
|
48
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
49
|
-
if (signal.aborted)
|
|
50
|
-
abort();
|
|
51
|
-
});
|
|
52
|
-
try {
|
|
53
|
-
return await Promise.race([pending, stopped]);
|
|
54
|
-
} finally {
|
|
55
|
-
signal.removeEventListener("abort", abort);
|
|
56
|
-
}
|
|
57
|
-
}, "abortable");
|
|
58
|
-
var readJsonResponse = /* @__PURE__ */ __name(async (response, options) => {
|
|
59
|
-
const { maxBytes, signal } = options ?? {};
|
|
60
|
-
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)
|
|
61
|
-
throw new CliError("validation_error", "maxBytes must be a positive safe integer");
|
|
62
|
-
if (signal !== void 0 && !(signal instanceof AbortSignal))
|
|
63
|
-
throw new CliError("validation_error", "signal must be an AbortSignal");
|
|
64
|
-
if (signal?.aborted) {
|
|
65
|
-
void response.body?.cancel().catch(() => {
|
|
66
|
-
});
|
|
67
|
-
throw interrupted(signal);
|
|
68
|
-
}
|
|
69
|
-
const length = response.headers.get("content-length");
|
|
70
|
-
if (length !== null && (!/^\d+$/.test(length) || Number(length) > maxBytes)) {
|
|
71
|
-
void response.body?.cancel().catch(() => {
|
|
72
|
-
});
|
|
73
|
-
throw new CliError("invalid_response", "HTTP response exceeds the byte budget");
|
|
74
|
-
}
|
|
75
|
-
if (!response.body)
|
|
76
|
-
throw new CliError("invalid_response", "HTTP response has no body");
|
|
77
|
-
if (response.body.locked)
|
|
78
|
-
throw new CliError("invalid_response", "HTTP response body is already in use");
|
|
79
|
-
const reader = response.body.getReader();
|
|
80
|
-
const chunks = [];
|
|
81
|
-
let bytes = 0;
|
|
82
|
-
try {
|
|
83
|
-
for (; ; ) {
|
|
84
|
-
checked(signal);
|
|
85
|
-
const part = await abortable(reader.read(), signal);
|
|
86
|
-
checked(signal);
|
|
87
|
-
if (part.done)
|
|
88
|
-
break;
|
|
89
|
-
if (!(part.value instanceof Uint8Array))
|
|
90
|
-
throw new CliError("invalid_response", "HTTP response is not bytes");
|
|
91
|
-
bytes += part.value.byteLength;
|
|
92
|
-
if (bytes > maxBytes)
|
|
93
|
-
throw new CliError("invalid_response", "HTTP response exceeds the byte budget");
|
|
94
|
-
if (part.value.byteLength)
|
|
95
|
-
chunks.push(new Uint8Array(part.value));
|
|
96
|
-
}
|
|
97
|
-
const body = new Uint8Array(bytes);
|
|
98
|
-
let offset = 0;
|
|
99
|
-
for (const chunk of chunks) {
|
|
100
|
-
body.set(chunk, offset);
|
|
101
|
-
offset += chunk.byteLength;
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(body));
|
|
105
|
-
} catch {
|
|
106
|
-
throw new CliError("invalid_response", "HTTP response is not valid UTF-8 JSON");
|
|
107
|
-
}
|
|
108
|
-
} catch (error) {
|
|
109
|
-
checked(signal);
|
|
110
|
-
if (isCliError(error))
|
|
111
|
-
throw error;
|
|
112
|
-
throw new CliError("network_error", "HTTP response could not be read");
|
|
113
|
-
} finally {
|
|
114
|
-
void reader.cancel().catch(() => {
|
|
115
|
-
});
|
|
116
|
-
reader.releaseLock();
|
|
117
|
-
}
|
|
118
|
-
}, "readJsonResponse");
|
|
119
|
-
|
|
120
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.80.8_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
|
|
121
|
-
var parseRetryAfter = /* @__PURE__ */ __name((header, now) => {
|
|
122
|
-
if (!header)
|
|
123
|
-
return void 0;
|
|
124
|
-
const trimmed = header.trim();
|
|
125
|
-
if (/^\d+$/.test(trimmed))
|
|
126
|
-
return Number(trimmed) * 1e3;
|
|
127
|
-
const at = Date.parse(trimmed);
|
|
128
|
-
if (Number.isNaN(at))
|
|
129
|
-
return void 0;
|
|
130
|
-
const delta = at - now().getTime();
|
|
131
|
-
return delta > 0 ? delta : void 0;
|
|
132
|
-
}, "parseRetryAfter");
|
|
133
|
-
var parseRateLimitReset = /* @__PURE__ */ __name((header, now) => {
|
|
134
|
-
if (!header)
|
|
135
|
-
return void 0;
|
|
136
|
-
const seconds = Number(header.trim());
|
|
137
|
-
if (!Number.isFinite(seconds))
|
|
138
|
-
return void 0;
|
|
139
|
-
const delta = seconds * 1e3 - now().getTime();
|
|
140
|
-
return delta > 0 ? delta : void 0;
|
|
141
|
-
}, "parseRateLimitReset");
|
|
142
|
-
var providerWaitMs = /* @__PURE__ */ __name((headers, now) => parseRetryAfter(headers.get("retry-after"), now) ?? parseRateLimitReset(headers.get("x-ratelimit-reset"), now), "providerWaitMs");
|
|
143
|
-
var retryableStatus = /* @__PURE__ */ __name((status) => status === 408 || status === 429 || status >= 500, "retryableStatus");
|
|
144
|
-
var statusToCode = /* @__PURE__ */ __name((status) => {
|
|
145
|
-
if (status === 400 || status === 422)
|
|
146
|
-
return "validation_error";
|
|
147
|
-
if (status === 401)
|
|
148
|
-
return "authentication_error";
|
|
149
|
-
if (status === 403)
|
|
150
|
-
return "permission_error";
|
|
151
|
-
if (status === 404)
|
|
152
|
-
return "not_found";
|
|
153
|
-
if (status === 408)
|
|
154
|
-
return "timeout";
|
|
155
|
-
if (status === 429)
|
|
156
|
-
return "rate_limited";
|
|
157
|
-
if (status === 502 || status === 503 || status === 504)
|
|
158
|
-
return "provider_unavailable";
|
|
159
|
-
return "provider_error";
|
|
160
|
-
}, "statusToCode");
|
|
161
|
-
|
|
162
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/speech/openai.js
|
|
163
40
|
var LONGEST_REQUEST_SECONDS = 600;
|
|
164
41
|
var JOINED_SECONDS = 0.2;
|
|
165
42
|
var PAD_SECONDS = 0.2;
|
|
@@ -172,7 +49,7 @@ var EXHAUSTED = /* @__PURE__ */ new Set([
|
|
|
172
49
|
"organization_usage_limit_exceeded"
|
|
173
50
|
]);
|
|
174
51
|
var RETRY = { ...DEFAULT_RETRY, retries: 4 };
|
|
175
|
-
var
|
|
52
|
+
var interrupted = /* @__PURE__ */ __name((signal) => {
|
|
176
53
|
if (!signal?.aborted)
|
|
177
54
|
return;
|
|
178
55
|
if (signal.reason instanceof CliError)
|
|
@@ -181,7 +58,7 @@ var interrupted2 = /* @__PURE__ */ __name((signal) => {
|
|
|
181
58
|
throw new CliError(timeout ? "timeout" : "cancelled", "the transcription was interrupted");
|
|
182
59
|
}, "interrupted");
|
|
183
60
|
var sleeping = /* @__PURE__ */ __name((ms, signal) => wait(ms, void 0, signal ? { signal } : {}).then(() => void 0, (error) => {
|
|
184
|
-
|
|
61
|
+
interrupted(signal);
|
|
185
62
|
throw error;
|
|
186
63
|
}), "sleeping");
|
|
187
64
|
var formOf = /* @__PURE__ */ __name((wav, options) => {
|
|
@@ -207,14 +84,15 @@ var failureOf = /* @__PURE__ */ __name(async (response) => {
|
|
|
207
84
|
return {};
|
|
208
85
|
}
|
|
209
86
|
}, "failureOf");
|
|
87
|
+
var TRANSCRIPTION_TIMEOUT_MS = 6e5;
|
|
210
88
|
var send = /* @__PURE__ */ __name(async (wav, options) => {
|
|
211
|
-
const
|
|
89
|
+
const url = `${(options.baseUrl ?? OPENAI_URL).replace(/\/+$/, "")}/audio/transcriptions`;
|
|
90
|
+
const post = options.fetch ?? endpointFetch(url, TRANSCRIPTION_TIMEOUT_MS);
|
|
212
91
|
const retry = options.retry ?? RETRY;
|
|
213
92
|
const sleep = options.sleep ?? sleeping;
|
|
214
93
|
const random = options.random ?? Math.random;
|
|
215
|
-
const url = `${(options.baseUrl ?? OPENAI_URL).replace(/\/+$/, "")}/audio/transcriptions`;
|
|
216
94
|
for (let attempt = 1; ; attempt++) {
|
|
217
|
-
|
|
95
|
+
interrupted(options.signal);
|
|
218
96
|
let response;
|
|
219
97
|
try {
|
|
220
98
|
response = await post(url, {
|
|
@@ -224,14 +102,14 @@ var send = /* @__PURE__ */ __name(async (wav, options) => {
|
|
|
224
102
|
...options.signal ? { signal: options.signal } : {}
|
|
225
103
|
});
|
|
226
104
|
} catch {
|
|
227
|
-
|
|
105
|
+
interrupted(options.signal);
|
|
228
106
|
if (attempt > retry.retries)
|
|
229
107
|
throw new CliError("network_error", "OpenAI could not be reached", { reason: "network.failed" });
|
|
230
108
|
await sleep(backoffMs(attempt, retry, random), options.signal);
|
|
231
109
|
continue;
|
|
232
110
|
}
|
|
233
111
|
if (response.ok) {
|
|
234
|
-
const body = await response.json().catch(() =>
|
|
112
|
+
const body = await response.json().catch(() => interrupted(options.signal));
|
|
235
113
|
if (typeof body?.text !== "string")
|
|
236
114
|
throw new CliError("invalid_response", "OpenAI answered without a transcript", {
|
|
237
115
|
reason: "provider.invalid-response"
|
|
@@ -281,7 +159,7 @@ var piecesOf = /* @__PURE__ */ __name((spans, limit) => {
|
|
|
281
159
|
return pieces;
|
|
282
160
|
}, "piecesOf");
|
|
283
161
|
var openCutter = /* @__PURE__ */ __name(async (vadModel) => {
|
|
284
|
-
const { openSpeechCutter } = await import("./recognize-
|
|
162
|
+
const { openSpeechCutter } = await import("./recognize-672E2RIB.js");
|
|
285
163
|
return openSpeechCutter(vadModel);
|
|
286
164
|
}, "openCutter");
|
|
287
165
|
var checkKeywords = /* @__PURE__ */ __name((keywords = []) => {
|
|
@@ -290,12 +168,13 @@ var checkKeywords = /* @__PURE__ */ __name((keywords = []) => {
|
|
|
290
168
|
throw new CliError("validation_error", "a keyword must be a non-empty single line without < or > \u2014 OpenAI refuses the whole request otherwise");
|
|
291
169
|
}, "checkKeywords");
|
|
292
170
|
var transcribeOpenAI = /* @__PURE__ */ __name(async (audio, options) => {
|
|
171
|
+
refuseModelAddress(options.env ?? process.env, options.baseUrl ?? OPENAI_URL, "audio");
|
|
293
172
|
if (!options.apiKey)
|
|
294
173
|
throw new CliError("authentication_error", "no OpenAI key \u2014 `models keys set openai`, or OPENAI_API_KEY", {
|
|
295
174
|
reason: "transcription.no-key"
|
|
296
175
|
});
|
|
297
176
|
checkKeywords(options.keywords);
|
|
298
|
-
|
|
177
|
+
interrupted(options.signal);
|
|
299
178
|
const pcm = toModelRate(audio.samples, audio.rate);
|
|
300
179
|
const duration = (pcm.length - LEAD) / SAMPLE_RATE;
|
|
301
180
|
if (options.bundle && duration <= LONGEST_REQUEST_SECONDS) {
|
|
@@ -327,10 +206,6 @@ var transcribeOpenAI = /* @__PURE__ */ __name(async (audio, options) => {
|
|
|
327
206
|
}, "transcribeOpenAI");
|
|
328
207
|
|
|
329
208
|
export {
|
|
330
|
-
readJsonResponse,
|
|
331
|
-
providerWaitMs,
|
|
332
|
-
retryableStatus,
|
|
333
|
-
statusToCode,
|
|
334
209
|
LONGEST_REQUEST_SECONDS,
|
|
335
210
|
piecesOf,
|
|
336
211
|
transcribeOpenAI
|