Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Gauthier Guinet <43207538+Gguinet@users.noreply.github.com>
Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Stanislas <stanislas.lange@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mathias Gesbert 2026-06-08 14:59:41 +02:00 committed by GitHub
parent 3f8487f761
commit 702d0f412e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 2446 additions and 502 deletions

View file

@ -6,6 +6,19 @@ from dataclasses import dataclass, field
type OnCommandsChanged = Callable[[], Awaitable[None]]
@dataclass(frozen=True)
class AcpCommandAvailabilityContext:
"""Context used to decide whether a command should be advertised."""
vibe_code_enabled: bool = False
def is_teleport_available(self) -> bool:
return self.vibe_code_enabled
type CommandAvailability = Callable[[AcpCommandAvailabilityContext], bool]
@dataclass(frozen=True)
class AcpCommand:
"""Command advertised to ACP clients via available_commands_update."""
@ -14,18 +27,31 @@ class AcpCommand:
description: str
handler: str
input_hint: str | None = None
is_available: CommandAvailability | None = None
@dataclass
class AcpCommandRegistry:
"""Registry of ACP commands. Notifies listeners when commands change."""
availability_context: AcpCommandAvailabilityContext = field(
default_factory=AcpCommandAvailabilityContext
)
_commands: dict[str, AcpCommand] = field(default_factory=dict)
_on_changed: OnCommandsChanged | None = None
def __post_init__(self) -> None:
if not self._commands:
self._commands = _build_commands()
self._commands = {
name: command
for name, command in _build_commands().items()
if self._is_available(command)
}
def _is_available(self, command: AcpCommand) -> bool:
if command.is_available is None:
return True
return command.is_available(self.availability_context)
def set_on_changed(self, callback: OnCommandsChanged) -> None:
self._on_changed = callback
@ -65,6 +91,12 @@ def _build_commands() -> dict[str, AcpCommand]:
description="Show path to current session log directory",
handler="_handle_log",
),
"teleport": AcpCommand(
name="teleport",
description="Teleport session to Vibe Code Web",
handler="_handle_teleport",
is_available=AcpCommandAvailabilityContext.is_teleport_available,
),
"proxy-setup": AcpCommand(
name="proxy-setup",
description="Configure proxy and SSL certificate settings",