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.
- package/CHANGELOG.md +17 -0
- package/etc/stx.conf +54 -58
- package/package.json +25 -106
- package/speechflow-cli/etc/stx.conf +77 -0
- package/speechflow-cli/package.json +116 -0
- package/speechflow-cli/src/speechflow-node-a2a-meter.ts +217 -0
- package/{src → speechflow-cli/src}/speechflow-node-a2a-vad.ts +14 -21
- package/{src → speechflow-cli/src}/speechflow-node-a2t-deepgram.ts +21 -38
- package/{src → speechflow-cli/src}/speechflow-node-t2a-elevenlabs.ts +10 -16
- package/speechflow-cli/src/speechflow-node-t2t-subtitle.ts +276 -0
- package/{src → speechflow-cli/src}/speechflow-node-x2x-filter.ts +5 -1
- package/{src → speechflow-cli/src}/speechflow-node-x2x-trace.ts +15 -7
- package/{src → speechflow-cli/src}/speechflow-node.ts +7 -0
- package/{src → speechflow-cli/src}/speechflow.ts +81 -25
- package/speechflow-ui-db/etc/eslint.mjs +106 -0
- package/speechflow-ui-db/etc/htmllint.json +55 -0
- package/speechflow-ui-db/etc/stx.conf +79 -0
- package/speechflow-ui-db/etc/stylelint.js +46 -0
- package/speechflow-ui-db/etc/stylelint.yaml +33 -0
- package/speechflow-ui-db/etc/tsc-client.json +30 -0
- package/speechflow-ui-db/etc/tsc.node.json +9 -0
- package/speechflow-ui-db/etc/vite-client.mts +63 -0
- package/speechflow-ui-db/package.d/htmllint-cli+0.0.7.patch +20 -0
- package/speechflow-ui-db/package.json +75 -0
- package/speechflow-ui-db/src/app-icon.ai +1989 -4
- package/speechflow-ui-db/src/app-icon.svg +26 -0
- package/speechflow-ui-db/src/app.styl +64 -0
- package/speechflow-ui-db/src/app.vue +221 -0
- package/speechflow-ui-db/src/index.html +23 -0
- package/speechflow-ui-db/src/index.ts +26 -0
- package/{dst/speechflow.d.ts → speechflow-ui-db/src/lib.d.ts} +5 -3
- package/speechflow-ui-db/src/tsconfig.json +3 -0
- package/speechflow-ui-st/etc/eslint.mjs +106 -0
- package/speechflow-ui-st/etc/htmllint.json +55 -0
- package/speechflow-ui-st/etc/stx.conf +79 -0
- package/speechflow-ui-st/etc/stylelint.js +46 -0
- package/speechflow-ui-st/etc/stylelint.yaml +33 -0
- package/speechflow-ui-st/etc/tsc-client.json +30 -0
- package/speechflow-ui-st/etc/tsc.node.json +9 -0
- package/speechflow-ui-st/etc/vite-client.mts +63 -0
- package/speechflow-ui-st/package.d/htmllint-cli+0.0.7.patch +20 -0
- package/speechflow-ui-st/package.json +79 -0
- package/speechflow-ui-st/src/app-icon.ai +1989 -4
- package/speechflow-ui-st/src/app-icon.svg +26 -0
- package/speechflow-ui-st/src/app.styl +64 -0
- package/speechflow-ui-st/src/app.vue +142 -0
- package/speechflow-ui-st/src/index.html +23 -0
- package/speechflow-ui-st/src/index.ts +26 -0
- package/speechflow-ui-st/src/lib.d.ts +9 -0
- package/speechflow-ui-st/src/tsconfig.json +3 -0
- package/dst/speechflow-node-a2a-ffmpeg.d.ts +0 -13
- package/dst/speechflow-node-a2a-ffmpeg.js +0 -153
- package/dst/speechflow-node-a2a-ffmpeg.js.map +0 -1
- package/dst/speechflow-node-a2a-gender.d.ts +0 -20
- package/dst/speechflow-node-a2a-gender.js +0 -349
- package/dst/speechflow-node-a2a-gender.js.map +0 -1
- package/dst/speechflow-node-a2a-meter.d.ts +0 -14
- package/dst/speechflow-node-a2a-meter.js +0 -196
- package/dst/speechflow-node-a2a-meter.js.map +0 -1
- package/dst/speechflow-node-a2a-mute.d.ts +0 -17
- package/dst/speechflow-node-a2a-mute.js +0 -117
- package/dst/speechflow-node-a2a-mute.js.map +0 -1
- package/dst/speechflow-node-a2a-vad.d.ts +0 -19
- package/dst/speechflow-node-a2a-vad.js +0 -383
- package/dst/speechflow-node-a2a-vad.js.map +0 -1
- package/dst/speechflow-node-a2a-wav.d.ts +0 -11
- package/dst/speechflow-node-a2a-wav.js +0 -211
- package/dst/speechflow-node-a2a-wav.js.map +0 -1
- package/dst/speechflow-node-a2t-deepgram.d.ts +0 -19
- package/dst/speechflow-node-a2t-deepgram.js +0 -345
- package/dst/speechflow-node-a2t-deepgram.js.map +0 -1
- package/dst/speechflow-node-t2a-elevenlabs.d.ts +0 -18
- package/dst/speechflow-node-t2a-elevenlabs.js +0 -244
- package/dst/speechflow-node-t2a-elevenlabs.js.map +0 -1
- package/dst/speechflow-node-t2a-kokoro.d.ts +0 -14
- package/dst/speechflow-node-t2a-kokoro.js +0 -155
- package/dst/speechflow-node-t2a-kokoro.js.map +0 -1
- package/dst/speechflow-node-t2t-deepl.d.ts +0 -15
- package/dst/speechflow-node-t2t-deepl.js +0 -146
- package/dst/speechflow-node-t2t-deepl.js.map +0 -1
- package/dst/speechflow-node-t2t-format.d.ts +0 -11
- package/dst/speechflow-node-t2t-format.js +0 -82
- package/dst/speechflow-node-t2t-format.js.map +0 -1
- package/dst/speechflow-node-t2t-ollama.d.ts +0 -13
- package/dst/speechflow-node-t2t-ollama.js +0 -247
- package/dst/speechflow-node-t2t-ollama.js.map +0 -1
- package/dst/speechflow-node-t2t-openai.d.ts +0 -13
- package/dst/speechflow-node-t2t-openai.js +0 -227
- package/dst/speechflow-node-t2t-openai.js.map +0 -1
- package/dst/speechflow-node-t2t-sentence.d.ts +0 -17
- package/dst/speechflow-node-t2t-sentence.js +0 -250
- package/dst/speechflow-node-t2t-sentence.js.map +0 -1
- package/dst/speechflow-node-t2t-subtitle.d.ts +0 -12
- package/dst/speechflow-node-t2t-subtitle.js +0 -166
- package/dst/speechflow-node-t2t-subtitle.js.map +0 -1
- package/dst/speechflow-node-t2t-transformers.d.ts +0 -14
- package/dst/speechflow-node-t2t-transformers.js +0 -265
- package/dst/speechflow-node-t2t-transformers.js.map +0 -1
- package/dst/speechflow-node-x2x-filter.d.ts +0 -11
- package/dst/speechflow-node-x2x-filter.js +0 -117
- package/dst/speechflow-node-x2x-filter.js.map +0 -1
- package/dst/speechflow-node-x2x-trace.d.ts +0 -11
- package/dst/speechflow-node-x2x-trace.js +0 -104
- package/dst/speechflow-node-x2x-trace.js.map +0 -1
- package/dst/speechflow-node-xio-device.d.ts +0 -13
- package/dst/speechflow-node-xio-device.js +0 -230
- package/dst/speechflow-node-xio-device.js.map +0 -1
- package/dst/speechflow-node-xio-file.d.ts +0 -11
- package/dst/speechflow-node-xio-file.js +0 -216
- package/dst/speechflow-node-xio-file.js.map +0 -1
- package/dst/speechflow-node-xio-mqtt.d.ts +0 -13
- package/dst/speechflow-node-xio-mqtt.js +0 -188
- package/dst/speechflow-node-xio-mqtt.js.map +0 -1
- package/dst/speechflow-node-xio-websocket.d.ts +0 -13
- package/dst/speechflow-node-xio-websocket.js +0 -278
- package/dst/speechflow-node-xio-websocket.js.map +0 -1
- package/dst/speechflow-node.d.ts +0 -63
- package/dst/speechflow-node.js +0 -177
- package/dst/speechflow-node.js.map +0 -1
- package/dst/speechflow-utils.d.ts +0 -74
- package/dst/speechflow-utils.js +0 -519
- package/dst/speechflow-utils.js.map +0 -1
- package/dst/speechflow.js +0 -787
- package/dst/speechflow.js.map +0 -1
- package/src/speechflow-node-a2a-meter.ts +0 -177
- package/src/speechflow-node-t2t-subtitle.ts +0 -149
- /package/{etc → speechflow-cli/etc}/biome.jsonc +0 -0
- /package/{etc → speechflow-cli/etc}/eslint.mjs +0 -0
- /package/{etc → speechflow-cli/etc}/oxlint.jsonc +0 -0
- /package/{etc → speechflow-cli/etc}/speechflow.bat +0 -0
- /package/{etc → speechflow-cli/etc}/speechflow.sh +0 -0
- /package/{etc → speechflow-cli/etc}/speechflow.yaml +0 -0
- /package/{etc → speechflow-cli/etc}/tsconfig.json +0 -0
- /package/{package.d → speechflow-cli/package.d}/@ericedouard+vad-node-realtime+0.2.0.patch +0 -0
- /package/{src → speechflow-cli/src}/lib.d.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-logo.ai +0 -0
- /package/{src → speechflow-cli/src}/speechflow-logo.svg +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-a2a-ffmpeg.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-a2a-gender.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-a2a-mute.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-a2a-wav.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2a-kokoro.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-deepl.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-format.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-ollama.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-openai.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-sentence.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-transformers.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-xio-device.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-xio-file.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-xio-mqtt.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-xio-websocket.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-utils.ts +0 -0
- /package/{tsconfig.json → speechflow-cli/tsconfig.json} +0 -0
|
@@ -1,188 +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_stream_1 = __importDefault(require("node:stream"));
|
|
46
|
-
/* external dependencies */
|
|
47
|
-
const mqtt_1 = __importDefault(require("mqtt"));
|
|
48
|
-
const pure_uuid_1 = __importDefault(require("pure-uuid"));
|
|
49
|
-
/* internal dependencies */
|
|
50
|
-
const speechflow_node_1 = __importDefault(require("./speechflow-node"));
|
|
51
|
-
const utils = __importStar(require("./speechflow-utils"));
|
|
52
|
-
/* SpeechFlow node for MQTT networking */
|
|
53
|
-
class SpeechFlowNodeMQTT extends speechflow_node_1.default {
|
|
54
|
-
/* declare official node name */
|
|
55
|
-
static name = "mqtt";
|
|
56
|
-
/* internal state */
|
|
57
|
-
broker = null;
|
|
58
|
-
clientId = (new pure_uuid_1.default(1)).format();
|
|
59
|
-
/* construct node */
|
|
60
|
-
constructor(id, cfg, opts, args) {
|
|
61
|
-
super(id, cfg, opts, args);
|
|
62
|
-
/* declare node configuration parameters */
|
|
63
|
-
this.configure({
|
|
64
|
-
url: { type: "string", pos: 0, val: "", match: /^(?:|(?:ws|mqtt):\/\/(.+?):(\d+)(?:\/.*)?)$/ },
|
|
65
|
-
username: { type: "string", pos: 1, val: "", match: /^.+$/ },
|
|
66
|
-
password: { type: "string", pos: 2, val: "", match: /^.+$/ },
|
|
67
|
-
topicRead: { type: "string", pos: 3, val: "", match: /^.+$/ },
|
|
68
|
-
topicWrite: { type: "string", pos: 4, val: "", match: /^.+$/ },
|
|
69
|
-
mode: { type: "string", pos: 5, val: "w", match: /^(?:r|w|rw)$/ },
|
|
70
|
-
type: { type: "string", pos: 6, val: "text", match: /^(?:audio|text)$/ }
|
|
71
|
-
});
|
|
72
|
-
/* declare node input/output format */
|
|
73
|
-
if (this.params.mode === "rw") {
|
|
74
|
-
this.input = this.params.type;
|
|
75
|
-
this.output = this.params.type;
|
|
76
|
-
}
|
|
77
|
-
else if (this.params.mode === "r") {
|
|
78
|
-
this.input = "none";
|
|
79
|
-
this.output = this.params.type;
|
|
80
|
-
}
|
|
81
|
-
else if (this.params.mode === "w") {
|
|
82
|
-
this.input = this.params.type;
|
|
83
|
-
this.output = "none";
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/* open node */
|
|
87
|
-
async open() {
|
|
88
|
-
/* logical parameter sanity check */
|
|
89
|
-
if (this.params.url === "")
|
|
90
|
-
throw new Error("required parameter \"url\" has to be given");
|
|
91
|
-
if ((this.params.mode === "w" || this.params.mode === "rw") && this.params.topicWrite === "")
|
|
92
|
-
throw new Error("writing to MQTT requires a topicWrite parameter");
|
|
93
|
-
if ((this.params.mode === "r" || this.params.mode === "rw") && this.params.topicRead === "")
|
|
94
|
-
throw new Error("reading from MQTT requires a topicRead parameter");
|
|
95
|
-
/* connect remotely to a MQTT broker */
|
|
96
|
-
this.broker = mqtt_1.default.connect(this.params.url, {
|
|
97
|
-
protocolId: "MQTT",
|
|
98
|
-
protocolVersion: 5,
|
|
99
|
-
username: this.params.username,
|
|
100
|
-
password: this.params.password,
|
|
101
|
-
clientId: this.clientId,
|
|
102
|
-
clean: true,
|
|
103
|
-
resubscribe: true,
|
|
104
|
-
keepalive: 60, /* 60s */
|
|
105
|
-
reconnectPeriod: 2 * 1000, /* 2s */
|
|
106
|
-
connectTimeout: 30 * 1000 /* 30s */
|
|
107
|
-
});
|
|
108
|
-
this.broker.on("error", (error) => {
|
|
109
|
-
this.log("error", `error on MQTT ${this.params.url}: ${error.message}`);
|
|
110
|
-
});
|
|
111
|
-
this.broker.on("connect", (packet) => {
|
|
112
|
-
this.log("info", `connection opened to MQTT ${this.params.url}`);
|
|
113
|
-
if (this.params.mode !== "w" && !packet.sessionPresent)
|
|
114
|
-
this.broker.subscribe([this.params.topicRead], (err) => {
|
|
115
|
-
if (err)
|
|
116
|
-
this.log("error", `failed to subscribe to MQTT topic "${this.params.topicRead}": ${err.message}`);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
this.broker.on("reconnect", () => {
|
|
120
|
-
this.log("info", `connection re-opened to MQTT ${this.params.url}`);
|
|
121
|
-
});
|
|
122
|
-
this.broker.on("disconnect", (packet) => {
|
|
123
|
-
this.log("info", `connection closed to MQTT ${this.params.url}`);
|
|
124
|
-
});
|
|
125
|
-
const chunkQueue = new utils.SingleQueue();
|
|
126
|
-
this.broker.on("message", (topic, payload, packet) => {
|
|
127
|
-
if (topic !== this.params.topicRead)
|
|
128
|
-
return;
|
|
129
|
-
try {
|
|
130
|
-
const chunk = utils.streamChunkDecode(payload);
|
|
131
|
-
chunkQueue.write(chunk);
|
|
132
|
-
}
|
|
133
|
-
catch (_err) {
|
|
134
|
-
this.log("warning", `received invalid CBOR chunk from MQTT ${this.params.url}`);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
const broker = this.broker;
|
|
138
|
-
const topicWrite = this.params.topicWrite;
|
|
139
|
-
const type = this.params.type;
|
|
140
|
-
const mode = this.params.mode;
|
|
141
|
-
this.stream = new node_stream_1.default.Duplex({
|
|
142
|
-
writableObjectMode: true,
|
|
143
|
-
readableObjectMode: true,
|
|
144
|
-
decodeStrings: false,
|
|
145
|
-
highWaterMark: 1,
|
|
146
|
-
write(chunk, encoding, callback) {
|
|
147
|
-
if (mode === "r")
|
|
148
|
-
callback(new Error("write operation on read-only node"));
|
|
149
|
-
else if (chunk.type !== type)
|
|
150
|
-
callback(new Error(`written chunk is not of ${type} type`));
|
|
151
|
-
else if (!broker.connected)
|
|
152
|
-
callback(new Error("still no MQTT connection available"));
|
|
153
|
-
else {
|
|
154
|
-
const data = Buffer.from(utils.streamChunkEncode(chunk));
|
|
155
|
-
broker.publish(topicWrite, data, { qos: 2, retain: false }, (err) => {
|
|
156
|
-
if (err)
|
|
157
|
-
callback(new Error(`failed to publish to MQTT topic "${topicWrite}": ${err}`));
|
|
158
|
-
else
|
|
159
|
-
callback();
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
read(size) {
|
|
164
|
-
if (mode === "w")
|
|
165
|
-
throw new Error("read operation on write-only node");
|
|
166
|
-
chunkQueue.read().then((chunk) => {
|
|
167
|
-
this.push(chunk, "binary");
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
/* close node */
|
|
173
|
-
async close() {
|
|
174
|
-
/* close MQTT broker */
|
|
175
|
-
if (this.broker !== null) {
|
|
176
|
-
if (this.broker.connected)
|
|
177
|
-
this.broker.end();
|
|
178
|
-
this.broker = null;
|
|
179
|
-
}
|
|
180
|
-
/* close stream */
|
|
181
|
-
if (this.stream !== null) {
|
|
182
|
-
this.stream.destroy();
|
|
183
|
-
this.stream = null;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
exports.default = SpeechFlowNodeMQTT;
|
|
188
|
-
//# sourceMappingURL=speechflow-node-xio-mqtt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"speechflow-node-xio-mqtt.js","sourceRoot":"","sources":["../src/speechflow-node-xio-mqtt.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,8DAAgC;AAEhC,6BAA6B;AAC7B,gDAAyB;AACzB,0DAA8B;AAE9B,6BAA6B;AAC7B,wEAAmE;AACnE,0DAAoE;AAEpE,2CAA2C;AAC3C,MAAqB,kBAAmB,SAAQ,yBAAc;IAC1D,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAA;IAE3B,sBAAsB;IACd,MAAM,GAA2B,IAAI,CAAA;IACrC,QAAQ,GAAW,CAAC,IAAI,mBAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;IAEjD,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,GAAG,EAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAM,KAAK,EAAE,6CAA6C,EAAE;YACzG,QAAQ,EAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAA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ends SpeechFlowNode {
|
|
3
|
-
static name: string;
|
|
4
|
-
private server;
|
|
5
|
-
private client;
|
|
6
|
-
constructor(id: string, cfg: {
|
|
7
|
-
[id: string]: any;
|
|
8
|
-
}, opts: {
|
|
9
|
-
[id: string]: any;
|
|
10
|
-
}, args: any[]);
|
|
11
|
-
open(): Promise<void>;
|
|
12
|
-
close(): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,278 +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_stream_1 = __importDefault(require("node:stream"));
|
|
46
|
-
/* external dependencies */
|
|
47
|
-
const ws_1 = __importDefault(require("ws"));
|
|
48
|
-
const reconnecting_websocket_1 = __importDefault(require("@opensumi/reconnecting-websocket"));
|
|
49
|
-
/* internal dependencies */
|
|
50
|
-
const speechflow_node_1 = __importDefault(require("./speechflow-node"));
|
|
51
|
-
const utils = __importStar(require("./speechflow-utils"));
|
|
52
|
-
/* SpeechFlow node for Websocket networking */
|
|
53
|
-
class SpeechFlowNodeWebsocket extends speechflow_node_1.default {
|
|
54
|
-
/* declare official node name */
|
|
55
|
-
static name = "websocket";
|
|
56
|
-
/* internal state */
|
|
57
|
-
server = null;
|
|
58
|
-
client = null;
|
|
59
|
-
/* construct node */
|
|
60
|
-
constructor(id, cfg, opts, args) {
|
|
61
|
-
super(id, cfg, opts, args);
|
|
62
|
-
/* declare node configuration parameters */
|
|
63
|
-
this.configure({
|
|
64
|
-
listen: { type: "string", val: "", match: /^(?:|ws:\/\/(.+?):(\d+))$/ },
|
|
65
|
-
connect: { type: "string", val: "", match: /^(?:|ws:\/\/(.+?):(\d+)(?:\/.*)?)$/ },
|
|
66
|
-
mode: { type: "string", val: "r", match: /^(?:r|w|rw)$/ },
|
|
67
|
-
type: { type: "string", val: "text", match: /^(?:audio|text)$/ }
|
|
68
|
-
});
|
|
69
|
-
/* declare node input/output format */
|
|
70
|
-
if (this.params.mode === "rw") {
|
|
71
|
-
this.input = this.params.type;
|
|
72
|
-
this.output = this.params.type;
|
|
73
|
-
}
|
|
74
|
-
else if (this.params.mode === "r") {
|
|
75
|
-
this.input = "none";
|
|
76
|
-
this.output = this.params.type;
|
|
77
|
-
}
|
|
78
|
-
else if (this.params.mode === "w") {
|
|
79
|
-
this.input = this.params.type;
|
|
80
|
-
this.output = "none";
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/* open node */
|
|
84
|
-
async open() {
|
|
85
|
-
/* sanity check usage */
|
|
86
|
-
if (this.params.listen !== "" && this.params.connect !== "")
|
|
87
|
-
throw new Error("Websocket node cannot listen and connect at the same time");
|
|
88
|
-
else if (this.params.listen === "" && this.params.connect === "")
|
|
89
|
-
throw new Error("Websocket node requires either listen or connect mode");
|
|
90
|
-
if (this.params.listen !== "") {
|
|
91
|
-
/* listen locally on a Websocket port */
|
|
92
|
-
const url = new URL(this.params.listen);
|
|
93
|
-
const websockets = new Set();
|
|
94
|
-
const chunkQueue = new utils.SingleQueue();
|
|
95
|
-
this.server = new ws_1.default.WebSocketServer({
|
|
96
|
-
host: url.hostname,
|
|
97
|
-
port: Number.parseInt(url.port),
|
|
98
|
-
path: url.pathname
|
|
99
|
-
});
|
|
100
|
-
this.server.on("listening", () => {
|
|
101
|
-
this.log("info", `listening on URL ${this.params.listen}`);
|
|
102
|
-
});
|
|
103
|
-
this.server.on("connection", (ws, request) => {
|
|
104
|
-
const peer = `${request.socket.remoteAddress}:${request.socket.remotePort}`;
|
|
105
|
-
this.log("info", `connection opened on URL ${this.params.listen} by peer ${peer}`);
|
|
106
|
-
websockets.add(ws);
|
|
107
|
-
ws.on("close", () => {
|
|
108
|
-
this.log("info", `connection closed on URL ${this.params.listen} by peer ${peer}`);
|
|
109
|
-
websockets.delete(ws);
|
|
110
|
-
});
|
|
111
|
-
ws.on("error", (error) => {
|
|
112
|
-
this.log("error", `error of connection on URL ${this.params.listen} for peer ${peer}: ${error.message}`);
|
|
113
|
-
});
|
|
114
|
-
ws.on("message", (data, isBinary) => {
|
|
115
|
-
if (this.params.mode === "w") {
|
|
116
|
-
this.log("warning", `connection on URL ${this.params.listen} by peer ${peer}: ` +
|
|
117
|
-
"received remote data on write-only node");
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (!isBinary) {
|
|
121
|
-
this.log("warning", `connection on URL ${this.params.listen} by peer ${peer}: ` +
|
|
122
|
-
"received non-binary message");
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
let buffer;
|
|
126
|
-
if (Buffer.isBuffer(data))
|
|
127
|
-
buffer = data;
|
|
128
|
-
else if (data instanceof ArrayBuffer)
|
|
129
|
-
buffer = Buffer.from(data);
|
|
130
|
-
else
|
|
131
|
-
buffer = Buffer.concat(data);
|
|
132
|
-
const chunk = utils.streamChunkDecode(buffer);
|
|
133
|
-
chunkQueue.write(chunk);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
this.server.on("error", (error) => {
|
|
137
|
-
this.log("error", `error of some connection on URL ${this.params.listen}: ${error.message}`);
|
|
138
|
-
});
|
|
139
|
-
const type = this.params.type;
|
|
140
|
-
const mode = this.params.mode;
|
|
141
|
-
this.stream = new node_stream_1.default.Duplex({
|
|
142
|
-
writableObjectMode: true,
|
|
143
|
-
readableObjectMode: true,
|
|
144
|
-
decodeStrings: false,
|
|
145
|
-
highWaterMark: 1,
|
|
146
|
-
write(chunk, encoding, callback) {
|
|
147
|
-
if (mode === "r")
|
|
148
|
-
callback(new Error("write operation on read-only node"));
|
|
149
|
-
else if (chunk.type !== type)
|
|
150
|
-
callback(new Error(`written chunk is not of ${type} type`));
|
|
151
|
-
else if (websockets.size === 0)
|
|
152
|
-
callback(new Error("still no Websocket connections available"));
|
|
153
|
-
else {
|
|
154
|
-
const data = utils.streamChunkEncode(chunk);
|
|
155
|
-
const results = [];
|
|
156
|
-
for (const websocket of websockets.values()) {
|
|
157
|
-
results.push(new Promise((resolve, reject) => {
|
|
158
|
-
websocket.send(data, (error) => {
|
|
159
|
-
if (error)
|
|
160
|
-
reject(error);
|
|
161
|
-
else
|
|
162
|
-
resolve();
|
|
163
|
-
});
|
|
164
|
-
}));
|
|
165
|
-
}
|
|
166
|
-
Promise.all(results).then(() => {
|
|
167
|
-
callback();
|
|
168
|
-
}).catch((errors) => {
|
|
169
|
-
const error = new Error(errors.map((e) => e.message).join("; "));
|
|
170
|
-
callback(error);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
read(size) {
|
|
175
|
-
if (mode === "w")
|
|
176
|
-
throw new Error("read operation on write-only node");
|
|
177
|
-
chunkQueue.read().then((chunk) => {
|
|
178
|
-
this.push(chunk, "binary");
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
else if (this.params.connect !== "") {
|
|
184
|
-
/* connect remotely to a Websocket port */
|
|
185
|
-
this.client = new reconnecting_websocket_1.default(this.params.connect, [], {
|
|
186
|
-
WebSocket: ws_1.default,
|
|
187
|
-
WebSocketOptions: {},
|
|
188
|
-
reconnectionDelayGrowFactor: 1.3,
|
|
189
|
-
maxReconnectionDelay: 4000,
|
|
190
|
-
minReconnectionDelay: 1000,
|
|
191
|
-
connectionTimeout: 4000,
|
|
192
|
-
minUptime: 5000
|
|
193
|
-
});
|
|
194
|
-
this.client.addEventListener("open", (ev) => {
|
|
195
|
-
this.log("info", `connection opened to URL ${this.params.connect}`);
|
|
196
|
-
});
|
|
197
|
-
this.client.addEventListener("close", (ev) => {
|
|
198
|
-
this.log("info", `connection closed to URL ${this.params.connect}`);
|
|
199
|
-
});
|
|
200
|
-
this.client.addEventListener("error", (ev) => {
|
|
201
|
-
this.log("error", `error of connection on URL ${this.params.connect}: ${ev.error.message}`);
|
|
202
|
-
});
|
|
203
|
-
const chunkQueue = new utils.SingleQueue();
|
|
204
|
-
this.client.addEventListener("message", (ev) => {
|
|
205
|
-
if (this.params.mode === "w") {
|
|
206
|
-
this.log("warning", `connection to URL ${this.params.connect}: ` +
|
|
207
|
-
"received remote data on write-only node");
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
if (!(ev.data instanceof ArrayBuffer)) {
|
|
211
|
-
this.log("warning", `connection to URL ${this.params.connect}: ` +
|
|
212
|
-
"received non-binary message");
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
const buffer = Buffer.from(ev.data);
|
|
216
|
-
const chunk = utils.streamChunkDecode(buffer);
|
|
217
|
-
chunkQueue.write(chunk);
|
|
218
|
-
});
|
|
219
|
-
const client = this.client;
|
|
220
|
-
client.binaryType = "arraybuffer";
|
|
221
|
-
const type = this.params.type;
|
|
222
|
-
const mode = this.params.mode;
|
|
223
|
-
this.stream = new node_stream_1.default.Duplex({
|
|
224
|
-
writableObjectMode: true,
|
|
225
|
-
readableObjectMode: true,
|
|
226
|
-
decodeStrings: false,
|
|
227
|
-
highWaterMark: 1,
|
|
228
|
-
write(chunk, encoding, callback) {
|
|
229
|
-
if (mode === "r")
|
|
230
|
-
callback(new Error("write operation on read-only node"));
|
|
231
|
-
else if (chunk.type !== type)
|
|
232
|
-
callback(new Error(`written chunk is not of ${type} type`));
|
|
233
|
-
else if (!client.OPEN)
|
|
234
|
-
callback(new Error("still no Websocket connection available"));
|
|
235
|
-
else {
|
|
236
|
-
const data = utils.streamChunkEncode(chunk);
|
|
237
|
-
client.send(data);
|
|
238
|
-
callback();
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
read(size) {
|
|
242
|
-
if (mode === "w")
|
|
243
|
-
throw new Error("read operation on write-only node");
|
|
244
|
-
chunkQueue.read().then((chunk) => {
|
|
245
|
-
this.push(chunk, "binary");
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
/* close node */
|
|
252
|
-
async close() {
|
|
253
|
-
/* close Websocket server */
|
|
254
|
-
if (this.server !== null) {
|
|
255
|
-
await new Promise((resolve, reject) => {
|
|
256
|
-
this.server.close((error) => {
|
|
257
|
-
if (error)
|
|
258
|
-
reject(error);
|
|
259
|
-
else
|
|
260
|
-
resolve();
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
this.server = null;
|
|
264
|
-
}
|
|
265
|
-
/* close Websocket client */
|
|
266
|
-
if (this.client !== null) {
|
|
267
|
-
this.client.close();
|
|
268
|
-
this.client = null;
|
|
269
|
-
}
|
|
270
|
-
/* close stream */
|
|
271
|
-
if (this.stream !== null) {
|
|
272
|
-
this.stream.destroy();
|
|
273
|
-
this.stream = null;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
exports.default = SpeechFlowNodeWebsocket;
|
|
278
|
-
//# sourceMappingURL=speechflow-node-xio-websocket.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"speechflow-node-xio-websocket.js","sourceRoot":"","sources":["../src/speechflow-node-xio-websocket.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,8DAAgC;AAEhC,6BAA6B;AAC7B,4CAAgD;AAChD,8FAA8E;AAE9E,6BAA6B;AAC7B,wEAAmE;AACnE,0DAAoE;AAEpE,gDAAgD;AAChD,MAAqB,uBAAwB,SAAQ,yBAAc;IAC/D,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,WAAW,CAAA;IAEhC,sBAAsB;IACd,MAAM,GAA8B,IAAI,CAAA;IACxC,MAAM,GAA8B,IAAI,CAAA;IAEhD,sBAAsB;IACtB,YAAa,EAAU,EAAE,GAA4B,EAAE,IAA6B,EAAE,IAAW;QAC7F,KAAK,CAAC,EAAE,EAAE,GAAG,E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MAAM,GAAG,IAAI,CAAA;QACtB,CAAC;IACL,CAAC;;AArOL,0CAsOC"}
|
package/dst/speechflow-node.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import Events from "node:events";
|
|
2
|
-
import Stream from "node:stream";
|
|
3
|
-
import { DateTime, Duration } from "luxon";
|
|
4
|
-
export declare class SpeechFlowChunk {
|
|
5
|
-
timestampStart: Duration;
|
|
6
|
-
timestampEnd: Duration;
|
|
7
|
-
kind: "intermediate" | "final";
|
|
8
|
-
type: "audio" | "text";
|
|
9
|
-
payload: Buffer | string;
|
|
10
|
-
meta: Map<string, any>;
|
|
11
|
-
constructor(timestampStart: Duration, timestampEnd: Duration, kind: "intermediate" | "final", type: "audio" | "text", payload: Buffer | string, meta?: Map<string, any>);
|
|
12
|
-
clone(): SpeechFlowChunk;
|
|
13
|
-
}
|
|
14
|
-
export default class SpeechFlowNode extends Events.EventEmitter {
|
|
15
|
-
id: string;
|
|
16
|
-
private cfg;
|
|
17
|
-
private opts;
|
|
18
|
-
private args;
|
|
19
|
-
static name: string | undefined;
|
|
20
|
-
config: {
|
|
21
|
-
audioChannels: number;
|
|
22
|
-
audioBitDepth: (1 | 8 | 16 | 24 | 32);
|
|
23
|
-
audioLittleEndian: boolean;
|
|
24
|
-
audioSampleRate: number;
|
|
25
|
-
textEncoding: BufferEncoding;
|
|
26
|
-
cacheDir: string;
|
|
27
|
-
};
|
|
28
|
-
input: string;
|
|
29
|
-
output: string;
|
|
30
|
-
params: {
|
|
31
|
-
[id: string]: any;
|
|
32
|
-
};
|
|
33
|
-
stream: Stream.Writable | Stream.Readable | Stream.Duplex | null;
|
|
34
|
-
connectionsIn: Set<SpeechFlowNode>;
|
|
35
|
-
connectionsOut: Set<SpeechFlowNode>;
|
|
36
|
-
timeOpen: DateTime<boolean> | undefined;
|
|
37
|
-
timeZero: DateTime<boolean>;
|
|
38
|
-
timeZeroOffset: Duration<boolean>;
|
|
39
|
-
constructor(id: string, cfg: {
|
|
40
|
-
[id: string]: any;
|
|
41
|
-
}, opts: {
|
|
42
|
-
[id: string]: any;
|
|
43
|
-
}, args: any[]);
|
|
44
|
-
setTimeZero(time: DateTime): void;
|
|
45
|
-
receiveRequest(args: any[]): Promise<void>;
|
|
46
|
-
sendResponse(args: any[]): void;
|
|
47
|
-
configure(spec: {
|
|
48
|
-
[id: string]: {
|
|
49
|
-
type: string;
|
|
50
|
-
pos?: number;
|
|
51
|
-
val?: any;
|
|
52
|
-
match?: RegExp | ((x: any) => boolean);
|
|
53
|
-
};
|
|
54
|
-
}): void;
|
|
55
|
-
connect(other: SpeechFlowNode): void;
|
|
56
|
-
disconnect(other: SpeechFlowNode): void;
|
|
57
|
-
log(level: string, msg: string, data?: any): void;
|
|
58
|
-
status(): Promise<{
|
|
59
|
-
[key: string]: string | number;
|
|
60
|
-
}>;
|
|
61
|
-
open(): Promise<void>;
|
|
62
|
-
close(): Promise<void>;
|
|
63
|
-
}
|