speechflow 1.3.2 → 1.4.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.
Files changed (154) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/etc/stx.conf +54 -58
  3. package/package.json +25 -106
  4. package/speechflow-cli/etc/stx.conf +77 -0
  5. package/speechflow-cli/package.json +116 -0
  6. package/speechflow-cli/src/speechflow-node-a2a-meter.ts +217 -0
  7. package/{src → speechflow-cli/src}/speechflow-node-a2a-vad.ts +14 -21
  8. package/{src → speechflow-cli/src}/speechflow-node-a2t-deepgram.ts +21 -38
  9. package/{src → speechflow-cli/src}/speechflow-node-t2a-elevenlabs.ts +10 -16
  10. package/speechflow-cli/src/speechflow-node-t2t-subtitle.ts +276 -0
  11. package/{src → speechflow-cli/src}/speechflow-node-x2x-filter.ts +5 -1
  12. package/{src → speechflow-cli/src}/speechflow-node-x2x-trace.ts +15 -7
  13. package/{src → speechflow-cli/src}/speechflow-node.ts +7 -0
  14. package/{src → speechflow-cli/src}/speechflow.ts +81 -25
  15. package/speechflow-ui-db/etc/eslint.mjs +106 -0
  16. package/speechflow-ui-db/etc/htmllint.json +55 -0
  17. package/speechflow-ui-db/etc/stx.conf +79 -0
  18. package/speechflow-ui-db/etc/stylelint.js +46 -0
  19. package/speechflow-ui-db/etc/stylelint.yaml +33 -0
  20. package/speechflow-ui-db/etc/tsc-client.json +30 -0
  21. package/speechflow-ui-db/etc/tsc.node.json +9 -0
  22. package/speechflow-ui-db/etc/vite-client.mts +63 -0
  23. package/speechflow-ui-db/package.d/htmllint-cli+0.0.7.patch +20 -0
  24. package/speechflow-ui-db/package.json +75 -0
  25. package/speechflow-ui-db/src/app-icon.ai +1989 -4
  26. package/speechflow-ui-db/src/app-icon.svg +26 -0
  27. package/speechflow-ui-db/src/app.styl +64 -0
  28. package/speechflow-ui-db/src/app.vue +221 -0
  29. package/speechflow-ui-db/src/index.html +23 -0
  30. package/speechflow-ui-db/src/index.ts +26 -0
  31. package/{dst/speechflow.d.ts → speechflow-ui-db/src/lib.d.ts} +5 -3
  32. package/speechflow-ui-db/src/tsconfig.json +3 -0
  33. package/speechflow-ui-st/etc/eslint.mjs +106 -0
  34. package/speechflow-ui-st/etc/htmllint.json +55 -0
  35. package/speechflow-ui-st/etc/stx.conf +79 -0
  36. package/speechflow-ui-st/etc/stylelint.js +46 -0
  37. package/speechflow-ui-st/etc/stylelint.yaml +33 -0
  38. package/speechflow-ui-st/etc/tsc-client.json +30 -0
  39. package/speechflow-ui-st/etc/tsc.node.json +9 -0
  40. package/speechflow-ui-st/etc/vite-client.mts +63 -0
  41. package/speechflow-ui-st/package.d/htmllint-cli+0.0.7.patch +20 -0
  42. package/speechflow-ui-st/package.json +79 -0
  43. package/speechflow-ui-st/src/app-icon.ai +1989 -4
  44. package/speechflow-ui-st/src/app-icon.svg +26 -0
  45. package/speechflow-ui-st/src/app.styl +64 -0
  46. package/speechflow-ui-st/src/app.vue +142 -0
  47. package/speechflow-ui-st/src/index.html +23 -0
  48. package/speechflow-ui-st/src/index.ts +26 -0
  49. package/speechflow-ui-st/src/lib.d.ts +9 -0
  50. package/speechflow-ui-st/src/tsconfig.json +3 -0
  51. package/dst/speechflow-node-a2a-ffmpeg.d.ts +0 -13
  52. package/dst/speechflow-node-a2a-ffmpeg.js +0 -153
  53. package/dst/speechflow-node-a2a-ffmpeg.js.map +0 -1
  54. package/dst/speechflow-node-a2a-gender.d.ts +0 -20
  55. package/dst/speechflow-node-a2a-gender.js +0 -349
  56. package/dst/speechflow-node-a2a-gender.js.map +0 -1
  57. package/dst/speechflow-node-a2a-meter.d.ts +0 -14
  58. package/dst/speechflow-node-a2a-meter.js +0 -196
  59. package/dst/speechflow-node-a2a-meter.js.map +0 -1
  60. package/dst/speechflow-node-a2a-mute.d.ts +0 -17
  61. package/dst/speechflow-node-a2a-mute.js +0 -117
  62. package/dst/speechflow-node-a2a-mute.js.map +0 -1
  63. package/dst/speechflow-node-a2a-vad.d.ts +0 -19
  64. package/dst/speechflow-node-a2a-vad.js +0 -383
  65. package/dst/speechflow-node-a2a-vad.js.map +0 -1
  66. package/dst/speechflow-node-a2a-wav.d.ts +0 -11
  67. package/dst/speechflow-node-a2a-wav.js +0 -211
  68. package/dst/speechflow-node-a2a-wav.js.map +0 -1
  69. package/dst/speechflow-node-a2t-deepgram.d.ts +0 -19
  70. package/dst/speechflow-node-a2t-deepgram.js +0 -345
  71. package/dst/speechflow-node-a2t-deepgram.js.map +0 -1
  72. package/dst/speechflow-node-t2a-elevenlabs.d.ts +0 -18
  73. package/dst/speechflow-node-t2a-elevenlabs.js +0 -244
  74. package/dst/speechflow-node-t2a-elevenlabs.js.map +0 -1
  75. package/dst/speechflow-node-t2a-kokoro.d.ts +0 -14
  76. package/dst/speechflow-node-t2a-kokoro.js +0 -155
  77. package/dst/speechflow-node-t2a-kokoro.js.map +0 -1
  78. package/dst/speechflow-node-t2t-deepl.d.ts +0 -15
  79. package/dst/speechflow-node-t2t-deepl.js +0 -146
  80. package/dst/speechflow-node-t2t-deepl.js.map +0 -1
  81. package/dst/speechflow-node-t2t-format.d.ts +0 -11
  82. package/dst/speechflow-node-t2t-format.js +0 -82
  83. package/dst/speechflow-node-t2t-format.js.map +0 -1
  84. package/dst/speechflow-node-t2t-ollama.d.ts +0 -13
  85. package/dst/speechflow-node-t2t-ollama.js +0 -247
  86. package/dst/speechflow-node-t2t-ollama.js.map +0 -1
  87. package/dst/speechflow-node-t2t-openai.d.ts +0 -13
  88. package/dst/speechflow-node-t2t-openai.js +0 -227
  89. package/dst/speechflow-node-t2t-openai.js.map +0 -1
  90. package/dst/speechflow-node-t2t-sentence.d.ts +0 -17
  91. package/dst/speechflow-node-t2t-sentence.js +0 -250
  92. package/dst/speechflow-node-t2t-sentence.js.map +0 -1
  93. package/dst/speechflow-node-t2t-subtitle.d.ts +0 -12
  94. package/dst/speechflow-node-t2t-subtitle.js +0 -166
  95. package/dst/speechflow-node-t2t-subtitle.js.map +0 -1
  96. package/dst/speechflow-node-t2t-transformers.d.ts +0 -14
  97. package/dst/speechflow-node-t2t-transformers.js +0 -265
  98. package/dst/speechflow-node-t2t-transformers.js.map +0 -1
  99. package/dst/speechflow-node-x2x-filter.d.ts +0 -11
  100. package/dst/speechflow-node-x2x-filter.js +0 -117
  101. package/dst/speechflow-node-x2x-filter.js.map +0 -1
  102. package/dst/speechflow-node-x2x-trace.d.ts +0 -11
  103. package/dst/speechflow-node-x2x-trace.js +0 -104
  104. package/dst/speechflow-node-x2x-trace.js.map +0 -1
  105. package/dst/speechflow-node-xio-device.d.ts +0 -13
  106. package/dst/speechflow-node-xio-device.js +0 -230
  107. package/dst/speechflow-node-xio-device.js.map +0 -1
  108. package/dst/speechflow-node-xio-file.d.ts +0 -11
  109. package/dst/speechflow-node-xio-file.js +0 -216
  110. package/dst/speechflow-node-xio-file.js.map +0 -1
  111. package/dst/speechflow-node-xio-mqtt.d.ts +0 -13
  112. package/dst/speechflow-node-xio-mqtt.js +0 -188
  113. package/dst/speechflow-node-xio-mqtt.js.map +0 -1
  114. package/dst/speechflow-node-xio-websocket.d.ts +0 -13
  115. package/dst/speechflow-node-xio-websocket.js +0 -278
  116. package/dst/speechflow-node-xio-websocket.js.map +0 -1
  117. package/dst/speechflow-node.d.ts +0 -63
  118. package/dst/speechflow-node.js +0 -177
  119. package/dst/speechflow-node.js.map +0 -1
  120. package/dst/speechflow-utils.d.ts +0 -74
  121. package/dst/speechflow-utils.js +0 -519
  122. package/dst/speechflow-utils.js.map +0 -1
  123. package/dst/speechflow.js +0 -787
  124. package/dst/speechflow.js.map +0 -1
  125. package/src/speechflow-node-a2a-meter.ts +0 -177
  126. package/src/speechflow-node-t2t-subtitle.ts +0 -149
  127. /package/{etc → speechflow-cli/etc}/biome.jsonc +0 -0
  128. /package/{etc → speechflow-cli/etc}/eslint.mjs +0 -0
  129. /package/{etc → speechflow-cli/etc}/oxlint.jsonc +0 -0
  130. /package/{etc → speechflow-cli/etc}/speechflow.bat +0 -0
  131. /package/{etc → speechflow-cli/etc}/speechflow.sh +0 -0
  132. /package/{etc → speechflow-cli/etc}/speechflow.yaml +0 -0
  133. /package/{etc → speechflow-cli/etc}/tsconfig.json +0 -0
  134. /package/{package.d → speechflow-cli/package.d}/@ericedouard+vad-node-realtime+0.2.0.patch +0 -0
  135. /package/{src → speechflow-cli/src}/lib.d.ts +0 -0
  136. /package/{src → speechflow-cli/src}/speechflow-logo.ai +0 -0
  137. /package/{src → speechflow-cli/src}/speechflow-logo.svg +0 -0
  138. /package/{src → speechflow-cli/src}/speechflow-node-a2a-ffmpeg.ts +0 -0
  139. /package/{src → speechflow-cli/src}/speechflow-node-a2a-gender.ts +0 -0
  140. /package/{src → speechflow-cli/src}/speechflow-node-a2a-mute.ts +0 -0
  141. /package/{src → speechflow-cli/src}/speechflow-node-a2a-wav.ts +0 -0
  142. /package/{src → speechflow-cli/src}/speechflow-node-t2a-kokoro.ts +0 -0
  143. /package/{src → speechflow-cli/src}/speechflow-node-t2t-deepl.ts +0 -0
  144. /package/{src → speechflow-cli/src}/speechflow-node-t2t-format.ts +0 -0
  145. /package/{src → speechflow-cli/src}/speechflow-node-t2t-ollama.ts +0 -0
  146. /package/{src → speechflow-cli/src}/speechflow-node-t2t-openai.ts +0 -0
  147. /package/{src → speechflow-cli/src}/speechflow-node-t2t-sentence.ts +0 -0
  148. /package/{src → speechflow-cli/src}/speechflow-node-t2t-transformers.ts +0 -0
  149. /package/{src → speechflow-cli/src}/speechflow-node-xio-device.ts +0 -0
  150. /package/{src → speechflow-cli/src}/speechflow-node-xio-file.ts +0 -0
  151. /package/{src → speechflow-cli/src}/speechflow-node-xio-mqtt.ts +0 -0
  152. /package/{src → speechflow-cli/src}/speechflow-node-xio-websocket.ts +0 -0
  153. /package/{src → speechflow-cli/src}/speechflow-utils.ts +0 -0
  154. /package/{tsconfig.json → speechflow-cli/tsconfig.json} +0 -0
@@ -1,265 +0,0 @@
1
- "use strict";
2
- /*
3
- ** SpeechFlow - Speech Processing Flow Graph
4
- ** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
5
- ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
6
- */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- var desc = Object.getOwnPropertyDescriptor(m, k);
10
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
- desc = { enumerable: true, get: function() { return m[k]; } };
12
- }
13
- Object.defineProperty(o, k2, desc);
14
- }) : (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- o[k2] = m[k];
17
- }));
18
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
- Object.defineProperty(o, "default", { enumerable: true, value: v });
20
- }) : function(o, v) {
21
- o["default"] = v;
22
- });
23
- var __importStar = (this && this.__importStar) || (function () {
24
- var ownKeys = function(o) {
25
- ownKeys = Object.getOwnPropertyNames || function (o) {
26
- var ar = [];
27
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
- return ar;
29
- };
30
- return ownKeys(o);
31
- };
32
- return function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- })();
40
- var __importDefault = (this && this.__importDefault) || function (mod) {
41
- return (mod && mod.__esModule) ? mod : { "default": mod };
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- /* standard dependencies */
45
- const node_path_1 = __importDefault(require("node:path"));
46
- const node_stream_1 = __importDefault(require("node:stream"));
47
- /* external dependencies */
48
- const Transformers = __importStar(require("@huggingface/transformers"));
49
- /* internal dependencies */
50
- const speechflow_node_1 = __importDefault(require("./speechflow-node"));
51
- /* SpeechFlow node for Transformers text-to-text translation */
52
- class SpeechFlowNodeTransformers extends speechflow_node_1.default {
53
- /* declare official node name */
54
- static name = "transformers";
55
- /* internal state */
56
- translator = null;
57
- generator = null;
58
- /* internal LLM setup */
59
- setup = {
60
- /* SmolLM3: English (EN) to German (DE) translation */
61
- "SmolLM3:en-de": {
62
- systemPrompt: "/no_think\n" +
63
- "You are a translator.\n" +
64
- "Output only the requested text.\n" +
65
- "Do not use markdown.\n" +
66
- "Do not chat.\n" +
67
- "Do not show any explanations.\n" +
68
- "Do not show any introduction.\n" +
69
- "Do not show any preamble.\n" +
70
- "Do not show any prolog.\n" +
71
- "Do not show any epilog.\n" +
72
- "Get to the point.\n" +
73
- "Preserve the original meaning, tone, and nuance.\n" +
74
- "Directly translate text from English (EN) to fluent and natural German (DE) language.\n",
75
- chat: [
76
- { role: "user", content: "I love my wife." },
77
- { role: "assistant", content: "Ich liebe meine Frau." },
78
- { role: "user", content: "The weather is wonderful." },
79
- { role: "assistant", content: "Das Wetter ist wunderschön." },
80
- { role: "user", content: "The live is awesome." },
81
- { role: "assistant", content: "Das Leben ist einfach großartig." }
82
- ]
83
- },
84
- /* SmolLM3: German (DE) to English (EN) translation */
85
- "SmolLM3:de-en": {
86
- systemPrompt: "/no_think\n" +
87
- "You are a translator.\n" +
88
- "Output only the requested text.\n" +
89
- "Do not use markdown.\n" +
90
- "Do not chat.\n" +
91
- "Do not show any explanations.\n" +
92
- "Do not show any introduction.\n" +
93
- "Do not show any preamble. \n" +
94
- "Do not show any prolog. \n" +
95
- "Do not show any epilog. \n" +
96
- "Get to the point.\n" +
97
- "Preserve the original meaning, tone, and nuance.\n" +
98
- "Directly translate text from German (DE) to fluent and natural English (EN) language.\n",
99
- chat: [
100
- { role: "user", content: "Ich liebe meine Frau." },
101
- { role: "assistant", content: "I love my wife." },
102
- { role: "user", content: "Das Wetter ist wunderschön." },
103
- { role: "assistant", content: "The weather is wonderful." },
104
- { role: "user", content: "Das Leben ist einfach großartig." },
105
- { role: "assistant", content: "The live is awesome." }
106
- ]
107
- }
108
- };
109
- /* construct node */
110
- constructor(id, cfg, opts, args) {
111
- super(id, cfg, opts, args);
112
- /* declare node configuration parameters */
113
- this.configure({
114
- src: { type: "string", pos: 0, val: "de", match: /^(?:de|en)$/ },
115
- dst: { type: "string", pos: 1, val: "en", match: /^(?:de|en)$/ },
116
- model: { type: "string", val: "OPUS", match: /^(?:OPUS|SmolLM3)$/ }
117
- });
118
- /* sanity check parameters */
119
- if (this.params.src === this.params.dst)
120
- throw new Error("source and destination languages cannot be the same");
121
- /* declare node input/output format */
122
- this.input = "text";
123
- this.output = "text";
124
- }
125
- /* open node */
126
- async open() {
127
- let model = "";
128
- /* track download progress when instantiating Transformers engine and model */
129
- const progressState = new Map();
130
- const progressCallback = (progress) => {
131
- let artifact = model;
132
- if (typeof progress.file === "string")
133
- artifact += `:${progress.file}`;
134
- let percent = 0;
135
- if (typeof progress.loaded === "number" && typeof progress.total === "number")
136
- percent = progress.loaded / progress.total * 100;
137
- else if (typeof progress.progress === "number")
138
- percent = progress.progress;
139
- if (percent > 0)
140
- progressState.set(artifact, percent);
141
- };
142
- const interval = setInterval(() => {
143
- for (const [artifact, percent] of progressState) {
144
- this.log("info", `downloaded ${percent.toFixed(2)}% of artifact "${artifact}"`);
145
- if (percent >= 1.0)
146
- progressState.delete(artifact);
147
- }
148
- }, 1000);
149
- /* instantiate Transformers engine and model */
150
- if (this.params.model === "OPUS") {
151
- model = `onnx-community/opus-mt-${this.params.src}-${this.params.dst}`;
152
- const pipeline = Transformers.pipeline("translation", model, {
153
- cache_dir: node_path_1.default.join(this.config.cacheDir, "transformers"),
154
- dtype: "q4",
155
- device: "auto",
156
- progress_callback: progressCallback
157
- });
158
- this.translator = await pipeline;
159
- if (this.translator === null)
160
- throw new Error("failed to instantiate translator pipeline");
161
- }
162
- else if (this.params.model === "SmolLM3") {
163
- model = "HuggingFaceTB/SmolLM3-3B-ONNX";
164
- const pipeline = Transformers.pipeline("text-generation", model, {
165
- cache_dir: node_path_1.default.join(this.config.cacheDir, "transformers"),
166
- dtype: "q4",
167
- device: "auto",
168
- progress_callback: progressCallback
169
- });
170
- this.generator = await pipeline;
171
- if (this.generator === null)
172
- throw new Error("failed to instantiate generator pipeline");
173
- }
174
- else
175
- throw new Error("invalid model");
176
- /* clear progress interval again */
177
- clearInterval(interval);
178
- /* provide text-to-text translation */
179
- const translate = async (text) => {
180
- if (this.params.model === "OPUS") {
181
- const result = await this.translator(text);
182
- return Array.isArray(result) ?
183
- result[0].translation_text :
184
- result.translation_text;
185
- }
186
- else if (this.params.model === "SmolLM3") {
187
- const key = `SmolLM3:${this.params.src}-${this.params.dst}`;
188
- const cfg = this.setup[key];
189
- const messages = [
190
- { role: "system", content: cfg.systemPrompt },
191
- ...cfg.chat,
192
- { role: "user", content: text }
193
- ];
194
- const result = await this.generator(messages, {
195
- max_new_tokens: 100,
196
- temperature: 0.6,
197
- top_p: 0.95,
198
- streamer: new Transformers.TextStreamer(this.generator.tokenizer, {
199
- skip_prompt: true,
200
- skip_special_tokens: true
201
- })
202
- });
203
- const generatedText = Array.isArray(result) ?
204
- result[0].generated_text :
205
- result.generated_text;
206
- const response = typeof generatedText === "string" ?
207
- generatedText :
208
- generatedText.at(-1).content;
209
- return response;
210
- }
211
- else
212
- throw new Error("invalid model");
213
- };
214
- /* establish a duplex stream and connect it to Transformers */
215
- this.stream = new node_stream_1.default.Transform({
216
- readableObjectMode: true,
217
- writableObjectMode: true,
218
- decodeStrings: false,
219
- highWaterMark: 1,
220
- transform(chunk, encoding, callback) {
221
- if (Buffer.isBuffer(chunk.payload))
222
- callback(new Error("invalid chunk payload type"));
223
- else {
224
- if (chunk.payload === "") {
225
- this.push(chunk);
226
- callback();
227
- }
228
- else {
229
- translate(chunk.payload).then((payload) => {
230
- chunk = chunk.clone();
231
- chunk.payload = payload;
232
- this.push(chunk);
233
- callback();
234
- }).catch((err) => {
235
- callback(err);
236
- });
237
- }
238
- }
239
- },
240
- final(callback) {
241
- this.push(null);
242
- callback();
243
- }
244
- });
245
- }
246
- /* close node */
247
- async close() {
248
- /* close stream */
249
- if (this.stream !== null) {
250
- this.stream.destroy();
251
- this.stream = null;
252
- }
253
- /* shutdown Transformers */
254
- if (this.translator !== null) {
255
- this.translator.dispose();
256
- this.translator = null;
257
- }
258
- if (this.generator !== null) {
259
- this.generator.dispose();
260
- this.generator = null;
261
- }
262
- }
263
- }
264
- exports.default = SpeechFlowNodeTransformers;
265
- //# sourceMappingURL=speechflow-node-t2t-transformers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"speechflow-node-t2t-transformers.js","sourceRoot":"","sources":["../src/speechflow-node-t2t-transformers.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,0DAA8B;AAC9B,8DAAgC;AAEhC,6BAA6B;AAC7B,wEAAyD;AAEzD,6BAA6B;AAC7B,wEAAmE;AAMnE,iEAAiE;AACjE,MAAqB,0BAA2B,SAAQ,yBAAc;IAClE,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,cAAc,CAAA;IAEnC,sBAAsB;IACd,UAAU,GAA+C,IAAI,CAAA;IAC7D,SAAS,GAAgD,IAAI,CAAA;IAErE,0BAA0B;IAClB,KAAK,GAAW;QACpB,wDAAwD;QACxD,eAAe,EAAE;YACb,YAAY,EACR,aAAa;gBACb,yBAAyB;gBACzB,mCAAmC;gBACnC,wBAAwB;gBACxB,gBAAgB;gBAChB,iCAAiC;gBACjC,iCAAiC;gBACjC,6BAA6B;gBAC7B,2BAA2B;gBAC3B,2BAA2B;gBAC3B,qBAAqB;gBACrB,oDAAoD;gBACpD,yFAAyF;YAC7F,IAAI,EAAE;gBACF,EAAE,IAAI,EAAE,MAAM,EAAI,OAAO,EAAE,iBAAiB,EAAE;gBAC9C,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE;gBACvD,EAAE,IAAI,EAAE,MAAM,EAA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BACI,CAAC;wBACF,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;4BACtC,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;4BACrB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAA;4BACvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;4BAChB,QAAQ,EAAE,CAAA;wBACd,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;4BACb,QAAQ,CAAC,GAAG,CAAC,CAAA;wBACjB,CAAC,CAAC,CAAA;oBACN,CAAC;gBACL,CAAC;YACL,CAAC;YACD,KAAK,CAAE,QAAQ;gBACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACf,QAAQ,EAAE,CAAA;YACd,CAAC;SACJ,CAAC,CAAA;IACN,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,KAAK;QACP,oBAAoB;QACpB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;YACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QACtB,CAAC;QAED,6BAA6B;QAC7B,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC3B,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;YACzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;QAC1B,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;YAC1B,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAA;YACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QACzB,CAAC;IACL,CAAC;;AAnOL,6CAoOC"}
@@ -1,11 +0,0 @@
1
- import SpeechFlowNode from "./speechflow-node";
2
- export default class SpeechFlowNodeFilter extends SpeechFlowNode {
3
- static name: string;
4
- constructor(id: string, cfg: {
5
- [id: string]: any;
6
- }, opts: {
7
- [id: string]: any;
8
- }, args: any[]);
9
- open(): Promise<void>;
10
- close(): Promise<void>;
11
- }
@@ -1,117 +0,0 @@
1
- "use strict";
2
- /*
3
- ** SpeechFlow - Speech Processing Flow Graph
4
- ** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
5
- ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
6
- */
7
- var __importDefault = (this && this.__importDefault) || function (mod) {
8
- return (mod && mod.__esModule) ? mod : { "default": mod };
9
- };
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- /* standard dependencies */
12
- const node_stream_1 = __importDefault(require("node:stream"));
13
- /* internal dependencies */
14
- const speechflow_node_1 = __importDefault(require("./speechflow-node"));
15
- /* SpeechFlow node for data flow filtering (based on meta information) */
16
- class SpeechFlowNodeFilter extends speechflow_node_1.default {
17
- /* declare official node name */
18
- static name = "filter";
19
- /* construct node */
20
- constructor(id, cfg, opts, args) {
21
- super(id, cfg, opts, args);
22
- /* declare node configuration parameters */
23
- this.configure({
24
- type: { type: "string", pos: 0, val: "audio", match: /^(?:audio|text)$/ },
25
- name: { type: "string", pos: 1, val: "filter", match: /^.+?$/ },
26
- var: { type: "string", pos: 2, val: "", match: /^(?:meta:.+|payload:(?:length|text)|time:(?:start|end))$/ },
27
- op: { type: "string", pos: 3, val: "==", match: /^(?:<|<=|==|!=|~~|!~|>=|>)$/ },
28
- val: { type: "string", pos: 4, val: "", match: /^.*$/ }
29
- });
30
- /* declare node input/output format */
31
- this.input = this.params.type;
32
- this.output = this.params.type;
33
- }
34
- /* open node */
35
- async open() {
36
- /* helper function for comparing two values */
37
- const comparison = (val1, op, val2) => {
38
- if (op === "==" || op === "!=") {
39
- /* equal comparison */
40
- const str1 = (typeof val1 === "string" ? val1 : val1.toString());
41
- const str2 = (typeof val2 === "string" ? val2 : val2.toString());
42
- return (op === "==" ? (str1 === str2) : (str1 !== str2));
43
- }
44
- else if (op === "~~" || op === "!~") {
45
- /* regular expression comparison */
46
- const str = (typeof val1 === "string" ? val1 : val1.toString());
47
- const regexp = (val2 instanceof RegExp ?
48
- val2 :
49
- typeof val2 === "string" ?
50
- new RegExp(val2) :
51
- new RegExp(val2.toString()));
52
- return (op === "~~" ? regexp.test(str) : !regexp.test(str));
53
- }
54
- else {
55
- /* non-equal comparison */
56
- const coerceNum = (val) => {
57
- return typeof val === "number" ? val : (typeof val === "string" && val.match(/^[\d+-]+$/) ? parseInt(val) : (typeof val === "string" && val.match(/^[\d.+-]+$/) ?
58
- parseFloat(val) :
59
- Number(val)));
60
- };
61
- const num1 = coerceNum(val1);
62
- const num2 = coerceNum(val2);
63
- return (op === "<" ?
64
- (num1 < num2) :
65
- op === "<=" ?
66
- (num1 <= num2) :
67
- op === ">=" ?
68
- (num1 >= num2) :
69
- op === ">" ?
70
- (num1 > num2) :
71
- false);
72
- }
73
- };
74
- /* provide Transform stream */
75
- const self = this;
76
- this.stream = new node_stream_1.default.Transform({
77
- writableObjectMode: true,
78
- readableObjectMode: true,
79
- decodeStrings: false,
80
- highWaterMark: 1,
81
- transform(chunk, encoding, callback) {
82
- let val1;
83
- const val2 = self.params.val;
84
- const m = self.params.var.match(/^meta:(.+)$/);
85
- if (m !== null)
86
- val1 = chunk.meta.get(m[1]) ?? "";
87
- else if (self.params.var === "payload:length")
88
- val1 = chunk.payload.length;
89
- else if (self.params.var === "payload:text")
90
- val1 = (self.params.type === "text" ? chunk.payload : "");
91
- else if (self.params.var === "time:start")
92
- val1 = chunk.timestampStart.toMillis();
93
- else if (self.params.var === "time:end")
94
- val1 = chunk.timestampEnd.toMillis();
95
- if (comparison(val1, self.params.op, val2)) {
96
- self.log("info", `[${self.params.name}]: passing through ${chunk.type} chunk`);
97
- this.push(chunk);
98
- }
99
- callback();
100
- },
101
- final(callback) {
102
- this.push(null);
103
- callback();
104
- }
105
- });
106
- }
107
- /* close node */
108
- async close() {
109
- /* close stream */
110
- if (this.stream !== null) {
111
- this.stream.destroy();
112
- this.stream = null;
113
- }
114
- }
115
- }
116
- exports.default = SpeechFlowNodeFilter;
117
- //# sourceMappingURL=speechflow-node-x2x-filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"speechflow-node-x2x-filter.js","sourceRoot":"","sources":["../src/speechflow-node-x2x-filter.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;AAEF,6BAA6B;AAC7B,8DAAgC;AAEhC,6BAA6B;AAC7B,wEAAmE;AAEnE,2EAA2E;AAC3E,MAAqB,oBAAqB,SAAQ,yBAAc;IAC5D,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;IAE7B,sBAAsB;IACtB,YAAa,EAAU,EAAE,GAA4B,EAAE,IAA6B,EAAE,IAAW;QAC7F,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QAE1B,6CAA6C;QAC7C,IAAI,CAAC,SAAS,CAAC;YACX,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAG,KAAK,EAAE,kBAAkB,EAAE;YAC1E,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;YAC/D,GAAG,EAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAQ,KAAK,EAAE,0DAA0D,EAAE;YAClH,EAAE,EAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAM,KAAK,EAAE,6BAA6B,EAAE;YACrF,GAAG,EAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAQ,KAAK,EAAE,MAAM,EAAE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AI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,sBAAsB,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAA;oBAC9E,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACpB,CAAC;gBACD,QAAQ,EAAE,CAAA;YACd,CAAC;YACD,KAAK,CAAE,QAAQ;gBACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACf,QAAQ,EAAE,CAAA;YACd,CAAC;SACJ,CAAC,CAAA;IACN,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,KAAK;QACP,oBAAoB;QACpB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;YACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QACtB,CAAC;IACL,CAAC;;AA/GL,uCAgHC"}
@@ -1,11 +0,0 @@
1
- import SpeechFlowNode from "./speechflow-node";
2
- export default class SpeechFlowNodeTrace extends SpeechFlowNode {
3
- static name: string;
4
- constructor(id: string, cfg: {
5
- [id: string]: any;
6
- }, opts: {
7
- [id: string]: any;
8
- }, args: any[]);
9
- open(): Promise<void>;
10
- close(): Promise<void>;
11
- }
@@ -1,104 +0,0 @@
1
- "use strict";
2
- /*
3
- ** SpeechFlow - Speech Processing Flow Graph
4
- ** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
5
- ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
6
- */
7
- var __importDefault = (this && this.__importDefault) || function (mod) {
8
- return (mod && mod.__esModule) ? mod : { "default": mod };
9
- };
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- /* standard dependencies */
12
- const node_stream_1 = __importDefault(require("node:stream"));
13
- /* internal dependencies */
14
- const speechflow_node_1 = __importDefault(require("./speechflow-node"));
15
- /* SpeechFlow node for data flow tracing */
16
- class SpeechFlowNodeTrace extends speechflow_node_1.default {
17
- /* declare official node name */
18
- static name = "trace";
19
- /* construct node */
20
- constructor(id, cfg, opts, args) {
21
- super(id, cfg, opts, args);
22
- /* declare node configuration parameters */
23
- this.configure({
24
- type: { type: "string", pos: 0, val: "audio", match: /^(?:audio|text)$/ },
25
- name: { type: "string", pos: 1, val: "trace" }
26
- });
27
- /* declare node input/output format */
28
- this.input = this.params.type;
29
- this.output = this.params.type;
30
- }
31
- /* open node */
32
- async open() {
33
- /* wrapper for local logging */
34
- const log = (level, msg) => {
35
- if (this.params.name !== undefined)
36
- this.log(level, `[${this.params.name}]: ${msg}`);
37
- else
38
- this.log(level, msg);
39
- };
40
- /* provide Transform stream */
41
- const type = this.params.type;
42
- this.stream = new node_stream_1.default.Transform({
43
- writableObjectMode: true,
44
- readableObjectMode: true,
45
- decodeStrings: false,
46
- highWaterMark: 1,
47
- transform(chunk, encoding, callback) {
48
- let error;
49
- const fmtTime = (t) => t.toFormat("hh:mm:ss.SSS");
50
- const fmtMeta = (meta) => {
51
- if (meta.size === 0)
52
- return "none";
53
- else
54
- return `{ ${Array.from(meta.entries())
55
- .map(([k, v]) => `${k}: ${JSON.stringify(v)}`)
56
- .join(", ")} }`;
57
- };
58
- if (Buffer.isBuffer(chunk.payload)) {
59
- if (type === "audio")
60
- log("debug", `chunk: type=${chunk.type} ` +
61
- `kind=${chunk.kind} ` +
62
- `start=${fmtTime(chunk.timestampStart)} ` +
63
- `end=${fmtTime(chunk.timestampEnd)} ` +
64
- `payload-type=Buffer payload-length=${chunk.payload.byteLength} ` +
65
- `meta=${fmtMeta(chunk.meta)}`);
66
- else
67
- error = new Error(`${type} chunk: seen Buffer instead of String chunk type`);
68
- }
69
- else {
70
- if (type === "text")
71
- log("debug", `chunk: type=${chunk.type} ` +
72
- `kind=${chunk.kind} ` +
73
- `start=${fmtTime(chunk.timestampStart)} ` +
74
- `end=${fmtTime(chunk.timestampEnd)} ` +
75
- `payload-type=String payload-length=${chunk.payload.length} ` +
76
- `payload-content="${chunk.payload.toString()}" ` +
77
- `meta=${fmtMeta(chunk.meta)}`);
78
- else
79
- error = new Error(`${type} chunk: seen String instead of Buffer chunk type`);
80
- }
81
- if (error !== undefined)
82
- callback(error);
83
- else {
84
- this.push(chunk, encoding);
85
- callback();
86
- }
87
- },
88
- final(callback) {
89
- this.push(null);
90
- callback();
91
- }
92
- });
93
- }
94
- /* close node */
95
- async close() {
96
- /* close stream */
97
- if (this.stream !== null) {
98
- this.stream.destroy();
99
- this.stream = null;
100
- }
101
- }
102
- }
103
- exports.default = SpeechFlowNodeTrace;
104
- //# sourceMappingURL=speechflow-node-x2x-trace.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"speechflow-node-x2x-trace.js","sourceRoot":"","sources":["../src/speechflow-node-x2x-trace.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;AAEF,6BAA6B;AAC7B,8DAAgC;AAKhC,6BAA6B;AAC7B,wEAAmE;AAEnE,6CAA6C;AAC7C,MAAqB,mBAAoB,SAAQ,yBAAc;IAC3D,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,OAAO,CAAA;IAE5B,sBAAsB;IACtB,YAAa,EAAU,EAAE,GAA4B,EAAE,IAA6B,EAAE,IAAW;QAC7F,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QAE1B,6CAA6C;QAC7C,IAAI,CAAC,SAAS,CAAC;YACX,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE;YACzE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE;SACjD,CAAC,CAAA;QAEF,wCAAwC;QACxC,IAAI,CAAC,KAAK,GAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;QAC9B,IAAI,CA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ACD,KAAK,CAAE,QAAQ;gBACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACf,QAAQ,EAAE,CAAA;YACd,CAAC;SACJ,CAAC,CAAA;IACN,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,KAAK;QACP,oBAAoB;QACpB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;YACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QACtB,CAAC;IACL,CAAC;;AA5FL,sCA6FC"}
@@ -1,13 +0,0 @@
1
- import SpeechFlowNode from "./speechflow-node";
2
- export default class SpeechFlowNodeDevice extends SpeechFlowNode {
3
- static name: string;
4
- private io;
5
- constructor(id: string, cfg: {
6
- [id: string]: any;
7
- }, opts: {
8
- [id: string]: any;
9
- }, args: any[]);
10
- private audioDeviceFromURL;
11
- open(): Promise<void>;
12
- close(): Promise<void>;
13
- }