@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,178 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
const PHRASES = [
|
|
4
|
+
'Condensing time-space matter',
|
|
5
|
+
'Starting particle collider',
|
|
6
|
+
'Calibrating quantum flux capacitor',
|
|
7
|
+
'Reversing polarity of neutron flow',
|
|
8
|
+
'Aligning cosmic frequencies',
|
|
9
|
+
'Compiling infinite loops',
|
|
10
|
+
'Downloading more RAM',
|
|
11
|
+
'Reticulating splines',
|
|
12
|
+
'Generating witty loading messages',
|
|
13
|
+
'Convincing electrons to cooperate',
|
|
14
|
+
'Negotiating with the cloud overlords',
|
|
15
|
+
'Bribing the API hamsters',
|
|
16
|
+
'Warming up the server potatoes',
|
|
17
|
+
'Untangling quantum entanglements',
|
|
18
|
+
'Feeding the deployment gremlins',
|
|
19
|
+
'Optimizing coffee-to-code ratio',
|
|
20
|
+
'Summoning the deployment spirits',
|
|
21
|
+
'Consulting the ancient scrolls',
|
|
22
|
+
'Charging the flux compensators',
|
|
23
|
+
'Stabilizing temporal anomalies',
|
|
24
|
+
'Synchronizing parallel universes',
|
|
25
|
+
'Decoding the matrix',
|
|
26
|
+
'Activating turbo encabulator',
|
|
27
|
+
'Adjusting the dilithium crystals',
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* Creates and manages a spinner for long-running operations
|
|
31
|
+
*/
|
|
32
|
+
export class LROSpinner {
|
|
33
|
+
spinner;
|
|
34
|
+
phraseInterval;
|
|
35
|
+
currentPhraseIndex = 0;
|
|
36
|
+
config;
|
|
37
|
+
iterationCount = 0;
|
|
38
|
+
startTime;
|
|
39
|
+
constructor(config = {}) {
|
|
40
|
+
this.config = {
|
|
41
|
+
initialText: 'Initializing deployment',
|
|
42
|
+
phraseInterval: 10000,
|
|
43
|
+
showIterations: true,
|
|
44
|
+
spinnerStyle: 'dots8Bit',
|
|
45
|
+
...config,
|
|
46
|
+
};
|
|
47
|
+
this.spinner = ora({
|
|
48
|
+
text: this.config.initialText,
|
|
49
|
+
spinner: this.config.spinnerStyle,
|
|
50
|
+
color: 'cyan',
|
|
51
|
+
});
|
|
52
|
+
this.startTime = Date.now();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Starts the spinner with rotating phrases
|
|
56
|
+
*/
|
|
57
|
+
start() {
|
|
58
|
+
this.spinner.start();
|
|
59
|
+
this.updateText();
|
|
60
|
+
// Start rotating phrases
|
|
61
|
+
this.phraseInterval = setInterval(() => {
|
|
62
|
+
// this.currentPhraseIndex = (this.currentPhraseIndex + 1) % PHRASES.length;
|
|
63
|
+
this.updateText();
|
|
64
|
+
}, this.config.phraseInterval);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Updates the spinner text with current phrase and optional iteration count
|
|
68
|
+
*/
|
|
69
|
+
updateText() {
|
|
70
|
+
const phrase = LROSpinner.getRandomPhrase();
|
|
71
|
+
const elapsedSeconds = Math.floor((Date.now() - this.startTime) / 1000);
|
|
72
|
+
let text = chalk.cyan(phrase);
|
|
73
|
+
if (this.config.showIterations && this.iterationCount > 0) {
|
|
74
|
+
text += chalk.gray(` (iteration ${this.iterationCount}, ${elapsedSeconds}s)`);
|
|
75
|
+
}
|
|
76
|
+
else if (elapsedSeconds > 0) {
|
|
77
|
+
text += chalk.gray(` (${elapsedSeconds}s)`);
|
|
78
|
+
}
|
|
79
|
+
this.spinner.text = text;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Updates the iteration count
|
|
83
|
+
*/
|
|
84
|
+
updateIteration(iteration) {
|
|
85
|
+
this.iterationCount = iteration + 1; // Convert 0-based to 1-based for display
|
|
86
|
+
this.updateText();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Updates spinner with custom text temporarily
|
|
90
|
+
*/
|
|
91
|
+
updateCustomText(text) {
|
|
92
|
+
this.spinner.text = chalk.yellow(text);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Succeeds the spinner with a success message
|
|
96
|
+
*/
|
|
97
|
+
succeed(text) {
|
|
98
|
+
this.cleanup();
|
|
99
|
+
const elapsedSeconds = Math.floor((Date.now() - this.startTime) / 1000);
|
|
100
|
+
const successText = text || `Deployment completed successfully in ${elapsedSeconds}s`;
|
|
101
|
+
this.spinner.succeed(chalk.green(successText));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Fails the spinner with an error message
|
|
105
|
+
*/
|
|
106
|
+
fail(text) {
|
|
107
|
+
this.cleanup();
|
|
108
|
+
const errorText = text || 'Deployment failed';
|
|
109
|
+
this.spinner.fail(chalk.red(errorText));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Warns the spinner with a warning message
|
|
113
|
+
*/
|
|
114
|
+
warn(text) {
|
|
115
|
+
this.cleanup();
|
|
116
|
+
const warnText = text || 'Deployment completed with warnings';
|
|
117
|
+
this.spinner.warn(chalk.yellow(warnText));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Stops the spinner without any status
|
|
121
|
+
*/
|
|
122
|
+
stop() {
|
|
123
|
+
this.cleanup();
|
|
124
|
+
this.spinner.stop();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Cleans up intervals
|
|
128
|
+
*/
|
|
129
|
+
cleanup() {
|
|
130
|
+
if (this.phraseInterval) {
|
|
131
|
+
clearInterval(this.phraseInterval);
|
|
132
|
+
this.phraseInterval = undefined;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Gets a random phrase for one-off usage
|
|
137
|
+
*/
|
|
138
|
+
static getRandomPhrase() {
|
|
139
|
+
return PHRASES[Math.floor(Math.random() * PHRASES.length)];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Helper function to create spinner callbacks for LRO operations
|
|
144
|
+
*/
|
|
145
|
+
export function createLROSpinnerCallbacks(config) {
|
|
146
|
+
let spinner = null;
|
|
147
|
+
return {
|
|
148
|
+
startCallback: (operationName) => {
|
|
149
|
+
spinner = new LROSpinner({
|
|
150
|
+
...config,
|
|
151
|
+
initialText: `Starting operation: ${operationName}`,
|
|
152
|
+
});
|
|
153
|
+
spinner.start();
|
|
154
|
+
},
|
|
155
|
+
iterationCallback: (operationName, _checkResponse, checkData) => {
|
|
156
|
+
if (spinner) {
|
|
157
|
+
spinner.updateIteration(checkData.checkIteration);
|
|
158
|
+
// Add progress warning if getting close to limit
|
|
159
|
+
if (checkData.checkIteration > checkData.checkLimit * 0.8) {
|
|
160
|
+
spinner.updateCustomText(chalk.yellow(`⚠️ Taking longer than expected... (${checkData.checkIteration}/${checkData.checkLimit})`));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
doneCallback: (_operationName, _response) => {
|
|
165
|
+
if (spinner) {
|
|
166
|
+
spinner.succeed(`Operation completed.`);
|
|
167
|
+
spinner = null;
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
errorCallback: (operationName, error) => {
|
|
171
|
+
if (spinner) {
|
|
172
|
+
spinner.fail(`Operation ${operationName} failed: ${error}`);
|
|
173
|
+
spinner = null;
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/utils/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAY,MAAM,KAAK,CAAC;AAE/B,MAAM,OAAO,GAAG;IACd,8BAA8B;IAC9B,4BAA4B;IAC5B,oCAAoC;IACpC,oCAAoC;IACpC,6BAA6B;IAC7B,0BAA0B;IAC1B,sBAAsB;IACtB,sBAAsB;IACtB,mCAAmC;IACnC,mCAAmC;IACnC,sCAAsC;IACtC,0BAA0B;IAC1B,gCAAgC;IAChC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IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;gBAElD,iDAAiD;gBACjD,IAAI,SAAS,CAAC,cAAc,GAAG,SAAS,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC;oBAC1D,OAAO,CAAC,gBAAgB,CACtB,KAAK,CAAC,MAAM,CACV,uCAAuC,SAAS,CAAC,cAAc,IAAI,SAAS,CAAC,UAAU,GAAG,CAC3F,CACF,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,YAAY,EAAE,CAAC,cAAsB,EAAE,SAAc,EAAE,EAAE;YACvD,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;gBACxC,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC;QACH,CAAC;QAED,aAAa,EAAE,CAAC,aAAqB,EAAE,KAAa,EAAE,EAAE;YACtD,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,IAAI,CAAC,aAAa,aAAa,YAAY,KAAK,EAAE,CAAC,CAAC;gBAC5D,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare function printHeader(message: string): void;
|
|
2
|
+
export declare function p(message: string): void;
|
|
3
|
+
export declare function print(message: string): void;
|
|
4
|
+
export declare function printBright(message: string): void;
|
|
5
|
+
export declare function printLink(message: string): void;
|
|
6
|
+
export declare function printError(message: string): void;
|
|
7
|
+
export declare function success(message: string): void;
|
|
8
|
+
export declare function printListHeader(message: string): void;
|
|
9
|
+
export declare function printListItem(message: string): void;
|
|
10
|
+
export declare function cyan(message: string): string;
|
|
11
|
+
export declare function yellow(message: string): string;
|
|
12
|
+
export declare function green(message: string): string;
|
|
13
|
+
export declare function bold(message: string): string;
|
|
14
|
+
export declare function bright(message: string): string;
|
|
15
|
+
export declare function dim(message: string): string;
|
|
16
|
+
export declare function link(message: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Prints content in a styled box
|
|
19
|
+
*/
|
|
20
|
+
export declare function printBox(lines: string[], options?: {
|
|
21
|
+
color?: string;
|
|
22
|
+
padding?: number;
|
|
23
|
+
}): void;
|
|
24
|
+
export declare function trimBase64Key(key: string): string;
|
|
25
|
+
export declare function trimToken(token: string): string;
|
|
26
|
+
export declare function workspaceLink(workspaceId: string): string;
|
|
27
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/utils/ui.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,QAE1C;AAED,wBAAgB,CAAC,CAAC,OAAO,EAAE,MAAM,QAEhC;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,QAEpC;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,QAE1C;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,QAExC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,QAEzC;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,QAEtC;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,QAE9C;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,QAE5C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,UAEnC;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,UAErC;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,UAEpC;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,UAEnC;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,UAErC;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,UAElC;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,UAEnC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,QAgCvF;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,UAEhD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { PLATFORM_URL } from '@/constants';
|
|
3
|
+
export function printHeader(message) {
|
|
4
|
+
console.log(chalk.bold(message));
|
|
5
|
+
}
|
|
6
|
+
export function p(message) {
|
|
7
|
+
console.log(message);
|
|
8
|
+
}
|
|
9
|
+
export function print(message) {
|
|
10
|
+
console.log(chalk.dim.white(message));
|
|
11
|
+
}
|
|
12
|
+
export function printBright(message) {
|
|
13
|
+
console.log(chalk.white(message));
|
|
14
|
+
}
|
|
15
|
+
export function printLink(message) {
|
|
16
|
+
console.log(chalk.dim.underline.cyan(message));
|
|
17
|
+
}
|
|
18
|
+
export function printError(message) {
|
|
19
|
+
console.error(chalk.dim.red(message));
|
|
20
|
+
}
|
|
21
|
+
export function success(message) {
|
|
22
|
+
console.log(chalk.dim.green(message));
|
|
23
|
+
}
|
|
24
|
+
export function printListHeader(message) {
|
|
25
|
+
console.log(chalk.gray(message));
|
|
26
|
+
}
|
|
27
|
+
export function printListItem(message) {
|
|
28
|
+
console.log('└ ' + chalk.gray(message));
|
|
29
|
+
}
|
|
30
|
+
export function cyan(message) {
|
|
31
|
+
return chalk.cyan(message);
|
|
32
|
+
}
|
|
33
|
+
export function yellow(message) {
|
|
34
|
+
return chalk.yellow(message);
|
|
35
|
+
}
|
|
36
|
+
export function green(message) {
|
|
37
|
+
return chalk.green(message);
|
|
38
|
+
}
|
|
39
|
+
export function bold(message) {
|
|
40
|
+
return chalk.bold(message);
|
|
41
|
+
}
|
|
42
|
+
export function link(message) {
|
|
43
|
+
return chalk.dim.underline.cyan(message);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Prints content in a styled box
|
|
47
|
+
*/
|
|
48
|
+
export function printBox(lines, options) {
|
|
49
|
+
const color = options?.color || 'yellow';
|
|
50
|
+
const padding = options?.padding ?? 2;
|
|
51
|
+
// Strip ANSI codes to calculate actual text width
|
|
52
|
+
const stripAnsi = (str) => str.replace(/\x1b\[[0-9;]*m/g, '');
|
|
53
|
+
// Calculate box width based on longest line
|
|
54
|
+
const maxContentWidth = Math.max(...lines.map(line => stripAnsi(line).length));
|
|
55
|
+
const boxWidth = maxContentWidth + padding * 2;
|
|
56
|
+
const horizontalLine = '─'.repeat(boxWidth);
|
|
57
|
+
const emptyLine = ' '.repeat(boxWidth);
|
|
58
|
+
// Get chalk color function
|
|
59
|
+
const colorFn = chalk[color] || chalk.yellow;
|
|
60
|
+
// Print box
|
|
61
|
+
p('');
|
|
62
|
+
p(colorFn('┌' + horizontalLine + '┐'));
|
|
63
|
+
p(colorFn('│' + emptyLine + '│'));
|
|
64
|
+
lines.forEach(line => {
|
|
65
|
+
const actualLength = stripAnsi(line).length;
|
|
66
|
+
const leftPad = ' '.repeat(padding);
|
|
67
|
+
const rightPad = ' '.repeat(boxWidth - actualLength - padding);
|
|
68
|
+
p(colorFn('│') + leftPad + line + rightPad + colorFn('│'));
|
|
69
|
+
});
|
|
70
|
+
p(colorFn('│' + emptyLine + '│'));
|
|
71
|
+
p(colorFn('└' + horizontalLine + '┘'));
|
|
72
|
+
p('');
|
|
73
|
+
}
|
|
74
|
+
export function trimBase64Key(key) {
|
|
75
|
+
return key.substring(0, 3) + '...' + key.substring(key.length - 5);
|
|
76
|
+
}
|
|
77
|
+
export function trimToken(token) {
|
|
78
|
+
return token.substring(0, 5) + '...';
|
|
79
|
+
}
|
|
80
|
+
export function workspaceLink(workspaceId) {
|
|
81
|
+
return link(`${PLATFORM_URL}/v2/workspaces/${workspaceId}`);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/utils/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,CAAC,CAAC,OAAe;IAC/B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,OAAe;IACrC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACxC,CAA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CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,WAAmB;IAC/C,OAAO,IAAI,CAAC,GAAG,YAAY,kBAAkB,WAAW,EAAE,CAAC,CAAA;AAC7D,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
LLMChatRequestBuilderNode,
|
|
3
2
|
RemoteLLMChatNode,
|
|
4
3
|
RemoteTTSNode,
|
|
5
4
|
SequentialGraphBuilder,
|
|
@@ -7,24 +6,24 @@ import {
|
|
|
7
6
|
} from '@inworld/runtime/graph';
|
|
8
7
|
|
|
9
8
|
const graphBuilder = new SequentialGraphBuilder({
|
|
10
|
-
id: '
|
|
9
|
+
id: 'llm-tts-graph',
|
|
11
10
|
nodes: [
|
|
12
|
-
new
|
|
13
|
-
|
|
11
|
+
new RemoteLLMChatNode({
|
|
12
|
+
provider: 'openai',
|
|
13
|
+
modelName: 'gpt-4o-mini',
|
|
14
|
+
stream: true,
|
|
15
|
+
messageTemplates: [
|
|
14
16
|
{
|
|
15
17
|
role: 'user',
|
|
16
18
|
content: { type: 'template', template: '{{user_input}}' },
|
|
17
19
|
},
|
|
18
20
|
],
|
|
19
|
-
|
|
20
|
-
new RemoteLLMChatNode({
|
|
21
|
-
provider: 'openai',
|
|
22
|
-
modelName: 'gpt-4o-mini',
|
|
23
|
-
stream: true,
|
|
21
|
+
|
|
24
22
|
}),
|
|
25
23
|
new TextChunkingNode(),
|
|
26
24
|
new RemoteTTSNode(),
|
|
27
25
|
],
|
|
26
|
+
enableRemoteConfig: false
|
|
28
27
|
});
|
|
29
28
|
|
|
30
29
|
export const graph = graphBuilder.build();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inworld/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-rc.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
"build:types": "tsc --emitDeclarationOnly",
|
|
13
13
|
"build:all": "npm run build && npm run build:types",
|
|
14
14
|
"start": "node dist/index.js",
|
|
15
|
-
"dev": "tsx index.ts"
|
|
15
|
+
"dev": "tsx src/index.ts"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"dist/**/*"
|
|
19
|
-
"src/templates/**/*"
|
|
18
|
+
"dist/**/*"
|
|
20
19
|
],
|
|
21
20
|
"author": "Inworld AI",
|
|
22
21
|
"license": "MIT",
|
|
@@ -32,12 +31,14 @@
|
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
33
|
"@zowe/secrets-for-zowe-sdk": "^8.27.0",
|
|
34
|
+
"adm-zip": "^0.5.16",
|
|
35
35
|
"archiver": "^7.0.1",
|
|
36
36
|
"chalk": "^5.3.0",
|
|
37
37
|
"commander": "^12.0.0",
|
|
38
38
|
"conf": "^14.0.0",
|
|
39
39
|
"esbuild": "^0.25.10",
|
|
40
40
|
"jwt-decode": "^4.0.0",
|
|
41
|
+
"mixpanel": "^0.18.1",
|
|
41
42
|
"ora": "^8.2.0",
|
|
42
43
|
"semver": "^7.6.3",
|
|
43
44
|
"tsx": "^4.20.5",
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Simple Custom Node Graph
|
|
2
|
-
|
|
3
|
-
This is a simple Inworld Runtime graph project that demonstrates creating a custom node.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
This template provides a basic example of:
|
|
8
|
-
|
|
9
|
-
- Creating a custom node by extending `CustomNode`
|
|
10
|
-
- Processing input text and returning transformed output
|
|
11
|
-
- Setting up a single-node graph with start and end points
|
|
12
|
-
|
|
13
|
-
## Getting Started
|
|
14
|
-
|
|
15
|
-
### Installation
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Running the Graph
|
|
22
|
-
|
|
23
|
-
#### As a server (recommended):
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm start
|
|
27
|
-
# or
|
|
28
|
-
npx inworld serve {{graphFileName}}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
#### Direct execution:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm run run
|
|
35
|
-
# or
|
|
36
|
-
npx inworld run {{graphFileName}}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Project Structure
|
|
40
|
-
|
|
41
|
-
- **`{{graphFileName}}`** - Main graph file containing your custom node implementation
|
|
42
|
-
- **`package.json`** - Project dependencies and scripts
|
|
43
|
-
- **`README.md`** - This file
|
|
44
|
-
|
|
45
|
-
## How It Works
|
|
46
|
-
|
|
47
|
-
The template includes:
|
|
48
|
-
|
|
49
|
-
1. **CustomTextNode**: A custom node that processes input text (converts to uppercase as an example)
|
|
50
|
-
2. **GraphBuilder**: Creates a graph with the custom node as both start and end point
|
|
51
|
-
3. **Graph Export**: Exports the built graph for use with Inworld CLI or Graph Server
|
|
52
|
-
|
|
53
|
-
## Customization
|
|
54
|
-
|
|
55
|
-
### Modifying the Custom Node
|
|
56
|
-
|
|
57
|
-
Edit the `CustomTextNode` class in `{{graphFileName}}` to change how text is processed:
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
export class CustomTextNode extends CustomNode {
|
|
61
|
-
async process(
|
|
62
|
-
_context: ProcessContext,
|
|
63
|
-
input: string,
|
|
64
|
-
): Promise<CustomTextOutput> {
|
|
65
|
-
// Add your custom processing logic here
|
|
66
|
-
return {
|
|
67
|
-
processedText: yourTransformFunction(input),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Adding More Nodes
|
|
74
|
-
|
|
75
|
-
You can create additional custom nodes and chain them together:
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
const node1 = new FirstCustomNode();
|
|
79
|
-
const node2 = new SecondCustomNode();
|
|
80
|
-
|
|
81
|
-
const graphBuilder = new GraphBuilder('my-graph')
|
|
82
|
-
.addNode(node1)
|
|
83
|
-
.addNode(node2)
|
|
84
|
-
.setStartNode(node1)
|
|
85
|
-
.setEndNode(node2)
|
|
86
|
-
.connectNodes(node1, node2);
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Deployment
|
|
90
|
-
|
|
91
|
-
To package your graph for deployment:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
npx inworld deploy {{graphFileName}}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
This will create a deployment package that can be uploaded to Inworld Cloud.
|
|
98
|
-
|
|
99
|
-
## Documentation
|
|
100
|
-
|
|
101
|
-
For more information about Inworld Runtime, visit the [documentation](https://docs.inworld.ai/).
|
|
102
|
-
|
|
103
|
-
## Requirements
|
|
104
|
-
|
|
105
|
-
- Node.js >= 18.0.0
|
|
106
|
-
- @inworld/cli package
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CustomNode,
|
|
3
|
-
GraphBuilder,
|
|
4
|
-
ProcessContext,
|
|
5
|
-
} from '@inworld/runtime/graph';
|
|
6
|
-
|
|
7
|
-
interface CustomTextOutput {
|
|
8
|
-
processedText: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Define a custom node that processes the input text
|
|
12
|
-
export class CustomTextNode extends CustomNode {
|
|
13
|
-
async process(
|
|
14
|
-
_context: ProcessContext,
|
|
15
|
-
input: string,
|
|
16
|
-
): Promise<CustomTextOutput> {
|
|
17
|
-
return {
|
|
18
|
-
processedText: input.toUpperCase(),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
// Create an instance of the custom node
|
|
23
|
-
const customTextNode = new CustomTextNode();
|
|
24
|
-
|
|
25
|
-
// Creating a simple single-node graph builder instance and adding the node to it.
|
|
26
|
-
const graphBuilder = new GraphBuilder('custom-text-node')
|
|
27
|
-
.addNode(customTextNode)
|
|
28
|
-
.setStartNode(customTextNode)
|
|
29
|
-
.setEndNode(customTextNode);
|
|
30
|
-
|
|
31
|
-
// Export graph to be used by Inworld CLI or Inworld Graph Server.
|
|
32
|
-
export const graph = graphBuilder.build();
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Simple Custom Node",
|
|
3
|
-
"displayName": "Simple Custom Node Graph",
|
|
4
|
-
"description": "A basic example demonstrating how to create a custom node that processes text input. Perfect for learning the basics of the Inworld Runtime graph system.",
|
|
5
|
-
"tags": ["beginner", "custom-node", "text-processing"],
|
|
6
|
-
"defaultProjectName": "simple-graph",
|
|
7
|
-
"examples": {
|
|
8
|
-
"curlCommand": "curl -X POST http://localhost:8080/process -H 'Content-Type: application/json' -d '{\"text\":\"Hello World\"}'",
|
|
9
|
-
"inputExample": {
|
|
10
|
-
"text": "Hello World"
|
|
11
|
-
},
|
|
12
|
-
"outputExample": {
|
|
13
|
-
"processedText": "HELLO WORLD"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"features": [
|
|
17
|
-
"Custom node implementation",
|
|
18
|
-
"Text processing pipeline",
|
|
19
|
-
"Simple graph structure",
|
|
20
|
-
"TypeScript support"
|
|
21
|
-
],
|
|
22
|
-
"requirements": {
|
|
23
|
-
"node": ">=18.0.0",
|
|
24
|
-
"dependencies": ["@inworld/runtime"]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Simple Custom Node Graph
|
|
2
|
-
|
|
3
|
-
This is a simple Inworld Runtime graph project that demonstrates creating a custom node.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
This template provides a basic example of:
|
|
8
|
-
|
|
9
|
-
- Creating a custom node by extending `CustomNode`
|
|
10
|
-
- Processing input text and returning transformed output
|
|
11
|
-
- Setting up a single-node graph with start and end points
|
|
12
|
-
|
|
13
|
-
## Getting Started
|
|
14
|
-
|
|
15
|
-
### Installation
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Running the Graph
|
|
22
|
-
|
|
23
|
-
#### As a server (recommended):
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm start
|
|
27
|
-
# or
|
|
28
|
-
npx inworld serve {{graphFileName}}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
#### Direct execution:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm run run
|
|
35
|
-
# or
|
|
36
|
-
npx inworld run {{graphFileName}}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Project Structure
|
|
40
|
-
|
|
41
|
-
- **`{{graphFileName}}`** - Main graph file containing your custom node implementation
|
|
42
|
-
- **`package.json`** - Project dependencies and scripts
|
|
43
|
-
- **`README.md`** - This file
|
|
44
|
-
|
|
45
|
-
## How It Works
|
|
46
|
-
|
|
47
|
-
The template includes:
|
|
48
|
-
|
|
49
|
-
1. **CustomTextNode**: A custom node that processes input text (converts to uppercase as an example)
|
|
50
|
-
2. **GraphBuilder**: Creates a graph with the custom node as both start and end point
|
|
51
|
-
3. **Graph Export**: Exports the built graph for use with Inworld CLI or Graph Server
|
|
52
|
-
|
|
53
|
-
## Customization
|
|
54
|
-
|
|
55
|
-
### Modifying the Custom Node
|
|
56
|
-
|
|
57
|
-
Edit the `CustomTextNode` class in `{{graphFileName}}` to change how text is processed:
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
export class CustomTextNode extends CustomNode {
|
|
61
|
-
async process(
|
|
62
|
-
_context: ProcessContext,
|
|
63
|
-
input: string,
|
|
64
|
-
): Promise<CustomTextOutput> {
|
|
65
|
-
// Add your custom processing logic here
|
|
66
|
-
return {
|
|
67
|
-
processedText: yourTransformFunction(input),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Adding More Nodes
|
|
74
|
-
|
|
75
|
-
You can create additional custom nodes and chain them together:
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
const node1 = new FirstCustomNode();
|
|
79
|
-
const node2 = new SecondCustomNode();
|
|
80
|
-
|
|
81
|
-
const graphBuilder = new GraphBuilder('my-graph')
|
|
82
|
-
.addNode(node1)
|
|
83
|
-
.addNode(node2)
|
|
84
|
-
.setStartNode(node1)
|
|
85
|
-
.setEndNode(node2)
|
|
86
|
-
.connectNodes(node1, node2);
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Deployment
|
|
90
|
-
|
|
91
|
-
To package your graph for deployment:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
npx inworld deploy {{graphFileName}}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
This will create a deployment package that can be uploaded to Inworld Cloud.
|
|
98
|
-
|
|
99
|
-
## Documentation
|
|
100
|
-
|
|
101
|
-
For more information about Inworld Runtime, visit the [documentation](https://docs.inworld.ai/).
|
|
102
|
-
|
|
103
|
-
## Requirements
|
|
104
|
-
|
|
105
|
-
- Node.js >= 18.0.0
|
|
106
|
-
- @inworld/cli package
|