@tiflis-io/tiflis-code-workstation 0.3.9 → 0.3.10

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 (2) hide show
  1. package/dist/main.js +55 -12
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -94,7 +94,7 @@ var EnvSchema = z.object({
94
94
  // ─────────────────────────────────────────────────────────────
95
95
  // Speech-to-Text (STT) Configuration
96
96
  // ─────────────────────────────────────────────────────────────
97
- STT_PROVIDER: z.enum(["openai", "elevenlabs", "deepgram"]).default("openai"),
97
+ STT_PROVIDER: z.enum(["openai", "elevenlabs", "deepgram", "local"]).default("openai"),
98
98
  STT_API_KEY: z.string().optional(),
99
99
  STT_MODEL: z.string().default("whisper-1"),
100
100
  STT_BASE_URL: z.string().url().optional(),
@@ -102,7 +102,7 @@ var EnvSchema = z.object({
102
102
  // ─────────────────────────────────────────────────────────────
103
103
  // Text-to-Speech (TTS) Configuration
104
104
  // ─────────────────────────────────────────────────────────────
105
- TTS_PROVIDER: z.enum(["openai", "elevenlabs"]).default("openai"),
105
+ TTS_PROVIDER: z.enum(["openai", "elevenlabs", "local"]).default("openai"),
106
106
  TTS_API_KEY: z.string().optional(),
107
107
  TTS_MODEL: z.string().default("tts-1"),
108
108
  TTS_VOICE: z.string().default("alloy"),
@@ -8379,7 +8379,18 @@ var STTService = class {
8379
8379
  this.logger.debug({ audioSize: audioBuffer.length, format }, "Transcribing audio");
8380
8380
  const startTime = Date.now();
8381
8381
  try {
8382
- const result = this.config.provider === "openai" ? await this.transcribeOpenAI(audioBuffer, format, signal) : await this.transcribeElevenLabs(audioBuffer, format, signal);
8382
+ let result;
8383
+ switch (this.config.provider) {
8384
+ case "openai":
8385
+ case "local":
8386
+ result = await this.transcribeOpenAI(audioBuffer, format, signal);
8387
+ break;
8388
+ case "elevenlabs":
8389
+ result = await this.transcribeElevenLabs(audioBuffer, format, signal);
8390
+ break;
8391
+ default:
8392
+ throw new Error(`Unsupported STT provider: ${this.config.provider}`);
8393
+ }
8383
8394
  const elapsed = Date.now() - startTime;
8384
8395
  this.logger.info(
8385
8396
  {
@@ -8491,6 +8502,9 @@ var STTService = class {
8491
8502
  * Check if the service is configured and ready.
8492
8503
  */
8493
8504
  isConfigured() {
8505
+ if (this.config.provider === "local") {
8506
+ return Boolean(this.config.baseUrl && this.config.model);
8507
+ }
8494
8508
  return Boolean(this.config.apiKey && this.config.model);
8495
8509
  }
8496
8510
  /**
@@ -8507,20 +8521,28 @@ var STTService = class {
8507
8521
  function createSTTService(env, logger) {
8508
8522
  const provider = (env.STT_PROVIDER ?? "openai").toLowerCase();
8509
8523
  const apiKey = env.STT_API_KEY;
8510
- if (!apiKey) {
8524
+ const baseUrl = env.STT_BASE_URL;
8525
+ if (provider === "local") {
8526
+ if (!baseUrl) {
8527
+ logger.warn("STT_BASE_URL not configured for local provider, STT service disabled");
8528
+ return null;
8529
+ }
8530
+ } else if (!apiKey) {
8511
8531
  logger.warn("STT_API_KEY not configured, STT service disabled");
8512
8532
  return null;
8513
8533
  }
8514
8534
  const defaults = {
8515
8535
  openai: { model: "whisper-1" },
8516
- elevenlabs: { model: "scribe_v1" }
8536
+ elevenlabs: { model: "scribe_v1" },
8537
+ deepgram: { model: "nova-2" },
8538
+ local: { model: "large-v3" }
8517
8539
  };
8518
8540
  const config2 = {
8519
8541
  provider,
8520
- apiKey,
8542
+ apiKey: apiKey ?? "",
8521
8543
  model: env.STT_MODEL ?? defaults[provider].model,
8522
8544
  language: env.STT_LANGUAGE,
8523
- baseUrl: env.STT_BASE_URL
8545
+ baseUrl
8524
8546
  };
8525
8547
  return new STTService(config2, logger);
8526
8548
  }
@@ -8540,7 +8562,18 @@ var TTSService = class {
8540
8562
  this.logger.debug({ textLength: text2.length }, "Synthesizing speech");
8541
8563
  const startTime = Date.now();
8542
8564
  try {
8543
- const result = this.config.provider === "openai" ? await this.synthesizeOpenAI(text2) : await this.synthesizeElevenLabs(text2);
8565
+ let result;
8566
+ switch (this.config.provider) {
8567
+ case "openai":
8568
+ case "local":
8569
+ result = await this.synthesizeOpenAI(text2);
8570
+ break;
8571
+ case "elevenlabs":
8572
+ result = await this.synthesizeElevenLabs(text2);
8573
+ break;
8574
+ default:
8575
+ throw new Error(`Unsupported TTS provider: ${this.config.provider}`);
8576
+ }
8544
8577
  const elapsed = Date.now() - startTime;
8545
8578
  this.logger.info(
8546
8579
  { textLength: text2.length, audioSize: result.audio.length, elapsedMs: elapsed },
@@ -8617,6 +8650,9 @@ var TTSService = class {
8617
8650
  * Check if the service is configured and ready.
8618
8651
  */
8619
8652
  isConfigured() {
8653
+ if (this.config.provider === "local") {
8654
+ return Boolean(this.config.baseUrl && this.config.voice);
8655
+ }
8620
8656
  return Boolean(this.config.apiKey && this.config.model && this.config.voice);
8621
8657
  }
8622
8658
  /**
@@ -8633,20 +8669,27 @@ var TTSService = class {
8633
8669
  function createTTSService(env, logger) {
8634
8670
  const provider = (env.TTS_PROVIDER ?? "openai").toLowerCase();
8635
8671
  const apiKey = env.TTS_API_KEY;
8636
- if (!apiKey) {
8672
+ const baseUrl = env.TTS_BASE_URL;
8673
+ if (provider === "local") {
8674
+ if (!baseUrl) {
8675
+ logger.warn("TTS_BASE_URL not configured for local provider, TTS service disabled");
8676
+ return null;
8677
+ }
8678
+ } else if (!apiKey) {
8637
8679
  logger.warn("TTS_API_KEY not configured, TTS service disabled");
8638
8680
  return null;
8639
8681
  }
8640
8682
  const defaults = {
8641
8683
  openai: { model: "tts-1", voice: "alloy" },
8642
- elevenlabs: { model: "eleven_flash_v2_5", voice: "21m00Tcm4TlvDq8ikWAM" }
8684
+ elevenlabs: { model: "eleven_flash_v2_5", voice: "21m00Tcm4TlvDq8ikWAM" },
8685
+ local: { model: "kokoro", voice: "af_heart" }
8643
8686
  };
8644
8687
  const config2 = {
8645
8688
  provider,
8646
- apiKey,
8689
+ apiKey: apiKey ?? "",
8647
8690
  model: env.TTS_MODEL ?? defaults[provider].model,
8648
8691
  voice: env.TTS_VOICE ?? defaults[provider].voice,
8649
- baseUrl: env.TTS_BASE_URL
8692
+ baseUrl
8650
8693
  };
8651
8694
  return new TTSService(config2, logger);
8652
8695
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiflis-io/tiflis-code-workstation",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "Workstation server for tiflis-code - manages agent sessions and terminal access",
5
5
  "author": "Roman Barinov <rbarinov@gmail.com>",
6
6
  "license": "FSL-1.1-NC",