c02be519f6
* feat(dangerous-mode): implement real-filesystem access with safety checks - Introduced a 'dangerous mode' allowing the agent to operate on the real filesystem. - Updated command validation to bypass path confinement while enforcing a blocklist for privileged commands. - Added warnings and guidelines for users when operating in dangerous mode. - Enhanced configuration to support dangerous mode and ensure it implies auto-approval. - Updated tests to verify the behavior of commands and configurations in dangerous mode. * feat(dangerous-mode): enhance logging and environment management for dangerous mode * feat(dangerous-mode): improve handling of dangerous mode with environment flags and enhance test isolation
56 lines
3.2 KiB
Python
56 lines
3.2 KiB
Python
"""Shared constants and utilities for CLI and TUI modules."""
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
|
|
def _agent_name() -> str:
|
|
# Deferred import: ``sessions`` pulls in langgraph/aiosqlite (~300 ms)
|
|
# and is only needed when ``build_metadata`` is actually called.
|
|
from ..sessions import AGENT_NAME
|
|
|
|
return AGENT_NAME
|
|
|
|
|
|
# Dangerous-mode warning banner — shared by Rich CLI, Textual TUI, and serve so
|
|
# the wording never drifts. Label is rendered white-on-red, message in red.
|
|
DANGEROUS_BANNER_LABEL = "DANGEROUS MODE"
|
|
DANGEROUS_BANNER_MESSAGE = (
|
|
"Real-filesystem access • the agent can read/write/delete anywhere."
|
|
)
|
|
|
|
WELCOME_SLOGANS = [
|
|
"Ready for vibe research? What do you want cooking?",
|
|
"Science doesn't sleep. Neither do your sub-agents.",
|
|
"From hypothesis to paper — let's cook.",
|
|
"Your research kitchen is ready. What's on the menu?",
|
|
"Experiments don't run themselves. Oh wait — they do now.",
|
|
"Drop a question. We'll bring the citations.",
|
|
"Vibe first. Discovery follows.",
|
|
"What breakthrough are we cooking today?",
|
|
"Harness the vibe. Start the research.",
|
|
"Ideas in. Discoveries out.",
|
|
]
|
|
|
|
# ASCII art logo — shared by both Rich CLI and Textual TUI banners.
|
|
LOGO_LINES = (
|
|
r" ███████╗ ██╗ ██╗ ██████╗ ███████╗ ██████╗ ██╗ ███████╗ ███╗ ██╗ ████████╗ ██╗ ███████╗ ████████╗",
|
|
r" ██╔════╝ ██║ ██║ ██╔═══██╗ ██╔════╝ ██╔════╝ ██║ ██╔════╝ ████╗ ██║ ╚══██╔══╝ ██║ ██╔════╝ ╚══██╔══╝",
|
|
r" █████╗ ██║ ██║ ██║ ██║ ███████╗ ██║ ██║ █████╗ ██╔██╗ ██║ ██║ ██║ ███████╗ ██║ ",
|
|
r" ██╔══╝ ╚██╗ ██╔╝ ██║ ██║ ╚════██║ ██║ ██║ ██╔══╝ ██║╚██╗██║ ██║ ██║ ╚════██║ ██║ ",
|
|
r" ███████╗ ╚████╔╝ ╚██████╔╝ ███████║ ╚██████╗ ██║ ███████╗ ██║ ╚████║ ██║ ██║ ███████║ ██║ ",
|
|
r" ╚══════╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚══════╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚══════╝ ╚═╝ ",
|
|
)
|
|
|
|
# Blue gradient: deep navy -> royal blue -> sky blue -> cyan
|
|
LOGO_GRADIENT = ["#1a237e", "#1565c0", "#1e88e5", "#42a5f5", "#64b5f6", "#90caf9"]
|
|
|
|
|
|
def build_metadata(workspace_dir: str | None, model: str | None) -> dict:
|
|
"""Build metadata dict for LangGraph checkpoint persistence."""
|
|
return {
|
|
"agent_name": _agent_name(),
|
|
"updated_at": datetime.now(UTC).isoformat(),
|
|
"workspace_dir": workspace_dir or "",
|
|
"model": model or "",
|
|
}
|