v2.4.1 (#475)
Co-authored-by: Quentin Torroba <quentin.torroba@mistral.ai> Co-authored-by: Clement Sirieix <clem.sirieix@gmail.com> Co-authored-by: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
dd372ce494
commit
e9428bce23
54 changed files with 877 additions and 362 deletions
|
|
@ -5,6 +5,7 @@ from pathlib import Path
|
|||
import sys
|
||||
|
||||
from rich import print as rprint
|
||||
import tomli_w
|
||||
|
||||
from vibe import __version__
|
||||
from vibe.cli.textual_ui.app import run_textual_ui
|
||||
|
|
@ -16,8 +17,9 @@ from vibe.core.config import (
|
|||
VibeConfig,
|
||||
load_dotenv_values,
|
||||
)
|
||||
from vibe.core.config.harness_files import get_harness_files_manager
|
||||
from vibe.core.logger import logger
|
||||
from vibe.core.paths.config_paths import CONFIG_FILE, HISTORY_FILE
|
||||
from vibe.core.paths import HISTORY_FILE
|
||||
from vibe.core.programmatic import run_programmatic
|
||||
from vibe.core.session.session_loader import SessionLoader
|
||||
from vibe.core.types import EntrypointMetadata, LLMMessage, OutputFormat, Role
|
||||
|
|
@ -61,16 +63,21 @@ def load_config_or_exit() -> VibeConfig:
|
|||
|
||||
|
||||
def bootstrap_config_files() -> None:
|
||||
if not CONFIG_FILE.path.exists():
|
||||
mgr = get_harness_files_manager()
|
||||
config_file = mgr.user_config_file
|
||||
if not config_file.exists():
|
||||
try:
|
||||
VibeConfig.save_updates(VibeConfig.create_default())
|
||||
config_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
with config_file.open("wb") as f:
|
||||
tomli_w.dump(VibeConfig.create_default(), f)
|
||||
except Exception as e:
|
||||
rprint(f"[yellow]Could not create default config file: {e}[/]")
|
||||
|
||||
if not HISTORY_FILE.path.exists():
|
||||
history_file = HISTORY_FILE.path
|
||||
if not history_file.exists():
|
||||
try:
|
||||
HISTORY_FILE.path.parent.mkdir(parents=True, exist_ok=True)
|
||||
HISTORY_FILE.path.write_text("Hello Vibe!\n", "utf-8")
|
||||
history_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
history_file.write_text("Hello Vibe!\n", "utf-8")
|
||||
except Exception as e:
|
||||
rprint(f"[yellow]Could not create history file: {e}[/]")
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from rich import print as rprint
|
|||
|
||||
from vibe import __version__
|
||||
from vibe.core.agents.models import BuiltinAgentName
|
||||
from vibe.core.paths.config_paths import unlock_config_paths
|
||||
from vibe.core.config.harness_files import init_harness_files_manager
|
||||
from vibe.core.trusted_folders import has_trustable_content, trusted_folders_manager
|
||||
from vibe.setup.trusted_folders.trust_folder_dialog import (
|
||||
TrustDialogQuitException,
|
||||
|
|
@ -152,7 +152,7 @@ def main() -> None:
|
|||
is_interactive = args.prompt is None
|
||||
if is_interactive:
|
||||
check_and_resolve_trusted_folder()
|
||||
unlock_config_paths()
|
||||
init_harness_files_manager("user", "project")
|
||||
|
||||
from vibe.cli.cli import run_cli
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ from vibe.core.agents import AgentProfile
|
|||
from vibe.core.autocompletion.path_prompt_adapter import render_path_prompt
|
||||
from vibe.core.config import Backend, VibeConfig
|
||||
from vibe.core.logger import logger
|
||||
from vibe.core.paths.config_paths import HISTORY_FILE
|
||||
from vibe.core.paths import HISTORY_FILE
|
||||
from vibe.core.session.session_loader import SessionLoader
|
||||
from vibe.core.teleport.types import (
|
||||
TeleportAuthCompleteEvent,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from vibe.cli.textual_ui.external_editor import ExternalEditor
|
|||
from vibe.cli.textual_ui.widgets.chat_input.completion_manager import (
|
||||
MultiCompletionManager,
|
||||
)
|
||||
from vibe.cli.textual_ui.widgets.vscode_compat import patch_vscode_space
|
||||
|
||||
InputMode = Literal["!", "/", ">", "&"]
|
||||
|
||||
|
|
@ -267,10 +268,7 @@ class ChatTextArea(TextArea):
|
|||
event.stop()
|
||||
return
|
||||
|
||||
# Work around VS Code 1.110+ sending space as CSI u (\x1b[32u),
|
||||
# which Textual parses as Key("space", character=None, is_printable=False).
|
||||
if event.key == "space" and event.character is None:
|
||||
event.character = " "
|
||||
patch_vscode_space(event)
|
||||
|
||||
await super()._on_key(event)
|
||||
self._mark_cursor_moved_if_needed()
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from textual.message import Message
|
|||
from textual.widgets import Input, Static
|
||||
|
||||
from vibe.cli.textual_ui.widgets.no_markup_static import NoMarkupStatic
|
||||
from vibe.cli.textual_ui.widgets.vscode_compat import VscodeCompatInput
|
||||
from vibe.core.proxy_setup import (
|
||||
SUPPORTED_PROXY_VARS,
|
||||
get_current_proxy_settings,
|
||||
|
|
@ -48,7 +49,7 @@ class ProxySetupApp(Container):
|
|||
yield Static(f"[bold ansi_blue]{key}[/]", classes="proxy-label-line")
|
||||
|
||||
initial_value = self.initial_values.get(key) or ""
|
||||
input_widget = Input(
|
||||
input_widget = VscodeCompatInput(
|
||||
value=initial_value,
|
||||
placeholder=description,
|
||||
id=f"proxy-input-{key}",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from textual.widgets import Input
|
|||
|
||||
from vibe.cli.textual_ui.ansi_markdown import AnsiMarkdown
|
||||
from vibe.cli.textual_ui.widgets.no_markup_static import NoMarkupStatic
|
||||
from vibe.cli.textual_ui.widgets.vscode_compat import VscodeCompatInput
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vibe.core.tools.builtins.ask_user_question import (
|
||||
|
|
@ -134,7 +135,7 @@ class QuestionApp(Container):
|
|||
with Horizontal(classes="question-other-row"):
|
||||
self.other_prefix = NoMarkupStatic("", classes="question-other-prefix")
|
||||
yield self.other_prefix
|
||||
self.other_input = Input(
|
||||
self.other_input = VscodeCompatInput(
|
||||
placeholder="Type your answer...", classes="question-other-input"
|
||||
)
|
||||
yield self.other_input
|
||||
|
|
|
|||
26
vibe/cli/textual_ui/widgets/vscode_compat.py
Normal file
26
vibe/cli/textual_ui/widgets/vscode_compat.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"""Workarounds for VS Code terminal quirks affecting Textual widgets."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from textual import events
|
||||
from textual.widgets import Input
|
||||
|
||||
|
||||
def patch_vscode_space(event: events.Key) -> None:
|
||||
"""Patch space key events sent as CSI u by VS Code 1.110+.
|
||||
|
||||
VS Code encodes space as ``\\x1b[32u`` (CSI u), which Textual parses as
|
||||
``Key("space", character=None, is_printable=False)``. Input widgets then
|
||||
silently drop the keystroke because there is no printable character.
|
||||
Assigning ``event.character = " "`` restores normal behaviour.
|
||||
"""
|
||||
if event.key == "space" and event.character is None:
|
||||
event.character = " "
|
||||
|
||||
|
||||
class VscodeCompatInput(Input):
|
||||
"""``Input`` subclass that handles the VS Code CSI-u space quirk."""
|
||||
|
||||
async def _on_key(self, event: events.Key) -> None:
|
||||
patch_vscode_space(event)
|
||||
await super()._on_key(event)
|
||||
|
|
@ -8,7 +8,7 @@ from vibe.cli.update_notifier.ports.update_cache_repository import (
|
|||
UpdateCache,
|
||||
UpdateCacheRepository,
|
||||
)
|
||||
from vibe.core.paths.global_paths import VIBE_HOME
|
||||
from vibe.core.paths import VIBE_HOME
|
||||
|
||||
|
||||
class FileSystemUpdateCacheRepository(UpdateCacheRepository):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue