@inworld/cli 0.3.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 +829 -305
- package/package.json +8 -2
- package/dist/index.js.map +0 -7
- package/dist/package.json +0 -49
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts +0 -10
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js +0 -16
- package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts +0 -13
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js +0 -2
- package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts +0 -7
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js +0 -15
- package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts +0 -14
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js +0 -7
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts +0 -116
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js +0 -71
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts +0 -14
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js +0 -7
- package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts +0 -76
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js +0 -40
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts +0 -10
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js +0 -7
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts +0 -7
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js +0 -13
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts +0 -115
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js +0 -86
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts +0 -255
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js +0 -88
- package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js.map +0 -1
- package/dist/proto/generated/portal/fetch.pb.d.ts +0 -26
- package/dist/proto/generated/portal/fetch.pb.d.ts.map +0 -1
- package/dist/proto/generated/portal/fetch.pb.js +0 -274
- package/dist/proto/generated/portal/fetch.pb.js.map +0 -1
- package/dist/src/auth/callback_server.d.ts +0 -41
- package/dist/src/auth/callback_server.d.ts.map +0 -1
- package/dist/src/auth/callback_server.js +0 -136
- package/dist/src/auth/callback_server.js.map +0 -1
- package/dist/src/auth/manager.d.ts +0 -97
- package/dist/src/auth/manager.d.ts.map +0 -1
- package/dist/src/auth/manager.js +0 -340
- package/dist/src/auth/manager.js.map +0 -1
- package/dist/src/auth/utils.d.ts +0 -45
- package/dist/src/auth/utils.d.ts.map +0 -1
- package/dist/src/auth/utils.js +0 -183
- package/dist/src/auth/utils.js.map +0 -1
- package/dist/src/commands/auth/disable_telemetry_command.d.ts +0 -3
- package/dist/src/commands/auth/disable_telemetry_command.d.ts.map +0 -1
- package/dist/src/commands/auth/enable_telemetry_command.d.ts +0 -3
- package/dist/src/commands/auth/enable_telemetry_command.d.ts.map +0 -1
- package/dist/src/commands/auth/login_ci_command.d.ts +0 -3
- package/dist/src/commands/auth/login_ci_command.d.ts.map +0 -1
- package/dist/src/commands/auth/login_ci_command.js +0 -41
- package/dist/src/commands/auth/login_ci_command.js.map +0 -1
- package/dist/src/commands/auth/login_command.d.ts +0 -4
- package/dist/src/commands/auth/login_command.d.ts.map +0 -1
- package/dist/src/commands/auth/login_command.js +0 -134
- package/dist/src/commands/auth/login_command.js.map +0 -1
- package/dist/src/commands/auth/logout_command.d.ts +0 -4
- package/dist/src/commands/auth/logout_command.d.ts.map +0 -1
- package/dist/src/commands/auth/logout_command.js +0 -54
- package/dist/src/commands/auth/logout_command.js.map +0 -1
- package/dist/src/commands/auth/print_access_token_command.d.ts +0 -3
- package/dist/src/commands/auth/print_access_token_command.d.ts.map +0 -1
- package/dist/src/commands/auth/print_access_token_command.js +0 -21
- package/dist/src/commands/auth/print_access_token_command.js.map +0 -1
- package/dist/src/commands/auth/print_api_key_command.d.ts +0 -3
- package/dist/src/commands/auth/print_api_key_command.d.ts.map +0 -1
- package/dist/src/commands/auth/print_api_key_command.js +0 -26
- package/dist/src/commands/auth/print_api_key_command.js.map +0 -1
- package/dist/src/commands/auth/status_command.d.ts +0 -4
- package/dist/src/commands/auth/status_command.d.ts.map +0 -1
- package/dist/src/commands/auth/status_command.js +0 -84
- package/dist/src/commands/auth/status_command.js.map +0 -1
- package/dist/src/commands/auth_command.d.ts +0 -3
- package/dist/src/commands/auth_command.d.ts.map +0 -1
- package/dist/src/commands/auth_command.js +0 -20
- package/dist/src/commands/auth_command.js.map +0 -1
- package/dist/src/commands/graph/graph_deploy_command.d.ts +0 -24
- package/dist/src/commands/graph/graph_deploy_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_deploy_command.js +0 -191
- package/dist/src/commands/graph/graph_deploy_command.js.map +0 -1
- package/dist/src/commands/graph/graph_init_command.d.ts +0 -4
- package/dist/src/commands/graph/graph_init_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_init_command.js +0 -376
- package/dist/src/commands/graph/graph_init_command.js.map +0 -1
- package/dist/src/commands/graph/graph_run_command.d.ts +0 -24
- package/dist/src/commands/graph/graph_run_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_run_command.js +0 -50
- package/dist/src/commands/graph/graph_run_command.js.map +0 -1
- package/dist/src/commands/graph/graph_serve_command.d.ts +0 -4
- package/dist/src/commands/graph/graph_serve_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_serve_command.js +0 -40
- package/dist/src/commands/graph/graph_serve_command.js.map +0 -1
- package/dist/src/commands/graph/graph_variant_command.d.ts +0 -3
- package/dist/src/commands/graph/graph_variant_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_variant_command.js +0 -13
- package/dist/src/commands/graph/graph_variant_command.js.map +0 -1
- package/dist/src/commands/graph/graph_visualize_command.d.ts +0 -7
- package/dist/src/commands/graph/graph_visualize_command.d.ts.map +0 -1
- package/dist/src/commands/graph/graph_visualize_command.js +0 -35
- package/dist/src/commands/graph/graph_visualize_command.js.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts +0 -3
- package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_list_command.js +0 -25
- package/dist/src/commands/graph/variant/graph_variant_list_command.js.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts +0 -7
- package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_print_command.js +0 -45
- package/dist/src/commands/graph/variant/graph_variant_print_command.js.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts +0 -3
- package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts.map +0 -1
- package/dist/src/commands/graph/variant/graph_variant_register_command.js +0 -45
- package/dist/src/commands/graph/variant/graph_variant_register_command.js.map +0 -1
- package/dist/src/commands/graph_command.d.ts +0 -3
- package/dist/src/commands/graph_command.d.ts.map +0 -1
- package/dist/src/commands/graph_command.js +0 -20
- package/dist/src/commands/graph_command.js.map +0 -1
- package/dist/src/commands/tts_commands.d.ts +0 -17
- package/dist/src/commands/tts_commands.d.ts.map +0 -1
- package/dist/src/commands/tts_commands.js +0 -568
- package/dist/src/commands/tts_commands.js.map +0 -1
- package/dist/src/commands/workspace_command.d.ts +0 -12
- package/dist/src/commands/workspace_command.d.ts.map +0 -1
- package/dist/src/commands/workspace_command.js +0 -33
- package/dist/src/commands/workspace_command.js.map +0 -1
- package/dist/src/constants.d.ts +0 -10
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -30
- package/dist/src/constants.js.map +0 -1
- package/dist/src/grpc/core/InworldError.d.ts +0 -30
- package/dist/src/grpc/core/InworldError.d.ts.map +0 -1
- package/dist/src/grpc/core/InworldError.js +0 -46
- package/dist/src/grpc/core/InworldError.js.map +0 -1
- package/dist/src/grpc/core/statusCodes.d.ts +0 -122
- package/dist/src/grpc/core/statusCodes.d.ts.map +0 -1
- package/dist/src/grpc/core/statusCodes.js +0 -133
- package/dist/src/grpc/core/statusCodes.js.map +0 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/services/analytics.d.ts +0 -45
- package/dist/src/services/analytics.d.ts.map +0 -1
- package/dist/src/services/deploy_service.d.ts +0 -4
- package/dist/src/services/deploy_service.d.ts.map +0 -1
- package/dist/src/services/deploy_service.js +0 -128
- package/dist/src/services/deploy_service.js.map +0 -1
- package/dist/src/services/graph_loader.d.ts +0 -7
- package/dist/src/services/graph_loader.d.ts.map +0 -1
- package/dist/src/services/graph_loader.js +0 -103
- package/dist/src/services/graph_loader.js.map +0 -1
- package/dist/src/services/graph_variant_service.d.ts +0 -12
- package/dist/src/services/graph_variant_service.d.ts.map +0 -1
- package/dist/src/services/graph_variant_service.js +0 -66
- package/dist/src/services/graph_variant_service.js.map +0 -1
- package/dist/src/services/tts_service.d.ts +0 -273
- package/dist/src/services/tts_service.d.ts.map +0 -1
- package/dist/src/services/tts_service.js +0 -299
- package/dist/src/services/tts_service.js.map +0 -1
- package/dist/src/services/update_checker.d.ts +0 -37
- package/dist/src/services/update_checker.d.ts.map +0 -1
- package/dist/src/services/workspace_service.d.ts +0 -47
- package/dist/src/services/workspace_service.d.ts.map +0 -1
- package/dist/src/services/workspace_service.js +0 -222
- package/dist/src/services/workspace_service.js.map +0 -1
- package/dist/src/templates/llm_tts/README.md +0 -161
- package/dist/src/templates/llm_tts/graph.d.ts +0 -2
- package/dist/src/templates/llm_tts/graph.d.ts.map +0 -1
- package/dist/src/templates/llm_tts/graph.ts +0 -30
- package/dist/src/templates/llm_tts/metadata.json +0 -41
- package/dist/src/utils/array.d.ts +0 -2
- package/dist/src/utils/array.d.ts.map +0 -1
- package/dist/src/utils/array.js +0 -4
- package/dist/src/utils/array.js.map +0 -1
- package/dist/src/utils/confirm.d.ts +0 -62
- package/dist/src/utils/confirm.d.ts.map +0 -1
- package/dist/src/utils/confirm.js +0 -90
- package/dist/src/utils/confirm.js.map +0 -1
- package/dist/src/utils/long_running_operations.d.ts +0 -38
- package/dist/src/utils/long_running_operations.d.ts.map +0 -1
- package/dist/src/utils/long_running_operations.js +0 -62
- package/dist/src/utils/long_running_operations.js.map +0 -1
- package/dist/src/utils/resource_name_helper.d.ts +0 -12
- package/dist/src/utils/resource_name_helper.d.ts.map +0 -1
- package/dist/src/utils/resource_name_helper.js +0 -29
- package/dist/src/utils/resource_name_helper.js.map +0 -1
- package/dist/src/utils/selector.d.ts +0 -62
- package/dist/src/utils/selector.d.ts.map +0 -1
- package/dist/src/utils/selector.js +0 -77
- package/dist/src/utils/selector.js.map +0 -1
- package/dist/src/utils/spinner.d.ts +0 -75
- package/dist/src/utils/spinner.d.ts.map +0 -1
- package/dist/src/utils/spinner.js +0 -178
- package/dist/src/utils/spinner.js.map +0 -1
- package/dist/src/utils/ui.d.ts +0 -27
- package/dist/src/utils/ui.d.ts.map +0 -1
- package/dist/src/utils/ui.js +0 -83
- package/dist/src/utils/ui.js.map +0 -1
- package/dist/templates/llm_tts/README.md +0 -155
- package/dist/templates/llm_tts/graph.ts +0 -29
- package/dist/templates/llm_tts/metadata.json +0 -41
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
# LLM + TTS Pipeline Graph
|
|
2
|
-
|
|
3
|
-
This is an Inworld Runtime graph that creates a complete conversational AI pipeline with LLM chat and text-to-speech capabilities.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
This template provides a production-ready pipeline that:
|
|
8
|
-
|
|
9
|
-
- Accepts user input and formats it for LLM processing
|
|
10
|
-
- Sends requests to an LLM provider (OpenAI GPT-4o-mini by default)
|
|
11
|
-
- Streams responses for better user experience
|
|
12
|
-
- Chunks text for optimal TTS processing
|
|
13
|
-
- Converts text responses to speech using TTS
|
|
14
|
-
|
|
15
|
-
## Getting Started
|
|
16
|
-
|
|
17
|
-
### Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Configuration
|
|
24
|
-
|
|
25
|
-
Before running, you'll need to set up your API keys:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# Set your OpenAI API key (for LLM)
|
|
29
|
-
export OPENAI_API_KEY="your-openai-api-key"
|
|
30
|
-
|
|
31
|
-
# Set your TTS provider credentials (if using a specific provider)
|
|
32
|
-
export TTS_API_KEY="your-tts-api-key"
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Running the Graph
|
|
36
|
-
|
|
37
|
-
#### As a server (recommended):
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm start
|
|
41
|
-
# or
|
|
42
|
-
npx inworld serve {{graphFileName}}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
#### Direct execution:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npm run run
|
|
49
|
-
# or
|
|
50
|
-
npx inworld run {{graphFileName}}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Project Structure
|
|
54
|
-
|
|
55
|
-
- **`{{graphFileName}}`** - Main graph file with the LLM-TTS pipeline
|
|
56
|
-
- **`package.json`** - Project dependencies and scripts
|
|
57
|
-
- **`README.md`** - This file
|
|
58
|
-
|
|
59
|
-
## Pipeline Architecture
|
|
60
|
-
|
|
61
|
-
The graph uses a `SequentialGraphBuilder` with the following nodes in order:
|
|
62
|
-
|
|
63
|
-
1. **LLMChatRequestBuilderNode**: Formats user input into LLM chat messages
|
|
64
|
-
2. **RemoteLLMChatNode**: Sends requests to the LLM provider and receives responses
|
|
65
|
-
3. **TextChunkingNode**: Breaks text into optimal chunks for TTS processing
|
|
66
|
-
4. **RemoteTTSNode**: Converts text chunks to speech
|
|
67
|
-
|
|
68
|
-
## Customization
|
|
69
|
-
|
|
70
|
-
### Changing the LLM Provider
|
|
71
|
-
|
|
72
|
-
Edit the `RemoteLLMChatNode` configuration in `{{graphFileName}}`:
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
new RemoteLLMChatNode({
|
|
76
|
-
provider: 'anthropic', // Change to 'anthropic', 'google', etc.
|
|
77
|
-
modelName: 'claude-3-sonnet', // Change to desired model
|
|
78
|
-
stream: true,
|
|
79
|
-
// Add other provider-specific options
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Modifying the System Prompt
|
|
84
|
-
|
|
85
|
-
Add system messages to the `LLMChatRequestBuilderNode`:
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
new LLMChatRequestBuilderNode({
|
|
89
|
-
messages: [
|
|
90
|
-
{
|
|
91
|
-
role: 'system',
|
|
92
|
-
content: { type: 'text', text: 'You are a helpful assistant...' },
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
role: 'user',
|
|
96
|
-
content: { type: 'template', template: '{{user_input}}' },
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
});
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Customizing TTS Settings
|
|
103
|
-
|
|
104
|
-
Configure the TTS node for different voices or providers:
|
|
105
|
-
|
|
106
|
-
```typescript
|
|
107
|
-
new RemoteTTSNode({
|
|
108
|
-
speakerId: 'Dennis',
|
|
109
|
-
modelId: 'inworld-tts-1-max',
|
|
110
|
-
});
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Adding Additional Processing
|
|
114
|
-
|
|
115
|
-
You can insert additional nodes into the pipeline:
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
const graphBuilder = new SequentialGraphBuilder({
|
|
119
|
-
id: 'custom-text-node-llm',
|
|
120
|
-
nodes: [
|
|
121
|
-
new LLMChatRequestBuilderNode({...}),
|
|
122
|
-
new RemoteLLMChatNode({...}),
|
|
123
|
-
new CustomProcessingNode(), // Your custom node
|
|
124
|
-
new TextChunkingNode(),
|
|
125
|
-
new RemoteTTSNode(),
|
|
126
|
-
],
|
|
127
|
-
});
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Environment Variables
|
|
131
|
-
|
|
132
|
-
The following environment variables can be configured:
|
|
133
|
-
|
|
134
|
-
- `OPENAI_API_KEY`: API key for OpenAI (required for GPT models)
|
|
135
|
-
- `ANTHROPIC_API_KEY`: API key for Anthropic (if using Claude)
|
|
136
|
-
- `GOOGLE_API_KEY`: API key for Google (if using Gemini)
|
|
137
|
-
- `TTS_API_KEY`: API key for your TTS provider
|
|
138
|
-
|
|
139
|
-
## Deployment
|
|
140
|
-
|
|
141
|
-
To package your graph for deployment:
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
npx inworld deploy {{graphFileName}}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
This will create a deployment package that can be uploaded to Inworld Cloud.
|
|
148
|
-
|
|
149
|
-
## Documentation
|
|
150
|
-
|
|
151
|
-
For more information about:
|
|
152
|
-
|
|
153
|
-
- Inworld Runtime: Visit the [documentation](https://docs.inworld.ai/)
|
|
154
|
-
- LLM providers: Check provider-specific documentation
|
|
155
|
-
- TTS options: See the TTS provider documentation
|
|
156
|
-
|
|
157
|
-
## Requirements
|
|
158
|
-
|
|
159
|
-
- Node.js >= 18.0.0
|
|
160
|
-
- @inworld/cli package
|
|
161
|
-
- Valid API keys for LLM and TTS providers
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../src/templates/llm_tts/graph.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,KAAK,KAAuB,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LLMChatRequestBuilderNode,
|
|
3
|
-
RemoteLLMChatNode,
|
|
4
|
-
RemoteTTSNode,
|
|
5
|
-
SequentialGraphBuilder,
|
|
6
|
-
TextChunkingNode,
|
|
7
|
-
} from '@inworld/runtime/graph';
|
|
8
|
-
|
|
9
|
-
const graphBuilder = new SequentialGraphBuilder({
|
|
10
|
-
id: 'custom-text-node-llm',
|
|
11
|
-
nodes: [
|
|
12
|
-
new LLMChatRequestBuilderNode({
|
|
13
|
-
messages: [
|
|
14
|
-
{
|
|
15
|
-
role: 'user',
|
|
16
|
-
content: { type: 'template', template: '{{user_input}}' },
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
}),
|
|
20
|
-
new RemoteLLMChatNode({
|
|
21
|
-
provider: 'openai',
|
|
22
|
-
modelName: 'gpt-4o-mini',
|
|
23
|
-
stream: true,
|
|
24
|
-
}),
|
|
25
|
-
new TextChunkingNode(),
|
|
26
|
-
new RemoteTTSNode(),
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export const graph = graphBuilder.build();
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "LLM + TTS Pipeline",
|
|
3
|
-
"displayName": "LLM Chat with Text-to-Speech",
|
|
4
|
-
"description": "A production-ready pipeline that processes user input through an LLM (GPT-4o-mini by default) and converts the response to speech using TTS. Includes streaming support for better user experience.",
|
|
5
|
-
"tags": ["llm", "tts", "openai", "voice", "streaming"],
|
|
6
|
-
"defaultProjectName": "llm-tts-graph",
|
|
7
|
-
"examples": {
|
|
8
|
-
"curlCommand": "curl http://localhost:3000/v1/graph:start -X POST -H 'Content-Type: application/json' -d '{\"input\": {\"user_input\":\"What is the weather like today?\"}}'",
|
|
9
|
-
"inputExample": {
|
|
10
|
-
"user_input": "What is the weather like today?"
|
|
11
|
-
},
|
|
12
|
-
"outputExample": {
|
|
13
|
-
"text": "I don't have access to real-time weather data...",
|
|
14
|
-
"audio": "base64_encoded_audio_data..."
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"features": [
|
|
18
|
-
"LLM integration (OpenAI GPT-4o-mini)",
|
|
19
|
-
"Text-to-Speech conversion",
|
|
20
|
-
"Streaming responses",
|
|
21
|
-
"Text chunking for optimal TTS",
|
|
22
|
-
"Configurable providers"
|
|
23
|
-
],
|
|
24
|
-
"requirements": {
|
|
25
|
-
"node": ">=18.0.0",
|
|
26
|
-
"dependencies": ["@inworld/runtime"],
|
|
27
|
-
"apiKeys": ["OPENAI_API_KEY"],
|
|
28
|
-
"optionalApiKeys": ["TTS_API_KEY"]
|
|
29
|
-
},
|
|
30
|
-
"configuration": {
|
|
31
|
-
"llm": {
|
|
32
|
-
"provider": "openai",
|
|
33
|
-
"model": "gpt-4o-mini",
|
|
34
|
-
"streaming": true
|
|
35
|
-
},
|
|
36
|
-
"tts": {
|
|
37
|
-
"provider": "default",
|
|
38
|
-
"voice": "default"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/utils/array.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,CAAC,EAC7B,GAAG,EAAE,CAAC,EAAE,GAAG,SAAS,EACpB,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,IAAI,CAAC,GACpC,GAAG,IAAI,CAAC,EAAE,CAIZ"}
|
package/dist/src/utils/array.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/utils/array.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAC3B,GAAoB,EACpB,SAAqC;IAErC,OAAO,CACL,OAAO,GAAG,KAAK,WAAW,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CACzE,CAAC;AACJ,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets the global auto-confirm flag
|
|
3
|
-
* @param value If true, all confirmations will be auto-accepted
|
|
4
|
-
*/
|
|
5
|
-
export declare function setGlobalForceYes(value: boolean): void;
|
|
6
|
-
/**
|
|
7
|
-
* Gets the current global auto-confirm flag value
|
|
8
|
-
*/
|
|
9
|
-
export declare function getGlobalForceYes(): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Options for confirmation prompts
|
|
12
|
-
*/
|
|
13
|
-
export interface ConfirmOptions {
|
|
14
|
-
/**
|
|
15
|
-
* The prompt message to show the user
|
|
16
|
-
*/
|
|
17
|
-
message: string;
|
|
18
|
-
/**
|
|
19
|
-
* If true, automatically confirm without prompting
|
|
20
|
-
* Overrides global forceYes setting
|
|
21
|
-
*/
|
|
22
|
-
forceYes?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* The default value if user just presses enter (defaults to false)
|
|
25
|
-
*/
|
|
26
|
-
defaultValue?: boolean;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Prompts the user for a yes/no confirmation
|
|
30
|
-
* Supports auto-confirm via forceYes parameter or global setting
|
|
31
|
-
*
|
|
32
|
-
* @param options Confirmation options
|
|
33
|
-
* @returns Promise that resolves to true if user confirmed, false otherwise
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* const shouldProceed = await confirm({
|
|
38
|
-
* message: 'Do you want to continue?',
|
|
39
|
-
* defaultValue: false
|
|
40
|
-
* });
|
|
41
|
-
* if (shouldProceed) {
|
|
42
|
-
* // proceed with action
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function confirm(options: ConfirmOptions): Promise<boolean>;
|
|
47
|
-
/**
|
|
48
|
-
* Prompts the user for confirmation and exits the process if declined
|
|
49
|
-
*
|
|
50
|
-
* @param options Confirmation options
|
|
51
|
-
* @param exitCode Exit code to use if user declines (defaults to 1)
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* await confirmOrExit({
|
|
56
|
-
* message: 'This will delete all data. Continue? (y/N): '
|
|
57
|
-
* });
|
|
58
|
-
* // Code only reaches here if user confirmed
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export declare function confirmOrExit(options: ConfirmOptions, exitCode?: number): Promise<void>;
|
|
62
|
-
//# sourceMappingURL=confirm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/utils/confirm.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAEtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAwCvE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,QAAQ,GAAE,MAAU,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import * as readline from 'readline';
|
|
2
|
-
/**
|
|
3
|
-
* Global context for confirmation prompts
|
|
4
|
-
*/
|
|
5
|
-
let globalForceYes = false;
|
|
6
|
-
/**
|
|
7
|
-
* Sets the global auto-confirm flag
|
|
8
|
-
* @param value If true, all confirmations will be auto-accepted
|
|
9
|
-
*/
|
|
10
|
-
export function setGlobalForceYes(value) {
|
|
11
|
-
globalForceYes = value;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Gets the current global auto-confirm flag value
|
|
15
|
-
*/
|
|
16
|
-
export function getGlobalForceYes() {
|
|
17
|
-
return globalForceYes;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Prompts the user for a yes/no confirmation
|
|
21
|
-
* Supports auto-confirm via forceYes parameter or global setting
|
|
22
|
-
*
|
|
23
|
-
* @param options Confirmation options
|
|
24
|
-
* @returns Promise that resolves to true if user confirmed, false otherwise
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const shouldProceed = await confirm({
|
|
29
|
-
* message: 'Do you want to continue?',
|
|
30
|
-
* defaultValue: false
|
|
31
|
-
* });
|
|
32
|
-
* if (shouldProceed) {
|
|
33
|
-
* // proceed with action
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export async function confirm(options) {
|
|
38
|
-
const { message, forceYes, defaultValue = false } = options;
|
|
39
|
-
// Check if we should auto-confirm (local override or global setting)
|
|
40
|
-
if (forceYes !== undefined ? forceYes : globalForceYes) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
const rl = readline.createInterface({
|
|
44
|
-
input: process.stdin,
|
|
45
|
-
output: process.stdout,
|
|
46
|
-
});
|
|
47
|
-
return new Promise((resolve) => {
|
|
48
|
-
rl.question(message, (answer) => {
|
|
49
|
-
rl.close();
|
|
50
|
-
const trimmedAnswer = answer.trim().toLowerCase();
|
|
51
|
-
// Handle explicit yes/no
|
|
52
|
-
if (trimmedAnswer === 'y' || trimmedAnswer === 'yes') {
|
|
53
|
-
resolve(true);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (trimmedAnswer === 'n' || trimmedAnswer === 'no') {
|
|
57
|
-
resolve(false);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
// Empty answer uses default
|
|
61
|
-
if (trimmedAnswer === '') {
|
|
62
|
-
resolve(defaultValue);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
// Invalid input defaults to false for safety
|
|
66
|
-
resolve(false);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Prompts the user for confirmation and exits the process if declined
|
|
72
|
-
*
|
|
73
|
-
* @param options Confirmation options
|
|
74
|
-
* @param exitCode Exit code to use if user declines (defaults to 1)
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* await confirmOrExit({
|
|
79
|
-
* message: 'This will delete all data. Continue? (y/N): '
|
|
80
|
-
* });
|
|
81
|
-
* // Code only reaches here if user confirmed
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
export async function confirmOrExit(options, exitCode = 1) {
|
|
85
|
-
const confirmed = await confirm(options);
|
|
86
|
-
if (!confirmed) {
|
|
87
|
-
process.exit(exitCode);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=confirm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../../src/utils/confirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,cAAc,GAAG,KAAK,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CAAC;AACxB,CAAC;AAuBD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAuB;IACnD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAE5D,qEAAqE;IACrE,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QAClC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAc,EAAE,EAAE;YACtC,EAAE,CAAC,KAAK,EAAE,CAAC;YAEX,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAElD,yBAAyB;YACzB,IAAI,aAAa,KAAK,GAAG,IAAI,aAAa,KAAK,KAAK,EAAE,CAAC;gBACrD,OAAO,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO;YACT,CAAC;YAED,IAAI,aAAa,KAAK,GAAG,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;gBACpD,OAAO,CAAC,KAAK,CAAC,CAAC;gBACf,OAAO;YACT,CAAC;YAED,4BAA4B;YAC5B,IAAI,aAAa,KAAK,EAAE,EAAE,CAAC;gBACzB,OAAO,CAAC,YAAY,CAAC,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,6CAA6C;YAC7C,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAuB,EACvB,WAAmB,CAAC;IAEpB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ErrorStatus } from '@/grpc/core/InworldError';
|
|
2
|
-
export type LongRunningOperationResponse = {
|
|
3
|
-
name: string;
|
|
4
|
-
metadata?: any;
|
|
5
|
-
done: boolean;
|
|
6
|
-
error?: ErrorStatus;
|
|
7
|
-
response?: any;
|
|
8
|
-
};
|
|
9
|
-
export declare const isLongRunningOperationResponse: (obj: any) => obj is LongRunningOperationResponse;
|
|
10
|
-
export declare const CHECK_LIMIT = 60;
|
|
11
|
-
export declare const CHECK_TIMEOUT = 2000;
|
|
12
|
-
export type LROPollOptions<T> = {
|
|
13
|
-
currentIteration?: number;
|
|
14
|
-
skipCheck?: boolean;
|
|
15
|
-
isRunning?: boolean;
|
|
16
|
-
operationName?: string;
|
|
17
|
-
startCallback?: (operationName: string) => void;
|
|
18
|
-
iterationCallback?: (operationName: string, checkResponse: {
|
|
19
|
-
done?: boolean | undefined;
|
|
20
|
-
response?: T | undefined;
|
|
21
|
-
error?: string | undefined;
|
|
22
|
-
} | undefined, checkData: {
|
|
23
|
-
checkIteration: number;
|
|
24
|
-
checkLimit: number;
|
|
25
|
-
checkTimeout: number;
|
|
26
|
-
}) => void;
|
|
27
|
-
doneCallback?: (operationName: string, response: T | undefined) => void;
|
|
28
|
-
errorCallback?: (operationName: string, error: string) => void;
|
|
29
|
-
};
|
|
30
|
-
export declare const checkLRO: <T>({ operationName, signal, checkLimit, checkTimeout, pollOptions, returnWithMetadata, }: {
|
|
31
|
-
operationName: string;
|
|
32
|
-
signal?: AbortSignal;
|
|
33
|
-
checkLimit?: number;
|
|
34
|
-
checkTimeout?: number;
|
|
35
|
-
pollOptions?: LROPollOptions<T>;
|
|
36
|
-
returnWithMetadata?: boolean;
|
|
37
|
-
}) => Promise<T>;
|
|
38
|
-
//# sourceMappingURL=long_running_operations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"long_running_operations.d.ts","sourceRoot":"","sources":["../../../src/utils/long_running_operations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AASF,eAAO,MAAM,8BAA8B,GACzC,KAAK,GAAG,KACP,GAAG,IAAI,4BAK6C,CAAC;AAExD,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,aAAa,OAAO,CAAC;AAElC,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,iBAAiB,CAAC,EAAE,CAClB,aAAa,EAAE,MAAM,EACrB,aAAa,EACT;QACE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC3B,QAAQ,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC5B,GACD,SAAS,EACb,SAAS,EAAE;QACT,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,KACE,IAAI,CAAC;IACV,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,CAAC;IACxE,aAAa,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAChE,CAAC;AAGF,eAAO,MAAM,QAAQ,GAAU,CAAC,EAAE,uFAO/B;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,eA2CA,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// Potred from portal ui code.
|
|
2
|
-
import { Operations } from '@/proto/generated/portal/ai/inworld/studio/v1/operations.pb';
|
|
3
|
-
import { retryableAuthenticatedInworldRequest } from '@/auth/utils';
|
|
4
|
-
const isOperationError = (obj) => typeof obj === 'object' &&
|
|
5
|
-
obj !== null &&
|
|
6
|
-
typeof obj.code === 'number' &&
|
|
7
|
-
typeof obj.message === 'string' &&
|
|
8
|
-
('details' in obj ? Array.isArray(obj.details) : true);
|
|
9
|
-
export const isLongRunningOperationResponse = (obj) => typeof obj === 'object' &&
|
|
10
|
-
obj !== null &&
|
|
11
|
-
typeof obj.name === 'string' &&
|
|
12
|
-
typeof obj.done === 'boolean' &&
|
|
13
|
-
('error' in obj ? isOperationError(obj.error) : true);
|
|
14
|
-
export const CHECK_LIMIT = 60;
|
|
15
|
-
export const CHECK_TIMEOUT = 2000;
|
|
16
|
-
//Decoupled polling logic from calling the operation
|
|
17
|
-
export const checkLRO = async ({ operationName, signal, checkLimit, checkTimeout, pollOptions, returnWithMetadata, }) => {
|
|
18
|
-
let checkResponse;
|
|
19
|
-
checkLimit = checkLimit ?? CHECK_LIMIT;
|
|
20
|
-
checkTimeout = checkTimeout ?? CHECK_TIMEOUT;
|
|
21
|
-
if (pollOptions?.startCallback) {
|
|
22
|
-
pollOptions.startCallback(operationName);
|
|
23
|
-
}
|
|
24
|
-
for (let i = pollOptions?.currentIteration ?? 0; i < checkLimit; i++) {
|
|
25
|
-
signal?.throwIfAborted();
|
|
26
|
-
try {
|
|
27
|
-
checkResponse = await check(operationName, signal, returnWithMetadata);
|
|
28
|
-
if (checkResponse?.done) {
|
|
29
|
-
if (checkResponse?.error || checkResponse?.metadata?.error) {
|
|
30
|
-
pollOptions?.errorCallback?.(operationName, checkResponse.error || checkResponse?.metadata?.error);
|
|
31
|
-
throw checkResponse.error || checkResponse?.metadata?.error;
|
|
32
|
-
}
|
|
33
|
-
pollOptions?.doneCallback?.(operationName, checkResponse?.response);
|
|
34
|
-
return (returnWithMetadata ? checkResponse : checkResponse?.response);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
pollOptions?.iterationCallback?.(operationName, checkResponse, {
|
|
38
|
-
checkIteration: i,
|
|
39
|
-
checkLimit,
|
|
40
|
-
checkTimeout,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
pollOptions?.errorCallback?.(operationName, error);
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
await new Promise((resolve) => setTimeout(resolve, checkTimeout));
|
|
49
|
-
}
|
|
50
|
-
throw new Error(`Operation timeout. Max number of checks reached ${checkLimit}`);
|
|
51
|
-
};
|
|
52
|
-
const check = async (operationName, signal, returnWithMetadata) => retryableAuthenticatedInworldRequest(Operations.GetOperation, {
|
|
53
|
-
nameworkspacescharactersoperations: operationName,
|
|
54
|
-
}, returnWithMetadata
|
|
55
|
-
? {
|
|
56
|
-
withMetadata: true,
|
|
57
|
-
maxRetries: 1,
|
|
58
|
-
backoffFactor: 2,
|
|
59
|
-
minTimeout: 300,
|
|
60
|
-
}
|
|
61
|
-
: undefined, signal);
|
|
62
|
-
//# sourceMappingURL=long_running_operations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"long_running_operations.js","sourceRoot":"","sources":["../../../src/utils/long_running_operations.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const parseWorkspaceResourceName: (resourceName: string) => {
|
|
2
|
-
workspaceId: string;
|
|
3
|
-
};
|
|
4
|
-
export declare const parseGraphResourceName: (resourceName: string) => {
|
|
5
|
-
workspaceId: string;
|
|
6
|
-
graphId: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const getGraphResourceName: (workspaceId: string, graphId: string) => string;
|
|
9
|
-
export declare const getGraphVariantResourceName: (workspaceId: string, graphId: string, variantId: string) => string;
|
|
10
|
-
export declare const getWorkspaceResourceName: (workspaceId: string) => string;
|
|
11
|
-
export declare const getGraphDeploymentResourceName: (workspaceId: string, graphId: string) => string;
|
|
12
|
-
//# sourceMappingURL=resource_name_helper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource_name_helper.d.ts","sourceRoot":"","sources":["../../../src/utils/resource_name_helper.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,GAAI,cAAc,MAAM;;CAM9D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,cAAc,MAAM;;;CAW1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,WAExE,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,aAAa,MAAM,EACnB,SAAS,MAAM,EACf,WAAW,MAAM,WAGlB,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,aAAa,MAAM,WAE3D,CAAC;AAEF,eAAO,MAAM,8BAA8B,GACzC,aAAa,MAAM,EACnB,SAAS,MAAM,WAGhB,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export const parseWorkspaceResourceName = (resourceName) => {
|
|
2
|
-
const [collection, workspaceId] = resourceName.split('/');
|
|
3
|
-
if (collection !== 'workspaces') {
|
|
4
|
-
throw new Error(`Invalid workspace resource name: ${resourceName}`);
|
|
5
|
-
}
|
|
6
|
-
return { workspaceId };
|
|
7
|
-
};
|
|
8
|
-
export const parseGraphResourceName = (resourceName) => {
|
|
9
|
-
const [workspaceCollection, workspaceId, graphCollection, graphId] = resourceName.split('/');
|
|
10
|
-
if (workspaceCollection !== 'workspaces' ||
|
|
11
|
-
graphCollection !== 'graphs' ||
|
|
12
|
-
graphId === undefined) {
|
|
13
|
-
throw new Error(`Invalid graph resource name: ${resourceName}`);
|
|
14
|
-
}
|
|
15
|
-
return { workspaceId, graphId };
|
|
16
|
-
};
|
|
17
|
-
export const getGraphResourceName = (workspaceId, graphId) => {
|
|
18
|
-
return `workspaces/${workspaceId}/graphs/${graphId}`;
|
|
19
|
-
};
|
|
20
|
-
export const getGraphVariantResourceName = (workspaceId, graphId, variantId) => {
|
|
21
|
-
return `${getGraphResourceName(workspaceId, graphId)}/variants/${variantId}`;
|
|
22
|
-
};
|
|
23
|
-
export const getWorkspaceResourceName = (workspaceId) => {
|
|
24
|
-
return `workspaces/${workspaceId}`;
|
|
25
|
-
};
|
|
26
|
-
export const getGraphDeploymentResourceName = (workspaceId, graphId) => {
|
|
27
|
-
return `${getGraphResourceName(workspaceId, graphId)}/deploy`;
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=resource_name_helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource_name_helper.js","sourceRoot":"","sources":["../../../src/utils/resource_name_helper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,YAAoB,EAAE,EAAE;IACjE,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1D,IAAI,UAAU,KAAK,YAAY,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,oCAAoC,YAAY,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,YAAoB,EAAE,EAAE;IAC7D,MAAM,CAAC,mBAAmB,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,CAAC,GAChE,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,IACE,mBAAmB,KAAK,YAAY;QACpC,eAAe,KAAK,QAAQ;QAC5B,OAAO,KAAK,SAAS,EACrB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,YAAY,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAAmB,EAAE,OAAe,EAAE,EAAE;IAC3E,OAAO,cAAc,WAAW,WAAW,OAAO,EAAE,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,WAAmB,EACnB,OAAe,EACf,SAAiB,EACjB,EAAE;IACF,OAAO,GAAG,oBAAoB,CAAC,WAAW,EAAE,OAAO,CAAC,aAAa,SAAS,EAAE,CAAC;AAC/E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC9D,OAAO,cAAc,WAAW,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC5C,WAAmB,EACnB,OAAe,EACf,EAAE;IACF,OAAO,GAAG,oBAAoB,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC;AAChE,CAAC,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for configuring the selector behavior
|
|
3
|
-
*/
|
|
4
|
-
export interface SelectorOptions<T> {
|
|
5
|
-
/**
|
|
6
|
-
* The items to select from
|
|
7
|
-
*/
|
|
8
|
-
items: T[];
|
|
9
|
-
/**
|
|
10
|
-
* Function to get the display name for an item
|
|
11
|
-
*/
|
|
12
|
-
getDisplayName: (item: T) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Function to get the ID/resource name for an item
|
|
15
|
-
*/
|
|
16
|
-
getIdentifier: (item: T) => string;
|
|
17
|
-
/**
|
|
18
|
-
* The prompt message to show to the user
|
|
19
|
-
*/
|
|
20
|
-
prompt: string;
|
|
21
|
-
/**
|
|
22
|
-
* The title to show before listing items
|
|
23
|
-
*/
|
|
24
|
-
title: string;
|
|
25
|
-
/**
|
|
26
|
-
* If true, automatically select the first item without prompting
|
|
27
|
-
*/
|
|
28
|
-
forceFirst?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Message to show when no items are found
|
|
31
|
-
*/
|
|
32
|
-
noItemsMessage?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Message to show for invalid selection
|
|
35
|
-
*/
|
|
36
|
-
invalidSelectionMessage?: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Generic selector utility that provides a consistent interface for selecting items
|
|
40
|
-
* from a list. Supports selection by index number or identifier.
|
|
41
|
-
*
|
|
42
|
-
* @param options Configuration options for the selector
|
|
43
|
-
* @returns The selected item or null if no selection was made
|
|
44
|
-
*/
|
|
45
|
-
export declare function selectItem<T>(options: SelectorOptions<T>): Promise<T | null>;
|
|
46
|
-
/**
|
|
47
|
-
* Selector options with exit capability
|
|
48
|
-
*/
|
|
49
|
-
export interface SelectorWithExitOptions<T> extends SelectorOptions<T> {
|
|
50
|
-
/**
|
|
51
|
-
* If true, the process will exit with code 1 when selection fails
|
|
52
|
-
*/
|
|
53
|
-
exitOnFailure?: boolean;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Wrapper around selectItem that exits the process on failure
|
|
57
|
-
*
|
|
58
|
-
* @param options Configuration options for the selector
|
|
59
|
-
* @returns The selected item (never null due to process exit on failure)
|
|
60
|
-
*/
|
|
61
|
-
export declare function selectItemOrExit<T>(options: SelectorWithExitOptions<T>): Promise<T>;
|
|
62
|
-
//# sourceMappingURL=selector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../../../src/utils/selector.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC;;OAEG;IACH,KAAK,EAAE,CAAC,EAAE,CAAC;IAEX;;OAEG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAEpC;;OAEG;IACH,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAEnC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAwEnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;IACpE;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC,CAUZ"}
|