agent-cli 0.70.5__py3-none-any.whl
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.
- agent_cli/__init__.py +5 -0
- agent_cli/__main__.py +6 -0
- agent_cli/_extras.json +14 -0
- agent_cli/_requirements/.gitkeep +0 -0
- agent_cli/_requirements/audio.txt +79 -0
- agent_cli/_requirements/faster-whisper.txt +215 -0
- agent_cli/_requirements/kokoro.txt +425 -0
- agent_cli/_requirements/llm.txt +183 -0
- agent_cli/_requirements/memory.txt +355 -0
- agent_cli/_requirements/mlx-whisper.txt +222 -0
- agent_cli/_requirements/piper.txt +176 -0
- agent_cli/_requirements/rag.txt +402 -0
- agent_cli/_requirements/server.txt +154 -0
- agent_cli/_requirements/speed.txt +77 -0
- agent_cli/_requirements/vad.txt +155 -0
- agent_cli/_requirements/wyoming.txt +71 -0
- agent_cli/_tools.py +368 -0
- agent_cli/agents/__init__.py +23 -0
- agent_cli/agents/_voice_agent_common.py +136 -0
- agent_cli/agents/assistant.py +383 -0
- agent_cli/agents/autocorrect.py +284 -0
- agent_cli/agents/chat.py +496 -0
- agent_cli/agents/memory/__init__.py +31 -0
- agent_cli/agents/memory/add.py +190 -0
- agent_cli/agents/memory/proxy.py +160 -0
- agent_cli/agents/rag_proxy.py +128 -0
- agent_cli/agents/speak.py +209 -0
- agent_cli/agents/transcribe.py +671 -0
- agent_cli/agents/transcribe_daemon.py +499 -0
- agent_cli/agents/voice_edit.py +291 -0
- agent_cli/api.py +22 -0
- agent_cli/cli.py +106 -0
- agent_cli/config.py +503 -0
- agent_cli/config_cmd.py +307 -0
- agent_cli/constants.py +27 -0
- agent_cli/core/__init__.py +1 -0
- agent_cli/core/audio.py +461 -0
- agent_cli/core/audio_format.py +299 -0
- agent_cli/core/chroma.py +88 -0
- agent_cli/core/deps.py +191 -0
- agent_cli/core/openai_proxy.py +139 -0
- agent_cli/core/process.py +195 -0
- agent_cli/core/reranker.py +120 -0
- agent_cli/core/sse.py +87 -0
- agent_cli/core/transcription_logger.py +70 -0
- agent_cli/core/utils.py +526 -0
- agent_cli/core/vad.py +175 -0
- agent_cli/core/watch.py +65 -0
- agent_cli/dev/__init__.py +14 -0
- agent_cli/dev/cli.py +1588 -0
- agent_cli/dev/coding_agents/__init__.py +19 -0
- agent_cli/dev/coding_agents/aider.py +24 -0
- agent_cli/dev/coding_agents/base.py +167 -0
- agent_cli/dev/coding_agents/claude.py +39 -0
- agent_cli/dev/coding_agents/codex.py +24 -0
- agent_cli/dev/coding_agents/continue_dev.py +15 -0
- agent_cli/dev/coding_agents/copilot.py +24 -0
- agent_cli/dev/coding_agents/cursor_agent.py +48 -0
- agent_cli/dev/coding_agents/gemini.py +28 -0
- agent_cli/dev/coding_agents/opencode.py +15 -0
- agent_cli/dev/coding_agents/registry.py +49 -0
- agent_cli/dev/editors/__init__.py +19 -0
- agent_cli/dev/editors/base.py +89 -0
- agent_cli/dev/editors/cursor.py +15 -0
- agent_cli/dev/editors/emacs.py +46 -0
- agent_cli/dev/editors/jetbrains.py +56 -0
- agent_cli/dev/editors/nano.py +31 -0
- agent_cli/dev/editors/neovim.py +33 -0
- agent_cli/dev/editors/registry.py +59 -0
- agent_cli/dev/editors/sublime.py +20 -0
- agent_cli/dev/editors/vim.py +42 -0
- agent_cli/dev/editors/vscode.py +15 -0
- agent_cli/dev/editors/zed.py +20 -0
- agent_cli/dev/project.py +568 -0
- agent_cli/dev/registry.py +52 -0
- agent_cli/dev/skill/SKILL.md +141 -0
- agent_cli/dev/skill/examples.md +571 -0
- agent_cli/dev/terminals/__init__.py +19 -0
- agent_cli/dev/terminals/apple_terminal.py +82 -0
- agent_cli/dev/terminals/base.py +56 -0
- agent_cli/dev/terminals/gnome.py +51 -0
- agent_cli/dev/terminals/iterm2.py +84 -0
- agent_cli/dev/terminals/kitty.py +77 -0
- agent_cli/dev/terminals/registry.py +48 -0
- agent_cli/dev/terminals/tmux.py +58 -0
- agent_cli/dev/terminals/warp.py +132 -0
- agent_cli/dev/terminals/zellij.py +78 -0
- agent_cli/dev/worktree.py +856 -0
- agent_cli/docs_gen.py +417 -0
- agent_cli/example-config.toml +185 -0
- agent_cli/install/__init__.py +5 -0
- agent_cli/install/common.py +89 -0
- agent_cli/install/extras.py +174 -0
- agent_cli/install/hotkeys.py +48 -0
- agent_cli/install/services.py +87 -0
- agent_cli/memory/__init__.py +7 -0
- agent_cli/memory/_files.py +250 -0
- agent_cli/memory/_filters.py +63 -0
- agent_cli/memory/_git.py +157 -0
- agent_cli/memory/_indexer.py +142 -0
- agent_cli/memory/_ingest.py +408 -0
- agent_cli/memory/_persistence.py +182 -0
- agent_cli/memory/_prompt.py +91 -0
- agent_cli/memory/_retrieval.py +294 -0
- agent_cli/memory/_store.py +169 -0
- agent_cli/memory/_streaming.py +44 -0
- agent_cli/memory/_tasks.py +48 -0
- agent_cli/memory/api.py +113 -0
- agent_cli/memory/client.py +272 -0
- agent_cli/memory/engine.py +361 -0
- agent_cli/memory/entities.py +43 -0
- agent_cli/memory/models.py +112 -0
- agent_cli/opts.py +433 -0
- agent_cli/py.typed +0 -0
- agent_cli/rag/__init__.py +3 -0
- agent_cli/rag/_indexer.py +67 -0
- agent_cli/rag/_indexing.py +226 -0
- agent_cli/rag/_prompt.py +30 -0
- agent_cli/rag/_retriever.py +156 -0
- agent_cli/rag/_store.py +48 -0
- agent_cli/rag/_utils.py +218 -0
- agent_cli/rag/api.py +175 -0
- agent_cli/rag/client.py +299 -0
- agent_cli/rag/engine.py +302 -0
- agent_cli/rag/models.py +55 -0
- agent_cli/scripts/.runtime/.gitkeep +0 -0
- agent_cli/scripts/__init__.py +1 -0
- agent_cli/scripts/check_plugin_skill_sync.py +50 -0
- agent_cli/scripts/linux-hotkeys/README.md +63 -0
- agent_cli/scripts/linux-hotkeys/toggle-autocorrect.sh +45 -0
- agent_cli/scripts/linux-hotkeys/toggle-transcription.sh +58 -0
- agent_cli/scripts/linux-hotkeys/toggle-voice-edit.sh +58 -0
- agent_cli/scripts/macos-hotkeys/README.md +45 -0
- agent_cli/scripts/macos-hotkeys/skhd-config-example +5 -0
- agent_cli/scripts/macos-hotkeys/toggle-autocorrect.sh +12 -0
- agent_cli/scripts/macos-hotkeys/toggle-transcription.sh +37 -0
- agent_cli/scripts/macos-hotkeys/toggle-voice-edit.sh +37 -0
- agent_cli/scripts/nvidia-asr-server/README.md +99 -0
- agent_cli/scripts/nvidia-asr-server/pyproject.toml +27 -0
- agent_cli/scripts/nvidia-asr-server/server.py +255 -0
- agent_cli/scripts/nvidia-asr-server/shell.nix +32 -0
- agent_cli/scripts/nvidia-asr-server/uv.lock +4654 -0
- agent_cli/scripts/run-openwakeword.sh +11 -0
- agent_cli/scripts/run-piper-windows.ps1 +30 -0
- agent_cli/scripts/run-piper.sh +24 -0
- agent_cli/scripts/run-whisper-linux.sh +40 -0
- agent_cli/scripts/run-whisper-macos.sh +6 -0
- agent_cli/scripts/run-whisper-windows.ps1 +51 -0
- agent_cli/scripts/run-whisper.sh +9 -0
- agent_cli/scripts/run_faster_whisper_server.py +136 -0
- agent_cli/scripts/setup-linux-hotkeys.sh +72 -0
- agent_cli/scripts/setup-linux.sh +108 -0
- agent_cli/scripts/setup-macos-hotkeys.sh +61 -0
- agent_cli/scripts/setup-macos.sh +76 -0
- agent_cli/scripts/setup-windows.ps1 +63 -0
- agent_cli/scripts/start-all-services-windows.ps1 +53 -0
- agent_cli/scripts/start-all-services.sh +178 -0
- agent_cli/scripts/sync_extras.py +138 -0
- agent_cli/server/__init__.py +3 -0
- agent_cli/server/cli.py +721 -0
- agent_cli/server/common.py +222 -0
- agent_cli/server/model_manager.py +288 -0
- agent_cli/server/model_registry.py +225 -0
- agent_cli/server/proxy/__init__.py +3 -0
- agent_cli/server/proxy/api.py +444 -0
- agent_cli/server/streaming.py +67 -0
- agent_cli/server/tts/__init__.py +3 -0
- agent_cli/server/tts/api.py +335 -0
- agent_cli/server/tts/backends/__init__.py +82 -0
- agent_cli/server/tts/backends/base.py +139 -0
- agent_cli/server/tts/backends/kokoro.py +403 -0
- agent_cli/server/tts/backends/piper.py +253 -0
- agent_cli/server/tts/model_manager.py +201 -0
- agent_cli/server/tts/model_registry.py +28 -0
- agent_cli/server/tts/wyoming_handler.py +249 -0
- agent_cli/server/whisper/__init__.py +3 -0
- agent_cli/server/whisper/api.py +413 -0
- agent_cli/server/whisper/backends/__init__.py +89 -0
- agent_cli/server/whisper/backends/base.py +97 -0
- agent_cli/server/whisper/backends/faster_whisper.py +225 -0
- agent_cli/server/whisper/backends/mlx.py +270 -0
- agent_cli/server/whisper/languages.py +116 -0
- agent_cli/server/whisper/model_manager.py +157 -0
- agent_cli/server/whisper/model_registry.py +28 -0
- agent_cli/server/whisper/wyoming_handler.py +203 -0
- agent_cli/services/__init__.py +343 -0
- agent_cli/services/_wyoming_utils.py +64 -0
- agent_cli/services/asr.py +506 -0
- agent_cli/services/llm.py +228 -0
- agent_cli/services/tts.py +450 -0
- agent_cli/services/wake_word.py +142 -0
- agent_cli-0.70.5.dist-info/METADATA +2118 -0
- agent_cli-0.70.5.dist-info/RECORD +196 -0
- agent_cli-0.70.5.dist-info/WHEEL +4 -0
- agent_cli-0.70.5.dist-info/entry_points.txt +4 -0
- agent_cli-0.70.5.dist-info/licenses/LICENSE +21 -0
agent_cli/config_cmd.py
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"""Configuration management commands for agent-cli."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import platform
|
|
8
|
+
import shlex
|
|
9
|
+
import shutil
|
|
10
|
+
import subprocess
|
|
11
|
+
from importlib import resources
|
|
12
|
+
from pathlib import Path # noqa: TC003
|
|
13
|
+
|
|
14
|
+
import typer
|
|
15
|
+
|
|
16
|
+
from agent_cli.cli import app
|
|
17
|
+
from agent_cli.config import CONFIG_PATHS, USER_CONFIG_PATH, _config_path
|
|
18
|
+
from agent_cli.core.process import set_process_title
|
|
19
|
+
from agent_cli.core.utils import console
|
|
20
|
+
|
|
21
|
+
config_app = typer.Typer(
|
|
22
|
+
name="config",
|
|
23
|
+
help="Manage agent-cli configuration files.",
|
|
24
|
+
add_completion=True,
|
|
25
|
+
rich_markup_mode="markdown",
|
|
26
|
+
no_args_is_help=True,
|
|
27
|
+
)
|
|
28
|
+
app.add_typer(config_app, name="config", rich_help_panel="Configuration")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@config_app.callback()
|
|
32
|
+
def config_callback(ctx: typer.Context) -> None:
|
|
33
|
+
"""Config command group callback."""
|
|
34
|
+
if ctx.invoked_subcommand is not None:
|
|
35
|
+
set_process_title(f"config-{ctx.invoked_subcommand}")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# --- Config command options ---
|
|
39
|
+
CONFIG_PATH_OPTION: Path | None = typer.Option(
|
|
40
|
+
None,
|
|
41
|
+
"--path",
|
|
42
|
+
"-p",
|
|
43
|
+
help="Path to config file. Uses auto-detection if not specified.",
|
|
44
|
+
)
|
|
45
|
+
CONFIG_PATH_INIT_OPTION: Path | None = typer.Option(
|
|
46
|
+
None,
|
|
47
|
+
"--path",
|
|
48
|
+
"-p",
|
|
49
|
+
help="Custom path for config file. Default: ~/.config/agent-cli/config.toml",
|
|
50
|
+
)
|
|
51
|
+
FORCE_OPTION: bool = typer.Option(
|
|
52
|
+
False, # noqa: FBT003
|
|
53
|
+
"--force",
|
|
54
|
+
"-f",
|
|
55
|
+
help="Overwrite existing config without confirmation.",
|
|
56
|
+
)
|
|
57
|
+
RAW_OPTION: bool = typer.Option(
|
|
58
|
+
False, # noqa: FBT003
|
|
59
|
+
"--raw",
|
|
60
|
+
"-r",
|
|
61
|
+
help="Output raw file contents (for copy-paste).",
|
|
62
|
+
)
|
|
63
|
+
JSON_OPTION: bool = typer.Option(
|
|
64
|
+
False, # noqa: FBT003
|
|
65
|
+
"--json",
|
|
66
|
+
help="Output as JSON for automation.",
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _get_editor() -> str:
|
|
71
|
+
"""Get the user's preferred editor.
|
|
72
|
+
|
|
73
|
+
Checks $EDITOR, then $VISUAL, then falls back to platform defaults.
|
|
74
|
+
"""
|
|
75
|
+
for env_var in ("EDITOR", "VISUAL"):
|
|
76
|
+
editor = os.environ.get(env_var)
|
|
77
|
+
if editor:
|
|
78
|
+
return editor
|
|
79
|
+
|
|
80
|
+
if platform.system() == "Windows":
|
|
81
|
+
return "notepad"
|
|
82
|
+
|
|
83
|
+
# Try common editors on Unix-like systems
|
|
84
|
+
for editor in ("nano", "vim", "vi"):
|
|
85
|
+
if shutil.which(editor):
|
|
86
|
+
return editor
|
|
87
|
+
|
|
88
|
+
return "vi"
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _generate_template() -> str:
|
|
92
|
+
"""Generate a config template with all options commented out."""
|
|
93
|
+
header = """\
|
|
94
|
+
# agent-cli configuration file
|
|
95
|
+
# Generated by: agent-cli config init
|
|
96
|
+
#
|
|
97
|
+
# Uncomment and modify options as needed.
|
|
98
|
+
# Keys use dashes to match command-line arguments.
|
|
99
|
+
# Any option here can be overridden by a command-line argument.
|
|
100
|
+
#
|
|
101
|
+
# For full documentation, see: https://github.com/basnijholt/agent-cli
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
# Example config is bundled with the package
|
|
105
|
+
try:
|
|
106
|
+
template_file = resources.files(__package__) / "example-config.toml"
|
|
107
|
+
example_content = template_file.read_text(encoding="utf-8")
|
|
108
|
+
except FileNotFoundError as e:
|
|
109
|
+
console.print("[red]Example config template is missing from the package.[/red]")
|
|
110
|
+
console.print("Reinstall agent-cli or report this issue.")
|
|
111
|
+
raise typer.Exit(1) from e
|
|
112
|
+
|
|
113
|
+
lines = [header.rstrip()]
|
|
114
|
+
skip_header = True # Skip the original file's header comments
|
|
115
|
+
|
|
116
|
+
for line in example_content.splitlines():
|
|
117
|
+
stripped = line.strip()
|
|
118
|
+
|
|
119
|
+
# Skip the original header comments (lines before first section)
|
|
120
|
+
if skip_header:
|
|
121
|
+
if stripped.startswith("["):
|
|
122
|
+
skip_header = False
|
|
123
|
+
else:
|
|
124
|
+
continue
|
|
125
|
+
|
|
126
|
+
# Keep section headers [defaults], [chat], etc.
|
|
127
|
+
if (
|
|
128
|
+
(stripped.startswith("[") and stripped.endswith("]"))
|
|
129
|
+
or stripped.startswith("#")
|
|
130
|
+
or not stripped
|
|
131
|
+
):
|
|
132
|
+
lines.append(line)
|
|
133
|
+
# Comment out actual config values
|
|
134
|
+
else:
|
|
135
|
+
lines.append(f"# {line}")
|
|
136
|
+
|
|
137
|
+
return "\n".join(lines) + "\n"
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _get_config_file(path: Path | None) -> Path | None:
|
|
141
|
+
"""Resolve config path, or auto-detect from standard locations."""
|
|
142
|
+
if path:
|
|
143
|
+
return path.expanduser().resolve()
|
|
144
|
+
return _config_path(None)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@config_app.command("init")
|
|
148
|
+
def config_init(
|
|
149
|
+
path: Path | None = CONFIG_PATH_INIT_OPTION,
|
|
150
|
+
force: bool = FORCE_OPTION,
|
|
151
|
+
) -> None:
|
|
152
|
+
"""Create a new config file with all options commented out.
|
|
153
|
+
|
|
154
|
+
The generated config file serves as a template showing all available
|
|
155
|
+
options. Uncomment and modify the options you want to customize.
|
|
156
|
+
"""
|
|
157
|
+
target_path = _get_config_file(path) or USER_CONFIG_PATH
|
|
158
|
+
|
|
159
|
+
if target_path.exists() and not force:
|
|
160
|
+
console.print(
|
|
161
|
+
f"[bold yellow]Config file already exists at:[/bold yellow] [cyan]{target_path}[/cyan]",
|
|
162
|
+
)
|
|
163
|
+
if not typer.confirm("Overwrite existing config file?"):
|
|
164
|
+
console.print("[dim]Aborted.[/dim]")
|
|
165
|
+
raise typer.Exit(0)
|
|
166
|
+
|
|
167
|
+
# Create parent directories
|
|
168
|
+
target_path.parent.mkdir(parents=True, exist_ok=True)
|
|
169
|
+
|
|
170
|
+
# Generate and write template
|
|
171
|
+
template_content = _generate_template()
|
|
172
|
+
target_path.write_text(template_content, encoding="utf-8")
|
|
173
|
+
|
|
174
|
+
console.print(f"[green]Config file created at:[/green] {target_path}")
|
|
175
|
+
console.print("\n[dim]Edit the file to customize your settings:[/dim]")
|
|
176
|
+
console.print(" [cyan]agent-cli config edit[/cyan]")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
@config_app.command("edit")
|
|
180
|
+
def config_edit(
|
|
181
|
+
path: Path | None = CONFIG_PATH_OPTION,
|
|
182
|
+
) -> None:
|
|
183
|
+
"""Open the config file in your default editor.
|
|
184
|
+
|
|
185
|
+
The editor is determined by: $EDITOR > $VISUAL > platform default.
|
|
186
|
+
"""
|
|
187
|
+
config_file = _get_config_file(path)
|
|
188
|
+
|
|
189
|
+
if config_file is None:
|
|
190
|
+
console.print("[yellow]No config file found.[/yellow]")
|
|
191
|
+
console.print(
|
|
192
|
+
"\nRun [bold cyan]agent-cli config init[/bold cyan] to create one.",
|
|
193
|
+
)
|
|
194
|
+
console.print("\nSearched locations:")
|
|
195
|
+
for p in CONFIG_PATHS:
|
|
196
|
+
console.print(f" - {p}")
|
|
197
|
+
raise typer.Exit(1)
|
|
198
|
+
|
|
199
|
+
if not config_file.exists():
|
|
200
|
+
console.print("[yellow]Config file not found.[/yellow]")
|
|
201
|
+
console.print(f"\nProvided path does not exist: [cyan]{config_file}[/cyan]")
|
|
202
|
+
console.print(
|
|
203
|
+
"\nRun [bold cyan]agent-cli config init[/bold cyan] to create one.",
|
|
204
|
+
)
|
|
205
|
+
raise typer.Exit(1)
|
|
206
|
+
|
|
207
|
+
editor = _get_editor()
|
|
208
|
+
console.print(f"[dim]Opening {config_file} with {editor}...[/dim]")
|
|
209
|
+
|
|
210
|
+
try:
|
|
211
|
+
editor_cmd = shlex.split(editor, posix=os.name != "nt")
|
|
212
|
+
except ValueError as e:
|
|
213
|
+
console.print("[red]Invalid editor command. Check $EDITOR/$VISUAL.[/red]")
|
|
214
|
+
raise typer.Exit(1) from e
|
|
215
|
+
|
|
216
|
+
if not editor_cmd:
|
|
217
|
+
console.print("[red]Editor command is empty.[/red]")
|
|
218
|
+
raise typer.Exit(1)
|
|
219
|
+
|
|
220
|
+
try:
|
|
221
|
+
subprocess.run([*editor_cmd, str(config_file)], check=True)
|
|
222
|
+
except FileNotFoundError:
|
|
223
|
+
console.print(f"[red]Editor '{editor_cmd[0]}' not found.[/red]")
|
|
224
|
+
console.print("Set $EDITOR environment variable to your preferred editor.")
|
|
225
|
+
raise typer.Exit(1) from None
|
|
226
|
+
except subprocess.CalledProcessError as e:
|
|
227
|
+
console.print(f"[red]Editor exited with error code {e.returncode}[/red]")
|
|
228
|
+
raise typer.Exit(e.returncode) from None
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
@config_app.command("show")
|
|
232
|
+
def config_show(
|
|
233
|
+
path: Path | None = CONFIG_PATH_OPTION,
|
|
234
|
+
raw: bool = RAW_OPTION,
|
|
235
|
+
json_output: bool = JSON_OPTION,
|
|
236
|
+
) -> None:
|
|
237
|
+
"""Display the config file location and contents."""
|
|
238
|
+
config_file = _get_config_file(path)
|
|
239
|
+
|
|
240
|
+
if config_file is None:
|
|
241
|
+
if json_output:
|
|
242
|
+
print(
|
|
243
|
+
json.dumps(
|
|
244
|
+
{
|
|
245
|
+
"path": None,
|
|
246
|
+
"exists": False,
|
|
247
|
+
"content": None,
|
|
248
|
+
"searched_locations": [str(p) for p in CONFIG_PATHS],
|
|
249
|
+
},
|
|
250
|
+
),
|
|
251
|
+
)
|
|
252
|
+
raise typer.Exit(0)
|
|
253
|
+
console.print("[yellow]No config file found.[/yellow]")
|
|
254
|
+
console.print("\nSearched locations:")
|
|
255
|
+
for p in CONFIG_PATHS:
|
|
256
|
+
status = "[green]exists[/green]" if p.exists() else "[dim]not found[/dim]"
|
|
257
|
+
console.print(f" - {p} ({status})")
|
|
258
|
+
console.print(
|
|
259
|
+
"\nRun [bold cyan]agent-cli config init[/bold cyan] to create one.",
|
|
260
|
+
)
|
|
261
|
+
raise typer.Exit(0)
|
|
262
|
+
|
|
263
|
+
if not config_file.exists():
|
|
264
|
+
if json_output:
|
|
265
|
+
print(
|
|
266
|
+
json.dumps(
|
|
267
|
+
{
|
|
268
|
+
"path": str(config_file),
|
|
269
|
+
"exists": False,
|
|
270
|
+
"content": None,
|
|
271
|
+
},
|
|
272
|
+
),
|
|
273
|
+
)
|
|
274
|
+
raise typer.Exit(1)
|
|
275
|
+
console.print("[yellow]Config file not found.[/yellow]")
|
|
276
|
+
console.print(f"\nProvided path does not exist: [cyan]{config_file}[/cyan]")
|
|
277
|
+
console.print(
|
|
278
|
+
"\nRun [bold cyan]agent-cli config init[/bold cyan] to create one.",
|
|
279
|
+
)
|
|
280
|
+
raise typer.Exit(1)
|
|
281
|
+
|
|
282
|
+
content = config_file.read_text(encoding="utf-8")
|
|
283
|
+
|
|
284
|
+
if json_output:
|
|
285
|
+
print(
|
|
286
|
+
json.dumps(
|
|
287
|
+
{
|
|
288
|
+
"path": str(config_file),
|
|
289
|
+
"exists": True,
|
|
290
|
+
"content": content,
|
|
291
|
+
},
|
|
292
|
+
),
|
|
293
|
+
)
|
|
294
|
+
return
|
|
295
|
+
|
|
296
|
+
if raw:
|
|
297
|
+
print(content, end="")
|
|
298
|
+
return
|
|
299
|
+
|
|
300
|
+
from rich.syntax import Syntax # noqa: PLC0415
|
|
301
|
+
|
|
302
|
+
console.print(f"[bold green]Config file:[/bold green] [cyan]{config_file}[/cyan]")
|
|
303
|
+
console.print()
|
|
304
|
+
syntax = Syntax(content, "toml", theme="monokai", line_numbers=True, word_wrap=True)
|
|
305
|
+
console.print(syntax)
|
|
306
|
+
console.print()
|
|
307
|
+
console.print("[dim]Tip: Use -r for copy-paste friendly output[/dim]")
|
agent_cli/constants.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Default configuration settings for the Agent CLI package."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
# --- Audio Configuration ---
|
|
6
|
+
AUDIO_FORMAT_STR = "int16" # sounddevice/numpy format
|
|
7
|
+
AUDIO_FORMAT_WIDTH = 2 # 2 bytes (16-bit)
|
|
8
|
+
AUDIO_CHANNELS = 1
|
|
9
|
+
AUDIO_RATE = 16000
|
|
10
|
+
AUDIO_CHUNK_SIZE = 1024
|
|
11
|
+
WAV_HEADER_SIZE = 44 # Standard WAV header size in bytes
|
|
12
|
+
|
|
13
|
+
# --- TTS Configuration ---
|
|
14
|
+
PIPER_DEFAULT_SAMPLE_RATE = 22050 # Piper TTS default sample rate
|
|
15
|
+
KOKORO_DEFAULT_SAMPLE_RATE = 24000 # Kokoro TTS default sample rate
|
|
16
|
+
|
|
17
|
+
# Standard Wyoming audio configuration
|
|
18
|
+
WYOMING_AUDIO_CONFIG = {
|
|
19
|
+
"rate": AUDIO_RATE,
|
|
20
|
+
"width": AUDIO_FORMAT_WIDTH,
|
|
21
|
+
"channels": AUDIO_CHANNELS,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# --- HTTP Defaults ---
|
|
25
|
+
DEFAULT_OPENAI_BASE_URL = "https://api.openai.com/v1"
|
|
26
|
+
DEFAULT_OPENAI_MODEL = "gpt-5-mini"
|
|
27
|
+
DEFAULT_OPENAI_EMBEDDING_MODEL = "text-embedding-3-small"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Core functionalities for the agent CLI."""
|