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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(memory): converge cloud runtime state
cyhd61790c7776f
diff --git a/config/v2_config.py b/config/v2_config.pyindex 9228cf13a..64b710480 100644--- a/config/v2_config.py+++ b/config/v2_config.py@@ -1951,7 +1951,9 @@ class MemoryConfig:# A pending enterprise transition is deliberately fenced on the# last applied custom identity until the user confirms the rebuild.return self.cloud.organization_attached- return self.cloud.scope == "platform" and self.mode == "platform"+ # Mode owns the runtime source. A missing or recovered cloud cache must+ # pause platform Memory, never expose saved custom endpoints as fallback.+ return self.mode == "platform"def runtime_source(self) -> Literal["cloud", "custom", "unavailable"]:if self.cloud_runtime_selected():@@ -1972,7 +1974,7 @@ class MemoryConfig:):return "custom"return "organization"- if self.cloud.scope == "platform" and self.mode == "platform":+ if self.mode == "platform":return "platform"return "custom"diff --git a/tests/test_memory_config.py b/tests/test_memory_config.pyindex 4da0f513c..4f13d653d 100644--- a/tests/test_memory_config.py+++ b/tests/test_memory_config.py@@ -360,15 +360,25 @@ def test_memory_rebuild_request_never_downgrades_recovery({"transition_rebuild_owned": True},],)+ ("mode", "recovery_intent", "runtime_source"),+ [+ ("custom", "factory_reset", "custom"),+ ("platform", None, "unavailable"),+ ],+)def test_disk_load_recovers_only_a_malformed_memory_cloud_cache(tmp_path,cloud: object,+ mode: str,+ recovery_intent: MemoryRecoveryIntent | None,+ runtime_source: str,) -> None:config_path = tmp_path / "config.json"memory = {"enabled": True,- "mode": "custom",- "recovery_intent": "factory_reset",+ "mode": mode,+ "recovery_intent": recovery_intent,"processing": _complete_processing(),"cloud": cloud,}@@ -381,12 +391,15 @@ def test_disk_load_recovers_only_a_malformed_memory_cloud_cache(loaded = V2Config.load(config_path)assert loaded.memory.enabled is True- assert loaded.memory.mode == "custom"+ assert loaded.memory.mode == modeassert loaded.memory.custom_processing_complete() is Trueassert loaded.memory.processing.llm.api_key == "llm-key"assert loaded.memory.processing.embedding.api_key == "embed-key"- assert loaded.memory.recovery_intent == "factory_reset"+ assert loaded.memory.recovery_intent == recovery_intentassert loaded.memory.cloud == MemoryCloudConfig()+ assert loaded.memory.runtime_source() == runtime_source+ assert loaded.memory.cloud_runtime_selected() is (mode == "platform")+ assert loaded.memory.settings_mode() == modeassert any("memory.cloud" in warning for warning in loaded.load_warnings)assert json.loads(config_path.read_text(encoding="utf-8"))["memory"]["cloud"] == clouddiff --git a/tests/test_model_service.py b/tests/test_model_service.pyindex d7d0253d0..7f98e542d 100644--- a/tests/test_model_service.py+++ b/tests/test_model_service.py@@ -740,6 +740,47 @@ def test_fresh_platform_instance_enables_when_memory_capabilities_recover() -> Nassert activated.recovery_intent is None+def test_org_release_preserves_disabled_memory_until_platform_capabilities_recover() -> None:+ organization = MemoryConfig(+ enabled=False,+ mode="platform",+ cloud=MemoryCloudConfig(+ scope="organization",+ capabilities=MemoryCloudCapabilities(chat=True, embedding=True),+ embedding_identity="emb-org",+ applied_embedding_identity="emb-org",+ model_access_key="mak_first",+ proxy_base_url="https://backend.example.test/v1/model",+ source_instance_id="instance-1",+ organization_attached=True,+ ),+ )++ released = _resolved(+ organization,+ _status(+ scope="platform",+ chat=False,+ embedding=False,+ identity=None,+ revision=2,+ ),+ )+ resumed = _resolved(+ released,+ _status(scope="platform", identity="emb-platform", revision=3),+ )++ assert released.enabled is False+ assert released.cloud.applied_embedding_identity == "emb-org"+ assert released.runtime_source() == "unavailable"+ assert released.recovery_intent == "rebuild"+ assert resumed.enabled is False+ assert resumed.cloud.applied_embedding_identity == "emb-platform"+ assert resumed.runtime_source() == "cloud"+ assert resumed.recovery_intent == "rebuild"++def test_capability_removal_pauses_and_resume_checks_last_applied_identity() -> None:attached = MemoryConfig(enabled=True,@@ -1041,3 +1082,49 @@ def test_mak_rotation_does_not_change_embedding_identity_and_rolls_back_on_applydef test_mak_response_requires_the_frozen_one_time_shape(payload: dict) -> None:with pytest.raises(model_service.ModelServiceResolutionError):model_service._mint_from_payload(payload) # noqa: SLF001+++def test_pairing_refresh_notifies_the_ui_worker_across_processes(+ monkeypatch: pytest.MonkeyPatch,+ tmp_path: Path,+) -> None:+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ _paired_config().save()+ monkeypatch.setattr("vibe.runtime.read_status", lambda: {"ui_pid": 4242})+ requests: list[tuple[str, str, dict[str, str]]] = []++ class Response:+ def __init__(self, payload: dict, status: int = 200) -> None:+ self.status = status+ self._body = json.dumps(payload).encode("utf-8")++ def __enter__(self):+ return self++ def __exit__(self, *_args: object) -> None:+ return None++ def read(self) -> bytes:+ return self._body++ def urlopen(request, *, timeout: float):+ headers = {key.lower(): value for key, value in request.header_items()}+ requests.append((request.get_method(), request.full_url, headers))+ assert timeout == 0.75+ if request.full_url.endswith("/status"):+ return Response({"ui_pid": 4242})+ return Response({"ok": True})++ monkeypatch.setattr(model_service.urllib.request, "urlopen", urlopen)+ model_service._REFRESH_EVENT.clear() # noqa: SLF001++ model_service.request_model_service_refresh()++ assert model_service._REFRESH_EVENT.is_set() # noqa: SLF001+ assert [(method, url) for method, url, _headers in requests] == [+ ("GET", "http://127.0.0.1:5123/status"),+ ("POST", "http://127.0.0.1:5123/api/model-service/refresh"),+ ]+ assert requests[-1][2]["x-vibe-show-client"] == "cli"+ assert requests[-1][2]["x-vibe-show-cli-token"]+ model_service._REFRESH_EVENT.clear() # noqa: SLF001diff --git a/tests/test_ui_server_mutation_protection.py b/tests/test_ui_server_mutation_protection.pyindex 30291cdac..8b930bd14 100644--- a/tests/test_ui_server_mutation_protection.py+++ b/tests/test_ui_server_mutation_protection.py@@ -4,6 +4,7 @@ import ipaddressfrom http.cookies import SimpleCookiefrom config.v2_config import AgentsConfig, PlatformsConfig, RemoteAccessConfig, RuntimeConfig, SlackConfig, V2Config+from core.show_pages import SHOW_CLI_EVENT_TOKEN_HEADER, show_cli_event_tokenfrom vibe import ui_serverfrom vibe.ui_compat import TEST_REMOTE_ADDR_HEADERfrom vibe.ui_server import app, protect_mutating_ui_requests@@ -527,3 +528,32 @@ def test_mutation_guard_exempts_e2e_simulation_endpoint(monkeypatch):monkeypatch.setenv("E2E_TEST_MODE", "true")with app.test_request_context("/e2e/simulate-interaction", method="POST"):assert protect_mutating_ui_requests() is None+++def test_model_service_refresh_ingress_requires_the_shared_cli_token(monkeypatch):+ refreshes: list[bool] = []+ monkeypatch.setattr(+ "vibe.model_service.request_model_service_refresh",+ lambda: refreshes.append(True),+ )+ client = app.test_client()++ denied = client.post(+ "/api/model-service/refresh",+ base_url="http://127.0.0.1:15131",+ json={},+ )+ accepted = client.post(+ "/api/model-service/refresh",+ base_url="http://127.0.0.1:15131",+ headers={+ "X-Vibe-Show-Client": "cli",+ SHOW_CLI_EVENT_TOKEN_HEADER: show_cli_event_token(),+ },+ json={},+ )++ assert denied.status_code == 403+ assert accepted.status_code == 200+ assert accepted.get_json() == {"ok": True}+ assert refreshes == [True]diff --git a/ui/src/components/settings/memory/MemorySettingsPanel.test.tsx b/ui/src/components/settings/memory/MemorySettingsPanel.test.tsxindex dfc982c7a..e8c318633 100644--- a/ui/src/components/settings/memory/MemorySettingsPanel.test.tsx+++ b/ui/src/components/settings/memory/MemorySettingsPanel.test.tsx@@ -101,6 +101,8 @@ describe('MemorySettingsPanel', () => {expect(screen.getByText('memory.settings.avibeCloudTitle')).toBeTruthy();expect(screen.getByText('memory.settings.avibeCloudFree')).toBeTruthy();expect(screen.getByRole('button', { name: 'memory.settings.useCustomEndpoints' })).toBeTruthy();+ expect(screen.getByText('memory.settings.disclosureTitle')).toBeTruthy();+ expect(screen.getByText('memory.settings.cloudDisclosureAttachment')).toBeTruthy();expect(screen.queryByText('memory.settings.llmTitle')).toBeNull();expect(screen.queryByRole('button', { name: 'memory.settings.save' })).toBeNull();});@@ -122,6 +124,8 @@ describe('MemorySettingsPanel', () => {expect(screen.getByText('memory.settings.organizationManaged')).toBeTruthy();expect(screen.getByRole('switch', { name: 'memory.settings.enableLabel' })).toBeTruthy();+ expect(screen.getByText('memory.settings.disclosureTitle')).toBeTruthy();+ expect(screen.getByText('memory.settings.cloudDisclosureAttachment')).toBeTruthy();expect(screen.queryByText('memory.settings.llmTitle')).toBeNull();expect(screen.queryByRole('button', { name: 'memory.settings.save' })).toBeNull();});@@ -301,6 +305,42 @@ describe('MemorySettingsPanel', () => {await waitFor(() => expect(api.saveMemorySettings).toHaveBeenCalledWith({ enabled: false }));});+ it.each([+ ['platform', false],+ ['organization', true],+ ] as const)('restores a failed immediate toggle in %s mode', async (mode, managed) => {+ api.saveMemorySettings.mockResolvedValue({+ status: 'failed',+ error: 'memory_llm_unavailable',+ });+ const user = userEvent.setup();+ render(+ <MemorySettingsPanel+ settings={{+ ...legacySettings,+ enabled: false,+ mode,+ managed,+ cloud_available: true,+ }}+ maintenance={null}+ maintenanceError={null}+ dependencyReady+ onSaved={() => undefined}+ onReloadSettings={() => undefined}+ onReloadMaintenance={() => undefined}+ onClearAll={() => undefined}+ clearing={false}+ />,+ );++ const toggle = screen.getByRole('switch', { name: 'memory.settings.enableLabel' });+ expect(toggle.getAttribute('aria-checked')).toBe('false');+ await user.click(toggle);+ await waitFor(() => expect(api.saveMemorySettings).toHaveBeenCalledWith({ enabled: true }));+ await waitFor(() => expect(toggle.getAttribute('aria-checked')).toBe('false'));+ });+it('hides multimodal configuration until IM attachment capture is available', () => {render(<MemorySettingsPaneldiff --git a/ui/src/components/settings/memory/MemorySettingsPanel.tsx b/ui/src/components/settings/memory/MemorySettingsPanel.tsxindex 9ff5d6424..253b37915 100644--- a/ui/src/components/settings/memory/MemorySettingsPanel.tsx+++ b/ui/src/components/settings/memory/MemorySettingsPanel.tsx@@ -298,6 +298,9 @@ export const MemorySettingsPanel: React.FC<{failure.diagnostic?.provider_error_code,),);+ if (!customMode && typeof patch.enabled === 'boolean') {+ setEnabledDraft(settings.enabled);+ }// Confirmed rebuild keeps the candidate on failure. Exit the confirm// modal so a second click cannot re-submit a now-non-identity patch;// Retry rebuild is the recovery control under the pending marker.@@ -315,6 +318,9 @@ export const MemorySettingsPanel: React.FC<{}} catch {setError(t('memory.settings.saveFailed'));+ if (!customMode && typeof patch.enabled === 'boolean') {+ setEnabledDraft(settings.enabled);+ }setConfirmRebuildOpen(false);setPendingPatch(null);onReloadSettings();@@ -608,10 +614,13 @@ export const MemorySettingsPanel: React.FC<{</Button></div>- {customMode ? <div className="rounded-xl border border-border bg-surface p-4">+ <div className="rounded-xl border border-border bg-surface p-4"><h3 className="mb-2 text-[13px] font-semibold text-foreground">{t('memory.settings.disclosureTitle')}</h3><ul className="flex flex-col gap-1.5">- {(t('memory.settings.disclosure', { returnObjects: true }) as string[]).map((line, idx) => (+ {(t(+ customMode ? 'memory.settings.disclosure' : 'memory.settings.cloudDisclosure',+ { returnObjects: true },+ ) as string[]).map((line, idx) => (<li key={idx} className="flex gap-2 text-[11.5px] leading-snug text-muted"><span className="mt-1 size-1 shrink-0 rounded-full bg-muted" />{line}@@ -620,11 +629,15 @@ export const MemorySettingsPanel: React.FC<{{settings.im_attachment_capture_available === true ? (<li className="flex gap-2 text-[11.5px] leading-snug text-muted"><span className="mt-1 size-1 shrink-0 rounded-full bg-muted" />- {t('memory.settings.disclosureAttachment')}+ {t(+ customMode+ ? 'memory.settings.disclosureAttachment'+ : 'memory.settings.cloudDisclosureAttachment',+ )}</li>) : null}</ul>- </div> : null}+ </div><ConfirmDialogopen={confirmRebuildOpen}diff --git a/ui/src/components/settings/memory/memoryCopyContract.test.ts b/ui/src/components/settings/memory/memoryCopyContract.test.tsindex bab57e852..d8c1adcda 100644--- a/ui/src/components/settings/memory/memoryCopyContract.test.ts+++ b/ui/src/components/settings/memory/memoryCopyContract.test.ts@@ -86,6 +86,22 @@ describe('Memory UI copy contracts', () => {}});+ it.each(['en', 'zh'] as const)('keeps local-data disclosure in cloud modes in %s', (language) => {+ const settings = BUNDLES[language].memory.settings;+ const disclosure = settings.cloudDisclosure.join('\n');++ expect(disclosure).toMatch(/5,000/);+ if (language === 'en') {+ expect(disclosure).toContain('raw messages and attachment copies');+ expect(disclosure).toContain('Turning Memory off pauses it');+ expect(settings.cloudDisclosureAttachment).toContain('cloud model service');+ } else {+ expect(disclosure).toContain('原始消息和附件副本');+ expect(disclosure).toContain('关闭记忆只是暂停记录');+ expect(settings.cloudDisclosureAttachment).toContain('云端模型服务');+ }+ });+it.each(['en', 'zh'] as const)('keeps staged IM attachment disclosure separate in %s', (language) => {const settings = BUNDLES[language].memory.settings;const baseDisclosure = settings.disclosure.join('\n');diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex fa2b1dd0b..7e08e7abc 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -4526,7 +4526,16 @@"Clear Memory Data deletes Avibe-managed Memory data for every user and project on this machine, including profiles, memories, and messages waiting to process. It can't take back content already sent to model endpoints or touch original chat histories.","Accounts on different platforms each have their own separate memory; they aren't linked."],+ "cloudDisclosure": [+ "When on, your Workbench messages and authorized users' private messages are distilled into memories. Your Agent can also proactively save durable notes without being asked, including preferences, corrections, decisions, and lasting facts about your machine or accounts found in files, forwarded or shared content, or other non-plain content.",+ "The local Memory queue keeps raw messages and attachment copies while they wait to process. If a submission needs manual recovery, those copies can remain after processing stops.",+ "To build memories, message content is sent to the cloud models selected by Avibe or your organization, and Search sends queries to that cloud service too. These models are separate from your Agent's models, and the cloud service handles data under its policies.",+ "Avibe's local Memory store stays on this machine and includes scrubbed model-call diagnostics for every user and project on this installation. Diagnostics can contain sensitive conversation text and are kept for up to 14 days or 5,000 calls. Copies sent to model endpoints are outside this local store. Turning Memory off pauses it — it doesn't delete anything.",+ "Clear Memory Data deletes Avibe-managed Memory data for every user and project on this machine, including profiles, memories, and messages waiting to process. It can't take back content already sent to model endpoints or touch original chat histories.",+ "Accounts on different platforms each have their own separate memory; they aren't linked."+ ],"disclosureAttachment": "When the IM attachment processing endpoint is configured, eligible attachments from bound direct messages are also sent to that provider.",+ "cloudDisclosureAttachment": "When cloud multimodal processing is available, eligible attachments from bound direct messages are also sent to the cloud model service.","clearKeyLabel": "Clear the saved key","rebuildRequiredTitle": "Memory index rebuild required","rebuildRequiredDescription": "Your embedding endpoint or model change is saved. The Memory engine can't restart until the rebuild finishes.",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex b3a7009df..db9e85a83 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -4526,7 +4526,16 @@"「清理记忆数据」会删除 Avibe 在本机上管理的记忆数据,涵盖本安装所有用户和项目,包括画像、记忆条目和待处理的消息。它无法撤回已发送给模型接口的内容,也不会触碰原始聊天记录。","不同平台的账号各自拥有独立的记忆,互不关联。"],+ "cloudDisclosure": [+ "开启后,你的 Workbench 消息和已授权用户的私聊消息会被提炼成记忆。Agent 也可能在未明确要求的情况下主动保存长期信息,包括偏好、纠偏、决策,以及它从文件、转发或共享内容等非纯文本内容中发现的、关于你的设备或账户的长期事实。",+ "本地 Memory 队列会在等待处理时保留原始消息和附件副本。如果一次提交需要人工恢复,即使处理停止,这些副本也可能继续保留。",+ "提炼记忆时,消息内容会发送到 Avibe 或你的组织选定的云端模型处理,使用搜索时搜索查询也会发送到该云端服务。这些模型与 Agent 使用的模型分开,云端服务会按其政策处理数据。",+ "Avibe 的本地 Memory 存储保留在这台机器上,其中包括本安装所有用户和项目的脱敏模型调用诊断。诊断仍可能包含敏感对话内容,最多保留 14 天或 5,000 次调用。发送到模型接口的副本不在此本地存储中。关闭记忆只是暂停记录,不会删除已有数据。",+ "「清理记忆数据」会删除 Avibe 在本机上管理的记忆数据,涵盖本安装所有用户和项目,包括画像、记忆条目和待处理的消息。它无法撤回已发送给模型接口的内容,也不会触碰原始聊天记录。",+ "不同平台的账号各自拥有独立的记忆,互不关联。"+ ],"disclosureAttachment": "配置 IM 附件处理端点后,已绑定私聊中的合规附件也会发送给该服务商。",+ "cloudDisclosureAttachment": "云端多模态处理可用时,已绑定私聊中的合规附件也会发送给云端模型服务。","clearKeyLabel": "清除已保存的密钥","rebuildRequiredTitle": "需要重建记忆索引","rebuildRequiredDescription": "向量模型接口地址或模型的更改已保存。索引重建完成前,无法重启记忆引擎。",diff --git a/vibe/model_service.py b/vibe/model_service.pyindex 56517fc79..71de9fb84 100644--- a/vibe/model_service.py+++ b/vibe/model_service.py@@ -5,9 +5,13 @@ from __future__ import annotationsfrom copy import deepcopyfrom dataclasses import dataclassfrom datetime import datetime+import jsonimport logging+import osimport threadingfrom typing import Any, Mapping+import urllib.error+import urllib.requestfrom config.v2_config import (MemoryCloudCapabilities,@@ -20,6 +24,7 @@ from config.v2_config import (logger = logging.getLogger(__name__)MODEL_SERVICE_POLL_SECONDS = 60+MODEL_SERVICE_REFRESH_PATH = "/api/model-service/refresh"_SYNC_LOCK = threading.Lock()_WORKER_LOCK = threading.Lock()_REFRESH_EVENT = threading.Event()@@ -285,7 +290,9 @@ def _resolved_memory(candidate.enabled = Trueelif was_organization_cloud:candidate.arm_rebuild_if_idle()- candidate.cloud.applied_embedding_identity = None+ # The applied identity is also the durable "not fresh" baseline.+ # Keep it across an unavailable release so later capability recovery+ # cannot silently override an explicit user opt-out.candidate.cloud.runtime_apply_pending = (current.cloud.runtime_apply_pending@@ -568,8 +575,64 @@ def ensure_model_access_key(config: V2Config | None = None) -> V2Config:return _persist_candidate(current, candidate)+def _model_service_ui_origins(config: V2Config) -> tuple[str, ...]:+ """Reuse the tunnel's canonical route to the local UI process."""++ from vibe import remote_access++ return (remote_access.origin_service_for_pairing(config),)+++def _notify_ui_model_service_refresh(config: V2Config) -> bool:+ """Wake the UI-owned worker when pairing changes in another process."""++ from core.show_pages import SHOW_CLI_EVENT_TOKEN_HEADER, show_cli_event_token+ from vibe import runtime++ try:+ ui_pid = int(runtime.read_status().get("ui_pid"))+ except (TypeError, ValueError):+ return False+ if ui_pid == os.getpid():+ return False++ headers = {"X-Vibe-Show-Client": "cli"}+ for origin in _model_service_ui_origins(config):+ try:+ status_request = urllib.request.Request(+ f"{origin}/status",+ method="GET",+ headers=headers,+ )+ with urllib.request.urlopen(status_request, timeout=0.75) as response:+ status = json.loads(response.read().decode("utf-8"))+ if int(status.get("ui_pid")) != ui_pid:+ continue+ refresh_request = urllib.request.Request(+ f"{origin}{MODEL_SERVICE_REFRESH_PATH}",+ data=b"{}",+ method="POST",+ headers={+ **headers,+ "Content-Type": "application/json",+ SHOW_CLI_EVENT_TOKEN_HEADER: show_cli_event_token(),+ },+ )+ with urllib.request.urlopen(refresh_request, timeout=0.75) as response:+ return response.status == 200+ except (OSError, TypeError, ValueError, json.JSONDecodeError, urllib.error.URLError):+ continue+ return False++def request_model_service_refresh() -> None:_REFRESH_EVENT.set()+ try:+ _notify_ui_model_service_refresh(V2Config.load())+ except Exception:+ # The in-process event remains authoritative when the UI is this process;+ # a stopped or unavailable UI has no sleeping worker to wake.+ logger.debug("Cloud Model Service UI refresh notification was unavailable", exc_info=True)def _worker_loop(initial_config: V2Config | None) -> None:diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 14392d180..6539d26b7 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -74,6 +74,7 @@ from modules.agents.catalog import AGENT_BACKENDS, supports_runtime_refreshfrom vibe.i18n import get_supported_languages, tfrom vibe.logging_config import application_log_pathsfrom vibe.message_types import types_with+from vibe.model_service import MODEL_SERVICE_REFRESH_PATHfrom vibe.runtime import get_ui_dist_path, get_working_dirfrom vibe.sentry_integration import init_sentryfrom storage.delivery_states import ADMITTED_DELIVERY_STATES@@ -577,7 +578,11 @@ def _trusted_public_origin_local_request(config: V2Config | None) -> bool:def _is_mutation_guard_exempt() -> bool:if request.path in {"/auth/callback", "/auth/organization/callback", "/auth/organization/start"}:return True- if _is_cli_show_event_request() or _is_cli_session_activity_request():+ if (+ _is_cli_show_event_request()+ or _is_cli_session_activity_request()+ or _is_cli_model_service_refresh_request()+ ):return Truereturn (request.path == "/e2e/simulate-interaction"@@ -611,6 +616,10 @@ def _is_cli_session_activity_request() -> bool:)+def _is_cli_model_service_refresh_request() -> bool:+ return _cli_local_event_token_ok() and request.path == MODEL_SERVICE_REFRESH_PATH++def _is_show_api_mutation() -> bool:if not (request.path.startswith("/show/") or request.path.startswith("/p/")):return False@@ -2950,6 +2959,16 @@ def status():return jsonify(payload)[email protected](MODEL_SERVICE_REFRESH_PATH, methods=["POST"])+def model_service_refresh():+ if not _is_cli_model_service_refresh_request():+ return jsonify({"ok": False, "error": "forbidden"}), 403+ from vibe.model_service import request_model_service_refresh++ request_model_service_refresh()+ return jsonify({"ok": True})++@app.websocket("/ws/echo")async def websocket_echo(websocket: WebSocket):if os.environ.get("VIBE_UI_ENABLE_WS_ECHO", "").lower() not in {"1", "true", "yes", "on"}: