@realtimex/sdk 1.2.5 → 1.3.1
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 +60 -2
- package/dist/index.d.ts +60 -2
- package/dist/index.js +38 -0
- package/dist/index.mjs +37 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -152,6 +152,47 @@ 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 STTProvider {
|
|
175
|
+
id: string;
|
|
176
|
+
name: string;
|
|
177
|
+
description?: string;
|
|
178
|
+
models: STTModel[];
|
|
179
|
+
}
|
|
180
|
+
interface STTProvidersResponse {
|
|
181
|
+
success: boolean;
|
|
182
|
+
providers: STTProvider[];
|
|
183
|
+
error?: string;
|
|
184
|
+
}
|
|
185
|
+
interface STTModelsResponse {
|
|
186
|
+
success: boolean;
|
|
187
|
+
models: STTModel[];
|
|
188
|
+
error?: string;
|
|
189
|
+
}
|
|
190
|
+
interface STTResponse {
|
|
191
|
+
success: boolean;
|
|
192
|
+
/** Transcribed text */
|
|
193
|
+
text: string;
|
|
194
|
+
error?: string;
|
|
195
|
+
}
|
|
155
196
|
|
|
156
197
|
/**
|
|
157
198
|
* Activities Module - HTTP Proxy to RealtimeX Main App
|
|
@@ -248,7 +289,7 @@ declare class ApiModule {
|
|
|
248
289
|
/**
|
|
249
290
|
* Make an API call with automatic permission handling
|
|
250
291
|
*/
|
|
251
|
-
|
|
292
|
+
protected apiCall<T>(method: string, endpoint: string, options?: RequestInit): Promise<T>;
|
|
252
293
|
getAgents(): Promise<Agent[]>;
|
|
253
294
|
getWorkspaces(): Promise<Workspace[]>;
|
|
254
295
|
getThreads(workspaceSlug: string): Promise<Thread[]>;
|
|
@@ -755,6 +796,22 @@ declare class TTSModule {
|
|
|
755
796
|
listProviders(): Promise<TTSProvider[]>;
|
|
756
797
|
}
|
|
757
798
|
|
|
799
|
+
declare class STTModule extends ApiModule {
|
|
800
|
+
/**
|
|
801
|
+
* Get available STT providers and their models.
|
|
802
|
+
* @returns Promise resolving to list of providers
|
|
803
|
+
*/
|
|
804
|
+
listProviders(): Promise<STTProvider[]>;
|
|
805
|
+
/**
|
|
806
|
+
* Listen to microphone and transcribe speech to text.
|
|
807
|
+
* Performed on the client device (Electron) via the RealtimeX Hub.
|
|
808
|
+
*
|
|
809
|
+
* @param options Configuration options for listening
|
|
810
|
+
* @returns Promise resolving to the transcribed text
|
|
811
|
+
*/
|
|
812
|
+
listen(options: STTListenOptions): Promise<STTResponse>;
|
|
813
|
+
}
|
|
814
|
+
|
|
758
815
|
/**
|
|
759
816
|
* RealtimeX Local App SDK
|
|
760
817
|
*
|
|
@@ -770,6 +827,7 @@ declare class RealtimeXSDK {
|
|
|
770
827
|
port: PortModule;
|
|
771
828
|
llm: LLMModule;
|
|
772
829
|
tts: TTSModule;
|
|
830
|
+
stt: STTModule;
|
|
773
831
|
readonly appId: string;
|
|
774
832
|
readonly appName: string | undefined;
|
|
775
833
|
readonly apiKey: string | undefined;
|
|
@@ -803,4 +861,4 @@ declare class RealtimeXSDK {
|
|
|
803
861
|
getAppDataDir(): Promise<string>;
|
|
804
862
|
}
|
|
805
863
|
|
|
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 };
|
|
864
|
+
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 STTProvider, type STTProvidersResponse, 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,47 @@ 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 STTProvider {
|
|
175
|
+
id: string;
|
|
176
|
+
name: string;
|
|
177
|
+
description?: string;
|
|
178
|
+
models: STTModel[];
|
|
179
|
+
}
|
|
180
|
+
interface STTProvidersResponse {
|
|
181
|
+
success: boolean;
|
|
182
|
+
providers: STTProvider[];
|
|
183
|
+
error?: string;
|
|
184
|
+
}
|
|
185
|
+
interface STTModelsResponse {
|
|
186
|
+
success: boolean;
|
|
187
|
+
models: STTModel[];
|
|
188
|
+
error?: string;
|
|
189
|
+
}
|
|
190
|
+
interface STTResponse {
|
|
191
|
+
success: boolean;
|
|
192
|
+
/** Transcribed text */
|
|
193
|
+
text: string;
|
|
194
|
+
error?: string;
|
|
195
|
+
}
|
|
155
196
|
|
|
156
197
|
/**
|
|
157
198
|
* Activities Module - HTTP Proxy to RealtimeX Main App
|
|
@@ -248,7 +289,7 @@ declare class ApiModule {
|
|
|
248
289
|
/**
|
|
249
290
|
* Make an API call with automatic permission handling
|
|
250
291
|
*/
|
|
251
|
-
|
|
292
|
+
protected apiCall<T>(method: string, endpoint: string, options?: RequestInit): Promise<T>;
|
|
252
293
|
getAgents(): Promise<Agent[]>;
|
|
253
294
|
getWorkspaces(): Promise<Workspace[]>;
|
|
254
295
|
getThreads(workspaceSlug: string): Promise<Thread[]>;
|
|
@@ -755,6 +796,22 @@ declare class TTSModule {
|
|
|
755
796
|
listProviders(): Promise<TTSProvider[]>;
|
|
756
797
|
}
|
|
757
798
|
|
|
799
|
+
declare class STTModule extends ApiModule {
|
|
800
|
+
/**
|
|
801
|
+
* Get available STT providers and their models.
|
|
802
|
+
* @returns Promise resolving to list of providers
|
|
803
|
+
*/
|
|
804
|
+
listProviders(): Promise<STTProvider[]>;
|
|
805
|
+
/**
|
|
806
|
+
* Listen to microphone and transcribe speech to text.
|
|
807
|
+
* Performed on the client device (Electron) via the RealtimeX Hub.
|
|
808
|
+
*
|
|
809
|
+
* @param options Configuration options for listening
|
|
810
|
+
* @returns Promise resolving to the transcribed text
|
|
811
|
+
*/
|
|
812
|
+
listen(options: STTListenOptions): Promise<STTResponse>;
|
|
813
|
+
}
|
|
814
|
+
|
|
758
815
|
/**
|
|
759
816
|
* RealtimeX Local App SDK
|
|
760
817
|
*
|
|
@@ -770,6 +827,7 @@ declare class RealtimeXSDK {
|
|
|
770
827
|
port: PortModule;
|
|
771
828
|
llm: LLMModule;
|
|
772
829
|
tts: TTSModule;
|
|
830
|
+
stt: STTModule;
|
|
773
831
|
readonly appId: string;
|
|
774
832
|
readonly appName: string | undefined;
|
|
775
833
|
readonly apiKey: string | undefined;
|
|
@@ -803,4 +861,4 @@ declare class RealtimeXSDK {
|
|
|
803
861
|
getAppDataDir(): Promise<string>;
|
|
804
862
|
}
|
|
805
863
|
|
|
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 };
|
|
864
|
+
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 STTProvider, type STTProvidersResponse, 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 providers and their models.
|
|
1174
|
+
* @returns Promise resolving to list of providers
|
|
1175
|
+
*/
|
|
1176
|
+
async listProviders() {
|
|
1177
|
+
try {
|
|
1178
|
+
const response = await this.apiCall("GET", "/sdk/stt/providers");
|
|
1179
|
+
if (!response.success) {
|
|
1180
|
+
throw new Error(response.error || "Failed to fetch providers");
|
|
1181
|
+
}
|
|
1182
|
+
return response.providers;
|
|
1183
|
+
} catch (error) {
|
|
1184
|
+
throw new Error(`STT providers 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 providers and their models.
|
|
1125
|
+
* @returns Promise resolving to list of providers
|
|
1126
|
+
*/
|
|
1127
|
+
async listProviders() {
|
|
1128
|
+
try {
|
|
1129
|
+
const response = await this.apiCall("GET", "/sdk/stt/providers");
|
|
1130
|
+
if (!response.success) {
|
|
1131
|
+
throw new Error(response.error || "Failed to fetch providers");
|
|
1132
|
+
}
|
|
1133
|
+
return response.providers;
|
|
1134
|
+
} catch (error) {
|
|
1135
|
+
throw new Error(`STT providers 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,
|