speechflow 2.3.1 → 2.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 (63) hide show
  1. package/.ase/service.log +10272 -0
  2. package/.claude/CLAUDE.md +1 -0
  3. package/AGENTS.md +1 -1
  4. package/CHANGELOG.md +10 -0
  5. package/README.md +10 -37
  6. package/package.json +6 -6
  7. package/speechflow-cli/dst/speechflow-main-graph.js +14 -5
  8. package/speechflow-cli/dst/speechflow-main-graph.js.map +1 -1
  9. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.d.ts +7 -0
  10. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js +145 -62
  11. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js.map +1 -1
  12. package/speechflow-cli/dst/speechflow-node-a2t-google.js +10 -4
  13. package/speechflow-cli/dst/speechflow-node-a2t-google.js.map +1 -1
  14. package/speechflow-cli/dst/speechflow-node-a2t-openai.js +10 -4
  15. package/speechflow-cli/dst/speechflow-node-a2t-openai.js.map +1 -1
  16. package/speechflow-cli/dst/{speechflow-node-t2t-spellcheck.d.ts → speechflow-node-t2t-proofread.d.ts} +1 -1
  17. package/speechflow-cli/dst/{speechflow-node-t2t-spellcheck.js → speechflow-node-t2t-proofread.js} +38 -54
  18. package/speechflow-cli/dst/speechflow-node-t2t-proofread.js.map +1 -0
  19. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js +44 -11
  20. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js.map +1 -1
  21. package/speechflow-cli/dst/speechflow-node-t2t-summary.js +1 -1
  22. package/speechflow-cli/dst/speechflow-node-t2t-summary.js.map +1 -1
  23. package/speechflow-cli/dst/speechflow-node-t2t-translate.js +1 -1
  24. package/speechflow-cli/dst/speechflow-node-t2t-translate.js.map +1 -1
  25. package/speechflow-cli/dst/speechflow-node-xio-device.js +4 -1
  26. package/speechflow-cli/dst/speechflow-node-xio-device.js.map +1 -1
  27. package/speechflow-cli/dst/speechflow-node-xio-exec.js +4 -1
  28. package/speechflow-cli/dst/speechflow-node-xio-exec.js.map +1 -1
  29. package/speechflow-cli/dst/speechflow-util-llm.d.ts +1 -0
  30. package/speechflow-cli/dst/speechflow-util-llm.js +6 -2
  31. package/speechflow-cli/dst/speechflow-util-llm.js.map +1 -1
  32. package/speechflow-cli/dst/speechflow-util-misc.js +28 -14
  33. package/speechflow-cli/dst/speechflow-util-misc.js.map +1 -1
  34. package/speechflow-cli/dst/speechflow.js.map +1 -1
  35. package/speechflow-cli/etc/oxlint.jsonc +9 -2
  36. package/speechflow-cli/package.d/{@typescript-eslint+typescript-estree+8.57.2.patch → @typescript-eslint+typescript-estree+8.59.3.patch} +1 -1
  37. package/speechflow-cli/package.json +30 -30
  38. package/speechflow-cli/src/speechflow-main-graph.ts +14 -5
  39. package/speechflow-cli/src/speechflow-node-a2t-deepgram.ts +156 -66
  40. package/speechflow-cli/src/speechflow-node-a2t-google.ts +10 -4
  41. package/speechflow-cli/src/speechflow-node-a2t-openai.ts +10 -4
  42. package/speechflow-cli/src/{speechflow-node-t2t-spellcheck.ts → speechflow-node-t2t-proofread.ts} +46 -59
  43. package/speechflow-cli/src/speechflow-node-t2t-summary.ts +1 -1
  44. package/speechflow-cli/src/speechflow-node-t2t-translate.ts +1 -1
  45. package/speechflow-cli/src/speechflow-node-xio-device.ts +4 -1
  46. package/speechflow-cli/src/speechflow-node-xio-exec.ts +4 -1
  47. package/speechflow-cli/src/speechflow-util-llm.ts +7 -2
  48. package/speechflow-cli/src/speechflow-util-misc.ts +33 -16
  49. package/speechflow-cli/src/speechflow.ts +1 -0
  50. package/speechflow-ui-db/dst/index.js +19 -16
  51. package/speechflow-ui-db/etc/oxlint.jsonc +0 -1
  52. package/speechflow-ui-db/package.d/{@typescript-eslint+typescript-estree+8.57.2.patch → @typescript-eslint+typescript-estree+8.59.3.patch} +1 -1
  53. package/speechflow-ui-db/package.json +15 -15
  54. package/speechflow-ui-st/dst/index.js +33 -33
  55. package/speechflow-ui-st/etc/oxlint.jsonc +2 -2
  56. package/speechflow-ui-st/package.d/{@typescript-eslint+typescript-estree+8.57.2.patch → @typescript-eslint+typescript-estree+8.59.3.patch} +1 -1
  57. package/speechflow-ui-st/package.json +15 -15
  58. package/.claude/settings.local.json +0 -3
  59. package/speechflow-cli/dst/speechflow-node-t2t-punctuation.d.ts +0 -13
  60. package/speechflow-cli/dst/speechflow-node-t2t-punctuation.js +0 -219
  61. package/speechflow-cli/dst/speechflow-node-t2t-punctuation.js.map +0 -1
  62. package/speechflow-cli/dst/speechflow-node-t2t-spellcheck.js.map +0 -1
  63. package/speechflow-cli/src/speechflow-node-t2t-punctuation.ts +0 -200
@@ -0,0 +1 @@
1
+ @../AGENTS.md
package/AGENTS.md CHANGED
@@ -24,7 +24,7 @@ SpeechFlow uses a modular node-based architecture with three main components:
24
24
  - **Input/Output (xio)**: file, device, websocket, mqtt, vban, webrtc, exec
25
25
  - **Audio-to-Audio (a2a)**: ffmpeg, wav, mute, meter, vad, gender, gain, filler, compressor, expander, rnnoise, speex, pitch
26
26
  - **Audio-to-Text (a2t)**: deepgram, amazon, openai, google
27
- - **Text-to-Text (t2t)**: deepl, google, amazon, subtitle, format, sentence, modify, punctuation, profanity, opus, translate, spellcheck, summary
27
+ - **Text-to-Text (t2t)**: deepl, google, amazon, subtitle, format, sentence, modify, profanity, opus, translate, proofread, summary
28
28
  - **Text-to-Audio (t2a)**: elevenlabs, kokoro, amazon, supertonic, openai, google
29
29
  - **Any-to-Any (x2x)**: filter, trace
30
30
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
  hangeLog
3
3
  =========
4
4
 
5
+ 2.4.0 (2026-05-15)
6
+ ------------------
7
+
8
+ - IMPROVEMENT: add "suspended" option and internal suspended operation mode to "a2t-deepgram" node
9
+ - REFACTOR: merge "spellcheck" and "punctuation" nodes into new all-in-one "proofread" node
10
+ - BUGFIX: make stream graph processing more robust why not emitting errors from nodes directly
11
+ - BUGFIX: fix stream graph management: handle correctly terminal Duplex stream nodes
12
+ - UPDATE: update from Gemma 3 to Gemma 4 in four nodes
13
+ - UPDATE: upgrade NPM dependencies and patches
14
+
5
15
  2.3.1 (2026-03-27)
6
16
  ------------------
7
17
 
package/README.md CHANGED
@@ -374,8 +374,7 @@ First a short overview of the available processing nodes:
374
374
  **t2t-opus**,
375
375
  **t2t-google**,
376
376
  **t2t-translate**,
377
- **t2t-spellcheck**,
378
- **t2t-punctuation**,
377
+ **t2t-proofread**,
379
378
  **t2t-modify**,
380
379
  **t2t-profanity**,
381
380
  **t2t-summary**,
@@ -1042,16 +1041,16 @@ The following nodes process text chunks only.
1042
1041
  | **model** | *none* | "gemma3:4b-it-q4\_K\_M" | *none* |
1043
1042
  | **key** | *none* | "" | *none* |
1044
1043
 
1045
- - Node: **t2t-spellcheck**<br/>
1046
- Purpose: **LLM-based Text-to-Text spellchecking**<br/>
1047
- Example: `t2t-spellcheck(lang: "en")`<br/>
1044
+ - Node: **t2t-proofread**<br/>
1045
+ Purpose: **LLM-based Text-to-Text proofreading**<br/>
1046
+ Example: `t2t-proofread(lang: "en")`<br/>
1048
1047
  Notice: this node requires an LLM provider (Ollama by default, or cloud-based OpenAI/Anthropic/Google, or local HuggingFace Transformers)!
1049
1048
 
1050
- > This node performs spellchecking of English or German text using an
1051
- > LLM service. It corrects spelling mistakes, adds missing punctuation,
1052
- > but preserves grammar and word choice. Multiple LLM providers are
1053
- > supported: local Ollama (default), local HuggingFace Transformers,
1054
- > or cloud-based OpenAI, Anthropic, or Google.
1049
+ > This node performs proofreading of English or German text using an
1050
+ > LLM service. It corrects spelling, punctuation and grammar in a
1051
+ > single pass. Multiple LLM providers are supported: local Ollama
1052
+ > (default), local HuggingFace Transformers, or cloud-based OpenAI,
1053
+ > Anthropic, or Google.
1055
1054
 
1056
1055
  | Port | Payload |
1057
1056
  | ------- | ----------- |
@@ -1063,33 +1062,7 @@ The following nodes process text chunks only.
1063
1062
  | **lang** | 0 | "en" | `/^(?:en\|de)$/` |
1064
1063
  | **provider** | *none* | "ollama" | `/^(?:openai\|anthropic\|google\|ollama\|transformers)$/` |
1065
1064
  | **api** | *none* | "http://127.0.0.1:11434" | `/^https?:\/\/.+?(:\d+)?$/` |
1066
- | **model** | *none* | "gemma3:4b-it-q4\_K\_M" | *none* |
1067
- | **key** | *none* | "" | *none* |
1068
-
1069
- - Node: **t2t-punctuation**<br/>
1070
- Purpose: **LLM-based punctuation restoration**<br/>
1071
- Example: `t2t-punctuation(lang: "en")`<br/>
1072
- Notice: this node requires an LLM provider (Ollama by default, or cloud-based OpenAI/Anthropic/Google, or local HuggingFace Transformers)!
1073
-
1074
- > This node performs punctuation restoration using an LLM service.
1075
- > It adds missing punctuation marks (periods, commas, question marks,
1076
- > exclamation marks, colons, semicolons) and capitalizes the first
1077
- > letters of sentences. It preserves all original words exactly as they
1078
- > are without spelling corrections or grammar changes. Multiple LLM
1079
- > providers are supported: local Ollama (default), local HuggingFace
1080
- > Transformers, or cloud-based OpenAI, Anthropic, or Google.
1081
-
1082
- | Port | Payload |
1083
- | ------- | ----------- |
1084
- | input | text |
1085
- | output | text |
1086
-
1087
- | Parameter | Position | Default | Requirement |
1088
- | ------------ | --------- | ------------------------ | ---------------------------------------- |
1089
- | **lang** | 0 | "en" | `/^(?:en\|de)$/` |
1090
- | **provider** | *none* | "ollama" | `/^(?:openai\|anthropic\|google\|ollama\|transformers)$/` |
1091
- | **api** | *none* | "http://127.0.0.1:11434" | `/^https?:\/\/.+?(:\d+)?$/` |
1092
- | **model** | *none* | "gemma3:4b-it-q4\_K\_M" | *none* |
1065
+ | **model** | *none* | "gemma4:e4b" | *none* |
1093
1066
  | **key** | *none* | "" | *none* |
1094
1067
 
1095
1068
  - Node: **t2t-modify**<br/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speechflow",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "x-stdver": "2.3.1-GA",
5
5
  "x-release": "2026-03-27",
6
6
  "homepage": "https://github.com/rse/speechflow",
@@ -17,17 +17,17 @@
17
17
  "url": "git+https://github.com/rse/speechflow.git"
18
18
  },
19
19
  "dependencies": {
20
- "@rse/stx": "1.1.4"
20
+ "@rse/stx": "1.1.5"
21
21
  },
22
22
  "devDependencies": {
23
23
  "nodemon": "3.1.14",
24
24
  "watch": "1.0.2",
25
- "concurrently": "9.2.1",
26
- "wait-on": "9.0.4",
25
+ "concurrently": "10.0.0",
26
+ "wait-on": "9.0.10",
27
27
  "cross-env": "10.1.0",
28
28
  "shx": "0.4.0",
29
- "secretlint": "11.4.0",
30
- "@secretlint/secretlint-rule-preset-recommend": "11.4.0"
29
+ "secretlint": "13.0.2",
30
+ "@secretlint/secretlint-rule-preset-recommend": "13.0.2"
31
31
  },
32
32
  "engines": {
33
33
  "npm": ">=10.0.0",
@@ -244,14 +244,23 @@ class NodeGraph {
244
244
  api.sendErrorToDashboard(Date.now(), node.id, "warning", error.message);
245
245
  });
246
246
  /* listen for the semantically correct completion event per stream type:
247
- - for Duplex/Transform listen only for "end"
247
+ - for Duplex/Transform with downstream consumers listen only for "end"
248
248
  (readable-side, fires last, guarantees all output is drained),
249
+ - for Duplex/Transform without downstream consumers (terminal writers,
250
+ e.g. Stream.compose(transform, writable)) listen for "finish",
251
+ since the readable side is never consumed and "end" never fires,
249
252
  - for pure Readable listen only for "end"
250
253
  - for pure Writable listen only for "finish" */
251
- if (node.stream instanceof node_stream_1.default.Duplex)
252
- node.stream.on("end", () => {
253
- deactivateNode(node, `readable stream side (output) of node <${node.id}> raised "end" event`);
254
- });
254
+ if (node.stream instanceof node_stream_1.default.Duplex) {
255
+ if (node.connectionsOut.size > 0)
256
+ node.stream.on("end", () => {
257
+ deactivateNode(node, `readable stream side (output) of node <${node.id}> raised "end" event`);
258
+ });
259
+ else
260
+ node.stream.on("finish", () => {
261
+ deactivateNode(node, `writable stream side (input) of node <${node.id}> raised "finish" event`);
262
+ });
263
+ }
255
264
  else if (node.stream instanceof node_stream_1.default.Readable)
256
265
  node.stream.on("end", () => {
257
266
  deactivateNode(node, `readable stream side (output) of node <${node.id}> raised "end" event`);
@@ -1 +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,GAAsB,IAAI,GAAG,EAAkB,CAAA;IACzD,WAAW,GAAqB,IAAI,GAAG,EAAkB,CAAA;IACzD,YAAY,GAAoB,IAAI,0BAAY,EAAE,CAAA;IAClD,QAAQ,GAAwB,IAAI,CAAA;IACpC,YAAY,GAAoB,KAAK,CAAA;IAE7C,2BAA2B;IAC3B,YACY,GAAU,EACV,QAAQ,KAAK;QADb,QAAG,GAAH,GAAG,CAAO;QACV,UAAK,GAAL,KAAK,CAAQ;IACtB,CAAC;IAEJ,2BAA2B;IAC3B,aAAa;QACT,OAAO,IAAI,CAAC,UAAU,CAAA;IAC1B,CAAC;IAED,kCAAkC;IAClC,aAAa,CAAE,IAAY;QACvB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,CAAA;IACvE,CAAC;IAED,2EAA2E;IAC3E,KAAK,CAAC,qBAAqB,CACvB,MAAiB,EACjB,KAAoD,EACpD,GAAqB,EACrB,SAAoC,EACpC,SAAyC;QAEzC,qDAAqD;QACrD,MAAM,gBAAgB,GAAG,CAAC,GAAY,EAAU,EAAE,CAC9C,GAAG,YAAY,KAAK,IAAI,GAAG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IAAI,CAAC,UAAU,EAAE,CAAA;QACvB,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;AAnaD,8BAmaC"}
@@ -3,13 +3,20 @@ export default class SpeechFlowNodeA2TDeepgram extends SpeechFlowNode {
3
3
  static name: string;
4
4
  private dg;
5
5
  private closing;
6
+ private reconfiguring;
6
7
  private connectionTimeout;
7
8
  private queue;
9
+ private metastore;
10
+ private suspended;
8
11
  constructor(id: string, cfg: {
9
12
  [id: string]: any;
10
13
  }, opts: {
11
14
  [id: string]: any;
12
15
  }, args: any[]);
16
+ receiveRequest(params: any[]): Promise<void>;
17
+ setSuspended(suspended: boolean): Promise<void>;
18
+ private openConnection;
19
+ private closeConnection;
13
20
  status(): Promise<{
14
21
  balance: string;
15
22
  }>;
@@ -56,8 +56,11 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
56
56
  /* internal state */
57
57
  dg = null;
58
58
  closing = false;
59
+ reconfiguring = false;
59
60
  connectionTimeout = null;
60
61
  queue = null;
62
+ metastore = null;
63
+ suspended = false;
61
64
  /* construct node */
62
65
  constructor(id, cfg, opts, args) {
63
66
  super(id, cfg, opts, args);
@@ -70,7 +73,8 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
70
73
  language: { type: "string", val: "multi", pos: 2 },
71
74
  interim: { type: "boolean", val: false, pos: 3 },
72
75
  endpointing: { type: "number", val: 0, pos: 4 },
73
- keywords: { type: "string", val: "", pos: 5 }
76
+ keywords: { type: "string", val: "", pos: 5 },
77
+ suspended: { type: "boolean", val: false, pos: 6 }
74
78
  });
75
79
  /* sanity check parameters */
76
80
  if (!this.params.key)
@@ -79,38 +83,53 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
79
83
  this.input = "audio";
80
84
  this.output = "text";
81
85
  }
82
- /* one-time status of node */
83
- async status() {
84
- let balance = 0;
86
+ /* receive external request */
87
+ async receiveRequest(params) {
88
+ if (this.closing)
89
+ throw new Error("deepgram: node already destroyed");
85
90
  try {
86
- const deepgram = Deepgram.createClient(this.params.keyAdm);
87
- const response = await deepgram.manage.getProjects();
88
- if (response !== null && response.error === null && response.result?.projects) {
89
- for (const project of response.result.projects) {
90
- const balanceResponse = await deepgram.manage.getProjectBalances(project.project_id);
91
- if (balanceResponse !== null && balanceResponse.error === null && balanceResponse.result?.balances)
92
- balance += balanceResponse.result.balances[0]?.amount ?? 0;
93
- }
91
+ if (params.length === 2 && params[0] === "suspended") {
92
+ if (typeof params[1] !== "boolean")
93
+ throw new Error("deepgram: invalid suspended argument in external request");
94
+ const suspended = params[1];
95
+ await this.setSuspended(suspended);
96
+ this.sendResponse(["deepgram", "suspended", suspended]);
94
97
  }
95
- else if (response !== null && response.error !== null)
96
- this.log("warning", `API error fetching projects: ${response.error}`);
98
+ else
99
+ throw new Error("deepgram: invalid arguments in external request");
97
100
  }
98
101
  catch (error) {
99
- this.log("warning", `failed to fetch balance: ${error}`);
102
+ this.log("error", `receive request error: ${error}`);
103
+ throw error;
100
104
  }
101
- return { balance: balance.toFixed(2) };
102
105
  }
103
- /* open node */
104
- async open() {
105
- /* sanity check situation */
106
- if (this.config.audioBitDepth !== 16 || !this.config.audioLittleEndian)
107
- throw new Error("Deepgram node currently supports PCM-S16LE audio only");
108
- /* clear destruction flag */
109
- this.closing = false;
110
- /* create queue for results */
111
- this.queue = new util.AsyncQueue();
112
- /* create a store for the meta information */
113
- const metastore = new util.TimeStore();
106
+ /* change suspended flag */
107
+ async setSuspended(suspended) {
108
+ if (this.closing) {
109
+ this.log("warning", "attempted to set suspended flag on destroyed node");
110
+ return;
111
+ }
112
+ if (suspended === this.suspended)
113
+ return;
114
+ this.log("info", `switching to ${suspended ? "SUSPENDED" : "UNSUSPENDED"} operation`);
115
+ this.suspended = suspended;
116
+ if (suspended) {
117
+ /* going suspended -- tear down Deepgram API connection */
118
+ this.reconfiguring = true;
119
+ try {
120
+ await this.closeConnection();
121
+ }
122
+ finally {
123
+ this.reconfiguring = false;
124
+ }
125
+ }
126
+ else {
127
+ /* going unsuspended -- re-establish Deepgram API connection */
128
+ await this.openConnection();
129
+ }
130
+ }
131
+ /* open Deepgram API connection */
132
+ async openConnection() {
114
133
  /* configure Deepgram connection options */
115
134
  const interim = this.params.interim;
116
135
  const endpointing = this.params.endpointing;
@@ -159,7 +178,7 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
159
178
  this.dg = deepgram.listen.live(options);
160
179
  /* hook onto Deepgram API events */
161
180
  this.dg.on(Deepgram.LiveTranscriptionEvents.Transcript, async (data) => {
162
- if (this.closing || this.queue === null)
181
+ if (this.closing || this.queue === null || this.metastore === null)
163
182
  return;
164
183
  const text = (data.channel?.alternatives[0]?.transcript ?? "");
165
184
  const words = (data.channel?.alternatives[0]?.words ?? []);
@@ -174,12 +193,12 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
174
193
  `"${text}"`);
175
194
  const start = luxon_1.Duration.fromMillis(data.start * 1000).plus(this.timeZeroOffset);
176
195
  const end = start.plus({ seconds: data.duration });
177
- const metas = metastore.fetch(start, end);
196
+ const metas = this.metastore.fetch(start, end);
178
197
  const meta = metas.toReversed().reduce((prev, curr) => {
179
198
  curr.forEach((val, key) => { prev.set(key, val); });
180
199
  return prev;
181
200
  }, new Map());
182
- metastore.prune(start);
201
+ this.metastore.prune(start);
183
202
  meta.set("words", words.map((word) => {
184
203
  const start = luxon_1.Duration.fromMillis(word.start * 1000).plus(this.timeZeroOffset);
185
204
  const end = luxon_1.Duration.fromMillis(word.end * 1000).plus(this.timeZeroOffset);
@@ -200,15 +219,12 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
200
219
  });
201
220
  this.dg.on(Deepgram.LiveTranscriptionEvents.Close, () => {
202
221
  this.log("info", "connection close");
203
- if (!this.closing && this.queue !== null)
222
+ /* NOTICE: suppress EOF signalling while reconfiguring (mute toggle),
223
+ since the connection is being torn down deliberately and the
224
+ graph must keep running */
225
+ if (!this.closing && !this.reconfiguring && this.queue !== null)
204
226
  this.queue.write(null);
205
227
  });
206
- this.dg.on(Deepgram.LiveTranscriptionEvents.Error, (error) => {
207
- this.log("error", `error: ${error.message}`);
208
- if (!this.closing && this.queue !== null)
209
- this.queue.write(null);
210
- this.emit("error", error);
211
- });
212
228
  /* wait for Deepgram API to be available */
213
229
  await new Promise((resolve, reject) => {
214
230
  this.connectionTimeout = setTimeout(() => {
@@ -233,6 +249,80 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
233
249
  reject(err);
234
250
  });
235
251
  });
252
+ /* NOTICE: register permanent Error handler only AFTER the open
253
+ handshake -- during open, the transient .once above is the sole
254
+ Error listener so the caller's promise rejects without a parallel
255
+ stream emission tearing down the graph prematurely. */
256
+ this.dg.on(Deepgram.LiveTranscriptionEvents.Error, (error) => {
257
+ this.log("warning", `error: ${error.message}`);
258
+ /* NOTICE: do not write null to the queue here -- a transient error
259
+ must not be misinterpreted as end-of-stream by downstream nodes;
260
+ the subsequent Deepgram Close event will signal real EOF. Also
261
+ do not emit("error") on the node itself, since nothing listens
262
+ for it and it would become an uncaughtException tearing down
263
+ the whole graph. Route via the stream instead, where it is
264
+ downgraded to a warning by the graph supervisor. */
265
+ if (!this.closing && this.stream !== null)
266
+ this.stream.emit("error", error);
267
+ });
268
+ }
269
+ /* close Deepgram API connection */
270
+ async closeConnection() {
271
+ /* cleanup pending connection timer */
272
+ if (this.connectionTimeout !== null) {
273
+ clearTimeout(this.connectionTimeout);
274
+ this.connectionTimeout = null;
275
+ }
276
+ /* close Deepgram connection and remove listeners */
277
+ if (this.dg !== null) {
278
+ try {
279
+ this.dg.removeAllListeners();
280
+ this.dg.requestClose();
281
+ this.log("info", "connection closed");
282
+ }
283
+ catch (error) {
284
+ this.log("warning", `error during Deepgram cleanup: ${error}`);
285
+ }
286
+ this.dg = null;
287
+ }
288
+ }
289
+ /* one-time status of node */
290
+ async status() {
291
+ let balance = 0;
292
+ try {
293
+ const deepgram = Deepgram.createClient(this.params.keyAdm);
294
+ const response = await deepgram.manage.getProjects();
295
+ if (response !== null && response.error === null && response.result?.projects) {
296
+ for (const project of response.result.projects) {
297
+ const balanceResponse = await deepgram.manage.getProjectBalances(project.project_id);
298
+ if (balanceResponse !== null && balanceResponse.error === null && balanceResponse.result?.balances)
299
+ balance += balanceResponse.result.balances[0]?.amount ?? 0;
300
+ }
301
+ }
302
+ else if (response !== null && response.error !== null)
303
+ this.log("warning", `API error fetching projects: ${response.error}`);
304
+ }
305
+ catch (error) {
306
+ this.log("warning", `failed to fetch balance: ${error}`);
307
+ }
308
+ return { balance: balance.toFixed(2) };
309
+ }
310
+ /* open node */
311
+ async open() {
312
+ /* sanity check situation */
313
+ if (this.config.audioBitDepth !== 16 || !this.config.audioLittleEndian)
314
+ throw new Error("Deepgram node currently supports PCM-S16LE audio only");
315
+ /* clear destruction flag */
316
+ this.closing = false;
317
+ /* create queue for results */
318
+ this.queue = new util.AsyncQueue();
319
+ /* create a store for the meta information */
320
+ this.metastore = new util.TimeStore();
321
+ /* determine initial suspended state from configuration */
322
+ this.suspended = this.params.suspended;
323
+ /* establish Deepgram API connection (unless starting suspended) */
324
+ if (!this.suspended)
325
+ await this.openConnection();
236
326
  /* remember opening time to receive time zero offset */
237
327
  this.timeOpen = luxon_1.DateTime.now();
238
328
  /* provide Duplex stream and internally attach to Deepgram API */
@@ -244,7 +334,7 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
244
334
  decodeStrings: false,
245
335
  highWaterMark: 1,
246
336
  write(chunk, encoding, callback) {
247
- if (self.closing || self.dg === null) {
337
+ if (self.closing) {
248
338
  callback(new Error("stream already destroyed"));
249
339
  return;
250
340
  }
@@ -252,11 +342,14 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
252
342
  callback(new Error("expected audio input chunk"));
253
343
  else if (!Buffer.isBuffer(chunk.payload))
254
344
  callback(new Error("expected Buffer input chunk"));
345
+ else if (self.suspended || self.dg === null)
346
+ /* drop audio entirely -- do not forward to Deepgram */
347
+ callback();
255
348
  else {
256
349
  if (chunk.payload.byteLength > 0) {
257
350
  self.log("debug", `send data (${chunk.payload.byteLength} bytes)`);
258
- if (chunk.meta.size > 0)
259
- metastore.store(chunk.timestampStart, chunk.timestampEnd, chunk.meta);
351
+ if (chunk.meta.size > 0 && self.metastore !== null)
352
+ self.metastore.store(chunk.timestampStart, chunk.timestampEnd, chunk.meta);
260
353
  try {
261
354
  /* send buffer (and intentionally discard all time information) */
262
355
  self.dg.send(chunk.payload.buffer.slice(chunk.payload.byteOffset, chunk.payload.byteOffset + chunk.payload.byteLength));
@@ -271,16 +364,18 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
271
364
  },
272
365
  async final(callback) {
273
366
  /* short-circuiting in case of own closing */
274
- if (self.closing || self.dg === null) {
367
+ if (self.closing) {
275
368
  callback();
276
369
  return;
277
370
  }
278
371
  /* close Deepgram API */
279
- try {
280
- self.dg.requestClose();
281
- }
282
- catch (error) {
283
- self.log("warning", `error closing Deepgram connection: ${error}`);
372
+ if (self.dg !== null) {
373
+ try {
374
+ self.dg.requestClose();
375
+ }
376
+ catch (error) {
377
+ self.log("warning", `error closing Deepgram connection: ${error}`);
378
+ }
284
379
  }
285
380
  /* await all read operations */
286
381
  await reads.awaitAll();
@@ -316,32 +411,20 @@ class SpeechFlowNodeA2TDeepgram extends speechflow_node_1.default {
316
411
  async close() {
317
412
  /* indicate closing first to stop all async operations */
318
413
  this.closing = true;
319
- /* cleanup all timers */
320
- if (this.connectionTimeout !== null) {
321
- clearTimeout(this.connectionTimeout);
322
- this.connectionTimeout = null;
323
- }
324
414
  /* shutdown stream */
325
415
  if (this.stream !== null) {
326
416
  await util.destroyStream(this.stream);
327
417
  this.stream = null;
328
418
  }
329
- /* close Deepgram connection and remove listeners */
330
- if (this.dg !== null) {
331
- try {
332
- this.dg.removeAllListeners();
333
- this.dg.requestClose();
334
- }
335
- catch (error) {
336
- this.log("warning", `error during Deepgram cleanup: ${error}`);
337
- }
338
- this.dg = null;
339
- }
419
+ /* close Deepgram API connection */
420
+ await this.closeConnection();
340
421
  /* signal EOF to any pending read operations */
341
422
  if (this.queue !== null) {
342
423
  this.queue.write(null);
343
424
  this.queue = null;
344
425
  }
426
+ /* discard meta information store */
427
+ this.metastore = null;
345
428
  }
346
429
  }
347
430
  exports.default = SpeechFlowNodeA2TDeepgram;