Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(update): add automatic update checker with Slack notifications

cyhhao5c65a7a9bdcd
diff --git a/config/v2_config.py b/config/v2_config.py
index d0af90b85..d99c6ff8e 100644
--- a/config/v2_config.py
+++ b/config/v2_config.py
@@ -83,6 +83,15 @@ class UiConfig:
open_browser: bool = True
+@dataclass
+class UpdateConfig:
+ """Configuration for automatic update checking and installation."""
+ auto_update: bool = True # Auto-install updates when idle
+ check_interval_minutes: int = 10 # How often to check for updates (0 = disable)
+ idle_minutes: int = 30 # Minutes of inactivity before auto-update
+ notify_slack: bool = True # Send Slack notification when update is available
+
+
@dataclass
class V2Config:
mode: str
@@ -92,6 +101,7 @@ class V2Config:
agents: AgentsConfig
gateway: Optional[GatewayConfig] = None
ui: UiConfig = field(default_factory=UiConfig)
+ update: UpdateConfig = field(default_factory=UpdateConfig)
ack_mode: str = "reaction"
@classmethod
@@ -167,6 +177,12 @@ class V2Config:
if not isinstance(ui_payload, dict):
raise ValueError("Config 'ui' must be an object")
ui = UiConfig(**ui_payload)
+
+ update_payload = payload.get("update") or {}
+ if not isinstance(update_payload, dict):
+ raise ValueError("Config 'update' must be an object")
+ update = UpdateConfig(**update_payload)
+
ack_mode = payload.get("ack_mode", "reaction")
if ack_mode not in {"reaction", "message"}:
raise ValueError("Config 'ack_mode' must be 'reaction' or 'message'")
@@ -179,6 +195,7 @@ class V2Config:
agents=agents,
gateway=gateway,
ui=ui,
+ update=update,
ack_mode=ack_mode,
)
@@ -201,6 +218,7 @@ class V2Config:
},
"gateway": self.gateway.__dict__ if self.gateway else None,
"ui": self.ui.__dict__,
+ "update": self.update.__dict__,
"ack_mode": self.ack_mode,
}
path.write_text(json.dumps(payload, indent=2), encoding="utf-8")
diff --git a/core/controller.py b/core/controller.py
index 3644f4f4e..562f2e991 100644
--- a/core/controller.py
+++ b/core/controller.py
@@ -17,6 +17,7 @@ from core.handlers import (
SettingsHandler,
MessageHandler,
)
+from core.update_checker import UpdateChecker
logger = logging.getLogger(__name__)
@@ -53,6 +54,9 @@ class Controller:
# Background task for cleanup
self.cleanup_task: Optional[asyncio.Task] = None
+ # Initialize update checker
+ self.update_checker = UpdateChecker(self, config.update)
+
# Restore session mappings on startup (after handlers are initialized)
self.session_handler.restore_session_mappings()
@@ -89,7 +93,8 @@ class Controller:
from modules.im.slack import SlackBot
if isinstance(self.im_client, SlackBot):
self.im_client.set_settings_manager(self.settings_manager)
- logger.info("Injected settings_manager into SlackBot for thread tracking")
+ self.im_client.set_controller(self)
+ logger.info("Injected settings_manager and controller into SlackBot")
def _init_handlers(self):
"""Initialize all handlers with controller reference"""
@@ -155,6 +160,13 @@ class Controller:
except Exception as e:
logger.error(f"Failed to restore active polls: {e}", exc_info=True)
+ # Start update checker and send any pending post-update notification
+ try:
+ await self.update_checker.check_and_send_post_update_notification()
+ self.update_checker.start()
+ except Exception as e:
+ logger.error(f"Failed to start update checker: {e}", exc_info=True)
+
# Utility methods used by handlers
def get_cwd(self, context: MessageContext) -> str:
@@ -702,6 +714,12 @@ class Controller:
"""Best-effort synchronous cleanup without cross-loop awaits"""
logger.info("Cleaning up controller resources (sync, best-effort)...")
+ # Stop update checker
+ try:
+ self.update_checker.stop()
+ except Exception as e:
+ logger.debug(f"Update checker cleanup skipped: {e}")
+
# Cancel receiver tasks without awaiting (they may belong to other loops)
try:
for session_id, task in list(self.receiver_tasks.items()):
diff --git a/core/handlers/message_handler.py b/core/handlers/message_handler.py
index 507e07b8a..bf1ffddab 100644
--- a/core/handlers/message_handler.py
+++ b/core/handlers/message_handler.py
@@ -47,6 +47,10 @@ class MessageHandler:
async def handle_user_message(self, context: MessageContext, message: str):
"""Process regular user messages and route to configured agent"""
try:
+ # Record user activity for auto-update idle detection
+ if hasattr(self.controller, 'update_checker'):
+ self.controller.update_checker.record_activity()
+
# If message is empty (e.g., user just @mentioned bot without text),
# trigger the /start command instead of sending empty message to agent
if not message or not message.strip():
diff --git a/core/update_checker.py b/core/update_checker.py
new file mode 100644
index 000000000..7f1b63a0c
--- /dev/null
+++ b/core/update_checker.py
@@ -0,0 +1,417 @@
+"""
+Automatic update checker and installer.
+
+This module provides:
+1. Periodic checking for new versions on PyPI
+2. Slack notifications to workspace owner when updates are available
+3. Automatic update installation when the system is idle
+"""
+
+import asyncio
+import json
+import logging
+import shutil
+import subprocess
+import sys
+import time
+import urllib.request
+from dataclasses import dataclass, field
+from pathlib import Path
+from typing import TYPE_CHECKING, Any, Dict, Optional
+
+from config import paths
+from config.v2_config import UpdateConfig
+
+if TYPE_CHECKING:
+ from core.controller import Controller
+
+logger = logging.getLogger(__name__)
+
+# Action ID for the update button in Slack
+UPDATE_BUTTON_ACTION_ID = "vibe_update_now"
+
+
+@dataclass
+class UpdateState:
+ """Persistent state for update tracking."""
+ notified_version: Optional[str] = None
+ notified_at: Optional[str] = None
+ last_check_at: Optional[str] = None
+ last_activity_at: Optional[float] = None
+
+ @classmethod
+ def load(cls) -> "UpdateState":
+ path = cls._get_path()
+ if not path.exists():
+ return cls()
+ try:
+ data = json.loads(path.read_text(encoding="utf-8"))
+ return cls(
+ notified_version=data.get("notified_version"),
+ notified_at=data.get("notified_at"),
+ last_check_at=data.get("last_check_at"),
+ last_activity_at=data.get("last_activity_at"),
+ )
+ except Exception as e:
+ logger.warning(f"Failed to load update state: {e}")
+ return cls()
+
+ def save(self) -> None:
+ path = self._get_path()
+ path.parent.mkdir(parents=True, exist_ok=True)
+ data = {
+ "notified_version": self.notified_version,
+ "notified_at": self.notified_at,
+ "last_check_at": self.last_check_at,
+ "last_activity_at": self.last_activity_at,
+ }
+ path.write_text(json.dumps(data, indent=2), encoding="utf-8")
+
+ @staticmethod
+ def _get_path() -> Path:
+ return paths.get_state_dir() / "update_state.json"
+
+
+class UpdateChecker:
+ """Handles automatic update checking and installation."""
+
+ def __init__(self, controller: "Controller", config: UpdateConfig):
+ self.controller = controller
+ self.config = config
+ self.state = UpdateState.load()
+ self._check_task: Optional[asyncio.Task] = None
+ self._running = False
+
+ def start(self) -> None:
+ """Start the periodic update checker."""
+ if self._running:
+ return
+ if self.config.check_interval_minutes <= 0:
+ logger.info("Update checker disabled (check_interval_minutes=0)")
+ return
+
+ self._running = True
+ self._check_task = asyncio.create_task(self._check_loop())
+ logger.info(
+ f"Update checker started (interval={self.config.check_interval_minutes}min, "
+ f"auto_update={self.config.auto_update}, idle_minutes={self.config.idle_minutes})"
+ )
+
+ def stop(self) -> None:
+ """Stop the periodic update checker."""
+ self._running = False
+ if self._check_task:
+ self._check_task.cancel()
+ self._check_task = None
+
+ def record_activity(self) -> None:
+ """Record user activity (called when a Slack message is received)."""
+ self.state.last_activity_at = time.time()
+ self.state.save()
+
+ async def _check_loop(self) -> None:
+ """Main loop for periodic update checking."""
+ # Initial delay to let the service fully start
+ await asyncio.sleep(30)
+
+ while self._running:
+ try:
+ await self._do_check()
+ except asyncio.CancelledError:
+ break
+ except Exception as e:
+ logger.error(f"Update check failed: {e}", exc_info=True)
+
+ # Wait for next check interval
+ await asyncio.sleep(self.config.check_interval_minutes * 60)
+
+ async def _do_check(self) -> None:
+ """Perform a single update check."""
+ version_info = self._get_version_info()
+
+ self.state.last_check_at = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
+ self.state.save()
+
+ if version_info.get("error"):
+ logger.warning(f"Failed to check for updates: {version_info['error']}")
+ return
+
+ if not version_info.get("has_update"):
+ logger.debug(f"No update available (current={version_info['current']})")
+ return
+
+ latest = version_info["latest"]
+ current = version_info["current"]
+ logger.info(f"Update available: {current} -> {latest}")
+
+ # Notification flow (independent)
+ if self.config.notify_slack and self.state.notified_version != latest:
+ await self._send_slack_notification(current, latest)
+ self.state.notified_version = latest
+ self.state.notified_at = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
+ self.state.save()
+
+ # Auto-update flow (independent)
+ if self.config.auto_update and self._is_idle():
+ logger.info("System is idle, performing auto-update...")
+ await self._perform_update(latest)
+
+ def _get_version_info(self) -> Dict[str, Any]:
+ """Get current version and check for updates from PyPI."""
+ from vibe import __version__
+
+ current = __version__
+ result = {"current": current, "latest": None, "has_update": False, "error": None}
+
+ try:
+ url = "https://pypi.org/pypi/vibe-remote/json"
+ req = urllib.request.Request(url, headers={"User-Agent": "vibe-remote"})
+ with urllib.request.urlopen(req, timeout=10) as resp:
+ data = json.loads(resp.read().decode("utf-8"))
+ latest = data.get("info", {}).get("version", "")
+ result["latest"] = latest
+
+ if latest and latest != current:
+ try:
+ current_parts = [int(x) for x in current.split(".")[:3] if x.isdigit()]
+ latest_parts = [int(x) for x in latest.split(".")[:3] if x.isdigit()]
+ result["has_update"] = latest_parts > current_parts
+ except (ValueError, AttributeError):
+ result["has_update"] = latest != current
+ except Exception as e:
+ result["error"] = str(e)
+
+ return result
+
+ def _is_idle(self) -> bool:
+ """Check if the system is idle (no active sessions and no recent activity)."""
+ # Check for active agent sessions
+ if self._has_active_sessions():
+ logger.debug("Not idle: has active sessions")
+ return False
+
+ # Check for recent activity
+ if self.state.last_activity_at:
+ idle_seconds = time.time() - self.state.last_activity_at
+ idle_minutes = idle_seconds / 60
+ if idle_minutes < self.config.idle_minutes:
+ logger.debug(f"Not idle: last activity {idle_minutes:.1f} minutes ago")
+ return False
+
+ return True
+
+ def _has_active_sessions(self) -> bool:
+ """Check if any agent has active sessions."""
+ try:
+ # Check OpenCode active polls
+ if hasattr(self.controller, 'settings_manager'):
+ active_polls = self.controller.settings_manager.get_all_active_polls()
+ if active_polls:
+ return True
+
+ # Check Claude sessions
+ if hasattr(self.controller, 'claude_sessions') and self.controller.claude_sessions:
+ return True
+
+ # Check Codex active processes
+ if hasattr(self.controller, 'agent_service'):
+ codex = self.controller.agent_service.agents.get("codex")
+ if codex and hasattr(codex, 'active_processes') and codex.active_processes:
+ return True
+ except Exception as e:
+ logger.warning(f"Error checking active sessions: {e}")
+
+ return False
+
+ async def _get_workspace_owner_id(self) -> Optional[str]:
+ """Get the Slack workspace primary owner's user ID."""
+ try:
+ im_client = self.controller.im_client
+ if not im_client or not hasattr(im_client, 'web_client'):
+ return None
+
+ response = await im_client.web_client.users_list()
+ if not response.get("ok"):
+ return None
+
+ for member in response.get("members", []):
+ if member.get("is_primary_owner"):
+ return member.get("id")
+
+ # Fallback to any owner if no primary owner found
+ for member in response.get("members", []):
+ if member.get("is_owner"):
+ return member.get("id")
+ except Exception as e:
+ logger.warning(f"Failed to get workspace owner: {e}")
+
+ return None
+
+ async def _send_slack_notification(self, current: str, latest: str) -> None:
+ """Send a Slack notification about the available update."""
+ owner_id = await self._get_workspace_owner_id()
+ if not owner_id:
+ logger.warning("Cannot send update notification: no workspace owner found")
+ return
+
+ try:
+ im_client = self.controller.im_client
+ blocks = [
+ {
+ "type": "section",
+ "text": {
+ "type": "mrkdwn",
+ "text": f":rocket: *Vibe Remote Update Available*\n\n"
+ f"A new version is available: `{current}` → `{latest}`"
+ }
+ },
+ {
+ "type": "actions",
+ "elements": [
+ {
+ "type": "button",
+ "text": {
+ "type": "plain_text",
+ "text": "Update Now",
+ "emoji": True
+ },
+ "style": "primary",
+ "action_id": UPDATE_BUTTON_ACTION_ID,
+ "value": latest
+ }
+ ]
+ }
+ ]
+
+ await im_client.web_client.chat_postMessage(
+ channel=owner_id,
+ text=f"Vibe Remote update available: {current} → {latest}",
+ blocks=blocks
+ )
+ logger.info(f"Sent update notification to workspace owner {owner_id}")
+ except Exception as e:
+ logger.error(f"Failed to send update notification: {e}")
+
+ async def _perform_update(self, target_version: str) -> None:
+ """Perform the actual update and restart."""
+ logger.info(f"Starting auto-update to version {target_version}")
+
+ # Write a marker file so we can send confirmation after restart
+ self._write_update_marker(target_version)
+
+ # Perform the upgrade
+ exe_path = sys.executable
+ is_uv_tool = ".local/share/uv/tools/" in exe_path or "/uv/tools/" in exe_path
+ uv_path = shutil.which("uv")
+
+ if is_uv_tool and uv_path:
+ cmd = [uv_path, "tool", "upgrade", "vibe-remote"]
+ else:
+ cmd = [sys.executable, "-m", "pip", "install", "--upgrade", "vibe-remote"]
+
+ try:
+ result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
+ if result.returncode == 0:
+ logger.info("Upgrade successful, restarting...")
+ # Schedule restart
+ vibe_path = shutil.which("vibe")
+ if vibe_path:
+ subprocess.Popen(
+ f"sleep 2 && {vibe_path}",
+ shell=True,
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL,
+ start_new_session=True,
+ )
+ else:
+ logger.error(f"Upgrade failed: {result.stderr}")
+ self._remove_update_marker()
+ except Exception as e:
+ logger.error(f"Upgrade failed: {e}")
+ self._remove_update_marker()
+
+ def _write_update_marker(self, version: str) -> None:
+ """Write a marker file to trigger post-update notification."""
+ marker_path = paths.get_state_dir() / "pending_update_notification.json"
+ marker_path.write_text(json.dumps({
+ "version": version,
+ "updated_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
+ }), encoding="utf-8")
+
+ def _remove_update_marker(self) -> None:
+ """Remove the update marker file."""
+ marker_path = paths.get_state_dir() / "pending_update_notification.json"
+ marker_path.unlink(missing_ok=True)
+
+ async def check_and_send_post_update_notification(self) -> None:
+ """Check for pending update notification and send it (called on startup)."""
+ marker_path = paths.get_state_dir() / "pending_update_notification.json"
+ if not marker_path.exists():
+ return
+
+ try:
+ data = json.loads(marker_path.read_text(encoding="utf-8"))
+ version = data.get("version")
+
+ owner_id = await self._get_workspace_owner_id()
+ if owner_id:
+ from vibe import __version__
+ im_client = self.controller.im_client
+ await im_client.web_client.chat_postMessage(
+ channel=owner_id,
+ text=f":white_check_mark: Vibe Remote has been updated to `{__version__}`"
+ )
+ logger.info(f"Sent post-update notification to {owner_id}")
+ except Exception as e:
+ logger.error(f"Failed to send post-update notification: {e}")
+ finally:
+ marker_path.unlink(missing_ok=True)
+
+
+async def handle_update_button_click(controller: "Controller", payload: Dict[str, Any]) -> None:
+ """Handle the 'Update Now' button click from Slack."""
+ try:
+ user_id = payload.get("user", {}).get("id")
+ channel_id = payload.get("channel", {}).get("id")
+ message_ts = payload.get("message", {}).get("ts")
+
+ im_client = controller.im_client
+
+ # Acknowledge the button click with a loading message
+ await im_client.web_client.chat_update(
+ channel=channel_id,
+ ts=message_ts,
+ text="Updating Vibe Remote...",
+ blocks=[
+ {
+ "type": "section",
+ "text": {
+ "type": "mrkdwn",
+ "text": ":hourglass_flowing_sand: *Updating Vibe Remote...*\n\nPlease wait, the service will restart shortly."
+ }
+ }
+ ]
+ )
+
+ # Perform the update
+ if hasattr(controller, 'update_checker'):
+ version_info = controller.update_checker._get_version_info()
+ if version_info.get("has_update"):
+ await controller.update_checker._perform_update(version_info["latest"])
+ else:
+ await im_client.web_client.chat_update(
+ channel=channel_id,
+ ts=message_ts,
+ text="Already up to date",
+ blocks=[
+ {
+ "type": "section",
+ "text": {
+ "type": "mrkdwn",
+ "text": ":white_check_mark: Already running the latest version."
+ }
+ }
+ ]
+ )
+ except Exception as e:
+ logger.error(f"Failed to handle update button click: {e}", exc_info=True)
diff --git a/modules/im/slack.py b/modules/im/slack.py
index 44ed2c911..91e856902 100644
--- a/modules/im/slack.py
+++ b/modules/im/slack.py
@@ -46,6 +46,8 @@ class SlackBot(BaseIMClient):
# Settings manager for thread tracking (will be injected later)
self.settings_manager = None
+ # Controller reference for update button handling (will be injected later)
+ self._controller = None
self._recent_event_ids: Dict[str, float] = {}
self._stop_event: Optional[asyncio.Event] = None
self._loop: Optional[asyncio.AbstractEventLoop] = None
@@ -55,6 +57,10 @@ class SlackBot(BaseIMClient):
"""Set the settings manager for thread tracking"""
self.settings_manager = settings_manager
+ def set_controller(self, controller):
+ """Set the controller reference for handling update button clicks"""
+ self._controller = controller
+
def _is_duplicate_event(self, event_id: Optional[str]) -> bool:
"""Deduplicate Slack events using event_id with a short TTL."""
if not event_id:
@@ -733,6 +739,14 @@ class SlackBot(BaseIMClient):
actions = payload.get("actions", [])
view = payload.get("view", {})
+ # Check for update button click (handled before channel authorization)
+ for action in actions:
+ if action.get("action_id") == "vibe_update_now":
+ from core.update_checker import handle_update_button_click
+ if hasattr(self, "_controller") and self._controller:
+ await handle_update_button_click(self._controller, payload)
+ return
+
# In Slack modals, `channel` is often missing. We store the originating
# channel_id in `view.private_metadata` when opening the modal.
channel_id = (
diff --git a/ui/src/components/VersionBadge.tsx b/ui/src/components/VersionBadge.tsx
index 19ab6b8a9..d81d15f19 100644
--- a/ui/src/components/VersionBadge.tsx
+++ b/ui/src/components/VersionBadge.tsx
@@ -13,11 +13,14 @@ export const VersionBadge: React.FC = () => {
const [upgrading, setUpgrading] = React.useState(false);
const [restarting, setRestarting] = React.useState(false);
const [upgradeResult, setUpgradeResult] = React.useState<UpgradeResult | null>(null);
+ const [autoUpdate, setAutoUpdate] = React.useState<boolean | null>(null);
+ const [savingAutoUpdate, setSavingAutoUpdate] = React.useState(false);
const popupRef = React.useRef<HTMLDivElement>(null);
- // Check version on mount
+ // Check version and load config on mount
React.useEffect(() => {
checkVersion();
+ loadAutoUpdateSetting();
}, []);
// Close popup when clicking outside
@@ -33,6 +36,35 @@ export const VersionBadge: React.FC = () => {
return () => document.removeEventListener('mousedown', handleClickOutside);
}, [isPopupOpen]);
+ const loadAutoUpdateSetting = async () => {
+ try {
+ const config = await api.getConfig();
+ setAutoUpdate(config.update?.auto_update ?? true);
+ } catch (e) {
+ console.error('Failed to load config:', e);
+ }
+ };
+
+ const handleAutoUpdateToggle = async (enabled: boolean) => {
+ setSavingAutoUpdate(true);
+ try {
+ const config = await api.getConfig();
+ const updatedConfig = {
+ ...config,
+ update: {
+ ...config.update,
+ auto_update: enabled,
+ },
+ };
+ await api.saveConfig(updatedConfig);
+ setAutoUpdate(enabled);
+ } catch (e) {
+ console.error('Failed to save auto-update setting:', e);
+ } finally {
+ setSavingAutoUpdate(false);
+ }
+ };
+
const checkVersion = async () => {
setChecking(true);
try {
@@ -171,6 +203,26 @@ export const VersionBadge: React.FC = () => {
<span>{t('dashboard.restarting')}</span>
</div>
)}
+
+ {/* Auto Update Toggle */}
+ {autoUpdate !== null && (
+ <div className="flex items-center justify-between pt-2 border-t border-border">
+ <div>
+ <span className="text-sm text-text">{t('dashboard.autoUpdate')}</span>
+ <p className="text-xs text-muted">{t('dashboard.autoUpdateHint')}</p>
+ </div>
+ <label className="relative inline-flex items-center cursor-pointer">
+ <input
+ type="checkbox"
+ checked={autoUpdate}
+ onChange={(e) => handleAutoUpdateToggle(e.target.checked)}
+ disabled={savingAutoUpdate}
+ className="sr-only peer"
+ />
+ <div className="w-9 h-5 bg-neutral-200 rounded-full peer peer-checked:bg-green-500 peer-focus:ring-2 peer-focus:ring-green-200 after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:after:translate-x-4"></div>
+ </label>
+ </div>
+ )}
</div>
{/* Actions */}
diff --git a/ui/src/components/steps/Summary.tsx b/ui/src/components/steps/Summary.tsx
index bbc4d3fc2..6e2a3d4b8 100644
--- a/ui/src/components/steps/Summary.tsx
+++ b/ui/src/components/steps/Summary.tsx
@@ -20,6 +20,7 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
const [saving, setSaving] = useState(false);
const [error, setError] = useState<string | null>(null);
const [requireMention, setRequireMention] = useState(data.slack?.require_mention || false);
+ const [autoUpdate, setAutoUpdate] = useState(data.update?.auto_update ?? true);
const navigate = useNavigate();
const saveAll = async () => {
@@ -32,6 +33,10 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
...data.slack,
require_mention: requireMention,
},
+ update: {
+ ...data.update,
+ auto_update: autoUpdate,
+ },
};
const configPayload = buildConfigPayload(updatedData);
await api.saveConfig(configPayload);
@@ -90,6 +95,25 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
</div>
</div>
+ {/* Auto Update Setting */}
+ <div className="bg-panel border border-border rounded-lg p-4 shadow-sm">
+ <div className="flex justify-between items-center">
+ <div>
+ <h3 className="text-sm font-medium text-text">{t('summary.autoUpdate')}</h3>
+ <p className="text-xs text-muted mt-1">{t('summary.autoUpdateHint')}</p>
+ </div>
+ <label className="relative inline-flex items-center cursor-pointer">
+ <input
+ type="checkbox"
+ checked={autoUpdate}
+ onChange={(e) => setAutoUpdate(e.target.checked)}
+ className="sr-only peer"
+ />
+ <div className="w-11 h-6 bg-border rounded-full peer peer-checked:bg-success peer-focus:ring-2 peer-focus:ring-success/20 after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:after:translate-x-full"></div>
+ </label>
+ </div>
+ </div>
+
{/* Usage Tips */}
<div className="bg-panel border border-border rounded-lg p-4 shadow-sm">
<h3 className="text-sm font-medium text-text mb-3">{t('summary.usageTips')}</h3>
@@ -203,6 +227,12 @@ const buildConfigPayload = (data: any) => {
setup_port: data.ui?.setup_port || 5123,
open_browser: true,
},
+ update: {
+ auto_update: data.update?.auto_update ?? true,
+ check_interval_minutes: data.update?.check_interval_minutes ?? 10,
+ idle_minutes: data.update?.idle_minutes ?? 30,
+ notify_slack: data.update?.notify_slack ?? true,
+ },
};
};
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 9fd223919..d7d850ae0 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -155,6 +155,8 @@
"channelsConfigured": "Channels Configured",
"requireMention": "Require @Mention",
"requireMentionHint": "Bot only responds when @mentioned in channels",
+ "autoUpdate": "Auto Update",
+ "autoUpdateHint": "Automatically install updates when system is idle",
"usageTips": "Quick Start Guide",
"tipStartCommand": "Use @Vibe Remote /start to begin",
"tipStartCommandDesc": "Type @Vibe Remote /start in any enabled channel to open the control panel.",
@@ -209,7 +211,9 @@
"upgradeSuccess": "Upgrade successful!",
"upgradeFailed": "Upgrade failed",
"updateHint": "Update from {{from}} to {{to}}",
- "restarting": "Restarting..."
+ "restarting": "Restarting...",
+ "autoUpdate": "Auto Update",
+ "autoUpdateHint": "Auto-install when idle"
},
"doctor": {
"title": "System Status",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 6ef1ab441..b790d08f4 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -155,6 +155,8 @@
"channelsConfigured": "已配置的频道",
"requireMention": "需要 @提及",
"requireMentionHint": "机器人仅在被 @提及时响应",
+ "autoUpdate": "自动更新",
+ "autoUpdateHint": "系统空闲时自动安装更新",
"usageTips": "快速上手",
"tipStartCommand": "使用 @Vibe Remote /start 开始",
"tipStartCommandDesc": "在任意已启用的频道输入 @Vibe Remote /start 打开控制面板。",
@@ -209,7 +211,9 @@
"upgradeSuccess": "更新成功!",
"upgradeFailed": "更新失败",
"updateHint": "从 {{from}} 更新到 {{to}}",
- "restarting": "正在重启..."
+ "restarting": "正在重启...",
+ "autoUpdate": "自动更新",
+ "autoUpdateHint": "空闲时自动安装"
},
"doctor": {
"title": "系统状态",
diff --git a/vibe/api.py b/vibe/api.py
index 178f972ed..af5489442 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -62,6 +62,7 @@ def config_to_payload(config: V2Config) -> dict:
},
"gateway": config.gateway.__dict__ if config.gateway else None,
"ui": config.ui.__dict__,
+ "update": config.update.__dict__,
"ack_mode": config.ack_mode,
}
return payload