codepp 0.0.437__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.
- code_puppy/__init__.py +10 -0
- code_puppy/__main__.py +10 -0
- code_puppy/agents/__init__.py +31 -0
- code_puppy/agents/agent_c_reviewer.py +155 -0
- code_puppy/agents/agent_code_puppy.py +117 -0
- code_puppy/agents/agent_code_reviewer.py +90 -0
- code_puppy/agents/agent_cpp_reviewer.py +132 -0
- code_puppy/agents/agent_creator_agent.py +638 -0
- code_puppy/agents/agent_golang_reviewer.py +151 -0
- code_puppy/agents/agent_helios.py +124 -0
- code_puppy/agents/agent_javascript_reviewer.py +160 -0
- code_puppy/agents/agent_manager.py +742 -0
- code_puppy/agents/agent_pack_leader.py +385 -0
- code_puppy/agents/agent_planning.py +165 -0
- code_puppy/agents/agent_python_programmer.py +169 -0
- code_puppy/agents/agent_python_reviewer.py +90 -0
- code_puppy/agents/agent_qa_expert.py +163 -0
- code_puppy/agents/agent_qa_kitten.py +208 -0
- code_puppy/agents/agent_scheduler.py +121 -0
- code_puppy/agents/agent_security_auditor.py +181 -0
- code_puppy/agents/agent_terminal_qa.py +323 -0
- code_puppy/agents/agent_typescript_reviewer.py +166 -0
- code_puppy/agents/base_agent.py +2156 -0
- code_puppy/agents/event_stream_handler.py +348 -0
- code_puppy/agents/json_agent.py +202 -0
- code_puppy/agents/pack/__init__.py +34 -0
- code_puppy/agents/pack/bloodhound.py +304 -0
- code_puppy/agents/pack/husky.py +327 -0
- code_puppy/agents/pack/retriever.py +393 -0
- code_puppy/agents/pack/shepherd.py +348 -0
- code_puppy/agents/pack/terrier.py +287 -0
- code_puppy/agents/pack/watchdog.py +367 -0
- code_puppy/agents/prompt_reviewer.py +145 -0
- code_puppy/agents/subagent_stream_handler.py +276 -0
- code_puppy/api/__init__.py +13 -0
- code_puppy/api/app.py +169 -0
- code_puppy/api/main.py +21 -0
- code_puppy/api/pty_manager.py +453 -0
- code_puppy/api/routers/__init__.py +12 -0
- code_puppy/api/routers/agents.py +36 -0
- code_puppy/api/routers/commands.py +217 -0
- code_puppy/api/routers/config.py +75 -0
- code_puppy/api/routers/sessions.py +234 -0
- code_puppy/api/templates/terminal.html +361 -0
- code_puppy/api/websocket.py +154 -0
- code_puppy/callbacks.py +692 -0
- code_puppy/chatgpt_codex_client.py +338 -0
- code_puppy/claude_cache_client.py +672 -0
- code_puppy/cli_runner.py +1073 -0
- code_puppy/command_line/__init__.py +1 -0
- code_puppy/command_line/add_model_menu.py +1092 -0
- code_puppy/command_line/agent_menu.py +662 -0
- code_puppy/command_line/attachments.py +395 -0
- code_puppy/command_line/autosave_menu.py +704 -0
- code_puppy/command_line/clipboard.py +527 -0
- code_puppy/command_line/colors_menu.py +532 -0
- code_puppy/command_line/command_handler.py +293 -0
- code_puppy/command_line/command_registry.py +150 -0
- code_puppy/command_line/config_commands.py +719 -0
- code_puppy/command_line/core_commands.py +867 -0
- code_puppy/command_line/diff_menu.py +865 -0
- code_puppy/command_line/file_path_completion.py +73 -0
- code_puppy/command_line/load_context_completion.py +52 -0
- code_puppy/command_line/mcp/__init__.py +10 -0
- code_puppy/command_line/mcp/base.py +32 -0
- code_puppy/command_line/mcp/catalog_server_installer.py +175 -0
- code_puppy/command_line/mcp/custom_server_form.py +688 -0
- code_puppy/command_line/mcp/custom_server_installer.py +195 -0
- code_puppy/command_line/mcp/edit_command.py +148 -0
- code_puppy/command_line/mcp/handler.py +138 -0
- code_puppy/command_line/mcp/help_command.py +147 -0
- code_puppy/command_line/mcp/install_command.py +214 -0
- code_puppy/command_line/mcp/install_menu.py +705 -0
- code_puppy/command_line/mcp/list_command.py +94 -0
- code_puppy/command_line/mcp/logs_command.py +235 -0
- code_puppy/command_line/mcp/remove_command.py +82 -0
- code_puppy/command_line/mcp/restart_command.py +100 -0
- code_puppy/command_line/mcp/search_command.py +123 -0
- code_puppy/command_line/mcp/start_all_command.py +135 -0
- code_puppy/command_line/mcp/start_command.py +117 -0
- code_puppy/command_line/mcp/status_command.py +184 -0
- code_puppy/command_line/mcp/stop_all_command.py +112 -0
- code_puppy/command_line/mcp/stop_command.py +80 -0
- code_puppy/command_line/mcp/test_command.py +107 -0
- code_puppy/command_line/mcp/utils.py +129 -0
- code_puppy/command_line/mcp/wizard_utils.py +334 -0
- code_puppy/command_line/mcp_completion.py +174 -0
- code_puppy/command_line/model_picker_completion.py +197 -0
- code_puppy/command_line/model_settings_menu.py +932 -0
- code_puppy/command_line/motd.py +96 -0
- code_puppy/command_line/onboarding_slides.py +179 -0
- code_puppy/command_line/onboarding_wizard.py +342 -0
- code_puppy/command_line/pin_command_completion.py +329 -0
- code_puppy/command_line/prompt_toolkit_completion.py +846 -0
- code_puppy/command_line/session_commands.py +302 -0
- code_puppy/command_line/shell_passthrough.py +145 -0
- code_puppy/command_line/skills_completion.py +160 -0
- code_puppy/command_line/uc_menu.py +893 -0
- code_puppy/command_line/utils.py +93 -0
- code_puppy/command_line/wiggum_state.py +78 -0
- code_puppy/config.py +1770 -0
- code_puppy/error_logging.py +134 -0
- code_puppy/gemini_code_assist.py +385 -0
- code_puppy/gemini_model.py +754 -0
- code_puppy/hook_engine/README.md +105 -0
- code_puppy/hook_engine/__init__.py +21 -0
- code_puppy/hook_engine/aliases.py +155 -0
- code_puppy/hook_engine/engine.py +221 -0
- code_puppy/hook_engine/executor.py +296 -0
- code_puppy/hook_engine/matcher.py +156 -0
- code_puppy/hook_engine/models.py +240 -0
- code_puppy/hook_engine/registry.py +106 -0
- code_puppy/hook_engine/validator.py +144 -0
- code_puppy/http_utils.py +361 -0
- code_puppy/keymap.py +128 -0
- code_puppy/main.py +10 -0
- code_puppy/mcp_/__init__.py +66 -0
- code_puppy/mcp_/async_lifecycle.py +286 -0
- code_puppy/mcp_/blocking_startup.py +469 -0
- code_puppy/mcp_/captured_stdio_server.py +275 -0
- code_puppy/mcp_/circuit_breaker.py +290 -0
- code_puppy/mcp_/config_wizard.py +507 -0
- code_puppy/mcp_/dashboard.py +308 -0
- code_puppy/mcp_/error_isolation.py +407 -0
- code_puppy/mcp_/examples/retry_example.py +226 -0
- code_puppy/mcp_/health_monitor.py +589 -0
- code_puppy/mcp_/managed_server.py +428 -0
- code_puppy/mcp_/manager.py +807 -0
- code_puppy/mcp_/mcp_logs.py +224 -0
- code_puppy/mcp_/registry.py +451 -0
- code_puppy/mcp_/retry_manager.py +337 -0
- code_puppy/mcp_/server_registry_catalog.py +1126 -0
- code_puppy/mcp_/status_tracker.py +355 -0
- code_puppy/mcp_/system_tools.py +209 -0
- code_puppy/mcp_prompts/__init__.py +1 -0
- code_puppy/mcp_prompts/hook_creator.py +103 -0
- code_puppy/messaging/__init__.py +255 -0
- code_puppy/messaging/bus.py +613 -0
- code_puppy/messaging/commands.py +167 -0
- code_puppy/messaging/markdown_patches.py +57 -0
- code_puppy/messaging/message_queue.py +361 -0
- code_puppy/messaging/messages.py +569 -0
- code_puppy/messaging/queue_console.py +271 -0
- code_puppy/messaging/renderers.py +311 -0
- code_puppy/messaging/rich_renderer.py +1158 -0
- code_puppy/messaging/spinner/__init__.py +83 -0
- code_puppy/messaging/spinner/console_spinner.py +240 -0
- code_puppy/messaging/spinner/spinner_base.py +95 -0
- code_puppy/messaging/subagent_console.py +460 -0
- code_puppy/model_factory.py +848 -0
- code_puppy/model_switching.py +63 -0
- code_puppy/model_utils.py +168 -0
- code_puppy/models.json +174 -0
- code_puppy/models_dev_api.json +1 -0
- code_puppy/models_dev_parser.py +592 -0
- code_puppy/plugins/__init__.py +186 -0
- code_puppy/plugins/agent_skills/__init__.py +22 -0
- code_puppy/plugins/agent_skills/config.py +175 -0
- code_puppy/plugins/agent_skills/discovery.py +136 -0
- code_puppy/plugins/agent_skills/downloader.py +392 -0
- code_puppy/plugins/agent_skills/installer.py +22 -0
- code_puppy/plugins/agent_skills/metadata.py +219 -0
- code_puppy/plugins/agent_skills/prompt_builder.py +60 -0
- code_puppy/plugins/agent_skills/register_callbacks.py +241 -0
- code_puppy/plugins/agent_skills/remote_catalog.py +322 -0
- code_puppy/plugins/agent_skills/skill_catalog.py +257 -0
- code_puppy/plugins/agent_skills/skills_install_menu.py +664 -0
- code_puppy/plugins/agent_skills/skills_menu.py +781 -0
- code_puppy/plugins/antigravity_oauth/__init__.py +10 -0
- code_puppy/plugins/antigravity_oauth/accounts.py +406 -0
- code_puppy/plugins/antigravity_oauth/antigravity_model.py +706 -0
- code_puppy/plugins/antigravity_oauth/config.py +42 -0
- code_puppy/plugins/antigravity_oauth/constants.py +133 -0
- code_puppy/plugins/antigravity_oauth/oauth.py +478 -0
- code_puppy/plugins/antigravity_oauth/register_callbacks.py +518 -0
- code_puppy/plugins/antigravity_oauth/storage.py +288 -0
- code_puppy/plugins/antigravity_oauth/test_plugin.py +319 -0
- code_puppy/plugins/antigravity_oauth/token.py +167 -0
- code_puppy/plugins/antigravity_oauth/transport.py +863 -0
- code_puppy/plugins/antigravity_oauth/utils.py +168 -0
- code_puppy/plugins/chatgpt_oauth/__init__.py +8 -0
- code_puppy/plugins/chatgpt_oauth/config.py +52 -0
- code_puppy/plugins/chatgpt_oauth/oauth_flow.py +329 -0
- code_puppy/plugins/chatgpt_oauth/register_callbacks.py +176 -0
- code_puppy/plugins/chatgpt_oauth/test_plugin.py +301 -0
- code_puppy/plugins/chatgpt_oauth/utils.py +523 -0
- code_puppy/plugins/claude_code_hooks/__init__.py +1 -0
- code_puppy/plugins/claude_code_hooks/config.py +137 -0
- code_puppy/plugins/claude_code_hooks/register_callbacks.py +175 -0
- code_puppy/plugins/claude_code_oauth/README.md +167 -0
- code_puppy/plugins/claude_code_oauth/SETUP.md +93 -0
- code_puppy/plugins/claude_code_oauth/__init__.py +25 -0
- code_puppy/plugins/claude_code_oauth/config.py +52 -0
- code_puppy/plugins/claude_code_oauth/register_callbacks.py +453 -0
- code_puppy/plugins/claude_code_oauth/test_plugin.py +283 -0
- code_puppy/plugins/claude_code_oauth/token_refresh_heartbeat.py +241 -0
- code_puppy/plugins/claude_code_oauth/utils.py +640 -0
- code_puppy/plugins/customizable_commands/__init__.py +0 -0
- code_puppy/plugins/customizable_commands/register_callbacks.py +152 -0
- code_puppy/plugins/example_custom_command/README.md +280 -0
- code_puppy/plugins/example_custom_command/register_callbacks.py +51 -0
- code_puppy/plugins/file_permission_handler/__init__.py +4 -0
- code_puppy/plugins/file_permission_handler/register_callbacks.py +470 -0
- code_puppy/plugins/frontend_emitter/__init__.py +25 -0
- code_puppy/plugins/frontend_emitter/emitter.py +121 -0
- code_puppy/plugins/frontend_emitter/register_callbacks.py +261 -0
- code_puppy/plugins/hook_creator/__init__.py +1 -0
- code_puppy/plugins/hook_creator/register_callbacks.py +33 -0
- code_puppy/plugins/hook_manager/__init__.py +1 -0
- code_puppy/plugins/hook_manager/config.py +290 -0
- code_puppy/plugins/hook_manager/hooks_menu.py +564 -0
- code_puppy/plugins/hook_manager/register_callbacks.py +227 -0
- code_puppy/plugins/oauth_puppy_html.py +228 -0
- code_puppy/plugins/scheduler/__init__.py +1 -0
- code_puppy/plugins/scheduler/register_callbacks.py +88 -0
- code_puppy/plugins/scheduler/scheduler_menu.py +522 -0
- code_puppy/plugins/scheduler/scheduler_wizard.py +341 -0
- code_puppy/plugins/shell_safety/__init__.py +6 -0
- code_puppy/plugins/shell_safety/agent_shell_safety.py +69 -0
- code_puppy/plugins/shell_safety/command_cache.py +156 -0
- code_puppy/plugins/shell_safety/register_callbacks.py +202 -0
- code_puppy/plugins/synthetic_status/__init__.py +1 -0
- code_puppy/plugins/synthetic_status/register_callbacks.py +132 -0
- code_puppy/plugins/synthetic_status/status_api.py +147 -0
- code_puppy/plugins/universal_constructor/__init__.py +13 -0
- code_puppy/plugins/universal_constructor/models.py +138 -0
- code_puppy/plugins/universal_constructor/register_callbacks.py +47 -0
- code_puppy/plugins/universal_constructor/registry.py +302 -0
- code_puppy/plugins/universal_constructor/sandbox.py +584 -0
- code_puppy/prompts/antigravity_system_prompt.md +1 -0
- code_puppy/pydantic_patches.py +356 -0
- code_puppy/reopenable_async_client.py +232 -0
- code_puppy/round_robin_model.py +150 -0
- code_puppy/scheduler/__init__.py +41 -0
- code_puppy/scheduler/__main__.py +9 -0
- code_puppy/scheduler/cli.py +118 -0
- code_puppy/scheduler/config.py +126 -0
- code_puppy/scheduler/daemon.py +280 -0
- code_puppy/scheduler/executor.py +155 -0
- code_puppy/scheduler/platform.py +19 -0
- code_puppy/scheduler/platform_unix.py +22 -0
- code_puppy/scheduler/platform_win.py +32 -0
- code_puppy/session_storage.py +338 -0
- code_puppy/status_display.py +257 -0
- code_puppy/summarization_agent.py +176 -0
- code_puppy/terminal_utils.py +418 -0
- code_puppy/tools/__init__.py +501 -0
- code_puppy/tools/agent_tools.py +603 -0
- code_puppy/tools/ask_user_question/__init__.py +26 -0
- code_puppy/tools/ask_user_question/constants.py +73 -0
- code_puppy/tools/ask_user_question/demo_tui.py +55 -0
- code_puppy/tools/ask_user_question/handler.py +232 -0
- code_puppy/tools/ask_user_question/models.py +304 -0
- code_puppy/tools/ask_user_question/registration.py +26 -0
- code_puppy/tools/ask_user_question/renderers.py +309 -0
- code_puppy/tools/ask_user_question/terminal_ui.py +329 -0
- code_puppy/tools/ask_user_question/theme.py +155 -0
- code_puppy/tools/ask_user_question/tui_loop.py +423 -0
- code_puppy/tools/browser/__init__.py +37 -0
- code_puppy/tools/browser/browser_control.py +289 -0
- code_puppy/tools/browser/browser_interactions.py +545 -0
- code_puppy/tools/browser/browser_locators.py +640 -0
- code_puppy/tools/browser/browser_manager.py +378 -0
- code_puppy/tools/browser/browser_navigation.py +251 -0
- code_puppy/tools/browser/browser_screenshot.py +179 -0
- code_puppy/tools/browser/browser_scripts.py +462 -0
- code_puppy/tools/browser/browser_workflows.py +221 -0
- code_puppy/tools/browser/chromium_terminal_manager.py +259 -0
- code_puppy/tools/browser/terminal_command_tools.py +534 -0
- code_puppy/tools/browser/terminal_screenshot_tools.py +552 -0
- code_puppy/tools/browser/terminal_tools.py +525 -0
- code_puppy/tools/command_runner.py +1346 -0
- code_puppy/tools/common.py +1409 -0
- code_puppy/tools/display.py +84 -0
- code_puppy/tools/file_modifications.py +886 -0
- code_puppy/tools/file_operations.py +802 -0
- code_puppy/tools/scheduler_tools.py +412 -0
- code_puppy/tools/skills_tools.py +244 -0
- code_puppy/tools/subagent_context.py +158 -0
- code_puppy/tools/tools_content.py +51 -0
- code_puppy/tools/universal_constructor.py +889 -0
- code_puppy/uvx_detection.py +242 -0
- code_puppy/version_checker.py +82 -0
- codepp-0.0.437.dist-info/METADATA +766 -0
- codepp-0.0.437.dist-info/RECORD +288 -0
- codepp-0.0.437.dist-info/WHEEL +4 -0
- codepp-0.0.437.dist-info/entry_points.txt +3 -0
- codepp-0.0.437.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
"""Code validation and safety checking for UC tools.
|
|
2
|
+
|
|
3
|
+
This module provides utilities for validating tool code before
|
|
4
|
+
execution or storage, including syntax checking, function extraction,
|
|
5
|
+
and dangerous pattern detection.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import ast
|
|
9
|
+
import logging
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any, Dict, List, Optional, Set
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
# Required fields for TOOL_META
|
|
17
|
+
TOOL_META_REQUIRED_FIELDS = {"name", "description"}
|
|
18
|
+
|
|
19
|
+
# Imports that might indicate dangerous operations
|
|
20
|
+
DANGEROUS_IMPORTS: Set[str] = {
|
|
21
|
+
# Execution/code generation
|
|
22
|
+
"subprocess",
|
|
23
|
+
"os.system",
|
|
24
|
+
"shutil.rmtree",
|
|
25
|
+
"eval",
|
|
26
|
+
"exec",
|
|
27
|
+
"compile",
|
|
28
|
+
"__import__",
|
|
29
|
+
"importlib",
|
|
30
|
+
"multiprocessing",
|
|
31
|
+
"pickle",
|
|
32
|
+
"marshal",
|
|
33
|
+
# Network access
|
|
34
|
+
"socket",
|
|
35
|
+
"urllib",
|
|
36
|
+
"http.client",
|
|
37
|
+
"requests",
|
|
38
|
+
# System access
|
|
39
|
+
"platform",
|
|
40
|
+
"ctypes",
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Dangerous function calls
|
|
44
|
+
DANGEROUS_CALLS: Set[str] = {
|
|
45
|
+
# Code execution
|
|
46
|
+
"eval",
|
|
47
|
+
"exec",
|
|
48
|
+
"compile",
|
|
49
|
+
"__import__",
|
|
50
|
+
"import_module",
|
|
51
|
+
# Process creation
|
|
52
|
+
"system",
|
|
53
|
+
"popen",
|
|
54
|
+
"spawn",
|
|
55
|
+
"fork",
|
|
56
|
+
"execv",
|
|
57
|
+
"execve",
|
|
58
|
+
"execvp",
|
|
59
|
+
"execl",
|
|
60
|
+
"execle",
|
|
61
|
+
"execlp",
|
|
62
|
+
# Scope manipulation
|
|
63
|
+
"globals",
|
|
64
|
+
"locals",
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# open() calls with write modes are dangerous
|
|
68
|
+
DANGEROUS_OPEN_MODES = {"w", "a", "x", "wb", "ab", "xb", "w+", "a+", "r+", "rb+", "wb+"}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass
|
|
72
|
+
class FunctionInfo:
|
|
73
|
+
"""Information extracted from a function definition."""
|
|
74
|
+
|
|
75
|
+
name: str
|
|
76
|
+
signature: str
|
|
77
|
+
docstring: Optional[str] = None
|
|
78
|
+
parameters: List[str] = field(default_factory=list)
|
|
79
|
+
return_annotation: Optional[str] = None
|
|
80
|
+
is_async: bool = False
|
|
81
|
+
decorators: List[str] = field(default_factory=list)
|
|
82
|
+
line_number: int = 0
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass
|
|
86
|
+
class ValidationResult:
|
|
87
|
+
"""Result of code validation."""
|
|
88
|
+
|
|
89
|
+
valid: bool
|
|
90
|
+
errors: List[str] = field(default_factory=list)
|
|
91
|
+
warnings: List[str] = field(default_factory=list)
|
|
92
|
+
functions: List[FunctionInfo] = field(default_factory=list)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def validate_syntax(code: str) -> ValidationResult:
|
|
96
|
+
"""Validate Python syntax.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
code: Python source code to validate.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
ValidationResult with valid=True if syntax is correct,
|
|
103
|
+
or valid=False with error details.
|
|
104
|
+
"""
|
|
105
|
+
result = ValidationResult(valid=True)
|
|
106
|
+
|
|
107
|
+
try:
|
|
108
|
+
ast.parse(code)
|
|
109
|
+
except SyntaxError as e:
|
|
110
|
+
result.valid = False
|
|
111
|
+
line_info = f" (line {e.lineno})" if e.lineno else ""
|
|
112
|
+
result.errors.append(f"Syntax error{line_info}: {e.msg}")
|
|
113
|
+
|
|
114
|
+
return result
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def extract_function_info(code: str) -> ValidationResult:
|
|
118
|
+
"""Extract function information from Python code.
|
|
119
|
+
|
|
120
|
+
Parses the code and extracts information about all function
|
|
121
|
+
definitions including name, signature, docstring, and parameters.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
code: Python source code.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
ValidationResult containing list of FunctionInfo objects.
|
|
128
|
+
"""
|
|
129
|
+
result = validate_syntax(code)
|
|
130
|
+
if not result.valid:
|
|
131
|
+
return result
|
|
132
|
+
|
|
133
|
+
try:
|
|
134
|
+
tree = ast.parse(code)
|
|
135
|
+
except SyntaxError:
|
|
136
|
+
return result
|
|
137
|
+
|
|
138
|
+
for node in ast.walk(tree):
|
|
139
|
+
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
|
|
140
|
+
func_info = _extract_single_function(node)
|
|
141
|
+
result.functions.append(func_info)
|
|
142
|
+
|
|
143
|
+
return result
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _extract_single_function(
|
|
147
|
+
node: ast.FunctionDef | ast.AsyncFunctionDef,
|
|
148
|
+
) -> FunctionInfo:
|
|
149
|
+
"""Extract info from a single function AST node."""
|
|
150
|
+
# Get parameter names
|
|
151
|
+
params = []
|
|
152
|
+
for arg in node.args.args:
|
|
153
|
+
param_str = arg.arg
|
|
154
|
+
if arg.annotation:
|
|
155
|
+
param_str += f": {ast.unparse(arg.annotation)}"
|
|
156
|
+
params.append(param_str)
|
|
157
|
+
|
|
158
|
+
# Handle *args and **kwargs
|
|
159
|
+
if node.args.vararg:
|
|
160
|
+
vararg = f"*{node.args.vararg.arg}"
|
|
161
|
+
if node.args.vararg.annotation:
|
|
162
|
+
vararg += f": {ast.unparse(node.args.vararg.annotation)}"
|
|
163
|
+
params.append(vararg)
|
|
164
|
+
|
|
165
|
+
if node.args.kwarg:
|
|
166
|
+
kwarg = f"**{node.args.kwarg.arg}"
|
|
167
|
+
if node.args.kwarg.annotation:
|
|
168
|
+
kwarg += f": {ast.unparse(node.args.kwarg.annotation)}"
|
|
169
|
+
params.append(kwarg)
|
|
170
|
+
|
|
171
|
+
# Build signature string
|
|
172
|
+
signature = f"{node.name}({', '.join(params)})"
|
|
173
|
+
|
|
174
|
+
# Get return annotation
|
|
175
|
+
return_annotation = None
|
|
176
|
+
if node.returns:
|
|
177
|
+
return_annotation = ast.unparse(node.returns)
|
|
178
|
+
signature += f" -> {return_annotation}"
|
|
179
|
+
|
|
180
|
+
# Get docstring
|
|
181
|
+
docstring = ast.get_docstring(node)
|
|
182
|
+
|
|
183
|
+
# Get decorators
|
|
184
|
+
decorators = []
|
|
185
|
+
for dec in node.decorator_list:
|
|
186
|
+
decorators.append(ast.unparse(dec))
|
|
187
|
+
|
|
188
|
+
return FunctionInfo(
|
|
189
|
+
name=node.name,
|
|
190
|
+
signature=signature,
|
|
191
|
+
docstring=docstring,
|
|
192
|
+
parameters=params,
|
|
193
|
+
return_annotation=return_annotation,
|
|
194
|
+
is_async=isinstance(node, ast.AsyncFunctionDef),
|
|
195
|
+
decorators=decorators,
|
|
196
|
+
line_number=node.lineno,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def check_dangerous_patterns(code: str) -> ValidationResult:
|
|
201
|
+
"""Check for potentially dangerous patterns in code.
|
|
202
|
+
|
|
203
|
+
This is an advisory check - it warns about patterns that might
|
|
204
|
+
be dangerous but doesn't prevent tool execution. Users should
|
|
205
|
+
review warned code before trusting it.
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
code: Python source code to check.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
ValidationResult with warnings for dangerous patterns.
|
|
212
|
+
"""
|
|
213
|
+
result = validate_syntax(code)
|
|
214
|
+
if not result.valid:
|
|
215
|
+
return result
|
|
216
|
+
|
|
217
|
+
try:
|
|
218
|
+
tree = ast.parse(code)
|
|
219
|
+
except SyntaxError:
|
|
220
|
+
return result
|
|
221
|
+
|
|
222
|
+
# Track dangerous imports
|
|
223
|
+
dangerous_found: List[str] = []
|
|
224
|
+
|
|
225
|
+
for node in ast.walk(tree):
|
|
226
|
+
# Check imports
|
|
227
|
+
if isinstance(node, ast.Import):
|
|
228
|
+
for alias in node.names:
|
|
229
|
+
if alias.name in DANGEROUS_IMPORTS:
|
|
230
|
+
dangerous_found.append(f"import {alias.name}")
|
|
231
|
+
|
|
232
|
+
elif isinstance(node, ast.ImportFrom):
|
|
233
|
+
module = node.module or ""
|
|
234
|
+
for alias in node.names:
|
|
235
|
+
full_name = f"{module}.{alias.name}"
|
|
236
|
+
if module in DANGEROUS_IMPORTS or full_name in DANGEROUS_IMPORTS:
|
|
237
|
+
dangerous_found.append(f"from {module} import {alias.name}")
|
|
238
|
+
|
|
239
|
+
# Check function calls
|
|
240
|
+
elif isinstance(node, ast.Call):
|
|
241
|
+
func_name = _get_call_name(node)
|
|
242
|
+
if func_name in DANGEROUS_CALLS:
|
|
243
|
+
line = getattr(node, "lineno", "?")
|
|
244
|
+
dangerous_found.append(f"{func_name}() call at line {line}")
|
|
245
|
+
# Special handling for open() - check if write mode is used
|
|
246
|
+
elif func_name == "open":
|
|
247
|
+
if _is_dangerous_open_call(node):
|
|
248
|
+
line = getattr(node, "lineno", "?")
|
|
249
|
+
dangerous_found.append(f"open() with write mode at line {line}")
|
|
250
|
+
|
|
251
|
+
# Add warnings for dangerous patterns
|
|
252
|
+
if dangerous_found:
|
|
253
|
+
result.warnings.append(
|
|
254
|
+
f"Potentially dangerous patterns found: {', '.join(dangerous_found)}"
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
return result
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def _get_call_name(node: ast.Call) -> str:
|
|
261
|
+
"""Extract the function name from a Call node."""
|
|
262
|
+
if isinstance(node.func, ast.Name):
|
|
263
|
+
return node.func.id
|
|
264
|
+
elif isinstance(node.func, ast.Attribute):
|
|
265
|
+
return node.func.attr
|
|
266
|
+
return ""
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def _is_dangerous_open_call(node: ast.Call) -> bool:
|
|
270
|
+
"""Check if an open() call uses a dangerous (write) mode.
|
|
271
|
+
|
|
272
|
+
Args:
|
|
273
|
+
node: AST Call node for open()
|
|
274
|
+
|
|
275
|
+
Returns:
|
|
276
|
+
True if the open call uses a write mode, False otherwise.
|
|
277
|
+
"""
|
|
278
|
+
# Check positional args - mode is typically the second argument
|
|
279
|
+
if len(node.args) >= 2:
|
|
280
|
+
mode_arg = node.args[1]
|
|
281
|
+
if isinstance(mode_arg, ast.Constant) and isinstance(mode_arg.value, str):
|
|
282
|
+
return mode_arg.value in DANGEROUS_OPEN_MODES
|
|
283
|
+
|
|
284
|
+
# Check keyword arguments
|
|
285
|
+
for kw in node.keywords:
|
|
286
|
+
if kw.arg == "mode":
|
|
287
|
+
if isinstance(kw.value, ast.Constant) and isinstance(kw.value.value, str):
|
|
288
|
+
return kw.value.value in DANGEROUS_OPEN_MODES
|
|
289
|
+
|
|
290
|
+
# If no mode specified, open() defaults to "r" which is safe
|
|
291
|
+
return False
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def full_validation(code: str) -> ValidationResult:
|
|
295
|
+
"""Perform full validation including syntax, function extraction, and safety.
|
|
296
|
+
|
|
297
|
+
Args:
|
|
298
|
+
code: Python source code to validate.
|
|
299
|
+
|
|
300
|
+
Returns:
|
|
301
|
+
Complete ValidationResult with all checks performed.
|
|
302
|
+
"""
|
|
303
|
+
# Start with syntax validation
|
|
304
|
+
result = validate_syntax(code)
|
|
305
|
+
if not result.valid:
|
|
306
|
+
return result
|
|
307
|
+
|
|
308
|
+
# Extract function info
|
|
309
|
+
func_result = extract_function_info(code)
|
|
310
|
+
result.functions = func_result.functions
|
|
311
|
+
|
|
312
|
+
# Check dangerous patterns
|
|
313
|
+
safety_result = check_dangerous_patterns(code)
|
|
314
|
+
result.warnings.extend(safety_result.warnings)
|
|
315
|
+
|
|
316
|
+
# Additional validation: ensure there's at least one function
|
|
317
|
+
if not result.functions:
|
|
318
|
+
result.warnings.append("No functions found in code - tool may not be callable")
|
|
319
|
+
|
|
320
|
+
return result
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
@dataclass
|
|
324
|
+
class ToolFileValidationResult(ValidationResult):
|
|
325
|
+
"""Extended validation result for tool files.
|
|
326
|
+
|
|
327
|
+
Includes TOOL_META extraction and main function validation.
|
|
328
|
+
"""
|
|
329
|
+
|
|
330
|
+
tool_meta: Optional[Dict[str, Any]] = None
|
|
331
|
+
main_function: Optional[FunctionInfo] = None
|
|
332
|
+
file_path: Optional[Path] = None
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def _extract_tool_meta(code: str) -> Optional[Dict[str, Any]]:
|
|
336
|
+
"""Extract TOOL_META dictionary from code.
|
|
337
|
+
|
|
338
|
+
Args:
|
|
339
|
+
code: Python source code containing TOOL_META.
|
|
340
|
+
|
|
341
|
+
Returns:
|
|
342
|
+
The TOOL_META dict if found and valid, None otherwise.
|
|
343
|
+
"""
|
|
344
|
+
try:
|
|
345
|
+
tree = ast.parse(code)
|
|
346
|
+
except SyntaxError:
|
|
347
|
+
return None
|
|
348
|
+
|
|
349
|
+
for node in ast.walk(tree):
|
|
350
|
+
if isinstance(node, ast.Assign):
|
|
351
|
+
for target in node.targets:
|
|
352
|
+
if isinstance(target, ast.Name) and target.id == "TOOL_META":
|
|
353
|
+
# Try to evaluate the dict literal
|
|
354
|
+
if isinstance(node.value, ast.Dict):
|
|
355
|
+
try:
|
|
356
|
+
# Safely evaluate the dict using ast.literal_eval
|
|
357
|
+
meta_str = ast.unparse(node.value)
|
|
358
|
+
return ast.literal_eval(meta_str)
|
|
359
|
+
except (ValueError, SyntaxError):
|
|
360
|
+
return None
|
|
361
|
+
return None
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def _validate_tool_meta(meta: Dict[str, Any]) -> List[str]:
|
|
365
|
+
"""Validate that TOOL_META has required fields.
|
|
366
|
+
|
|
367
|
+
Args:
|
|
368
|
+
meta: The TOOL_META dictionary to validate.
|
|
369
|
+
|
|
370
|
+
Returns:
|
|
371
|
+
List of error messages (empty if valid).
|
|
372
|
+
"""
|
|
373
|
+
errors = []
|
|
374
|
+
for field_name in TOOL_META_REQUIRED_FIELDS:
|
|
375
|
+
if field_name not in meta:
|
|
376
|
+
errors.append(f"TOOL_META missing required field: '{field_name}'")
|
|
377
|
+
elif not meta[field_name]:
|
|
378
|
+
errors.append(f"TOOL_META field '{field_name}' cannot be empty")
|
|
379
|
+
return errors
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
def _find_main_function(
|
|
383
|
+
functions: List[FunctionInfo], tool_name: str
|
|
384
|
+
) -> Optional[FunctionInfo]:
|
|
385
|
+
"""Find the main function for a tool.
|
|
386
|
+
|
|
387
|
+
The main function is expected to have the same name as the tool.
|
|
388
|
+
|
|
389
|
+
Args:
|
|
390
|
+
functions: List of functions found in the code.
|
|
391
|
+
tool_name: Expected name of the main function.
|
|
392
|
+
|
|
393
|
+
Returns:
|
|
394
|
+
The main FunctionInfo if found, None otherwise.
|
|
395
|
+
"""
|
|
396
|
+
for func in functions:
|
|
397
|
+
if func.name == tool_name:
|
|
398
|
+
return func
|
|
399
|
+
return None
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
def validate_tool_file(file_path: Path) -> ToolFileValidationResult:
|
|
403
|
+
"""Validate a tool file including TOOL_META and main function.
|
|
404
|
+
|
|
405
|
+
This function performs comprehensive validation:
|
|
406
|
+
1. Reads the file content
|
|
407
|
+
2. Validates Python syntax
|
|
408
|
+
3. Extracts and validates TOOL_META dict
|
|
409
|
+
4. Extracts and validates the main function
|
|
410
|
+
5. Checks for dangerous patterns
|
|
411
|
+
|
|
412
|
+
Args:
|
|
413
|
+
file_path: Path to the tool file to validate.
|
|
414
|
+
|
|
415
|
+
Returns:
|
|
416
|
+
ToolFileValidationResult with all validation details.
|
|
417
|
+
"""
|
|
418
|
+
result = ToolFileValidationResult(valid=True, file_path=file_path)
|
|
419
|
+
|
|
420
|
+
# Check file exists
|
|
421
|
+
if not file_path.exists():
|
|
422
|
+
result.valid = False
|
|
423
|
+
result.errors.append(f"File not found: {file_path}")
|
|
424
|
+
return result
|
|
425
|
+
|
|
426
|
+
if not file_path.is_file():
|
|
427
|
+
result.valid = False
|
|
428
|
+
result.errors.append(f"Path is not a file: {file_path}")
|
|
429
|
+
return result
|
|
430
|
+
|
|
431
|
+
# Read file content
|
|
432
|
+
try:
|
|
433
|
+
code = file_path.read_text(encoding="utf-8")
|
|
434
|
+
except Exception as e:
|
|
435
|
+
result.valid = False
|
|
436
|
+
result.errors.append(f"Failed to read file: {e}")
|
|
437
|
+
return result
|
|
438
|
+
|
|
439
|
+
# Validate syntax
|
|
440
|
+
syntax_result = validate_syntax(code)
|
|
441
|
+
if not syntax_result.valid:
|
|
442
|
+
result.valid = False
|
|
443
|
+
result.errors.extend(syntax_result.errors)
|
|
444
|
+
return result
|
|
445
|
+
|
|
446
|
+
# Extract TOOL_META
|
|
447
|
+
meta = _extract_tool_meta(code)
|
|
448
|
+
if meta is None:
|
|
449
|
+
result.valid = False
|
|
450
|
+
result.errors.append("TOOL_META not found or invalid in file")
|
|
451
|
+
return result
|
|
452
|
+
|
|
453
|
+
result.tool_meta = meta
|
|
454
|
+
|
|
455
|
+
# Validate TOOL_META has required fields
|
|
456
|
+
meta_errors = _validate_tool_meta(meta)
|
|
457
|
+
if meta_errors:
|
|
458
|
+
result.valid = False
|
|
459
|
+
result.errors.extend(meta_errors)
|
|
460
|
+
return result
|
|
461
|
+
|
|
462
|
+
# Extract functions
|
|
463
|
+
func_result = extract_function_info(code)
|
|
464
|
+
result.functions = func_result.functions
|
|
465
|
+
|
|
466
|
+
# Find main function (should match tool name)
|
|
467
|
+
tool_name = meta.get("name", "")
|
|
468
|
+
main_func = _find_main_function(result.functions, tool_name)
|
|
469
|
+
if main_func is None:
|
|
470
|
+
result.warnings.append(
|
|
471
|
+
f"No function named '{tool_name}' found - "
|
|
472
|
+
f"tool may not be callable as expected"
|
|
473
|
+
)
|
|
474
|
+
else:
|
|
475
|
+
result.main_function = main_func
|
|
476
|
+
|
|
477
|
+
# Check dangerous patterns
|
|
478
|
+
safety_result = check_dangerous_patterns(code)
|
|
479
|
+
result.warnings.extend(safety_result.warnings)
|
|
480
|
+
|
|
481
|
+
return result
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def _validate_safe_path(file_path: Path, safe_root: Path) -> bool:
|
|
485
|
+
"""Validate that file_path is contained within safe_root.
|
|
486
|
+
|
|
487
|
+
Args:
|
|
488
|
+
file_path: The path to validate.
|
|
489
|
+
safe_root: The root directory that file_path must be within.
|
|
490
|
+
|
|
491
|
+
Returns:
|
|
492
|
+
True if file_path is safely within safe_root, False otherwise.
|
|
493
|
+
"""
|
|
494
|
+
try:
|
|
495
|
+
# Resolve both paths to absolute paths
|
|
496
|
+
resolved_path = file_path.resolve()
|
|
497
|
+
resolved_root = safe_root.resolve()
|
|
498
|
+
# Check if the resolved path is relative to the root
|
|
499
|
+
resolved_path.relative_to(resolved_root)
|
|
500
|
+
return True
|
|
501
|
+
except ValueError:
|
|
502
|
+
return False
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
def validate_and_write_tool(
|
|
506
|
+
code: str, file_path: Path, safe_root: Optional[Path] = None
|
|
507
|
+
) -> ToolFileValidationResult:
|
|
508
|
+
"""Validate code and write to file only if valid.
|
|
509
|
+
|
|
510
|
+
This function performs full validation before writing,
|
|
511
|
+
ensuring only valid tool code is persisted to disk.
|
|
512
|
+
|
|
513
|
+
Args:
|
|
514
|
+
code: Python source code for the tool.
|
|
515
|
+
file_path: Path where the tool file should be written.
|
|
516
|
+
safe_root: Optional root directory to validate against. Defaults to USER_UC_DIR.
|
|
517
|
+
Pass the parent directory of file_path to skip validation (for testing).
|
|
518
|
+
|
|
519
|
+
Returns:
|
|
520
|
+
ToolFileValidationResult indicating success/failure.
|
|
521
|
+
If valid, the file will be written to file_path.
|
|
522
|
+
"""
|
|
523
|
+
from . import USER_UC_DIR
|
|
524
|
+
|
|
525
|
+
result = ToolFileValidationResult(valid=True, file_path=file_path)
|
|
526
|
+
|
|
527
|
+
# Validate path is within safe root directory (prevent path traversal)
|
|
528
|
+
root_to_check = safe_root if safe_root is not None else USER_UC_DIR
|
|
529
|
+
if not _validate_safe_path(file_path, root_to_check):
|
|
530
|
+
result.valid = False
|
|
531
|
+
result.errors.append(f"Unsafe file path: must be within {root_to_check}")
|
|
532
|
+
return result
|
|
533
|
+
syntax_result = validate_syntax(code)
|
|
534
|
+
if not syntax_result.valid:
|
|
535
|
+
result.valid = False
|
|
536
|
+
result.errors.extend(syntax_result.errors)
|
|
537
|
+
return result
|
|
538
|
+
|
|
539
|
+
# Extract and validate TOOL_META
|
|
540
|
+
meta = _extract_tool_meta(code)
|
|
541
|
+
if meta is None:
|
|
542
|
+
result.valid = False
|
|
543
|
+
result.errors.append("TOOL_META not found or invalid in code")
|
|
544
|
+
return result
|
|
545
|
+
|
|
546
|
+
result.tool_meta = meta
|
|
547
|
+
|
|
548
|
+
# Validate TOOL_META has required fields
|
|
549
|
+
meta_errors = _validate_tool_meta(meta)
|
|
550
|
+
if meta_errors:
|
|
551
|
+
result.valid = False
|
|
552
|
+
result.errors.extend(meta_errors)
|
|
553
|
+
return result
|
|
554
|
+
|
|
555
|
+
# Extract functions
|
|
556
|
+
func_result = extract_function_info(code)
|
|
557
|
+
result.functions = func_result.functions
|
|
558
|
+
|
|
559
|
+
# Find main function
|
|
560
|
+
tool_name = meta.get("name", "")
|
|
561
|
+
main_func = _find_main_function(result.functions, tool_name)
|
|
562
|
+
if main_func is None:
|
|
563
|
+
result.warnings.append(
|
|
564
|
+
f"No function named '{tool_name}' found - "
|
|
565
|
+
f"tool may not be callable as expected"
|
|
566
|
+
)
|
|
567
|
+
else:
|
|
568
|
+
result.main_function = main_func
|
|
569
|
+
|
|
570
|
+
# Check dangerous patterns (warnings only, don't fail)
|
|
571
|
+
safety_result = check_dangerous_patterns(code)
|
|
572
|
+
result.warnings.extend(safety_result.warnings)
|
|
573
|
+
|
|
574
|
+
# If we got here, validation passed - write the file
|
|
575
|
+
try:
|
|
576
|
+
# Ensure parent directory exists
|
|
577
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
578
|
+
file_path.write_text(code, encoding="utf-8")
|
|
579
|
+
except Exception as e:
|
|
580
|
+
result.valid = False
|
|
581
|
+
result.errors.append(f"Failed to write file: {e}")
|
|
582
|
+
return result
|
|
583
|
+
|
|
584
|
+
return result
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<identity>\nYou are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.\nYou are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.\nThe USER will send you requests, which you must always prioritize addressing. Along with each USER request, we will attach additional metadata about their current state, such as what files they have open and where their cursor is.\nThis information may or may not be relevant to the coding task, it is up for you to decide.\n</identity>\n\n<tool_calling>\nCall tools as you normally would. The following list provides additional guidance to help you avoid errors:\n - **Absolute paths only**. When using tools that accept file path arguments, ALWAYS use the absolute file path.\n</tool_calling>\n\n<web_application_development>\n## Technology Stack,\nYour web applications should be built using the following technologies:,\n1. **Core**: Use HTML for structure and Javascript for logic.\n2. **Styling (CSS)**: Use Vanilla CSS for maximum flexibility and control. Avoid using TailwindCSS unless the USER explicitly requests it; in this case, first confirm which TailwindCSS version to use.\n3. **Web App**: If the USER specifies that they want a more complex web app, use a framework like Next.js or Vite. Only do this if the USER explicitly requests a web app.\n4. **New Project Creation**: If you need to use a framework for a new app, use `npx` with the appropriate script, but there are some rules to follow:,\n - Use `npx -y` to automatically install the script and its dependencies\n - You MUST run the command with `--help` flag to see all available options first, \n - Initialize the app in the current directory with `./` (example: `npx -y create-vite-app@latest ./`),\n - You should run in non-interactive mode so that the user doesn't need to input anything,\n5. **Running Locally**: When running locally, use `npm run dev` or equivalent dev server. Only build the production bundle if the USER explicitly requests it or you are validating the code for correctness.\n\n# Design Aesthetics,\n1. **Use Rich Aesthetics**: The USER should be wowed at first glance by the design. Use best practices in modern web design (e.g. vibrant colors, dark modes, glassmorphism, and dynamic animations) to create a stunning first impression. Failure to do this is UNACCEPTABLE.\n2. **Prioritize Visual Excellence**: Implement designs that will WOW the user and feel extremely premium:\n\t\t- Avoid generic colors (plain red, blue, green). Use curated, harmonious color palettes (e.g., HSL tailored colors, sleek dark modes).\n - Using modern typography (e.g., from Google Fonts like Inter, Roboto, or Outfit) instead of browser defaults.\n\t\t- Use smooth gradients,\n\t\t- Add subtle micro-animations for enhanced user experience,\n3. **Use a Dynamic Design**: An interface that feels responsive and alive encourages interaction. Achieve this with hover effects and interactive elements. Micro-animations, in particular, are highly effective for improving user engagement.\n4. **Premium Designs**. Make a design that feels premium and state of the art. Avoid creating simple minimum viable products.\n4. **Don't use placeholders**. If you need an image, use your generate_image tool to create a working demonstration.,\n\n## Implementation Workflow,\nFollow this systematic approach when building web applications:,\n1. **Plan and Understand**:,\n\t\t- Fully understand the user's requirements,\n\t\t- Draw inspiration from modern, beautiful, and dynamic web designs,\n\t\t- Outline the features needed for the initial version,\n2. **Build the Foundation**:,\n\t\t- Start by creating/modifying `index.css`,\n\t\t- Implement the core design system with all tokens and utilities,\n3. **Create Components**:,\n\t\t- Build necessary components using your design system,\n\t\t- Ensure all components use predefined styles, not ad-hoc utilities,\n\t\t- Keep components focused and reusable,\n4. **Assemble Pages**:,\n\t\t- Update the main application to incorporate your design and components,\n\t\t- Ensure proper routing and navigation,\n\t\t- Implement responsive layouts,\n5. **Polish and Optimize**:,\n\t\t- Review the overall user experience,\n\t\t- Ensure smooth interactions and transitions,\n\t\t- Optimize performance where needed,\n\n## SEO Best Practices,\nAutomatically implement SEO best practices on every page:,\n- **Title Tags**: Include proper, descriptive title tags for each page,\n- **Meta Descriptions**: Add compelling meta descriptions that accurately summarize page content,\n- **Heading Structure**: Use a single `<h1>` per page with proper heading hierarchy,\n- **Semantic HTML**: Use appropriate HTML5 semantic elements,\n- **Unique IDs**: Ensure all interactive elements have unique, descriptive IDs for browser testing,\n- **Performance**: Ensure fast page load times through optimization,\nCRITICAL REMINDER: AESTHETICS ARE VERY IMPORTANT. If your web app looks simple and basic then you have FAILED!\n</web_application_development>\n<ephemeral_message>\nThere will be an <EPHEMERAL_MESSAGE> appearing in the conversation at times. This is not coming from the user, but instead injected by the system as important information to pay attention to. \nDo not respond to nor acknowledge those messages, but do follow them strictly.\n</ephemeral_message>\n\n\n<communication_style>\n- **Formatting**. Format your responses in github-style markdown to make your responses easier for the USER to parse. For example, use headers to organize your responses and bolded or italicized text to highlight important keywords. Use backticks to format file, directory, function, and class names. If providing a URL to the user, format this in markdown as well, for example `[label](example.com)`.\n- **Proactiveness**. As an agent, you are allowed to be proactive, but only in the course of completing the user's task. For example, if the user asks you to add a new component, you can edit the code, verify build and test statuses, and take any other obvious follow-up actions, such as performing additional research. However, avoid surprising the user. For example, if the user asks HOW to approach something, you should answer their question and instead of jumping into editing a file.\n- **Helpfulness**. Respond like a helpful software engineer who is explaining your work to a friendly collaborator on the project. Acknowledge mistakes or any backtracking you do as a result of new information.\n- **Ask for clarification**. If you are unsure about the USER's intent, always ask for clarification rather than making assumptions.\n</communication_style>
|