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.

fix(remote-access): polish vibe cloud pairing

cyh6a355d534fa2
diff --git a/ui/src/components/RemoteAccess.tsx b/ui/src/components/RemoteAccess.tsx
index 07f2e58b0..c280e32b1 100644
--- a/ui/src/components/RemoteAccess.tsx
+++ b/ui/src/components/RemoteAccess.tsx
@@ -4,6 +4,8 @@ import { useTranslation } from 'react-i18next';
import { useApi } from '../context/ApiContext';
import { useToast } from '../context/ToastContext';
+const VIBE_CLOUD_URL = 'https://avibe.bot';
+
export const RemoteAccess: React.FC = () => {
const { t } = useTranslation();
const api = useApi();
@@ -11,8 +13,8 @@ export const RemoteAccess: React.FC = () => {
const [loading, setLoading] = useState(true);
const [pairing, setPairing] = useState(false);
const [status, setStatus] = useState<any>(null);
- const [backendUrl, setBackendUrl] = useState('https://avibe.bot');
const [pairingKey, setPairingKey] = useState('');
+ const [reconfiguring, setReconfiguring] = useState(false);
const [actionMessage, setActionMessage] = useState<{ type: 'success' | 'error'; text: string } | null>(null);
const describeError = (payload: any) => {
@@ -26,9 +28,8 @@ export const RemoteAccess: React.FC = () => {
const refresh = async () => {
setLoading(true);
try {
- const [config, remoteStatus] = await Promise.all([api.getConfig(), api.remoteAccessStatus()]);
+ const remoteStatus = await api.remoteAccessStatus();
setStatus(remoteStatus);
- setBackendUrl(config?.remote_access?.vibe_cloud?.backend_url || 'https://avibe.bot');
} finally {
setLoading(false);
}
@@ -43,7 +44,7 @@ export const RemoteAccess: React.FC = () => {
setActionMessage(null);
try {
const result = await api.pairVibeCloudRemoteAccess({
- backend_url: backendUrl.trim(),
+ backend_url: VIBE_CLOUD_URL,
pairing_key: pairingKey.trim(),
device_name: 'Vibe Remote',
});
@@ -55,6 +56,7 @@ export const RemoteAccess: React.FC = () => {
showToast(message, 'error');
} else {
const message = t('remoteAccess.pairSuccess');
+ setReconfiguring(false);
setActionMessage({ type: 'success', text: message });
showToast(message, 'success');
}
@@ -110,6 +112,7 @@ export const RemoteAccess: React.FC = () => {
const publicUrl = status?.public_url;
const paired = Boolean(status?.paired);
const running = Boolean(status?.running);
+ const showPairingForm = !paired || reconfiguring;
const connectorState = status?.pid_state === 'unknown'
? t('remoteAccess.stateNeedsAttention')
: running
@@ -135,40 +138,77 @@ export const RemoteAccess: React.FC = () => {
<div>
<h2 className="text-xl font-semibold flex items-center gap-2">
<KeyRound className="w-5 h-5 text-accent" />
- {t('remoteAccess.connectTitle')}
+ {paired && !reconfiguring ? t('remoteAccess.configuredTitle') : t('remoteAccess.connectTitle')}
</h2>
- <p className="text-sm text-muted mt-1">{t('remoteAccess.connectDesc')}</p>
+ <p className="text-sm text-muted mt-1">
+ {paired && !reconfiguring ? t('remoteAccess.configuredDesc') : t('remoteAccess.connectDesc')}
+ </p>
+ </div>
+
+ <div className="rounded-xl border border-border bg-neutral-50 p-4 text-sm">
+ <div className="text-muted">{t('remoteAccess.vibeCloudService')}</div>
+ <a className="mt-1 inline-flex items-center gap-2 font-medium text-accent" href={VIBE_CLOUD_URL} target="_blank" rel="noreferrer">
+ {VIBE_CLOUD_URL}
+ <ExternalLink className="h-4 w-4" />
+ </a>
</div>
- <label className="block space-y-2">
- <span className="text-sm font-medium">{t('remoteAccess.backendUrl')}</span>
- <input
- className="w-full rounded-lg border border-border bg-bg px-3 py-2"
- value={backendUrl}
- onChange={(event) => setBackendUrl(event.target.value)}
- placeholder="https://avibe.bot"
- />
- </label>
-
- <label className="block space-y-2">
- <span className="text-sm font-medium">{t('remoteAccess.pairingKey')}</span>
- <input
- className="w-full rounded-lg border border-border bg-bg px-3 py-2 font-mono"
- value={pairingKey}
- onChange={(event) => setPairingKey(event.target.value)}
- placeholder="vrp_xxxxxxxxxxxxxxxxx"
- />
- </label>
-
- <button
- type="button"
- className="inline-flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-white font-medium disabled:opacity-50"
- disabled={pairing || !pairingKey.trim() || !backendUrl.trim()}
- onClick={pair}
- >
- <Link2 className="w-4 h-4" />
- {pairing ? t('remoteAccess.pairing') : t('remoteAccess.pair')}
- </button>
+ {showPairingForm ? (
+ <>
+ <label className="block space-y-2">
+ <span className="text-sm font-medium">{t('remoteAccess.pairingKey')}</span>
+ <input
+ className="w-full rounded-lg border border-border bg-bg px-3 py-2 font-mono"
+ value={pairingKey}
+ onChange={(event) => setPairingKey(event.target.value)}
+ placeholder="vrp_xxxxxxxxxxxxxxxxx"
+ />
+ <span className="block text-xs text-muted">{t('remoteAccess.pairingKeyHelp')}</span>
+ </label>
+
+ <div className="flex flex-wrap gap-3">
+ <button
+ type="button"
+ className="inline-flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-white font-medium disabled:opacity-50"
+ disabled={pairing || !pairingKey.trim()}
+ onClick={pair}
+ >
+ <Link2 className="w-4 h-4" />
+ {pairing ? t('remoteAccess.pairing') : t('remoteAccess.pair')}
+ </button>
+ {paired && (
+ <button
+ type="button"
+ className="rounded-lg border border-border px-4 py-2"
+ onClick={() => {
+ setReconfiguring(false);
+ setPairingKey('');
+ }}
+ >
+ {t('common.cancel')}
+ </button>
+ )}
+ </div>
+ </>
+ ) : (
+ <div className="rounded-xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-950">
+ <div className="flex items-start gap-3">
+ <CheckCircle2 className="mt-0.5 h-4 w-4 shrink-0" />
+ <div className="min-w-0 flex-1">
+ <div className="font-semibold">{t('remoteAccess.configuredBadge')}</div>
+ <div className="mt-1">{t('remoteAccess.configuredHelp')}</div>
+ {publicUrl && <div className="mt-2 truncate font-mono text-xs">{publicUrl}</div>}
+ </div>
+ </div>
+ <button
+ type="button"
+ className="mt-4 rounded-lg border border-emerald-300 px-3 py-2 font-medium"
+ onClick={() => setReconfiguring(true)}
+ >
+ {t('remoteAccess.repair')}
+ </button>
+ </div>
+ )}
<div className="rounded-xl border border-cyan-200 bg-cyan-50 p-4 text-sm text-cyan-950">
<div className="font-semibold">{t('remoteAccess.flowTitle')}</div>
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 87907f16a..1f5e706bd 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -50,11 +50,18 @@
"title": "Remote Access",
"subtitle": "Expose this local admin UI at your Vibe Cloud hostname. Vibe Cloud handles OAuth; traffic goes directly through Cloudflare Tunnel to this machine.",
"connectTitle": "Connect to Vibe Cloud",
- "connectDesc": "Create an instance in avibe.bot, copy the pairing key, then paste it here. Vibe Remote will save the OAuth metadata and start cloudflared.",
+ "connectDesc": "Open avibe.bot, sign up or sign in, create your Vibe Bot instance, then paste the one-time Pairing Key here.",
+ "configuredTitle": "Vibe Cloud is configured",
+ "configuredDesc": "This machine has saved the remote-access credentials. The Pairing Key is a one-time code and is not stored; after restart, Vibe Remote uses the saved connection credentials.",
+ "configuredBadge": "Connected to Vibe Cloud",
+ "configuredHelp": "Use re-pair only when switching account, switching instance, or regenerating the Tunnel.",
+ "vibeCloudService": "Vibe Cloud service",
"backendUrl": "Vibe Cloud URL",
"pairingKey": "Pairing key",
+ "pairingKeyHelp": "The Pairing Key is shown once and usually starts with vrp_. After redemption, Vibe Remote stores connection credentials, not this one-time key.",
"pair": "Pair and start",
"pairing": "Pairing...",
+ "repair": "Re-pair",
"pairSuccess": "Remote access paired",
"startSuccess": "Remote access started",
"stopSuccess": "Remote access stopped",
@@ -63,9 +70,9 @@
"paired": "Pairing",
"connector": "Connector",
"flowTitle": "How it works",
- "flowStep1": "Create a remote-access instance in avibe.bot.",
- "flowStep2": "Copy the one-time Pairing Key and paste it here.",
- "flowStep3": "After pairing, this machine starts the connector and receives a public URL.",
+ "flowStep1": "Open avibe.bot and sign up or sign in.",
+ "flowStep2": "Create a Vibe Bot instance in the console and copy its one-time Pairing Key.",
+ "flowStep3": "Return here to pair. Vibe Remote then saves connection credentials and starts the connector.",
"actionNeeded": "Action needed",
"ready": "Ready",
"stateNeedsAttention": "Needs attention"
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index fe88d3d03..ccee04de8 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -50,11 +50,18 @@
"title": "远程访问",
"subtitle": "把本地管理后台发布到 Vibe Cloud 分配的访问地址。Vibe Cloud 只负责 OAuth 授权,业务流量通过 Cloudflare Tunnel 直达本机。",
"connectTitle": "连接 Vibe Cloud",
- "connectDesc": "在 avibe.bot 创建实例后复制 Pairing Key,粘贴到这里。Vibe Remote 会保存 OAuth 元数据并启动 cloudflared。",
+ "connectDesc": "先前往 avibe.bot 注册或登录,创建你的 Vibe Bot 实例,然后把一次性的 Pairing Key 粘贴到这里。",
+ "configuredTitle": "Vibe Cloud 已配置",
+ "configuredDesc": "本机已经保存了远程访问凭证。Pairing Key 是一次性兑换码,不会长期保存;重启后会使用已保存的连接凭证自动恢复。",
+ "configuredBadge": "已连接到 Vibe Cloud",
+ "configuredHelp": "如果要换账号、换实例或重新生成 Tunnel,再点击重新配对。",
+ "vibeCloudService": "Vibe Cloud 服务",
"backendUrl": "Vibe Cloud 地址",
"pairingKey": "Pairing Key",
+ "pairingKeyHelp": "Pairing Key 只会显示一次,通常以 vrp_ 开头。兑换成功后本地保存的是连接凭证,不是这个一次性 Key。",
"pair": "配对并启动",
"pairing": "配对中...",
+ "repair": "重新配对",
"pairSuccess": "远程访问已配对",
"startSuccess": "远程访问已启动",
"stopSuccess": "远程访问已停止",
@@ -63,9 +70,9 @@
"paired": "配对状态",
"connector": "连接器",
"flowTitle": "使用流程",
- "flowStep1": "先在 avibe.bot 后台创建一个远程访问实例。",
- "flowStep2": "复制一次性的 Pairing Key,粘贴到这里完成绑定。",
- "flowStep3": "绑定成功后,本机连接器会自动启动,并生成可访问地址。",
+ "flowStep1": "打开 avibe.bot,注册或登录你的账号。",
+ "flowStep2": "在控制台创建 Vibe Bot 实例,复制一次性的 Pairing Key。",
+ "flowStep3": "回到这里完成配对。之后 Vibe Remote 会自动保存连接凭证并启动连接器。",
"actionNeeded": "需要处理",
"ready": "已就绪",
"stateNeedsAttention": "需要检查"
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index dd654a625..62beeb79c 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -18,7 +18,7 @@ from urllib.parse import quote, unquote, urlparse, urlsplit, urlunsplit
from flask import Flask, request, jsonify, send_file, Response
from config import paths
-from config.v2_config import V2Config
+from config.v2_config import CONFIG_LOCK, V2Config
from vibe.runtime import get_ui_dist_path, get_working_dir
from vibe.sentry_integration import init_sentry
@@ -618,13 +618,14 @@ def config_post():
from vibe import remote_access
payload = request.json or {}
- previous_config = _load_remote_access_config() if "remote_access" in payload else None
- config = api.save_config(payload)
remote_access_runtime = None
- if _remote_access_settings_changed(previous_config, config, payload):
- if _should_rotate_remote_session_secret(previous_config, config, payload):
- remote_access.rotate_session_secret(config)
- remote_access_runtime = remote_access.reconcile(config)
+ with CONFIG_LOCK:
+ previous_config = _load_remote_access_config() if "remote_access" in payload else None
+ config = api.save_config(payload)
+ if _remote_access_settings_changed(previous_config, config, payload):
+ if _should_rotate_remote_session_secret(previous_config, config, payload):
+ remote_access.rotate_session_secret(config)
+ remote_access_runtime = remote_access.reconcile(config)
response_payload = api.config_to_payload(config)
if remote_access_runtime is not None:
response_payload["remote_access_runtime"] = remote_access_runtime