@wirecat/notion-cli 0.0.0-stage → 0.1.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/CHANGELOG.md +33 -0
- package/LICENSE +204 -0
- package/README.md +36 -2
- package/contracts/wirecat.json +1315 -0
- package/dist/bin/notion.d.ts +3 -0
- package/dist/bin/notion.d.ts.map +1 -0
- package/dist/bin/notion.js +40 -0
- package/dist/bin/notion.js.map +1 -0
- package/dist/bundle/all-profiles-OETMCOLN.js +278 -0
- package/dist/bundle/anthropic-5Y3O2TYM.js +91 -0
- package/dist/bundle/app-server-IVWBIVHC.js +231 -0
- package/dist/bundle/bun-EO636SAD.js +169 -0
- package/dist/bundle/bun-sqlite-C2T7QJ2M.js +76 -0
- package/dist/bundle/chunk-24FAYAML.js +52 -0
- package/dist/bundle/chunk-2YR3RYT4.js +73 -0
- package/dist/bundle/chunk-35K5T6WV.js +24 -0
- package/dist/bundle/chunk-3D3PFXBP.js +2315 -0
- package/dist/bundle/chunk-47R43UVJ.js +1068 -0
- package/dist/bundle/chunk-4GC5DBHW.js +100 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-64D5VUZ4.js +9564 -0
- package/dist/bundle/chunk-66PL7P4C.js +23 -0
- package/dist/bundle/chunk-7FII4DCE.js +362 -0
- package/dist/bundle/chunk-7N5QB6NL.js +156 -0
- package/dist/bundle/chunk-AE2KQ37N.js +95 -0
- package/dist/bundle/chunk-AQZO3ITW.js +58 -0
- package/dist/bundle/chunk-B2WFKFYL.js +1488 -0
- package/dist/bundle/chunk-B2XKEEFX.js +230 -0
- package/dist/bundle/chunk-B4B65XIO.js +73 -0
- package/dist/bundle/chunk-BWICUW7W.js +288 -0
- package/dist/bundle/chunk-CLG2ISQH.js +206 -0
- package/dist/bundle/chunk-CWVAYQXI.js +185 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DIM5YWBU.js +53 -0
- package/dist/bundle/chunk-EGTBL3MJ.js +6848 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-EPAZ7DJB.js +783 -0
- package/dist/bundle/chunk-ESZT4WW3.js +142 -0
- package/dist/bundle/chunk-EU5WCOMQ.js +4001 -0
- package/dist/bundle/chunk-F6MLJ3V5.js +72 -0
- package/dist/bundle/chunk-FF4DDBCB.js +1028 -0
- package/dist/bundle/chunk-GA3URWIF.js +46 -0
- package/dist/bundle/chunk-HRTIRRXR.js +3112 -0
- package/dist/bundle/chunk-HWRKURQH.js +54 -0
- package/dist/bundle/chunk-IQWEJEB5.js +39724 -0
- package/dist/bundle/chunk-JK44XO2S.js +392 -0
- package/dist/bundle/chunk-JKIN5TOU.js +131 -0
- package/dist/bundle/chunk-K5TWMQSY.js +188 -0
- package/dist/bundle/chunk-KHOVVPLC.js +18 -0
- package/dist/bundle/chunk-NLDYZBTC.js +5862 -0
- package/dist/bundle/chunk-OWJDC4CB.js +217 -0
- package/dist/bundle/chunk-QBC23NHD.js +38 -0
- package/dist/bundle/chunk-QC3KOJT4.js +300 -0
- package/dist/bundle/chunk-R6ZM45NF.js +1239 -0
- package/dist/bundle/chunk-RAZKIHGH.js +76 -0
- package/dist/bundle/chunk-RDZ7SVBZ.js +731 -0
- package/dist/bundle/chunk-RLSFOR2D.js +161 -0
- package/dist/bundle/chunk-RSIS7BR7.js +2778 -0
- package/dist/bundle/chunk-ST2UC7FS.js +1324 -0
- package/dist/bundle/chunk-TR7R5DL4.js +370 -0
- package/dist/bundle/chunk-TSCIIXN3.js +106 -0
- package/dist/bundle/chunk-UWIA2G6Q.js +12737 -0
- package/dist/bundle/chunk-UWW24JQF.js +66 -0
- package/dist/bundle/chunk-WK3OSDNV.js +1197 -0
- package/dist/bundle/chunk-WM7663C2.js +1221 -0
- package/dist/bundle/chunk-WVZFXI36.js +274 -0
- package/dist/bundle/chunk-WWMB4UHF.js +78 -0
- package/dist/bundle/chunk-XC5CKHX2.js +63 -0
- package/dist/bundle/chunk-XL2HXHP3.js +82 -0
- package/dist/bundle/chunk-XQUUANA2.js +24600 -0
- package/dist/bundle/chunk-XYIT2XB3.js +1372 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YA4LSSDZ.js +64499 -0
- package/dist/bundle/chunk-ZI3YTXSF.js +2 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-6G5DC2FN.js +35 -0
- package/dist/bundle/command-server-entry-A66DJ3MH.js +164 -0
- package/dist/bundle/decode-7XOFRAAT.js +163 -0
- package/dist/bundle/definitions-M3U4UYHN.js +45607 -0
- package/dist/bundle/dispatch-FEKU5UXC.js +411 -0
- package/dist/bundle/dist-YFKABFFF.js +7577 -0
- package/dist/bundle/echarts-XD2JSWU4.js +42501 -0
- package/dist/bundle/embed-F3HYGAF7.js +38 -0
- package/dist/bundle/embedder-GSEDDUH7.js +111 -0
- package/dist/bundle/failure-HDJLR2YJ.js +25 -0
- package/dist/bundle/first-run-TXNTIUSP.js +28 -0
- package/dist/bundle/first-screen-JZPJND7J.js +33 -0
- package/dist/bundle/instructions-NZGJ4FW5.js +11 -0
- package/dist/bundle/mcp-VFIOZDVY.js +167 -0
- package/dist/bundle/node-KM3CUABH.js +2340 -0
- package/dist/bundle/node-RPKPDYQS.js +176 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-KH2UUYVO.js +74 -0
- package/dist/bundle/notion.js +185 -0
- package/dist/bundle/oauth-NKAI7TQD.js +20 -0
- package/dist/bundle/open-WSAEAA2V.js +23 -0
- package/dist/bundle/openai-JPVDGHG5.js +238 -0
- package/dist/bundle/process-5ZFVKOQX.js +91 -0
- package/dist/bundle/program-M3D56D6T.js +28854 -0
- package/dist/bundle/prompt-FROYQ5LV.js +17 -0
- package/dist/bundle/recognize-NYCHQMCX.js +26 -0
- package/dist/bundle/remote-4OERF3Z4.js +32 -0
- package/dist/bundle/rerank-TEGXFUWY.js +52 -0
- package/dist/bundle/schemas-MZNNOEYN.js +12214 -0
- package/dist/bundle/serve-HLYYBAXY.js +199 -0
- package/dist/bundle/server-D5OYNEUW.js +193 -0
- package/dist/bundle/server-LWZGVMNW.js +62 -0
- package/dist/bundle/sqlite-runtime-H2S5RR2F.js +20 -0
- package/dist/bundle/state-OPOXCDZL.js +36 -0
- package/dist/bundle/store-NHMXEJPD.js +164 -0
- package/dist/bundle/store-Y3KRLCJ7.js +281 -0
- package/dist/bundle/store-maintenance-command-D4W7WSLQ.js +53 -0
- package/dist/commands/api.d.ts +4 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +140 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/databases.d.ts +3 -0
- package/dist/commands/databases.d.ts.map +1 -0
- package/dist/commands/databases.js +65 -0
- package/dist/commands/databases.js.map +1 -0
- package/dist/commands/documents.d.ts +3 -0
- package/dist/commands/documents.d.ts.map +1 -0
- package/dist/commands/documents.js +41 -0
- package/dist/commands/documents.js.map +1 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +104 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +46 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +58 -0
- package/dist/context.js.map +1 -0
- package/dist/generated/definitions.d.ts +3 -0
- package/dist/generated/definitions.d.ts.map +1 -0
- package/dist/generated/definitions.js +45603 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/manifest.d.ts +3 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +2089 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/metadata.d.ts +6 -0
- package/dist/generated/metadata.d.ts.map +1 -0
- package/dist/generated/metadata.js +24 -0
- package/dist/generated/metadata.js.map +1 -0
- package/dist/generated/schemas.d.ts +1223 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +11557 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +11120 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +5 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/identity.d.ts +7 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +29 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/notion/client.d.ts +42 -0
- package/dist/notion/client.d.ts.map +1 -0
- package/dist/notion/client.js +118 -0
- package/dist/notion/client.js.map +1 -0
- package/dist/notion/errors.d.ts +24 -0
- package/dist/notion/errors.d.ts.map +1 -0
- package/dist/notion/errors.js +102 -0
- package/dist/notion/errors.js.map +1 -0
- package/dist/notion/ids.d.ts +7 -0
- package/dist/notion/ids.d.ts.map +1 -0
- package/dist/notion/ids.js +37 -0
- package/dist/notion/ids.js.map +1 -0
- package/dist/notion/links.d.ts +6 -0
- package/dist/notion/links.d.ts.map +1 -0
- package/dist/notion/links.js +22 -0
- package/dist/notion/links.js.map +1 -0
- package/dist/notion/notion.d.ts +95 -0
- package/dist/notion/notion.d.ts.map +1 -0
- package/dist/notion/notion.js +269 -0
- package/dist/notion/notion.js.map +1 -0
- package/dist/notion/port.d.ts +13 -0
- package/dist/notion/port.d.ts.map +1 -0
- package/dist/notion/port.js +60 -0
- package/dist/notion/port.js.map +1 -0
- package/dist/notion/read-posts.d.ts +36 -0
- package/dist/notion/read-posts.d.ts.map +1 -0
- package/dist/notion/read-posts.js +24 -0
- package/dist/notion/read-posts.js.map +1 -0
- package/dist/notion/reads.d.ts +327 -0
- package/dist/notion/reads.d.ts.map +1 -0
- package/dist/notion/reads.js +18 -0
- package/dist/notion/reads.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +62 -0
- package/dist/program.js.map +1 -0
- package/dist/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/sync/cursor.d.ts +54 -0
- package/dist/sync/cursor.d.ts.map +1 -0
- package/dist/sync/cursor.js +52 -0
- package/dist/sync/cursor.js.map +1 -0
- package/dist/sync/front-matter.d.ts +10 -0
- package/dist/sync/front-matter.d.ts.map +1 -0
- package/dist/sync/front-matter.js +114 -0
- package/dist/sync/front-matter.js.map +1 -0
- package/dist/sync/markdown.d.ts +8 -0
- package/dist/sync/markdown.d.ts.map +1 -0
- package/dist/sync/markdown.js +40 -0
- package/dist/sync/markdown.js.map +1 -0
- package/dist/sync/source.d.ts +64 -0
- package/dist/sync/source.d.ts.map +1 -0
- package/dist/sync/source.js +634 -0
- package/dist/sync/source.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- 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 +85 -4
- package/skills/notion-cli/SKILL.md +34 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
wirecatDirectory
|
|
5
|
+
} from "./chunk-HWRKURQH.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-F6MLJ3V5.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.663.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_8be6aa3a41727a76ce87cf0d5a7bd659/node_modules/@wirecat/cli-core/dist/speech/models.js
|
|
14
|
+
var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/csukuangfj/${repository}/resolve/${commit}/${name}`, "huggingFace");
|
|
15
|
+
var gigaam = huggingFace("sherpa-onnx-nemo-transducer-punct-giga-am-v3-russian-2025-12-16", "a6039be7cee829a9044a69ac0ebaf1c191217c97");
|
|
16
|
+
var gigaamCtc = huggingFace("sherpa-onnx-nemo-ctc-punct-giga-am-v3-russian-2025-12-16", "4fb5407ff028a69fec516cdf4c10fac9ddea7c16");
|
|
17
|
+
var parakeet = huggingFace("sherpa-onnx-nemo-parakeet-tdt-0.6b-v3-int8", "2bda32ec70b097a55adaa07d9a7173915b43cc78");
|
|
18
|
+
var MODELS = [
|
|
19
|
+
{
|
|
20
|
+
id: "gigaam-v3",
|
|
21
|
+
title: "GigaAM v3, with punctuation",
|
|
22
|
+
languages: "Russian \u2014 the best of the three for Russian",
|
|
23
|
+
language: "ru",
|
|
24
|
+
featureDim: 64,
|
|
25
|
+
files: [
|
|
26
|
+
{
|
|
27
|
+
name: "encoder.int8.onnx",
|
|
28
|
+
url: gigaam("encoder.int8.onnx"),
|
|
29
|
+
sha256: "369f35a71bf288d3b8e0391fabd8dba5f2314088d440bca474056b7b4b6e66bf",
|
|
30
|
+
bytes: 224570820
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "decoder.onnx",
|
|
34
|
+
url: gigaam("decoder.onnx"),
|
|
35
|
+
sha256: "38fc7475443ea2a26f63211ca350f73ac50fff824ab7a3876ee2bd610c53bbc4",
|
|
36
|
+
bytes: 4600132
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "joiner.onnx",
|
|
40
|
+
url: gigaam("joiner.onnx"),
|
|
41
|
+
sha256: "602ff7017a93311aad34df1437c8d7f49911353c13d6eae7a6ee7b041339465c",
|
|
42
|
+
bytes: 2712896
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "tokens.txt",
|
|
46
|
+
url: gigaam("tokens.txt"),
|
|
47
|
+
sha256: "39abae20e692998290c574e606f11a9edef2902a1995463fcff63d1490cf22b7",
|
|
48
|
+
bytes: 13354
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
config: /* @__PURE__ */ __name((path) => ({
|
|
52
|
+
transducer: { encoder: path("encoder.int8.onnx"), decoder: path("decoder.onnx"), joiner: path("joiner.onnx") },
|
|
53
|
+
tokens: path("tokens.txt"),
|
|
54
|
+
modelType: "nemo_transducer"
|
|
55
|
+
}), "config")
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "gigaam-v3-ctc",
|
|
59
|
+
title: "GigaAM v3 CTC, with punctuation \u2014 a little faster",
|
|
60
|
+
languages: "Russian \u2014 a little faster, rougher with capital letters",
|
|
61
|
+
language: "ru",
|
|
62
|
+
featureDim: 64,
|
|
63
|
+
files: [
|
|
64
|
+
{
|
|
65
|
+
name: "model.int8.onnx",
|
|
66
|
+
url: gigaamCtc("model.int8.onnx"),
|
|
67
|
+
sha256: "d5fea8df94263c285e54b21e5774b707c707192d3bdbeffd7b1eb07fb6743b35",
|
|
68
|
+
bytes: 224893661
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "tokens.txt",
|
|
72
|
+
url: gigaamCtc("tokens.txt"),
|
|
73
|
+
sha256: "142de7570b3de5b3035ce111a89c228e80e6085273731d944093ddf24fa539cd",
|
|
74
|
+
bytes: 2007
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
config: /* @__PURE__ */ __name((path) => ({ nemoCtc: { model: path("model.int8.onnx") }, tokens: path("tokens.txt") }), "config")
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "parakeet-v3",
|
|
81
|
+
title: "NVIDIA Parakeet TDT 0.6B v3",
|
|
82
|
+
/** The model card's list: huggingface.co/nvidia/parakeet-tdt-0.6b-v3, read 2026-09-24. */
|
|
83
|
+
languages: "25: bg cs da de el en es et fi fr hr hu it lt lv mt nl pl pt ro ru sk sl sv uk",
|
|
84
|
+
featureDim: 80,
|
|
85
|
+
files: [
|
|
86
|
+
{
|
|
87
|
+
name: "encoder.int8.onnx",
|
|
88
|
+
url: parakeet("encoder.int8.onnx"),
|
|
89
|
+
sha256: "acfc2b4456377e15d04f0243af540b7fe7c992f8d898d751cf134c3a55fd2247",
|
|
90
|
+
bytes: 652184281
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "decoder.int8.onnx",
|
|
94
|
+
url: parakeet("decoder.int8.onnx"),
|
|
95
|
+
sha256: "179e50c43d1a9de79c8a24149a2f9bac6eb5981823f2a2ed88d655b24248db4e",
|
|
96
|
+
bytes: 11845275
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "joiner.int8.onnx",
|
|
100
|
+
url: parakeet("joiner.int8.onnx"),
|
|
101
|
+
sha256: "3164c13fc2821009440d20fcb5fdc78bff28b4db2f8d0f0b329101719c0948b3",
|
|
102
|
+
bytes: 6355277
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "tokens.txt",
|
|
106
|
+
url: parakeet("tokens.txt"),
|
|
107
|
+
sha256: "d58544679ea4bc6ac563d1f545eb7d474bd6cfa467f0a6e2c1dc1c7d37e3c35d",
|
|
108
|
+
bytes: 93939
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
config: /* @__PURE__ */ __name((path) => ({
|
|
112
|
+
transducer: {
|
|
113
|
+
encoder: path("encoder.int8.onnx"),
|
|
114
|
+
decoder: path("decoder.int8.onnx"),
|
|
115
|
+
joiner: path("joiner.int8.onnx")
|
|
116
|
+
},
|
|
117
|
+
tokens: path("tokens.txt"),
|
|
118
|
+
modelType: "nemo_transducer"
|
|
119
|
+
}), "config")
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
var OPENAI_TRANSCRIBE_MODEL = "gpt-transcribe";
|
|
123
|
+
var VAD = {
|
|
124
|
+
name: "silero_vad.onnx",
|
|
125
|
+
url: "https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx",
|
|
126
|
+
sha256: "9e2449e1087496d8d4caba907f23e0bd3f78d91fa552479bb9c23ac09cbb1fd6",
|
|
127
|
+
bytes: 643854
|
|
128
|
+
};
|
|
129
|
+
var DEFAULT_ORDER = ["parakeet-v3", "gigaam-v3", "gigaam-v3-ctc"];
|
|
130
|
+
var orderedModels = /* @__PURE__ */ __name((order = DEFAULT_ORDER) => [.../* @__PURE__ */ new Set([...order, ...DEFAULT_ORDER])].map(speechModel), "orderedModels");
|
|
131
|
+
var findModel = /* @__PURE__ */ __name((id) => MODELS.find((model) => model.id === id), "findModel");
|
|
132
|
+
var speechModel = /* @__PURE__ */ __name((id) => {
|
|
133
|
+
const model = findModel(id);
|
|
134
|
+
if (!model) {
|
|
135
|
+
throw new CliError("validation_error", `no speech model "${id}" \u2014 one of ${MODELS.map((known) => known.id).join(", ")}`);
|
|
136
|
+
}
|
|
137
|
+
return model;
|
|
138
|
+
}, "speechModel");
|
|
139
|
+
|
|
140
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.663.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_8be6aa3a41727a76ce87cf0d5a7bd659/node_modules/@wirecat/cli-core/dist/speech/install.js
|
|
141
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
142
|
+
import { createReadStream, createWriteStream, mkdirSync, statSync } from "node:fs";
|
|
143
|
+
import { rename, rm } from "node:fs/promises";
|
|
144
|
+
import { dirname, join } from "node:path";
|
|
145
|
+
import { Readable, Transform } from "node:stream";
|
|
146
|
+
import { pipeline } from "node:stream/promises";
|
|
147
|
+
var sharedModelsDirectory = /* @__PURE__ */ __name((kind, env = process.env) => join(wirecatDirectory(env), "models", kind), "sharedModelsDirectory");
|
|
148
|
+
var modelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("audio", env), "modelsDirectory");
|
|
149
|
+
var STALL_MS = 6e4;
|
|
150
|
+
var watchdog = /* @__PURE__ */ __name((ms) => {
|
|
151
|
+
const controller = new AbortController();
|
|
152
|
+
let timer = setTimeout(() => controller.abort(), ms);
|
|
153
|
+
return {
|
|
154
|
+
signal: controller.signal,
|
|
155
|
+
poke: /* @__PURE__ */ __name(() => {
|
|
156
|
+
clearTimeout(timer);
|
|
157
|
+
timer = setTimeout(() => controller.abort(), ms);
|
|
158
|
+
}, "poke"),
|
|
159
|
+
stop: /* @__PURE__ */ __name(() => clearTimeout(timer), "stop")
|
|
160
|
+
};
|
|
161
|
+
}, "watchdog");
|
|
162
|
+
var modelPath = /* @__PURE__ */ __name((directory, model) => (name) => join(directory, model.id, name), "modelPath");
|
|
163
|
+
var vadPath = /* @__PURE__ */ __name((directory) => join(directory, VAD.name), "vadPath");
|
|
164
|
+
var placed = /* @__PURE__ */ __name((model, directory) => [
|
|
165
|
+
...model.files.map((file) => [file, modelPath(directory, model)(file.name)]),
|
|
166
|
+
[VAD, vadPath(directory)]
|
|
167
|
+
], "placed");
|
|
168
|
+
var isInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placed(model, directory)), "isInstalled");
|
|
169
|
+
var filesPresent = /* @__PURE__ */ __name((files) => files.every(([file, path]) => sizeOf(path) === file.bytes), "filesPresent");
|
|
170
|
+
var sizeOf = /* @__PURE__ */ __name((path) => {
|
|
171
|
+
try {
|
|
172
|
+
return statSync(path).size;
|
|
173
|
+
} catch {
|
|
174
|
+
return void 0;
|
|
175
|
+
}
|
|
176
|
+
}, "sizeOf");
|
|
177
|
+
var installedBytes = /* @__PURE__ */ __name((model) => model.files.reduce((sum, file) => sum + file.bytes, 0), "installedBytes");
|
|
178
|
+
var install = /* @__PURE__ */ __name(async (model, directory, { fetch: get = fetch, progress, bytes, verifyExisting } = {}) => {
|
|
179
|
+
mkdirSync(join(directory, model.id), { recursive: true, mode: 448 });
|
|
180
|
+
await installFiles(placed(model, directory), { fetch: get, progress, bytes, verifyExisting });
|
|
181
|
+
}, "install");
|
|
182
|
+
var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, progress, bytes = /* @__PURE__ */ __name(() => {
|
|
183
|
+
}, "bytes"), verifyExisting } = {}) => {
|
|
184
|
+
if (verifyExisting)
|
|
185
|
+
for (const [file, path] of files) {
|
|
186
|
+
if (sizeOf(path) !== void 0) {
|
|
187
|
+
const hash = createHash("sha256");
|
|
188
|
+
for await (const chunk of createReadStream(path))
|
|
189
|
+
hash.update(chunk);
|
|
190
|
+
if (hash.digest("hex") !== file.sha256) {
|
|
191
|
+
progress?.(`${path}: not the file this version expects, downloading it again`);
|
|
192
|
+
await rm(path, { force: true });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const total = files.reduce((sum, [file]) => sum + file.bytes, 0);
|
|
197
|
+
const missing = files.filter(([file, path]) => sizeOf(path) !== file.bytes);
|
|
198
|
+
let done = total - missing.reduce((sum, [file]) => sum + file.bytes, 0);
|
|
199
|
+
bytes(done, total);
|
|
200
|
+
for (const [file, path] of missing) {
|
|
201
|
+
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
202
|
+
progress?.(`downloading ${file.name} (${megabytes(file.bytes)})`);
|
|
203
|
+
const before = done;
|
|
204
|
+
await fetchVerified(file, path, get, (received) => {
|
|
205
|
+
done = before + received;
|
|
206
|
+
bytes(done, total);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}, "installFiles");
|
|
210
|
+
var fetchVerified = /* @__PURE__ */ __name(async (file, path, get, received) => {
|
|
211
|
+
const stalled = watchdog(STALL_MS);
|
|
212
|
+
try {
|
|
213
|
+
await fetchInto(file, path, get, stalled, received);
|
|
214
|
+
} catch (error) {
|
|
215
|
+
if (stalled.signal.aborted) {
|
|
216
|
+
throw new CliError("timeout", `${file.name} stopped downloading for ${STALL_MS / 1e3} s \u2014 nothing was installed`);
|
|
217
|
+
}
|
|
218
|
+
throw error;
|
|
219
|
+
} finally {
|
|
220
|
+
stalled.stop();
|
|
221
|
+
}
|
|
222
|
+
}, "fetchVerified");
|
|
223
|
+
var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled, received) => {
|
|
224
|
+
const response = await get(file.url, { signal: stalled.signal });
|
|
225
|
+
if (!response.ok || !response.body) {
|
|
226
|
+
await response.body?.cancel();
|
|
227
|
+
throw new CliError("network_error", `${file.name} could not be downloaded: HTTP ${response.status}`);
|
|
228
|
+
}
|
|
229
|
+
const partial = `${path}.${randomUUID()}.part`;
|
|
230
|
+
const hash = createHash("sha256");
|
|
231
|
+
let bytes = 0;
|
|
232
|
+
const hashing = new Transform({
|
|
233
|
+
transform(chunk, _encoding, done) {
|
|
234
|
+
stalled.poke();
|
|
235
|
+
bytes += chunk.length;
|
|
236
|
+
if (bytes > file.bytes) {
|
|
237
|
+
done(new CliError("invalid_response", `${file.name} is larger than this version expects \u2014 nothing was installed`));
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
hash.update(chunk);
|
|
241
|
+
received(bytes);
|
|
242
|
+
done(null, chunk);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
try {
|
|
246
|
+
await pipeline(Readable.fromWeb(response.body), hashing, createWriteStream(partial, { flags: "wx", mode: 384 }));
|
|
247
|
+
const actual = hash.digest("hex");
|
|
248
|
+
if (actual !== file.sha256) {
|
|
249
|
+
throw new CliError("invalid_response", `${file.name} is not the file this version expects (sha256 ${actual}) \u2014 nothing was installed`);
|
|
250
|
+
}
|
|
251
|
+
await rename(partial, path);
|
|
252
|
+
} finally {
|
|
253
|
+
await rm(partial, { force: true });
|
|
254
|
+
}
|
|
255
|
+
}, "fetchInto");
|
|
256
|
+
var megabytes = /* @__PURE__ */ __name((bytes) => bytes < 1e6 ? "under 1 MB" : `${Math.round(bytes / 1e6)} MB`, "megabytes");
|
|
257
|
+
|
|
258
|
+
export {
|
|
259
|
+
OPENAI_TRANSCRIBE_MODEL,
|
|
260
|
+
VAD,
|
|
261
|
+
DEFAULT_ORDER,
|
|
262
|
+
orderedModels,
|
|
263
|
+
speechModel,
|
|
264
|
+
sharedModelsDirectory,
|
|
265
|
+
modelsDirectory,
|
|
266
|
+
modelPath,
|
|
267
|
+
vadPath,
|
|
268
|
+
isInstalled,
|
|
269
|
+
filesPresent,
|
|
270
|
+
installedBytes,
|
|
271
|
+
install,
|
|
272
|
+
installFiles,
|
|
273
|
+
megabytes
|
|
274
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__name
|
|
5
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.663.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_8be6aa3a41727a76ce87cf0d5a7bd659/node_modules/@wirecat/cli-core/dist/http/listen.js
|
|
8
|
+
import { createServer } from "node:http";
|
|
9
|
+
import { Readable } from "node:stream";
|
|
10
|
+
var MAX_BODY = 4 * 1024 * 1024;
|
|
11
|
+
var TooLarge = class extends Error {
|
|
12
|
+
static {
|
|
13
|
+
__name(this, "TooLarge");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var readBody = /* @__PURE__ */ __name((incoming, limit) => new Promise((resolve, reject) => {
|
|
17
|
+
if (Number(incoming.headers["content-length"] ?? 0) > limit)
|
|
18
|
+
return reject(new TooLarge());
|
|
19
|
+
const chunks = [];
|
|
20
|
+
let size = 0;
|
|
21
|
+
incoming.on("data", (chunk) => {
|
|
22
|
+
size += chunk.length;
|
|
23
|
+
if (size > limit) {
|
|
24
|
+
incoming.destroy();
|
|
25
|
+
reject(new TooLarge());
|
|
26
|
+
} else
|
|
27
|
+
chunks.push(chunk);
|
|
28
|
+
});
|
|
29
|
+
incoming.once("end", () => resolve(Buffer.concat(chunks)));
|
|
30
|
+
incoming.once("error", reject);
|
|
31
|
+
}), "readBody");
|
|
32
|
+
var toRequest = /* @__PURE__ */ __name(async (incoming, origin, maxBody) => {
|
|
33
|
+
const headers = new Headers();
|
|
34
|
+
for (const [name, value] of Object.entries(incoming.headers)) {
|
|
35
|
+
if (Array.isArray(value))
|
|
36
|
+
for (const one of value)
|
|
37
|
+
headers.append(name, one);
|
|
38
|
+
else if (value !== void 0)
|
|
39
|
+
headers.set(name, value);
|
|
40
|
+
}
|
|
41
|
+
const method = incoming.method ?? "GET";
|
|
42
|
+
const body = method === "GET" || method === "HEAD" ? void 0 : await readBody(incoming, maxBody);
|
|
43
|
+
if (body)
|
|
44
|
+
headers.set("content-length", String(body.length));
|
|
45
|
+
return new Request(new URL(incoming.url ?? "/", origin), { method, headers, ...body ? { body } : {} });
|
|
46
|
+
}, "toRequest");
|
|
47
|
+
var send = /* @__PURE__ */ __name(async (response, outgoing) => {
|
|
48
|
+
outgoing.writeHead(response.status, Object.fromEntries(response.headers));
|
|
49
|
+
if (!response.body)
|
|
50
|
+
return void outgoing.end();
|
|
51
|
+
const body = Readable.fromWeb(response.body);
|
|
52
|
+
outgoing.once("close", () => body.destroy());
|
|
53
|
+
body.pipe(outgoing);
|
|
54
|
+
}, "send");
|
|
55
|
+
var listen = /* @__PURE__ */ __name((handle, { host, port, maxBody = MAX_BODY }) => new Promise((resolve, reject) => {
|
|
56
|
+
const server = createServer((incoming, outgoing) => {
|
|
57
|
+
toRequest(incoming, `http://${host}`, maxBody).then(handle).then((response) => send(response, outgoing)).catch((error) => {
|
|
58
|
+
if (!outgoing.headersSent)
|
|
59
|
+
outgoing.writeHead(error instanceof TooLarge ? 413 : 500, { connection: "close" });
|
|
60
|
+
outgoing.end();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
server.once("error", reject);
|
|
64
|
+
server.listen(port, host, () => {
|
|
65
|
+
const { port: bound } = server.address();
|
|
66
|
+
resolve({
|
|
67
|
+
url: new URL(`http://${host}:${bound}`),
|
|
68
|
+
close: /* @__PURE__ */ __name(() => new Promise((done) => {
|
|
69
|
+
server.close(() => done());
|
|
70
|
+
server.closeAllConnections();
|
|
71
|
+
}), "close")
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}), "listen");
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
listen
|
|
78
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__name
|
|
5
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.663.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_8be6aa3a41727a76ce87cf0d5a7bd659/node_modules/@wirecat/cli-core/dist/background/processes.js
|
|
8
|
+
import { execFileSync } from "node:child_process";
|
|
9
|
+
import { readdirSync, readFileSync, readlinkSync } from "node:fs";
|
|
10
|
+
var alive = /* @__PURE__ */ __name((pid) => {
|
|
11
|
+
try {
|
|
12
|
+
process.kill(pid, 0);
|
|
13
|
+
return true;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
return error.code === "EPERM";
|
|
16
|
+
}
|
|
17
|
+
}, "alive");
|
|
18
|
+
var carries = /* @__PURE__ */ __name((pid, marker) => {
|
|
19
|
+
if (pid <= 0 || !alive(pid))
|
|
20
|
+
return false;
|
|
21
|
+
try {
|
|
22
|
+
if (process.platform === "linux") {
|
|
23
|
+
return readFileSync(`/proc/${pid}/environ`, "latin1").split("\0").some((entry) => entry.endsWith(marker));
|
|
24
|
+
}
|
|
25
|
+
if (process.platform === "darwin") {
|
|
26
|
+
return execFileSync("ps", ["eww", "-o", "command=", "-p", String(pid)], { encoding: "utf8" }).includes(marker);
|
|
27
|
+
}
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}, "carries");
|
|
33
|
+
var holdersOf = /* @__PURE__ */ __name((paths) => {
|
|
34
|
+
if (process.platform === "linux") {
|
|
35
|
+
const wanted = new Set(paths);
|
|
36
|
+
return readdirSync("/proc").filter((entry) => /^\d+$/.test(entry) && Number(entry) !== process.pid).filter((pid) => {
|
|
37
|
+
try {
|
|
38
|
+
return readdirSync(`/proc/${pid}/fd`).some((fd) => {
|
|
39
|
+
try {
|
|
40
|
+
return wanted.has(readlinkSync(`/proc/${pid}/fd/${fd}`));
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
} catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}).map(Number);
|
|
49
|
+
}
|
|
50
|
+
const pids = /* @__PURE__ */ __name((listed) => listed.split("\n").filter(Boolean).map(Number).filter((pid) => pid !== process.pid), "pids");
|
|
51
|
+
try {
|
|
52
|
+
return pids(execFileSync("lsof", ["-t", "--", ...paths], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }));
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const { status, stdout } = error;
|
|
55
|
+
return status === 1 ? pids(stdout ?? "") : void 0;
|
|
56
|
+
}
|
|
57
|
+
}, "holdersOf");
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
alive,
|
|
61
|
+
carries,
|
|
62
|
+
holdersOf
|
|
63
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError
|
|
5
|
+
} from "./chunk-F6MLJ3V5.js";
|
|
6
|
+
import {
|
|
7
|
+
__name
|
|
8
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
9
|
+
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.663.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_8be6aa3a41727a76ce87cf0d5a7bd659/node_modules/@wirecat/cli-core/dist/cli/input-policy.js
|
|
11
|
+
var MAX_BUFFERED_INPUT = 16 * 1024 * 1024;
|
|
12
|
+
var MAX_SECRET_INPUT = 64 * 1024;
|
|
13
|
+
var policies = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
var inputPolicy = /* @__PURE__ */ __name((input) => policies.get(input) ?? {}, "inputPolicy");
|
|
15
|
+
var provideInputPolicy = /* @__PURE__ */ __name((input, policy) => {
|
|
16
|
+
const previous = policies.get(input);
|
|
17
|
+
policies.set(input, policy);
|
|
18
|
+
return () => {
|
|
19
|
+
if (previous)
|
|
20
|
+
policies.set(input, previous);
|
|
21
|
+
else
|
|
22
|
+
policies.delete(input);
|
|
23
|
+
};
|
|
24
|
+
}, "provideInputPolicy");
|
|
25
|
+
var bufferedInput = /* @__PURE__ */ __name((input, options = {}) => {
|
|
26
|
+
const policy = inputPolicy(input);
|
|
27
|
+
const maxBytes = options.maxBytes ?? policy.maxBytes ?? MAX_BUFFERED_INPUT;
|
|
28
|
+
const signals = [options.signal, policy.signal].filter((one) => one !== void 0);
|
|
29
|
+
const signal = signals.length ? AbortSignal.any(signals) : void 0;
|
|
30
|
+
const state = input;
|
|
31
|
+
if (state.readableEnded)
|
|
32
|
+
return Promise.resolve(Buffer.alloc(0));
|
|
33
|
+
if (state.destroyed)
|
|
34
|
+
return Promise.reject(new CliError("validation_error", "input closed before EOF", { reason: "input.closed" }));
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const chunks = [];
|
|
37
|
+
let bytes = 0;
|
|
38
|
+
const cleanup = /* @__PURE__ */ __name(() => {
|
|
39
|
+
input.off("data", data).off("end", end).off("error", error).off("close", closed);
|
|
40
|
+
signal?.removeEventListener("abort", aborted);
|
|
41
|
+
input.pause();
|
|
42
|
+
}, "cleanup");
|
|
43
|
+
const error = /* @__PURE__ */ __name((cause) => {
|
|
44
|
+
cleanup();
|
|
45
|
+
reject(cause);
|
|
46
|
+
}, "error");
|
|
47
|
+
const aborted = /* @__PURE__ */ __name(() => error(new CliError("cancelled", "input cancelled", { retryable: false })), "aborted");
|
|
48
|
+
const closed = /* @__PURE__ */ __name(() => error(new CliError("validation_error", "input closed before EOF", { reason: "input.closed" })), "closed");
|
|
49
|
+
const end = /* @__PURE__ */ __name(() => {
|
|
50
|
+
cleanup();
|
|
51
|
+
resolve(Buffer.concat(chunks, bytes));
|
|
52
|
+
}, "end");
|
|
53
|
+
const data = /* @__PURE__ */ __name((chunk) => {
|
|
54
|
+
const buffer = Buffer.from(chunk);
|
|
55
|
+
bytes += buffer.length;
|
|
56
|
+
if (bytes > maxBytes) {
|
|
57
|
+
error(new CliError("validation_error", `buffered input exceeds ${maxBytes} bytes \u2014 use a smaller input or --max-input-bytes`, {
|
|
58
|
+
reason: "input.too-large",
|
|
59
|
+
max_bytes: maxBytes,
|
|
60
|
+
retryable: false
|
|
61
|
+
}));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
chunks.push(buffer);
|
|
65
|
+
}, "data");
|
|
66
|
+
if (signal?.aborted) {
|
|
67
|
+
aborted();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
input.on("data", data).once("end", end).once("error", error).once("close", closed);
|
|
71
|
+
signal?.addEventListener("abort", aborted, { once: true });
|
|
72
|
+
input.resume();
|
|
73
|
+
});
|
|
74
|
+
}, "bufferedInput");
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
MAX_BUFFERED_INPUT,
|
|
78
|
+
MAX_SECRET_INPUT,
|
|
79
|
+
inputPolicy,
|
|
80
|
+
provideInputPolicy,
|
|
81
|
+
bufferedInput
|
|
82
|
+
};
|