@inworld/cli 0.2.15 → 0.3.0-rc.5
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 +1246 -544
- package/dist/index.js.map +4 -4
- package/dist/package.json +49 -0
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts +10 -0
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js +16 -0
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts +13 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js +2 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts +7 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js +15 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts +14 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js +7 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts +116 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js +71 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts +14 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js +7 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts +76 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js +40 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts +10 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js +7 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts +7 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js +13 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts +115 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js +86 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts +255 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js +88 -0
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js.map +1 -0
- package/dist/proto/generated/portal/fetch.pb.d.ts +26 -0
- package/dist/proto/generated/portal/fetch.pb.d.ts.map +1 -0
- package/dist/proto/generated/portal/fetch.pb.js +274 -0
- package/dist/proto/generated/portal/fetch.pb.js.map +1 -0
- package/dist/src/auth/callback_server.d.ts +41 -0
- package/dist/src/auth/callback_server.d.ts.map +1 -0
- package/dist/src/auth/callback_server.js +136 -0
- package/dist/src/auth/callback_server.js.map +1 -0
- package/dist/src/auth/manager.d.ts +97 -0
- package/dist/src/auth/manager.d.ts.map +1 -0
- package/dist/src/auth/manager.js +340 -0
- package/dist/src/auth/manager.js.map +1 -0
- package/dist/src/auth/utils.d.ts +45 -0
- package/dist/src/auth/utils.d.ts.map +1 -0
- package/dist/src/auth/utils.js +183 -0
- package/dist/src/auth/utils.js.map +1 -0
- package/dist/src/commands/auth/disable_telemetry_command.d.ts +3 -0
- package/dist/src/commands/auth/disable_telemetry_command.d.ts.map +1 -0
- package/dist/src/commands/auth/enable_telemetry_command.d.ts +3 -0
- package/dist/src/commands/auth/enable_telemetry_command.d.ts.map +1 -0
- package/dist/src/commands/auth/login_ci_command.d.ts +3 -0
- package/dist/src/commands/auth/login_ci_command.d.ts.map +1 -0
- package/dist/src/commands/auth/login_ci_command.js +41 -0
- package/dist/src/commands/auth/login_ci_command.js.map +1 -0
- package/dist/src/commands/auth/login_command.d.ts +4 -0
- package/dist/src/commands/auth/login_command.d.ts.map +1 -0
- package/dist/src/commands/auth/login_command.js +134 -0
- package/dist/src/commands/auth/login_command.js.map +1 -0
- package/dist/src/commands/auth/logout_command.d.ts +4 -0
- package/dist/src/commands/auth/logout_command.d.ts.map +1 -0
- package/dist/src/commands/auth/logout_command.js +54 -0
- package/dist/src/commands/auth/logout_command.js.map +1 -0
- package/dist/src/commands/auth/print_access_token_command.d.ts +3 -0
- package/dist/src/commands/auth/print_access_token_command.d.ts.map +1 -0
- package/dist/src/commands/auth/print_access_token_command.js +21 -0
- package/dist/src/commands/auth/print_access_token_command.js.map +1 -0
- package/dist/src/commands/auth/print_api_key_command.d.ts +3 -0
- package/dist/src/commands/auth/print_api_key_command.d.ts.map +1 -0
- package/dist/src/commands/auth/print_api_key_command.js +26 -0
- package/dist/src/commands/auth/print_api_key_command.js.map +1 -0
- package/dist/src/commands/auth/status_command.d.ts +4 -0
- package/dist/src/commands/auth/status_command.d.ts.map +1 -0
- package/dist/src/commands/auth/status_command.js +84 -0
- package/dist/src/commands/auth/status_command.js.map +1 -0
- package/dist/src/commands/auth_command.d.ts +3 -0
- package/dist/src/commands/auth_command.d.ts.map +1 -0
- package/dist/src/commands/auth_command.js +20 -0
- package/dist/src/commands/auth_command.js.map +1 -0
- package/dist/src/commands/graph/graph_deploy_command.d.ts +24 -0
- package/dist/src/commands/graph/graph_deploy_command.d.ts.map +1 -0
- package/dist/src/commands/graph/graph_deploy_command.js +191 -0
- package/dist/src/commands/graph/graph_deploy_command.js.map +1 -0
- package/dist/src/commands/graph/graph_init_command.d.ts +4 -0
- package/dist/src/commands/graph/graph_init_command.d.ts.map +1 -0
- package/dist/src/commands/graph/graph_init_command.js +376 -0
- package/dist/src/commands/graph/graph_init_command.js.map +1 -0
- package/dist/src/commands/graph/graph_run_command.d.ts +24 -0
- package/dist/src/commands/graph/graph_run_command.d.ts.map +1 -0
- package/dist/src/commands/graph/graph_run_command.js +50 -0
- package/dist/src/commands/graph/graph_run_command.js.map +1 -0
- package/dist/src/commands/graph/graph_serve_command.d.ts +4 -0
- package/dist/src/commands/graph/graph_serve_command.d.ts.map +1 -0
- package/dist/src/commands/graph/graph_serve_command.js +40 -0
- package/dist/src/commands/graph/graph_serve_command.js.map +1 -0
- package/dist/src/commands/graph/graph_variant_command.d.ts +3 -0
- package/dist/src/commands/graph/graph_variant_command.d.ts.map +1 -0
- package/dist/src/commands/graph/graph_variant_command.js +13 -0
- package/dist/src/commands/graph/graph_variant_command.js.map +1 -0
- package/dist/src/commands/graph/graph_visualize_command.d.ts +7 -0
- package/dist/src/commands/graph/graph_visualize_command.d.ts.map +1 -0
- package/dist/src/commands/graph/graph_visualize_command.js +35 -0
- package/dist/src/commands/graph/graph_visualize_command.js.map +1 -0
- package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts +3 -0
- package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts.map +1 -0
- package/dist/src/commands/graph/variant/graph_variant_list_command.js +25 -0
- package/dist/src/commands/graph/variant/graph_variant_list_command.js.map +1 -0
- package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts +7 -0
- package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts.map +1 -0
- package/dist/src/commands/graph/variant/graph_variant_print_command.js +45 -0
- package/dist/src/commands/graph/variant/graph_variant_print_command.js.map +1 -0
- package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts +3 -0
- package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts.map +1 -0
- package/dist/src/commands/graph/variant/graph_variant_register_command.js +45 -0
- package/dist/src/commands/graph/variant/graph_variant_register_command.js.map +1 -0
- package/dist/src/commands/graph_command.d.ts +3 -0
- package/dist/src/commands/graph_command.d.ts.map +1 -0
- package/dist/src/commands/graph_command.js +20 -0
- package/dist/src/commands/graph_command.js.map +1 -0
- package/dist/src/commands/tts_commands.d.ts +17 -0
- package/dist/src/commands/tts_commands.d.ts.map +1 -0
- package/dist/src/commands/tts_commands.js +568 -0
- package/dist/src/commands/tts_commands.js.map +1 -0
- package/dist/src/commands/workspace_command.d.ts +12 -0
- package/dist/src/commands/workspace_command.d.ts.map +1 -0
- package/dist/src/commands/workspace_command.js +33 -0
- package/dist/src/commands/workspace_command.js.map +1 -0
- package/dist/src/constants.d.ts +10 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +30 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/grpc/core/InworldError.d.ts +30 -0
- package/dist/src/grpc/core/InworldError.d.ts.map +1 -0
- package/dist/src/grpc/core/InworldError.js +46 -0
- package/dist/src/grpc/core/InworldError.js.map +1 -0
- package/dist/src/grpc/core/statusCodes.d.ts +122 -0
- package/dist/src/grpc/core/statusCodes.d.ts.map +1 -0
- package/dist/src/grpc/core/statusCodes.js +133 -0
- package/dist/src/grpc/core/statusCodes.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/services/analytics.d.ts +45 -0
- package/dist/src/services/analytics.d.ts.map +1 -0
- package/dist/src/services/deploy_service.d.ts +4 -0
- package/dist/src/services/deploy_service.d.ts.map +1 -0
- package/dist/src/services/deploy_service.js +128 -0
- package/dist/src/services/deploy_service.js.map +1 -0
- package/dist/src/services/graph_loader.d.ts +7 -0
- package/dist/src/services/graph_loader.d.ts.map +1 -0
- package/dist/src/services/graph_loader.js +103 -0
- package/dist/src/services/graph_loader.js.map +1 -0
- package/dist/src/services/graph_variant_service.d.ts +12 -0
- package/dist/src/services/graph_variant_service.d.ts.map +1 -0
- package/dist/src/services/graph_variant_service.js +66 -0
- package/dist/src/services/graph_variant_service.js.map +1 -0
- package/dist/src/services/tts_service.d.ts +273 -0
- package/dist/src/services/tts_service.d.ts.map +1 -0
- package/dist/src/services/tts_service.js +299 -0
- package/dist/src/services/tts_service.js.map +1 -0
- package/dist/src/services/update_checker.d.ts +37 -0
- package/dist/src/services/update_checker.d.ts.map +1 -0
- package/dist/src/services/workspace_service.d.ts +47 -0
- package/dist/src/services/workspace_service.d.ts.map +1 -0
- package/dist/src/services/workspace_service.js +222 -0
- package/dist/src/services/workspace_service.js.map +1 -0
- package/dist/src/templates/llm_tts/graph.d.ts +2 -0
- package/dist/src/templates/llm_tts/graph.d.ts.map +1 -0
- package/dist/src/utils/array.d.ts +2 -0
- package/dist/src/utils/array.d.ts.map +1 -0
- package/dist/src/utils/array.js +4 -0
- package/dist/src/utils/array.js.map +1 -0
- package/dist/src/utils/confirm.d.ts +62 -0
- package/dist/src/utils/confirm.d.ts.map +1 -0
- package/dist/src/utils/confirm.js +90 -0
- package/dist/src/utils/confirm.js.map +1 -0
- package/dist/src/utils/long_running_operations.d.ts +38 -0
- package/dist/src/utils/long_running_operations.d.ts.map +1 -0
- package/dist/src/utils/long_running_operations.js +62 -0
- package/dist/src/utils/long_running_operations.js.map +1 -0
- package/dist/src/utils/resource_name_helper.d.ts +12 -0
- package/dist/src/utils/resource_name_helper.d.ts.map +1 -0
- package/dist/src/utils/resource_name_helper.js +29 -0
- package/dist/src/utils/resource_name_helper.js.map +1 -0
- package/dist/src/utils/selector.d.ts +62 -0
- package/dist/src/utils/selector.d.ts.map +1 -0
- package/dist/src/utils/selector.js +77 -0
- package/dist/src/utils/selector.js.map +1 -0
- package/dist/src/utils/spinner.d.ts +75 -0
- package/dist/src/utils/spinner.d.ts.map +1 -0
- package/dist/src/utils/spinner.js +178 -0
- package/dist/src/utils/spinner.js.map +1 -0
- package/dist/src/utils/ui.d.ts +27 -0
- package/dist/src/utils/ui.d.ts.map +1 -0
- package/dist/src/utils/ui.js +83 -0
- package/dist/src/utils/ui.js.map +1 -0
- package/dist/templates/llm_tts/graph.ts +8 -9
- package/package.json +5 -4
- package/dist/src/templates/simple/README.md +0 -106
- package/dist/src/templates/simple/graph.ts +0 -32
- package/dist/src/templates/simple/metadata.json +0 -26
- package/dist/templates/simple/README.md +0 -106
- package/dist/templates/simple/graph.ts +0 -32
- package/dist/templates/simple/metadata.json +0 -26
- package/src/templates/llm_tts/README.md +0 -155
- package/src/templates/llm_tts/graph.ts +0 -30
- package/src/templates/llm_tts/metadata.json +0 -41
- package/src/templates/simple/README.md +0 -106
- package/src/templates/simple/graph.ts +0 -32
- package/src/templates/simple/metadata.json +0 -26
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import * as ui from '@/utils/ui';
|
|
3
|
+
import { loadGraph } from '@/services/graph_loader';
|
|
4
|
+
// The actual run action handler
|
|
5
|
+
const runAction = async (file, request) => {
|
|
6
|
+
try {
|
|
7
|
+
const { graph } = await loadGraph(file);
|
|
8
|
+
let requestJson;
|
|
9
|
+
try {
|
|
10
|
+
requestJson = JSON.parse(request);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
console.error('Error parsing request:', error);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
const results = await graph.executeJsonRequest(requestJson);
|
|
17
|
+
for await (const result of results) {
|
|
18
|
+
console.log(result);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error('Error starting server:', error);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const makeRunCommand = (description) => {
|
|
26
|
+
return new Command('run')
|
|
27
|
+
.description(description)
|
|
28
|
+
.argument('<file>', 'Path to the graph file (e.g., test.ts)')
|
|
29
|
+
.argument('<request>', `
|
|
30
|
+
Graph input, heavily depends on the exact graph. E.g.:
|
|
31
|
+
|
|
32
|
+
{"input": "Hello"}
|
|
33
|
+
|
|
34
|
+
Also acceptes execution id, user context and data store content:
|
|
35
|
+
|
|
36
|
+
'{
|
|
37
|
+
"input": {"my_complicated_input_object": "not really"},
|
|
38
|
+
"executionId": "123e4567-e89b-12d3-a456-426614174000",
|
|
39
|
+
"userContext": {"targetingKey": "id", "attributes": {}},
|
|
40
|
+
"dataStoreContent": {}
|
|
41
|
+
}'
|
|
42
|
+
|
|
43
|
+
Mirrors the input format of the Inworld HTTP Graph Server.
|
|
44
|
+
`)
|
|
45
|
+
.action(runAction);
|
|
46
|
+
};
|
|
47
|
+
// Create the run subcommand for graph
|
|
48
|
+
export const runCommand = makeRunCommand('Runs single execution against provided Inworld graph. Uses same input and output protocol as http server.');
|
|
49
|
+
export const runCommandAlias = makeRunCommand(`Alias for "${ui.bold('inworld graph run')}"`);
|
|
50
|
+
//# sourceMappingURL=graph_run_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_run_command.js","sourceRoot":"","sources":["../../../../src/commands/graph/graph_run_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAyBpD,gCAAgC;AAChC,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAAE,OAAe,EAAE,EAAE;IACxD,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;QAExC,IAAI,WAAW,CAAC;QAChB,IAAI,CAAC;YACH,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAE5D,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC7C,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC;SACtB,WAAW,CAAC,WAAW,CAAC;SACxB,QAAQ,CAAC,QAAQ,EAAE,wCAAwC,CAAC;SAC5D,QAAQ,CACP,WAAW,EACX;;;;;;;;;;;;;;;CAeL,CACI;SACA,MAAM,CAAC,SAAS,CAAC,CAAC;AACvB,CAAC,CAAC;AACF,sCAAsC;AACtC,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CACtC,2GAA2G,CAC5G,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAC3C,cAAc,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_serve_command.d.ts","sourceRoot":"","sources":["../../../../src/commands/graph/graph_serve_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0DpC,eAAO,MAAM,YAAY,SAExB,CAAC;AAEF,eAAO,MAAM,iBAAiB,SAE7B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { loadGraph } from '@/services/graph_loader';
|
|
3
|
+
import * as ui from '@/utils/ui';
|
|
4
|
+
// The actual serve action handler
|
|
5
|
+
const serveAction = async (file, options) => {
|
|
6
|
+
try {
|
|
7
|
+
const { graph } = await loadGraph(file);
|
|
8
|
+
const port = parseInt(options.port, 10);
|
|
9
|
+
const host = options.host;
|
|
10
|
+
if (!['http', 'grpc'].includes(options.transport)) {
|
|
11
|
+
ui.printError('Transport must be either "http" or "grpc"');
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
await graph.serve({
|
|
15
|
+
host,
|
|
16
|
+
port,
|
|
17
|
+
transport: options.transport,
|
|
18
|
+
swagger: options.swagger,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
ui.printError('Error starting server:');
|
|
23
|
+
console.error(error);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
// Create the serve subcommand for graph
|
|
28
|
+
const makeServeCommand = (description) => {
|
|
29
|
+
return new Command('serve')
|
|
30
|
+
.description(description)
|
|
31
|
+
.argument('<file>', 'Path to the graph file (e.g., test.ts)')
|
|
32
|
+
.option('-p, --port <port>', 'Port to run the server on', '3000')
|
|
33
|
+
.option('--host <host>', 'Host to bind the server to', 'localhost')
|
|
34
|
+
.option('-t, --transport <transport>', 'Transport protocol (http or grpc)', 'http')
|
|
35
|
+
.option('--swagger', 'Enable Swagger UI documentation (HTTP transport only)', false)
|
|
36
|
+
.action(serveAction);
|
|
37
|
+
};
|
|
38
|
+
export const serveCommand = makeServeCommand('Start a server that wraps an Inworld Runtime graph');
|
|
39
|
+
export const serveCommandAlias = makeServeCommand(`Alias for "${ui.bold('inworld graph serve')}"`);
|
|
40
|
+
//# sourceMappingURL=graph_serve_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_serve_command.js","sourceRoot":"","sources":["../../../../src/commands/graph/graph_serve_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,kCAAkC;AAClC,MAAM,WAAW,GAAG,KAAK,EACvB,IAAY,EACZ,OAKC,EACD,EAAE;IACF,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAE1B,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAClD,EAAE,CAAC,UAAU,CAAC,2CAA2C,CAAC,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,KAAK,CAAC,KAAK,CAAC;YAChB,IAAI;YACJ,IAAI;YACJ,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,EAAE,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;QACxC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF,wCAAwC;AACxC,MAAM,gBAAgB,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC/C,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;SACxB,WAAW,CAAC,WAAW,CAAC;SACxB,QAAQ,CAAC,QAAQ,EAAE,wCAAwC,CAAC;SAC5D,MAAM,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAChE,MAAM,CAAC,eAAe,EAAE,4BAA4B,EAAE,WAAW,CAAC;SAClE,MAAM,CACL,6BAA6B,EAC7B,mCAAmC,EACnC,MAAM,CACP;SACA,MAAM,CACL,WAAW,EACX,uDAAuD,EACvD,KAAK,CACN;SACA,MAAM,CAAC,WAAW,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAC1C,oDAAoD,CACrD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAC/C,cAAc,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_variant_command.d.ts","sourceRoot":"","sources":["../../../../src/commands/graph/graph_variant_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,mBAAmB,SAO5B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { graphListVariantsCommand } from './variant/graph_variant_list_command';
|
|
3
|
+
import { graphVariantPrintCommand } from './variant/graph_variant_print_command';
|
|
4
|
+
import { graphVariantRegisterCommand } from './variant/graph_variant_register_command';
|
|
5
|
+
export const graphVariantCommand = new Command('variant')
|
|
6
|
+
.description('Manage Inworld graph variants')
|
|
7
|
+
.addCommand(graphListVariantsCommand)
|
|
8
|
+
.addCommand(graphVariantRegisterCommand)
|
|
9
|
+
.addCommand(graphVariantPrintCommand)
|
|
10
|
+
.action(() => {
|
|
11
|
+
graphVariantCommand.help();
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=graph_variant_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_variant_command.js","sourceRoot":"","sources":["../../../../src/commands/graph/graph_variant_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAEvF,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;KACtD,WAAW,CAAC,+BAA+B,CAAC;KAC5C,UAAU,CAAC,wBAAwB,CAAC;KACpC,UAAU,CAAC,2BAA2B,CAAC;KACvC,UAAU,CAAC,wBAAwB,CAAC;KACpC,MAAM,CAAC,GAAG,EAAE;IACX,mBAAmB,CAAC,IAAI,EAAE,CAAC;AAC7B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Command for visualizing an Inworld Runtime graph.
|
|
4
|
+
* Generates a visual representation of the graph structure.
|
|
5
|
+
*/
|
|
6
|
+
export declare const visualizeCommand: Command;
|
|
7
|
+
//# sourceMappingURL=graph_visualize_command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_visualize_command.d.ts","sourceRoot":"","sources":["../../../../src/commands/graph/graph_visualize_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,SAQH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { loadGraph } from '@/services/graph_loader';
|
|
4
|
+
import * as ui from '@/utils/ui';
|
|
5
|
+
/**
|
|
6
|
+
* Handler for the visualize action.
|
|
7
|
+
* Loads a graph and generates its visualization.
|
|
8
|
+
*
|
|
9
|
+
* @param file - Path to the graph file
|
|
10
|
+
* @param options - Command options
|
|
11
|
+
*/
|
|
12
|
+
const visualizeAction = async (file, options) => {
|
|
13
|
+
try {
|
|
14
|
+
const { graph } = await loadGraph(file);
|
|
15
|
+
const outputPath = path.resolve(options.output);
|
|
16
|
+
ui.print(`Storing graph visualization to ${outputPath}`);
|
|
17
|
+
// Call visualize on the graph object
|
|
18
|
+
await graph.visualize(outputPath);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
ui.printError('Error visualizing graph:');
|
|
22
|
+
console.error(error);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Command for visualizing an Inworld Runtime graph.
|
|
28
|
+
* Generates a visual representation of the graph structure.
|
|
29
|
+
*/
|
|
30
|
+
export const visualizeCommand = new Command('visualize')
|
|
31
|
+
.description('Generate a visualization of an Inworld Runtime graph')
|
|
32
|
+
.argument('<file>', 'Path to the graph file (e.g., test.ts)')
|
|
33
|
+
.option('-o, --output <file>', 'Output file path (if not specified, outputs to graph.png in current directory)', './graph.png')
|
|
34
|
+
.action(visualizeAction);
|
|
35
|
+
//# sourceMappingURL=graph_visualize_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_visualize_command.js","sourceRoot":"","sources":["../../../../src/commands/graph/graph_visualize_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,KAAK,EAAE,IAAY,EAAE,OAA2B,EAAE,EAAE;IAC1E,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;QAExC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEhD,EAAE,CAAC,KAAK,CAAC,kCAAkC,UAAU,EAAE,CAAC,CAAC;QACzD,qCAAqC;QACrC,MAAM,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,EAAE,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;QAC1C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;KACrD,WAAW,CAAC,sDAAsD,CAAC;KACnE,QAAQ,CAAC,QAAQ,EAAE,wCAAwC,CAAC;KAC5D,MAAM,CACL,qBAAqB,EACrB,gFAAgF,EAChF,aAAa,CACd;KACA,MAAM,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_variant_list_command.d.ts","sourceRoot":"","sources":["../../../../../src/commands/graph/variant/graph_variant_list_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC,eAAO,MAAM,wBAAwB,SAGR,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { requireWorkspace } from '@/auth/utils';
|
|
3
|
+
import { loadGraph } from '@/services/graph_loader';
|
|
4
|
+
import { listGraphVariants } from '@/services/graph_variant_service';
|
|
5
|
+
import * as ui from '@/utils/ui';
|
|
6
|
+
const listVariantsAction = async (file) => {
|
|
7
|
+
const workspaceId = await requireWorkspace();
|
|
8
|
+
const { graph } = await loadGraph(file);
|
|
9
|
+
const variants = await listGraphVariants(graph.graphId);
|
|
10
|
+
if (!variants || variants.graphVariants?.length === 0) {
|
|
11
|
+
console.log();
|
|
12
|
+
ui.print(`No registered variants of the graph "${graph.graphId}" found in workspace "${workspaceId}"`);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
console.log();
|
|
16
|
+
ui.printHeader(`Registered variants of the graph "${graph.graphId}" in workspace "${workspaceId}":`);
|
|
17
|
+
variants.graphVariants?.forEach((variant) => {
|
|
18
|
+
ui.printListItem(`${variant.name} - ${variant.displayName}`);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export const graphListVariantsCommand = new Command('list')
|
|
22
|
+
.description('List all registered variants of the graph.')
|
|
23
|
+
.argument('<file>', 'Path to the graph file (e.g., graph.ts)')
|
|
24
|
+
.action(listVariantsAction);
|
|
25
|
+
//# sourceMappingURL=graph_variant_list_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_variant_list_command.js","sourceRoot":"","sources":["../../../../../src/commands/graph/variant/graph_variant_list_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,MAAM,kBAAkB,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE;IAChD,MAAM,WAAW,GAAG,MAAM,gBAAgB,EAAE,CAAC;IAE7C,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACxD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,aAAa,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,EAAE,CAAC,KAAK,CACN,wCAAwC,KAAK,CAAC,OAAO,yBAAyB,WAAW,GAAG,CAC7F,CAAC;QACF,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,EAAE,CAAC,WAAW,CACZ,qCAAqC,KAAK,CAAC,OAAO,mBAAmB,WAAW,IAAI,CACrF,CAAC;IACF,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC1C,EAAE,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KACxD,WAAW,CAAC,4CAA4C,CAAC;KACzD,QAAQ,CAAC,QAAQ,EAAE,yCAAyC,CAAC;KAC7D,MAAM,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Command for converting an Inworld Runtime graph to JSON format.
|
|
4
|
+
* Serializes the graph structure and configuration to JSON.
|
|
5
|
+
*/
|
|
6
|
+
export declare const graphVariantPrintCommand: Command;
|
|
7
|
+
//# sourceMappingURL=graph_variant_print_command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_variant_print_command.d.ts","sourceRoot":"","sources":["../../../../../src/commands/graph/variant/graph_variant_print_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4CpC;;;GAGG;AACH,eAAO,MAAM,wBAAwB,SAOH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { loadGraph } from '@/services/graph_loader';
|
|
4
|
+
import * as ui from '@/utils/ui';
|
|
5
|
+
/**
|
|
6
|
+
* Handler for the to_json action.
|
|
7
|
+
* Loads a graph and converts it to JSON format.
|
|
8
|
+
*
|
|
9
|
+
* @param file - Path to the graph file
|
|
10
|
+
* @param options - Command options
|
|
11
|
+
*/
|
|
12
|
+
const graphVariantPrintAction = async (file, options) => {
|
|
13
|
+
try {
|
|
14
|
+
const { graph } = await loadGraph(file);
|
|
15
|
+
// Call toJson on the graph object
|
|
16
|
+
const jsonResult = await graph.toJSON();
|
|
17
|
+
// Output the JSON
|
|
18
|
+
if (options.output) {
|
|
19
|
+
// If output file is specified, write to file
|
|
20
|
+
const outputPath = path.resolve(options.output);
|
|
21
|
+
const fs = await import('fs/promises');
|
|
22
|
+
await fs.writeFile(options.output, jsonResult);
|
|
23
|
+
ui.success(`JSON saved to ${outputPath}`);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// Otherwise, output to console
|
|
27
|
+
console.log(jsonResult);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
ui.printError('Error converting graph to JSON:');
|
|
32
|
+
console.error(error);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Command for converting an Inworld Runtime graph to JSON format.
|
|
38
|
+
* Serializes the graph structure and configuration to JSON.
|
|
39
|
+
*/
|
|
40
|
+
export const graphVariantPrintCommand = new Command('print')
|
|
41
|
+
.description('Print JSON representation of the graph variant')
|
|
42
|
+
.argument('<file>', 'Path to the graph file (e.g., test.ts)')
|
|
43
|
+
.option('-o, --output <file>', 'Output file path (if not specified, outputs to console)')
|
|
44
|
+
.action(graphVariantPrintAction);
|
|
45
|
+
//# sourceMappingURL=graph_variant_print_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_variant_print_command.js","sourceRoot":"","sources":["../../../../../src/commands/graph/variant/graph_variant_print_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,KAAK,EACnC,IAAY,EACZ,OAEC,EACD,EAAE;IACF,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;QAExC,kCAAkC;QAClC,MAAM,UAAU,GAAW,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC;QAEhD,kBAAkB;QAClB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,6CAA6C;YAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAEhD,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;YACvC,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YAC/C,EAAE,CAAC,OAAO,CAAC,iBAAiB,UAAU,EAAE,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,+BAA+B;YAC/B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,EAAE,CAAC,UAAU,CAAC,iCAAiC,CAAC,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KACzD,WAAW,CAAC,gDAAgD,CAAC;KAC7D,QAAQ,CAAC,QAAQ,EAAE,wCAAwC,CAAC;KAC5D,MAAM,CACL,qBAAqB,EACrB,yDAAyD,CAC1D;KACA,MAAM,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_variant_register_command.d.ts","sourceRoot":"","sources":["../../../../../src/commands/graph/variant/graph_variant_register_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiEpC,eAAO,MAAM,2BAA2B,SAQP,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { requireWorkspace } from '@/auth/utils';
|
|
3
|
+
import { PLATFORM_URL } from '@/constants';
|
|
4
|
+
import { isGrpcError } from '@/grpc/core/InworldError';
|
|
5
|
+
import { GrpcStatusCode } from '@/grpc/core/statusCodes';
|
|
6
|
+
import { loadGraph } from '@/services/graph_loader';
|
|
7
|
+
import { registerGraphVariant } from '@/services/graph_variant_service';
|
|
8
|
+
import { getGraphResourceName } from '@/utils/resource_name_helper';
|
|
9
|
+
import * as ui from '@/utils/ui';
|
|
10
|
+
const registerVariantsAction = async (file, options) => {
|
|
11
|
+
const workspaceId = await requireWorkspace();
|
|
12
|
+
const { graph } = await loadGraph(file);
|
|
13
|
+
let response = await registerGraphVariant(graph.graphId, options.displayName, graph.toJSON());
|
|
14
|
+
if (response !== true &&
|
|
15
|
+
isGrpcError(response) &&
|
|
16
|
+
response.code === GrpcStatusCode.ALREADY_EXISTS) {
|
|
17
|
+
if (options.force) {
|
|
18
|
+
response = await registerGraphVariant(graph.graphId, options.displayName, graph.toJSON(), true);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (response === true) {
|
|
22
|
+
const uri = `${PLATFORM_URL}/v2/${getGraphResourceName(workspaceId, graph.graphId)}/targeting`;
|
|
23
|
+
console.log();
|
|
24
|
+
ui.success(`Variant "${options.displayName}" ${options.force ? 'updated' : 'registered'} successfully`);
|
|
25
|
+
console.log();
|
|
26
|
+
ui.print(`Now you can open ${ui.link(uri)} and setup targeting for different variants`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (isGrpcError(response) &&
|
|
30
|
+
response.code === GrpcStatusCode.ALREADY_EXISTS) {
|
|
31
|
+
console.log();
|
|
32
|
+
ui.printError(`Variant "${options.displayName}" already registered for graph "${graph.graphId}" in workspace "${workspaceId}", use --force option to update it`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
ui.printError(`Failed to register variant "${options.displayName}"`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const graphVariantRegisterCommand = new Command('register')
|
|
40
|
+
.description('List all registered variants of the graph.')
|
|
41
|
+
.argument('<file>', 'Path to the graph file (e.g., graph.ts)')
|
|
42
|
+
.requiredOption('-d, --display-name <variantDisplayName>', 'The display name of the variant')
|
|
43
|
+
.option('-f, --force', 'Updates the variant if it already exists', false)
|
|
44
|
+
.action(registerVariantsAction);
|
|
45
|
+
//# sourceMappingURL=graph_variant_register_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_variant_register_command.js","sourceRoot":"","sources":["../../../../../src/commands/graph/variant/graph_variant_register_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,MAAM,sBAAsB,GAAG,KAAK,EAClC,IAAY,EACZ,OAAgD,EAChD,EAAE;IACF,MAAM,WAAW,GAAG,MAAM,gBAAgB,EAAE,CAAC;IAE7C,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,QAAQ,GAAG,MAAM,oBAAoB,CACvC,KAAK,CAAC,OAAO,EACb,OAAO,CAAC,WAAW,EACnB,KAAK,CAAC,MAAM,EAAE,CACf,CAAC;IAEF,IACE,QAAQ,KAAK,IAAI;QACjB,WAAW,CAAC,QAAQ,CAAC;QACrB,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,EAC/C,CAAC;QACD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,QAAQ,GAAG,MAAM,oBAAoB,CACnC,KAAK,CAAC,OAAO,EACb,OAAO,CAAC,WAAW,EACnB,KAAK,CAAC,MAAM,EAAE,EACd,IAAI,CACL,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,GAAG,YAAY,OAAO,oBAAoB,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;QAE/F,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,EAAE,CAAC,OAAO,CACR,YAAY,OAAO,CAAC,WAAW,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,eAAe,CAC5F,CAAC;QACF,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,EAAE,CAAC,KAAK,CACN,oBAAoB,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,6CAA6C,CAC9E,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,IACE,WAAW,CAAC,QAAQ,CAAC;YACrB,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,EAC/C,CAAC;YACD,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,EAAE,CAAC,UAAU,CACX,YAAY,OAAO,CAAC,WAAW,mCAAmC,KAAK,CAAC,OAAO,mBAAmB,WAAW,oCAAoC,CAClJ,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,UAAU,CAAC,+BAA+B,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;KAC/D,WAAW,CAAC,4CAA4C,CAAC;KACzD,QAAQ,CAAC,QAAQ,EAAE,yCAAyC,CAAC;KAC7D,cAAc,CACb,yCAAyC,EACzC,iCAAiC,CAClC;KACA,MAAM,CAAC,aAAa,EAAE,0CAA0C,EAAE,KAAK,CAAC;KACxE,MAAM,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_command.d.ts","sourceRoot":"","sources":["../../../src/commands/graph_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,YAAY,SAUrB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { deployCommand } from './graph/graph_deploy_command';
|
|
3
|
+
import { initCommand } from './graph/graph_init_command';
|
|
4
|
+
import { runCommand } from './graph/graph_run_command';
|
|
5
|
+
import { serveCommand } from './graph/graph_serve_command';
|
|
6
|
+
import { graphVariantCommand } from './graph/graph_variant_command';
|
|
7
|
+
import { visualizeCommand } from './graph/graph_visualize_command';
|
|
8
|
+
// Create the graph parent command
|
|
9
|
+
export const graphCommand = new Command('graph')
|
|
10
|
+
.description('Manage Inworld graph projects')
|
|
11
|
+
.addCommand(initCommand)
|
|
12
|
+
.addCommand(serveCommand)
|
|
13
|
+
.addCommand(runCommand)
|
|
14
|
+
.addCommand(deployCommand)
|
|
15
|
+
.addCommand(visualizeCommand)
|
|
16
|
+
.addCommand(graphVariantCommand)
|
|
17
|
+
.action(() => {
|
|
18
|
+
graphCommand.help();
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=graph_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_command.js","sourceRoot":"","sources":["../../../src/commands/graph_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,kCAAkC;AAClC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,+BAA+B,CAAC;KAC5C,UAAU,CAAC,WAAW,CAAC;KACvB,UAAU,CAAC,YAAY,CAAC;KACxB,UAAU,CAAC,UAAU,CAAC;KACtB,UAAU,CAAC,aAAa,CAAC;KACzB,UAAU,CAAC,gBAAgB,CAAC;KAC5B,UAAU,CAAC,mBAAmB,CAAC;KAC/B,MAAM,CAAC,GAAG,EAAE;IACX,YAAY,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* List voices command
|
|
4
|
+
* Displays all available TTS voices in a formatted output
|
|
5
|
+
*/
|
|
6
|
+
export declare const listVoicesCommand: Command;
|
|
7
|
+
/**
|
|
8
|
+
* Synthesize speech command
|
|
9
|
+
* Converts text to speech using specified voice and settings
|
|
10
|
+
*/
|
|
11
|
+
export declare const synthesizeCommand: Command;
|
|
12
|
+
/**
|
|
13
|
+
* Main TTS command with subcommands
|
|
14
|
+
* Manages text-to-speech functionality
|
|
15
|
+
*/
|
|
16
|
+
export declare const ttsCommand: Command;
|
|
17
|
+
//# sourceMappingURL=tts_commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tts_commands.d.ts","sourceRoot":"","sources":["../../../src/commands/tts_commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BpC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAuI1B,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAsmB1B,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,UAAU,SAMnB,CAAC"}
|