v1.3.3
This commit is contained in:
parent
08d8e85447
commit
4d449be276
14 changed files with 65 additions and 46 deletions
|
|
@ -3,4 +3,4 @@ from __future__ import annotations
|
|||
from pathlib import Path
|
||||
|
||||
VIBE_ROOT = Path(__file__).parent
|
||||
__version__ = "1.3.2"
|
||||
__version__ = "1.3.3"
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class BottomApp(StrEnum):
|
|||
Input = auto()
|
||||
|
||||
|
||||
class VibeApp(App):
|
||||
class VibeApp(App): # noqa: PLR0904
|
||||
ENABLE_COMMAND_PALETTE = False
|
||||
CSS_PATH = "app.tcss"
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ class VibeApp(App):
|
|||
**kwargs: Any,
|
||||
) -> None:
|
||||
super().__init__(**kwargs)
|
||||
self.config = config
|
||||
self._config = config
|
||||
self._current_agent_mode = initial_mode
|
||||
self.enable_streaming = enable_streaming
|
||||
self.agent: Agent | None = None
|
||||
|
|
@ -147,6 +147,10 @@ class VibeApp(App):
|
|||
self._last_escape_time: float | None = None
|
||||
self._terminal_theme = capture_terminal_theme()
|
||||
|
||||
@property
|
||||
def config(self) -> VibeConfig:
|
||||
return self.agent.config if self.agent else self._config
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
with VerticalScroll(id="chat"):
|
||||
yield WelcomeBanner(self.config)
|
||||
|
|
@ -704,8 +708,8 @@ class VibeApp(App):
|
|||
|
||||
if self.agent:
|
||||
await self.agent.reload_with_initial_messages(config=new_config)
|
||||
|
||||
self.config = new_config
|
||||
else:
|
||||
self._config = new_config
|
||||
if self._context_progress:
|
||||
if self.config.auto_compact_threshold > 0:
|
||||
current_tokens = (
|
||||
|
|
|
|||
|
|
@ -104,8 +104,8 @@ class Agent:
|
|||
self._max_turns = max_turns
|
||||
self._max_price = max_price
|
||||
|
||||
self.tool_manager = ToolManager(config)
|
||||
self.skill_manager = SkillManager(config)
|
||||
self.tool_manager = ToolManager(lambda: self.config)
|
||||
self.skill_manager = SkillManager(lambda: self.config)
|
||||
self.format_handler = APIToolFormatHandler()
|
||||
|
||||
self.backend_factory = lambda: backend or self._select_backend()
|
||||
|
|
@ -870,8 +870,8 @@ class Agent:
|
|||
if max_price is not None:
|
||||
self._max_price = max_price
|
||||
|
||||
self.tool_manager = ToolManager(self.config)
|
||||
self.skill_manager = SkillManager(self.config)
|
||||
self.tool_manager = ToolManager(lambda: self.config)
|
||||
self.skill_manager = SkillManager(lambda: self.config)
|
||||
|
||||
new_system_prompt = get_universal_system_prompt(
|
||||
self.tool_manager, self.config, self.skill_manager
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from logging import getLogger
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
|
@ -16,9 +17,9 @@ logger = getLogger("vibe")
|
|||
|
||||
|
||||
class SkillManager:
|
||||
def __init__(self, config: VibeConfig) -> None:
|
||||
self._config = config
|
||||
self._search_paths = self._compute_search_paths(config)
|
||||
def __init__(self, config_getter: Callable[[], VibeConfig]) -> None:
|
||||
self._config_getter = config_getter
|
||||
self._search_paths = self._compute_search_paths(self._config)
|
||||
self.available_skills = self._discover_skills()
|
||||
|
||||
if self.available_skills:
|
||||
|
|
@ -28,6 +29,10 @@ class SkillManager:
|
|||
len(self._search_paths),
|
||||
)
|
||||
|
||||
@property
|
||||
def _config(self) -> VibeConfig:
|
||||
return self._config_getter()
|
||||
|
||||
@staticmethod
|
||||
def _compute_search_paths(config: VibeConfig) -> list[Path]:
|
||||
paths: list[Path] = []
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterator
|
||||
from collections.abc import Callable, Iterator
|
||||
import importlib.util
|
||||
import inspect
|
||||
from logging import getLogger
|
||||
|
|
@ -38,16 +38,20 @@ class ToolManager:
|
|||
should have its own ToolManager instance.
|
||||
"""
|
||||
|
||||
def __init__(self, config: VibeConfig) -> None:
|
||||
self._config = config
|
||||
def __init__(self, config_getter: Callable[[], VibeConfig]) -> None:
|
||||
self._config_getter = config_getter
|
||||
self._instances: dict[str, BaseTool] = {}
|
||||
self._search_paths: list[Path] = self._compute_search_paths(config)
|
||||
self._search_paths: list[Path] = self._compute_search_paths(self._config)
|
||||
|
||||
self._available: dict[str, type[BaseTool]] = {
|
||||
cls.get_name(): cls for cls in self._iter_tool_classes(self._search_paths)
|
||||
}
|
||||
self._integrate_mcp()
|
||||
|
||||
@property
|
||||
def _config(self) -> VibeConfig:
|
||||
return self._config_getter()
|
||||
|
||||
@staticmethod
|
||||
def _compute_search_paths(config: VibeConfig) -> list[Path]:
|
||||
paths: list[Path] = [DEFAULT_TOOL_DIR.path]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue