@inworld/cli 0.3.1 → 2.0.0-rc.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.js +829 -305
- package/package.json +8 -2
- package/dist/index.js.map +0 -7
- package/dist/package.json +0 -49
- 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 -16
- 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 -15
- 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 -7
- 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 -7
- 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 -76
- 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 -40
- 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 -7
- 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 -13
- 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 -86
- 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 -88
- 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 -340
- 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/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/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 -20
- 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 -191
- 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 -376
- 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 -25
- 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 -45
- 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 -45
- 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_commands.d.ts +0 -17
- package/dist/src/commands/tts_commands.d.ts.map +0 -1
- package/dist/src/commands/tts_commands.js +0 -568
- package/dist/src/commands/tts_commands.js.map +0 -1
- package/dist/src/commands/workspace_command.d.ts +0 -12
- package/dist/src/commands/workspace_command.d.ts.map +0 -1
- package/dist/src/commands/workspace_command.js +0 -33
- package/dist/src/commands/workspace_command.js.map +0 -1
- package/dist/src/constants.d.ts +0 -10
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -30
- 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/services/analytics.d.ts +0 -45
- package/dist/src/services/analytics.d.ts.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/tts_service.d.ts +0 -273
- package/dist/src/services/tts_service.d.ts.map +0 -1
- package/dist/src/services/tts_service.js +0 -299
- 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/workspace_service.d.ts +0 -47
- package/dist/src/services/workspace_service.d.ts.map +0 -1
- package/dist/src/services/workspace_service.js +0 -222
- package/dist/src/services/workspace_service.js.map +0 -1
- package/dist/src/templates/llm_tts/README.md +0 -161
- package/dist/src/templates/llm_tts/graph.d.ts +0 -2
- package/dist/src/templates/llm_tts/graph.d.ts.map +0 -1
- package/dist/src/templates/llm_tts/graph.ts +0 -30
- package/dist/src/templates/llm_tts/metadata.json +0 -41
- 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/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 -12
- package/dist/src/utils/resource_name_helper.d.ts.map +0 -1
- package/dist/src/utils/resource_name_helper.js +0 -29
- 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 -77
- 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 -83
- package/dist/src/utils/ui.js.map +0 -1
- package/dist/templates/llm_tts/README.md +0 -155
- package/dist/templates/llm_tts/graph.ts +0 -29
- package/dist/templates/llm_tts/metadata.json +0 -41
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { requireApiKey } from '@/auth/utils';
|
|
2
|
-
import { PLATFORM_URL } from '@/constants';
|
|
3
|
-
/**
|
|
4
|
-
* Audio encoding options for TTS
|
|
5
|
-
* @see {@link https://api.inworld.ai/docs/models#tts}
|
|
6
|
-
*/
|
|
7
|
-
export var AudioEncoding;
|
|
8
|
-
(function (AudioEncoding) {
|
|
9
|
-
AudioEncoding["LINEAR16"] = "LINEAR16";
|
|
10
|
-
AudioEncoding["MP3"] = "MP3";
|
|
11
|
-
AudioEncoding["OGG_OPUS"] = "OGG_OPUS";
|
|
12
|
-
AudioEncoding["ALAW"] = "ALAW";
|
|
13
|
-
AudioEncoding["MULAW"] = "MULAW";
|
|
14
|
-
})(AudioEncoding || (AudioEncoding = {}));
|
|
15
|
-
/**
|
|
16
|
-
* Available TTS models
|
|
17
|
-
* @see {@link https://api.inworld.ai/docs/models#tts}
|
|
18
|
-
*/
|
|
19
|
-
export var TTSModel;
|
|
20
|
-
(function (TTSModel) {
|
|
21
|
-
TTSModel["INWORLD_TTS_1"] = "inworld-tts-1";
|
|
22
|
-
TTSModel["INWORLD_TTS_1_MAX"] = "inworld-tts-1-max";
|
|
23
|
-
})(TTSModel || (TTSModel = {}));
|
|
24
|
-
/**
|
|
25
|
-
* Timestamp types for alignment data
|
|
26
|
-
*/
|
|
27
|
-
export var TimestampType;
|
|
28
|
-
(function (TimestampType) {
|
|
29
|
-
TimestampType["UNSPECIFIED"] = "TIMESTAMP_TYPE_UNSPECIFIED";
|
|
30
|
-
TimestampType["WORD"] = "WORD";
|
|
31
|
-
TimestampType["CHARACTER"] = "CHARACTER";
|
|
32
|
-
})(TimestampType || (TimestampType = {}));
|
|
33
|
-
/**
|
|
34
|
-
* TTS Service for interacting with Inworld's Text-to-Speech API
|
|
35
|
-
* @description Provides methods for listing voices and synthesizing speech
|
|
36
|
-
*/
|
|
37
|
-
export class TTSService {
|
|
38
|
-
apiKey = null;
|
|
39
|
-
/**
|
|
40
|
-
* Ensures the API key is available
|
|
41
|
-
* @private
|
|
42
|
-
*/
|
|
43
|
-
async ensureApiKey() {
|
|
44
|
-
if (!this.apiKey) {
|
|
45
|
-
this.apiKey = await requireApiKey();
|
|
46
|
-
}
|
|
47
|
-
return this.apiKey;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Makes an authenticated request to the Inworld API
|
|
51
|
-
* @private
|
|
52
|
-
*/
|
|
53
|
-
async makeRequest(endpoint, options = {}, trackMetrics = false) {
|
|
54
|
-
const apiKey = await this.ensureApiKey();
|
|
55
|
-
const url = `${PLATFORM_URL.replace('platform', 'api')}${endpoint}`;
|
|
56
|
-
const metrics = trackMetrics
|
|
57
|
-
? {
|
|
58
|
-
startTime: Date.now(),
|
|
59
|
-
ttfb: 0,
|
|
60
|
-
totalTime: 0,
|
|
61
|
-
responseSize: 0,
|
|
62
|
-
}
|
|
63
|
-
: {};
|
|
64
|
-
const response = await fetch(url, {
|
|
65
|
-
...options,
|
|
66
|
-
headers: {
|
|
67
|
-
Authorization: `Basic ${apiKey}`,
|
|
68
|
-
'Content-Type': 'application/json',
|
|
69
|
-
...options.headers,
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
if (trackMetrics) {
|
|
73
|
-
metrics.ttfb = Date.now() - metrics.startTime;
|
|
74
|
-
}
|
|
75
|
-
const data = await response.json();
|
|
76
|
-
if (trackMetrics) {
|
|
77
|
-
metrics.totalTime = Date.now() - metrics.startTime;
|
|
78
|
-
// Estimate response size from JSON string
|
|
79
|
-
metrics.responseSize = JSON.stringify(data).length;
|
|
80
|
-
}
|
|
81
|
-
if (!response.ok) {
|
|
82
|
-
const error = data;
|
|
83
|
-
throw new Error(`TTS API Error [${error.code || response.status}]: ${error.message || 'Unknown error'}`);
|
|
84
|
-
}
|
|
85
|
-
const result = data;
|
|
86
|
-
if (trackMetrics) {
|
|
87
|
-
result._metrics = metrics;
|
|
88
|
-
}
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Lists all available voices based on the provided filter
|
|
93
|
-
* @param filter - Optional filter expression (e.g., "language=en")
|
|
94
|
-
* @returns Promise resolving to the list of available voices
|
|
95
|
-
* @example
|
|
96
|
-
* ```typescript
|
|
97
|
-
* const ttsService = new TTSService();
|
|
98
|
-
* const voices = await ttsService.listVoices('language=en');
|
|
99
|
-
* console.log(voices.voices);
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
async listVoices(filter) {
|
|
103
|
-
const params = filter ? `?filter=${encodeURIComponent(filter)}` : '';
|
|
104
|
-
return this.makeRequest(`/tts/v1/voices${params}`, {
|
|
105
|
-
method: 'GET',
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Synthesizes speech from text
|
|
110
|
-
* @param request - The synthesis request parameters
|
|
111
|
-
* @returns Promise resolving to the synthesized audio data and optional timestamp information
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* const ttsService = new TTSService();
|
|
115
|
-
* const result = await ttsService.synthesizeSpeech({
|
|
116
|
-
* text: 'Hello, world!',
|
|
117
|
-
* voiceId: 'Dennis',
|
|
118
|
-
* modelId: TTSModel.INWORLD_TTS_1,
|
|
119
|
-
* timestampType: TimestampType.WORD,
|
|
120
|
-
* });
|
|
121
|
-
* // result.audioContent is base64 encoded audio data
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
async synthesizeSpeech(request) {
|
|
125
|
-
return this.makeRequest('/tts/v1/voice', {
|
|
126
|
-
method: 'POST',
|
|
127
|
-
body: JSON.stringify(request),
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Synthesizes speech from text with performance metrics
|
|
132
|
-
* @param request - The synthesis request parameters
|
|
133
|
-
* @returns Promise resolving to the synthesized audio data with metrics
|
|
134
|
-
*/
|
|
135
|
-
async synthesizeSpeechWithMetrics(request) {
|
|
136
|
-
return this.makeRequest('/tts/v1/voice', {
|
|
137
|
-
method: 'POST',
|
|
138
|
-
body: JSON.stringify(request),
|
|
139
|
-
}, true);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Synthesizes speech using streaming API
|
|
143
|
-
* @param request - The synthesis request parameters
|
|
144
|
-
* @param onChunk - Callback for each audio chunk received
|
|
145
|
-
* @param trackMetrics - Whether to track streaming metrics
|
|
146
|
-
* @returns Promise resolving when stream completes, with optional metrics
|
|
147
|
-
*/
|
|
148
|
-
async synthesizeSpeechStream(request, onChunk, trackMetrics = false) {
|
|
149
|
-
const apiKey = await this.ensureApiKey();
|
|
150
|
-
const url = `${PLATFORM_URL.replace('platform', 'api')}/tts/v1/voice:stream`;
|
|
151
|
-
const metrics = trackMetrics
|
|
152
|
-
? {
|
|
153
|
-
startTime: Date.now(),
|
|
154
|
-
timeToFirstChunk: 0,
|
|
155
|
-
totalTime: 0,
|
|
156
|
-
chunksReceived: 0,
|
|
157
|
-
totalBytes: 0,
|
|
158
|
-
chunkSizes: [],
|
|
159
|
-
chunkIntervals: [],
|
|
160
|
-
errorChunks: 0,
|
|
161
|
-
}
|
|
162
|
-
: {};
|
|
163
|
-
const response = await fetch(url, {
|
|
164
|
-
method: 'POST',
|
|
165
|
-
headers: {
|
|
166
|
-
Authorization: `Basic ${apiKey}`,
|
|
167
|
-
'Content-Type': 'application/json',
|
|
168
|
-
},
|
|
169
|
-
body: JSON.stringify(request),
|
|
170
|
-
});
|
|
171
|
-
if (!response.ok) {
|
|
172
|
-
const error = (await response.json());
|
|
173
|
-
throw new Error(`TTS Stream API Error [${error.code || response.status}]: ${error.message || 'Unknown error'}`);
|
|
174
|
-
}
|
|
175
|
-
if (!response.body) {
|
|
176
|
-
throw new Error('No response body received from streaming endpoint');
|
|
177
|
-
}
|
|
178
|
-
const reader = response.body.getReader();
|
|
179
|
-
const decoder = new TextDecoder();
|
|
180
|
-
let buffer = '';
|
|
181
|
-
let lastChunkTime = trackMetrics ? Date.now() : 0;
|
|
182
|
-
let isFirstChunk = true;
|
|
183
|
-
try {
|
|
184
|
-
while (true) {
|
|
185
|
-
const { done, value } = await reader.read();
|
|
186
|
-
if (done)
|
|
187
|
-
break;
|
|
188
|
-
// Decode the chunk
|
|
189
|
-
buffer += decoder.decode(value, { stream: true });
|
|
190
|
-
// Process complete lines
|
|
191
|
-
const lines = buffer.split('\n');
|
|
192
|
-
buffer = lines.pop() || ''; // Keep incomplete line in buffer
|
|
193
|
-
for (const line of lines) {
|
|
194
|
-
if (!line.trim())
|
|
195
|
-
continue; // Skip empty lines
|
|
196
|
-
try {
|
|
197
|
-
const data = JSON.parse(line);
|
|
198
|
-
if (trackMetrics) {
|
|
199
|
-
const now = Date.now();
|
|
200
|
-
if (isFirstChunk) {
|
|
201
|
-
metrics.timeToFirstChunk = now - metrics.startTime;
|
|
202
|
-
isFirstChunk = false;
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
metrics.chunkIntervals.push(now - lastChunkTime);
|
|
206
|
-
}
|
|
207
|
-
lastChunkTime = now;
|
|
208
|
-
metrics.chunksReceived++;
|
|
209
|
-
if (data.result?.audioContent) {
|
|
210
|
-
const chunkSize = data.result.audioContent.length;
|
|
211
|
-
metrics.chunkSizes.push(chunkSize);
|
|
212
|
-
metrics.totalBytes += chunkSize;
|
|
213
|
-
}
|
|
214
|
-
if (data.error) {
|
|
215
|
-
metrics.errorChunks++;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
// Pass the chunk to the callback
|
|
219
|
-
if (data.result) {
|
|
220
|
-
onChunk(data.result);
|
|
221
|
-
}
|
|
222
|
-
else if (data.error) {
|
|
223
|
-
onChunk({ error: data.error });
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
catch (e) {
|
|
227
|
-
console.error('Failed to parse streaming chunk:', e);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
// Process any remaining data in buffer
|
|
232
|
-
if (buffer.trim()) {
|
|
233
|
-
try {
|
|
234
|
-
const data = JSON.parse(buffer);
|
|
235
|
-
if (data.result) {
|
|
236
|
-
onChunk(data.result);
|
|
237
|
-
}
|
|
238
|
-
else if (data.error) {
|
|
239
|
-
onChunk({ error: data.error });
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
catch (e) {
|
|
243
|
-
console.error('Failed to parse final chunk:', e);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
finally {
|
|
248
|
-
reader.releaseLock();
|
|
249
|
-
}
|
|
250
|
-
if (trackMetrics) {
|
|
251
|
-
metrics.totalTime = Date.now() - metrics.startTime;
|
|
252
|
-
}
|
|
253
|
-
return trackMetrics ? { _metrics: metrics } : {};
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Helper method to synthesize speech with simple parameters
|
|
257
|
-
* @param text - The text to synthesize
|
|
258
|
-
* @param voiceId - The voice ID to use
|
|
259
|
-
* @param modelId - The model ID to use (defaults to inworld-tts-1-max)
|
|
260
|
-
* @returns Promise resolving to the synthesized audio data
|
|
261
|
-
* @example
|
|
262
|
-
* ```typescript
|
|
263
|
-
* const ttsService = new TTSService();
|
|
264
|
-
* const result = await ttsService.synthesize('Hello, world!', 'Dennis');
|
|
265
|
-
* const audioBuffer = Buffer.from(result.audioContent, 'base64');
|
|
266
|
-
* ```
|
|
267
|
-
*/
|
|
268
|
-
async synthesize(text, voiceId, modelId = TTSModel.INWORLD_TTS_1_MAX) {
|
|
269
|
-
return this.synthesizeSpeech({
|
|
270
|
-
text,
|
|
271
|
-
voiceId,
|
|
272
|
-
modelId,
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Saves synthesized audio to a file
|
|
277
|
-
* @param audioContent - Base64 encoded audio content
|
|
278
|
-
* @param filepath - Path where the audio file should be saved
|
|
279
|
-
* @returns Promise that resolves when the file is written
|
|
280
|
-
* @example
|
|
281
|
-
* ```typescript
|
|
282
|
-
* const ttsService = new TTSService();
|
|
283
|
-
* const result = await ttsService.synthesize('Hello, world!', 'Dennis');
|
|
284
|
-
* await ttsService.saveAudioToFile(result.audioContent, 'output.mp3');
|
|
285
|
-
* ```
|
|
286
|
-
*/
|
|
287
|
-
async saveAudioToFile(audioContent, filepath) {
|
|
288
|
-
const { writeFile } = await import('fs/promises');
|
|
289
|
-
const audioBuffer = Buffer.from(audioContent, 'base64');
|
|
290
|
-
await writeFile(filepath, audioBuffer);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
// Export a singleton instance for convenience
|
|
294
|
-
export const ttsService = new TTSService();
|
|
295
|
-
// Re-export the main synthesis function for backward compatibility
|
|
296
|
-
export const synthesizeSpeech = async (text, voice) => {
|
|
297
|
-
return ttsService.synthesize(text, voice);
|
|
298
|
-
};
|
|
299
|
-
//# sourceMappingURL=tts_service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tts_service.js","sourceRoot":"","sources":["../../../src/services/tts_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAN,IAAY,aAMX;AAND,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,4BAAW,CAAA;IACX,sCAAqB,CAAA;IACrB,8BAAa,CAAA;IACb,gCAAe,CAAA;AACjB,CAAC,EANW,aAAa,KAAb,aAAa,QAMxB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,2CAA+B,CAAA;IAC/B,mDAAuC,CAAA;AACzC,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,2DAA0C,CAAA;IAC1C,8BAAa,CAAA;IACb,wCAAuB,CAAA;AACzB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAiKD;;;GAGG;AACH,MAAM,OAAO,UAAU;IACb,MAAM,GAAkB,IAAI,CAAC;IAErC;;;OAGG;IACK,KAAK,CAAC,YAAY;QACxB,IAAI,CAAC,IAAI,CAAC,MAAM,E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vB,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;QACrD,CAAC;QAED,OAAO,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnD,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,UAAU,CACd,IAAY,EACZ,OAAe,EACf,UAAoB,QAAQ,CAAC,iBAAiB;QAE9C,OAAO,IAAI,CAAC,gBAAgB,CAAC;YAC3B,IAAI;YACJ,OAAO;YACP,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,eAAe,CAAC,YAAoB,EAAE,QAAgB;QAC1D,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QAClD,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACxD,MAAM,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACzC,CAAC;CACF;AAED,8CAA8C;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;AAE3C,mEAAmE;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,IAAY,EACZ,KAAa,EACsB,EAAE;IACrC,OAAO,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UpdateChecker handles checking for new versions of the CLI on npm.
|
|
3
|
-
* It caches results to avoid excessive network requests.
|
|
4
|
-
*/
|
|
5
|
-
export declare class UpdateChecker {
|
|
6
|
-
private static readonly PACKAGE_NAME;
|
|
7
|
-
private static readonly CHECK_INTERVAL;
|
|
8
|
-
private static readonly NPM_REGISTRY_URL;
|
|
9
|
-
private static readonly REQUEST_TIMEOUT;
|
|
10
|
-
private static readonly CONF_ENTRY_NAME;
|
|
11
|
-
private conf;
|
|
12
|
-
constructor();
|
|
13
|
-
/**
|
|
14
|
-
* Checks if an update is available and displays a notification if needed.
|
|
15
|
-
* This method is non-blocking and will not throw errors.
|
|
16
|
-
*/
|
|
17
|
-
checkAndNotify(): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Determines if we should check for updates based on cache age
|
|
20
|
-
*/
|
|
21
|
-
private shouldCheckForUpdate;
|
|
22
|
-
/**
|
|
23
|
-
* Fetches the latest version from npm registry
|
|
24
|
-
*/
|
|
25
|
-
private fetchLatestVersion;
|
|
26
|
-
/**
|
|
27
|
-
* Compares current version with latest version
|
|
28
|
-
* Returns true if an update is available
|
|
29
|
-
*/
|
|
30
|
-
private compareVersions;
|
|
31
|
-
/**
|
|
32
|
-
* Displays a styled update notification to the user
|
|
33
|
-
*/
|
|
34
|
-
private displayUpdateNotification;
|
|
35
|
-
}
|
|
36
|
-
export declare const updateChecker: UpdateChecker;
|
|
37
|
-
//# sourceMappingURL=update_checker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update_checker.d.ts","sourceRoot":"","sources":["../../../src/services/update_checker.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAkB;IACtD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAuB;IAC7D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAgC;IACxE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAiB;IAExD,OAAO,CAAC,IAAI,CAA2C;;IAQvD;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IA4CrC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;OAEG;YACW,kBAAkB;IA+BhC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAevB;;OAEG;IACH,OAAO,CAAC,yBAAyB;CAYlC;AAGD,eAAO,MAAM,aAAa,eAAsB,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Service for managing Inworld workspaces and API keys.
|
|
3
|
-
* Provides functionality to list, select, and activate workspaces with their associated API keys.
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* This service handles the authentication flow for workspace activation,
|
|
7
|
-
* including API key selection and generation when needed.
|
|
8
|
-
*/
|
|
9
|
-
export declare class WorkspaceService {
|
|
10
|
-
/**
|
|
11
|
-
* Prompts user to select a workspace from available workspaces
|
|
12
|
-
* @param forceFirst If true, automatically selects the first workspace
|
|
13
|
-
* @returns The resource name of the selected workspace
|
|
14
|
-
*/
|
|
15
|
-
private static pickWorkspace;
|
|
16
|
-
/**
|
|
17
|
-
* Prompts user to select an API key from available API keys
|
|
18
|
-
* @param apiKeys List of API keys to select from
|
|
19
|
-
* @param forceFirst If true, automatically selects the first API key
|
|
20
|
-
* @returns The selected API key or null if no selection was made
|
|
21
|
-
*/
|
|
22
|
-
private static pickApiKey;
|
|
23
|
-
private static returnBase64;
|
|
24
|
-
/**
|
|
25
|
-
* Activates a workspace by selecting it and its associated API key.
|
|
26
|
-
* If no API key exists, prompts the user to generate one.
|
|
27
|
-
*
|
|
28
|
-
* @param options Configuration options
|
|
29
|
-
* @param options.forceFirst If true, automatically selects the first workspace and API key
|
|
30
|
-
*/
|
|
31
|
-
static activateWorkspace({ forceFirst, }?: {
|
|
32
|
-
forceFirst?: boolean;
|
|
33
|
-
}): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Lists all API keys for the currently active workspace
|
|
36
|
-
*/
|
|
37
|
-
static listApiKeys(): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Allows user to select and activate a different API key from the current workspace
|
|
40
|
-
*/
|
|
41
|
-
static selectApiKey(): Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Generates a new API key for the currently active workspace
|
|
44
|
-
*/
|
|
45
|
-
static generateApiKey(): Promise<void>;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=workspace_service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace_service.d.ts","sourceRoot":"","sources":["../../../src/services/workspace_service.ts"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,qBAAa,gBAAgB;IAC3B;;;;OAIG;mBACkB,aAAa;IA4BlC;;;;;OAKG;mBACkB,UAAU;IAwB/B,OAAO,CAAC,MAAM,CAAC,YAAY,CAGzB;IAEF;;;;;;OAMG;WACU,iBAAiB,CAAC,EAC7B,UAAU,GACX,GAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAO;IA0DhC;;OAEG;WACU,WAAW;IAqCxB;;OAEG;WACU,YAAY;IAyDzB;;OAEG;WACU,cAAc;CA4C5B"}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { ApiKeys, } from '@/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb';
|
|
3
|
-
import { Workspaces } from '@/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb';
|
|
4
|
-
import { authManager } from '@/auth/manager';
|
|
5
|
-
import { authenticatedInworldRequest } from '@/auth/utils';
|
|
6
|
-
import { WORKSPACES_LIST_SIZE } from '@/constants';
|
|
7
|
-
import { confirm } from '@/utils/confirm';
|
|
8
|
-
import { parseWorkspaceResourceName } from '@/utils/resource_name_helper';
|
|
9
|
-
import { selectItemOrExit } from '@/utils/selector';
|
|
10
|
-
import * as ui from '@/utils/ui';
|
|
11
|
-
/**
|
|
12
|
-
* Service for managing Inworld workspaces and API keys.
|
|
13
|
-
* Provides functionality to list, select, and activate workspaces with their associated API keys.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* This service handles the authentication flow for workspace activation,
|
|
17
|
-
* including API key selection and generation when needed.
|
|
18
|
-
*/
|
|
19
|
-
export class WorkspaceService {
|
|
20
|
-
/**
|
|
21
|
-
* Prompts user to select a workspace from available workspaces
|
|
22
|
-
* @param forceFirst If true, automatically selects the first workspace
|
|
23
|
-
* @returns The resource name of the selected workspace
|
|
24
|
-
*/
|
|
25
|
-
static async pickWorkspace(forceFirst = false) {
|
|
26
|
-
const listWorkspacesResponse = await authenticatedInworldRequest(Workspaces.ListWorkspaces, {
|
|
27
|
-
pageSize: forceFirst ? 1 : WORKSPACES_LIST_SIZE,
|
|
28
|
-
});
|
|
29
|
-
const workspaces = listWorkspacesResponse?.workspaces || [];
|
|
30
|
-
const selectedWorkspace = await selectItemOrExit({
|
|
31
|
-
items: workspaces,
|
|
32
|
-
getDisplayName: (ws) => ws.displayName || ws.name?.split('/').pop() || 'unknown',
|
|
33
|
-
getIdentifier: (ws) => ws.name?.split('/').pop() || 'unknown',
|
|
34
|
-
prompt: 'Enter the number or resource name of the workspace to activate:',
|
|
35
|
-
title: 'Available workspaces:',
|
|
36
|
-
forceFirst,
|
|
37
|
-
noItemsMessage: 'No workspaces found.',
|
|
38
|
-
invalidSelectionMessage: 'Invalid selection. Please enter a valid number or workspace resource name.',
|
|
39
|
-
});
|
|
40
|
-
return selectedWorkspace.name;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Prompts user to select an API key from available API keys
|
|
44
|
-
* @param apiKeys List of API keys to select from
|
|
45
|
-
* @param forceFirst If true, automatically selects the first API key
|
|
46
|
-
* @returns The selected API key or null if no selection was made
|
|
47
|
-
*/
|
|
48
|
-
static async pickApiKey(apiKeys, forceFirst = false) {
|
|
49
|
-
return selectItemOrExit({
|
|
50
|
-
items: apiKeys,
|
|
51
|
-
getDisplayName: (apiKey) => {
|
|
52
|
-
const name = apiKey.name?.split('/').pop() || 'unknown';
|
|
53
|
-
// Show creation time if available
|
|
54
|
-
const createdAt = apiKey.createTime
|
|
55
|
-
? new Date(apiKey.createTime).toLocaleDateString()
|
|
56
|
-
: 'unknown date';
|
|
57
|
-
return `${name} (created: ${createdAt})`;
|
|
58
|
-
},
|
|
59
|
-
getIdentifier: (apiKey) => apiKey.name?.split('/').pop() || 'unknown',
|
|
60
|
-
prompt: 'Enter the number or resource name of the API key to use:',
|
|
61
|
-
title: 'Available API keys:',
|
|
62
|
-
forceFirst,
|
|
63
|
-
noItemsMessage: 'No API keys found.',
|
|
64
|
-
invalidSelectionMessage: 'Invalid selection. Please enter a valid number or API key resource name.',
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
static returnBase64 = (key, secret) => {
|
|
68
|
-
const encodedKeySecret = new TextEncoder().encode(`${key}:${secret}`);
|
|
69
|
-
return btoa(String.fromCharCode.apply(null, Array.from(encodedKeySecret)));
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Activates a workspace by selecting it and its associated API key.
|
|
73
|
-
* If no API key exists, prompts the user to generate one.
|
|
74
|
-
*
|
|
75
|
-
* @param options Configuration options
|
|
76
|
-
* @param options.forceFirst If true, automatically selects the first workspace and API key
|
|
77
|
-
*/
|
|
78
|
-
static async activateWorkspace({ forceFirst, } = {}) {
|
|
79
|
-
const workspaceResourceName = await this.pickWorkspace(forceFirst);
|
|
80
|
-
const workspaceId = parseWorkspaceResourceName(workspaceResourceName).workspaceId;
|
|
81
|
-
ui.print(`\nSelecting workspace: ${chalk.whiteBright(workspaceId)}`);
|
|
82
|
-
ui.print(`Selected workspace link: ${ui.workspaceLink(workspaceId)}`);
|
|
83
|
-
let apiKey = null;
|
|
84
|
-
const response = await authenticatedInworldRequest(ApiKeys.ListApiKeys, {
|
|
85
|
-
parent: workspaceResourceName,
|
|
86
|
-
pageSize: forceFirst ? 1 : WORKSPACES_LIST_SIZE,
|
|
87
|
-
});
|
|
88
|
-
if (response?.apiKeys?.length) {
|
|
89
|
-
// If there's only one API key or forceFirst is true, use it directly
|
|
90
|
-
if (response.apiKeys.length === 1 || forceFirst) {
|
|
91
|
-
apiKey = response.apiKeys[0];
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
// Multiple API keys found, let user select
|
|
95
|
-
ui.print(`Found ${response.apiKeys.length} API keys in the workspace.`);
|
|
96
|
-
apiKey = await this.pickApiKey(response.apiKeys, false);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
const shouldGenerate = await confirm({
|
|
101
|
-
message: 'No API keys found for this workspace. Would you like to generate one? (y/N): ',
|
|
102
|
-
defaultValue: false,
|
|
103
|
-
});
|
|
104
|
-
if (shouldGenerate) {
|
|
105
|
-
ui.print('Generating API key...');
|
|
106
|
-
const generateApiKeyResponse = await authenticatedInworldRequest(ApiKeys.GenerateApiKey, {
|
|
107
|
-
parent: workspaceResourceName,
|
|
108
|
-
});
|
|
109
|
-
if (!generateApiKeyResponse) {
|
|
110
|
-
ui.printError('Failed to generate API key.');
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
apiKey = generateApiKeyResponse;
|
|
114
|
-
ui.success('API key generated successfully.');
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
ui.print('No API key will be generated.');
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const base64Key = this.returnBase64(apiKey?.key, apiKey?.secret);
|
|
121
|
-
ui.print(`\nSelecting API key: ${chalk.whiteBright(ui.trimBase64Key(base64Key))}`);
|
|
122
|
-
await authManager.updateWorkspaceAndApiKey(workspaceId, base64Key);
|
|
123
|
-
ui.success('\nWorkspace and API key selected.');
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Lists all API keys for the currently active workspace
|
|
127
|
-
*/
|
|
128
|
-
static async listApiKeys() {
|
|
129
|
-
const credentials = await authManager.getCredentials();
|
|
130
|
-
if (!credentials?.workspace) {
|
|
131
|
-
ui.printError('No workspace activated. Please run "inworld workspace activate" first.');
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const response = await authenticatedInworldRequest(ApiKeys.ListApiKeys, {
|
|
135
|
-
parent: credentials.workspace,
|
|
136
|
-
pageSize: WORKSPACES_LIST_SIZE,
|
|
137
|
-
});
|
|
138
|
-
const apiKeys = response?.apiKeys || [];
|
|
139
|
-
if (apiKeys.length === 0) {
|
|
140
|
-
ui.printError('No API keys found in the active workspace.');
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
console.log();
|
|
144
|
-
ui.printHeader(`API keys in workspace ${credentials.workspace}:`);
|
|
145
|
-
apiKeys.forEach((apiKey, idx) => {
|
|
146
|
-
const name = apiKey.name?.split('/').pop() || 'unknown';
|
|
147
|
-
const createdAt = apiKey.createTime
|
|
148
|
-
? new Date(apiKey.createTime).toLocaleDateString()
|
|
149
|
-
: 'unknown date';
|
|
150
|
-
const state = apiKey.state || 'unknown';
|
|
151
|
-
ui.printListItem(`${idx + 1}. ${name} (created: ${createdAt}, state: ${state})`);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Allows user to select and activate a different API key from the current workspace
|
|
156
|
-
*/
|
|
157
|
-
static async selectApiKey() {
|
|
158
|
-
const credentials = await authManager.getCredentials();
|
|
159
|
-
if (!credentials?.workspace) {
|
|
160
|
-
ui.printError('No workspace activated. Please run "inworld workspace activate" first.');
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const response = await authenticatedInworldRequest(ApiKeys.ListApiKeys, {
|
|
164
|
-
parent: credentials.workspace,
|
|
165
|
-
pageSize: WORKSPACES_LIST_SIZE,
|
|
166
|
-
});
|
|
167
|
-
const apiKeys = response?.apiKeys || [];
|
|
168
|
-
if (apiKeys.length === 0) {
|
|
169
|
-
ui.printError('No API keys found in the active workspace.');
|
|
170
|
-
const shouldGenerate = await confirm({
|
|
171
|
-
message: 'Would you like to generate a new API key? (y/N): ',
|
|
172
|
-
defaultValue: false,
|
|
173
|
-
});
|
|
174
|
-
if (shouldGenerate) {
|
|
175
|
-
await this.generateApiKey();
|
|
176
|
-
}
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (apiKeys.length === 1) {
|
|
180
|
-
ui.print('Only one API key found in the workspace.');
|
|
181
|
-
const apiKey = apiKeys[0];
|
|
182
|
-
const base64Key = this.returnBase64(apiKey?.key, apiKey?.secret);
|
|
183
|
-
await authManager.updateWorkspaceAndApiKey(credentials.workspace, base64Key);
|
|
184
|
-
ui.success('API key activated successfully.');
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const selectedApiKey = await this.pickApiKey(apiKeys, false);
|
|
188
|
-
if (selectedApiKey) {
|
|
189
|
-
const base64Key = this.returnBase64(selectedApiKey.key, selectedApiKey.secret);
|
|
190
|
-
await authManager.updateWorkspaceAndApiKey(credentials.workspace, base64Key);
|
|
191
|
-
ui.success('API key activated successfully.');
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Generates a new API key for the currently active workspace
|
|
196
|
-
*/
|
|
197
|
-
static async generateApiKey() {
|
|
198
|
-
const credentials = await authManager.getCredentials();
|
|
199
|
-
if (!credentials?.workspace) {
|
|
200
|
-
ui.printError('No workspace activated. Please run "inworld workspace activate" first.');
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
ui.print('Generating new API key...');
|
|
204
|
-
const generateApiKeyResponse = await authenticatedInworldRequest(ApiKeys.GenerateApiKey, {
|
|
205
|
-
parent: credentials.workspace,
|
|
206
|
-
});
|
|
207
|
-
if (!generateApiKeyResponse) {
|
|
208
|
-
ui.printError('Failed to generate API key.');
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
const base64Key = this.returnBase64(generateApiKeyResponse.key, generateApiKeyResponse.secret);
|
|
212
|
-
await authManager.updateWorkspaceAndApiKey(credentials.workspace, base64Key);
|
|
213
|
-
ui.success('API key activated successfully.');
|
|
214
|
-
ui.success('API key generated and activated successfully.');
|
|
215
|
-
console.log();
|
|
216
|
-
ui.printHeader('API Key details:');
|
|
217
|
-
ui.printListItem(`Name: ${generateApiKeyResponse.name?.split('/').pop() || 'unknown'}`);
|
|
218
|
-
ui.printListItem(`Key: ${generateApiKeyResponse.key}`);
|
|
219
|
-
ui.printListItem(`Base64: ${base64Key}`);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
//# sourceMappingURL=workspace_service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace_service.js","sourceRoot":"","sources":["../../../src/services/workspace_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAEL,OAAO,GACR,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kEAAkE,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;;;OAIG;IACK,MAAM,CAAC,KAAK,CAAC,aAAa,CAChC,aAAsB,KAAK;QAE3B,MAAM,sBAAsB,GAAG,MAAM,2BAA2B,CAC9D,UAAU,CAAC,cAAc,EACzB;YACE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB;SAChD,CACF,CAAC;QAEF,MAAM,UAAU,GAAG,sBAAsB,EAAE,UAAU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