speechflow 1.6.0 → 1.6.2
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 +12 -0
- package/README.md +1 -1
- package/etc/claude.md +9 -4
- package/etc/keyfiles.txt +19 -0
- package/etc/speechflow.yaml +4 -4
- package/package.json +3 -3
- package/speechflow-cli/dst/speechflow-main-api.d.ts +12 -0
- package/speechflow-cli/dst/speechflow-main-api.js +319 -0
- package/speechflow-cli/dst/speechflow-main-api.js.map +1 -0
- package/speechflow-cli/dst/speechflow-main-cli.d.ts +28 -0
- package/speechflow-cli/dst/speechflow-main-cli.js +271 -0
- package/speechflow-cli/dst/speechflow-main-cli.js.map +1 -0
- package/speechflow-cli/dst/speechflow-main-config.d.ts +9 -0
- package/speechflow-cli/dst/speechflow-main-config.js +27 -0
- package/speechflow-cli/dst/speechflow-main-config.js.map +1 -0
- package/speechflow-cli/dst/speechflow-main-graph.d.ts +34 -0
- package/speechflow-cli/dst/speechflow-main-graph.js +365 -0
- package/speechflow-cli/dst/speechflow-main-graph.js.map +1 -0
- package/speechflow-cli/dst/speechflow-main-nodes.d.ts +10 -0
- package/speechflow-cli/dst/speechflow-main-nodes.js +60 -0
- package/speechflow-cli/dst/speechflow-main-nodes.js.map +1 -0
- package/speechflow-cli/dst/speechflow-main-status.d.ts +11 -0
- package/speechflow-cli/dst/speechflow-main-status.js +60 -0
- package/speechflow-cli/dst/speechflow-main-status.js.map +1 -0
- package/speechflow-cli/dst/speechflow-main.d.ts +7 -0
- package/speechflow-cli/dst/speechflow-main.js +127 -0
- package/speechflow-cli/dst/speechflow-main.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-a2a-compressor-wt.js +4 -4
- package/speechflow-cli/dst/speechflow-node-a2a-compressor-wt.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-compressor.js +5 -6
- package/speechflow-cli/dst/speechflow-node-a2a-compressor.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-expander-wt.js +5 -5
- package/speechflow-cli/dst/speechflow-node-a2a-expander-wt.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-expander.js +5 -6
- package/speechflow-cli/dst/speechflow-node-a2a-expander.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js +5 -5
- package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-filler.js +3 -3
- package/speechflow-cli/dst/speechflow-node-a2a-filler.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-gain.js +2 -2
- package/speechflow-cli/dst/speechflow-node-a2a-gain.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-gender.js +4 -4
- package/speechflow-cli/dst/speechflow-node-a2a-gender.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-meter.js +2 -2
- package/speechflow-cli/dst/speechflow-node-a2a-meter.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-rnnoise.js +4 -4
- package/speechflow-cli/dst/speechflow-node-a2a-rnnoise.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-speex.js +4 -4
- package/speechflow-cli/dst/speechflow-node-a2a-speex.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2a-vad.js +4 -4
- package/speechflow-cli/dst/speechflow-node-a2a-vad.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2t-amazon.js +6 -6
- package/speechflow-cli/dst/speechflow-node-a2t-amazon.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js +4 -4
- package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-a2t-openai.js +4 -4
- package/speechflow-cli/dst/speechflow-node-a2t-openai.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2a-amazon.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2a-amazon.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2t-amazon.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2t-amazon.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2t-deepl.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2t-deepl.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2t-google.js +5 -5
- package/speechflow-cli/dst/speechflow-node-t2t-google.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2t-modify.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2t-modify.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2t-ollama.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2t-ollama.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2t-openai.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2t-openai.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2t-sentence.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2t-sentence.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-t2t-transformers.js +2 -2
- package/speechflow-cli/dst/speechflow-node-t2t-transformers.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-x2x-filter.js +2 -2
- package/speechflow-cli/dst/speechflow-node-x2x-filter.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-xio-device.js +5 -5
- package/speechflow-cli/dst/speechflow-node-xio-device.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-xio-file.js +27 -27
- package/speechflow-cli/dst/speechflow-node-xio-file.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-xio-mqtt.js +4 -4
- package/speechflow-cli/dst/speechflow-node-xio-mqtt.js.map +1 -1
- package/speechflow-cli/dst/speechflow-node-xio-websocket.js +7 -7
- package/speechflow-cli/dst/speechflow-node-xio-websocket.js.map +1 -1
- package/speechflow-cli/dst/{speechflow-utils-audio-wt.js → speechflow-util-audio-wt.js} +1 -1
- package/speechflow-cli/dst/speechflow-util-audio-wt.js.map +1 -0
- package/speechflow-cli/dst/speechflow-util-audio.d.ts +22 -0
- package/speechflow-cli/dst/speechflow-util-audio.js +251 -0
- package/speechflow-cli/dst/speechflow-util-audio.js.map +1 -0
- package/speechflow-cli/dst/speechflow-util-error.d.ts +14 -0
- package/speechflow-cli/dst/speechflow-util-error.js +131 -0
- package/speechflow-cli/dst/speechflow-util-error.js.map +1 -0
- package/speechflow-cli/dst/speechflow-util-queue.d.ts +68 -0
- package/speechflow-cli/dst/speechflow-util-queue.js +338 -0
- package/speechflow-cli/dst/speechflow-util-queue.js.map +1 -0
- package/speechflow-cli/dst/speechflow-util-stream.d.ts +18 -0
- package/speechflow-cli/dst/speechflow-util-stream.js +219 -0
- package/speechflow-cli/dst/speechflow-util-stream.js.map +1 -0
- package/speechflow-cli/dst/speechflow-util-webaudio-wt.js +124 -0
- package/speechflow-cli/dst/speechflow-util-webaudio-wt.js.map +1 -0
- package/speechflow-cli/dst/{speechflow-utils-audio.js → speechflow-util-webaudio.js} +2 -2
- package/speechflow-cli/dst/speechflow-util-webaudio.js.map +1 -0
- package/speechflow-cli/dst/speechflow-util.d.ts +4 -0
- package/speechflow-cli/dst/speechflow-util.js +26 -0
- package/speechflow-cli/dst/speechflow-util.js.map +1 -0
- package/speechflow-cli/dst/speechflow.js +3 -912
- package/speechflow-cli/dst/speechflow.js.map +1 -1
- package/speechflow-cli/etc/oxlint.jsonc +4 -1
- package/speechflow-cli/package.json +1 -0
- package/speechflow-cli/src/lib.d.ts +2 -0
- package/speechflow-cli/src/speechflow-main-api.ts +315 -0
- package/speechflow-cli/src/speechflow-main-cli.ts +259 -0
- package/speechflow-cli/src/speechflow-main-config.ts +17 -0
- package/speechflow-cli/src/speechflow-main-graph.ts +370 -0
- package/speechflow-cli/src/speechflow-main-nodes.ts +61 -0
- package/speechflow-cli/src/speechflow-main-status.ts +70 -0
- package/speechflow-cli/src/speechflow-main.ts +106 -0
- package/speechflow-cli/src/speechflow-node-a2a-compressor-wt.ts +4 -4
- package/speechflow-cli/src/speechflow-node-a2a-compressor.ts +5 -6
- package/speechflow-cli/src/speechflow-node-a2a-expander-wt.ts +5 -5
- package/speechflow-cli/src/speechflow-node-a2a-expander.ts +5 -6
- package/speechflow-cli/src/speechflow-node-a2a-ffmpeg.ts +5 -5
- package/speechflow-cli/src/speechflow-node-a2a-filler.ts +4 -4
- package/speechflow-cli/src/speechflow-node-a2a-gain.ts +2 -2
- package/speechflow-cli/src/speechflow-node-a2a-gender.ts +4 -4
- package/speechflow-cli/src/speechflow-node-a2a-meter.ts +2 -2
- package/speechflow-cli/src/speechflow-node-a2a-rnnoise.ts +4 -4
- package/speechflow-cli/src/speechflow-node-a2a-speex.ts +4 -4
- package/speechflow-cli/src/speechflow-node-a2a-vad.ts +4 -4
- package/speechflow-cli/src/speechflow-node-a2t-amazon.ts +7 -7
- package/speechflow-cli/src/speechflow-node-a2t-deepgram.ts +5 -5
- package/speechflow-cli/src/speechflow-node-a2t-openai.ts +5 -5
- package/speechflow-cli/src/speechflow-node-t2a-amazon.ts +2 -2
- package/speechflow-cli/src/speechflow-node-t2a-kokoro.ts +2 -2
- package/speechflow-cli/src/speechflow-node-t2t-amazon.ts +2 -2
- package/speechflow-cli/src/speechflow-node-t2t-deepl.ts +2 -2
- package/speechflow-cli/src/speechflow-node-t2t-google.ts +5 -5
- package/speechflow-cli/src/speechflow-node-t2t-modify.ts +2 -2
- package/speechflow-cli/src/speechflow-node-t2t-ollama.ts +2 -2
- package/speechflow-cli/src/speechflow-node-t2t-openai.ts +2 -2
- package/speechflow-cli/src/speechflow-node-t2t-sentence.ts +2 -2
- package/speechflow-cli/src/speechflow-node-t2t-subtitle.ts +2 -2
- package/speechflow-cli/src/speechflow-node-t2t-transformers.ts +2 -2
- package/speechflow-cli/src/speechflow-node-x2x-filter.ts +2 -2
- package/speechflow-cli/src/speechflow-node-xio-device.ts +5 -5
- package/speechflow-cli/src/speechflow-node-xio-file.ts +9 -10
- package/speechflow-cli/src/speechflow-node-xio-mqtt.ts +5 -5
- package/speechflow-cli/src/speechflow-node-xio-websocket.ts +7 -7
- package/speechflow-cli/src/{speechflow-utils-audio.ts → speechflow-util-audio.ts} +131 -1
- package/speechflow-cli/src/speechflow-util-error.ts +184 -0
- package/speechflow-cli/src/speechflow-util-queue.ts +320 -0
- package/speechflow-cli/src/speechflow-util-stream.ts +197 -0
- package/speechflow-cli/src/speechflow-util.ts +10 -0
- package/speechflow-cli/src/speechflow.ts +3 -953
- package/speechflow-ui-db/dst/index.js +1 -1
- package/speechflow-ui-db/etc/vite-client.mts +0 -2
- package/speechflow-ui-db/src/app.vue +20 -19
- package/speechflow-ui-st/dst/index.js +1 -1
- package/speechflow-ui-st/etc/vite-client.mts +0 -2
- package/speechflow-ui-st/src/app.vue +10 -6
- package/speechflow-cli/dst/speechflow-node-a2a-dynamics-wt.js +0 -208
- package/speechflow-cli/dst/speechflow-node-a2a-dynamics-wt.js.map +0 -1
- package/speechflow-cli/dst/speechflow-node-a2a-dynamics.d.ts +0 -15
- package/speechflow-cli/dst/speechflow-node-a2a-dynamics.js +0 -312
- package/speechflow-cli/dst/speechflow-node-a2a-dynamics.js.map +0 -1
- package/speechflow-cli/dst/speechflow-node-a2t-awstranscribe.d.ts +0 -18
- package/speechflow-cli/dst/speechflow-node-a2t-awstranscribe.js +0 -312
- package/speechflow-cli/dst/speechflow-node-a2t-awstranscribe.js.map +0 -1
- package/speechflow-cli/dst/speechflow-node-a2t-openaitranscribe.d.ts +0 -19
- package/speechflow-cli/dst/speechflow-node-a2t-openaitranscribe.js +0 -351
- package/speechflow-cli/dst/speechflow-node-a2t-openaitranscribe.js.map +0 -1
- package/speechflow-cli/dst/speechflow-node-t2a-awspolly.d.ts +0 -16
- package/speechflow-cli/dst/speechflow-node-t2a-awspolly.js +0 -204
- package/speechflow-cli/dst/speechflow-node-t2a-awspolly.js.map +0 -1
- package/speechflow-cli/dst/speechflow-node-t2t-awstranslate.d.ts +0 -13
- package/speechflow-cli/dst/speechflow-node-t2t-awstranslate.js +0 -175
- package/speechflow-cli/dst/speechflow-node-t2t-awstranslate.js.map +0 -1
- package/speechflow-cli/dst/speechflow-utils-audio-wt.js.map +0 -1
- package/speechflow-cli/dst/speechflow-utils-audio.js.map +0 -1
- package/speechflow-cli/dst/speechflow-utils.d.ts +0 -108
- package/speechflow-cli/dst/speechflow-utils.js +0 -746
- package/speechflow-cli/dst/speechflow-utils.js.map +0 -1
- package/speechflow-cli/src/speechflow-utils.ts +0 -810
- /package/speechflow-cli/dst/{speechflow-node-a2a-dynamics-wt.d.ts → speechflow-util-audio-wt.d.ts} +0 -0
- /package/speechflow-cli/dst/{speechflow-utils-audio-wt.d.ts → speechflow-util-webaudio-wt.d.ts} +0 -0
- /package/speechflow-cli/dst/{speechflow-utils-audio.d.ts → speechflow-util-webaudio.d.ts} +0 -0
- /package/speechflow-cli/src/{speechflow-utils-audio-wt.ts → speechflow-util-audio-wt.ts} +0 -0
|
@@ -0,0 +1,365 @@
|
|
|
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
|
+
exports.NodeGraph = void 0;
|
|
45
|
+
/* standard dependencies */
|
|
46
|
+
const node_stream_1 = __importDefault(require("node:stream"));
|
|
47
|
+
const node_events_1 = require("node:events");
|
|
48
|
+
/* external dependencies */
|
|
49
|
+
const luxon_1 = require("luxon");
|
|
50
|
+
const flowlink_1 = __importDefault(require("flowlink"));
|
|
51
|
+
const object_path_1 = __importDefault(require("object-path"));
|
|
52
|
+
const util = __importStar(require("./speechflow-util"));
|
|
53
|
+
/* the SpeechFlow node graph management */
|
|
54
|
+
class NodeGraph {
|
|
55
|
+
cli;
|
|
56
|
+
debug;
|
|
57
|
+
/* internal state */
|
|
58
|
+
graphNodes = new Set();
|
|
59
|
+
activeNodes = new Set();
|
|
60
|
+
finishEvents = new node_events_1.EventEmitter();
|
|
61
|
+
timeZero = null;
|
|
62
|
+
shuttingDown = false;
|
|
63
|
+
/* simple construction */
|
|
64
|
+
constructor(cli, debug = false) {
|
|
65
|
+
this.cli = cli;
|
|
66
|
+
this.debug = debug;
|
|
67
|
+
}
|
|
68
|
+
/* get all graph nodes */
|
|
69
|
+
getGraphNodes() {
|
|
70
|
+
return this.graphNodes;
|
|
71
|
+
}
|
|
72
|
+
/* find particular graph node */
|
|
73
|
+
findGraphNode(name) {
|
|
74
|
+
return Array.from(this.graphNodes).find((node) => node.id === name);
|
|
75
|
+
}
|
|
76
|
+
/* graph establishment: PASS 1: parse DSL and create and connect nodes */
|
|
77
|
+
async createAndConnectNodes(config, nodes, cfg, variables, accessBus) {
|
|
78
|
+
const flowlink = new flowlink_1.default({
|
|
79
|
+
trace: (msg) => {
|
|
80
|
+
this.cli.log("debug", msg);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
const nodeNums = new Map();
|
|
84
|
+
let ast;
|
|
85
|
+
try {
|
|
86
|
+
ast = flowlink.compile(config);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
const errorMsg = err instanceof Error && err.name === "FlowLinkError"
|
|
90
|
+
? err.toString() : (err instanceof Error ? err.message : "internal error");
|
|
91
|
+
this.cli.log("error", `failed to parse SpeechFlow configuration: ${errorMsg}`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
flowlink.execute(ast, {
|
|
96
|
+
resolveVariable: (id) => {
|
|
97
|
+
if (!object_path_1.default.has(variables, id))
|
|
98
|
+
throw new Error(`failed to resolve variable "${id}"`);
|
|
99
|
+
const value = object_path_1.default.get(variables, id);
|
|
100
|
+
this.cli.log("info", `resolve variable: "${id}" -> "${value}"`);
|
|
101
|
+
return value;
|
|
102
|
+
},
|
|
103
|
+
createNode: (id, opts, args) => {
|
|
104
|
+
if (nodes[id] === undefined)
|
|
105
|
+
throw new Error(`unknown node <${id}>`);
|
|
106
|
+
let node;
|
|
107
|
+
try {
|
|
108
|
+
const NodeClass = nodes[id];
|
|
109
|
+
let num = nodeNums.get(NodeClass) ?? 0;
|
|
110
|
+
nodeNums.set(NodeClass, ++num);
|
|
111
|
+
const name = num === 1 ? id : `${id}:${num}`;
|
|
112
|
+
node = new NodeClass(name, cfg, opts, args);
|
|
113
|
+
node._accessBus = accessBus;
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
/* fatal error */
|
|
117
|
+
if (err instanceof Error)
|
|
118
|
+
this.cli.log("error", `creation of node <${id}> failed: ${err.message}`);
|
|
119
|
+
else
|
|
120
|
+
this.cli.log("error", `creation of node <${id}> failed: ${err}`);
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
const params = Object.keys(node.params).map((key) => {
|
|
124
|
+
if (key.match(/key/))
|
|
125
|
+
return `${key}: [...]`;
|
|
126
|
+
else
|
|
127
|
+
return `${key}: ${JSON.stringify(node.params[key])}`;
|
|
128
|
+
}).join(", ");
|
|
129
|
+
this.cli.log("info", `create node <${node.id}> (${params})`);
|
|
130
|
+
this.graphNodes.add(node);
|
|
131
|
+
return node;
|
|
132
|
+
},
|
|
133
|
+
connectNodes: (node1, node2) => {
|
|
134
|
+
this.cli.log("info", `connect node <${node1.id}> to node <${node2.id}>`);
|
|
135
|
+
node1.connect(node2);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
const errorMsg = err instanceof Error && err.name === "FlowLinkError"
|
|
141
|
+
? err.toString() : (err instanceof Error ? err.message : "internal error");
|
|
142
|
+
this.cli.log("error", `failed to materialize SpeechFlow configuration: ${errorMsg}`);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/* graph establishment: PASS 2: prune connections of nodes */
|
|
147
|
+
async pruneConnections() {
|
|
148
|
+
for (const node of this.graphNodes) {
|
|
149
|
+
/* determine connections */
|
|
150
|
+
let connectionsIn = Array.from(node.connectionsIn);
|
|
151
|
+
let connectionsOut = Array.from(node.connectionsOut);
|
|
152
|
+
/* ensure necessary incoming links */
|
|
153
|
+
if (node.input !== "none" && connectionsIn.length === 0)
|
|
154
|
+
throw new Error(`node <${node.id}> requires input but has no input nodes connected`);
|
|
155
|
+
/* prune unnecessary incoming links */
|
|
156
|
+
if (node.input === "none" && connectionsIn.length > 0)
|
|
157
|
+
connectionsIn.forEach((other) => { other.disconnect(node); });
|
|
158
|
+
/* ensure necessary outgoing links */
|
|
159
|
+
if (node.output !== "none" && connectionsOut.length === 0)
|
|
160
|
+
throw new Error(`node <${node.id}> requires output but has no output nodes connected`);
|
|
161
|
+
/* prune unnecessary outgoing links */
|
|
162
|
+
if (node.output === "none" && connectionsOut.length > 0)
|
|
163
|
+
connectionsOut.forEach((other) => { node.disconnect(other); });
|
|
164
|
+
/* check for payload compatibility */
|
|
165
|
+
connectionsIn = Array.from(node.connectionsIn);
|
|
166
|
+
connectionsOut = Array.from(node.connectionsOut);
|
|
167
|
+
for (const other of connectionsOut)
|
|
168
|
+
if (other.input !== node.output)
|
|
169
|
+
throw new Error(`${node.output} output node <${node.id}> cannot be ` +
|
|
170
|
+
`connected to ${other.input} input node <${other.id}> (payload is incompatible)`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/* graph establishment: PASS 3: open nodes */
|
|
174
|
+
async openNodes() {
|
|
175
|
+
this.timeZero = luxon_1.DateTime.now();
|
|
176
|
+
for (const node of this.graphNodes) {
|
|
177
|
+
/* connect node events */
|
|
178
|
+
node.on("log", (level, msg, data) => {
|
|
179
|
+
let str = `<${node.id}>: ${msg}`;
|
|
180
|
+
if (data !== undefined)
|
|
181
|
+
str += ` (${JSON.stringify(data)})`;
|
|
182
|
+
this.cli.log(level, str);
|
|
183
|
+
});
|
|
184
|
+
/* open node */
|
|
185
|
+
this.cli.log("info", `open node <${node.id}>`);
|
|
186
|
+
node.setTimeZero(this.timeZero);
|
|
187
|
+
await Promise.race([
|
|
188
|
+
node.open(),
|
|
189
|
+
new Promise((resolve, reject) => setTimeout(() => reject(new Error("timeout")), 10 * 1000))
|
|
190
|
+
]).catch((err) => {
|
|
191
|
+
this.cli.log("error", `<${node.id}>: failed to open node <${node.id}>: ${err.message}`);
|
|
192
|
+
throw new Error(`failed to open node <${node.id}>: ${err.message}`);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/* graph establishment: PASS 4: connect node streams */
|
|
197
|
+
async connectStreams() {
|
|
198
|
+
for (const node of this.graphNodes) {
|
|
199
|
+
if (node.stream === null)
|
|
200
|
+
throw new Error(`stream of node <${node.id}> still not initialized`);
|
|
201
|
+
for (const other of Array.from(node.connectionsOut)) {
|
|
202
|
+
if (other.stream === null)
|
|
203
|
+
throw new Error(`stream of incoming node <${other.id}> still not initialized`);
|
|
204
|
+
this.cli.log("info", `connect stream of node <${node.id}> to stream of node <${other.id}>`);
|
|
205
|
+
if (!(node.stream instanceof node_stream_1.default.Readable
|
|
206
|
+
|| node.stream instanceof node_stream_1.default.Duplex))
|
|
207
|
+
throw new Error(`stream of output node <${node.id}> is neither of Readable nor Duplex type`);
|
|
208
|
+
if (!(other.stream instanceof node_stream_1.default.Writable
|
|
209
|
+
|| other.stream instanceof node_stream_1.default.Duplex))
|
|
210
|
+
throw new Error(`stream of input node <${other.id}> is neither of Writable nor Duplex type`);
|
|
211
|
+
node.stream.pipe(other.stream);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/* graph establishment: PASS 5: track stream finishing */
|
|
216
|
+
trackFinishing(args, api) {
|
|
217
|
+
this.finishEvents.removeAllListeners();
|
|
218
|
+
this.finishEvents.setMaxListeners(this.graphNodes.size + 10);
|
|
219
|
+
for (const node of this.graphNodes) {
|
|
220
|
+
if (node.stream === null)
|
|
221
|
+
throw new Error(`stream of node <${node.id}> still not initialized`);
|
|
222
|
+
this.cli.log("info", `observe stream of node <${node.id}> for finish event`);
|
|
223
|
+
this.activeNodes.add(node);
|
|
224
|
+
const deactivateNode = (node, msg) => {
|
|
225
|
+
if (this.activeNodes.has(node))
|
|
226
|
+
this.activeNodes.delete(node);
|
|
227
|
+
this.cli.log("info", `${msg} (${this.activeNodes.size} active nodes remaining)`);
|
|
228
|
+
if (this.activeNodes.size === 0) {
|
|
229
|
+
const timeFinished = luxon_1.DateTime.now();
|
|
230
|
+
const duration = timeFinished.diff(this.timeZero);
|
|
231
|
+
this.cli.log("info", "**** everything finished -- stream processing in SpeechFlow graph stops " +
|
|
232
|
+
`(total duration: ${duration.toFormat("hh:mm:ss.SSS")}) ****`);
|
|
233
|
+
this.finishEvents.emit("finished");
|
|
234
|
+
this.shutdown("finished", args, api);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
node.stream.on("end", () => {
|
|
238
|
+
deactivateNode(node, `readable stream side of node <${node.id}> raised "end" event`);
|
|
239
|
+
});
|
|
240
|
+
node.stream.on("finish", () => {
|
|
241
|
+
deactivateNode(node, `writable stream side of node <${node.id}> raised "finish" event`);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/* start of internal stream processing */
|
|
245
|
+
this.cli.log("info", "**** everything established -- stream processing in SpeechFlow graph starts ****");
|
|
246
|
+
}
|
|
247
|
+
/* graph destruction: PASS 1: disconnect node streams */
|
|
248
|
+
async disconnectStreams() {
|
|
249
|
+
for (const node of this.graphNodes) {
|
|
250
|
+
if (node.stream === null) {
|
|
251
|
+
this.cli.log("warning", `stream of node <${node.id}> no longer initialized`);
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
for (const other of Array.from(node.connectionsOut)) {
|
|
255
|
+
if (other.stream === null) {
|
|
256
|
+
this.cli.log("warning", `stream of incoming node <${other.id}> no longer initialized`);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (!(node.stream instanceof node_stream_1.default.Readable
|
|
260
|
+
|| node.stream instanceof node_stream_1.default.Duplex)) {
|
|
261
|
+
this.cli.log("warning", `stream of output node <${node.id}> is neither of Readable nor Duplex type`);
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (!(other.stream instanceof node_stream_1.default.Writable
|
|
265
|
+
|| other.stream instanceof node_stream_1.default.Duplex)) {
|
|
266
|
+
this.cli.log("warning", `stream of input node <${other.id}> is neither of Writable nor Duplex type`);
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
this.cli.log("info", `disconnect stream of node <${node.id}> from stream of node <${other.id}>`);
|
|
270
|
+
node.stream.unpipe(other.stream);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/* graph destruction: PASS 2: close nodes */
|
|
275
|
+
async closeNodes() {
|
|
276
|
+
for (const node of this.graphNodes) {
|
|
277
|
+
this.cli.log("info", `close node <${node.id}>`);
|
|
278
|
+
await Promise.race([
|
|
279
|
+
node.close(),
|
|
280
|
+
new Promise((resolve, reject) => setTimeout(() => reject(new Error("timeout")), 10 * 1000))
|
|
281
|
+
]).catch((err) => {
|
|
282
|
+
this.cli.log("warning", `node <${node.id}> failed to close: ${err.message}`);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/* graph destruction: PASS 3: disconnect nodes */
|
|
287
|
+
disconnectNodes() {
|
|
288
|
+
for (const node of this.graphNodes) {
|
|
289
|
+
this.cli.log("info", `disconnect node <${node.id}>`);
|
|
290
|
+
const connectionsIn = Array.from(node.connectionsIn);
|
|
291
|
+
const connectionsOut = Array.from(node.connectionsOut);
|
|
292
|
+
connectionsIn.forEach((other) => { other.disconnect(node); });
|
|
293
|
+
connectionsOut.forEach((other) => { node.disconnect(other); });
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/* graph destruction: PASS 4: destroy nodes */
|
|
297
|
+
destroyNodes() {
|
|
298
|
+
for (const node of this.graphNodes) {
|
|
299
|
+
this.cli.log("info", `destroy node <${node.id}>`);
|
|
300
|
+
this.graphNodes.delete(node);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
/* setup signal handling for shutdown */
|
|
304
|
+
setupSignalHandlers(args, api) {
|
|
305
|
+
/* internal helper functions */
|
|
306
|
+
const shutdownHandler = (signal) => this.shutdown(signal, args, api);
|
|
307
|
+
const logError = (error) => {
|
|
308
|
+
if (this.debug)
|
|
309
|
+
this.cli.log("error", `uncaught exception: ${error.message}\n${error.stack}`);
|
|
310
|
+
else
|
|
311
|
+
this.cli.log("error", `uncaught exception: ${error.message}`);
|
|
312
|
+
};
|
|
313
|
+
/* hook into process signals */
|
|
314
|
+
process.on("SIGINT", () => { shutdownHandler("SIGINT"); });
|
|
315
|
+
process.on("SIGUSR1", () => { shutdownHandler("SIGUSR1"); });
|
|
316
|
+
process.on("SIGUSR2", () => { shutdownHandler("SIGUSR2"); });
|
|
317
|
+
process.on("SIGTERM", () => { shutdownHandler("SIGTERM"); });
|
|
318
|
+
/* re-hook into uncaught exception handler */
|
|
319
|
+
process.removeAllListeners("uncaughtException");
|
|
320
|
+
process.on("uncaughtException", (err) => {
|
|
321
|
+
const error = util.ensureError(err, "uncaught exception");
|
|
322
|
+
logError(error);
|
|
323
|
+
shutdownHandler("exception");
|
|
324
|
+
});
|
|
325
|
+
/* re-hook into unhandled promise rejection handler */
|
|
326
|
+
process.removeAllListeners("unhandledRejection");
|
|
327
|
+
process.on("unhandledRejection", (reason) => {
|
|
328
|
+
const error = util.ensureError(reason, "unhandled promise rejection");
|
|
329
|
+
logError(error);
|
|
330
|
+
shutdownHandler("exception");
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/* shutdown procedure */
|
|
334
|
+
async shutdown(signal, args, api) {
|
|
335
|
+
if (this.shuttingDown)
|
|
336
|
+
return;
|
|
337
|
+
this.shuttingDown = true;
|
|
338
|
+
if (signal === "exception")
|
|
339
|
+
this.cli.log("warning", "**** exception occurred -- shutting down service ****");
|
|
340
|
+
else if (signal !== "finished")
|
|
341
|
+
this.cli.log("warning", `**** received signal ${signal} -- shutting down service ****`);
|
|
342
|
+
/* shutdown API service */
|
|
343
|
+
await api.stop(args);
|
|
344
|
+
/* disconnect, close and destroy nodes */
|
|
345
|
+
await this.disconnectStreams();
|
|
346
|
+
await this.closeNodes();
|
|
347
|
+
this.disconnectNodes();
|
|
348
|
+
this.destroyNodes();
|
|
349
|
+
/* clear event emitters */
|
|
350
|
+
this.finishEvents.removeAllListeners();
|
|
351
|
+
/* clear active nodes */
|
|
352
|
+
this.activeNodes.clear();
|
|
353
|
+
/* terminate process */
|
|
354
|
+
if (signal === "finished") {
|
|
355
|
+
this.cli.log("info", "terminate process (exit code 0)");
|
|
356
|
+
process.exit(0);
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
this.cli.log("info", "terminate process (exit code 1)");
|
|
360
|
+
process.exit(1);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
exports.NodeGraph = NodeGraph;
|
|
365
|
+
//# sourceMappingURL=speechflow-main-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speechflow-main-graph.js","sourceRoot":"","sources":["../src/speechflow-main-graph.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,8DAA+C;AAC/C,6CAA+C;AAE/C,6BAA6B;AAC7B,iCAAyC;AAEzC,wDAA4C;AAC5C,8DAA+C;AAO/C,wDAAqD;AAErD,4CAA4C;AAC5C,MAAa,SAAS;IAUN;IACA;IAVZ,sBAAsB;IACd,UAAU,GAAM,IAAI,G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C,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,wBAAwB,MAAM,gCAAgC,CAAC,CAAA;QAE3F,4BAA4B;QAC5B,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEpB,2CAA2C;QAC3C,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC9B,MAAM,IAAI,CAAC,UAAU,EAAE,CAAA;QACvB,IAAI,CAAC,eAAe,EAAE,CAAA;QACtB,IAAI,CAAC,YAAY,EAAE,CAAA;QAEnB,4BAA4B;QAC5B,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAA;QAEtC,0BAA0B;QAC1B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAA;QAExB,yBAAyB;QACzB,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAA;YACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,CAAC;aACI,CAAC;YACF,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAA;YACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,CAAC;IACL,CAAC;CACJ;AAzVD,8BAyVC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
exports.NodeRegistry = void 0;
|
|
12
|
+
const installed_packages_1 = __importDefault(require("installed-packages"));
|
|
13
|
+
const glob_1 = require("glob");
|
|
14
|
+
/* the node loader */
|
|
15
|
+
class NodeRegistry {
|
|
16
|
+
cli;
|
|
17
|
+
nodes = {};
|
|
18
|
+
constructor(cli) {
|
|
19
|
+
this.cli = cli;
|
|
20
|
+
}
|
|
21
|
+
/* node internal and external SpeechFlow nodes */
|
|
22
|
+
async load() {
|
|
23
|
+
/* load internal SpeechFlow nodes */
|
|
24
|
+
const pkgsI = await (0, glob_1.glob)("speechflow-node-*-*.js", {
|
|
25
|
+
cwd: __dirname,
|
|
26
|
+
ignore: {
|
|
27
|
+
ignored: (p) => p.name.endsWith("-wt.js")
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
for (const pkg of pkgsI) {
|
|
31
|
+
let node = await import(`./${pkg}`);
|
|
32
|
+
while (node.default !== undefined)
|
|
33
|
+
node = node.default;
|
|
34
|
+
if (typeof node === "function" && typeof node.name === "string") {
|
|
35
|
+
this.cli.log("info", `loading SpeechFlow node <${node.name}> from internal module`);
|
|
36
|
+
this.nodes[node.name] = node;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/* load external SpeechFlow nodes */
|
|
40
|
+
const pkgsE = await (0, installed_packages_1.default)();
|
|
41
|
+
for (const pkg of pkgsE) {
|
|
42
|
+
if (pkg.match(/^(?:@[^/]+\/)?speechflow-node-.+$/)) {
|
|
43
|
+
let node = await import(pkg);
|
|
44
|
+
while (node.default !== undefined)
|
|
45
|
+
node = node.default;
|
|
46
|
+
if (typeof node === "function" && typeof node.name === "string") {
|
|
47
|
+
if (this.nodes[node.name] !== undefined) {
|
|
48
|
+
this.cli.log("warning", `failed loading SpeechFlow node <${node.name}> ` +
|
|
49
|
+
`from external module "${pkg}" -- node already exists`);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
this.cli.log("info", `loading SpeechFlow node <${node.name}> from external module "${pkg}"`);
|
|
53
|
+
this.nodes[node.name] = node;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.NodeRegistry = NodeRegistry;
|
|
60
|
+
//# sourceMappingURL=speechflow-main-nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speechflow-main-nodes.js","sourceRoot":"","sources":["../src/speechflow-main-nodes.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;AAIF,4EAAkD;AAClD,+BAAoC;AAKpC,uBAAuB;AACvB,MAAa,YAAY;IAIT;IAHL,KAAK,GAA8C,EAAE,CAAA;IAE5D,YACY,GAAU;QAAV,QAAG,GAAH,GAAG,CAAO;IACnB,CAAC;IAEJ,mDAAmD;IACnD,KAAK,CAAC,IAAI;QACN,sCAAsC;QACtC,MAAM,KAAK,GAAG,MAAM,IAAA,WAAI,EAAC,wBAAwB,EAAE;YAC/C,GAAG,EAAE,SAAS;YACd,MAAM,EAAE;gBACJ,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;aAC5C;SACJ,CAAC,CAAA;QACF,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACtB,IAAI,IAAI,GAAQ,MAAM,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC,CAAA;YACxC,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS;gBAC7B,IAAI,GAAG,IAAI,CAAC,OAAO,CAAA;YACvB,IAAI,OAAO,IAAI,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC9D,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,4BAA4B,IAAI,CAAC,IAAI,wBAAwB,CAAC,CAAA;gBACnF,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAA6B,CAAA;YACzD,CAAC;QACL,CAAC;QAED,sCAAsC;QACtC,MAAM,KAAK,GAAG,MAAM,IAAA,4BAAiB,GAAE,CAAA;QACvC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACtB,IAAI,GAAG,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE,CAAC;gBACjD,IAAI,IAAI,GAAQ,MAAM,MAAM,CAAC,GAAG,CAAC,CAAA;gBACjC,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS;oBAC7B,IAAI,GAAG,IAAI,CAAC,OAAO,CAAA;gBACvB,IAAI,OAAO,IAAI,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC9D,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;wBACtC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,mCAAmC,IAAI,CAAC,IAAI,IAAI;4BACpE,yBAAyB,GAAG,0BAA0B,CAAC,CAAA;wBAC3D,SAAQ;oBACZ,CAAC;oBACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,4BAA4B,IAAI,CAAC,IAAI,2BAA2B,GAAG,GAAG,CAAC,CAAA;oBAC5F,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAA6B,CAAA;gBACzD,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AA7CD,oCA6CC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import CLIio from "cli-io";
|
|
3
|
+
import SpeechFlowNode from "./speechflow-node";
|
|
4
|
+
import { NodeConfig } from "./speechflow-main-config";
|
|
5
|
+
export declare class NodeStatusManager {
|
|
6
|
+
private cli;
|
|
7
|
+
constructor(cli: CLIio);
|
|
8
|
+
showNodeStatus(nodes: {
|
|
9
|
+
[id: string]: typeof SpeechFlowNode;
|
|
10
|
+
}, cfg: NodeConfig, accessBus: (name: string) => EventEmitter): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
exports.NodeStatusManager = void 0;
|
|
12
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
13
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
14
|
+
/* the node status manager */
|
|
15
|
+
class NodeStatusManager {
|
|
16
|
+
cli;
|
|
17
|
+
constructor(cli) {
|
|
18
|
+
this.cli = cli;
|
|
19
|
+
}
|
|
20
|
+
/* gather and show status of all nodes */
|
|
21
|
+
async showNodeStatus(nodes, cfg, accessBus) {
|
|
22
|
+
/* create CLI table */
|
|
23
|
+
const table = new cli_table3_1.default({
|
|
24
|
+
head: [
|
|
25
|
+
chalk_1.default.reset.bold("NODE"),
|
|
26
|
+
chalk_1.default.reset.bold("PROPERTY"),
|
|
27
|
+
chalk_1.default.reset.bold("VALUE")
|
|
28
|
+
],
|
|
29
|
+
colWidths: [15, 15, 50 - (2 * 2 + 2 * 3)],
|
|
30
|
+
style: { "padding-left": 1, "padding-right": 1, border: ["grey"], compact: true },
|
|
31
|
+
chars: { "left-mid": "", mid: "", "mid-mid": "", "right-mid": "" }
|
|
32
|
+
});
|
|
33
|
+
/* iterate over all nodes... */
|
|
34
|
+
for (const name of Object.keys(nodes)) {
|
|
35
|
+
/* instantiate node and query its status */
|
|
36
|
+
this.cli.log("info", `gathering status of node <${name}>`);
|
|
37
|
+
const node = new nodes[name](name, cfg, {}, []);
|
|
38
|
+
node._accessBus = accessBus;
|
|
39
|
+
const status = await Promise.race([
|
|
40
|
+
node.status(),
|
|
41
|
+
new Promise((resolve, reject) => setTimeout(() => reject(new Error("timeout")), 10 * 1000))
|
|
42
|
+
]).catch((err) => {
|
|
43
|
+
this.cli.log("warning", `[${node.id}]: failed to gather status of node <${node.id}>: ${err.message}`);
|
|
44
|
+
return {};
|
|
45
|
+
});
|
|
46
|
+
/* render output as a table row */
|
|
47
|
+
if (Object.keys(status).length > 0) {
|
|
48
|
+
let first = true;
|
|
49
|
+
for (const key of Object.keys(status)) {
|
|
50
|
+
table.push([first ? chalk_1.default.bold(name) : "", key, chalk_1.default.blue(status[key])]);
|
|
51
|
+
first = false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const output = table.toString();
|
|
56
|
+
process.stdout.write(output + "\n");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.NodeStatusManager = NodeStatusManager;
|
|
60
|
+
//# sourceMappingURL=speechflow-main-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speechflow-main-status.js","sourceRoot":"","sources":["../src/speechflow-main-status.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;AAOF,4DAA8C;AAC9C,kDAAyC;AAMzC,+BAA+B;AAC/B,MAAa,iBAAiB;IAEd;IADZ,YACY,GAAU;QAAV,QAAG,GAAH,GAAG,CAAO;IACnB,CAAC;IAEJ,2CAA2C;IAC3C,KAAK,CAAC,cAAc,CAChB,KAAoD,EACpD,GAAqB,EACrB,SAAyC;QAEzC,wBAAwB;QACxB,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;YACpB,IAAI,EAAE;gBACF,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;gBACxB,eAAK,CAAC,KAAK,CAAC,IAAI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