superbased 1.4.0 → 1.5.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.
@@ -2,6 +2,10 @@
2
2
  // Azure Speech Services real-time transcription via WebSocket.
3
3
  // Uses the microsoft-cognitiveservices-speech-sdk with PushAudioInputStream
4
4
  // for streaming audio from the renderer process.
5
+ //
6
+ // Performance: the recognizer and WebSocket are kept alive between dictation
7
+ // sessions (persistent mode). Only the push stream is closed/reopened per
8
+ // session. This eliminates the ~700ms reconnect + phrase re-attach cost.
5
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -44,6 +48,7 @@ exports.startRealtimeRecognition = startRealtimeRecognition;
44
48
  exports.pushAudioData = pushAudioData;
45
49
  exports.startPreBuffering = startPreBuffering;
46
50
  exports.stopRealtimeRecognition = stopRealtimeRecognition;
51
+ exports.shutdownRecognizer = shutdownRecognizer;
47
52
  exports.isRealtimeRunning = isRealtimeRunning;
48
53
  exports.extractRegionFromEndpoint = extractRegionFromEndpoint;
49
54
  const fs = __importStar(require("fs"));
@@ -56,6 +61,14 @@ let recognizer = null;
56
61
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
62
  let pushStream = null;
58
63
  let isRunning = false;
64
+ // Pre-warmed recognizer: created in background after each session ends,
65
+ // ready for instant use on the next dictation.
66
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
+ let standbyRecognizer = null;
68
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+ let standbyPushStream = null;
70
+ let standbyReady = false;
71
+ let lastConfig = null;
59
72
  // Accumulate final results across multiple recognized events
60
73
  let finalText = '';
61
74
  // Last accepted recognized text — used to skip exact duplicates that Azure
@@ -115,50 +128,7 @@ function loadBundledPhraseList() {
115
128
  cachedPhraseList = [];
116
129
  return cachedPhraseList;
117
130
  }
118
- async function startRealtimeRecognition(subscriptionKey, region, language, callbacks, timing, extraPhrases) {
119
- const speechSdk = await loadSdk();
120
- if (isRunning) {
121
- logger_1.default.warn('[AzureSpeechRT] Already running, stopping previous session');
122
- await stopRealtimeRecognition();
123
- }
124
- finalText = '';
125
- lastRecognized = '';
126
- // Create speech config
127
- const speechConfig = speechSdk.SpeechConfig.fromSubscription(subscriptionKey, region);
128
- speechConfig.speechRecognitionLanguage = language || 'en-US';
129
- speechConfig.enableDictation(); // Optimizes for dictation: better punctuation, handles longer pauses
130
- // Silence timeouts — configurable via Settings > Dictation > Advanced
131
- const endSilence = timing?.endSilenceMs ?? 5000;
132
- const initialSilence = timing?.initialSilenceMs ?? 15000;
133
- const segSilence = timing?.segmentationSilenceMs ?? 3000;
134
- speechConfig.setProperty('speechServiceConnection_endSilenceTimeoutMs', String(endSilence));
135
- speechConfig.setProperty('speechServiceConnection_initialSilenceTimeoutMs', String(initialSilence));
136
- speechConfig.setProperty('Speech_SegmentationSilenceTimeoutMs', String(segSilence));
137
- // Create push stream — expects 16kHz, 16-bit, mono PCM
138
- const format = speechSdk.AudioStreamFormat.getWaveFormatPCM(16000, 16, 1);
139
- pushStream = speechSdk.AudioInputStream.createPushStream(format);
140
- // Create audio config from push stream
141
- const audioConfig = speechSdk.AudioConfig.fromStreamInput(pushStream);
142
- // Create recognizer
143
- recognizer = new speechSdk.SpeechRecognizer(speechConfig, audioConfig);
144
- // Attach a phrase list grammar to boost recognition of technical terms.
145
- // Combines the bundled curated list (~600 dev/cloud/AI terms) with any
146
- // caller-supplied extras (typically the user's personal dictionary).
147
- // Azure caps a single grammar at 1024 phrases per session.
148
- try {
149
- const bundled = loadBundledPhraseList();
150
- const merged = mergePhrases(bundled, extraPhrases || []);
151
- if (merged.length > 0) {
152
- const phraseList = speechSdk.PhraseListGrammar.fromRecognizer(recognizer);
153
- for (const phrase of merged) {
154
- phraseList.addPhrase(phrase);
155
- }
156
- logger_1.default.info(`[AzureSpeechRT] Attached ${merged.length} phrases (bundled=${bundled.length}, extra=${extraPhrases?.length || 0})`);
157
- }
158
- }
159
- catch (err) {
160
- logger_1.default.warn('[AzureSpeechRT] Failed to attach phrase list:', err);
161
- }
131
+ function attachRecognizerEvents(speechSdk, callbacks) {
162
132
  // Intermediate results — updates as user speaks
163
133
  recognizer.recognizing = (_sender, e) => {
164
134
  if (e.result.text) {
@@ -222,6 +192,70 @@ async function startRealtimeRecognition(subscriptionKey, region, language, callb
222
192
  callbacks.onError(`Recognition error: ${e.errorDetails}`);
223
193
  }
224
194
  };
195
+ }
196
+ async function startRealtimeRecognition(subscriptionKey, region, language, callbacks, timing, extraPhrases) {
197
+ const speechSdk = await loadSdk();
198
+ // If a pre-warmed standby recognizer is ready, use it instantly.
199
+ // It was created in the background after the previous session ended.
200
+ if (standbyReady && standbyRecognizer && standbyPushStream) {
201
+ logger_1.default.info('[AzureSpeechRT] Using pre-warmed standby recognizer (instant)');
202
+ recognizer = standbyRecognizer;
203
+ pushStream = standbyPushStream;
204
+ standbyRecognizer = null;
205
+ standbyPushStream = null;
206
+ standbyReady = false;
207
+ finalText = '';
208
+ lastRecognized = '';
209
+ attachRecognizerEvents(speechSdk, callbacks);
210
+ isRunning = true;
211
+ flushPreBuffer();
212
+ return;
213
+ }
214
+ if (isRunning) {
215
+ logger_1.default.warn('[AzureSpeechRT] Already running, stopping previous session');
216
+ await stopRealtimeRecognition();
217
+ }
218
+ finalText = '';
219
+ lastRecognized = '';
220
+ // Create speech config
221
+ const speechConfig = speechSdk.SpeechConfig.fromSubscription(subscriptionKey, region);
222
+ speechConfig.speechRecognitionLanguage = language || 'en-US';
223
+ speechConfig.enableDictation(); // Optimizes for dictation: better punctuation, handles longer pauses
224
+ // Silence timeouts — configurable via Settings > Dictation > Advanced
225
+ const endSilence = timing?.endSilenceMs ?? 5000;
226
+ const initialSilence = timing?.initialSilenceMs ?? 15000;
227
+ const segSilence = timing?.segmentationSilenceMs ?? 3000;
228
+ speechConfig.setProperty('speechServiceConnection_endSilenceTimeoutMs', String(endSilence));
229
+ speechConfig.setProperty('speechServiceConnection_initialSilenceTimeoutMs', String(initialSilence));
230
+ speechConfig.setProperty('Speech_SegmentationSilenceTimeoutMs', String(segSilence));
231
+ // Save config for pre-warming the next standby recognizer
232
+ lastConfig = { key: subscriptionKey, region, language, timing, phrases: extraPhrases };
233
+ // Create push stream — expects 16kHz, 16-bit, mono PCM
234
+ const format = speechSdk.AudioStreamFormat.getWaveFormatPCM(16000, 16, 1);
235
+ pushStream = speechSdk.AudioInputStream.createPushStream(format);
236
+ // Create audio config from push stream
237
+ const audioConfig = speechSdk.AudioConfig.fromStreamInput(pushStream);
238
+ // Create recognizer
239
+ recognizer = new speechSdk.SpeechRecognizer(speechConfig, audioConfig);
240
+ // Attach a phrase list grammar to boost recognition of technical terms.
241
+ // Combines the bundled curated list (~600 dev/cloud/AI terms) with any
242
+ // caller-supplied extras (typically the user's personal dictionary).
243
+ // Azure caps a single grammar at 1024 phrases per session.
244
+ try {
245
+ const bundled = loadBundledPhraseList();
246
+ const merged = mergePhrases(bundled, extraPhrases || []);
247
+ if (merged.length > 0) {
248
+ const phraseList = speechSdk.PhraseListGrammar.fromRecognizer(recognizer);
249
+ for (const phrase of merged) {
250
+ phraseList.addPhrase(phrase);
251
+ }
252
+ logger_1.default.info(`[AzureSpeechRT] Attached ${merged.length} phrases (bundled=${bundled.length}, extra=${extraPhrases?.length || 0})`);
253
+ }
254
+ }
255
+ catch (err) {
256
+ logger_1.default.warn('[AzureSpeechRT] Failed to attach phrase list:', err);
257
+ }
258
+ attachRecognizerEvents(speechSdk, callbacks);
225
259
  // Start continuous recognition
226
260
  return new Promise((resolve, reject) => {
227
261
  recognizer.startContinuousRecognitionAsync(() => {
@@ -269,24 +303,30 @@ function flushPreBuffer() {
269
303
  preBuffering = false;
270
304
  }
271
305
  /**
272
- * Stop recognition and return the final accumulated transcript.
273
- * Closing the push stream signals end-of-audio to the SDK,
274
- * which triggers final recognition of any remaining buffered audio.
306
+ * Stop the current dictation session and return the accumulated transcript.
307
+ *
308
+ * In persistent mode: closes the push stream (signals end-of-audio) and
309
+ * stops recognition, but keeps the recognizer alive for the next session.
310
+ * The recognizer will be restarted with a new push stream on the next call
311
+ * to startRealtimeRecognition().
312
+ *
313
+ * The stopContinuousRecognitionAsync call ensures all recognized events
314
+ * have fired before we grab finalText.
275
315
  */
276
316
  async function stopRealtimeRecognition() {
277
317
  if (!isRunning)
278
318
  return finalText;
279
- // Close push stream first — signals end of audio to SDK
319
+ // Close push stream — signals end of audio to SDK
280
320
  if (pushStream) {
281
321
  pushStream.close();
282
322
  pushStream = null;
283
323
  }
284
- // Wait briefly for any final recognition to complete
285
- await new Promise((resolve) => setTimeout(resolve, 300));
286
- // Stop the recognizer
324
+ // Stop recognition — ensures all recognized events have fired
287
325
  if (recognizer) {
326
+ const oldRecognizer = recognizer;
327
+ recognizer = null;
288
328
  await new Promise((resolve) => {
289
- recognizer.stopContinuousRecognitionAsync(() => {
329
+ oldRecognizer.stopContinuousRecognitionAsync(() => {
290
330
  logger_1.default.info('[AzureSpeechRT] Stopped');
291
331
  resolve();
292
332
  }, (err) => {
@@ -294,15 +334,108 @@ async function stopRealtimeRecognition() {
294
334
  resolve();
295
335
  });
296
336
  });
297
- recognizer.close();
298
- recognizer = null;
337
+ // Close the old recognizer in background
338
+ setTimeout(() => { try {
339
+ oldRecognizer.close();
340
+ }
341
+ catch { /* ignore */ } }, 0);
299
342
  }
300
343
  isRunning = false;
301
344
  const result = finalText;
302
345
  finalText = '';
303
346
  lastRecognized = '';
347
+ // Pre-warm the next recognizer in the background so it's ready
348
+ // by the time the user starts the next dictation session.
349
+ prewarmStandby();
304
350
  return result;
305
351
  }
352
+ /**
353
+ * Create a standby recognizer in the background using the last config.
354
+ * Called after each session ends. The standby is fully connected with
355
+ * phrases attached — ready for instant use on the next dictation.
356
+ */
357
+ function prewarmStandby() {
358
+ if (!lastConfig || !sdk)
359
+ return;
360
+ // Clean up any existing standby
361
+ if (standbyRecognizer) {
362
+ try {
363
+ standbyRecognizer.close();
364
+ }
365
+ catch { /* ignore */ }
366
+ standbyRecognizer = null;
367
+ standbyPushStream = null;
368
+ standbyReady = false;
369
+ }
370
+ const { key, region, language, timing, phrases } = lastConfig;
371
+ const speechSdk = sdk;
372
+ // Create everything fresh
373
+ const speechConfig = speechSdk.SpeechConfig.fromSubscription(key, region);
374
+ speechConfig.speechRecognitionLanguage = language || 'en-US';
375
+ speechConfig.enableDictation();
376
+ const endSilence = timing?.endSilenceMs ?? 5000;
377
+ const initialSilence = timing?.initialSilenceMs ?? 15000;
378
+ const segSilence = timing?.segmentationSilenceMs ?? 3000;
379
+ speechConfig.setProperty('speechServiceConnection_endSilenceTimeoutMs', String(endSilence));
380
+ speechConfig.setProperty('speechServiceConnection_initialSilenceTimeoutMs', String(initialSilence));
381
+ speechConfig.setProperty('Speech_SegmentationSilenceTimeoutMs', String(segSilence));
382
+ const format = speechSdk.AudioStreamFormat.getWaveFormatPCM(16000, 16, 1);
383
+ const newPushStream = speechSdk.AudioInputStream.createPushStream(format);
384
+ const audioConfig = speechSdk.AudioConfig.fromStreamInput(newPushStream);
385
+ const newRecognizer = new speechSdk.SpeechRecognizer(speechConfig, audioConfig);
386
+ // Attach phrases
387
+ try {
388
+ const bundled = loadBundledPhraseList();
389
+ const merged = mergePhrases(bundled, phrases || []);
390
+ if (merged.length > 0) {
391
+ const phraseList = speechSdk.PhraseListGrammar.fromRecognizer(newRecognizer);
392
+ for (const phrase of merged) {
393
+ phraseList.addPhrase(phrase);
394
+ }
395
+ }
396
+ }
397
+ catch { /* ignore */ }
398
+ // Start recognition so the WebSocket connects
399
+ newRecognizer.startContinuousRecognitionAsync(() => {
400
+ standbyRecognizer = newRecognizer;
401
+ standbyPushStream = newPushStream;
402
+ standbyReady = true;
403
+ logger_1.default.info('[AzureSpeechRT] Standby recognizer pre-warmed and ready');
404
+ }, (err) => {
405
+ logger_1.default.warn('[AzureSpeechRT] Failed to pre-warm standby:', err);
406
+ try {
407
+ newRecognizer.close();
408
+ }
409
+ catch { /* ignore */ }
410
+ });
411
+ }
412
+ /**
413
+ * Fully shut down the recognizer (called on app exit).
414
+ */
415
+ async function shutdownRecognizer() {
416
+ lastConfig = null; // Prevent prewarmStandby from running during stop
417
+ // Clean up standby
418
+ if (standbyRecognizer) {
419
+ try {
420
+ standbyRecognizer.close();
421
+ }
422
+ catch { /* ignore */ }
423
+ standbyRecognizer = null;
424
+ standbyPushStream = null;
425
+ standbyReady = false;
426
+ }
427
+ if (isRunning) {
428
+ await stopRealtimeRecognition();
429
+ }
430
+ if (recognizer) {
431
+ try {
432
+ recognizer.close();
433
+ }
434
+ catch { /* ignore */ }
435
+ recognizer = null;
436
+ }
437
+ lastConfig = null;
438
+ }
306
439
  /**
307
440
  * Deduplicate + cap a phrase list. Azure's PhraseListGrammar accepts up to
308
441
  * 1024 phrases per session — we prioritise caller-supplied extras (personal
@@ -39,7 +39,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.normalizeTechnicalTerms = normalizeTechnicalTerms;
42
43
  exports.removeFillerWords = removeFillerWords;
44
+ exports.normalizeShortPhrase = normalizeShortPhrase;
43
45
  exports.deduplicateConsecutiveWords = deduplicateConsecutiveWords;
44
46
  exports.handleAudioReady = handleAudioReady;
45
47
  exports.initializeDictation = initializeDictation;
@@ -386,6 +388,126 @@ function normalizeTechnicalTerms(text) {
386
388
  result = result.replace(/(\w)\s+(?:pipe|vertical bar)\s+(\w)/gi, '$1|$2');
387
389
  result = result.replace(/(\w)\s+(?:tilde|til-duh)\s+(\w)/gi, '$1~$2');
388
390
  result = result.replace(/(\w)\s+(?:equals|equal sign|equal)\s+(\w)/gi, '$1=$2');
391
+ // ── STEP 5: Brand / product name normalization ──
392
+ // Speech engines often split or phonetically mangle brand names.
393
+ // Fix common misrecognitions for AI, dev tools, and tech terms.
394
+ const brandMap = [
395
+ // SuperBased & product
396
+ [/\bsuper ?bas[es]d?\b/gi, 'SuperBased'],
397
+ [/\bsuper ?bass\b/gi, 'SuperBased'],
398
+ [/\bgaja a\.?i\.?\b/gi, 'Gaja AI'],
399
+ // LLM providers & models
400
+ [/\b(?:cloud|clod|clawed|claud) code\b/gi, 'Claude Code'],
401
+ [/\b(?:cloud|clod|clawed) opus\b/gi, 'Claude Opus'],
402
+ [/\b(?:cloud|clod|clawed) sonnet\b/gi, 'Claude Sonnet'],
403
+ [/\b(?:cloud|clod|clawed) haiku\b/gi, 'Claude Haiku'],
404
+ [/\bclaude code\b/gi, 'Claude Code'],
405
+ [/\bclaude opus\b/gi, 'Claude Opus'],
406
+ [/\bclaude sonnet\b/gi, 'Claude Sonnet'],
407
+ [/\bclaude haiku\b/gi, 'Claude Haiku'],
408
+ [/\banthropic\b/gi, 'Anthropic'],
409
+ [/\bopen a\.?i\.?\b/gi, 'OpenAI'],
410
+ [/\bdeep seek\b/gi, 'DeepSeek'],
411
+ [/\bmix tral\b/gi, 'Mixtral'],
412
+ [/\b(?:ou|oh|o) ?llama\b/gi, 'Ollama'],
413
+ [/\bllama\b/g, 'Llama'], // case-sensitive: don't touch if already correct
414
+ [/\bgemini\b/gi, 'Gemini'],
415
+ [/\bmistral\b/gi, 'Mistral'],
416
+ [/\bgroq\b/gi, 'Groq'],
417
+ [/\bperplexity\b/gi, 'Perplexity'],
418
+ [/\bco ?here\b/gi, 'Cohere'],
419
+ [/\bhugging face\b/gi, 'Hugging Face'],
420
+ [/\bx a\.?i\.?\b/gi, 'xAI'],
421
+ [/\bmeta a\.?i\.?\b/gi, 'Meta AI'],
422
+ [/\bstability a\.?i\.?\b/gi, 'Stability AI'],
423
+ [/\bgoogle deep ?mind\b/gi, 'Google DeepMind'],
424
+ [/\btogether a\.?i\.?\b/gi, 'Together AI'],
425
+ [/\bfireworks a\.?i\.?\b/gi, 'Fireworks AI'],
426
+ [/\bsamba ?nova\b/gi, 'SambaNova'],
427
+ [/\bdeep ?infra\b/gi, 'DeepInfra'],
428
+ [/\beleven ?labs\b/gi, 'ElevenLabs'],
429
+ [/\bdeep ?gram\b/gi, 'Deepgram'],
430
+ [/\bassembly a\.?i\.?\b/gi, 'AssemblyAI'],
431
+ [/\bopen ?router\b/gi, 'OpenRouter'],
432
+ [/\bL\.?M\.? ?studio\b/gi, 'LM Studio'],
433
+ // AI coding tools
434
+ [/\bcursor\b/g, 'Cursor'],
435
+ [/\bwind ?surf\b/gi, 'Windsurf'],
436
+ [/\bcline\b/gi, 'Cline'],
437
+ [/\baider\b/gi, 'Aider'],
438
+ [/\bco ?pilot\b/gi, 'Copilot'],
439
+ [/\bgit ?hub co ?pilot\b/gi, 'GitHub Copilot'],
440
+ [/\bcode ?ium\b/gi, 'Codeium'],
441
+ [/\btab ?nine\b/gi, 'Tabnine'],
442
+ [/\bsuper ?maven\b/gi, 'Supermaven'],
443
+ [/\bopen ?code\b/gi, 'OpenCode'],
444
+ [/\bzed a\.?i\.?\b/gi, 'Zed AI'],
445
+ // AI frameworks
446
+ [/\blang ?chain\b/gi, 'LangChain'],
447
+ [/\blang ?graph\b/gi, 'LangGraph'],
448
+ [/\bllama ?index\b/gi, 'LlamaIndex'],
449
+ [/\bcrew a\.?i\.?\b/gi, 'CrewAI'],
450
+ [/\bauto ?gen\b/gi, 'AutoGen'],
451
+ [/\bsemantic kernel\b/gi, 'Semantic Kernel'],
452
+ [/\bhay ?stack\b/gi, 'Haystack'],
453
+ [/\bvercel a\.?i\.? ?s\.?d\.?k\.?\b/gi, 'Vercel AI SDK'],
454
+ [/\bpydantic a\.?i\.?\b/gi, 'Pydantic AI'],
455
+ [/\bD\.?S\.?P\.?Y\.?\b/g, 'DSPy'],
456
+ // AI infra & concepts
457
+ [/\bM\.?C\.?P\.?\b/g, 'MCP'],
458
+ [/\bmodel context protocol\b/gi, 'Model Context Protocol'],
459
+ [/\bR\.?A\.?G\.?\b/g, 'RAG'],
460
+ [/\bretrieval augmented generation\b/gi, 'retrieval augmented generation'],
461
+ [/\bR\.?L\.?H\.?F\.?\b/g, 'RLHF'],
462
+ [/\blo ?ra\b/gi, 'LoRA'],
463
+ [/\bQ\.? ?lo ?ra\b/gi, 'QLoRA'],
464
+ [/\bP\.?E\.?F\.?T\.?\b/g, 'PEFT'],
465
+ [/\bV\.? ?L\.?L\.?M\.?\b/g, 'vLLM'],
466
+ [/\bG\.?G\.?U\.?F\.?\b/g, 'GGUF'],
467
+ [/\bO\.?N\.?N\.?X\.?\b/g, 'ONNX'],
468
+ [/\btensor ?R\.?T\.?\b/gi, 'TensorRT'],
469
+ [/\bfine ?tune\b/gi, 'fine-tune'],
470
+ [/\bfine ?tuning\b/gi, 'fine-tuning'],
471
+ [/\bmulti ?modal\b/gi, 'multimodal'],
472
+ [/\bcontext window\b/gi, 'context window'],
473
+ [/\bprompt engineering\b/gi, 'prompt engineering'],
474
+ [/\bfunction calling\b/gi, 'function calling'],
475
+ [/\btool calling\b/gi, 'tool calling'],
476
+ [/\btool use\b/gi, 'tool use'],
477
+ [/\bagentic\b/gi, 'agentic'],
478
+ // Vector DBs
479
+ [/\bpine ?cone\b/gi, 'Pinecone'],
480
+ [/\bweaviate\b/gi, 'Weaviate'],
481
+ [/\bq ?drant\b/gi, 'Qdrant'],
482
+ [/\bchroma\b/gi, 'Chroma'],
483
+ [/\bmilvus\b/gi, 'Milvus'],
484
+ [/\bpg ?vector\b/gi, 'pgvector'],
485
+ // Media AI
486
+ [/\bdall[ -]?e\b/gi, 'DALL-E'],
487
+ [/\bmid ?journey\b/gi, 'Midjourney'],
488
+ [/\bstable diffusion\b/gi, 'Stable Diffusion'],
489
+ // Dev tools
490
+ [/\bsupa ?base\b/gi, 'Supabase'],
491
+ [/\bnext ?\.?j\.?s\.?\b/gi, 'Next.js'],
492
+ [/\bsvelte ?kit\b/gi, 'SvelteKit'],
493
+ [/\btailwind\b/gi, 'Tailwind'],
494
+ [/\btype ?script\b/gi, 'TypeScript'],
495
+ [/\bjava ?script\b/gi, 'JavaScript'],
496
+ [/\bpost ?gres\b/gi, 'Postgres'],
497
+ [/\bred is\b/gi, 'Redis'],
498
+ [/\bcloud ?flare\b/gi, 'Cloudflare'],
499
+ [/\bterraform\b/gi, 'Terraform'],
500
+ [/\bkubernetes\b/gi, 'Kubernetes'],
501
+ [/\bV\.?S\.? ?code\b/gi, 'VS Code'],
502
+ [/\bt\.?R\.?P\.?C\.?\b/g, 'tRPC'],
503
+ [/\bdrizzle ?O\.?R\.?M\.?\b/gi, 'Drizzle ORM'],
504
+ // Observability
505
+ [/\blang ?fuse\b/gi, 'Langfuse'],
506
+ [/\blang ?smith\b/gi, 'LangSmith'],
507
+ ];
508
+ for (const [pattern, replacement] of brandMap) {
509
+ result = result.replace(pattern, replacement);
510
+ }
389
511
  // Standalone symbol words (not between two words)
390
512
  result = result.replace(/\b(?:fat |thick )?arrow\b/gi, '=>');
391
513
  result = result.replace(/\bthin arrow\b/gi, '->');