@inworld/cli 1.0.0-rc.1 → 1.0.0-rc.2
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.js +15 -15
- package/package.json +1 -1
- package/dist/package.json +0 -53
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts +0 -10
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js +0 -15
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts +0 -13
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js +0 -2
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts +0 -7
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js +0 -14
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts +0 -14
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js +0 -6
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts +0 -116
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js +0 -71
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts +0 -14
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js +0 -6
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts +0 -78
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js +0 -39
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts +0 -10
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js +0 -6
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts +0 -7
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js +0 -12
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts +0 -115
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js +0 -85
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts +0 -255
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js +0 -87
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js.map +0 -1
- package/dist/proto/generated/portal/fetch.pb.d.ts +0 -26
- package/dist/proto/generated/portal/fetch.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/fetch.pb.js +0 -274
- package/dist/proto/generated/portal/fetch.pb.js.map +0 -1
- package/dist/src/auth/callback_server.d.ts +0 -41
- package/dist/src/auth/callback_server.d.ts.map +0 -1
- package/dist/src/auth/callback_server.js +0 -136
- package/dist/src/auth/callback_server.js.map +0 -1
- package/dist/src/auth/manager.d.ts +0 -97
- package/dist/src/auth/manager.d.ts.map +0 -1
- package/dist/src/auth/manager.js +0 -338
- package/dist/src/auth/manager.js.map +0 -1
- package/dist/src/auth/utils.d.ts +0 -45
- package/dist/src/auth/utils.d.ts.map +0 -1
- package/dist/src/auth/utils.js +0 -183
- package/dist/src/auth/utils.js.map +0 -1
- package/dist/src/commands/auth/disable_telemetry_command.d.ts +0 -3
- package/dist/src/commands/auth/disable_telemetry_command.d.ts.map +0 -1
- package/dist/src/commands/auth/disable_telemetry_command.js +0 -21
- package/dist/src/commands/auth/disable_telemetry_command.js.map +0 -1
- package/dist/src/commands/auth/enable_telemetry_command.d.ts +0 -3
- package/dist/src/commands/auth/enable_telemetry_command.d.ts.map +0 -1
- package/dist/src/commands/auth/enable_telemetry_command.js +0 -22
- package/dist/src/commands/auth/enable_telemetry_command.js.map +0 -1
- package/dist/src/commands/auth/login_ci_command.d.ts +0 -3
- package/dist/src/commands/auth/login_ci_command.d.ts.map +0 -1
- package/dist/src/commands/auth/login_ci_command.js +0 -41
- package/dist/src/commands/auth/login_ci_command.js.map +0 -1
- package/dist/src/commands/auth/login_command.d.ts +0 -4
- package/dist/src/commands/auth/login_command.d.ts.map +0 -1
- package/dist/src/commands/auth/login_command.js +0 -134
- package/dist/src/commands/auth/login_command.js.map +0 -1
- package/dist/src/commands/auth/logout_command.d.ts +0 -4
- package/dist/src/commands/auth/logout_command.d.ts.map +0 -1
- package/dist/src/commands/auth/logout_command.js +0 -54
- package/dist/src/commands/auth/logout_command.js.map +0 -1
- package/dist/src/commands/auth/print_access_token_command.d.ts +0 -3
- package/dist/src/commands/auth/print_access_token_command.d.ts.map +0 -1
- package/dist/src/commands/auth/print_access_token_command.js +0 -21
- package/dist/src/commands/auth/print_access_token_command.js.map +0 -1
- package/dist/src/commands/auth/print_api_key_command.d.ts +0 -3
- package/dist/src/commands/auth/print_api_key_command.d.ts.map +0 -1
- package/dist/src/commands/auth/print_api_key_command.js +0 -26
- package/dist/src/commands/auth/print_api_key_command.js.map +0 -1
- package/dist/src/commands/auth/status_command.d.ts +0 -4
- package/dist/src/commands/auth/status_command.d.ts.map +0 -1
- package/dist/src/commands/auth/status_command.js +0 -84
- package/dist/src/commands/auth/status_command.js.map +0 -1
- package/dist/src/commands/auth_command.d.ts +0 -3
- package/dist/src/commands/auth_command.d.ts.map +0 -1
- package/dist/src/commands/auth_command.js +0 -24
- package/dist/src/commands/auth_command.js.map +0 -1
- package/dist/src/commands/graph/graph_deploy_command.d.ts +0 -24
- package/dist/src/commands/graph/graph_deploy_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_deploy_command.js +0 -204
- package/dist/src/commands/graph/graph_deploy_command.js.map +0 -1
- package/dist/src/commands/graph/graph_init_command.d.ts +0 -4
- package/dist/src/commands/graph/graph_init_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_init_command.js +0 -335
- package/dist/src/commands/graph/graph_init_command.js.map +0 -1
- package/dist/src/commands/graph/graph_run_command.d.ts +0 -24
- package/dist/src/commands/graph/graph_run_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_run_command.js +0 -50
- package/dist/src/commands/graph/graph_run_command.js.map +0 -1
- package/dist/src/commands/graph/graph_serve_command.d.ts +0 -4
- package/dist/src/commands/graph/graph_serve_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_serve_command.js +0 -40
- package/dist/src/commands/graph/graph_serve_command.js.map +0 -1
- package/dist/src/commands/graph/graph_variant_command.d.ts +0 -3
- package/dist/src/commands/graph/graph_variant_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_variant_command.js +0 -13
- package/dist/src/commands/graph/graph_variant_command.js.map +0 -1
- package/dist/src/commands/graph/graph_visualize_command.d.ts +0 -7
- package/dist/src/commands/graph/graph_visualize_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_visualize_command.js +0 -35
- package/dist/src/commands/graph/graph_visualize_command.js.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts +0 -3
- package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_list_command.js +0 -26
- package/dist/src/commands/graph/variant/graph_variant_list_command.js.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts +0 -7
- package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_print_command.js +0 -46
- package/dist/src/commands/graph/variant/graph_variant_print_command.js.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts +0 -3
- package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_register_command.js +0 -46
- package/dist/src/commands/graph/variant/graph_variant_register_command.js.map +0 -1
- package/dist/src/commands/graph_command.d.ts +0 -3
- package/dist/src/commands/graph_command.d.ts.map +0 -1
- package/dist/src/commands/graph_command.js +0 -20
- package/dist/src/commands/graph_command.js.map +0 -1
- package/dist/src/commands/tts/tts_clone_command.d.ts +0 -6
- package/dist/src/commands/tts/tts_clone_command.d.ts.map +0 -1
- package/dist/src/commands/tts/tts_clone_command.js +0 -80
- package/dist/src/commands/tts/tts_clone_command.js.map +0 -1
- package/dist/src/commands/tts/tts_design_command.d.ts +0 -6
- package/dist/src/commands/tts/tts_design_command.d.ts.map +0 -1
- package/dist/src/commands/tts/tts_design_command.js +0 -216
- package/dist/src/commands/tts/tts_design_command.js.map +0 -1
- package/dist/src/commands/tts/tts_list_voices_command.d.ts +0 -6
- package/dist/src/commands/tts/tts_list_voices_command.d.ts.map +0 -1
- package/dist/src/commands/tts/tts_list_voices_command.js +0 -108
- package/dist/src/commands/tts/tts_list_voices_command.js.map +0 -1
- package/dist/src/commands/tts/tts_synthesize_command.d.ts +0 -6
- package/dist/src/commands/tts/tts_synthesize_command.d.ts.map +0 -1
- package/dist/src/commands/tts/tts_synthesize_command.js +0 -351
- package/dist/src/commands/tts/tts_synthesize_command.js.map +0 -1
- package/dist/src/commands/tts/tts_utils.d.ts +0 -14
- package/dist/src/commands/tts/tts_utils.d.ts.map +0 -1
- package/dist/src/commands/tts/tts_utils.js +0 -84
- package/dist/src/commands/tts/tts_utils.js.map +0 -1
- package/dist/src/commands/tts_commands.d.ts +0 -6
- package/dist/src/commands/tts_commands.d.ts.map +0 -1
- package/dist/src/commands/tts_commands.js +0 -18
- package/dist/src/commands/tts_commands.js.map +0 -1
- package/dist/src/commands/workspace_command.d.ts +0 -22
- package/dist/src/commands/workspace_command.d.ts.map +0 -1
- package/dist/src/commands/workspace_command.js +0 -72
- package/dist/src/commands/workspace_command.js.map +0 -1
- package/dist/src/constants.d.ts +0 -11
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -48
- package/dist/src/constants.js.map +0 -1
- package/dist/src/grpc/core/InworldError.d.ts +0 -30
- package/dist/src/grpc/core/InworldError.d.ts.map +0 -1
- package/dist/src/grpc/core/InworldError.js +0 -46
- package/dist/src/grpc/core/InworldError.js.map +0 -1
- package/dist/src/grpc/core/statusCodes.d.ts +0 -122
- package/dist/src/grpc/core/statusCodes.d.ts.map +0 -1
- package/dist/src/grpc/core/statusCodes.js +0 -133
- package/dist/src/grpc/core/statusCodes.js.map +0 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -139
- package/dist/src/index.js.map +0 -1
- package/dist/src/services/analytics.d.ts +0 -45
- package/dist/src/services/analytics.d.ts.map +0 -1
- package/dist/src/services/analytics.js +0 -139
- package/dist/src/services/analytics.js.map +0 -1
- package/dist/src/services/deploy_service.d.ts +0 -4
- package/dist/src/services/deploy_service.d.ts.map +0 -1
- package/dist/src/services/deploy_service.js +0 -128
- package/dist/src/services/deploy_service.js.map +0 -1
- package/dist/src/services/graph_loader.d.ts +0 -7
- package/dist/src/services/graph_loader.d.ts.map +0 -1
- package/dist/src/services/graph_loader.js +0 -103
- package/dist/src/services/graph_loader.js.map +0 -1
- package/dist/src/services/graph_variant_service.d.ts +0 -12
- package/dist/src/services/graph_variant_service.d.ts.map +0 -1
- package/dist/src/services/graph_variant_service.js +0 -66
- package/dist/src/services/graph_variant_service.js.map +0 -1
- package/dist/src/services/template_service.d.ts +0 -79
- package/dist/src/services/template_service.d.ts.map +0 -1
- package/dist/src/services/template_service.js +0 -299
- package/dist/src/services/template_service.js.map +0 -1
- package/dist/src/services/tts_service.d.ts +0 -340
- package/dist/src/services/tts_service.d.ts.map +0 -1
- package/dist/src/services/tts_service.js +0 -320
- package/dist/src/services/tts_service.js.map +0 -1
- package/dist/src/services/update_checker.d.ts +0 -37
- package/dist/src/services/update_checker.d.ts.map +0 -1
- package/dist/src/services/update_checker.js +0 -134
- package/dist/src/services/update_checker.js.map +0 -1
- package/dist/src/services/workspace_service.d.ts +0 -53
- package/dist/src/services/workspace_service.d.ts.map +0 -1
- package/dist/src/services/workspace_service.js +0 -324
- package/dist/src/services/workspace_service.js.map +0 -1
- package/dist/src/utils/array.d.ts +0 -2
- package/dist/src/utils/array.d.ts.map +0 -1
- package/dist/src/utils/array.js +0 -4
- package/dist/src/utils/array.js.map +0 -1
- package/dist/src/utils/audio_player.d.ts +0 -10
- package/dist/src/utils/audio_player.d.ts.map +0 -1
- package/dist/src/utils/audio_player.js +0 -34
- package/dist/src/utils/audio_player.js.map +0 -1
- package/dist/src/utils/confirm.d.ts +0 -62
- package/dist/src/utils/confirm.d.ts.map +0 -1
- package/dist/src/utils/confirm.js +0 -90
- package/dist/src/utils/confirm.js.map +0 -1
- package/dist/src/utils/long_running_operations.d.ts +0 -38
- package/dist/src/utils/long_running_operations.d.ts.map +0 -1
- package/dist/src/utils/long_running_operations.js +0 -62
- package/dist/src/utils/long_running_operations.js.map +0 -1
- package/dist/src/utils/resource_name_helper.d.ts +0 -17
- package/dist/src/utils/resource_name_helper.d.ts.map +0 -1
- package/dist/src/utils/resource_name_helper.js +0 -38
- package/dist/src/utils/resource_name_helper.js.map +0 -1
- package/dist/src/utils/selector.d.ts +0 -62
- package/dist/src/utils/selector.d.ts.map +0 -1
- package/dist/src/utils/selector.js +0 -76
- package/dist/src/utils/selector.js.map +0 -1
- package/dist/src/utils/spinner.d.ts +0 -75
- package/dist/src/utils/spinner.d.ts.map +0 -1
- package/dist/src/utils/spinner.js +0 -178
- package/dist/src/utils/spinner.js.map +0 -1
- package/dist/src/utils/ui.d.ts +0 -27
- package/dist/src/utils/ui.d.ts.map +0 -1
- package/dist/src/utils/ui.js +0 -89
- package/dist/src/utils/ui.js.map +0 -1
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import { createWriteStream } from 'fs';
|
|
3
|
-
import https from 'https';
|
|
4
|
-
import ora from 'ora';
|
|
5
|
-
import os from 'os';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import { TEMPLATES_METADATA_URL } from '@/constants';
|
|
8
|
-
// Default branch for template repositories
|
|
9
|
-
const DEFAULT_TEMPLATE_BRANCH = 'main';
|
|
10
|
-
// Cache expiration time (24 hours in milliseconds)
|
|
11
|
-
const CACHE_EXPIRATION_MS = 24 * 60 * 60 * 1000;
|
|
12
|
-
/**
|
|
13
|
-
* Get cache directory for downloaded templates
|
|
14
|
-
*/
|
|
15
|
-
function getTemplateCachePath() {
|
|
16
|
-
// Use OS temp directory with a subdirectory for inworld templates
|
|
17
|
-
const cacheDir = path.join(os.tmpdir(), 'inworld-cli-templates');
|
|
18
|
-
if (!fs.existsSync(cacheDir)) {
|
|
19
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
20
|
-
}
|
|
21
|
-
return cacheDir;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Fetch templates metadata from the public JSON file
|
|
25
|
-
* Always fetches fresh data (no caching)
|
|
26
|
-
*/
|
|
27
|
-
export async function fetchTemplatesMetadata() {
|
|
28
|
-
try {
|
|
29
|
-
const response = await fetch(TEMPLATES_METADATA_URL);
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
throw new Error(`Failed to fetch templates metadata: ${response.status}`);
|
|
32
|
-
}
|
|
33
|
-
const data = (await response.json());
|
|
34
|
-
const templates = data.templates || [];
|
|
35
|
-
return templates.filter((template) => template.id === 'llm-to-tts-node');
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
throw error;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Extract owner/repo from GitHub URL
|
|
43
|
-
*/
|
|
44
|
-
export function extractRepoFromUrl(githubUrl) {
|
|
45
|
-
const match = githubUrl.match(/github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?$/);
|
|
46
|
-
if (match) {
|
|
47
|
-
return `${match[1]}/${match[2]}`;
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Parse repository string to extract owner and repo
|
|
53
|
-
* Supports formats:
|
|
54
|
-
* - 'owner/repo'
|
|
55
|
-
* - 'https://github.com/owner/repo'
|
|
56
|
-
* - 'https://github.com/owner/repo.git'
|
|
57
|
-
*/
|
|
58
|
-
export function parseRepository(repoString) {
|
|
59
|
-
// Remove .git suffix if present
|
|
60
|
-
let repo = repoString.replace(/\.git$/, '');
|
|
61
|
-
// Extract from URL if it's a full URL
|
|
62
|
-
const urlMatch = repo.match(/github\.com[/:]([^/]+)\/([^/]+)/);
|
|
63
|
-
if (urlMatch) {
|
|
64
|
-
return { owner: urlMatch[1], repo: urlMatch[2] };
|
|
65
|
-
}
|
|
66
|
-
// Assume format is 'owner/repo'
|
|
67
|
-
const parts = repo.split('/');
|
|
68
|
-
if (parts.length !== 2) {
|
|
69
|
-
throw new Error(`Invalid repository format: ${repoString}. Expected 'owner/repo' or GitHub URL.`);
|
|
70
|
-
}
|
|
71
|
-
return { owner: parts[0], repo: parts[1] };
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Copy directory recursively
|
|
75
|
-
* Excludes .git directories and other unnecessary files
|
|
76
|
-
*/
|
|
77
|
-
function copyDirectory(src, dest) {
|
|
78
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
79
|
-
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
80
|
-
// Files/directories to exclude when copying
|
|
81
|
-
const excludeList = [
|
|
82
|
-
'.git',
|
|
83
|
-
'.github',
|
|
84
|
-
'node_modules',
|
|
85
|
-
'.DS_Store',
|
|
86
|
-
'.cache-metadata.json',
|
|
87
|
-
];
|
|
88
|
-
for (const entry of entries) {
|
|
89
|
-
// Skip excluded files/directories
|
|
90
|
-
if (excludeList.includes(entry.name)) {
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
const srcPath = path.join(src, entry.name);
|
|
94
|
-
const destPath = path.join(dest, entry.name);
|
|
95
|
-
if (entry.isDirectory()) {
|
|
96
|
-
copyDirectory(srcPath, destPath);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
fs.copyFileSync(srcPath, destPath);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Download a template from GitHub
|
|
105
|
-
*/
|
|
106
|
-
async function downloadTemplateFromGitHub(templateName, targetPath, repository, branch) {
|
|
107
|
-
// Repository must be provided from metadata
|
|
108
|
-
if (!repository) {
|
|
109
|
-
throw new Error(`No repository found for template '${templateName}'. Please ensure the template exists in the templates metadata.`);
|
|
110
|
-
}
|
|
111
|
-
const { owner, repo } = parseRepository(repository);
|
|
112
|
-
const repoBranch = branch || DEFAULT_TEMPLATE_BRANCH;
|
|
113
|
-
const spinner = ora(`Downloading template '${templateName}' from ${owner}/${repo}...`).start();
|
|
114
|
-
try {
|
|
115
|
-
// Create a temporary directory for downloading
|
|
116
|
-
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'inworld-template-'));
|
|
117
|
-
const zipPath = path.join(tempDir, `${templateName}.zip`);
|
|
118
|
-
// GitHub API URL to download a directory as zip
|
|
119
|
-
// Format: https://api.github.com/repos/{owner}/{repo}/zipball/{branch}
|
|
120
|
-
const archiveUrl = `https://api.github.com/repos/${owner}/${repo}/zipball/${repoBranch}`;
|
|
121
|
-
spinner.text = `Downloading repository archive from ${owner}/${repo}...`;
|
|
122
|
-
// Download the entire repo as zip
|
|
123
|
-
await new Promise((resolve, reject) => {
|
|
124
|
-
https
|
|
125
|
-
.get(archiveUrl, { headers: { 'User-Agent': 'inworld-cli' } }, (res) => {
|
|
126
|
-
if (res.statusCode === 302 && res.headers.location) {
|
|
127
|
-
// Follow redirect
|
|
128
|
-
https
|
|
129
|
-
.get(res.headers.location, { headers: { 'User-Agent': 'inworld-cli' } }, (redirectRes) => {
|
|
130
|
-
if (redirectRes.statusCode !== 200) {
|
|
131
|
-
reject(new Error(`Failed to download: ${redirectRes.statusCode}`));
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const fileStream = createWriteStream(zipPath);
|
|
135
|
-
redirectRes.pipe(fileStream);
|
|
136
|
-
fileStream.on('finish', resolve);
|
|
137
|
-
fileStream.on('error', reject);
|
|
138
|
-
})
|
|
139
|
-
.on('error', reject);
|
|
140
|
-
}
|
|
141
|
-
else if (res.statusCode === 200) {
|
|
142
|
-
const fileStream = createWriteStream(zipPath);
|
|
143
|
-
res.pipe(fileStream);
|
|
144
|
-
fileStream.on('finish', resolve);
|
|
145
|
-
fileStream.on('error', reject);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
reject(new Error(`Failed to download: ${res.statusCode}`));
|
|
149
|
-
}
|
|
150
|
-
})
|
|
151
|
-
.on('error', reject);
|
|
152
|
-
});
|
|
153
|
-
spinner.text = `Extracting template files...`;
|
|
154
|
-
// Extract the zip file
|
|
155
|
-
// @ts-ignore - adm-zip doesn't have type definitions
|
|
156
|
-
const AdmZip = (await import('adm-zip')).default;
|
|
157
|
-
const zip = new AdmZip(zipPath);
|
|
158
|
-
const extractPath = path.join(tempDir, 'extracted');
|
|
159
|
-
zip.extractAllTo(extractPath, true);
|
|
160
|
-
// Find the extracted directory (GitHub adds a commit hash prefix)
|
|
161
|
-
const extractedDirs = fs.readdirSync(extractPath);
|
|
162
|
-
if (extractedDirs.length === 0) {
|
|
163
|
-
throw new Error('Failed to extract template from GitHub');
|
|
164
|
-
}
|
|
165
|
-
const extractedRoot = path.join(extractPath, extractedDirs[0]);
|
|
166
|
-
// The repository is a complete app, so copy everything from the root
|
|
167
|
-
// Verify the repository has content
|
|
168
|
-
const entries = fs.readdirSync(extractedRoot);
|
|
169
|
-
if (entries.length === 0) {
|
|
170
|
-
throw new Error(`Repository ${owner}/${repo} appears to be empty.`);
|
|
171
|
-
}
|
|
172
|
-
spinner.text = `Copying application files...`;
|
|
173
|
-
// Create target directory
|
|
174
|
-
fs.mkdirSync(targetPath, { recursive: true });
|
|
175
|
-
// Copy entire repository contents to target path
|
|
176
|
-
copyDirectory(extractedRoot, targetPath);
|
|
177
|
-
// Cleanup
|
|
178
|
-
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
179
|
-
spinner.stop();
|
|
180
|
-
}
|
|
181
|
-
catch (error) {
|
|
182
|
-
spinner.fail(`Failed to download template: ${error instanceof Error ? error.message : String(error)}`);
|
|
183
|
-
throw error;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Check if cached template is still valid (not expired)
|
|
188
|
-
*/
|
|
189
|
-
function isCacheValid(templateDir) {
|
|
190
|
-
if (!fs.existsSync(templateDir)) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
const cacheMetadataPath = path.join(templateDir, '.cache-metadata.json');
|
|
194
|
-
// If no metadata file, check directory modification time
|
|
195
|
-
if (!fs.existsSync(cacheMetadataPath)) {
|
|
196
|
-
try {
|
|
197
|
-
const stats = fs.statSync(templateDir);
|
|
198
|
-
const age = Date.now() - stats.mtimeMs;
|
|
199
|
-
return age < CACHE_EXPIRATION_MS;
|
|
200
|
-
}
|
|
201
|
-
catch {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
// Check metadata file for expiration
|
|
206
|
-
try {
|
|
207
|
-
const metadata = JSON.parse(fs.readFileSync(cacheMetadataPath, 'utf-8'));
|
|
208
|
-
const age = Date.now() - metadata.cachedAt;
|
|
209
|
-
return age < CACHE_EXPIRATION_MS;
|
|
210
|
-
}
|
|
211
|
-
catch {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Check if template is cached and valid (without downloading)
|
|
217
|
-
*/
|
|
218
|
-
export function isTemplateCached(templateId, forceRefresh) {
|
|
219
|
-
if (forceRefresh) {
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
const cachePath = getTemplateCachePath();
|
|
223
|
-
const templateDir = path.join(cachePath, templateId);
|
|
224
|
-
if (!fs.existsSync(templateDir)) {
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
const files = fs.readdirSync(templateDir);
|
|
228
|
-
return files.length > 0 && isCacheValid(templateDir);
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Write cache metadata file
|
|
232
|
-
*/
|
|
233
|
-
function writeCacheMetadata(templateDir) {
|
|
234
|
-
const cacheMetadataPath = path.join(templateDir, '.cache-metadata.json');
|
|
235
|
-
const metadata = {
|
|
236
|
-
cachedAt: Date.now(),
|
|
237
|
-
};
|
|
238
|
-
fs.writeFileSync(cacheMetadataPath, JSON.stringify(metadata, null, 2));
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Download and cache a template from GitHub
|
|
242
|
-
* Returns the path to the cached template directory and whether it was from cache
|
|
243
|
-
*/
|
|
244
|
-
export async function downloadAndCacheTemplate(templateId, repository, branch, forceRefresh = false) {
|
|
245
|
-
const cachePath = getTemplateCachePath();
|
|
246
|
-
// Use template ID for cache directory (normalized, consistent)
|
|
247
|
-
const templateDir = path.join(cachePath, templateId);
|
|
248
|
-
// Check if already cached and not expired (unless force refresh)
|
|
249
|
-
if (!forceRefresh && fs.existsSync(templateDir)) {
|
|
250
|
-
const files = fs.readdirSync(templateDir);
|
|
251
|
-
if (files.length > 0 && isCacheValid(templateDir)) {
|
|
252
|
-
return { path: templateDir, fromCache: true };
|
|
253
|
-
}
|
|
254
|
-
// Cache expired or invalid, remove it
|
|
255
|
-
if (fs.existsSync(templateDir)) {
|
|
256
|
-
fs.rmSync(templateDir, { recursive: true, force: true });
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
// Download from GitHub - repository must be provided from metadata
|
|
260
|
-
if (!repository) {
|
|
261
|
-
throw new Error(`No repository found for template '${templateId}'. Please ensure the template exists in the templates metadata.`);
|
|
262
|
-
}
|
|
263
|
-
await downloadTemplateFromGitHub(templateId, templateDir, repository, branch);
|
|
264
|
-
if (!fs.existsSync(templateDir)) {
|
|
265
|
-
throw new Error(`Template '${templateId}' was not downloaded correctly.`);
|
|
266
|
-
}
|
|
267
|
-
// Write cache metadata
|
|
268
|
-
writeCacheMetadata(templateDir);
|
|
269
|
-
return { path: templateDir, fromCache: false };
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Get available templates from metadata URL
|
|
273
|
-
*/
|
|
274
|
-
export async function getAvailableTemplatesWithMetadata() {
|
|
275
|
-
const templates = [];
|
|
276
|
-
try {
|
|
277
|
-
// Fetch templates from metadata URL
|
|
278
|
-
const metadataTemplates = await fetchTemplatesMetadata();
|
|
279
|
-
for (const template of metadataTemplates) {
|
|
280
|
-
const templateInfo = {
|
|
281
|
-
directory: template.id || template.name,
|
|
282
|
-
metadata: template,
|
|
283
|
-
};
|
|
284
|
-
templates.push(templateInfo);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
catch (error) {
|
|
288
|
-
throw error;
|
|
289
|
-
}
|
|
290
|
-
return templates.filter((template) => template.metadata.id === 'llm-to-tts-node');
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Copy directory recursively (exported for use in command)
|
|
294
|
-
* Excludes .git directories and other unnecessary files
|
|
295
|
-
*/
|
|
296
|
-
export function copyTemplateDirectory(src, dest) {
|
|
297
|
-
copyDirectory(src, dest);
|
|
298
|
-
}
|
|
299
|
-
//# sourceMappingURL=template_service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template_service.js","sourceRoot":"","sources":["../../../src/services/template_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,2CAA2C;AAC3C,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC,mDAAmD;AACnD,MAAM,mBAAmB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAsChD;;GAEG;AACH,SAAS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M,sBAAsB,EAAE,CAAC;QAEzD,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE,CAAC;YACzC,MAAM,YAAY,GAAiB;gBACjC,SAAS,EAAE,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI;gBACvC,QAAQ,EAAE,QAAQ;aACnB,CAAC;YAEF,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO,SAAS,CAAC,MAAM,CACrB,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,iBAAiB,CACzD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW,EAAE,IAAY;IAC7D,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Audio encoding options for TTS
|
|
3
|
-
* @see {@link https://docs.inworld.ai/docs/tts/tts/}
|
|
4
|
-
*/
|
|
5
|
-
export declare enum AudioEncoding {
|
|
6
|
-
LINEAR16 = "LINEAR16",
|
|
7
|
-
MP3 = "MP3",
|
|
8
|
-
OGG_OPUS = "OGG_OPUS",
|
|
9
|
-
ALAW = "ALAW",
|
|
10
|
-
MULAW = "MULAW",
|
|
11
|
-
FLAC = "FLAC",
|
|
12
|
-
PCM = "PCM",
|
|
13
|
-
WAV = "WAV"
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Available TTS models
|
|
17
|
-
* @see {@link https://docs.inworld.ai/docs/tts/tts/}
|
|
18
|
-
*/
|
|
19
|
-
export declare enum TTSModel {
|
|
20
|
-
/** @deprecated Use INWORLD_TTS_1_5_MINI or INWORLD_TTS_1_5_MAX instead */
|
|
21
|
-
INWORLD_TTS_1 = "inworld-tts-1",
|
|
22
|
-
/** @deprecated Use INWORLD_TTS_1_5_MINI or INWORLD_TTS_1_5_MAX instead */
|
|
23
|
-
INWORLD_TTS_1_MAX = "inworld-tts-1-max",
|
|
24
|
-
INWORLD_TTS_1_5_MINI = "inworld-tts-1.5-mini",
|
|
25
|
-
INWORLD_TTS_1_5_MAX = "inworld-tts-1.5-max"
|
|
26
|
-
}
|
|
27
|
-
/** Legacy model IDs that trigger deprecation warnings */
|
|
28
|
-
export declare const LEGACY_MODELS: Set<TTSModel>;
|
|
29
|
-
/**
|
|
30
|
-
* Timestamp types for alignment data
|
|
31
|
-
*/
|
|
32
|
-
export declare enum TimestampType {
|
|
33
|
-
UNSPECIFIED = "TIMESTAMP_TYPE_UNSPECIFIED",
|
|
34
|
-
WORD = "WORD",
|
|
35
|
-
CHARACTER = "CHARACTER"
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Text normalization options
|
|
39
|
-
*/
|
|
40
|
-
export declare enum TextNormalization {
|
|
41
|
-
ON = "ON",
|
|
42
|
-
OFF = "OFF"
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Audio configuration for TTS synthesis
|
|
46
|
-
*/
|
|
47
|
-
export interface AudioConfig {
|
|
48
|
-
/** The desired output format of the synthesized audio. Defaults to MP3. */
|
|
49
|
-
audioEncoding?: AudioEncoding;
|
|
50
|
-
/** Bits per second of the audio. Only for compressed audio formats (MP3, OGG_OPUS). Default is 128,000. */
|
|
51
|
-
bitRate?: number;
|
|
52
|
-
/** The synthesis sample rate (in hertz) for this audio. Accepts values within the range [8000, 48000]. Default is 48,000. */
|
|
53
|
-
sampleRateHertz?: number;
|
|
54
|
-
/** Speaking rate/speed, in the range [0.5, 1.5]. Default is 1.0. */
|
|
55
|
-
speakingRate?: number;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Request options for synthesizing speech
|
|
59
|
-
*/
|
|
60
|
-
export interface SynthesizeSpeechRequest {
|
|
61
|
-
/** The text to be synthesized into speech. Maximum input of 2,000 characters. */
|
|
62
|
-
text: string;
|
|
63
|
-
/** The ID of the voice to use for synthesizing speech. */
|
|
64
|
-
voiceId: string;
|
|
65
|
-
/** The ID of the model to use for synthesizing speech. */
|
|
66
|
-
modelId: TTSModel;
|
|
67
|
-
/** Audio configuration options. */
|
|
68
|
-
audioConfig?: AudioConfig;
|
|
69
|
-
/** Determines the degree of randomness when sampling audio tokens. Range (0, 2]. Default is 1.1. */
|
|
70
|
-
temperature?: number;
|
|
71
|
-
/** Controls timestamp metadata returned with the audio. */
|
|
72
|
-
timestampType?: TimestampType;
|
|
73
|
-
/** Controls text normalization. */
|
|
74
|
-
applyTextNormalization?: TextNormalization;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Phonetic detail for a word (TTS 1.5+)
|
|
78
|
-
*/
|
|
79
|
-
export interface PhoneticDetail {
|
|
80
|
-
/** IPA phoneme symbol */
|
|
81
|
-
phoneSymbol: string;
|
|
82
|
-
/** Start time in seconds */
|
|
83
|
-
startTimeSeconds: number;
|
|
84
|
-
/** Duration in seconds */
|
|
85
|
-
durationSeconds: number;
|
|
86
|
-
/** Viseme symbol for lip-sync (e.g., 'aei', 'bmp', 'fv') */
|
|
87
|
-
visemeSymbol?: string;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Word alignment information
|
|
91
|
-
*/
|
|
92
|
-
export interface WordAlignment {
|
|
93
|
-
/** Aligned words in order. */
|
|
94
|
-
words: string[];
|
|
95
|
-
/** Start time for each word in seconds from the beginning of the audio. */
|
|
96
|
-
wordStartTimeSeconds: number[];
|
|
97
|
-
/** End time for each word in seconds from the beginning of the audio. */
|
|
98
|
-
wordEndTimeSeconds: number[];
|
|
99
|
-
/** Phoneme-level details including IPA and visemes (TTS 1.5+). */
|
|
100
|
-
phoneticDetails?: PhoneticDetail[];
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Character alignment information
|
|
104
|
-
*/
|
|
105
|
-
export interface CharacterAlignment {
|
|
106
|
-
/** Aligned characters (including punctuation and spaces) in order. */
|
|
107
|
-
characters: string[];
|
|
108
|
-
/** Start time for each character in seconds from the beginning of the audio. */
|
|
109
|
-
characterStartTimeSeconds: number[];
|
|
110
|
-
/** End time for each character in seconds from the beginning of the audio. */
|
|
111
|
-
characterEndTimeSeconds: number[];
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Timestamp information for synthesized speech
|
|
115
|
-
*/
|
|
116
|
-
export interface TimestampInfo {
|
|
117
|
-
/** Word-level alignment when timestampType is WORD. */
|
|
118
|
-
wordAlignment?: WordAlignment;
|
|
119
|
-
/** Character-level alignment when timestampType is CHARACTER. */
|
|
120
|
-
characterAlignment?: CharacterAlignment;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Usage information from the API response
|
|
124
|
-
*/
|
|
125
|
-
export interface Usage {
|
|
126
|
-
/** Number of characters processed for billing */
|
|
127
|
-
processedCharactersCount: number;
|
|
128
|
-
/** Model used for synthesis */
|
|
129
|
-
modelId: string;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Response from synthesizing speech
|
|
133
|
-
*/
|
|
134
|
-
export interface SynthesizeSpeechResponse {
|
|
135
|
-
/** The audio data bytes encoded in the format specified in the request. Base64 encoded. */
|
|
136
|
-
audioContent: string;
|
|
137
|
-
/** Timestamp alignment information (present when alignment is enabled). */
|
|
138
|
-
timestampInfo?: TimestampInfo;
|
|
139
|
-
/** Usage/billing information. */
|
|
140
|
-
usage?: Usage;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Voice information
|
|
144
|
-
*/
|
|
145
|
-
export interface Voice {
|
|
146
|
-
/** The language(s) of the original voice audio. */
|
|
147
|
-
languages: string[];
|
|
148
|
-
/** The ID of the voice. */
|
|
149
|
-
voiceId: string;
|
|
150
|
-
/** The display name of the voice. */
|
|
151
|
-
displayName?: string;
|
|
152
|
-
/** The description of the voice. */
|
|
153
|
-
description?: string;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Response from listing voices
|
|
157
|
-
*/
|
|
158
|
-
export interface ListVoicesResponse {
|
|
159
|
-
/** The list of voices. */
|
|
160
|
-
voices: Voice[];
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Error response from the API
|
|
164
|
-
*/
|
|
165
|
-
export interface ErrorResponse {
|
|
166
|
-
/** The error code, as specified by gRPC status codes. */
|
|
167
|
-
code: number;
|
|
168
|
-
/** A short description of the error. */
|
|
169
|
-
message: string;
|
|
170
|
-
/** Additional error details. */
|
|
171
|
-
details?: any[];
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Request performance metrics
|
|
175
|
-
*/
|
|
176
|
-
export interface RequestMetrics {
|
|
177
|
-
/** Time when the request started (ms) */
|
|
178
|
-
startTime: number;
|
|
179
|
-
/** Time to first byte (ms) */
|
|
180
|
-
ttfb: number;
|
|
181
|
-
/** Total request time (ms) */
|
|
182
|
-
totalTime: number;
|
|
183
|
-
/** Estimated response size in bytes */
|
|
184
|
-
responseSize: number;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Streaming performance metrics
|
|
188
|
-
*/
|
|
189
|
-
export interface StreamingMetrics {
|
|
190
|
-
/** Time when the request started (ms) */
|
|
191
|
-
startTime: number;
|
|
192
|
-
/** Time to first chunk (ms) */
|
|
193
|
-
timeToFirstChunk: number;
|
|
194
|
-
/** Total streaming time (ms) */
|
|
195
|
-
totalTime: number;
|
|
196
|
-
/** Number of chunks received */
|
|
197
|
-
chunksReceived: number;
|
|
198
|
-
/** Total bytes received */
|
|
199
|
-
totalBytes: number;
|
|
200
|
-
/** Individual chunk sizes */
|
|
201
|
-
chunkSizes: number[];
|
|
202
|
-
/** Time between chunks (ms) */
|
|
203
|
-
chunkIntervals: number[];
|
|
204
|
-
/** Error chunks received */
|
|
205
|
-
errorChunks: number;
|
|
206
|
-
}
|
|
207
|
-
export interface VoiceSample {
|
|
208
|
-
/** Base64-encoded audio data */
|
|
209
|
-
audioData: string;
|
|
210
|
-
/** Transcription of the audio */
|
|
211
|
-
transcription?: string;
|
|
212
|
-
}
|
|
213
|
-
export interface CloneVoiceRequest {
|
|
214
|
-
displayName: string;
|
|
215
|
-
langCode: string;
|
|
216
|
-
voiceSamples: VoiceSample[];
|
|
217
|
-
description?: string;
|
|
218
|
-
tags?: string[];
|
|
219
|
-
audioProcessingConfig?: {
|
|
220
|
-
removeBackgroundNoise?: boolean;
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
export interface ValidatedSample {
|
|
224
|
-
audioData: string;
|
|
225
|
-
errors: string[];
|
|
226
|
-
langCode: string;
|
|
227
|
-
transcription: string;
|
|
228
|
-
warnings: string[];
|
|
229
|
-
}
|
|
230
|
-
export interface ClonedVoice {
|
|
231
|
-
voiceId: string;
|
|
232
|
-
langCode: string;
|
|
233
|
-
displayName: string;
|
|
234
|
-
description: string;
|
|
235
|
-
tags: string[];
|
|
236
|
-
name: string;
|
|
237
|
-
source: string;
|
|
238
|
-
}
|
|
239
|
-
export interface CloneVoiceResponse {
|
|
240
|
-
audioSamplesValidated: ValidatedSample[];
|
|
241
|
-
voice: ClonedVoice;
|
|
242
|
-
}
|
|
243
|
-
export interface DesignVoiceRequest {
|
|
244
|
-
langCode: string;
|
|
245
|
-
designPrompt: string;
|
|
246
|
-
previewText: string;
|
|
247
|
-
voiceDesignConfig?: {
|
|
248
|
-
numberOfSamples?: number;
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
export interface PreviewVoice {
|
|
252
|
-
voiceId: string;
|
|
253
|
-
previewText: string;
|
|
254
|
-
previewAudio: string;
|
|
255
|
-
}
|
|
256
|
-
export interface DesignVoiceResponse {
|
|
257
|
-
langCode: string;
|
|
258
|
-
previewVoices: PreviewVoice[];
|
|
259
|
-
}
|
|
260
|
-
export interface PublishVoiceRequest {
|
|
261
|
-
displayName: string;
|
|
262
|
-
description: string;
|
|
263
|
-
tags?: string[];
|
|
264
|
-
}
|
|
265
|
-
export interface PublishedVoice {
|
|
266
|
-
voiceId: string;
|
|
267
|
-
langCode: string;
|
|
268
|
-
displayName: string;
|
|
269
|
-
description: string;
|
|
270
|
-
tags: string[];
|
|
271
|
-
name: string;
|
|
272
|
-
source: string;
|
|
273
|
-
}
|
|
274
|
-
export interface GeneratePreviewTextResponse {
|
|
275
|
-
previewText: string;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* TTS Service for interacting with Inworld's Text-to-Speech API
|
|
279
|
-
*/
|
|
280
|
-
export declare class TTSService {
|
|
281
|
-
private apiKey;
|
|
282
|
-
private ensureApiKey;
|
|
283
|
-
/** Builds the API base URL from the platform URL */
|
|
284
|
-
private get apiBaseUrl();
|
|
285
|
-
/**
|
|
286
|
-
* Makes an authenticated request to the Inworld API
|
|
287
|
-
*/
|
|
288
|
-
private makeRequest;
|
|
289
|
-
/**
|
|
290
|
-
* Lists all available voices based on the provided filter
|
|
291
|
-
*/
|
|
292
|
-
listVoices(filter?: string): Promise<ListVoicesResponse>;
|
|
293
|
-
/**
|
|
294
|
-
* Synthesizes speech from text
|
|
295
|
-
*/
|
|
296
|
-
synthesizeSpeech(request: SynthesizeSpeechRequest): Promise<SynthesizeSpeechResponse>;
|
|
297
|
-
/**
|
|
298
|
-
* Synthesizes speech from text with performance metrics
|
|
299
|
-
*/
|
|
300
|
-
synthesizeSpeechWithMetrics(request: SynthesizeSpeechRequest): Promise<SynthesizeSpeechResponse & {
|
|
301
|
-
_metrics?: RequestMetrics;
|
|
302
|
-
}>;
|
|
303
|
-
/**
|
|
304
|
-
* Synthesizes speech using streaming API
|
|
305
|
-
*/
|
|
306
|
-
synthesizeSpeechStream(request: SynthesizeSpeechRequest, onChunk: (chunk: {
|
|
307
|
-
audioContent?: string;
|
|
308
|
-
timestampInfo?: TimestampInfo;
|
|
309
|
-
error?: ErrorResponse;
|
|
310
|
-
}) => void, trackMetrics?: boolean): Promise<{
|
|
311
|
-
_metrics?: StreamingMetrics;
|
|
312
|
-
}>;
|
|
313
|
-
/**
|
|
314
|
-
* Helper method to synthesize speech with simple parameters
|
|
315
|
-
*/
|
|
316
|
-
synthesize(text: string, voiceId: string, modelId?: TTSModel): Promise<SynthesizeSpeechResponse>;
|
|
317
|
-
/**
|
|
318
|
-
* Saves synthesized audio to a file
|
|
319
|
-
*/
|
|
320
|
-
saveAudioToFile(audioContent: string, filepath: string): Promise<void>;
|
|
321
|
-
/**
|
|
322
|
-
* Clones a voice from audio samples
|
|
323
|
-
*/
|
|
324
|
-
cloneVoice(request: CloneVoiceRequest): Promise<CloneVoiceResponse>;
|
|
325
|
-
/**
|
|
326
|
-
* Generates preview text for voice design
|
|
327
|
-
*/
|
|
328
|
-
generatePreviewText(workspace: string, description: string, langCode: string): Promise<GeneratePreviewTextResponse>;
|
|
329
|
-
/**
|
|
330
|
-
* Designs a voice from a text description
|
|
331
|
-
*/
|
|
332
|
-
designVoice(request: DesignVoiceRequest): Promise<DesignVoiceResponse>;
|
|
333
|
-
/**
|
|
334
|
-
* Publishes a designed voice preview to the voice library
|
|
335
|
-
*/
|
|
336
|
-
publishVoice(voiceId: string, request: PublishVoiceRequest): Promise<PublishedVoice>;
|
|
337
|
-
}
|
|
338
|
-
export declare const ttsService: TTSService;
|
|
339
|
-
export declare const synthesizeSpeech: (text: string, voice: string) => Promise<SynthesizeSpeechResponse>;
|
|
340
|
-
//# sourceMappingURL=tts_service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tts_service.d.ts","sourceRoot":"","sources":["../../../src/services/tts_service.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,oBAAY,aAAa;IACvB,QAAQ,aAAa;IACrB,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED;;;GAGG;AACH,oBAAY,QAAQ;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