@wirecat/wordpress-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 +27 -0
- package/LICENSE +204 -0
- package/README.md +248 -2
- package/contracts/wirecat.json +2535 -0
- package/dist/bin/wordpress.d.ts +3 -0
- package/dist/bin/wordpress.d.ts.map +1 -0
- package/dist/bin/wordpress.js +40 -0
- package/dist/bin/wordpress.js.map +1 -0
- package/dist/bundle/agent-LKBRYKNB.js +37 -0
- package/dist/bundle/all-profiles-OEV7VFQG.js +320 -0
- package/dist/bundle/anthropic-JKTZP2DW.js +91 -0
- package/dist/bundle/app-server-7LWLDDE2.js +249 -0
- package/dist/bundle/bun-2FLR4IV4.js +169 -0
- package/dist/bundle/bun-sqlite-GRSRX5P4.js +76 -0
- package/dist/bundle/chunk-2BI25SEE.js +259 -0
- package/dist/bundle/chunk-2UEGJ5AJ.js +52 -0
- package/dist/bundle/chunk-2XUV7HNE.js +58 -0
- package/dist/bundle/chunk-2Z7UOXFC.js +16 -0
- package/dist/bundle/chunk-3BM6KBWP.js +2788 -0
- package/dist/bundle/chunk-3BRAZVHR.js +1010 -0
- package/dist/bundle/chunk-3LMW7U7F.js +1233 -0
- package/dist/bundle/chunk-3LVTQFGB.js +2000 -0
- package/dist/bundle/chunk-3TKFFSFU.js +106 -0
- package/dist/bundle/chunk-3UX4VJWD.js +78 -0
- package/dist/bundle/chunk-4HEXAGKT.js +334 -0
- package/dist/bundle/chunk-4HP6KGBI.js +32 -0
- package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
- package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
- package/dist/bundle/chunk-5XPHFV7H.js +2333 -0
- package/dist/bundle/chunk-5Z3P543G.js +80 -0
- package/dist/bundle/chunk-6UYDKCV6.js +794 -0
- package/dist/bundle/chunk-7GNB4LBX.js +50 -0
- package/dist/bundle/chunk-7HJFBOAT.js +161 -0
- package/dist/bundle/chunk-7JVKQ6NM.js +206 -0
- package/dist/bundle/chunk-7QH5BZUG.js +142 -0
- package/dist/bundle/chunk-A474OVIW.js +1392 -0
- package/dist/bundle/chunk-AENEMQL3.js +1068 -0
- package/dist/bundle/chunk-AL7I4DT4.js +65718 -0
- package/dist/bundle/chunk-ARGRGTPX.js +108 -0
- package/dist/bundle/chunk-AV2ZJ4WX.js +7 -0
- package/dist/bundle/chunk-BAXNAOOL.js +76 -0
- package/dist/bundle/chunk-BH63B66W.js +407 -0
- package/dist/bundle/chunk-CCOSG3F2.js +24616 -0
- package/dist/bundle/chunk-CFQQTDSA.js +46 -0
- package/dist/bundle/chunk-CGCUOT67.js +388 -0
- package/dist/bundle/chunk-CHPWBQUK.js +39 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DQSOYH6N.js +20 -0
- package/dist/bundle/chunk-ECYOTDJM.js +14 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-EHW45LLT.js +100 -0
- package/dist/bundle/chunk-F3AV5ZSL.js +338 -0
- package/dist/bundle/chunk-F4BX7TH2.js +15 -0
- package/dist/bundle/chunk-F5ZAN7OC.js +6848 -0
- package/dist/bundle/chunk-FMMYBVCH.js +38 -0
- package/dist/bundle/chunk-FNB4SWTY.js +66 -0
- package/dist/bundle/chunk-FQROWBKV.js +12660 -0
- package/dist/bundle/chunk-FV2HJOSC.js +771 -0
- package/dist/bundle/chunk-GCAJW4SR.js +53 -0
- package/dist/bundle/chunk-GPRJXJC7.js +102 -0
- package/dist/bundle/chunk-HCOZUOSN.js +54 -0
- package/dist/bundle/chunk-HM6AMYHR.js +72 -0
- package/dist/bundle/chunk-HVXOA4FO.js +23 -0
- package/dist/bundle/chunk-HWQ7572G.js +95 -0
- package/dist/bundle/chunk-IJVTN5L3.js +82 -0
- package/dist/bundle/chunk-IZDDBOHU.js +3610 -0
- package/dist/bundle/chunk-JAE5B4G7.js +388 -0
- package/dist/bundle/chunk-K2Y5K37O.js +218 -0
- package/dist/bundle/chunk-KCH224US.js +9581 -0
- package/dist/bundle/chunk-KZJQPJK5.js +230 -0
- package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
- package/dist/bundle/chunk-LECMHK2F.js +18 -0
- package/dist/bundle/chunk-LWEMZJLG.js +1332 -0
- package/dist/bundle/chunk-LWTETL2O.js +185 -0
- package/dist/bundle/chunk-MEYYH47C.js +25 -0
- package/dist/bundle/chunk-MJ6LTG4L.js +170 -0
- package/dist/bundle/chunk-NMQRSEZM.js +37 -0
- package/dist/bundle/chunk-ODVGFCBE.js +557 -0
- package/dist/bundle/chunk-OEQNP56V.js +633 -0
- package/dist/bundle/chunk-OV6WQY3L.js +39 -0
- package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
- package/dist/bundle/chunk-PPNTY7LD.js +733 -0
- package/dist/bundle/chunk-PRZYRA66.js +358 -0
- package/dist/bundle/chunk-PV5UYGRJ.js +41594 -0
- package/dist/bundle/chunk-QYTOLPNI.js +52 -0
- package/dist/bundle/chunk-R7Y3XU66.js +362 -0
- package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
- package/dist/bundle/chunk-SD5CXGIG.js +188 -0
- package/dist/bundle/chunk-SXY5G62I.js +288 -0
- package/dist/bundle/chunk-T37TAXVL.js +29 -0
- package/dist/bundle/chunk-T5SOY3AE.js +1197 -0
- package/dist/bundle/chunk-TJ7OORSO.js +1876 -0
- package/dist/bundle/chunk-TRYYWV7J.js +291 -0
- package/dist/bundle/chunk-U6VLNYCO.js +73 -0
- package/dist/bundle/chunk-UC7JLE6J.js +58 -0
- package/dist/bundle/chunk-UUIOAZPH.js +156 -0
- package/dist/bundle/chunk-UXQ24OY6.js +4072 -0
- package/dist/bundle/chunk-VBRRMGON.js +1007 -0
- package/dist/bundle/chunk-VRIBES2C.js +319 -0
- package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
- package/dist/bundle/chunk-XT5XYQEZ.js +3414 -0
- package/dist/bundle/chunk-XTAS5Z3G.js +2231 -0
- package/dist/bundle/chunk-XYQVVW4R.js +24 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YHWFF6DN.js +39 -0
- package/dist/bundle/chunk-YUDVRFXN.js +63 -0
- package/dist/bundle/chunk-Z3I2MCUT.js +131 -0
- package/dist/bundle/chunk-ZDI3WC7V.js +353 -0
- package/dist/bundle/chunk-ZVQ7KFMT.js +274 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-P7YE4EKS.js +37 -0
- package/dist/bundle/command-server-entry-XIMCBWMV.js +166 -0
- package/dist/bundle/decode-6XK55WYV.js +297 -0
- package/dist/bundle/definitions-GIQCGYPR.js +7986 -0
- package/dist/bundle/dispatch-JQBAZWCL.js +411 -0
- package/dist/bundle/dist-2TV3NVE5.js +7577 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/echarts-YRRVLEX3.js +42501 -0
- package/dist/bundle/embed-L3EEQSGX.js +38 -0
- package/dist/bundle/embedder-BIKLBV3J.js +111 -0
- package/dist/bundle/failure-I6AAF5R5.js +25 -0
- package/dist/bundle/first-run-W6G6TYZ2.js +29 -0
- package/dist/bundle/first-screen-ITIAJIBU.js +37 -0
- package/dist/bundle/hast-util-from-html-ZHU6HGIE.js +10531 -0
- package/dist/bundle/hast-util-to-html-IIFHILP5.js +998 -0
- package/dist/bundle/hast-util-to-mdast-D62XX3NR.js +2272 -0
- package/dist/bundle/instructions-AG7SRWTR.js +11 -0
- package/dist/bundle/mcp-YGOAUNC3.js +167 -0
- package/dist/bundle/mdast-util-from-markdown-WVUJDSUO.js +1900 -0
- package/dist/bundle/mdast-util-gfm-KN2D32QS.js +1040 -0
- package/dist/bundle/mdast-util-to-hast-AYJV7KAE.js +879 -0
- package/dist/bundle/mdast-util-to-markdown-UCAJNHJO.js +18 -0
- package/dist/bundle/meeting-combined-CQJ3JHHU.js +24 -0
- package/dist/bundle/meeting-model-MZ7VVBNK.js +25 -0
- package/dist/bundle/meeting-semantic-DADWRRHP.js +22 -0
- package/dist/bundle/micromark-extension-gfm-EEJRRJ36.js +1771 -0
- package/dist/bundle/node-GJQYN4FT.js +176 -0
- package/dist/bundle/node-JJ3WDCNJ.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-TPR62DT2.js +74 -0
- package/dist/bundle/oauth-WGY7JQVW.js +20 -0
- package/dist/bundle/open-DE7QZNAN.js +23 -0
- package/dist/bundle/openai-NHEFT3HS.js +238 -0
- package/dist/bundle/process-MEKCZMX3.js +91 -0
- package/dist/bundle/program-EP2S5BTM.js +38857 -0
- package/dist/bundle/prompt-PWY53BYH.js +17 -0
- package/dist/bundle/recognize-74TXHKMQ.js +26 -0
- package/dist/bundle/remote-F5TJZ5ER.js +31 -0
- package/dist/bundle/rerank-HWUO52UF.js +52 -0
- package/dist/bundle/schemas-4K6WWS5N.js +2157 -0
- package/dist/bundle/serve-I2USUY4X.js +199 -0
- package/dist/bundle/server-GDYDNO6K.js +79 -0
- package/dist/bundle/server-KYUW2AHB.js +212 -0
- package/dist/bundle/sqlite-runtime-N6VFGBJK.js +20 -0
- package/dist/bundle/state-L6JSCN77.js +36 -0
- package/dist/bundle/store-EPG2YPN3.js +291 -0
- package/dist/bundle/store-SQWQJE32.js +181 -0
- package/dist/bundle/store-maintenance-command-FTGSICVA.js +66 -0
- package/dist/bundle/surface-SNMHY6GP.js +65 -0
- package/dist/bundle/wordpress.js +183 -0
- package/dist/commands/api.d.ts +22 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +37 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/content.d.ts +4 -0
- package/dist/commands/content.d.ts.map +1 -0
- package/dist/commands/content.js +94 -0
- package/dist/commands/content.js.map +1 -0
- package/dist/commands/session.d.ts +8 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +28 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +69 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +37 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +31 -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 +7982 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/manifest.d.ts +6 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +8830 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +229 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +2019 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +3365 -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/generated/wirecat-config.d.ts +11 -0
- package/dist/generated/wirecat-config.d.ts.map +1 -0
- package/dist/generated/wirecat-config.js +337 -0
- package/dist/generated/wirecat-config.js.map +1 -0
- package/dist/identity.d.ts +28 -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/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +53 -0
- package/dist/program.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 +87 -4
- package/skills/wordpress-cli/SKILL.md +88 -0
- package/skills/wordpress-cli/references/api/api-block-directory.md +17 -0
- package/skills/wordpress-cli/references/api/api-block-patterns.md +13 -0
- package/skills/wordpress-cli/references/api/api-block-types.md +34 -0
- package/skills/wordpress-cli/references/api/api-blocks.md +159 -0
- package/skills/wordpress-cli/references/api/api-categories.md +69 -0
- package/skills/wordpress-cli/references/api/api-comments.md +79 -0
- package/skills/wordpress-cli/references/api/api-font-collections.md +16 -0
- package/skills/wordpress-cli/references/api/api-font-families.md +122 -0
- package/skills/wordpress-cli/references/api/api-global-styles.md +29 -0
- package/skills/wordpress-cli/references/api/api-media.md +106 -0
- package/skills/wordpress-cli/references/api/api-menu-items.md +115 -0
- package/skills/wordpress-cli/references/api/api-menu-locations.md +22 -0
- package/skills/wordpress-cli/references/api/api-menus.md +69 -0
- package/skills/wordpress-cli/references/api/api-navigation.md +155 -0
- package/skills/wordpress-cli/references/api/api-pages.md +161 -0
- package/skills/wordpress-cli/references/api/api-pattern-directory.md +23 -0
- package/skills/wordpress-cli/references/api/api-plugins.md +25 -0
- package/skills/wordpress-cli/references/api/api-posts.md +166 -0
- package/skills/wordpress-cli/references/api/api-search.md +21 -0
- package/skills/wordpress-cli/references/api/api-settings.md +19 -0
- package/skills/wordpress-cli/references/api/api-sidebars.md +34 -0
- package/skills/wordpress-cli/references/api/api-statuses.md +22 -0
- package/skills/wordpress-cli/references/api/api-tags.md +69 -0
- package/skills/wordpress-cli/references/api/api-taxonomies.md +23 -0
- package/skills/wordpress-cli/references/api/api-template-parts.md +38 -0
- package/skills/wordpress-cli/references/api/api-templates.md +38 -0
- package/skills/wordpress-cli/references/api/api-themes.md +12 -0
- package/skills/wordpress-cli/references/api/api-types.md +22 -0
- package/skills/wordpress-cli/references/api/api-users.md +149 -0
- package/skills/wordpress-cli/references/api/api-widget-types.md +46 -0
- package/skills/wordpress-cli/references/api/api-widgets.md +57 -0
- package/skills/wordpress-cli/references/api/api-wp-pattern-category.md +69 -0
- package/skills/wordpress-cli/references/api.md +44 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
importFrom
|
|
5
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-HM6AMYHR.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
|
|
17
|
+
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
|
|
18
|
+
var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
19
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
20
|
+
let offset = 0;
|
|
21
|
+
let serial;
|
|
22
|
+
let packet = 0;
|
|
23
|
+
let length = 0;
|
|
24
|
+
const prefix = [];
|
|
25
|
+
while (offset < bytes.length) {
|
|
26
|
+
if (offset + 27 > bytes.length || view.getUint32(offset, false) !== 1332176723 || bytes[offset + 4] !== 0)
|
|
27
|
+
throw invalid();
|
|
28
|
+
const stream = view.getUint32(offset + 14, true);
|
|
29
|
+
if (serial !== void 0 && serial !== stream)
|
|
30
|
+
throw invalid();
|
|
31
|
+
serial = stream;
|
|
32
|
+
const segments = bytes[offset + 26] ?? 0;
|
|
33
|
+
let data = offset + 27 + segments;
|
|
34
|
+
if (data > bytes.length || Boolean((bytes[offset + 5] ?? 0) & 1) !== length > 0)
|
|
35
|
+
throw invalid();
|
|
36
|
+
for (let index = 0; index < segments; index++) {
|
|
37
|
+
const size = bytes[offset + 27 + index] ?? 0;
|
|
38
|
+
if (data + size > bytes.length)
|
|
39
|
+
throw invalid();
|
|
40
|
+
const take = Math.min(size, 19 - prefix.length);
|
|
41
|
+
for (let i = 0; i < take; i++)
|
|
42
|
+
prefix.push(bytes[data + i] ?? 0);
|
|
43
|
+
length += size;
|
|
44
|
+
data += size;
|
|
45
|
+
if (size === 255)
|
|
46
|
+
continue;
|
|
47
|
+
if (packet === 0) {
|
|
48
|
+
if (length < 19 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusHead" || ![1, 2].includes(prefix[9] ?? 0) || prefix[18] !== 0)
|
|
49
|
+
throw invalid();
|
|
50
|
+
} else if (packet === 1) {
|
|
51
|
+
if (length < 8 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusTags")
|
|
52
|
+
throw invalid();
|
|
53
|
+
} else {
|
|
54
|
+
if (length < 1)
|
|
55
|
+
throw invalid();
|
|
56
|
+
const toc = prefix[0] ?? 0;
|
|
57
|
+
const config = toc >> 3;
|
|
58
|
+
const frame = config >= 16 ? 120 << (config & 3) : config >= 12 ? 480 << (config & 1) : (config & 3) === 3 ? 2880 : 480 << (config & 3);
|
|
59
|
+
const count = (toc & 3) === 0 ? 1 : (toc & 3) === 3 ? length >= 2 ? (prefix[1] ?? 0) & 63 : 0 : 2;
|
|
60
|
+
if (count < 1 || frame * count > 5760)
|
|
61
|
+
throw invalid();
|
|
62
|
+
}
|
|
63
|
+
packet++;
|
|
64
|
+
length = 0;
|
|
65
|
+
prefix.length = 0;
|
|
66
|
+
}
|
|
67
|
+
offset = data;
|
|
68
|
+
}
|
|
69
|
+
if (length !== 0 || packet < 3)
|
|
70
|
+
throw invalid();
|
|
71
|
+
}, "checkOggDuration");
|
|
72
|
+
|
|
73
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
74
|
+
var SAMPLE_RATE = 16e3;
|
|
75
|
+
var LEAD = SAMPLE_RATE / 2;
|
|
76
|
+
var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
|
|
77
|
+
const step = rate / SAMPLE_RATE;
|
|
78
|
+
const length = Math.floor(samples.length / step);
|
|
79
|
+
const pcm = new Float32Array(LEAD + length);
|
|
80
|
+
for (let i = 0; i < length; i++) {
|
|
81
|
+
const from = Math.floor(i * step);
|
|
82
|
+
const to = Math.max(from + 1, Math.floor((i + 1) * step));
|
|
83
|
+
let sum = 0;
|
|
84
|
+
for (let j = from; j < to; j++)
|
|
85
|
+
sum += samples[j] ?? 0;
|
|
86
|
+
pcm[LEAD + i] = sum / (to - from);
|
|
87
|
+
}
|
|
88
|
+
return pcm;
|
|
89
|
+
}, "toModelRate");
|
|
90
|
+
var decodeOgg = /* @__PURE__ */ __name(async (bytes) => {
|
|
91
|
+
checkOggDuration(bytes);
|
|
92
|
+
const { OggOpusDecoder } = await importFrom(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href, "ogg-opus-decoder");
|
|
93
|
+
const decoder = new OggOpusDecoder();
|
|
94
|
+
await decoder.ready;
|
|
95
|
+
try {
|
|
96
|
+
const { channelData, sampleRate, samplesDecoded } = await decoder.decodeFile(bytes);
|
|
97
|
+
if (!channelData[0] || samplesDecoded === 0)
|
|
98
|
+
throw new Error("no Ogg Opus audio in it");
|
|
99
|
+
return channelData.map((samples) => ({ samples, rate: sampleRate }));
|
|
100
|
+
} finally {
|
|
101
|
+
decoder.free();
|
|
102
|
+
}
|
|
103
|
+
}, "decodeOgg");
|
|
104
|
+
var WINDOW = 512;
|
|
105
|
+
var detector = /* @__PURE__ */ __name((vadModel) => ({
|
|
106
|
+
sileroVad: {
|
|
107
|
+
model: vadModel,
|
|
108
|
+
// At the default 0.5 a quietly spoken stretch in the middle of a voice message never counted as
|
|
109
|
+
// speech and was lost; 0.3 keeps it for both models and changes nothing on clear speech (126508, 2026-09-30).
|
|
110
|
+
threshold: 0.3,
|
|
111
|
+
minSilenceDuration: 0.5,
|
|
112
|
+
minSpeechDuration: 0.25,
|
|
113
|
+
maxSpeechDuration: 20,
|
|
114
|
+
windowSize: WINDOW
|
|
115
|
+
},
|
|
116
|
+
sampleRate: SAMPLE_RATE,
|
|
117
|
+
numThreads: 1,
|
|
118
|
+
provider: "cpu",
|
|
119
|
+
debug: 0,
|
|
120
|
+
bufferSizeInSeconds: 30
|
|
121
|
+
}), "detector");
|
|
122
|
+
var cut = /* @__PURE__ */ __name((vad, pcm, each) => {
|
|
123
|
+
vad.reset();
|
|
124
|
+
const last = Math.max(0, pcm.length - LEAD);
|
|
125
|
+
const drain = /* @__PURE__ */ __name(() => {
|
|
126
|
+
for (; !vad.isEmpty(); vad.pop()) {
|
|
127
|
+
const { start, samples } = vad.front();
|
|
128
|
+
each({
|
|
129
|
+
start: Math.min(last, Math.max(0, start - LEAD)) / SAMPLE_RATE,
|
|
130
|
+
end: Math.min(last, Math.max(0, start + samples.length - LEAD)) / SAMPLE_RATE,
|
|
131
|
+
samples
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, "drain");
|
|
135
|
+
for (let i = 0; i + WINDOW <= pcm.length; i += WINDOW) {
|
|
136
|
+
vad.acceptWaveform(pcm.subarray(i, i + WINDOW));
|
|
137
|
+
drain();
|
|
138
|
+
}
|
|
139
|
+
vad.flush();
|
|
140
|
+
drain();
|
|
141
|
+
}, "cut");
|
|
142
|
+
var openSpeechCutter = /* @__PURE__ */ __name((vadModel) => {
|
|
143
|
+
const vad = loadSherpa().createVad(detector(vadModel));
|
|
144
|
+
return {
|
|
145
|
+
cut: /* @__PURE__ */ __name((pcm) => {
|
|
146
|
+
const spans = [];
|
|
147
|
+
cut(vad, pcm, ({ start, end }) => spans.push({ start, end }));
|
|
148
|
+
return spans;
|
|
149
|
+
}, "cut"),
|
|
150
|
+
free: /* @__PURE__ */ __name(() => vad.free(), "free")
|
|
151
|
+
};
|
|
152
|
+
}, "openSpeechCutter");
|
|
153
|
+
var loaded;
|
|
154
|
+
var loadSherpa = /* @__PURE__ */ __name(() => {
|
|
155
|
+
if (loaded)
|
|
156
|
+
return loaded;
|
|
157
|
+
const load = createRequire(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href);
|
|
158
|
+
const wasm = {};
|
|
159
|
+
load("sherpa-onnx/sherpa-onnx-wasm-nodejs.js")(wasm);
|
|
160
|
+
const stdout = wasm.FS?.getStream(1);
|
|
161
|
+
if (stdout)
|
|
162
|
+
stdout.nfd = 2;
|
|
163
|
+
const asr = load("sherpa-onnx/sherpa-onnx-asr.js");
|
|
164
|
+
const vad = load("sherpa-onnx/sherpa-onnx-vad.js");
|
|
165
|
+
loaded = {
|
|
166
|
+
createOfflineRecognizer: /* @__PURE__ */ __name((config) => new asr.OfflineRecognizer(config, wasm), "createOfflineRecognizer"),
|
|
167
|
+
createVad: /* @__PURE__ */ __name((config) => vad.createVad(wasm, config), "createVad")
|
|
168
|
+
};
|
|
169
|
+
return loaded;
|
|
170
|
+
}, "loadSherpa");
|
|
171
|
+
var openRecognizer = /* @__PURE__ */ __name((model, path, vadModel) => {
|
|
172
|
+
const sherpa = loadSherpa();
|
|
173
|
+
const engine = sherpa.createOfflineRecognizer({
|
|
174
|
+
featConfig: { sampleRate: SAMPLE_RATE, featureDim: model.featureDim },
|
|
175
|
+
modelConfig: { ...model.config(path), numThreads: 1, provider: "cpu", debug: 0 },
|
|
176
|
+
decodingMethod: "greedy_search"
|
|
177
|
+
});
|
|
178
|
+
const vad = sherpa.createVad(detector(vadModel));
|
|
179
|
+
const piece = /* @__PURE__ */ __name((samples) => {
|
|
180
|
+
const stream = engine.createStream();
|
|
181
|
+
try {
|
|
182
|
+
stream.acceptWaveform(SAMPLE_RATE, samples);
|
|
183
|
+
engine.decode(stream);
|
|
184
|
+
return engine.getResult(stream).text.trim();
|
|
185
|
+
} finally {
|
|
186
|
+
stream.free();
|
|
187
|
+
}
|
|
188
|
+
}, "piece");
|
|
189
|
+
const pieces = /* @__PURE__ */ __name((pcm) => {
|
|
190
|
+
const heard = [];
|
|
191
|
+
cut(vad, pcm, ({ start, end, samples }) => {
|
|
192
|
+
const text = piece(samples);
|
|
193
|
+
if (text)
|
|
194
|
+
heard.push({ start, end, text });
|
|
195
|
+
});
|
|
196
|
+
return heard;
|
|
197
|
+
}, "pieces");
|
|
198
|
+
const piecesUntil = /* @__PURE__ */ __name(async (pcm, signal) => {
|
|
199
|
+
const spans = [];
|
|
200
|
+
cut(vad, pcm, (span) => spans.push(span));
|
|
201
|
+
const heard = [];
|
|
202
|
+
for (const { start, end, samples } of spans) {
|
|
203
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
204
|
+
signal.throwIfAborted();
|
|
205
|
+
const text = piece(samples);
|
|
206
|
+
if (text)
|
|
207
|
+
heard.push({ start, end, text });
|
|
208
|
+
}
|
|
209
|
+
return heard;
|
|
210
|
+
}, "piecesUntil");
|
|
211
|
+
return {
|
|
212
|
+
recognize: /* @__PURE__ */ __name((pcm) => pieces(pcm).map(({ text }) => text).join(" "), "recognize"),
|
|
213
|
+
pieces,
|
|
214
|
+
piecesUntil,
|
|
215
|
+
free: /* @__PURE__ */ __name(() => {
|
|
216
|
+
vad.free();
|
|
217
|
+
engine.free();
|
|
218
|
+
}, "free")
|
|
219
|
+
};
|
|
220
|
+
}, "openRecognizer");
|
|
221
|
+
|
|
222
|
+
export {
|
|
223
|
+
SAMPLE_RATE,
|
|
224
|
+
toModelRate,
|
|
225
|
+
decodeOgg,
|
|
226
|
+
detector,
|
|
227
|
+
openSpeechCutter,
|
|
228
|
+
loadSherpa,
|
|
229
|
+
openRecognizer
|
|
230
|
+
};
|
|
@@ -0,0 +1,286 @@
|
|
|
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/@ungap+structured-clone@1.4.0/node_modules/@ungap/structured-clone/esm/types.js
|
|
8
|
+
var VOID = -1;
|
|
9
|
+
var PRIMITIVE = 0;
|
|
10
|
+
var ARRAY = 1;
|
|
11
|
+
var OBJECT = 2;
|
|
12
|
+
var DATE = 3;
|
|
13
|
+
var REGEXP = 4;
|
|
14
|
+
var MAP = 5;
|
|
15
|
+
var SET = 6;
|
|
16
|
+
var ERROR = 7;
|
|
17
|
+
var BIGINT = 8;
|
|
18
|
+
|
|
19
|
+
// node_modules/.pnpm/@ungap+structured-clone@1.4.0/node_modules/@ungap/structured-clone/esm/deserialize.js
|
|
20
|
+
var { defineProperty } = Object;
|
|
21
|
+
var env = typeof self === "object" ? self : globalThis;
|
|
22
|
+
var guard = /* @__PURE__ */ __name((name, init) => {
|
|
23
|
+
switch (name) {
|
|
24
|
+
case "Function":
|
|
25
|
+
case "SharedWorker":
|
|
26
|
+
case "Worker":
|
|
27
|
+
case "eval":
|
|
28
|
+
case "setInterval":
|
|
29
|
+
case "setTimeout":
|
|
30
|
+
throw new TypeError("unable to deserialize " + name);
|
|
31
|
+
}
|
|
32
|
+
return new env[name](init);
|
|
33
|
+
}, "guard");
|
|
34
|
+
var deserializer = /* @__PURE__ */ __name(($, _) => {
|
|
35
|
+
const as = /* @__PURE__ */ __name((out, index) => {
|
|
36
|
+
$.set(index, out);
|
|
37
|
+
return out;
|
|
38
|
+
}, "as");
|
|
39
|
+
const unpair = /* @__PURE__ */ __name((index) => {
|
|
40
|
+
if ($.has(index))
|
|
41
|
+
return $.get(index);
|
|
42
|
+
const [type, value] = _[index];
|
|
43
|
+
switch (type) {
|
|
44
|
+
case PRIMITIVE:
|
|
45
|
+
case VOID:
|
|
46
|
+
return as(value, index);
|
|
47
|
+
case ARRAY: {
|
|
48
|
+
const arr = as([], index);
|
|
49
|
+
for (const index2 of value)
|
|
50
|
+
arr.push(unpair(index2));
|
|
51
|
+
return arr;
|
|
52
|
+
}
|
|
53
|
+
case OBJECT: {
|
|
54
|
+
const object = as({}, index);
|
|
55
|
+
for (const [key, index2] of value) {
|
|
56
|
+
const k = unpair(key), value2 = unpair(index2);
|
|
57
|
+
if (k === "__proto__") defineProperty(object, k, {
|
|
58
|
+
value: value2,
|
|
59
|
+
configurable: true,
|
|
60
|
+
enumerable: true,
|
|
61
|
+
writable: true
|
|
62
|
+
});
|
|
63
|
+
else object[k] = value2;
|
|
64
|
+
}
|
|
65
|
+
return object;
|
|
66
|
+
}
|
|
67
|
+
case DATE:
|
|
68
|
+
return as(new Date(value), index);
|
|
69
|
+
case REGEXP: {
|
|
70
|
+
const { source, flags } = value;
|
|
71
|
+
return as(new RegExp(source, flags), index);
|
|
72
|
+
}
|
|
73
|
+
case MAP: {
|
|
74
|
+
const map = as(/* @__PURE__ */ new Map(), index);
|
|
75
|
+
for (const [key, index2] of value)
|
|
76
|
+
map.set(unpair(key), unpair(index2));
|
|
77
|
+
return map;
|
|
78
|
+
}
|
|
79
|
+
case SET: {
|
|
80
|
+
const set = as(/* @__PURE__ */ new Set(), index);
|
|
81
|
+
for (const index2 of value)
|
|
82
|
+
set.add(unpair(index2));
|
|
83
|
+
return set;
|
|
84
|
+
}
|
|
85
|
+
case ERROR: {
|
|
86
|
+
const { name, message } = value;
|
|
87
|
+
return as(
|
|
88
|
+
typeof env[name] === "function" ? guard(name, message) : new Error(message),
|
|
89
|
+
index
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
case BIGINT:
|
|
93
|
+
return as(BigInt(value), index);
|
|
94
|
+
case "BigInt":
|
|
95
|
+
return as(Object(BigInt(value)), index);
|
|
96
|
+
case "ArrayBuffer":
|
|
97
|
+
return as(new Uint8Array(value).buffer, value);
|
|
98
|
+
case "DataView": {
|
|
99
|
+
const { buffer } = new Uint8Array(value);
|
|
100
|
+
return as(new DataView(buffer), value);
|
|
101
|
+
}
|
|
102
|
+
case "-0":
|
|
103
|
+
return -0;
|
|
104
|
+
}
|
|
105
|
+
return as(guard(type, value), index);
|
|
106
|
+
}, "unpair");
|
|
107
|
+
return unpair;
|
|
108
|
+
}, "deserializer");
|
|
109
|
+
var deserialize = /* @__PURE__ */ __name((serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0), "deserialize");
|
|
110
|
+
|
|
111
|
+
// node_modules/.pnpm/@ungap+structured-clone@1.4.0/node_modules/@ungap/structured-clone/esm/serialize.js
|
|
112
|
+
var EMPTY = "";
|
|
113
|
+
var { toString } = {};
|
|
114
|
+
var { keys, is } = Object;
|
|
115
|
+
var typeOf = /* @__PURE__ */ __name((value) => {
|
|
116
|
+
const type = typeof value;
|
|
117
|
+
if (type !== "object" || !value)
|
|
118
|
+
return [PRIMITIVE, type];
|
|
119
|
+
const asString = toString.call(value).slice(8, -1);
|
|
120
|
+
switch (asString) {
|
|
121
|
+
case "Array":
|
|
122
|
+
return [ARRAY, EMPTY];
|
|
123
|
+
case "Object":
|
|
124
|
+
return [OBJECT, EMPTY];
|
|
125
|
+
case "Date":
|
|
126
|
+
return [DATE, EMPTY];
|
|
127
|
+
case "RegExp":
|
|
128
|
+
return [REGEXP, EMPTY];
|
|
129
|
+
case "Map":
|
|
130
|
+
return [MAP, EMPTY];
|
|
131
|
+
case "Set":
|
|
132
|
+
return [SET, EMPTY];
|
|
133
|
+
case "DataView":
|
|
134
|
+
return [ARRAY, asString];
|
|
135
|
+
}
|
|
136
|
+
if (asString.includes("Array"))
|
|
137
|
+
return [ARRAY, asString];
|
|
138
|
+
if (value instanceof Error)
|
|
139
|
+
return [ERROR, value.name || "Error"];
|
|
140
|
+
return [OBJECT, asString];
|
|
141
|
+
}, "typeOf");
|
|
142
|
+
var shouldSkip = /* @__PURE__ */ __name(([TYPE, type]) => TYPE === PRIMITIVE && (type === "function" || type === "symbol"), "shouldSkip");
|
|
143
|
+
var serializer = /* @__PURE__ */ __name((strict, json, $, _) => {
|
|
144
|
+
const as = /* @__PURE__ */ __name((out, value) => {
|
|
145
|
+
const index = _.push(out) - 1;
|
|
146
|
+
$.set(value, index);
|
|
147
|
+
return index;
|
|
148
|
+
}, "as");
|
|
149
|
+
const pair = /* @__PURE__ */ __name((value) => {
|
|
150
|
+
if ($.has(value))
|
|
151
|
+
return $.get(value);
|
|
152
|
+
let [TYPE, type] = typeOf(value);
|
|
153
|
+
switch (TYPE) {
|
|
154
|
+
case PRIMITIVE: {
|
|
155
|
+
let entry = value;
|
|
156
|
+
switch (type) {
|
|
157
|
+
case "bigint":
|
|
158
|
+
TYPE = BIGINT;
|
|
159
|
+
entry = value.toString();
|
|
160
|
+
break;
|
|
161
|
+
case "number":
|
|
162
|
+
if (!value && is(value, -0))
|
|
163
|
+
return _.push(["-0"]) - 1;
|
|
164
|
+
break;
|
|
165
|
+
case "function":
|
|
166
|
+
case "symbol":
|
|
167
|
+
if (strict)
|
|
168
|
+
throw new TypeError("unable to serialize " + type);
|
|
169
|
+
entry = null;
|
|
170
|
+
break;
|
|
171
|
+
case "undefined":
|
|
172
|
+
return as([VOID], value);
|
|
173
|
+
}
|
|
174
|
+
return as([TYPE, entry], value);
|
|
175
|
+
}
|
|
176
|
+
case ARRAY: {
|
|
177
|
+
if (type) {
|
|
178
|
+
let spread = value;
|
|
179
|
+
if (type === "DataView") {
|
|
180
|
+
spread = new Uint8Array(value.buffer);
|
|
181
|
+
} else if (type === "ArrayBuffer") {
|
|
182
|
+
spread = new Uint8Array(value);
|
|
183
|
+
}
|
|
184
|
+
return as([type, [...spread]], value);
|
|
185
|
+
}
|
|
186
|
+
const arr = [];
|
|
187
|
+
const index = as([TYPE, arr], value);
|
|
188
|
+
for (const entry of value)
|
|
189
|
+
arr.push(pair(entry));
|
|
190
|
+
return index;
|
|
191
|
+
}
|
|
192
|
+
case OBJECT: {
|
|
193
|
+
if (type) {
|
|
194
|
+
switch (type) {
|
|
195
|
+
case "BigInt":
|
|
196
|
+
return as([type, value.toString()], value);
|
|
197
|
+
case "Boolean":
|
|
198
|
+
case "Number":
|
|
199
|
+
case "String":
|
|
200
|
+
return as([type, value.valueOf()], value);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (json && "toJSON" in value)
|
|
204
|
+
return pair(value.toJSON());
|
|
205
|
+
const entries = [];
|
|
206
|
+
const index = as([TYPE, entries], value);
|
|
207
|
+
for (const key of keys(value)) {
|
|
208
|
+
if (strict || !shouldSkip(typeOf(value[key])))
|
|
209
|
+
entries.push([pair(key), pair(value[key])]);
|
|
210
|
+
}
|
|
211
|
+
return index;
|
|
212
|
+
}
|
|
213
|
+
case DATE:
|
|
214
|
+
return as([TYPE, isNaN(value.getTime()) ? EMPTY : value.toISOString()], value);
|
|
215
|
+
case REGEXP: {
|
|
216
|
+
const { source, flags } = value;
|
|
217
|
+
return as([TYPE, { source, flags }], value);
|
|
218
|
+
}
|
|
219
|
+
case MAP: {
|
|
220
|
+
const entries = [];
|
|
221
|
+
const index = as([TYPE, entries], value);
|
|
222
|
+
for (const [key, entry] of value) {
|
|
223
|
+
if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))
|
|
224
|
+
entries.push([pair(key), pair(entry)]);
|
|
225
|
+
}
|
|
226
|
+
return index;
|
|
227
|
+
}
|
|
228
|
+
case SET: {
|
|
229
|
+
const entries = [];
|
|
230
|
+
const index = as([TYPE, entries], value);
|
|
231
|
+
for (const entry of value) {
|
|
232
|
+
if (strict || !shouldSkip(typeOf(entry)))
|
|
233
|
+
entries.push(pair(entry));
|
|
234
|
+
}
|
|
235
|
+
return index;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const { message } = value;
|
|
239
|
+
return as([TYPE, { name: type, message }], value);
|
|
240
|
+
}, "pair");
|
|
241
|
+
return pair;
|
|
242
|
+
}, "serializer");
|
|
243
|
+
var serialize = /* @__PURE__ */ __name((value, { json, lossy } = {}) => {
|
|
244
|
+
const _ = [];
|
|
245
|
+
return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _)(value), _;
|
|
246
|
+
}, "serialize");
|
|
247
|
+
|
|
248
|
+
// node_modules/.pnpm/@ungap+structured-clone@1.4.0/node_modules/@ungap/structured-clone/esm/index.js
|
|
249
|
+
var esm_default = typeof structuredClone === "function" ? (
|
|
250
|
+
/* c8 ignore start */
|
|
251
|
+
(any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any, options)) : structuredClone(any)
|
|
252
|
+
) : (any, options) => deserialize(serialize(any, options));
|
|
253
|
+
|
|
254
|
+
// node_modules/.pnpm/unist-util-position@5.0.0/node_modules/unist-util-position/lib/index.js
|
|
255
|
+
var pointEnd = point("end");
|
|
256
|
+
var pointStart = point("start");
|
|
257
|
+
function point(type) {
|
|
258
|
+
return point2;
|
|
259
|
+
function point2(node) {
|
|
260
|
+
const point3 = node && node.position && node.position[type] || {};
|
|
261
|
+
if (typeof point3.line === "number" && point3.line > 0 && typeof point3.column === "number" && point3.column > 0) {
|
|
262
|
+
return {
|
|
263
|
+
line: point3.line,
|
|
264
|
+
column: point3.column,
|
|
265
|
+
offset: typeof point3.offset === "number" && point3.offset > -1 ? point3.offset : void 0
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
__name(point2, "point");
|
|
270
|
+
}
|
|
271
|
+
__name(point, "point");
|
|
272
|
+
function position(node) {
|
|
273
|
+
const start = pointStart(node);
|
|
274
|
+
const end = pointEnd(node);
|
|
275
|
+
if (start && end) {
|
|
276
|
+
return { start, end };
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
__name(position, "position");
|
|
280
|
+
|
|
281
|
+
export {
|
|
282
|
+
esm_default,
|
|
283
|
+
pointEnd,
|
|
284
|
+
pointStart,
|
|
285
|
+
position
|
|
286
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/cli/stdin-field.js
|
|
8
|
+
var fields = /* @__PURE__ */ new WeakMap();
|
|
9
|
+
var readsStdin = /* @__PURE__ */ __name((command, field) => {
|
|
10
|
+
fields.set(command, field);
|
|
11
|
+
return command;
|
|
12
|
+
}, "readsStdin");
|
|
13
|
+
var stdinFieldOf = /* @__PURE__ */ __name((command) => fields.get(command), "stdinFieldOf");
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
readsStdin,
|
|
17
|
+
stdinFieldOf
|
|
18
|
+
};
|