tunacode-cli 0.0.70__py3-none-any.whl → 0.0.78.6__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.
Potentially problematic release.
This version of tunacode-cli might be problematic. Click here for more details.
- tunacode/cli/commands/__init__.py +0 -2
- tunacode/cli/commands/implementations/__init__.py +0 -3
- tunacode/cli/commands/implementations/debug.py +2 -2
- tunacode/cli/commands/implementations/development.py +10 -8
- tunacode/cli/commands/implementations/model.py +357 -29
- tunacode/cli/commands/implementations/system.py +3 -2
- tunacode/cli/commands/implementations/template.py +0 -2
- tunacode/cli/commands/registry.py +8 -7
- tunacode/cli/commands/slash/loader.py +2 -1
- tunacode/cli/commands/slash/validator.py +2 -1
- tunacode/cli/main.py +19 -1
- tunacode/cli/repl.py +90 -229
- tunacode/cli/repl_components/command_parser.py +2 -1
- tunacode/cli/repl_components/error_recovery.py +8 -5
- tunacode/cli/repl_components/output_display.py +1 -10
- tunacode/cli/repl_components/tool_executor.py +1 -13
- tunacode/configuration/defaults.py +2 -2
- tunacode/configuration/key_descriptions.py +284 -0
- tunacode/configuration/settings.py +0 -1
- tunacode/constants.py +6 -42
- tunacode/core/agents/__init__.py +43 -2
- tunacode/core/agents/agent_components/__init__.py +7 -0
- tunacode/core/agents/agent_components/agent_config.py +162 -158
- tunacode/core/agents/agent_components/agent_helpers.py +31 -2
- tunacode/core/agents/agent_components/node_processor.py +180 -146
- tunacode/core/agents/agent_components/response_state.py +123 -6
- tunacode/core/agents/agent_components/state_transition.py +116 -0
- tunacode/core/agents/agent_components/streaming.py +296 -0
- tunacode/core/agents/agent_components/task_completion.py +19 -6
- tunacode/core/agents/agent_components/tool_buffer.py +21 -1
- tunacode/core/agents/agent_components/tool_executor.py +10 -0
- tunacode/core/agents/main.py +522 -370
- tunacode/core/agents/main_legact.py +538 -0
- tunacode/core/agents/prompts.py +66 -0
- tunacode/core/agents/utils.py +29 -122
- tunacode/core/setup/__init__.py +0 -2
- tunacode/core/setup/config_setup.py +88 -227
- tunacode/core/setup/config_wizard.py +230 -0
- tunacode/core/setup/coordinator.py +2 -1
- tunacode/core/state.py +16 -64
- tunacode/core/token_usage/usage_tracker.py +3 -1
- tunacode/core/tool_authorization.py +352 -0
- tunacode/core/tool_handler.py +67 -60
- tunacode/prompts/system.xml +751 -0
- tunacode/services/mcp.py +97 -1
- tunacode/setup.py +0 -23
- tunacode/tools/base.py +54 -1
- tunacode/tools/bash.py +14 -0
- tunacode/tools/glob.py +4 -2
- tunacode/tools/grep.py +7 -17
- tunacode/tools/prompts/glob_prompt.xml +1 -1
- tunacode/tools/prompts/grep_prompt.xml +1 -0
- tunacode/tools/prompts/list_dir_prompt.xml +1 -1
- tunacode/tools/prompts/react_prompt.xml +23 -0
- tunacode/tools/prompts/read_file_prompt.xml +1 -1
- tunacode/tools/react.py +153 -0
- tunacode/tools/run_command.py +15 -0
- tunacode/types.py +14 -79
- tunacode/ui/completers.py +434 -50
- tunacode/ui/config_dashboard.py +585 -0
- tunacode/ui/console.py +63 -11
- tunacode/ui/input.py +8 -3
- tunacode/ui/keybindings.py +0 -18
- tunacode/ui/model_selector.py +395 -0
- tunacode/ui/output.py +40 -19
- tunacode/ui/panels.py +173 -49
- tunacode/ui/path_heuristics.py +91 -0
- tunacode/ui/prompt_manager.py +1 -20
- tunacode/ui/tool_ui.py +30 -8
- tunacode/utils/api_key_validation.py +93 -0
- tunacode/utils/config_comparator.py +340 -0
- tunacode/utils/models_registry.py +593 -0
- tunacode/utils/text_utils.py +18 -1
- {tunacode_cli-0.0.70.dist-info → tunacode_cli-0.0.78.6.dist-info}/METADATA +80 -12
- {tunacode_cli-0.0.70.dist-info → tunacode_cli-0.0.78.6.dist-info}/RECORD +78 -74
- tunacode/cli/commands/implementations/plan.py +0 -50
- tunacode/cli/commands/implementations/todo.py +0 -217
- tunacode/context.py +0 -71
- tunacode/core/setup/git_safety_setup.py +0 -186
- tunacode/prompts/system.md +0 -359
- tunacode/prompts/system.md.bak +0 -487
- tunacode/tools/exit_plan_mode.py +0 -273
- tunacode/tools/present_plan.py +0 -288
- tunacode/tools/prompts/exit_plan_mode_prompt.xml +0 -25
- tunacode/tools/prompts/present_plan_prompt.xml +0 -20
- tunacode/tools/prompts/todo_prompt.xml +0 -96
- tunacode/tools/todo.py +0 -456
- {tunacode_cli-0.0.70.dist-info → tunacode_cli-0.0.78.6.dist-info}/WHEEL +0 -0
- {tunacode_cli-0.0.70.dist-info → tunacode_cli-0.0.78.6.dist-info}/entry_points.txt +0 -0
- {tunacode_cli-0.0.70.dist-info → tunacode_cli-0.0.78.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module: tunacode.configuration.key_descriptions
|
|
3
|
+
|
|
4
|
+
Educational descriptions and examples for configuration keys to help users
|
|
5
|
+
understand what each setting does and how to configure it properly.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
from typing import Any, Dict, Optional
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class KeyDescription:
|
|
14
|
+
"""Description of a configuration key with examples and help text."""
|
|
15
|
+
|
|
16
|
+
name: str
|
|
17
|
+
description: str
|
|
18
|
+
example: Any
|
|
19
|
+
help_text: str
|
|
20
|
+
category: str
|
|
21
|
+
is_sensitive: bool = False
|
|
22
|
+
service_type: Optional[str] = None # For API keys: "openai", "anthropic", etc.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Configuration key descriptions organized by category
|
|
26
|
+
CONFIG_KEY_DESCRIPTIONS: Dict[str, KeyDescription] = {
|
|
27
|
+
# Root level keys
|
|
28
|
+
"default_model": KeyDescription(
|
|
29
|
+
name="default_model",
|
|
30
|
+
description="Which AI model TunaCode uses by default",
|
|
31
|
+
example="openrouter:openai/gpt-4.1",
|
|
32
|
+
help_text="Format: provider:model-name. Examples: openai:gpt-4, "
|
|
33
|
+
"anthropic:claude-3-sonnet, google:gemini-pro",
|
|
34
|
+
category="AI Models",
|
|
35
|
+
),
|
|
36
|
+
# Environment variables (API Keys)
|
|
37
|
+
"env.OPENAI_API_KEY": KeyDescription(
|
|
38
|
+
name="OPENAI_API_KEY",
|
|
39
|
+
description="Your OpenAI API key for GPT models",
|
|
40
|
+
example="sk-proj-abc123...",
|
|
41
|
+
help_text="Get this from https://platform.openai.com/api-keys. "
|
|
42
|
+
"Required for OpenAI models like GPT-4.",
|
|
43
|
+
category="API Keys",
|
|
44
|
+
is_sensitive=True,
|
|
45
|
+
service_type="openai",
|
|
46
|
+
),
|
|
47
|
+
"env.ANTHROPIC_API_KEY": KeyDescription(
|
|
48
|
+
name="ANTHROPIC_API_KEY",
|
|
49
|
+
description="Your Anthropic API key for Claude models",
|
|
50
|
+
example="sk-ant-api03-abc123...",
|
|
51
|
+
help_text="Get this from https://console.anthropic.com/. Required for Claude models.",
|
|
52
|
+
category="API Keys",
|
|
53
|
+
is_sensitive=True,
|
|
54
|
+
service_type="anthropic",
|
|
55
|
+
),
|
|
56
|
+
"env.OPENROUTER_API_KEY": KeyDescription(
|
|
57
|
+
name="OPENROUTER_API_KEY",
|
|
58
|
+
description="Your OpenRouter API key for accessing multiple models",
|
|
59
|
+
example="sk-or-v1-abc123...",
|
|
60
|
+
help_text="Get this from https://openrouter.ai/keys. "
|
|
61
|
+
"Gives access to many different AI models.",
|
|
62
|
+
category="API Keys",
|
|
63
|
+
is_sensitive=True,
|
|
64
|
+
service_type="openrouter",
|
|
65
|
+
),
|
|
66
|
+
"env.GEMINI_API_KEY": KeyDescription(
|
|
67
|
+
name="GEMINI_API_KEY",
|
|
68
|
+
description="Your Google Gemini API key",
|
|
69
|
+
example="AIza123...",
|
|
70
|
+
help_text="Get this from Google AI Studio. Required for Gemini models.",
|
|
71
|
+
category="API Keys",
|
|
72
|
+
is_sensitive=True,
|
|
73
|
+
service_type="google",
|
|
74
|
+
),
|
|
75
|
+
"env.OPENAI_BASE_URL": KeyDescription(
|
|
76
|
+
name="OPENAI_BASE_URL",
|
|
77
|
+
description="Custom API endpoint for OpenAI-compatible services",
|
|
78
|
+
example="https://api.cerebras.ai/v1",
|
|
79
|
+
help_text="Use this to connect to local models (LM Studio, Ollama) or "
|
|
80
|
+
"alternative providers like Cerebras.",
|
|
81
|
+
category="API Configuration",
|
|
82
|
+
),
|
|
83
|
+
# Settings
|
|
84
|
+
"settings.max_retries": KeyDescription(
|
|
85
|
+
name="max_retries",
|
|
86
|
+
description="How many times to retry failed API calls",
|
|
87
|
+
example=10,
|
|
88
|
+
help_text="Higher values = more resilient to temporary API issues, "
|
|
89
|
+
"but slower when APIs are down.",
|
|
90
|
+
category="Behavior Settings",
|
|
91
|
+
),
|
|
92
|
+
"settings.max_iterations": KeyDescription(
|
|
93
|
+
name="max_iterations",
|
|
94
|
+
description="Maximum conversation turns before stopping",
|
|
95
|
+
example=40,
|
|
96
|
+
help_text="Prevents infinite loops. TunaCode will stop after this many "
|
|
97
|
+
"back-and-forth exchanges.",
|
|
98
|
+
category="Behavior Settings",
|
|
99
|
+
),
|
|
100
|
+
"settings.tool_ignore": KeyDescription(
|
|
101
|
+
name="tool_ignore",
|
|
102
|
+
description="List of tools TunaCode should not use",
|
|
103
|
+
example=["read_file", "write_file"],
|
|
104
|
+
help_text="Useful for restricting what TunaCode can do. Empty list means "
|
|
105
|
+
"all tools are available.",
|
|
106
|
+
category="Tool Configuration",
|
|
107
|
+
),
|
|
108
|
+
"settings.guide_file": KeyDescription(
|
|
109
|
+
name="guide_file",
|
|
110
|
+
description="Name of your project guide file",
|
|
111
|
+
example="AGENTS.md",
|
|
112
|
+
help_text="TunaCode looks for this file to understand your project. "
|
|
113
|
+
"Usually AGENTS.md or README.md.",
|
|
114
|
+
category="Project Settings",
|
|
115
|
+
),
|
|
116
|
+
"settings.fallback_response": KeyDescription(
|
|
117
|
+
name="fallback_response",
|
|
118
|
+
description="Whether to provide a response when tools fail",
|
|
119
|
+
example=True,
|
|
120
|
+
help_text="When true, TunaCode will try to help even if some tools don't work properly.",
|
|
121
|
+
category="Behavior Settings",
|
|
122
|
+
),
|
|
123
|
+
"settings.fallback_verbosity": KeyDescription(
|
|
124
|
+
name="fallback_verbosity",
|
|
125
|
+
description="How detailed fallback responses should be",
|
|
126
|
+
example="normal",
|
|
127
|
+
help_text="Options: minimal, normal, detailed. Controls how much "
|
|
128
|
+
"TunaCode explains when things go wrong.",
|
|
129
|
+
category="Behavior Settings",
|
|
130
|
+
),
|
|
131
|
+
"settings.context_window_size": KeyDescription(
|
|
132
|
+
name="context_window_size",
|
|
133
|
+
description="Maximum tokens TunaCode can use in one conversation",
|
|
134
|
+
example=200000,
|
|
135
|
+
help_text="Larger values = TunaCode remembers more context, but costs more. "
|
|
136
|
+
"Adjust based on your model's limits.",
|
|
137
|
+
category="Performance Settings",
|
|
138
|
+
),
|
|
139
|
+
"settings.enable_streaming": KeyDescription(
|
|
140
|
+
name="enable_streaming",
|
|
141
|
+
description="Show AI responses as they're generated",
|
|
142
|
+
example=True,
|
|
143
|
+
help_text="When true, you see responses appear word-by-word. "
|
|
144
|
+
"When false, you wait for complete responses.",
|
|
145
|
+
category="User Experience",
|
|
146
|
+
),
|
|
147
|
+
# Ripgrep settings
|
|
148
|
+
"settings.ripgrep.use_bundled": KeyDescription(
|
|
149
|
+
name="ripgrep.use_bundled",
|
|
150
|
+
description="Use TunaCode's built-in ripgrep instead of system version",
|
|
151
|
+
example=False,
|
|
152
|
+
help_text="Usually false is better - uses your system's ripgrep which may be newer/faster.",
|
|
153
|
+
category="Search Settings",
|
|
154
|
+
),
|
|
155
|
+
"settings.ripgrep.timeout": KeyDescription(
|
|
156
|
+
name="ripgrep.timeout",
|
|
157
|
+
description="How long to wait for search results (seconds)",
|
|
158
|
+
example=10,
|
|
159
|
+
help_text="Prevents searches from hanging. Increase for very large codebases.",
|
|
160
|
+
category="Search Settings",
|
|
161
|
+
),
|
|
162
|
+
"settings.ripgrep.max_buffer_size": KeyDescription(
|
|
163
|
+
name="ripgrep.max_buffer_size",
|
|
164
|
+
description="Maximum size of search results (bytes)",
|
|
165
|
+
example=1048576,
|
|
166
|
+
help_text="1MB by default. Prevents memory issues with huge search results.",
|
|
167
|
+
category="Search Settings",
|
|
168
|
+
),
|
|
169
|
+
"settings.ripgrep.max_results": KeyDescription(
|
|
170
|
+
name="ripgrep.max_results",
|
|
171
|
+
description="Maximum number of search results to return",
|
|
172
|
+
example=100,
|
|
173
|
+
help_text="Prevents overwhelming output. Increase if you need more "
|
|
174
|
+
"comprehensive search results.",
|
|
175
|
+
category="Search Settings",
|
|
176
|
+
),
|
|
177
|
+
"settings.ripgrep.enable_metrics": KeyDescription(
|
|
178
|
+
name="ripgrep.enable_metrics",
|
|
179
|
+
description="Collect performance data about searches",
|
|
180
|
+
example=False,
|
|
181
|
+
help_text="Enable for debugging search performance. Usually not needed.",
|
|
182
|
+
category="Search Settings",
|
|
183
|
+
),
|
|
184
|
+
"settings.ripgrep.debug": KeyDescription(
|
|
185
|
+
name="ripgrep.debug",
|
|
186
|
+
description="Show detailed search debugging information",
|
|
187
|
+
example=False,
|
|
188
|
+
help_text="Enable for troubleshooting search issues. Creates verbose output.",
|
|
189
|
+
category="Search Settings",
|
|
190
|
+
),
|
|
191
|
+
# Tutorial/onboarding settings
|
|
192
|
+
"settings.enable_tutorial": KeyDescription(
|
|
193
|
+
name="enable_tutorial",
|
|
194
|
+
description="Show tutorial prompts for new users",
|
|
195
|
+
example=True,
|
|
196
|
+
help_text="Helps new users learn TunaCode. Disable once you're comfortable with the tool.",
|
|
197
|
+
category="User Experience",
|
|
198
|
+
),
|
|
199
|
+
"settings.first_installation_date": KeyDescription(
|
|
200
|
+
name="first_installation_date",
|
|
201
|
+
description="When TunaCode was first installed",
|
|
202
|
+
example="2025-09-11T11:50:40.167105",
|
|
203
|
+
help_text="Automatically set. Used for tracking usage patterns and showing relevant tips.",
|
|
204
|
+
category="System Information",
|
|
205
|
+
),
|
|
206
|
+
"settings.tutorial_declined": KeyDescription(
|
|
207
|
+
name="tutorial_declined",
|
|
208
|
+
description="Whether user declined the tutorial",
|
|
209
|
+
example=True,
|
|
210
|
+
help_text="Automatically set when you skip the tutorial. Prevents repeated "
|
|
211
|
+
"tutorial prompts.",
|
|
212
|
+
category="User Experience",
|
|
213
|
+
),
|
|
214
|
+
# MCP Servers
|
|
215
|
+
"mcpServers": KeyDescription(
|
|
216
|
+
name="mcpServers",
|
|
217
|
+
description="Model Context Protocol server configurations",
|
|
218
|
+
example={},
|
|
219
|
+
help_text="Advanced feature for connecting external tools and services. "
|
|
220
|
+
"Usually empty for basic usage.",
|
|
221
|
+
category="Advanced Features",
|
|
222
|
+
),
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def get_key_description(key_path: str) -> Optional[KeyDescription]:
|
|
227
|
+
"""Get description for a configuration key by its path."""
|
|
228
|
+
return CONFIG_KEY_DESCRIPTIONS.get(key_path)
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def get_service_type_for_api_key(key_name: str) -> Optional[str]:
|
|
232
|
+
"""Determine the service type for an API key."""
|
|
233
|
+
service_mapping = {
|
|
234
|
+
"OPENAI_API_KEY": "openai",
|
|
235
|
+
"ANTHROPIC_API_KEY": "anthropic",
|
|
236
|
+
"OPENROUTER_API_KEY": "openrouter",
|
|
237
|
+
"GEMINI_API_KEY": "google",
|
|
238
|
+
}
|
|
239
|
+
return service_mapping.get(key_name)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def get_categories() -> Dict[str, list[KeyDescription]]:
|
|
243
|
+
"""Get all configuration keys organized by category."""
|
|
244
|
+
categories: Dict[str, list[KeyDescription]] = {}
|
|
245
|
+
|
|
246
|
+
for desc in CONFIG_KEY_DESCRIPTIONS.values():
|
|
247
|
+
if desc.category not in categories:
|
|
248
|
+
categories[desc.category] = []
|
|
249
|
+
categories[desc.category].append(desc)
|
|
250
|
+
|
|
251
|
+
return categories
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def get_configuration_glossary() -> str:
|
|
255
|
+
"""Generate a glossary of configuration terms for the help section."""
|
|
256
|
+
glossary = """
|
|
257
|
+
[bold]Configuration Key Glossary[/bold]
|
|
258
|
+
|
|
259
|
+
[cyan]What are configuration keys?[/cyan]
|
|
260
|
+
Configuration keys are setting names (like 'default_model', 'max_retries') that
|
|
261
|
+
control how TunaCode behaves.
|
|
262
|
+
Think of them like preferences in any app - they let you customize TunaCode to work
|
|
263
|
+
the way you want.
|
|
264
|
+
|
|
265
|
+
[cyan]Key Categories:[/cyan]
|
|
266
|
+
• [yellow]AI Models[/yellow]: Which AI to use (GPT-4, Claude, etc.)
|
|
267
|
+
• [yellow]API Keys[/yellow]: Your credentials for AI services
|
|
268
|
+
• [yellow]Behavior Settings[/yellow]: How TunaCode acts (retries, iterations, etc.)
|
|
269
|
+
• [yellow]Tool Configuration[/yellow]: Which tools TunaCode can use
|
|
270
|
+
• [yellow]Performance Settings[/yellow]: Memory and speed optimizations
|
|
271
|
+
• [yellow]User Experience[/yellow]: Interface and tutorial preferences
|
|
272
|
+
|
|
273
|
+
[cyan]Common Examples:[/cyan]
|
|
274
|
+
• default_model → Which AI model to use by default
|
|
275
|
+
• max_retries → How many times to retry failed requests
|
|
276
|
+
• OPENAI_API_KEY → Your OpenAI account credentials
|
|
277
|
+
• tool_ignore → List of tools TunaCode shouldn't use
|
|
278
|
+
• context_window_size → How much conversation history to remember
|
|
279
|
+
|
|
280
|
+
[cyan]Default vs Custom:[/cyan]
|
|
281
|
+
• 📋 Default: TunaCode's built-in settings (work for most people)
|
|
282
|
+
• 🔧 Custom: Settings you've changed to fit your needs
|
|
283
|
+
"""
|
|
284
|
+
return glossary.strip()
|
tunacode/constants.py
CHANGED
|
@@ -9,12 +9,12 @@ from enum import Enum
|
|
|
9
9
|
|
|
10
10
|
# Application info
|
|
11
11
|
APP_NAME = "TunaCode"
|
|
12
|
-
APP_VERSION = "0.0.
|
|
12
|
+
APP_VERSION = "0.0.78.6"
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
# File patterns
|
|
16
16
|
GUIDE_FILE_PATTERN = "{name}.md"
|
|
17
|
-
GUIDE_FILE_NAME = "
|
|
17
|
+
GUIDE_FILE_NAME = "AGENTS.md"
|
|
18
18
|
ENV_FILE = ".env"
|
|
19
19
|
CONFIG_FILE_NAME = "tunacode.json"
|
|
20
20
|
|
|
@@ -43,8 +43,7 @@ class ToolName(str, Enum):
|
|
|
43
43
|
GREP = "grep"
|
|
44
44
|
LIST_DIR = "list_dir"
|
|
45
45
|
GLOB = "glob"
|
|
46
|
-
|
|
47
|
-
EXIT_PLAN_MODE = "exit_plan_mode"
|
|
46
|
+
REACT = "react"
|
|
48
47
|
|
|
49
48
|
|
|
50
49
|
# Tool names (backward compatibility)
|
|
@@ -56,8 +55,7 @@ TOOL_BASH = ToolName.BASH
|
|
|
56
55
|
TOOL_GREP = ToolName.GREP
|
|
57
56
|
TOOL_LIST_DIR = ToolName.LIST_DIR
|
|
58
57
|
TOOL_GLOB = ToolName.GLOB
|
|
59
|
-
|
|
60
|
-
TOOL_EXIT_PLAN_MODE = ToolName.EXIT_PLAN_MODE
|
|
58
|
+
TOOL_REACT = ToolName.REACT
|
|
61
59
|
|
|
62
60
|
# Tool categorization
|
|
63
61
|
READ_ONLY_TOOLS = [
|
|
@@ -65,7 +63,7 @@ READ_ONLY_TOOLS = [
|
|
|
65
63
|
ToolName.GREP,
|
|
66
64
|
ToolName.LIST_DIR,
|
|
67
65
|
ToolName.GLOB,
|
|
68
|
-
ToolName.
|
|
66
|
+
ToolName.REACT,
|
|
69
67
|
]
|
|
70
68
|
WRITE_TOOLS = [ToolName.WRITE_FILE, ToolName.UPDATE_FILE]
|
|
71
69
|
EXECUTE_TOOLS = [ToolName.BASH, ToolName.RUN_COMMAND]
|
|
@@ -120,7 +118,7 @@ UI_COLORS = {
|
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
# UI text and formatting
|
|
123
|
-
UI_PROMPT_PREFIX = ">
|
|
121
|
+
UI_PROMPT_PREFIX = '<style fg="#00d7ff"><b>> </b></style>'
|
|
124
122
|
UI_THINKING_MESSAGE = "[bold #00d7ff]Thinking...[/bold #00d7ff]"
|
|
125
123
|
UI_DARKGREY_OPEN = "<darkgrey>"
|
|
126
124
|
UI_DARKGREY_CLOSE = "</darkgrey>"
|
|
@@ -167,40 +165,6 @@ MSG_UPDATE_INSTRUCTION = "Exit, and run: [bold]pip install --upgrade tunacode-cl
|
|
|
167
165
|
MSG_VERSION_DISPLAY = "TunaCode CLI {version}"
|
|
168
166
|
MSG_FILE_SIZE_LIMIT = " Please specify a smaller file or use other tools to process it."
|
|
169
167
|
|
|
170
|
-
|
|
171
|
-
class TodoStatus(str, Enum):
|
|
172
|
-
"""Enumeration of todo statuses."""
|
|
173
|
-
|
|
174
|
-
PENDING = "pending"
|
|
175
|
-
IN_PROGRESS = "in_progress"
|
|
176
|
-
COMPLETED = "completed"
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
class TodoPriority(str, Enum):
|
|
180
|
-
"""Enumeration of todo priorities."""
|
|
181
|
-
|
|
182
|
-
HIGH = "high"
|
|
183
|
-
MEDIUM = "medium"
|
|
184
|
-
LOW = "low"
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
# Todo-related constants (backward compatibility)
|
|
188
|
-
TODO_STATUS_PENDING = TodoStatus.PENDING
|
|
189
|
-
TODO_STATUS_IN_PROGRESS = TodoStatus.IN_PROGRESS
|
|
190
|
-
TODO_STATUS_COMPLETED = TodoStatus.COMPLETED
|
|
191
|
-
TODO_STATUSES = [TodoStatus.PENDING, TodoStatus.IN_PROGRESS, TodoStatus.COMPLETED]
|
|
192
|
-
|
|
193
|
-
TODO_PRIORITY_HIGH = TodoPriority.HIGH
|
|
194
|
-
TODO_PRIORITY_MEDIUM = TodoPriority.MEDIUM
|
|
195
|
-
TODO_PRIORITY_LOW = TodoPriority.LOW
|
|
196
|
-
TODO_PRIORITIES = [TodoPriority.HIGH, TodoPriority.MEDIUM, TodoPriority.LOW]
|
|
197
|
-
|
|
198
|
-
# Maximum number of todos allowed per session
|
|
199
|
-
MAX_TODOS_PER_SESSION = 100
|
|
200
|
-
|
|
201
|
-
# Maximum length for todo content
|
|
202
|
-
MAX_TODO_CONTENT_LENGTH = 500
|
|
203
|
-
|
|
204
168
|
# JSON parsing retry configuration
|
|
205
169
|
JSON_PARSE_MAX_RETRIES = 10
|
|
206
170
|
JSON_PARSE_BASE_DELAY = 0.1 # Initial delay in seconds
|
tunacode/core/agents/__init__.py
CHANGED
|
@@ -1,8 +1,49 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Public entry points for TunaCode agent orchestration."""
|
|
2
2
|
|
|
3
|
-
from .
|
|
3
|
+
from . import main as main
|
|
4
|
+
from .agent_components import (
|
|
5
|
+
AgentRunWithState,
|
|
6
|
+
AgentRunWrapper,
|
|
7
|
+
ResponseState,
|
|
8
|
+
SimpleResult,
|
|
9
|
+
ToolBuffer,
|
|
10
|
+
_process_node,
|
|
11
|
+
check_task_completion,
|
|
12
|
+
execute_tools_parallel,
|
|
13
|
+
extract_and_execute_tool_calls,
|
|
14
|
+
get_model_messages,
|
|
15
|
+
get_or_create_agent,
|
|
16
|
+
parse_json_tool_calls,
|
|
17
|
+
patch_tool_messages,
|
|
18
|
+
)
|
|
19
|
+
from .main import (
|
|
20
|
+
check_query_satisfaction,
|
|
21
|
+
cleanup_mcp_servers,
|
|
22
|
+
get_agent_tool,
|
|
23
|
+
get_mcp_servers,
|
|
24
|
+
process_request,
|
|
25
|
+
register_mcp_agent,
|
|
26
|
+
)
|
|
4
27
|
|
|
5
28
|
__all__ = [
|
|
6
29
|
"process_request",
|
|
7
30
|
"get_or_create_agent",
|
|
31
|
+
"extract_and_execute_tool_calls",
|
|
32
|
+
"parse_json_tool_calls",
|
|
33
|
+
"get_model_messages",
|
|
34
|
+
"patch_tool_messages",
|
|
35
|
+
"_process_node",
|
|
36
|
+
"ResponseState",
|
|
37
|
+
"SimpleResult",
|
|
38
|
+
"AgentRunWrapper",
|
|
39
|
+
"AgentRunWithState",
|
|
40
|
+
"ToolBuffer",
|
|
41
|
+
"check_task_completion",
|
|
42
|
+
"execute_tools_parallel",
|
|
43
|
+
"get_mcp_servers",
|
|
44
|
+
"cleanup_mcp_servers",
|
|
45
|
+
"register_mcp_agent",
|
|
46
|
+
"check_query_satisfaction",
|
|
47
|
+
"get_agent_tool",
|
|
48
|
+
"main",
|
|
8
49
|
]
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"""Agent components package for modular agent functionality."""
|
|
2
2
|
|
|
3
|
+
from tunacode.ui.tool_descriptions import get_batch_description
|
|
4
|
+
|
|
3
5
|
from .agent_config import get_or_create_agent
|
|
4
6
|
from .agent_helpers import (
|
|
5
7
|
create_empty_response_message,
|
|
@@ -11,12 +13,14 @@ from .agent_helpers import (
|
|
|
11
13
|
get_tool_description,
|
|
12
14
|
get_tool_summary,
|
|
13
15
|
get_user_prompt_part_class,
|
|
16
|
+
handle_empty_response,
|
|
14
17
|
)
|
|
15
18
|
from .json_tool_parser import extract_and_execute_tool_calls, parse_json_tool_calls
|
|
16
19
|
from .message_handler import get_model_messages, patch_tool_messages
|
|
17
20
|
from .node_processor import _process_node
|
|
18
21
|
from .response_state import ResponseState
|
|
19
22
|
from .result_wrapper import AgentRunWithState, AgentRunWrapper, SimpleResult
|
|
23
|
+
from .streaming import stream_model_request_node
|
|
20
24
|
from .task_completion import check_task_completion
|
|
21
25
|
from .tool_buffer import ToolBuffer
|
|
22
26
|
from .tool_executor import execute_tools_parallel
|
|
@@ -44,4 +48,7 @@ __all__ = [
|
|
|
44
48
|
"get_tool_description",
|
|
45
49
|
"get_tool_summary",
|
|
46
50
|
"get_user_prompt_part_class",
|
|
51
|
+
"handle_empty_response",
|
|
52
|
+
"stream_model_request_node",
|
|
53
|
+
"get_batch_description",
|
|
47
54
|
]
|