@realtimex/sdk 1.2.5 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -152,6 +152,36 @@ interface TTSChunkEvent {
152
152
  error: string;
153
153
  };
154
154
  }
155
+ interface STTListenOptions {
156
+ /** STT provider (e.g., 'native', 'whisper', 'groq') */
157
+ provider?: string;
158
+ /** Language code (e.g., 'en-US') */
159
+ language?: string;
160
+ /** Specific model ID (e.g., 'onnx-community/whisper-tiny.en') */
161
+ model: string;
162
+ /** Timeout in milliseconds (default: 60000) */
163
+ timeout?: number;
164
+ }
165
+ interface STTModel {
166
+ id: string;
167
+ name: string;
168
+ provider: string;
169
+ description?: string;
170
+ language?: string;
171
+ size?: string;
172
+ recommended?: boolean;
173
+ }
174
+ interface STTModelsResponse {
175
+ success: boolean;
176
+ models: STTModel[];
177
+ error?: string;
178
+ }
179
+ interface STTResponse {
180
+ success: boolean;
181
+ /** Transcribed text */
182
+ text: string;
183
+ error?: string;
184
+ }
155
185
 
156
186
  /**
157
187
  * Activities Module - HTTP Proxy to RealtimeX Main App
@@ -248,7 +278,7 @@ declare class ApiModule {
248
278
  /**
249
279
  * Make an API call with automatic permission handling
250
280
  */
251
- private apiCall;
281
+ protected apiCall<T>(method: string, endpoint: string, options?: RequestInit): Promise<T>;
252
282
  getAgents(): Promise<Agent[]>;
253
283
  getWorkspaces(): Promise<Workspace[]>;
254
284
  getThreads(workspaceSlug: string): Promise<Thread[]>;
@@ -755,6 +785,22 @@ declare class TTSModule {
755
785
  listProviders(): Promise<TTSProvider[]>;
756
786
  }
757
787
 
788
+ declare class STTModule extends ApiModule {
789
+ /**
790
+ * Get available STT models.
791
+ * @returns Promise resolving to list of models
792
+ */
793
+ models(): Promise<STTModel[]>;
794
+ /**
795
+ * Listen to microphone and transcribe speech to text.
796
+ * Performed on the client device (Electron) via the RealtimeX Hub.
797
+ *
798
+ * @param options Configuration options for listening
799
+ * @returns Promise resolving to the transcribed text
800
+ */
801
+ listen(options: STTListenOptions): Promise<STTResponse>;
802
+ }
803
+
758
804
  /**
759
805
  * RealtimeX Local App SDK
760
806
  *
@@ -770,6 +816,7 @@ declare class RealtimeXSDK {
770
816
  port: PortModule;
771
817
  llm: LLMModule;
772
818
  tts: TTSModule;
819
+ stt: STTModule;
773
820
  readonly appId: string;
774
821
  readonly appName: string | undefined;
775
822
  readonly apiKey: string | undefined;
@@ -803,4 +850,4 @@ declare class RealtimeXSDK {
803
850
  getAppDataDir(): Promise<string>;
804
851
  }
805
852
 
806
- export { ActivitiesModule, type Activity, type Agent, ApiModule, type ChatMessage, type ChatOptions, type ChatResponse, type EmbedOptions, type EmbedResponse, LLMModule, LLMPermissionError, LLMProviderError, PermissionDeniedError, PermissionRequiredError, PortModule, type Provider, type ProvidersResponse, RealtimeXSDK, type SDKConfig, type StreamChunk, type TTSChunk, type TTSChunkEvent, TTSModule, type TTSOptions, type TTSProvider, type TTSProviderConfig, type TTSProvidersResponse, type Task, TaskModule, type TaskRun, type Thread, type TriggerAgentPayload, type TriggerAgentResponse, type VectorDeleteOptions, type VectorDeleteResponse, type VectorQueryOptions, type VectorQueryResponse, type VectorQueryResult, type VectorRecord, VectorStore, type VectorUpsertOptions, type VectorUpsertResponse, WebhookModule, type Workspace };
853
+ export { ActivitiesModule, type Activity, type Agent, ApiModule, type ChatMessage, type ChatOptions, type ChatResponse, type EmbedOptions, type EmbedResponse, LLMModule, LLMPermissionError, LLMProviderError, PermissionDeniedError, PermissionRequiredError, PortModule, type Provider, type ProvidersResponse, RealtimeXSDK, type SDKConfig, type STTListenOptions, type STTModel, type STTModelsResponse, STTModule, type STTResponse, type StreamChunk, type TTSChunk, type TTSChunkEvent, TTSModule, type TTSOptions, type TTSProvider, type TTSProviderConfig, type TTSProvidersResponse, type Task, TaskModule, type TaskRun, type Thread, type TriggerAgentPayload, type TriggerAgentResponse, type VectorDeleteOptions, type VectorDeleteResponse, type VectorQueryOptions, type VectorQueryResponse, type VectorQueryResult, type VectorRecord, VectorStore, type VectorUpsertOptions, type VectorUpsertResponse, WebhookModule, type Workspace };
package/dist/index.d.ts CHANGED
@@ -152,6 +152,36 @@ interface TTSChunkEvent {
152
152
  error: string;
153
153
  };
154
154
  }
155
+ interface STTListenOptions {
156
+ /** STT provider (e.g., 'native', 'whisper', 'groq') */
157
+ provider?: string;
158
+ /** Language code (e.g., 'en-US') */
159
+ language?: string;
160
+ /** Specific model ID (e.g., 'onnx-community/whisper-tiny.en') */
161
+ model: string;
162
+ /** Timeout in milliseconds (default: 60000) */
163
+ timeout?: number;
164
+ }
165
+ interface STTModel {
166
+ id: string;
167
+ name: string;
168
+ provider: string;
169
+ description?: string;
170
+ language?: string;
171
+ size?: string;
172
+ recommended?: boolean;
173
+ }
174
+ interface STTModelsResponse {
175
+ success: boolean;
176
+ models: STTModel[];
177
+ error?: string;
178
+ }
179
+ interface STTResponse {
180
+ success: boolean;
181
+ /** Transcribed text */
182
+ text: string;
183
+ error?: string;
184
+ }
155
185
 
156
186
  /**
157
187
  * Activities Module - HTTP Proxy to RealtimeX Main App
@@ -248,7 +278,7 @@ declare class ApiModule {
248
278
  /**
249
279
  * Make an API call with automatic permission handling
250
280
  */
251
- private apiCall;
281
+ protected apiCall<T>(method: string, endpoint: string, options?: RequestInit): Promise<T>;
252
282
  getAgents(): Promise<Agent[]>;
253
283
  getWorkspaces(): Promise<Workspace[]>;
254
284
  getThreads(workspaceSlug: string): Promise<Thread[]>;
@@ -755,6 +785,22 @@ declare class TTSModule {
755
785
  listProviders(): Promise<TTSProvider[]>;
756
786
  }
757
787
 
788
+ declare class STTModule extends ApiModule {
789
+ /**
790
+ * Get available STT models.
791
+ * @returns Promise resolving to list of models
792
+ */
793
+ models(): Promise<STTModel[]>;
794
+ /**
795
+ * Listen to microphone and transcribe speech to text.
796
+ * Performed on the client device (Electron) via the RealtimeX Hub.
797
+ *
798
+ * @param options Configuration options for listening
799
+ * @returns Promise resolving to the transcribed text
800
+ */
801
+ listen(options: STTListenOptions): Promise<STTResponse>;
802
+ }
803
+
758
804
  /**
759
805
  * RealtimeX Local App SDK
760
806
  *
@@ -770,6 +816,7 @@ declare class RealtimeXSDK {
770
816
  port: PortModule;
771
817
  llm: LLMModule;
772
818
  tts: TTSModule;
819
+ stt: STTModule;
773
820
  readonly appId: string;
774
821
  readonly appName: string | undefined;
775
822
  readonly apiKey: string | undefined;
@@ -803,4 +850,4 @@ declare class RealtimeXSDK {
803
850
  getAppDataDir(): Promise<string>;
804
851
  }
805
852
 
806
- export { ActivitiesModule, type Activity, type Agent, ApiModule, type ChatMessage, type ChatOptions, type ChatResponse, type EmbedOptions, type EmbedResponse, LLMModule, LLMPermissionError, LLMProviderError, PermissionDeniedError, PermissionRequiredError, PortModule, type Provider, type ProvidersResponse, RealtimeXSDK, type SDKConfig, type StreamChunk, type TTSChunk, type TTSChunkEvent, TTSModule, type TTSOptions, type TTSProvider, type TTSProviderConfig, type TTSProvidersResponse, type Task, TaskModule, type TaskRun, type Thread, type TriggerAgentPayload, type TriggerAgentResponse, type VectorDeleteOptions, type VectorDeleteResponse, type VectorQueryOptions, type VectorQueryResponse, type VectorQueryResult, type VectorRecord, VectorStore, type VectorUpsertOptions, type VectorUpsertResponse, WebhookModule, type Workspace };
853
+ export { ActivitiesModule, type Activity, type Agent, ApiModule, type ChatMessage, type ChatOptions, type ChatResponse, type EmbedOptions, type EmbedResponse, LLMModule, LLMPermissionError, LLMProviderError, PermissionDeniedError, PermissionRequiredError, PortModule, type Provider, type ProvidersResponse, RealtimeXSDK, type SDKConfig, type STTListenOptions, type STTModel, type STTModelsResponse, STTModule, type STTResponse, type StreamChunk, type TTSChunk, type TTSChunkEvent, TTSModule, type TTSOptions, type TTSProvider, type TTSProviderConfig, type TTSProvidersResponse, type Task, TaskModule, type TaskRun, type Thread, type TriggerAgentPayload, type TriggerAgentResponse, type VectorDeleteOptions, type VectorDeleteResponse, type VectorQueryOptions, type VectorQueryResponse, type VectorQueryResult, type VectorRecord, VectorStore, type VectorUpsertOptions, type VectorUpsertResponse, WebhookModule, type Workspace };
package/dist/index.js CHANGED
@@ -39,6 +39,7 @@ __export(index_exports, {
39
39
  PermissionRequiredError: () => PermissionRequiredError,
40
40
  PortModule: () => PortModule,
41
41
  RealtimeXSDK: () => RealtimeXSDK,
42
+ STTModule: () => STTModule,
42
43
  TTSModule: () => TTSModule,
43
44
  TaskModule: () => TaskModule,
44
45
  VectorStore: () => VectorStore,
@@ -1166,6 +1167,41 @@ var TTSModule = class {
1166
1167
  }
1167
1168
  };
1168
1169
 
1170
+ // src/modules/stt.ts
1171
+ var STTModule = class extends ApiModule {
1172
+ /**
1173
+ * Get available STT models.
1174
+ * @returns Promise resolving to list of models
1175
+ */
1176
+ async models() {
1177
+ try {
1178
+ const response = await this.apiCall("GET", "/sdk/stt/models");
1179
+ if (!response.success) {
1180
+ throw new Error(response.error || "Failed to fetch models");
1181
+ }
1182
+ return response.models;
1183
+ } catch (error) {
1184
+ throw new Error(`STT models fetch failed: ${error.message}`);
1185
+ }
1186
+ }
1187
+ /**
1188
+ * Listen to microphone and transcribe speech to text.
1189
+ * Performed on the client device (Electron) via the RealtimeX Hub.
1190
+ *
1191
+ * @param options Configuration options for listening
1192
+ * @returns Promise resolving to the transcribed text
1193
+ */
1194
+ async listen(options) {
1195
+ try {
1196
+ return await this.apiCall("POST", "/sdk/stt/listen", {
1197
+ body: JSON.stringify(options)
1198
+ });
1199
+ } catch (error) {
1200
+ throw new Error(`STT listen failed: ${error.message}`);
1201
+ }
1202
+ }
1203
+ };
1204
+
1169
1205
  // src/index.ts
1170
1206
  var _RealtimeXSDK = class _RealtimeXSDK {
1171
1207
  constructor(config = {}) {
@@ -1184,6 +1220,7 @@ var _RealtimeXSDK = class _RealtimeXSDK {
1184
1220
  this.port = new PortModule(config.defaultPort);
1185
1221
  this.llm = new LLMModule(this.realtimexUrl, this.appId, this.appName, this.apiKey);
1186
1222
  this.tts = new TTSModule(this.realtimexUrl, this.appId, this.appName, this.apiKey);
1223
+ this.stt = new STTModule(this.realtimexUrl, this.appId, this.appName, this.apiKey);
1187
1224
  if (this.permissions.length > 0 && this.appId && !this.apiKey) {
1188
1225
  this.register().catch((err) => {
1189
1226
  console.error("[RealtimeX SDK] Auto-registration failed:", err.message);
@@ -1294,6 +1331,7 @@ var RealtimeXSDK = _RealtimeXSDK;
1294
1331
  PermissionRequiredError,
1295
1332
  PortModule,
1296
1333
  RealtimeXSDK,
1334
+ STTModule,
1297
1335
  TTSModule,
1298
1336
  TaskModule,
1299
1337
  VectorStore,
package/dist/index.mjs CHANGED
@@ -1118,6 +1118,41 @@ var TTSModule = class {
1118
1118
  }
1119
1119
  };
1120
1120
 
1121
+ // src/modules/stt.ts
1122
+ var STTModule = class extends ApiModule {
1123
+ /**
1124
+ * Get available STT models.
1125
+ * @returns Promise resolving to list of models
1126
+ */
1127
+ async models() {
1128
+ try {
1129
+ const response = await this.apiCall("GET", "/sdk/stt/models");
1130
+ if (!response.success) {
1131
+ throw new Error(response.error || "Failed to fetch models");
1132
+ }
1133
+ return response.models;
1134
+ } catch (error) {
1135
+ throw new Error(`STT models fetch failed: ${error.message}`);
1136
+ }
1137
+ }
1138
+ /**
1139
+ * Listen to microphone and transcribe speech to text.
1140
+ * Performed on the client device (Electron) via the RealtimeX Hub.
1141
+ *
1142
+ * @param options Configuration options for listening
1143
+ * @returns Promise resolving to the transcribed text
1144
+ */
1145
+ async listen(options) {
1146
+ try {
1147
+ return await this.apiCall("POST", "/sdk/stt/listen", {
1148
+ body: JSON.stringify(options)
1149
+ });
1150
+ } catch (error) {
1151
+ throw new Error(`STT listen failed: ${error.message}`);
1152
+ }
1153
+ }
1154
+ };
1155
+
1121
1156
  // src/index.ts
1122
1157
  var _RealtimeXSDK = class _RealtimeXSDK {
1123
1158
  constructor(config = {}) {
@@ -1136,6 +1171,7 @@ var _RealtimeXSDK = class _RealtimeXSDK {
1136
1171
  this.port = new PortModule(config.defaultPort);
1137
1172
  this.llm = new LLMModule(this.realtimexUrl, this.appId, this.appName, this.apiKey);
1138
1173
  this.tts = new TTSModule(this.realtimexUrl, this.appId, this.appName, this.apiKey);
1174
+ this.stt = new STTModule(this.realtimexUrl, this.appId, this.appName, this.apiKey);
1139
1175
  if (this.permissions.length > 0 && this.appId && !this.apiKey) {
1140
1176
  this.register().catch((err) => {
1141
1177
  console.error("[RealtimeX SDK] Auto-registration failed:", err.message);
@@ -1245,6 +1281,7 @@ export {
1245
1281
  PermissionRequiredError,
1246
1282
  PortModule,
1247
1283
  RealtimeXSDK,
1284
+ STTModule,
1248
1285
  TTSModule,
1249
1286
  TaskModule,
1250
1287
  VectorStore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realtimex/sdk",
3
- "version": "1.2.5",
3
+ "version": "1.3.0",
4
4
  "description": "SDK for building Local Apps that integrate with RealtimeX",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",