@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,139 +0,0 @@
|
|
|
1
|
-
import Conf from 'conf';
|
|
2
|
-
import Mixpanel from 'mixpanel';
|
|
3
|
-
import { authManager } from '@/auth/manager';
|
|
4
|
-
import { CLI_VERSION, MIXPANEL_TOKEN } from '@/constants';
|
|
5
|
-
/**
|
|
6
|
-
* Analytics service handles tracking CLI usage via Mixpanel.
|
|
7
|
-
* Users can opt out using the 'inworld auth disable_telemetry' command.
|
|
8
|
-
*/
|
|
9
|
-
export class Analytics {
|
|
10
|
-
static CONF_ENTRY_NAME = 'analytics';
|
|
11
|
-
conf;
|
|
12
|
-
mixpanel = null;
|
|
13
|
-
userId = null;
|
|
14
|
-
initialized = false;
|
|
15
|
-
constructor() {
|
|
16
|
-
this.conf = new Conf({
|
|
17
|
-
projectName: 'inworld-cli-config',
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Initializes Mixpanel with user context (email and CLI version).
|
|
22
|
-
* Only initializes if the user is authenticated and hasn't opted out.
|
|
23
|
-
*/
|
|
24
|
-
async initialize() {
|
|
25
|
-
try {
|
|
26
|
-
// Check if telemetry is enabled (opt-in by default)
|
|
27
|
-
if (!this.isTelemetryEnabled()) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Don't initialize if no token is provided
|
|
31
|
-
if (!MIXPANEL_TOKEN) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
// Get user credentials to identify the user
|
|
35
|
-
const credentials = await authManager.getCredentials();
|
|
36
|
-
if (!credentials?.email) {
|
|
37
|
-
// Don't initialize if the user is not authenticated
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// Initialize Mixpanel
|
|
41
|
-
this.mixpanel = Mixpanel.init(MIXPANEL_TOKEN);
|
|
42
|
-
this.userId = credentials.email;
|
|
43
|
-
this.initialized = true;
|
|
44
|
-
// Set user profile properties
|
|
45
|
-
if (this.mixpanel && this.userId) {
|
|
46
|
-
this.mixpanel.people.set(this.userId, {
|
|
47
|
-
$email: credentials.email,
|
|
48
|
-
cli_version: CLI_VERSION,
|
|
49
|
-
environment: credentials.env || 'PROD',
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
// Silently fail - we don't want analytics to break the CLI
|
|
55
|
-
this.initialized = false;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Checks if telemetry is enabled (opt-in by default)
|
|
60
|
-
*/
|
|
61
|
-
isTelemetryEnabled() {
|
|
62
|
-
const config = this.conf.get(Analytics.CONF_ENTRY_NAME);
|
|
63
|
-
// Default to true (opt-in by default)
|
|
64
|
-
return config?.telemetryEnabled !== false;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Enables or disables telemetry
|
|
68
|
-
*/
|
|
69
|
-
setTelemetryEnabled(enabled) {
|
|
70
|
-
this.conf.set(Analytics.CONF_ENTRY_NAME, { telemetryEnabled: enabled });
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Tracks a command execution event
|
|
74
|
-
* @param command The command being executed (e.g., 'auth login', 'graph deploy')
|
|
75
|
-
* @param parameters Command parameters (sanitized, no sensitive data)
|
|
76
|
-
*/
|
|
77
|
-
trackCommandExecution(command, parameters) {
|
|
78
|
-
if (!this.initialized || !this.mixpanel || !this.userId) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
this.mixpanel.track('[inworld cli] command_execution', {
|
|
83
|
-
distinct_id: this.userId,
|
|
84
|
-
command,
|
|
85
|
-
cli_version: CLI_VERSION,
|
|
86
|
-
...parameters,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
// Silently fail
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Tracks a command result event (success or failure)
|
|
95
|
-
* @param command The command that was executed
|
|
96
|
-
* @param success Whether the command succeeded
|
|
97
|
-
* @param errorMessage Optional error message (sanitized)
|
|
98
|
-
*/
|
|
99
|
-
trackCommandResult(command, success, errorMessage) {
|
|
100
|
-
if (!this.initialized || !this.mixpanel || !this.userId) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
this.mixpanel.track('[inworld_cli] command_result', {
|
|
105
|
-
distinct_id: this.userId,
|
|
106
|
-
command,
|
|
107
|
-
success,
|
|
108
|
-
cli_version: CLI_VERSION,
|
|
109
|
-
error_message: errorMessage,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
// Silently fail
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Flushes any pending events to Mixpanel
|
|
118
|
-
* Should be called before the CLI exits
|
|
119
|
-
*/
|
|
120
|
-
flush() {
|
|
121
|
-
return new Promise((resolve) => {
|
|
122
|
-
if (!this.initialized || !this.mixpanel) {
|
|
123
|
-
resolve();
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
// Give Mixpanel a short time to flush, but don't block indefinitely
|
|
127
|
-
const timeout = setTimeout(() => resolve(), 500);
|
|
128
|
-
// Mixpanel doesn't have a flush method in this version, but we can
|
|
129
|
-
// give it a small delay to send pending events
|
|
130
|
-
setTimeout(() => {
|
|
131
|
-
clearTimeout(timeout);
|
|
132
|
-
resolve();
|
|
133
|
-
}, 100);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// Export singleton instance
|
|
138
|
-
export const analytics = new Analytics();
|
|
139
|
-
//# sourceMappingURL=analytics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/services/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAM1D;;;GAGG;AACH,MAAM,OAAO,SAAS;IACZ,MAAM,CAAU,eAAe,GAAG,WAAW,CAAC;IAE9C,IAAI,CAAwC;IAC5C,QAAQ,GAA6B,IAAI,CAAC;IAC1C,MAAM,GAAkB,IAAI,CAAC;IAC7B,WAAW,GAAG,KAAK,CAAC;IAE5B;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAkC;YACpD,WAAW,EAAE,oBAAoB;SAClC,CAAC,CAAC;IACL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AAoE;YACpE,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;YAEjD,mEAAmE;YACnE,+CAA+C;YAC/C,UAAU,CAAC,GAAG,EAAE;gBACd,YAAY,CAAC,OAAO,CAAC,CAAC;gBACtB,OAAO,EAAE,CAAC;YACZ,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;IACL,CAAC;;AAGH,4BAA4B;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const deployGraph: (graphId: string, _archive: Uint8Array) => Promise<import("@/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb").GraphDeployment | undefined>;
|
|
2
|
-
export declare const getGraphDeployment: (graphResourceName: string) => Promise<import("@/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb").GraphDeployment | undefined>;
|
|
3
|
-
export declare const ensureGraphRegistered: (workspaceId: string, graphId: string) => Promise<import("@/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb").Graph | undefined>;
|
|
4
|
-
//# sourceMappingURL=deploy_service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_service.d.ts","sourceRoot":"","sources":["../../../src/services/deploy_service.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,WAAW,GAAU,SAAS,MAAM,EAAE,UAAU,UAAU,gIA6DtE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,mBAAmB,MAAM,gIAKjE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,EACnB,SAAS,MAAM,sHAgBhB,CAAC"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { authenticatedInworldRequest, requireAuth, requireWorkspace, } from '@/auth/utils';
|
|
2
|
-
import { isGrpcError } from '@/grpc/core/InworldError';
|
|
3
|
-
import { GrpcStatusCode } from '@/grpc/core/statusCodes';
|
|
4
|
-
import { GraphsService } from '@/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb';
|
|
5
|
-
import { checkLRO } from '@/utils/long_running_operations';
|
|
6
|
-
import { getGraphResourceName, getWorkspaceResourceName, } from '@/utils/resource_name_helper';
|
|
7
|
-
import { createLROSpinnerCallbacks } from '@/utils/spinner';
|
|
8
|
-
import * as ui from '@/utils/ui';
|
|
9
|
-
export const deployGraph = async (graphId, _archive) => {
|
|
10
|
-
const workspaceId = await requireWorkspace();
|
|
11
|
-
const graphResourceName = getGraphResourceName(workspaceId, graphId);
|
|
12
|
-
try {
|
|
13
|
-
await ensureGraphRegistered(workspaceId, graphId);
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
ui.printError(`Error ensuring graph registration on workspace ${workspaceId}:`);
|
|
17
|
-
console.error(error);
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
const operation = await authenticatedInworldRequest(GraphsService.DeployGraph, {
|
|
22
|
-
parent: graphResourceName,
|
|
23
|
-
graph: {
|
|
24
|
-
archive: _archive,
|
|
25
|
-
archiveType: 'zip',
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
const gracefulShutdown = () => {
|
|
29
|
-
process.exit(0);
|
|
30
|
-
};
|
|
31
|
-
for (const signal of [
|
|
32
|
-
'SIGINT',
|
|
33
|
-
'SIGTERM',
|
|
34
|
-
'SIGQUIT',
|
|
35
|
-
'SIGSEGV',
|
|
36
|
-
'SIGBUS',
|
|
37
|
-
'exit',
|
|
38
|
-
]) {
|
|
39
|
-
process.on(signal, gracefulShutdown);
|
|
40
|
-
}
|
|
41
|
-
const spinnerCallbacks = createLROSpinnerCallbacks({
|
|
42
|
-
initialText: `Deploying graph "${graphId}" to Inworld platform`,
|
|
43
|
-
showIterations: false,
|
|
44
|
-
phraseInterval: 10000, // Change phrase every 10 seconds
|
|
45
|
-
});
|
|
46
|
-
await checkLRO({
|
|
47
|
-
operationName: operation.name,
|
|
48
|
-
checkLimit: 100,
|
|
49
|
-
checkTimeout: 8000,
|
|
50
|
-
returnWithMetadata: true,
|
|
51
|
-
pollOptions: spinnerCallbacks,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
ui.printError('Error deploying graph:');
|
|
56
|
-
console.error(error);
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
const deployment = await getGraphDeployment(graphResourceName);
|
|
60
|
-
return deployment;
|
|
61
|
-
};
|
|
62
|
-
export const getGraphDeployment = async (graphResourceName) => {
|
|
63
|
-
requireAuth();
|
|
64
|
-
return await authenticatedInworldRequest(GraphsService.GetGraphDeployment, {
|
|
65
|
-
name: graphResourceName + '/deploy',
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
export const ensureGraphRegistered = async (workspaceId, graphId) => {
|
|
69
|
-
requireAuth();
|
|
70
|
-
const graphResourceName = getGraphResourceName(workspaceId, graphId);
|
|
71
|
-
try {
|
|
72
|
-
return await getGraph(graphResourceName);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
if (isGrpcError(error) && error.code === GrpcStatusCode.NOT_FOUND) {
|
|
76
|
-
ui.print(`Graph "${graphId}" is not registered on the Inworld platform for workspace "${workspaceId}", registering now...`);
|
|
77
|
-
await registerGraph(workspaceId, graphId);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
throw error;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
* @param graphResourceName
|
|
87
|
-
* @returns
|
|
88
|
-
*
|
|
89
|
-
* @throws {GrpcError}
|
|
90
|
-
*/
|
|
91
|
-
const getGraph = async (graphResourceName) => {
|
|
92
|
-
requireAuth();
|
|
93
|
-
return await authenticatedInworldRequest(GraphsService.GetGraph, {
|
|
94
|
-
name: graphResourceName,
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
99
|
-
* @param workspace
|
|
100
|
-
* @param graphResourceName
|
|
101
|
-
* @param displayName
|
|
102
|
-
* @returns
|
|
103
|
-
*
|
|
104
|
-
* @throws {GrpcError}
|
|
105
|
-
*/
|
|
106
|
-
const registerGraph = async (workspaceId, graphId) => {
|
|
107
|
-
requireAuth();
|
|
108
|
-
const graphResourceName = getGraphResourceName(workspaceId, graphId);
|
|
109
|
-
const workspaceResourceName = getWorkspaceResourceName(workspaceId);
|
|
110
|
-
const operation = await authenticatedInworldRequest(GraphsService.CreateGraph, {
|
|
111
|
-
parent: `${workspaceResourceName}`,
|
|
112
|
-
graph: {
|
|
113
|
-
name: graphResourceName,
|
|
114
|
-
displayName: graphId,
|
|
115
|
-
targeting: { rawContent: JSON.stringify({}) },
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
const spinnerCallbacks = createLROSpinnerCallbacks({
|
|
119
|
-
initialText: `Registering graph ${graphId} on Inworld platform`,
|
|
120
|
-
showIterations: false,
|
|
121
|
-
});
|
|
122
|
-
await checkLRO({
|
|
123
|
-
operationName: operation.name,
|
|
124
|
-
pollOptions: spinnerCallbacks,
|
|
125
|
-
});
|
|
126
|
-
return getGraph(graphResourceName);
|
|
127
|
-
};
|
|
128
|
-
//# sourceMappingURL=deploy_service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_service.js","sourceRoot":"","sources":["../../../src/services/deploy_service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,WAAW,EACX,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,8EAA8E,CAAC;AAC7G,OAAO,EAAE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@
|
|
|
1
|
-
{"version":3,"file":"graph_loader.d.ts","sourceRoot":"","sources":["../../../src/services/graph_loader.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS,GAAU,MAAM,MAAM;;;;;EAmG3C,CAAC"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import { Module } from 'module';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { requireApiKey } from '@/auth/utils';
|
|
6
|
-
import { printError } from '@/utils/ui';
|
|
7
|
-
export const loadGraph = async (file) => {
|
|
8
|
-
process.env.INWORLD_API_KEY = await requireApiKey();
|
|
9
|
-
// Resolve the file path
|
|
10
|
-
const filePath = path.resolve(process.cwd(), file);
|
|
11
|
-
if (!fs.existsSync(filePath)) {
|
|
12
|
-
console.error(`Error: File not found: ${filePath}`);
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
console.log(`Packaging graph from: ${filePath}`);
|
|
16
|
-
// Find the nearest package.json
|
|
17
|
-
const packageJsonPath = findNearestPackageJson(path.dirname(filePath));
|
|
18
|
-
if (!packageJsonPath) {
|
|
19
|
-
console.error('Error: No package.json found in the project hierarchy');
|
|
20
|
-
console.error('Please ensure your graph file is in a proper Node.js project');
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
console.log(`Using package.json from: ${packageJsonPath}`);
|
|
24
|
-
const originalPackageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
25
|
-
// Bundle the module with local files
|
|
26
|
-
console.log('Bundling graph module with local dependencies...');
|
|
27
|
-
let bundledCode;
|
|
28
|
-
let module;
|
|
29
|
-
if (!filePath.endsWith('.ts') && !filePath.endsWith('.js')) {
|
|
30
|
-
console.error('Error: File must be a .ts or .js file');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
// Use esbuild to bundle local files together
|
|
34
|
-
const result = await esbuild.build({
|
|
35
|
-
entryPoints: [filePath],
|
|
36
|
-
bundle: true,
|
|
37
|
-
platform: 'node',
|
|
38
|
-
loader: { '.ts': 'ts', '.js': 'js' },
|
|
39
|
-
target: 'node18',
|
|
40
|
-
format: 'cjs',
|
|
41
|
-
// Keep all npm packages external - they'll be installed via package.json
|
|
42
|
-
packages: 'external',
|
|
43
|
-
sourcemap: 'inline',
|
|
44
|
-
write: false,
|
|
45
|
-
logLevel: 'error',
|
|
46
|
-
resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
|
|
47
|
-
keepNames: true,
|
|
48
|
-
minify: false,
|
|
49
|
-
});
|
|
50
|
-
bundledCode = result.outputFiles[0].text;
|
|
51
|
-
// Validate that the bundled module exports a graph
|
|
52
|
-
const moduleInstance = new Module(filePath, module);
|
|
53
|
-
moduleInstance.filename = filePath;
|
|
54
|
-
moduleInstance.paths = Module._nodeModulePaths(path.dirname(filePath));
|
|
55
|
-
// Compile and evaluate with proper module resolution
|
|
56
|
-
moduleInstance._compile(bundledCode, filePath);
|
|
57
|
-
module = moduleInstance.exports;
|
|
58
|
-
// Validate that the module exports a graph
|
|
59
|
-
if (!module.graph) {
|
|
60
|
-
console.error('Error: The file must export a "graph" object');
|
|
61
|
-
process.exit(1);
|
|
62
|
-
}
|
|
63
|
-
const graphId = module.graph.graphId;
|
|
64
|
-
// Validate that the graphId is alphanumeric, dashes, or underscores
|
|
65
|
-
if (typeof graphId !== 'string' || !/^[a-zA-Z0-9_-]+$/.test(graphId)) {
|
|
66
|
-
printError('Error: Graph id must be a string containing only alphanumeric (latin) characters, dashes, or underscores.');
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
// FIXME: validate graph module.
|
|
70
|
-
// if (!(module.graph instanceof Graph)) {
|
|
71
|
-
// console.error(
|
|
72
|
-
// 'Error: The exported "graph" must be an instance of Inworld Runtime Graph class',
|
|
73
|
-
// );
|
|
74
|
-
// process.exit(1);
|
|
75
|
-
// }
|
|
76
|
-
return {
|
|
77
|
-
graph: module.graph,
|
|
78
|
-
bundledCode,
|
|
79
|
-
originalPackageJson,
|
|
80
|
-
packageJsonPath,
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Find the nearest package.json file by traversing up the directory tree
|
|
85
|
-
*/
|
|
86
|
-
function findNearestPackageJson(startDir) {
|
|
87
|
-
let currentDir = startDir;
|
|
88
|
-
const root = path.parse(currentDir).root;
|
|
89
|
-
while (currentDir !== root) {
|
|
90
|
-
const packageJsonPath = path.join(currentDir, 'package.json');
|
|
91
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
92
|
-
return packageJsonPath;
|
|
93
|
-
}
|
|
94
|
-
currentDir = path.dirname(currentDir);
|
|
95
|
-
}
|
|
96
|
-
// Check root directory as well
|
|
97
|
-
const rootPackageJson = path.join(root, 'package.json');
|
|
98
|
-
if (fs.existsSync(rootPackageJson)) {
|
|
99
|
-
return rootPackageJson;
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=graph_loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph_loader.js","sourceRoot":"","sources":["../../../src/services/graph_loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE;IAC9C,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,aAAa,EAAE,CAAC;IAEpD,wBAAwB;IACxB,MAAM,QAAQ,GAAG,IAAI,CAA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rE,UAAU,CACR,2GAA2G,CAC5G,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,gCAAgC;IAChC,0CAA0C;IAC1C,mBAAmB;IACnB,wFAAwF;IACxF,OAAO;IACP,qBAAqB;IACrB,IAAI;IAEJ,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,WAAW;QACX,mBAAmB;QACnB,eAAe;KAChB,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,SAAS,sBAAsB,CAAC,QAAgB;IAC9C,IAAI,UAAU,GAAG,QAAQ,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;IAEzC,OAAO,UAAU,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC9D,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACnC,OAAO,eAAe,CAAC;QACzB,CAAC;QACD,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,+BAA+B;IAC/B,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACxD,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACnC,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const listGraphVariants: (graphId: string) => Promise<import("@/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb").ListGraphVariantsResponse | undefined>;
|
|
2
|
-
/**
|
|
3
|
-
* Converts the input string to a string containing only alphanumeric characters,
|
|
4
|
-
* dashes, and underscores. Spaces are replaced with underscores, all other
|
|
5
|
-
* non-alphanumeric/dash/underscore characters are removed, and the result is lowercased.
|
|
6
|
-
*
|
|
7
|
-
* @param input - The string to sanitize.
|
|
8
|
-
* @returns The sanitized, lowercased string containing only [a-z0-9-_], with spaces replaced by underscores.
|
|
9
|
-
*/
|
|
10
|
-
export declare function toAlphanumericDashUnderscore(input: string): string;
|
|
11
|
-
export declare const registerGraphVariant: (graphId: string, variantDisplayName: string, variantConfig: string, force?: boolean) => Promise<unknown>;
|
|
12
|
-
//# sourceMappingURL=graph_variant_service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph_variant_service.d.ts","sourceRoot":"","sources":["../../../src/services/graph_variant_service.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,GAAU,SAAS,MAAM,0IAMtD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlE;AAED,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,EACf,oBAAoB,MAAM,EAC1B,eAAe,MAAM,EACrB,QAAO,OAAe,qBAoDvB,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { authenticatedInworldRequest, requireWorkspace } from '@/auth/utils';
|
|
2
|
-
import { GraphsService } from '@/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb';
|
|
3
|
-
import { checkLRO } from '@/utils/long_running_operations';
|
|
4
|
-
import { getGraphResourceName, getGraphVariantResourceName, } from '@/utils/resource_name_helper';
|
|
5
|
-
import { ensureGraphRegistered } from './deploy_service';
|
|
6
|
-
export const listGraphVariants = async (graphId) => {
|
|
7
|
-
const workspaceId = await requireWorkspace();
|
|
8
|
-
const graphResourceName = getGraphResourceName(workspaceId, graphId);
|
|
9
|
-
return await authenticatedInworldRequest(GraphsService.ListGraphVariants, {
|
|
10
|
-
parent: graphResourceName,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Converts the input string to a string containing only alphanumeric characters,
|
|
15
|
-
* dashes, and underscores. Spaces are replaced with underscores, all other
|
|
16
|
-
* non-alphanumeric/dash/underscore characters are removed, and the result is lowercased.
|
|
17
|
-
*
|
|
18
|
-
* @param input - The string to sanitize.
|
|
19
|
-
* @returns The sanitized, lowercased string containing only [a-z0-9-_], with spaces replaced by underscores.
|
|
20
|
-
*/
|
|
21
|
-
export function toAlphanumericDashUnderscore(input) {
|
|
22
|
-
return input
|
|
23
|
-
.replace(/\s+/g, '_') // Replace spaces with underscores
|
|
24
|
-
.replace(/[^a-zA-Z0-9-_]/g, '') // Remove all non-alphanumeric, non-dash, non-underscore
|
|
25
|
-
.toLowerCase(); // Convert to lowercase
|
|
26
|
-
}
|
|
27
|
-
export const registerGraphVariant = async (graphId, variantDisplayName, variantConfig, force = false) => {
|
|
28
|
-
const request = force
|
|
29
|
-
? GraphsService.UpdateGraphVariant
|
|
30
|
-
: GraphsService.CreateGraphVariant;
|
|
31
|
-
const workspaceId = await requireWorkspace();
|
|
32
|
-
const graphResourceName = getGraphResourceName(workspaceId, graphId);
|
|
33
|
-
const variantResourceName = getGraphVariantResourceName(workspaceId, graphId, toAlphanumericDashUnderscore(variantDisplayName));
|
|
34
|
-
await ensureGraphRegistered(workspaceId, graphId);
|
|
35
|
-
try {
|
|
36
|
-
const operation = await authenticatedInworldRequest(request, {
|
|
37
|
-
parent: graphResourceName,
|
|
38
|
-
graphVariant: {
|
|
39
|
-
config: {
|
|
40
|
-
rawContent: variantConfig,
|
|
41
|
-
},
|
|
42
|
-
displayName: variantDisplayName,
|
|
43
|
-
name: variantResourceName,
|
|
44
|
-
graph: graphResourceName,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
await checkLRO({ operationName: operation.name });
|
|
48
|
-
const graph = await ensureGraphRegistered(workspaceId, graphId);
|
|
49
|
-
if (graph && graph.targeting?.rawContent === '{}') {
|
|
50
|
-
console.log(`Graph "${graphId}" has no targeting, setting up registered variant as default...`);
|
|
51
|
-
// graph has no targeting, so we need to setup registered variant as default.
|
|
52
|
-
const operation = await authenticatedInworldRequest(GraphsService.UpdateGraph, {
|
|
53
|
-
graph: {
|
|
54
|
-
...graph,
|
|
55
|
-
targeting: { rawContent: `{"if": ["${variantResourceName}"]}` },
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
await checkLRO({ operationName: operation.name });
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
return error;
|
|
63
|
-
}
|
|
64
|
-
return true;
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=graph_variant_service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph_variant_service.js","sourceRoot":"","sources":["../../../src/services/graph_variant_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,8EAA8E,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;IACzD,MAAM,WAAW,GAAG,MAAM,gBAAgB,EAAE,CAAC;IAC7C,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACrE,OAAO,MAAM,2BAA2B,CAAC,aAAa,CAAC,iBAAiB,EAAE;QACxE,MAAM,EAAE,iBAAiB;KAC1B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAa;IACxD,OAAO,KAAK;SACT,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,C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AS,GAAG,MAAM,2BAA2B,CACjD,aAAa,CAAC,WAAW,EACzB;gBACE,KAAK,EAAE;oBACL,GAAG,KAAK;oBACR,SAAS,EAAE,EAAE,UAAU,EAAE,YAAY,mBAAmB,KAAK,EAAE;iBAChE;aACF,CACF,CAAC;YACF,MAAM,QAAQ,CAAC,EAAE,aAAa,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Template metadata from JSON file
|
|
3
|
-
*/
|
|
4
|
-
export interface TemplateMetadata {
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
githubRepo: string;
|
|
8
|
-
readmeLink?: string;
|
|
9
|
-
inputModality?: string[];
|
|
10
|
-
outputModality?: string[];
|
|
11
|
-
useCase?: string[];
|
|
12
|
-
useCases?: Array<string | {
|
|
13
|
-
useCase: string;
|
|
14
|
-
icon?: string;
|
|
15
|
-
}>;
|
|
16
|
-
sdk?: string;
|
|
17
|
-
sdkVersion?: string;
|
|
18
|
-
webDemo?: string | null;
|
|
19
|
-
videoDemo?: string | null;
|
|
20
|
-
docsLink?: string | null;
|
|
21
|
-
type?: string;
|
|
22
|
-
backgroundImage?: string;
|
|
23
|
-
foregroundImage?: string;
|
|
24
|
-
id: string;
|
|
25
|
-
rawReadmeURL?: string;
|
|
26
|
-
readmeContent?: string;
|
|
27
|
-
readmeHTML?: string;
|
|
28
|
-
branch?: string;
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Template info including directory name and metadata
|
|
33
|
-
*/
|
|
34
|
-
export interface TemplateInfo {
|
|
35
|
-
directory: string;
|
|
36
|
-
metadata: TemplateMetadata;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Fetch templates metadata from the public JSON file
|
|
40
|
-
* Always fetches fresh data (no caching)
|
|
41
|
-
*/
|
|
42
|
-
export declare function fetchTemplatesMetadata(): Promise<TemplateMetadata[]>;
|
|
43
|
-
/**
|
|
44
|
-
* Extract owner/repo from GitHub URL
|
|
45
|
-
*/
|
|
46
|
-
export declare function extractRepoFromUrl(githubUrl: string): string | null;
|
|
47
|
-
/**
|
|
48
|
-
* Parse repository string to extract owner and repo
|
|
49
|
-
* Supports formats:
|
|
50
|
-
* - 'owner/repo'
|
|
51
|
-
* - 'https://github.com/owner/repo'
|
|
52
|
-
* - 'https://github.com/owner/repo.git'
|
|
53
|
-
*/
|
|
54
|
-
export declare function parseRepository(repoString: string): {
|
|
55
|
-
owner: string;
|
|
56
|
-
repo: string;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Check if template is cached and valid (without downloading)
|
|
60
|
-
*/
|
|
61
|
-
export declare function isTemplateCached(templateId: string, forceRefresh: boolean): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Download and cache a template from GitHub
|
|
64
|
-
* Returns the path to the cached template directory and whether it was from cache
|
|
65
|
-
*/
|
|
66
|
-
export declare function downloadAndCacheTemplate(templateId: string, repository: string, branch?: string, forceRefresh?: boolean): Promise<{
|
|
67
|
-
path: string;
|
|
68
|
-
fromCache: boolean;
|
|
69
|
-
}>;
|
|
70
|
-
/**
|
|
71
|
-
* Get available templates from metadata URL
|
|
72
|
-
*/
|
|
73
|
-
export declare function getAvailableTemplatesWithMetadata(): Promise<TemplateInfo[]>;
|
|
74
|
-
/**
|
|
75
|
-
* Copy directory recursively (exported for use in command)
|
|
76
|
-
* Excludes .git directories and other unnecessary files
|
|
77
|
-
*/
|
|
78
|
-
export declare function copyTemplateDirectory(src: string, dest: string): void;
|
|
79
|
-
//# sourceMappingURL=template_service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template_service.d.ts","sourceRo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