voicerun-cli 0.2.4__tar.gz
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.
- voicerun_cli-0.2.4/PKG-INFO +598 -0
- voicerun_cli-0.2.4/README.md +570 -0
- voicerun_cli-0.2.4/pyproject.toml +69 -0
- voicerun_cli-0.2.4/setup.cfg +4 -0
- voicerun_cli-0.2.4/tests/test_agent_commands.py +499 -0
- voicerun_cli-0.2.4/tests/test_func_commands.py +958 -0
- voicerun_cli-0.2.4/voicerun_cli.egg-info/PKG-INFO +598 -0
- voicerun_cli-0.2.4/voicerun_cli.egg-info/SOURCES.txt +28 -0
- voicerun_cli-0.2.4/voicerun_cli.egg-info/dependency_links.txt +1 -0
- voicerun_cli-0.2.4/voicerun_cli.egg-info/entry_points.txt +2 -0
- voicerun_cli-0.2.4/voicerun_cli.egg-info/requires.txt +21 -0
- voicerun_cli-0.2.4/voicerun_cli.egg-info/top_level.txt +1 -0
- voicerun_cli-0.2.4/vr_cli/__init__.py +0 -0
- voicerun_cli-0.2.4/vr_cli/cli.py +16 -0
- voicerun_cli-0.2.4/vr_cli/commands/agent.py +206 -0
- voicerun_cli-0.2.4/vr_cli/commands/auth.py +249 -0
- voicerun_cli-0.2.4/vr_cli/commands/debug.py +841 -0
- voicerun_cli-0.2.4/vr_cli/commands/env.py +479 -0
- voicerun_cli-0.2.4/vr_cli/commands/func.py +530 -0
- voicerun_cli-0.2.4/vr_cli/commands/user.py +34 -0
- voicerun_cli-0.2.4/vr_cli/entities/agent.py +40 -0
- voicerun_cli-0.2.4/vr_cli/entities/agent_environment.py +59 -0
- voicerun_cli-0.2.4/vr_cli/entities/agent_environment_variable.py +32 -0
- voicerun_cli-0.2.4/vr_cli/entities/agent_function.py +42 -0
- voicerun_cli-0.2.4/vr_cli/entities/base.py +129 -0
- voicerun_cli-0.2.4/vr_cli/entities/phone_number.py +32 -0
- voicerun_cli-0.2.4/vr_cli/utils/audio_input.py +316 -0
- voicerun_cli-0.2.4/vr_cli/utils/audio_output.py +256 -0
- voicerun_cli-0.2.4/vr_cli/utils/config.py +98 -0
- voicerun_cli-0.2.4/vr_cli/utils/utils.py +445 -0
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: voicerun-cli
|
|
3
|
+
Version: 0.2.4
|
|
4
|
+
Summary: VoiceRun command-line interface
|
|
5
|
+
Author-email: VoiceRun <anna@primvoices.com>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: black>=23.3.0
|
|
9
|
+
Requires-Dist: requests>=2.32.4
|
|
10
|
+
Requires-Dist: typer>=0.16.0
|
|
11
|
+
Requires-Dist: websocket-client>=1.6.0
|
|
12
|
+
Requires-Dist: websockets>=11.0.0
|
|
13
|
+
Requires-Dist: rich>=13.0.0
|
|
14
|
+
Requires-Dist: aiohttp>=3.8.6
|
|
15
|
+
Requires-Dist: loguru>=0.7.3
|
|
16
|
+
Requires-Dist: pyaudio>=0.2.11
|
|
17
|
+
Requires-Dist: numpy>=1.24.0
|
|
18
|
+
Requires-Dist: pygame-ce>=2.5.0
|
|
19
|
+
Requires-Dist: primfunctions>=0.1.13
|
|
20
|
+
Requires-Dist: g711>=1.6.5
|
|
21
|
+
Requires-Dist: pygame>=2.6.1
|
|
22
|
+
Requires-Dist: six>=1.17.0
|
|
23
|
+
Provides-Extra: test
|
|
24
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
25
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
|
26
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
|
|
28
|
+
|
|
29
|
+
# voicerun-cli
|
|
30
|
+
|
|
31
|
+
A comprehensive command-line interface for interacting with the VoiceRun API. This CLI tool provides easy access to manage agents, functions, environments, and authentication.
|
|
32
|
+
|
|
33
|
+
## Table of Contents
|
|
34
|
+
- [Prerequisites](#prerequisites)
|
|
35
|
+
- [Installation](#installation)
|
|
36
|
+
- [Install from PyPI](#install-from-pypi)
|
|
37
|
+
- [Install from Source](#install-from-source)
|
|
38
|
+
- [Development Setup](#development-setup)
|
|
39
|
+
- [Quick Start](#quick-start)
|
|
40
|
+
- [Authentication](#authentication)
|
|
41
|
+
- [Agent Management](#agent-management)
|
|
42
|
+
- [Agent Functions](#agent-functions)
|
|
43
|
+
- [Agent Environments](#agent-environments)
|
|
44
|
+
- [Features](#features)
|
|
45
|
+
- [Configuration](#configuration)
|
|
46
|
+
- [API Endpoints](#api-endpoints)
|
|
47
|
+
- [Requirements](#requirements)
|
|
48
|
+
- [Dependencies](#dependencies)
|
|
49
|
+
- [Support](#support)
|
|
50
|
+
- [CLI Output Conventions](#cli-output-conventions)
|
|
51
|
+
- [Developer Notes](#developer-notes)
|
|
52
|
+
- [Phone Number Management](#phone-number-management)
|
|
53
|
+
|
|
54
|
+
## Prerequisites
|
|
55
|
+
|
|
56
|
+
- Python 3.12+
|
|
57
|
+
- [uv](https://docs.astral.sh/uv/)
|
|
58
|
+
|
|
59
|
+
If you do not have a uv virtual environment, you can create one with:
|
|
60
|
+
```bash
|
|
61
|
+
uv venv --python 3.12
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Note:** We recommend using uv to install the package due to the incredible speed of the package manager. The package can still be installed via pip directly, but it will be slower.
|
|
65
|
+
|
|
66
|
+
Make sure you run below when you are on mac os
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install pyaudio
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Installation
|
|
73
|
+
|
|
74
|
+
### Install from PyPI
|
|
75
|
+
|
|
76
|
+
The easiest way to install voicerun-cli is from PyPI:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install primcli
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Install from Source
|
|
83
|
+
|
|
84
|
+
To install from source (for development or latest features):
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
uv pip install .
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Development Setup
|
|
91
|
+
|
|
92
|
+
### Environment
|
|
93
|
+
|
|
94
|
+
To switch target platform environment, update:
|
|
95
|
+
`vr_cli/tools/config.py` : `API_BASE_URL` + `FRONTEND_URL`
|
|
96
|
+
|
|
97
|
+
### Git Hooks
|
|
98
|
+
This project includes git hooks to ensure code quality. To set up the git hooks:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
python setup_hooks.py
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This will create a pre-commit hook that automatically runs black on Python files before each commit.
|
|
105
|
+
|
|
106
|
+
## Quick Start
|
|
107
|
+
|
|
108
|
+
1. **Sign in to your account:**
|
|
109
|
+
```bash
|
|
110
|
+
vr signin
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
2. **List your agents:**
|
|
114
|
+
```bash
|
|
115
|
+
vr list
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Authentication
|
|
119
|
+
|
|
120
|
+
### Sign In
|
|
121
|
+
```bash
|
|
122
|
+
vr signin
|
|
123
|
+
```
|
|
124
|
+
This command offers two authentication methods:
|
|
125
|
+
- **Direct authentication**: Enter email and password directly in the terminal
|
|
126
|
+
- **Web authentication**: Opens a browser to login through the VoiceRun website (recommended for enhanced security via Stytch)
|
|
127
|
+
|
|
128
|
+
When using web authentication, the CLI will open a login URL in your browser and poll for completion. Upon successful login, your session is securely stored locally.
|
|
129
|
+
|
|
130
|
+
### Sign Out
|
|
131
|
+
```bash
|
|
132
|
+
vr signout
|
|
133
|
+
```
|
|
134
|
+
Clears your authentication session and removes stored credentials.
|
|
135
|
+
|
|
136
|
+
## Agent Management
|
|
137
|
+
|
|
138
|
+
### List Agents
|
|
139
|
+
```bash
|
|
140
|
+
vr list [--all]
|
|
141
|
+
```
|
|
142
|
+
- `--all`: Show detailed information including creation dates and IDs
|
|
143
|
+
|
|
144
|
+
### Agent Information
|
|
145
|
+
```bash
|
|
146
|
+
vr info <agent_name_or_id>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Create Agent
|
|
150
|
+
```bash
|
|
151
|
+
vr create
|
|
152
|
+
```
|
|
153
|
+
Interactive command that prompts for:
|
|
154
|
+
- Agent name (required)
|
|
155
|
+
- Description (required)
|
|
156
|
+
- Default voice (by name or ID, required)
|
|
157
|
+
|
|
158
|
+
### Update Agent
|
|
159
|
+
```bash
|
|
160
|
+
vr update <agent_name_or_id>
|
|
161
|
+
```
|
|
162
|
+
Interactive command to modify agent properties.
|
|
163
|
+
|
|
164
|
+
### Delete Agent
|
|
165
|
+
```bash
|
|
166
|
+
vr delete <agent_name_or_id>
|
|
167
|
+
```
|
|
168
|
+
Deletes an agent after confirmation.
|
|
169
|
+
|
|
170
|
+
## Agent Functions
|
|
171
|
+
|
|
172
|
+
### List Functions
|
|
173
|
+
```bash
|
|
174
|
+
vr func list <agent_name_or_id>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Function Information
|
|
178
|
+
```bash
|
|
179
|
+
vr func info <agent_name_or_id> <function_name_or_id>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Create Function
|
|
183
|
+
```bash
|
|
184
|
+
vr func create <agent_name_or_id> --dir <directory_path>
|
|
185
|
+
```
|
|
186
|
+
Creates a new function from a directory. Supports multiple programming languages:
|
|
187
|
+
- Python (.py)
|
|
188
|
+
- JavaScript (.js)
|
|
189
|
+
- e.g. to create a new function with a display name: `vr func create <agent_name_or_id> --dir <directory_path> --display-name "v2"`
|
|
190
|
+
|
|
191
|
+
### Update Function
|
|
192
|
+
```bash
|
|
193
|
+
vr func update <agent_name_or_id> <function_name_or_id> [--dir <directory_path>]
|
|
194
|
+
```
|
|
195
|
+
- `--dir`: Path to the updated code directory
|
|
196
|
+
- Without `--dir`: Creates a temporary file for editing
|
|
197
|
+
- e.g. from URL: https://app.primvoices.com/agents/<agent_name_or_id>/function?f=<function_name_or_id>
|
|
198
|
+
|
|
199
|
+
### Delete Function
|
|
200
|
+
```bash
|
|
201
|
+
vr func delete <agent_name_or_id> <function_name_or_id>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Deploy Function
|
|
205
|
+
```bash
|
|
206
|
+
vr func deploy <agent_name_or_id> <function_name_or_id>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Debug Functions
|
|
210
|
+
|
|
211
|
+
**NEW**: Debug functions interactively using the command-line debugger, with support for phone and advanced audio features:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
vr func debug <agent_name_or_id> <function_name_or_id> [--env <environment_name_or_id>] [--phone]
|
|
215
|
+
```
|
|
216
|
+
- `--phone`: Start debugging via phone call (uses environment or user phone number)
|
|
217
|
+
|
|
218
|
+
#### Debugger Features
|
|
219
|
+
|
|
220
|
+
The CLI debugger provides the same functionality as the web UI debugger, plus:
|
|
221
|
+
|
|
222
|
+
- **Real-time WebSocket communication** with the agent
|
|
223
|
+
- **Send text messages** to the agent
|
|
224
|
+
- **View agent responses** including text-to-speech events
|
|
225
|
+
- **Monitor debug events** and logs
|
|
226
|
+
- **Track conversation turns** and performance
|
|
227
|
+
- **Start/stop microphone recording** (`listen`/`stop` commands)
|
|
228
|
+
- **Connect/disconnect phone number** (`phone` command)
|
|
229
|
+
- **Advanced audio system**: Echo cancellation, interruption detection, and dynamic echo alignment for seamless voice interaction
|
|
230
|
+
|
|
231
|
+
#### Debugger Commands
|
|
232
|
+
|
|
233
|
+
Once in the debugger, you can use these commands:
|
|
234
|
+
|
|
235
|
+
- `send <text>` - Send a text message to the agent
|
|
236
|
+
- `listen` - Start microphone recording (voice input)
|
|
237
|
+
- `stop` - Stop microphone recording
|
|
238
|
+
- `phone` - Connect or disconnect a phone number for call-based debugging
|
|
239
|
+
- `status` - Show connection status and debug summary
|
|
240
|
+
- `messages` - Show all debug messages
|
|
241
|
+
- `clear` - Clear debug messages
|
|
242
|
+
- `help` - Show available commands
|
|
243
|
+
- `quit` - Exit debugger
|
|
244
|
+
|
|
245
|
+
#### Prerequisites
|
|
246
|
+
|
|
247
|
+
Before using the debugger, make sure:
|
|
248
|
+
|
|
249
|
+
1. **VoiceRun Agent Server** is running on `localhost:7860`
|
|
250
|
+
```bash
|
|
251
|
+
# In the primvoices-agents directory
|
|
252
|
+
python src/main.py
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
2. **WebSocket dependency** is installed:
|
|
256
|
+
```bash
|
|
257
|
+
pip install websockets
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
3. **Agent and function** exist and are properly configured
|
|
261
|
+
|
|
262
|
+
#### Example Debug Session
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
$ vr func debug my-agent my-function
|
|
266
|
+
|
|
267
|
+
Starting debugger for agent: my-agent, function: my-function
|
|
268
|
+
|
|
269
|
+
Debug Configuration:
|
|
270
|
+
Agent: My Agent (agent-123)
|
|
271
|
+
Function: My Function (func-456)
|
|
272
|
+
Environment: Development (env-789)
|
|
273
|
+
Language: python
|
|
274
|
+
|
|
275
|
+
Starting interactive debugger...
|
|
276
|
+
Connecting to WebSocket server at ws://localhost:7860/ws
|
|
277
|
+
✓ Connected to ws://localhost:7860/ws
|
|
278
|
+
|
|
279
|
+
VoiceRun CLI Debugger
|
|
280
|
+
Type 'help' for available commands, 'quit' to exit
|
|
281
|
+
|
|
282
|
+
debug> send Hello, how are you?
|
|
283
|
+
→ Sent: Hello, how are you?
|
|
284
|
+
🤖 Agent (nova): Hello! I'm doing well, thank you for asking. How can I help you today?
|
|
285
|
+
|
|
286
|
+
debug> status
|
|
287
|
+
|
|
288
|
+
Debug Summary:
|
|
289
|
+
Total messages: 3
|
|
290
|
+
Current turn: 1
|
|
291
|
+
Connection: Connected
|
|
292
|
+
Listening: No
|
|
293
|
+
|
|
294
|
+
Recent Messages:
|
|
295
|
+
text (input)
|
|
296
|
+
text_to_speech (output)
|
|
297
|
+
turn_end (system)
|
|
298
|
+
|
|
299
|
+
debug> quit
|
|
300
|
+
Disconnected
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Agent Environments
|
|
304
|
+
|
|
305
|
+
### List Environments
|
|
306
|
+
```bash
|
|
307
|
+
vr env list <agent_name_or_id>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Environment Information
|
|
311
|
+
```bash
|
|
312
|
+
vr env info <agent_name_or_id> <environment_name_or_id>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Create Environment
|
|
316
|
+
```bash
|
|
317
|
+
vr env create <agent_name_or_id>
|
|
318
|
+
```
|
|
319
|
+
Interactive command that prompts for:
|
|
320
|
+
- Environment name (required)
|
|
321
|
+
- Phone number (optional)
|
|
322
|
+
- Recording settings
|
|
323
|
+
- Redaction settings
|
|
324
|
+
- STT language (English or Multi-lingual)
|
|
325
|
+
- STT keywords (optional)
|
|
326
|
+
- Function deployment (optional)
|
|
327
|
+
- Environment variables (names required, values optional)
|
|
328
|
+
|
|
329
|
+
If you choose to add a phone number, the CLI will guide you through associating a number with the environment. This enables phone-based debugging and agent interaction.
|
|
330
|
+
|
|
331
|
+
### Update Environment
|
|
332
|
+
```bash
|
|
333
|
+
vr env update <agent_name_or_id> <environment_name_or_id>
|
|
334
|
+
```
|
|
335
|
+
Interactive command to modify environment properties and variables.
|
|
336
|
+
|
|
337
|
+
### Delete Environment
|
|
338
|
+
```bash
|
|
339
|
+
vr env delete <agent_name_or_id> <environment_name_or_id>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Deploy to Environment
|
|
343
|
+
```bash
|
|
344
|
+
vr env deploy <agent_name_or_id> <environment_name_or_id>
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Debug Functions
|
|
348
|
+
|
|
349
|
+
**NEW**: Debug functions interactively using the command-line debugger:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
vr env debug <agent_name_or_id> <environment_name_or_id>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
#### Debugger Features
|
|
356
|
+
|
|
357
|
+
The CLI debugger provides the same functionality as the web UI debugger:
|
|
358
|
+
|
|
359
|
+
- **WebSocket Communication**: Real-time bidirectional communication with VoiceRun agents
|
|
360
|
+
- **Audio Processing**: Capture microphone input and play agent responses
|
|
361
|
+
- **Text Messaging**: Send text messages to agents
|
|
362
|
+
- **Debug Monitoring**: Real-time display of debug messages and conversation turns
|
|
363
|
+
- **Audio Statistics**: Monitor audio levels and speech detection
|
|
364
|
+
- **Session Management**: Automatic session ID generation and management
|
|
365
|
+
- **Configuration**: Environment-based configuration with custom parameters
|
|
366
|
+
- **Phone Integration**: Connect to a phone number for call-based debugging and agent interaction
|
|
367
|
+
|
|
368
|
+
#### Debugger Commands
|
|
369
|
+
|
|
370
|
+
Once in the debugger, you can use these commands:
|
|
371
|
+
|
|
372
|
+
- `help` - Show help information
|
|
373
|
+
- `status` - Show connection status
|
|
374
|
+
- `config` - Show running agent, environment, and function
|
|
375
|
+
- `messages` - Show recent debug messages
|
|
376
|
+
- `debug <ID>` - Show detailed debugging info for a specific message
|
|
377
|
+
- `clear` - Clear message history
|
|
378
|
+
- `quit`, `exit`, `q`, or `x` - Exit debugger
|
|
379
|
+
- `send <text>` - Send a text message to an agent (also runs when typing any text that's not a command)
|
|
380
|
+
- `listen` - Start microphone recording
|
|
381
|
+
- `stop` - Stop microphone recording
|
|
382
|
+
- `phone` - Connect or disconnect a phone number
|
|
383
|
+
|
|
384
|
+
#### Example Debug Session
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
$ vr env debug my-agent my-environment
|
|
388
|
+
|
|
389
|
+
Debugging function 'my-agent' in environment 'my-environment'
|
|
390
|
+
VoiceRun Debugger
|
|
391
|
+
Type 'help' for available commands, or 'quit' to exit
|
|
392
|
+
⠼ Connected!
|
|
393
|
+
|
|
394
|
+
start (turn 0)
|
|
395
|
+
|
|
396
|
+
Agent: Hello from your agent
|
|
397
|
+
|
|
398
|
+
turn_end (turn 0)
|
|
399
|
+
|
|
400
|
+
debugger> Hello!
|
|
401
|
+
Sent: Hello!
|
|
402
|
+
|
|
403
|
+
You: Hello!
|
|
404
|
+
|
|
405
|
+
Agent: Agent heard hello!
|
|
406
|
+
|
|
407
|
+
turn_end (turn 1)
|
|
408
|
+
|
|
409
|
+
debugger> config
|
|
410
|
+
Agent: my-agent
|
|
411
|
+
Agent ID: agent-123
|
|
412
|
+
Environment: my-environment
|
|
413
|
+
Environment ID: environment-456
|
|
414
|
+
Function: my-function
|
|
415
|
+
Function ID: function-789
|
|
416
|
+
|
|
417
|
+
debugger> quit
|
|
418
|
+
Goodbye!
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## Features
|
|
422
|
+
|
|
423
|
+
### Rich Terminal Output
|
|
424
|
+
- Color-coded tables and information displays
|
|
425
|
+
- Formatted dates and timestamps
|
|
426
|
+
- Clear status indicators (Yes/No, On/Off)
|
|
427
|
+
|
|
428
|
+
### Secure Authentication
|
|
429
|
+
- Session cookie management
|
|
430
|
+
- Secure credential storage
|
|
431
|
+
- Direct or web-based authentication using Stytch
|
|
432
|
+
|
|
433
|
+
### File Management
|
|
434
|
+
- Automatic language detection from file extensions
|
|
435
|
+
- Temporary file creation for code editing
|
|
436
|
+
- Support for multiple programming languages
|
|
437
|
+
|
|
438
|
+
### Interactive Prompts
|
|
439
|
+
- Confirmation dialogs for destructive operations
|
|
440
|
+
- Default value suggestions
|
|
441
|
+
- Clear error messages and help text
|
|
442
|
+
- **All prompts require non-empty input by default unless otherwise specified.**
|
|
443
|
+
- To allow empty input, the `validation` parameter can be set to `None` in the prompt utility.
|
|
444
|
+
- All prompts and confirmations use single quotes around referenced names/IDs and enforce clear, imperative language.
|
|
445
|
+
|
|
446
|
+
### Advanced Audio System
|
|
447
|
+
- Real-time microphone capture and playback with PyAudio and pygame
|
|
448
|
+
- **Echo cancellation**: Removes agent output from mic input to prevent feedback
|
|
449
|
+
- **Interruption detection**: Detects when a human interrupts agent speech and stops playback for immediate response
|
|
450
|
+
- **Dynamic echo alignment**: Automatically calibrates echo delay for robust interruption detection
|
|
451
|
+
- **Hysteresis**: Prevents false stops during brief pauses in conversation
|
|
452
|
+
- All audio features are available in the debugger and during phone-based sessions
|
|
453
|
+
|
|
454
|
+
### Phone Number Management
|
|
455
|
+
|
|
456
|
+
#### User Phone Number
|
|
457
|
+
|
|
458
|
+
Manage your user phone number for call-based agent interaction:
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
vr phone
|
|
462
|
+
```
|
|
463
|
+
- View your current phone number
|
|
464
|
+
- Add a new phone number if none is set
|
|
465
|
+
|
|
466
|
+
#### Environment Phone Number
|
|
467
|
+
|
|
468
|
+
When creating or updating an environment, you can associate a phone number for inbound/outbound calls. This enables phone-based debugging and agent interaction.
|
|
469
|
+
|
|
470
|
+
- Add a phone number during `vr env create` or `vr env update`
|
|
471
|
+
- Use the `phone` command in the debugger to connect/disconnect calls
|
|
472
|
+
|
|
473
|
+
## Configuration
|
|
474
|
+
|
|
475
|
+
The CLI automatically manages configuration in your home directory:
|
|
476
|
+
- Authentication cookies: `~/.voicerun_cookie`
|
|
477
|
+
- Session management and API endpoints
|
|
478
|
+
|
|
479
|
+
## API Endpoints
|
|
480
|
+
|
|
481
|
+
- **API Base URL**: `https://api.primvoices.com`
|
|
482
|
+
- **Frontend URL**: `https://app.primvoices.com`
|
|
483
|
+
|
|
484
|
+
## Requirements
|
|
485
|
+
|
|
486
|
+
- Python 3.7 or higher
|
|
487
|
+
- Internet connection for API access
|
|
488
|
+
|
|
489
|
+
## Dependencies
|
|
490
|
+
|
|
491
|
+
- `typer`: Command-line interface framework
|
|
492
|
+
- `requests`: HTTP client for API communication
|
|
493
|
+
- `rich`: Rich terminal output formatting
|
|
494
|
+
|
|
495
|
+
## CLI Output Conventions
|
|
496
|
+
|
|
497
|
+
The VoiceRun CLI uses consistent output conventions for all commands to ensure clarity and a professional user experience. These conventions are enforced throughout the codebase:
|
|
498
|
+
|
|
499
|
+
- **Success messages:**
|
|
500
|
+
- Printed in **bold green** using Rich.
|
|
501
|
+
- Use `print_success()` utility.
|
|
502
|
+
- Example: `[bold green]Agent created successfully![/bold green]`
|
|
503
|
+
|
|
504
|
+
- **Warning messages:**
|
|
505
|
+
- Printed in **bold yellow** with a `Warning:` prefix using Rich.
|
|
506
|
+
- Use `print_warning()` utility.
|
|
507
|
+
- Example: `[bold yellow]Warning: No Set-Cookie header received[/bold yellow]`
|
|
508
|
+
|
|
509
|
+
- **Error messages:**
|
|
510
|
+
- Printed in **bold red** with an `Error:` prefix using Rich.
|
|
511
|
+
- Use `print_error()` utility.
|
|
512
|
+
- Example: `[bold red]Error: Unauthorized. Please sign in with vr signin.[/bold red]`
|
|
513
|
+
|
|
514
|
+
- **IDs:**
|
|
515
|
+
- Always styled as **blue** in output: `[blue]{id}[/blue]`
|
|
516
|
+
- Applies to all user-facing output, including tables and error messages.
|
|
517
|
+
|
|
518
|
+
- **File paths and URLs:**
|
|
519
|
+
- Always styled as **cyan** in output: `[cyan]{path_or_url}[/cyan]`
|
|
520
|
+
- Applies to all user-facing output, including error/warning messages and informational output.
|
|
521
|
+
|
|
522
|
+
- **Tables and formatted output:**
|
|
523
|
+
- The CLI uses the [Rich](https://rich.readthedocs.io/) library for all tables and styled output.
|
|
524
|
+
- Table headers use the color defined in `TITLE_COLOR` in `utils/config.py`.
|
|
525
|
+
|
|
526
|
+
- **Prompts and Confirmations:**
|
|
527
|
+
- All interactive prompts use the `prompt` and `confirm` utilities from `vr_cli/utils/utils.py`.
|
|
528
|
+
- Prompts require non-empty input by default. To allow empty input, pass `validation=None`.
|
|
529
|
+
- Prompts and confirmations use single quotes for referenced names/IDs and clear, imperative language.
|
|
530
|
+
|
|
531
|
+
**Note:**
|
|
532
|
+
- All output and prompt utilities are defined in `vr_cli/utils/utils.py`.
|
|
533
|
+
- Please follow these conventions for any new commands or output added to the CLI.
|
|
534
|
+
|
|
535
|
+
## Developer Notes
|
|
536
|
+
|
|
537
|
+
### Adding New Commands
|
|
538
|
+
- Use Typer's `@app.command` decorator for new commands.
|
|
539
|
+
- Use the `prompt` and `confirm` utilities for all user input. By default, prompts require non-empty input. For optional input, set `validation=None`.
|
|
540
|
+
- Always use single quotes around referenced names/IDs in prompts and confirmations.
|
|
541
|
+
- Use the output utilities (`print_success`, `print_error`, `print_warning`, `print_info`) for all user-facing output.
|
|
542
|
+
- Style IDs as blue and file paths as cyan using Rich markup.
|
|
543
|
+
- Table headers should use the color defined in `TITLE_COLOR` in `utils/config.py`.
|
|
544
|
+
|
|
545
|
+
### Testing Agents
|
|
546
|
+
|
|
547
|
+
**NEW**: Test your agents interactively using text input:
|
|
548
|
+
|
|
549
|
+
```bash
|
|
550
|
+
vr env run <agent_name_or_id> <environment_name_or_id>
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
This command starts an interactive session where you can:
|
|
554
|
+
- Send text messages to your agent
|
|
555
|
+
- See real-time responses from your agent function
|
|
556
|
+
- View conversation history
|
|
557
|
+
- Use built-in commands like `help`, `status`, `clear`, `history`
|
|
558
|
+
|
|
559
|
+
#### Requirements for Real Agent Testing
|
|
560
|
+
|
|
561
|
+
To test with real agent responses (not simulated), you need:
|
|
562
|
+
|
|
563
|
+
1. **API Key**: Set the `PRIMVOICES_API_KEY` environment variable
|
|
564
|
+
2. **PrimVoices Agents**: The `primvoices-agents` project must be available in the same directory
|
|
565
|
+
3. **Deployed Function**: A function must be deployed to the environment you're testing
|
|
566
|
+
|
|
567
|
+
#### Example Session
|
|
568
|
+
|
|
569
|
+
```
|
|
570
|
+
$ vr env run my-agent development
|
|
571
|
+
|
|
572
|
+
Starting interactive session for agent 'my-agent' in environment 'development'
|
|
573
|
+
Type your messages and press Enter. Type 'quit' or 'exit' to end the session.
|
|
574
|
+
Type 'help' for available commands.
|
|
575
|
+
|
|
576
|
+
Agent function loaded successfully!
|
|
577
|
+
You can now interact with your agent using text messages.
|
|
578
|
+
|
|
579
|
+
You: Hello, how are you?
|
|
580
|
+
Agent: Hello! I'm doing well, thank you for asking. How can I help you today?
|
|
581
|
+
|
|
582
|
+
You: What's the weather like?
|
|
583
|
+
Agent: I don't have access to real-time weather information, but I can help you with other questions or tasks. What would you like to know?
|
|
584
|
+
|
|
585
|
+
You: help
|
|
586
|
+
┌─ Help ──────────────────────────────────────────────────────────────────────┐
|
|
587
|
+
│ Available commands: │
|
|
588
|
+
│ - help: Show this help message │
|
|
589
|
+
│ - quit/exit: End the session │
|
|
590
|
+
│ - clear: Clear the conversation history │
|
|
591
|
+
│ - history: Show conversation history │
|
|
592
|
+
│ - status: Show current session status │
|
|
593
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
594
|
+
|
|
595
|
+
You: quit
|
|
596
|
+
Ending session...
|
|
597
|
+
Session ended. Total messages: 4
|
|
598
|
+
```
|