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.

Merge remote-tracking branch 'origin/master' into codex-integrate-org-into-master

cyh10bc2db9c373
diff --cc core/session_turns.py
index fbbe358f7,6c626c573..775d67aed
--- a/core/session_turns.py
+++ b/core/session_turns.py
@@@ -27,14 -27,11 +27,15 @@@ from sqlalchemy import and_, exists, li
from sqlalchemy.engine import Connection, Engine
from sqlalchemy.exc import IntegrityError
-from core.web_push_notifications import WEB_PUSH_USER_KEY_METADATA, WEB_PUSH_USER_KEYS_METADATA
from core.message_context import resolve_turn_sink_key
+from core.web_push_notifications import (
+ WEB_PUSH_AUTHORIZATION_CONTEXTS_METADATA,
+ WEB_PUSH_USER_KEY_METADATA,
+ WEB_PUSH_USER_KEYS_METADATA,
+)
from core.native_dispatch_phase import backend_dispatch_attempted
from core.run_settlement import (
+ NON_COMPLETING_TURN_SETTLEMENTS,
SETTLEMENTS_WITHOUT_RESULT,
SETTLED_BY_BACKEND_REFRESH,
SETTLED_BY_NO_TERMINAL_RESULT,
diff --cc storage/messages_service.py
index 554941b50,3bc6a1625..aff79961b
--- a/storage/messages_service.py
+++ b/storage/messages_service.py
@@@ -668,9 -747,12 +770,13 @@@ def list_session_messages
after_id: Optional[str] = None,
before_id: Optional[str] = None,
around_id: Optional[str] = None,
+ around_native_id: Optional[str] = None,
+ around_native_platform: Optional[str] = None,
+ around_turn_id: Optional[str] = None,
+ around_run_id: Optional[str] = None,
limit: int = 50,
types: Optional[Iterable[str]] = None,
+ include_private_metadata: bool = False,
tail: bool = False,
) -> dict[str, Any]:
"""Return messages for one session in chronological order with cursor pagination.
@@@ -737,10 -879,8 +908,10 @@@
older.reverse()
anchor_rows = [
- _row_to_payload(dict(row))
+ _row_to_payload(
+ dict(row), include_private_metadata=include_private_metadata
+ )
- for row in conn.execute(query.where(messages.c.id == around_id)).mappings().all()
+ for row in conn.execute(query.where(messages.c.id == anchor_id)).mappings().all()
]
newer_q = (
diff --cc tests/test_internal_server.py
index bd9fbd0f5,1a3352771..5d11d6830
--- a/tests/test_internal_server.py
+++ b/tests/test_internal_server.py
@@@ -301,10 -296,6 +301,13 @@@ def _build_controller_double(handler=No
return controller
+def _set_memory_cli_sessions(controller, principals: dict[str, str]) -> None:
- controller.memory_principal_for_cli_session = lambda session_id: principals.get(session_id)
++ project_id = "p-11111111111111111111111111111111"
++ controller.memory_scope_for_cli_session = lambda session_id: (
++ (principals[session_id], project_id) if session_id in principals else None
++ )
+
+
# ---------------------------------------------------------------------
# Public surface
# ---------------------------------------------------------------------
@@@ -527,446 -345,6 +530,454 @@@ def test_create_app_exposes_minimal_end
assert ("/internal/dispatch", ("POST",)) not in routes
assert ("/internal/events", ("GET",)) in routes
assert ("/internal/events", ("POST",)) in routes
+ assert ("/internal/reconcile-memory", ("POST",)) in routes
+ assert ("/internal/memory/install-runtime", ("POST",)) in routes
+ assert ("/internal/memory/status", ("GET",)) in routes
+ assert ("/internal/memory/failures", ("GET",)) in routes
+ assert ("/internal/memory/profile", ("GET",)) in routes
+ assert ("/internal/memory/search", ("POST",)) in routes
+ assert ("/internal/memory/remember", ("POST",)) in routes
+ assert ("/internal/memory/clear", ("POST",)) in routes
+
+
+def test_memory_internal_routes_only_accept_typed_operations(monkeypatch):
+ from core.memory.ui_access import MEMORY_UI_PROOF_HEADER, build_ui_read_proof
+
+ controller = _build_controller_double()
+ calls: list[tuple[str, object]] = []
+ capture_finished = asyncio.Event()
+
+ class _Module:
+ async def capture(self, request):
+ calls.append(("capture", request))
+ capture_finished.set()
+ return types.SimpleNamespace(status="accepted")
+
+ class _Runtime:
+ def __init__(self):
+ self.module = _Module()
+
+ async def status_payload(self):
+ calls.append(("status", None))
+ return {"state": "ready", "data_exists": True}
+
+ async def failure_log_payload(self):
+ calls.append(("failures", None))
+ return {"items": [], "retention_days": 90}
+
+ def principal_for_user_key(self, user_key):
+ assert user_key == "avibe:local"
+ return "u-11111111111111111111111111111111"
+
- async def profile_payload(self, principal_id):
++ async def profile_payload(self, principal_id, _project_id):
+ calls.append(("profile", principal_id))
+ return {"status": "ok", "items": []}
+
- async def search_payload(self, query, limit, principal_id):
++ async def search_payload(self, query, limit, principal_id, _project_id):
+ calls.append(("search", (query, limit, principal_id)))
+ return {"status": "ok", "items": []}
+
+ async def clear(self):
+ calls.append(("clear", None))
+ return {"status": "completed", "epoch": 2}
+
+ async def install_artifact(self):
+ calls.append(("install", None))
+ return {"ok": False, "reason": "memory_runtime_unpublished", "download_error": None}
+
+ async def reconcile_memory(config):
+ calls.append(("reconcile", config))
+ return {"ok": True, "state": "ready"}
+
+ controller.memory_runtime = _Runtime()
++ controller.default_memory_project_id = lambda: "p-11111111111111111111111111111111"
+ _set_memory_cli_sessions(
+ controller,
+ {"session-1": "u-11111111111111111111111111111111"},
+ )
+ controller.reconcile_memory = reconcile_memory
+ monkeypatch.setattr("config.v2_config.V2Config.load", lambda: types.SimpleNamespace(memory="configured-memory"))
+ memory_ui_secret = "test-ui-controller-secret"
+ app = internal_server.create_app(controller, memory_ui_secret=memory_ui_secret)
+
+ async def _go():
+ transport = httpx.ASGITransport(app=app)
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
+ user_headers = {
+ "X-Avibe-Memory-User-Key": "avibe:local",
+ MEMORY_UI_PROOF_HEADER: build_ui_read_proof(
+ memory_ui_secret,
+ method="GET",
+ path="/internal/memory/profile",
+ user_key="avibe:local",
+ ),
+ }
+ search_headers = {
+ "X-Avibe-Memory-User-Key": "avibe:local",
+ MEMORY_UI_PROOF_HEADER: build_ui_read_proof(
+ memory_ui_secret,
+ method="POST",
+ path="/internal/memory/search",
+ user_key="avibe:local",
+ ),
+ }
+ session_headers = {"X-Avibe-Caller-Session": "session-1"}
+ clear_headers = {
+ "X-Avibe-Memory-User-Key": "avibe:local",
+ MEMORY_UI_PROOF_HEADER: build_ui_read_proof(
+ memory_ui_secret,
+ method="POST",
+ path="/internal/memory/clear",
+ user_key="avibe:local",
+ ),
+ }
+ responses = (
+ await client.get("/internal/memory/status"),
+ await client.get("/internal/memory/failures"),
+ await client.get("/internal/memory/profile", headers=user_headers),
+ await client.post(
+ "/internal/memory/search",
+ json={"query": "safe query", "limit": 3},
+ headers=search_headers,
+ ),
+ await client.post(
+ "/internal/memory/remember",
+ json={"text": "ordinary text"},
+ headers=session_headers,
+ ),
+ await client.post(
+ "/internal/memory/clear",
+ json={"confirm": True},
+ headers=clear_headers,
+ ),
+ await client.post("/internal/memory/install-runtime"),
+ await client.post("/internal/reconcile-memory"),
+ await client.post("/internal/memory/search", json=[], headers=search_headers),
+ await client.post(
+ "/internal/memory/remember",
+ json={"text": ""},
+ headers=session_headers,
+ ),
+ )
+ await asyncio.wait_for(capture_finished.wait(), timeout=1)
+ return responses
+
+ status, failures, profile, search, capture, clear, install, reconcile, invalid, invalid_capture = asyncio.run(_go())
+
+ assert status.json() == {"state": "ready", "data_exists": True}
+ assert failures.json() == {"items": [], "retention_days": 90}
+ assert profile.json() == {"status": "ok", "items": []}
+ assert search.json() == {"status": "ok", "items": []}
+ assert capture.json() == {"status": "accepted"}
+ assert clear.json() == {"status": "completed", "epoch": 2}
+ assert install.json() == {"ok": False, "reason": "memory_runtime_unpublished", "download_error": None}
+ assert reconcile.json() == {"ok": True, "state": "ready"}
+ assert invalid.status_code == 400
+ assert invalid_capture.status_code == 400
+ assert [name for name, _value in calls if name != "capture"] == [
+ "status",
+ "failures",
+ "profile",
+ "search",
+ "clear",
+ "install",
+ "reconcile",
+ ]
+ captured_request = next(value for name, value in calls if name == "capture")
+ assert captured_request.source_message_id.startswith(
- "agent:u-11111111111111111111111111111111:session-1:"
++ "agent:u-11111111111111111111111111111111:"
++ "p-11111111111111111111111111111111:session-1:"
+ )
+ assert captured_request.session_id == "session-1"
+ assert captured_request.principal_id == "u-11111111111111111111111111111111"
+ assert captured_request.provenance == "agent"
+
+
+def test_memory_remember_idempotency_is_scoped_to_the_principal():
+ controller = _build_controller_double()
+ captures = []
+
+ class _Module:
+ async def capture(self, request):
+ captures.append(request)
+ return types.SimpleNamespace(status="accepted")
+
+ controller.memory_runtime = types.SimpleNamespace(module=_Module())
+ first_principal = "u-11111111111111111111111111111111"
+ second_principal = "u-22222222222222222222222222222222"
+ principals = {"shared-session": first_principal}
+ _set_memory_cli_sessions(controller, principals)
+ app = internal_server.create_app(controller)
+
+ async def _go():
+ transport = httpx.ASGITransport(app=app)
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
+ first = await client.post(
+ "/internal/memory/remember",
+ json={"text": "same text"},
+ headers={"X-Avibe-Caller-Session": "shared-session"},
+ )
+ principals["shared-session"] = second_principal
+ second = await client.post(
+ "/internal/memory/remember",
+ json={"text": "same text"},
+ headers={"X-Avibe-Caller-Session": "shared-session"},
+ )
+ return first, second
+
+ first, second = asyncio.run(_go())
+
+ assert first.status_code == second.status_code == 200
+ assert [request.principal_id for request in captures] == [first_principal, second_principal]
+ assert captures[0].source_message_id != captures[1].source_message_id
+
+
+def test_memory_clear_accepts_only_a_clear_scoped_ui_proof() -> None:
+ from core.memory.http_headers import CALLER_SESSION_HEADER, MEMORY_USER_KEY_HEADER
+ from core.memory.ui_access import MEMORY_UI_PROOF_HEADER, build_ui_read_proof
+
+ controller = _build_controller_double()
+ controller.memory_runtime = types.SimpleNamespace(
+ clear=AsyncMock(return_value={"status": "completed", "epoch": 2}),
+ )
+ _set_memory_cli_sessions(
+ controller,
+ {"session-1": "u-11111111111111111111111111111111"},
+ )
+ secret = "test-ui-controller-secret"
+ app = internal_server.create_app(controller, memory_ui_secret=secret)
+
+ async def _go():
+ transport = httpx.ASGITransport(app=app)
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
+ no_proof = await client.post("/internal/memory/clear", json={"confirm": True})
+ agent_session = await client.post(
+ "/internal/memory/clear",
+ json={"confirm": True},
+ headers={CALLER_SESSION_HEADER: "session-1"},
+ )
+ profile_proof = await client.post(
+ "/internal/memory/clear",
+ json={"confirm": True},
+ headers={
+ MEMORY_USER_KEY_HEADER: "avibe:local",
+ MEMORY_UI_PROOF_HEADER: build_ui_read_proof(
+ secret,
+ method="GET",
+ path="/internal/memory/profile",
+ user_key="avibe:local",
+ ),
+ },
+ )
+ clear_proof = await client.post(
+ "/internal/memory/clear",
+ json={"confirm": True},
+ headers={
+ MEMORY_USER_KEY_HEADER: "avibe:local",
+ MEMORY_UI_PROOF_HEADER: build_ui_read_proof(
+ secret,
+ method="POST",
+ path="/internal/memory/clear",
+ user_key="avibe:local",
+ ),
+ },
+ )
+ return no_proof, agent_session, profile_proof, clear_proof
+
+ no_proof, agent_session, profile_proof, clear_proof = asyncio.run(_go())
+
+ assert [no_proof.status_code, agent_session.status_code, profile_proof.status_code] == [403, 403, 403]
+ assert clear_proof.status_code == 200
+ controller.memory_runtime.clear.assert_awaited_once_with()
+
+
+def test_memory_internal_reads_reject_an_unassociated_agent_session():
+ controller = _build_controller_double()
+ calls: list[str] = []
+
+ class _Runtime:
+ async def profile_payload(self, principal_id):
+ calls.append("profile")
+ return {"status": "ok", "items": []}
+
+ controller.memory_runtime = _Runtime()
+ _set_memory_cli_sessions(controller, {})
+ app = internal_server.create_app(controller)
+
+ async def _go():
+ transport = httpx.ASGITransport(app=app)
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
+ return await client.get(
+ "/internal/memory/profile",
+ headers={
+ "X-Avibe-Caller-Session": "ses-non-admin",
+ },
+ )
+
+ response = asyncio.run(_go())
+
+ assert response.status_code == 403
+ assert response.json() == {"status": "failed", "error": "memory_access_denied"}
+ assert calls == []
+
+
+def test_memory_internal_reads_accept_an_associated_agent_session():
+ from core.memory.http_headers import CALLER_SESSION_HEADER
+
+ controller = _build_controller_double()
+ controller.memory_runtime = types.SimpleNamespace(
+ profile_payload=AsyncMock(return_value={"status": "ok", "items": []})
+ )
+ principal_id = "u-11111111111111111111111111111111"
+ _set_memory_cli_sessions(controller, {"ses-admin": principal_id})
+ app = internal_server.create_app(controller)
+
+ async def _go():
+ transport = httpx.ASGITransport(app=app)
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
+ return await client.get(
+ "/internal/memory/profile",
+ headers={CALLER_SESSION_HEADER: "ses-admin"},
+ )
+
+ response = asyncio.run(_go())
+
+ assert response.status_code == 200
+ assert response.json() == {"status": "ok", "items": []}
- controller.memory_runtime.profile_payload.assert_awaited_once_with(principal_id)
++ controller.memory_runtime.profile_payload.assert_awaited_once_with(
++ principal_id,
++ "p-11111111111111111111111111111111",
++ )
+
+
+def test_memory_internal_read_rejects_agent_session_with_forged_local_owner_header():
+ from core.memory.http_headers import (
+ CALLER_SESSION_HEADER,
+ MEMORY_USER_KEY_HEADER,
+ )
+
+ controller = _build_controller_double()
+ controller.memory_runtime = types.SimpleNamespace(
+ principal_for_user_key=Mock(return_value="u-11111111111111111111111111111111"),
+ profile_payload=AsyncMock(return_value={"status": "ok", "items": []}),
+ )
+ _set_memory_cli_sessions(
+ controller,
+ {"ses-user-b": "u-22222222222222222222222222222222"},
+ )
+ app = internal_server.create_app(
+ controller,
+ memory_ui_secret="test-ui-controller-secret",
+ )
+
+ async def _go():
+ transport = httpx.ASGITransport(app=app)
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
+ return await client.get(
+ "/internal/memory/profile",
+ headers={
+ CALLER_SESSION_HEADER: "ses-user-b",
+ MEMORY_USER_KEY_HEADER: "avibe:local",
+ },
+ )
+
+ response = asyncio.run(_go())
+
+ assert response.status_code == 403
+ controller.memory_runtime.principal_for_user_key.assert_not_called()
+ controller.memory_runtime.profile_payload.assert_not_awaited()
+
+
+def test_memory_internal_reads_keep_two_session_principals_isolated():
+ from core.memory.http_headers import CALLER_SESSION_HEADER
+
+ first_principal = "u-11111111111111111111111111111111"
+ second_principal = "u-22222222222222222222222222222222"
++ project_id = "p-11111111111111111111111111111111"
+ calls: list[tuple[str, str]] = []
+
+ class _Runtime:
- async def profile_payload(self, principal_id):
++ async def profile_payload(self, principal_id, requested_project_id):
++ assert requested_project_id == project_id
+ calls.append(("profile", principal_id))
+ return {"status": "ok", "items": [{"kind": "profile", "text": principal_id}]}
+
- async def search_payload(self, _query, _limit, principal_id):
++ async def search_payload(self, _query, _limit, principal_id, requested_project_id):
++ assert requested_project_id == project_id
+ calls.append(("search", principal_id))
+ return {"status": "ok", "items": [{"kind": "fact", "text": principal_id}]}
+
+ controller = _build_controller_double()
+ controller.memory_runtime = _Runtime()
+ _set_memory_cli_sessions(
+ controller,
+ {"session-1": first_principal, "session-2": second_principal},
+ )
+ app = internal_server.create_app(controller)
+
+ async def _go():
+ transport = httpx.ASGITransport(app=app)
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
+ first_headers = {CALLER_SESSION_HEADER: "session-1"}
+ second_headers = {CALLER_SESSION_HEADER: "session-2"}
+ return (
+ await client.get("/internal/memory/profile", headers=first_headers),
+ await client.post(
+ "/internal/memory/search",
+ json={"query": "mine", "limit": 3},
+ headers=second_headers,
+ ),
+ await client.get("/internal/memory/profile"),
+ await client.post("/internal/memory/search", json={"query": "none", "limit": 3}),
+ )
+
+ first, second, unscoped_profile, unscoped_search = asyncio.run(_go())
+
+ assert first.json()["items"][0]["text"] == first_principal
+ assert second.json()["items"][0]["text"] == second_principal
+ assert unscoped_profile.status_code == 403
+ assert unscoped_search.status_code == 403
+ assert calls == [("profile", first_principal), ("search", second_principal)]
+
+
+def test_memory_remember_endpoint_returns_after_durable_capture_handoff():
+ controller = _build_controller_double()
+ capture_started = asyncio.Event()
+ release_capture = asyncio.Event()
+
+ class _Module:
+ async def capture(self, request):
+ capture_started.set()
+ await release_capture.wait()
+ return types.SimpleNamespace(status="accepted")
+
+ controller.memory_runtime = types.SimpleNamespace(module=_Module())
+ _set_memory_cli_sessions(
+ controller,
+ {"session-1": "u-11111111111111111111111111111111"},
+ )
+ app = internal_server.create_app(controller)
+
+ async def _go():
+ transport = httpx.ASGITransport(app=app)
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
+ response_task = asyncio.create_task(
+ client.post(
+ "/internal/memory/remember",
+ json={"text": "ordinary text"},
+ headers={
+ "X-Avibe-Caller-Session": "session-1",
+ },
+ )
+ )
+ await asyncio.wait_for(capture_started.wait(), timeout=1)
+ assert response_task.done() is False
+ release_capture.set()
+ response = await asyncio.wait_for(response_task, timeout=1)
+ assert response.status_code == 200
+ assert response.json() == {"status": "accepted"}
+
+ asyncio.run(_go())
# ---------------------------------------------------------------------
@@@ -6548,151 -5733,108 +6559,256 @@@ def test_boot_publishes_app_then_waits_
assert calls == ["app", "serve", "close"]
+# ---------------------------------------------------------------------
+# ASGI round-trips
+# ---------------------------------------------------------------------
+
+
+def test_flush_restores_memory_cli_admission_only_when_every_queued_turn_was_local(tmp_path, monkeypatch):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ session_id = _seed_avibe_session_with_queue([("first", None), ("second", None)])
+ from storage import message_deliveries
+ from storage.db import create_sqlite_engine
+
+ with create_sqlite_engine().begin() as conn:
+ rows = message_deliveries.list_queued(conn, session_id)
+ for row in rows:
+ delivery = message_deliveries.get_delivery(conn, row["id"])
+ assert delivery is not None
+ snapshot = json.loads(delivery["snapshot_json"])
+ metadata = json.loads(snapshot["metadata_json"])
+ metadata["_memory_cli_admitted"] = True
+ snapshot["metadata_json"] = json.dumps(metadata)
+ assert message_deliveries.cas_delivery(
+ conn,
+ row["id"],
+ expected_version=delivery["version"],
+ expected_states=("queued",),
+ values={"snapshot_json": json.dumps(snapshot)},
+ )
+ manager, runs = _manager_capturing_runs()
+ assert asyncio.run(manager.flush_queue(session_id)) is True
+ assert runs[0][2].platform_specific["memory_cli_admitted"] is True
+
+
+def test_flush_mixed_owner_user_rows_never_merge(tmp_path, monkeypatch):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+
+ from core.services import sessions as sessions_service
+ from storage import message_deliveries, messages_service
+ from storage.db import create_sqlite_engine
+ from storage.importer import ensure_sqlite_state
+ from storage.settings_service import upsert_scope
+
+ ensure_sqlite_state()
+ engine = create_sqlite_engine()
+ delivery_ids: list[str] = []
+ with engine.begin() as conn:
+ scope_id = upsert_scope(
+ conn, platform="avibe", scope_type="project", native_id="proj_mixed_owner", now="2026-05-31T00:00:00Z"
+ )
+ _seed_project_workdir(conn, scope_id, tmp_path)
+ session = sessions_service.create_session(
+ conn, scope_id=scope_id, agent_backend="claude", agent_name="worker"
+ )
+ for text, owner in (("u1", "remote:user-a"), ("u2", "remote:user-b")):
+ delivery = message_deliveries.enqueue_queued(
+ conn,
+ scope_id=scope_id,
+ session_id=session["id"],
+ platform="avibe",
+ author="user",
+ source="user",
+ text=text,
+ author_id=owner,
+ metadata={
+ "_web_push_user_key": owner,
+ "_memory_user_id": owner,
+ "_web_push_authorization_contexts": [
+ {
+ "user_key": owner,
+ "sub": owner.removeprefix("remote:"),
+ "email": f"{owner.removeprefix('remote:')}@example.com",
+ "vibe_instance_role": "editor",
+ "vibe_instance_access_source": "email",
+ "vibe_group_ids": [],
+ }
+ ],
+ },
+ )
+ delivery_ids.append(delivery["id"])
+
+ mgr, runs = _manager_accepting_runs()
+
+ assert asyncio.run(mgr.flush_queue(session["id"])) is True
+ assert [(t, s) for t, s, _ in runs] == [("u1", SOURCE_HUMAN)]
+ assert runs[0][2].user_id == "remote:user-a"
+ with engine.connect() as conn:
+ first_delivery = message_deliveries.get_delivery(conn, delivery_ids[0])
+ second_delivery = message_deliveries.get_delivery(conn, delivery_ids[1])
+ assert first_delivery is not None
+ assert second_delivery is not None
+ assert first_delivery["state"] == "accepted"
+ assert second_delivery["state"] == "claimed"
+ assert first_delivery["turn_id"] != second_delivery["turn_id"]
+ assert second_delivery["message_id"] is None
+ transcript = messages_service.list_session_messages(conn, session_id=session["id"], types=("user",))
+ from storage.models import messages
+
+ metadata_json = conn.execute(
+ select(messages.c.metadata_json).where(
+ messages.c.id == transcript["messages"][0]["id"]
+ )
+ ).scalar_one()
+ assert transcript["messages"][0]["author_id"] == "remote:user-a"
+ assert not any(
+ key.startswith("_web_push_")
+ for key in transcript["messages"][0]["metadata"]
+ )
+ assert transcript["messages"][0]["metadata"]["_memory_user_id"] == "remote:user-a"
+ persisted_metadata = json.loads(metadata_json)
+ assert persisted_metadata["_web_push_user_key"] == "remote:user-a"
+ assert [
+ record["user_key"]
+ for record in persisted_metadata["_web_push_authorization_contexts"]
+ ] == ["remote:user-a"]
+
+
+def test_shutdown_records_stopped_even_if_the_done_callback_never_runs(monkeypatch, tmp_path) -> None:
+ """``start``'s done callback is scheduled with ``call_soon``.
+
+ A shutdown that cancels the task and then closes the loop can finish before
+ that callback runs, which is why ``internal-server.json`` kept saying
+ "ready" after a normal stop. ``note_stopped`` makes the write deterministic.
+ """
+
+ status_path = tmp_path / "runtime" / "internal-server.json"
+ monkeypatch.setattr(paths, "get_internal_server_status_path", lambda: status_path)
+
+ async def never_returns(*_args, **_kwargs) -> None:
+ await asyncio.Event().wait()
+
+ monkeypatch.setattr(internal_server, "serve", never_returns)
+
+ async def run() -> asyncio.Task:
+ task = internal_server.start(object())
+ await asyncio.sleep(0)
+ assert json.loads(status_path.read_text(encoding="utf-8"))["state"] == "starting"
+ task.cancel()
+ try:
+ await task
+ except asyncio.CancelledError:
+ pass
+ # Deliberately do NOT yield to the loop here: that is what lets the
+ # done callback slip past a closing loop in the real shutdown path.
+ internal_server.note_stopped()
+ return task
+
+ asyncio.run(run())
+
+ assert json.loads(status_path.read_text(encoding="utf-8"))["state"] == "stopped"
+
+ def _seed_slack_dm_session(conn, tmp_path, *, dm_chat_id: str, user_id: str = "U_DM"):
+ """Create a Slack DM Session whose scope_id is the USER id, like production."""
+
+ import json as _json
+
+ from core.services import sessions as sessions_service
+ from storage.models import scope_settings
+ from storage.settings_service import upsert_scope
+
+ now = "2026-08-09T00:00:00Z"
+ scope_id = upsert_scope(
+ conn,
+ platform="slack",
+ scope_type="user",
+ native_id=user_id,
+ now=now,
+ )
+ payload = {"bound_at": now}
+ if dm_chat_id:
+ payload["dm_chat_id"] = dm_chat_id
+ conn.execute(
+ scope_settings.insert().values(
+ scope_id=scope_id,
+ enabled=1,
+ role=None,
+ workdir=str(tmp_path),
+ agent_name=None,
+ agent_backend=None,
+ agent_variant=None,
+ model=None,
+ reasoning_effort=None,
+ require_mention=None,
+ settings_version=1,
+ settings_json=_json.dumps(payload),
+ created_at=now,
+ updated_at=now,
+ )
+ )
+ return sessions_service.create_session(
+ conn,
+ scope_id=scope_id,
+ agent_backend="claude",
+ agent_name="claude",
+ )
+
+
+ def test_build_session_context_uses_bound_dm_channel_for_dm_scope(monkeypatch, tmp_path):
+ """A DM Session's scope_id is the USER id, which is not a channel.
+
+ Slack's ``chat.postMessage`` tolerates a user id (it opens the DM), so sending
+ kept working — but ``reactions.add`` answers ``channel_not_found``, so the
+ reaction ack failed and silently downgraded to the ack message. The builder
+ must swap in the bound ``dm_chat_id`` like every other resolver does.
+ """
+
+ from storage.db import create_sqlite_engine
+ from storage.importer import ensure_sqlite_state
+
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ ensure_sqlite_state()
+ engine = create_sqlite_engine()
+ with engine.begin() as conn:
+ session = _seed_slack_dm_session(conn, tmp_path, dm_chat_id="D_REAL")
+
+ context = internal_server._build_session_context(session["id"])
+
+ assert context.platform == "slack"
+ assert context.user_id == "U_DM"
+ assert context.channel_id == "D_REAL"
+ assert context.platform_specific["is_dm"] is True
+
+
+ def test_build_session_context_falls_back_to_scope_id_without_dm_binding(monkeypatch, tmp_path):
+ """No recorded dm_chat_id -> keep the old behaviour rather than inventing one."""
+
+ from storage.db import create_sqlite_engine
+ from storage.importer import ensure_sqlite_state
+
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ ensure_sqlite_state()
+ engine = create_sqlite_engine()
+ with engine.begin() as conn:
+ session = _seed_slack_dm_session(conn, tmp_path, dm_chat_id="", user_id="U_UNBOUND")
+
+ context = internal_server._build_session_context(session["id"])
+
+ assert context.channel_id == "U_UNBOUND"
+
+
+ def test_build_session_context_respects_explicit_channel_override(monkeypatch, tmp_path):
+ """An explicit channel_id (Delivery hydration) still wins over the binding."""
+
+ from storage.db import create_sqlite_engine
+ from storage.importer import ensure_sqlite_state
+
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ ensure_sqlite_state()
+ engine = create_sqlite_engine()
+ with engine.begin() as conn:
+ session = _seed_slack_dm_session(conn, tmp_path, dm_chat_id="D_REAL", user_id="U_OVERRIDE")
+
+ context = internal_server._build_session_context(session["id"], channel_id="D_EXPLICIT")
+
+ assert context.channel_id == "D_EXPLICIT"
diff --cc tests/test_ui_remote_access_auth.py
index e25561841,fdde9c872..322546e2b
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@@ -747,1318 -606,19 +747,1317 @@@ def test_remote_host_allows_valid_remot
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
config = _save_config(tmp_path)
client = app.test_client()
- client.set_cookie(remote_access.SESSION_COOKIE_NAME, remote_access.make_session_cookie(config, "[email protected]", "user-1"), domain="alex.avibe.bot")
+ client.set_cookie(remote_access.SESSION_COOKIE_NAME, remote_session_cookie(config, "[email protected]", "user-1"), domain="alex.avibe.bot")
+
+ response = client.get("/dashboard", base_url="https://alex.avibe.bot", follow_redirects=False)
+
+ assert response.status_code != 302
+
+
+def test_remote_generic_config_omits_memory_projection(monkeypatch, tmp_path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ config.memory.processing.llm.base_url = "https://llm.example.test/v1"
+ config.memory.processing.llm.model = "private-model"
+ config.save()
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-1"),
+ domain="alex.avibe.bot",
+ )
+
+ response = client.get(
+ "/api/config",
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 200
+ assert "memory" not in response.get_json()
+
+
+def test_remote_config_uses_the_safe_projection_for_an_instance_owner(monkeypatch, tmp_path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ config.runtime.default_cwd = "/private/local-agent-workdir"
+ config.agents.codex.cli_path = "/opt/avibe/bin/codex"
+ config.save()
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner", role="owner"),
+ domain="alex.avibe.bot",
+ )
+
+ response = client.get(
+ "/api/config",
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 200
+ payload = response.get_json()
+ assert payload["mode"] == "self_host"
+ assert payload["ui"]["instance_name"] == config.ui.instance_name
+ assert "runtime" not in payload
+ assert "agents" not in payload
+ assert "memory" not in payload
+
+
+def test_remote_config_post_uses_the_safe_projection_for_an_instance_owner(monkeypatch, tmp_path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ config.runtime.default_cwd = "/private/local-agent-workdir"
+ config.agents.codex.cli_path = "/opt/avibe/bin/codex"
+ config.save()
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner", role="owner"),
+ domain="alex.avibe.bot",
+ )
+
+ response = client.post(
+ "/api/config",
+ json={"ui": {"instance_name": "Remote Workbench"}},
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 200
+ payload = response.get_json()
+ assert payload["ui"]["instance_name"] == "Remote Workbench"
+ assert set(payload) == {"language", "mode", "setup_state", "ui", "version"}
+ assert "runtime" not in payload
+ assert "agents" not in payload
+ assert "memory" not in payload
+ assert "remote_access_runtime" not in payload
+ assert "platform_runtime" not in payload
+ assert "agent_backend_runtime" not in payload
+
-
+def test_remote_session_info_includes_authenticated_subject(monkeypatch, tmp_path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-1"),
+ domain="alex.avibe.bot",
+ )
+
+ response = client.get("/api/session", base_url="https://alex.avibe.bot")
+
+ assert response.status_code == 200
+ assert response.get_json() == {
+ "remote": True,
+ "authenticated": True,
+ "email": "[email protected]",
+ "sub": "user-1",
+ "instance_role": "owner",
+ "capabilities": {
+ "is_instance_owner": True,
+ "can_read_instance": True,
+ "can_chat": False,
+ "can_manage_projects": True,
+ "can_manage_agents": True,
+ "can_manage_instance": True,
+ "can_use_agents": True,
+ "can_use_skills": True,
+ "can_use_vault_secrets": True,
+ "can_use_show_pages": True,
+ "can_use_terminal_files": False,
+ "can_use_terminal": False,
+ "can_use_files": False,
+ "can_use_system": False,
+ },
+ }
+
+
+def test_remote_file_api_is_blocked_while_local_file_browsing_still_works(
+ monkeypatch,
+ tmp_path,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ remote_response = client.get(
+ "/api/files/list",
+ params={"path": str(tmp_path)},
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+ local_response = app.test_client().get(
+ "/api/files/list",
+ params={"path": str(tmp_path)},
+ base_url="http://localhost",
+ environ_base={"REMOTE_ADDR": "127.0.0.1"},
+ )
+
+ assert remote_response.status_code == 403
+ assert remote_response.get_json()["code"] == "remote_execution_disabled"
+ assert local_response.status_code == 200
+ assert local_response.get_json()["path"] == str(tmp_path.resolve())
+
+
+ ("method", "path", "json_body"),
+ [
+ ("PATCH", "/api/harness/tasks/task-1", {"enabled": False}),
+ ("DELETE", "/api/harness/tasks/task-1", None),
+ ("PATCH", "/api/harness/watches/watch-1", {"enabled": False}),
+ ("DELETE", "/api/harness/watches/watch-1", None),
+ ],
+)
+def test_remote_harness_mutations_are_blocked_before_store_access(
+ monkeypatch,
+ tmp_path,
+ method,
+ path,
+ json_body,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ response = client.request(
+ method,
+ path,
+ json=json_body,
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("path", "json_body", "controller_method"),
+ [
+ ("/api/sessions/ses-local/cancel", {}, "cancel_dispatch"),
+ (
+ "/api/running-agents/end",
+ {"backend": "codex", "base_session_id": "local-run"},
+ "end_running_agent",
+ ),
+ ],
+)
+def test_remote_agent_termination_is_blocked_before_controller_access(
+ monkeypatch,
+ tmp_path,
+ path,
+ json_body,
+ controller_method,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ async def unexpected_controller_call(*args, **kwargs):
+ raise AssertionError("remote termination reached the local controller")
+
+ monkeypatch.setattr(
+ f"vibe.internal_client.{controller_method}",
+ unexpected_controller_call,
+ )
+ response = client.post(
+ path,
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
[email protected]("path", ("/api/running-agents", "/api/agents-graph"))
+def test_remote_runtime_snapshots_are_blocked_before_controller_access(monkeypatch, tmp_path, path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner", role="owner"),
+ domain="alex.avibe.bot",
+ )
+
+ async def unexpected_snapshot(*args, **kwargs):
+ raise AssertionError("remote runtime snapshot reached the local controller")
+
+ monkeypatch.setattr("vibe.internal_client.list_running_agents", unexpected_snapshot)
+ response = client.get(
+ path,
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ "json_body",
+ [
+ {"agent_name": "codex"},
+ {"model": "gpt-5"},
+ {"reasoning_effort": "high"},
+ {"scope_id": "scope-local"},
+ ],
+)
+def test_remote_session_execution_settings_are_blocked_before_store_access(
+ monkeypatch,
+ tmp_path,
+ json_body,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_session_update(*args, **kwargs):
+ raise AssertionError("remote session routing reached the local session store")
+
+ monkeypatch.setattr(
+ "core.services.sessions.update_session",
+ unexpected_session_update,
+ )
+ response = client.patch(
+ "/api/sessions/ses-local",
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("method", "path", "json_body"),
+ [
+ ("POST", "/api/projects", {"folder_path": "/tmp/remote-project"}),
+ ("PATCH", "/api/projects/proj-local", {"folder_path": "/tmp/remote-project"}),
+ ("PATCH", "/api/projects/proj-local", {"agent_name": "codex"}),
+ ("PATCH", "/api/projects/proj-local", {"model": "gpt-5"}),
+ ],
+)
+def test_remote_project_execution_settings_are_blocked_before_store_access(
+ monkeypatch,
+ tmp_path,
+ method,
+ path,
+ json_body,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ monkeypatch.setattr(
+ "storage.projects_service.create_project",
+ lambda *args, **kwargs: (_ for _ in ()).throw(
+ AssertionError("remote project creation reached the local project store")
+ ),
+ )
+ monkeypatch.setattr(
+ "storage.projects_service.update_project",
+ lambda *args, **kwargs: (_ for _ in ()).throw(
+ AssertionError("remote project routing reached the local project store")
+ ),
+ )
+ response = client.request(
+ method,
+ path,
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_im_settings_are_rejected_before_store_access(monkeypatch, tmp_path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ monkeypatch.setattr(
+ api,
+ "save_settings",
+ lambda payload: (_ for _ in ()).throw(
+ AssertionError("remote IM configuration reached the local settings store")
+ ),
+ )
+ response = client.post(
+ "/api/settings",
+ json={"platform": "slack", "channels": {"C1": {"enabled": False}}},
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_im_settings_read_is_rejected_before_store_access(monkeypatch, tmp_path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+ monkeypatch.setattr(
+ api,
+ "get_settings",
+ lambda *args, **kwargs: (_ for _ in ()).throw(
+ AssertionError("remote IM settings read reached the local settings store")
+ ),
+ )
+
+ response = client.get(
+ "/api/settings?platform=slack",
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_thread_scope_settings_are_blocked_before_store_access(monkeypatch, tmp_path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+ monkeypatch.setattr(
+ api,
+ "save_thread_settings",
+ lambda payload: (_ for _ in ()).throw(
+ AssertionError("remote thread routing reached the local settings store")
+ ),
+ )
+
+ response = client.post(
+ "/api/settings/thread",
+ json={
+ "platform": "telegram",
+ "channel_id": "channel-1",
+ "thread_id": "thread-1",
+ "settings": {"enabled": True},
+ },
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_session_fork_is_rejected_before_fork_reservation(monkeypatch, tmp_path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ async def unexpected_turn_state(session_id):
+ raise AssertionError(f"remote fork reached turn-state lookup for {session_id}")
+
+ monkeypatch.setattr(ui_server, "_session_turn_state_for_fork", unexpected_turn_state)
+ monkeypatch.setattr(
+ ui_server,
+ "_reserve_forked_session_for_ui",
+ lambda *args, **kwargs: (_ for _ in ()).throw(
+ AssertionError("remote fork reached the local session store")
+ ),
+ )
+
+ response = client.post(
+ "/api/sessions/ses-local/fork",
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ "json_body",
+ [
+ {"agents": {"codex": {"cli_path": "/tmp/remote-codex"}}},
+ {"platforms": {"enabled": ["telegram"], "primary": "telegram"}},
+ {"remote_access": {"provider": "none"}},
+ {"ui": {"setup_host": "0.0.0.0"}},
+ {"update": {"auto_update": False}},
+ {"show_pages_prompt": "follow remote instructions"},
+ {"future_runtime": {"enabled": True}},
+ ],
+)
+def test_remote_execution_config_changes_are_blocked_before_runtime_reconcile(
+ monkeypatch,
+ tmp_path,
+ json_body,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+ monkeypatch.setattr(
+ ui_server,
+ "_save_config_and_runtime_decisions",
+ lambda *args, **kwargs: (_ for _ in ()).throw(
+ AssertionError("remote execution config reached persistence/reconcile")
+ ),
+ )
+
+ response = client.post(
+ "/api/config",
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_session_and_project_metadata_predicates_remain_allowed():
+ assert not ui_server._is_remote_local_execution_request(
+ "PATCH", "/api/sessions/ses-local", {"title": "renamed"}
+ )
+ assert not ui_server._is_remote_local_execution_request(
+ "PATCH", "/api/projects/proj-local", {"display_name": "renamed"}
+ )
+
+
+ ("method", "path", "payload"),
+ [
+ ("POST", "/api/sessions", None),
+ ("POST", "/api/sessions", {"project_id": "proj-1", "future_route": "codex"}),
+ ("PATCH", "/api/sessions/ses-1", {"title": "renamed", "future_route": "codex"}),
+ ("POST", "/api/projects", {"display_name": "Project", "future_workdir": "/tmp"}),
+ ("PATCH", "/api/projects/proj-1", {"display_name": "Project", "future_route": "codex"}),
+ (
+ "POST",
+ "/api/settings",
+ {"platform": "slack", "channels": {"C1": {"enabled": True, "future_route": "codex"}}},
+ ),
+ (
+ "POST",
+ "/api/settings/thread",
+ {
+ "platform": "telegram",
+ "channel_id": "C1",
+ "thread_id": "T1",
+ "settings": {"enabled": True, "future_route": "codex"},
+ },
+ ),
+ (
+ "POST",
+ "/api/users",
+ {"platform": "slack", "users": {"U1": {"enabled": True, "future_route": "codex"}}},
+ ),
+ ],
+)
+def test_remote_payload_filtered_routes_reject_unknown_fields(method, path, payload):
+ assert ui_server._is_remote_local_execution_request(method, path, payload)
+
+
+def test_remote_config_allows_only_explicit_preferences_and_unchanged_round_trip(
+ monkeypatch,
+ tmp_path,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+
+ assert not ui_server._is_remote_local_execution_request(
+ "POST",
+ "/api/config",
+ {"language": "zh", "ui": {"instance_name": "Remote label"}},
+ )
+ assert not ui_server._is_remote_local_execution_request(
+ "POST",
+ "/api/config",
+ json.loads(json.dumps(api.config_to_payload(config))),
+ )
+ assert ui_server._is_remote_local_execution_request(
+ "POST",
+ "/api/config",
+ {"ui": {"future_setting": True}},
+ )
+
+
+def test_remote_config_strips_protected_round_trip_fields_before_persistence(
+ monkeypatch,
+ tmp_path,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+ payload = json.loads(json.dumps(api.config_to_payload(config)))
+ payload["language"] = "zh"
+ observed = []
+
+ def save_config(remote_payload):
+ observed.append(remote_payload)
+ return config, False, False, []
+
+ monkeypatch.setattr(ui_server, "_save_config_and_runtime_decisions", save_config)
+ monkeypatch.setattr(ui_server, "_ensure_remote_access_monitoring", lambda _config: None)
+ response = client.post(
+ "/api/config",
+ json=payload,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 200
+ assert len(observed) == 1
+ assert observed[0]["language"] == "zh"
+ assert observed[0]["ui"] == {
+ field: payload["ui"][field]
+ for field in ui_server._REMOTE_UI_CONFIG_MUTABLE_FIELDS
+ }
+ assert set(observed[0]).issubset(
+ ui_server._REMOTE_CONFIG_MUTABLE_FIELDS | {"ui"}
+ )
+ assert "runtime" not in observed[0]
+ assert "agents" not in observed[0]
+ assert "remote_access" not in observed[0]
+
+
+def test_remote_session_archive_is_blocked_before_store_access(
+ monkeypatch,
+ tmp_path,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_archive(*args, **kwargs):
+ raise AssertionError("remote archive reached the local session store")
+
+ monkeypatch.setattr(
+ "core.services.sessions.archive_session",
+ unexpected_archive,
+ )
+ response = client.delete(
+ "/api/sessions/ses-local",
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("path", "json_body", "call_target"),
+ [
+ ("/api/control", {"action": "restart"}, "vibe.runtime.read_status"),
+ ("/api/upgrade", {}, "vibe.api.do_upgrade"),
+ ("/api/agent/codex/install", {}, "vibe.api.start_agent_install_job"),
+ (
+ "/api/dependencies/askill/install",
+ {},
+ "vibe.api.start_dependency_install_job",
+ ),
+ ],
+)
+def test_remote_system_operations_are_blocked_before_runtime_calls(
+ monkeypatch,
+ tmp_path,
+ path,
+ json_body,
+ call_target,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_runtime_call(*args, **kwargs):
+ raise AssertionError("remote system operation reached the local runtime")
+
+ monkeypatch.setattr(call_target, unexpected_runtime_call)
+ response = client.post(
+ path,
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("method", "path", "json_body", "call_target"),
+ [
+ ("GET", "/api/doctor", None, "vibe.ui_server.paths.get_runtime_doctor_path"),
+ ("POST", "/api/doctor", {}, "vibe.cli._doctor"),
+ ("POST", "/api/logs", {}, "vibe.ui_server._resolve_log_sources"),
+ ("POST", "/api/ui/reload", {"host": "127.0.0.1", "port": 5123}, "vibe.runtime.read_status"),
+ ("POST", "/api/opencode/options", {"cwd": "/tmp/remote"}, "vibe.api.opencode_options_async"),
+ ("POST", "/api/opencode/setup-permission", {}, "vibe.api.setup_opencode_permission"),
+ ],
+)
+def test_remote_diagnostics_and_legacy_system_helpers_are_blocked_before_local_access(
+ monkeypatch,
+ tmp_path,
+ method,
+ path,
+ json_body,
+ call_target,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_local_access(*args, **kwargs):
+ raise AssertionError(f"remote request reached local capability: {path}")
+
+ monkeypatch.setattr(call_target, unexpected_local_access)
+ request_kwargs = {
+ "headers": csrf_headers(client, "https://alex.avibe.bot"),
+ "base_url": "https://alex.avibe.bot",
+ "environ_base": _remote_peer(),
+ }
+ if json_body is not None:
+ request_kwargs["json"] = json_body
+ response = client.request(method, path, **request_kwargs)
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("path", "call_target"),
+ [
+ ("/api/models/runtime/start", "vibe.ui_server._model_hub_service"),
+ ("/api/models/agents/codex/probe", "vibe.ui_server._model_hub_service"),
+ ("/api/backend/codex/restart", "vibe.api.restart_backend"),
+ ("/api/backend/codex/auth/test", "vibe.api.test_backend_auth_async"),
+ ],
+)
+def test_remote_model_and_backend_operations_are_blocked_before_runtime_calls(
+ monkeypatch,
+ tmp_path,
+ path,
+ call_target,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "1")
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_runtime_call(*args, **kwargs):
+ raise AssertionError("remote backend operation reached the local runtime")
+
+ monkeypatch.setattr(call_target, unexpected_runtime_call)
+ response = client.post(
+ path,
+ json={},
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_show_page_icon_upload_is_blocked_before_filesystem_access(
+ monkeypatch,
+ tmp_path,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_icon_write(*args, **kwargs):
+ raise AssertionError("remote icon upload reached the local filesystem")
+
+ monkeypatch.setattr(api, "upload_show_page_icon", unexpected_icon_write)
+ response = client.post(
+ "/api/show-pages/ses-local/icon",
+ files={"file": ("icon.svg", b"<svg/>", "image/svg+xml")},
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("path", "local_only"),
+ [
+ ("/api/models/runtime/status", False),
+ ("/api/models/agents", False),
+ ("/api/backend/codex/runtime", True),
+ ("/api/backend/codex/auth", True),
+ ],
+)
+def test_remote_model_and_backend_reads_follow_execution_safety_policy(path, local_only):
+ assert ui_server._is_remote_local_execution_request("GET", path) is local_only
+
+
+ ("method", "path", "json_body", "api_method"),
+ [
+ ("POST", "/api/agents", {"name": "remote"}, "create_vibe_agent"),
+ ("POST", "/api/agents/import", {}, "import_vibe_agents"),
+ ("POST", "/api/agents/default", {"name": "remote"}, "set_default_vibe_agent"),
+ ("PATCH", "/api/agents/remote", {"enabled": False}, "update_vibe_agent"),
+ ("DELETE", "/api/agents/remote", None, "remove_vibe_agent"),
+ ],
+)
+def test_remote_agent_definition_mutations_are_blocked_before_api_calls(
+ monkeypatch,
+ tmp_path,
+ method,
+ path,
+ json_body,
+ api_method,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_agent_call(*args, **kwargs):
+ raise AssertionError("remote Agent mutation reached the local Agent API")
+
+ monkeypatch.setattr(api, api_method, unexpected_agent_call)
+ response = client.request(
+ method,
+ path,
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("method", "path", "json_body", "api_method"),
+ [
+ ("POST", "/api/skills/preview", {"source": "./local-skill"}, "preview_skill_source"),
+ ("POST", "/api/skills", {"source": "gh:owner/repo"}, "add_skill"),
+ ("POST", "/api/skills/update", {"name": "demo"}, "update_skill"),
+ ("POST", "/api/skills/upload", {"content_base64": ""}, "upload_skill_zip"),
+ ("DELETE", "/api/skills/demo", None, "remove_skill"),
+ ],
+)
+def test_remote_skill_mutations_are_blocked_before_api_calls(
+ monkeypatch,
+ tmp_path,
+ method,
+ path,
+ json_body,
+ api_method,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ async def unexpected_skill_call(*args, **kwargs):
+ raise AssertionError("remote skill mutation reached the local Skills API")
+
+ monkeypatch.setattr(api, api_method, unexpected_skill_call)
+ response = client.request(
+ method,
+ path,
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("method", "path", "json_body", "api_method"),
+ [
+ ("POST", "/api/vault/secrets", {"name": "REMOTE_SECRET"}, "create_vault_secret"),
+ ("PATCH", "/api/vault/secrets/REMOTE_SECRET", {"description": "changed"}, "update_vault_secret"),
+ ("DELETE", "/api/vault/secrets/REMOTE_SECRET", None, "delete_vault_secret"),
+ ("POST", "/api/vault/grants", {"secret_name": "REMOTE_SECRET"}, "create_vault_grant"),
+ ("DELETE", "/api/vault/grants/grant-1", None, "revoke_vault_grant"),
+ ("POST", "/api/vault/sign", {"secret_name": "REMOTE_SECRET"}, "vault_sign"),
+ ],
+)
+def test_remote_vault_mutations_are_blocked_before_api_calls(
+ monkeypatch,
+ tmp_path,
+ method,
+ path,
+ json_body,
+ api_method,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_vault_call(*args, **kwargs):
+ raise AssertionError("remote Vault mutation reached the local Vault API")
+
+ monkeypatch.setattr(api, api_method, unexpected_vault_call)
+ response = client.request(
+ method,
+ path,
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("method", "path", "json_body", "api_method"),
+ [
+ ("POST", "/api/users", {"platform": "slack", "users": {"U1": {"enabled": True}}}, "save_users"),
+ ("POST", "/api/users/U1/admin", {"platform": "slack", "is_admin": True}, "toggle_admin"),
+ ("DELETE", "/api/users/U1", None, "remove_user"),
+ ],
+)
+def test_remote_im_user_mutations_are_blocked_before_api_calls(
+ monkeypatch,
+ tmp_path,
+ method,
+ path,
+ json_body,
+ api_method,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_user_call(*args, **kwargs):
+ raise AssertionError("remote IM user mutation reached the local user store")
+
+ monkeypatch.setattr(api, api_method, unexpected_user_call)
+ response = client.request(
+ method,
+ path,
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("method", "path", "json_body", "api_method"),
+ [
+ ("GET", "/api/bind-codes", None, "get_bind_codes"),
+ ("POST", "/api/bind-codes", {"type": "one_time"}, "create_bind_code"),
+ ("DELETE", "/api/bind-codes/CODE1", None, "delete_bind_code"),
+ ],
+)
+def test_remote_bind_code_operations_are_blocked_before_api_calls(
+ monkeypatch,
+ tmp_path,
+ method,
+ path,
+ json_body,
+ api_method,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_bind_code_call(*args, **kwargs):
+ raise AssertionError("remote bind-code operation reached the local auth store")
+
+ monkeypatch.setattr(api, api_method, unexpected_bind_code_call)
+ response = client.request(
+ method,
+ path,
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_project_archive_is_blocked_before_project_store(monkeypatch, tmp_path):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner", role="owner"),
+ domain="alex.avibe.bot",
+ )
+ monkeypatch.setattr(
+ "storage.projects_service.archive_project",
+ lambda *args, **kwargs: (_ for _ in ()).throw(
+ AssertionError("remote project archive reached the local project store")
+ ),
+ )
+
+ response = client.delete(
+ "/api/projects/proj-local",
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+ ("path", "json_body", "write_target"),
+ [
+ (
+ "/api/projects/proj-local/agents-md",
+ {"content": "remote instructions"},
+ "vibe.project_agents_md.save_agents_md",
+ ),
+ (
+ "/api/global-prompts",
+ {"content": "remote instructions", "backends": ["codex"]},
+ "vibe.global_agents_md.write_many_global_agents_md",
+ ),
+ ],
+)
+def test_remote_agent_instruction_writes_are_blocked_before_filesystem_access(
+ monkeypatch,
+ tmp_path,
+ path,
+ json_body,
+ write_target,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_instruction_write(*args, **kwargs):
+ raise AssertionError("remote instruction mutation reached the local filesystem")
+
+ monkeypatch.setattr(write_target, unexpected_instruction_write)
+ response = client.put(
+ path,
+ json=json_body,
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_queue_deletion_is_blocked_before_store_access(
+ monkeypatch,
+ tmp_path,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ def unexpected_queue_retirement(*args, **kwargs):
+ raise AssertionError("remote queue deletion reached the local delivery store")
+
+ monkeypatch.setattr(
+ "storage.message_deliveries.retire_queued_with_run",
+ unexpected_queue_retirement,
+ )
+ response = client.delete(
+ "/api/sessions/ses-local/queue/del-local",
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_owner_can_still_read_agent_instructions_and_queue(
+ monkeypatch,
+ tmp_path,
+):
+ from storage.importer import ensure_sqlite_state
+
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ ensure_sqlite_state()
+ monkeypatch.setattr(ui_server, "_resolve_project_dir", lambda project_id: str(tmp_path))
+ monkeypatch.setattr(
+ "vibe.global_agents_md.read_all_global_agents_md",
+ lambda: [],
+ )
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ project_response = client.get(
+ "/api/projects/proj-local/agents-md",
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+ global_response = client.get(
+ "/api/global-prompts",
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+ queue_response = client.get(
+ "/api/sessions/ses-local/queue",
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert project_response.status_code == 200
+ assert project_response.get_json()["source"] == "none"
+ assert global_response.status_code == 403
+ assert global_response.get_json()["code"] == "remote_execution_disabled"
+ assert queue_response.status_code == 200
+ assert queue_response.get_json() == {"queued": []}
+ assert ui_server._is_remote_local_execution_request("POST", "/api/skills/preview")
+
+
+def test_remote_show_dispatch_is_rejected_before_event_reservation(
+ monkeypatch,
+ tmp_path,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+ monkeypatch.setattr(ui_server, "_is_cli_show_event_request", lambda: True)
+
+ def unexpected_store():
+ raise AssertionError("remote Show dispatch must not reserve an event")
+
+ monkeypatch.setattr(ui_server, "_show_session_event_store", unexpected_store)
+ response = client.post(
+ "/api/show/sessions/ses-remote/events",
+ json={
+ "type": "human.intent.submitted",
+ "actor": "human",
+ "payload": {"intent": "choose", "dispatch": True},
+ },
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
+
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
+
+
+def test_remote_show_runtime_write_is_rejected_before_runtime_invocation(
+ monkeypatch,
+ tmp_path,
+):
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ remote_session_cookie(config, "[email protected]", "user-owner"),
+ domain="alex.avibe.bot",
+ )
+
+ async def unexpected_runtime(*args, **kwargs):
+ raise AssertionError("remote Show write reached the local Show Runtime")
+
+ monkeypatch.setattr(ui_server, "_show_page_runtime_response", unexpected_runtime)
+ response = client.post(
+ "/show/ses-remote/api/example",
+ json={"input": "remote"},
+ headers=csrf_headers(client, "https://alex.avibe.bot"),
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ )
- response = client.get("/dashboard", base_url="https://alex.avibe.bot", follow_redirects=False)
+ assert response.status_code == 403
+ assert response.get_json()["code"] == "remote_execution_disabled"
- assert response.status_code != 302
+def test_remote_owner_can_still_read_authorized_session_history(
+ monkeypatch,
+ tmp_path,
+):
+ from storage import messages_service, workbench_sessions_service
+ from storage.db import create_sqlite_engine
+ from storage.importer import ensure_sqlite_state
+ from storage.settings_service import upsert_scope
-def test_remote_generic_config_omits_memory_projection(monkeypatch, tmp_path):
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
config = _save_config(tmp_path)
- config.memory.processing.llm.base_url = "https://llm.example.test/v1"
- config.memory.processing.llm.model = "private-model"
- config.save()
+ ensure_sqlite_state()
+ engine = create_sqlite_engine()
+ with engine.begin() as conn:
+ scope_id = upsert_scope(
+ conn,
+ platform="avibe",
+ scope_type="project",
+ native_id="proj_remote_history",
+ now="2026-08-04T00:00:00Z",
+ )
+ session = workbench_sessions_service.create_session(
+ conn,
+ scope_id=scope_id,
+ agent_backend="codex",
+ agent_name="worker",
+ )
+ messages_service.append(
+ conn,
+ scope_id=scope_id,
+ session_id=session["id"],
+ platform="avibe",
+ author="user",
+ message_type="user",
+ text="readable history",
+ )
+
client = app.test_client()
client.set_cookie(
remote_access.SESSION_COOKIE_NAME,
diff --cc ui/src/components/AppShell.tsx
index 9538dbd07,024ab045b..9379194f4
--- a/ui/src/components/AppShell.tsx
+++ b/ui/src/components/AppShell.tsx
@@@ -30,7 -29,7 +30,8 @@@ import { InstallHint } from './InstallH
import logoImg from '../assets/logo.png';
import { getEnabledPlatforms, platformSupportsChannels } from '../lib/platforms';
import { useViewportHeightVar } from '../lib/useViewportHeightVar';
+import { OrganizationShell } from '../features/organization/OrganizationShell';
+ import { isAdvancedSettingsPath, isMemorySettingsPath } from '../lib/adminNavigation';
type ShellNavItem = {
// Optional: a parent that only groups children (no page of its own) omits `to`
@@@ -409,17 -364,17 +406,24 @@@ export const AppShell: React.FC = () =
const adminMobileTabs: ShellNavItem[] = [
{ to: '/', label: t('nav.workbench'), icon: Sparkles, variant: 'workbench' },
{ to: '/admin/dashboard', label: t('nav.dashboard'), icon: LayoutDashboard },
+ ...(ORGANIZATION_NAV_ENABLED
+ ? [{ to: '/admin/organization/overview', label: t('nav.organization'), icon: Building2 }]
+ : []),
{ label: t('nav.more'), icon: Menu, onClick: () => setAdminMenuOpen(true), match: () => adminMenuOpen },
+ {
+ to: '/admin/settings/messaging',
+ label: t('nav.advancedSettings'),
+ icon: Settings,
+ match: (pathname) => isAdvancedSettingsPath(pathname, memoryNavVisible),
+ },
];
- // The 更多 sheet shows the OVERFLOW — admin sections not already on the bottom
- // bar (控制台 + 高级设置) — so nothing is duplicated.
- const adminBottomBarPaths = new Set(['/admin/dashboard', '/admin/settings/messaging']);
+ // The More sheet shows the overflow: admin sections not already on the bottom
+ // bar. Keep its filtering aligned with the currently visible primary tabs.
+ const adminBottomBarPaths = new Set([
+ '/admin/dashboard',
+ ...(ORGANIZATION_NAV_ENABLED ? ['/admin/organization/overview'] : []),
++ '/admin/settings/messaging',
+ ]);
const adminSheetItems = adminItems
.filter((item) => !item.to || !adminBottomBarPaths.has(item.to))
// Groups start expanded in the sheet (the sheet is transient — show the
diff --cc ui/src/components/workbench/ChatPage.tsx
index eb7b7cb84,f7c4eb4ca..d78640739
--- a/ui/src/components/workbench/ChatPage.tsx
+++ b/ui/src/components/workbench/ChatPage.tsx
@@@ -1091,8 -1394,15 +1402,16 @@@ export const ChatPage: React.FC = () =
// while the URL is already on the new chat (Codex P2). Nulling it shows the
// loading state until refresh() resolves the new session.
setSession(null);
+ setSessionCanChat(false);
setMessages([]);
+ setVaultResolvedSourceIds(new Map());
+ vaultAnchorFetchesRef.current.clear();
+ vaultAnchorRetryAttemptsRef.current.clear();
+ vaultAnchorRetryExhaustedRef.current.clear();
+ vaultAnchorRetryWaitingRef.current.clear();
+ vaultAnchorInFlightRef.current = false;
+ deepLinkWindowHandledRef.current = false;
+ hiddenVaultRequestIdsRef.current.clear();
setOlderCursor(null);
setHistoricalWindow(false);
oldestLoadedIdRef.current = null;
@@@ -2125,7 -2427,8 +2452,8 @@@
key={sessionId ?? 'no-session'}
requests={vaultRequests}
onResolved={refreshVaultRequests}
+ onProvisionRequestHidden={markVaultRequestHidden}
- disabled={readOnly}
+ disabled={!writable}
>
{/* Mobile: a FIXED full-screen flex column (the AppShell brand header is
hidden on chat) so the composer has NO scrollable ancestor — that is what
diff --cc ui/src/i18n/en.json
index d07eefa23,ca1e7d908..ee01b4b9e
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@@ -1313,8 -1309,8 +1311,12 @@@
"memory_runtime_unpublished": "This Avibe version hasn't published a memory runtime yet.",
"memory_runtime_manifest_missing": "The memory runtime manifest is missing.",
"memory_runtime_manifest_unavailable": "The memory runtime manifest couldn't be downloaded.",
- "memory_runtime_archive_unavailable": "The memory runtime download isn't available right now."
+ "memory_runtime_archive_unavailable": "The memory runtime download isn't available right now.",
- "remote_execution_disabled": "Remote access is read-only for Agent, Harness, terminal, and file execution in this release. Open Avibe on the machine to run this action."
++ "remote_execution_disabled": "Remote access is read-only for Agent, Harness, terminal, and file execution in this release. Open Avibe on the machine to run this action.",
++ "memory_log_entry_not_found": "That Memory processing entry is no longer available.",
++ "memory_access_denied": "This caller isn't allowed to read that Memory data.",
++ "memory_reconcile_failed": "Avibe couldn't apply the Memory settings. Check the runtime logs for the failing step.",
++ "memory_restart_failed": "Restarting the Memory engine failed."
},
"apps": {
"title": "Apps",
@@@ -3014,8 -2982,7 +3016,9 @@@
"escalation": "On failure → escalation",
"triagePrompt": "Triage prompt",
"cwdFromSession": "Bound session, else runtime default or Avibe state dir",
- "cwdRuntimeDefault": "Runtime default, else Avibe state dir"
+ "cwdRuntimeDefault": "Runtime default, else Avibe state dir",
- "definition": "Definition"
++ "definition": "Definition",
++ "eventProcessing": "Event processing"
},
"taskKind": {
"command": "Command"
@@@ -3110,20 -3082,6 +3113,25 @@@
"sat": "Sat"
},
"weekdaySeparator": ", "
+ },
+ "soon": "soon",
+ "webhooksSoon": "Webhooks are coming soon",
+ "webhooksSoonBody": "Inbound HTTP triggers will land in a follow-up release. Tasks and watches cover scheduled and event-driven runs today.",
+ "schedule": {
+ "cron": "cron · {{value}}",
+ "oneShot": "one-shot · {{value}}"
+ },
+ "runtime": {
+ "running": "Running",
+ "paused": "Paused",
+ "idle": "Idle",
+ "enabled": "Enabled",
+ "disabled": "Disabled"
++ },
++ "processingHealth": {
++ "failing": "processing failed",
++ "degraded": "recent processing failure",
++ "unknown": "processing status unknown"
}
},
"chat": {
@@@ -3207,7 -3165,14 +3215,14 @@@
"showIntent": "Page action",
"harness": "From agent",
"from": "From",
- "agentFallback": "agent"
++ "agentFallback": "agent",
+ "vault": "From Vault",
+ "vaultProvided": "Secret provided",
+ "vaultAccessApproved": "Access approved",
+ "vaultSigned": "Signature complete",
+ "vaultDenied": "Denied",
+ "vaultFailed": "Failed",
- "vaultExpired": "Expired",
- "agentFallback": "agent"
++ "vaultExpired": "Expired"
},
"annotation": {
"titleUser": "User annotation",
@@@ -3261,7 -3227,7 +3276,8 @@@
"voiceStartFailed": "Voice recording could not start in this browser. Reload the page or try a supported browser.",
"voiceDraftChanged": "The draft changed during voice input. The recovered transcript is available to copy.",
"removeAttachment": "Remove",
-- "dropOverlay": "Drop files to attach"
++ "dropOverlay": "Drop files to attach",
++ "voicePreview": "Live transcription preview"
},
"media": {
"preview": "Preview",
@@@ -3617,11 -3583,12 +3633,12 @@@
"status": "Status",
"profile": "Profile",
"search": "Search",
- "log": "Log",
-- "settings": "Settings"
++ "settings": "Settings",
++ "log": "Log"
},
"remoteUnavailable": {
- "title": "Available on this device only",
- "description": "Memory settings and data are visible only from a direct connection to this Avibe install — not through Avibe Cloud or another remote route."
+ "title": "Memory unavailable on this connection",
+ "description": "Connect directly to this Avibe install or use an authenticated Avibe Cloud session. Other remote routes remain blocked."
},
"status": {
"title": "Status",
@@@ -3685,7 -3652,7 +3702,9 @@@
"distillation_rejected": "Distillation rejected",
"result_unknown": "Result unknown"
}
-- }
++ },
++ "restartEngine": "Restart engine",
++ "engineRestartCompleted": "Memory engine restarted."
},
"profile": {
"description": "The provider's current distilled profile of you, built from captured messages.",
@@@ -3695,7 -3662,12 +3714,12 @@@
"warningUnavailable": "A profile isn't available from this provider yet. This is expected, not an error — try Search instead, or check back later.",
"disabledHint": "Enable Memory to view your profile.",
"refresh": "Refresh",
- "sourceNote": "Distilled from your conversation history."
++ "sourceNote": "Distilled from your conversation history, plus any notes your Agent recorded.",
+ "summary": "Summary",
+ "explicitInfo": "Explicit information",
+ "implicitTraits": "Inferred traits",
+ "basis": "Basis",
- "evidence": "Evidence",
- "sourceNote": "Distilled from your conversation history, plus any notes your Agent recorded."
++ "evidence": "Evidence"
},
"search": {
"description": "Search your distilled profile, episodes, and facts.",
@@@ -3705,407 -3677,172 +3729,504 @@@
"empty": "No results.",
"searchFailed": "Search failed.",
"disabledHint": "Enable Memory to search.",
- "sourceNote": "Distilled from your conversation history."
+ "sourceNote": "Distilled from your conversation history, plus any notes your Agent recorded."
},
+ "settings": {
+ "loading": "Loading settings…",
+ "loadFailed": "Couldn't load Memory settings.",
+ "enableLabel": "Memory",
- "enableHint": "Distill eligible Workbench messages and bound, enabled private-IM messages into a per-user searchable memory.",
++ "enableHint": "Distill eligible Workbench messages and bound, enabled private-IM messages into a per-user searchable memory. Durable facts your Agent records while working for you are included as well.",
+ "dependencyNotReady": "The memory-runtime dependency isn't ready yet. Install or repair it from Settings → Dependencies, then try enabling Memory again.",
+ "goToDependencies": "Open Dependencies",
+ "llmTitle": "LLM endpoint",
+ "embeddingTitle": "Embedding endpoint",
+ "baseUrl": "Base URL",
+ "baseUrlPlaceholder": "https://api.example.com/v1",
+ "model": "Model",
+ "modelPlaceholder": "model name",
+ "apiKey": "API key",
+ "apiKeySet": "A key is set — leave blank to keep it.",
+ "apiKeyNotSet": "No key set.",
+ "apiKeyPlaceholder": "sk-…",
+ "apiKeyClearHint": "Keys are write-only — Avibe never shows a saved key back to you.",
+ "embeddingLocked": "Changing the embedding endpoint or model is disabled while memory data exists. Run Clear all first.",
+ "embeddingStatusPending": "Confirming Memory state… the embedding endpoint unlocks once it's confirmed no data exists.",
+ "save": "Save settings",
+ "saving": "Saving…",
+ "saveFailed": "Couldn't save Memory settings.",
+ "saved": "Memory settings saved.",
+ "disclosureTitle": "Before you enable Memory",
+ "disclosure": [
+ "Eligible Workbench and bound, enabled private-IM text is copied into a bounded local queue for processing.",
++ "Your Agent also records durable conclusions it distills from your conversations and from work on your machine — such as preferences, corrections, decisions, and lasting environment or account facts it encounters in files or tool output — into the same queue without an explicit request.",
+ "Once a message succeeds or exhausts its retries, its text is scrubbed immediately; a content-free tombstone may remain for up to 90 days, bounded to the newest 100,000 rows.",
+ "The Memory LLM and embedding endpoints are separate from your agent's model subscriptions.",
+ "These remote endpoints receive captured text or search queries and may retain them under their own policy.",
+ "Private-IM text has already traveled over that platform before capture and remains subject to that platform's own retention and sync.",
+ "The local runtime retains unflushed raw messages and extracted data in local state in addition to the visible profile.",
++ "Memory processing retains scrubbed, bounded provider request and response diagnostics for every user and project on this installation for up to 14 days or until Clear all.",
+ "Disabling Memory freezes local data rather than deleting it — use Clear all to remove it.",
+ "Clear all removes this install's local Memory data but cannot retract copies already sent to a remote endpoint or your original chat history.",
+ "Delivery to the Memory endpoints is at-least-once — a rare duplicate derived memory is possible after a timeout or crash.",
+ "Each platform user has a separate memory scope; identities are not linked across platforms."
+ ],
+ "clearKeyLabel": "Clear the saved key"
+ },
+ "clear": {
+ "button": "Clear all",
+ "confirmTitle": "Clear all local Memory data?",
- "confirmDescription": "This removes your distilled profile, episodes, facts, and any pending queued text on this install.",
++ "confirmDescription": "This removes your distilled profile, episodes, facts, pending queued text, and retained provider-call diagnostics on this install.",
+ "removesTitle": "This removes:",
+ "removes": [
+ "Your visible distilled profile",
+ "Hidden local buffers and indexes used to build it",
- "Pending and finished items in the local processing queue"
++ "Pending and finished items in the local processing queue",
++ "Retained provider request and response diagnostics"
+ ],
+ "keepsTitle": "This does not remove:",
+ "keeps": [
+ "Your original Avibe chat history",
+ "Copies already sent to a remote Memory endpoint",
+ "Copies or snapshots you created yourself",
+ "Any data stored outside the dedicated Memory folder",
+ "Existing logs, crash reports, or backups",
+ "Physical traces on the storage device — this is not a secure wipe"
+ ],
+ "confirmLabel": "Clear all",
+ "clearing": "Clearing…",
+ "cleared": "Memory data cleared.",
+ "failed": "Clear failed."
+ },
+ "kind": {
+ "profile": "Profile",
+ "episode": "Episode",
+ "fact": "Fact"
++ },
+ "log": {
+ "description": "Trace captured messages across every project and user.",
+ "loading": "Loading processing log…",
+ "loadFailed": "Couldn't load the processing log.",
+ "detailLoading": "Loading processing details…",
+ "detailFailed": "Couldn't load processing details.",
+ "detailUnavailable": "Processing details are unavailable.",
+ "forbidden": "This processing log isn't available on the current connection.",
+ "disabledHint": "Enable Memory to view its processing log.",
+ "empty": "No processed Memory entries yet.",
+ "refresh": "Refresh",
+ "loadMore": "Load more",
+ "limitReached": "Showing the first {{count}} entries. Refresh to see the newest processing activity.",
+ "back": "Back to processing log",
+ "messages": "{{count}} messages",
+ "runs": "{{count}} runs",
+ "providerCalls": "{{count}} calls",
+ "projectId": "Project ID",
+ "userId": "User ID",
+ "noPreview": "No text preview available.",
+ "recorderDegraded": "New provider calls aren't being recorded. Existing rows remain readable.",
+ "recorderCorrupt": "The provider call log is corrupt. Clear all Memory data to remove it before recording can resume.",
+ "clearAction": "Open Clear all",
+ "sectionUnavailable": "{{section}} is unavailable ({{reason}}). Other sections may still be complete.",
+ "sectionPartial": "{{section}} is partially available ({{reason}}).",
+ "section": {
+ "everos": "Timeline data",
+ "capture": "Capture attribution",
+ "calls": "Provider calls"
+ },
+ "timeline": "Processing timeline",
+ "step": {
+ "capture": "Capture and delivery",
+ "memcell": "Memcell created",
+ "strategy": "Memory strategy"
+ },
+ "reason": {
+ "missing": "source data is missing",
+ "busy": "source data is busy",
+ "malformed": "source data is malformed",
+ "expired": "attribution has expired",
+ "runsMissing": "processing runs are missing",
+ "runsBusy": "processing runs are busy",
+ "runsMalformed": "processing runs are malformed"
+ },
+ "status": {
+ "created": "Created",
+ "mixed": "Mixed",
+ "pending": "Pending",
+ "processing": "Processing",
+ "delivered": "Delivered",
+ "dead": "Stopped",
+ "running": "Running",
+ "ok": "Succeeded",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "deadLetter": "Stopped after retries",
+ "crashed": "Crashed",
+ "error": "Error",
+ "present": "Present",
+ "missing": "Missing",
+ "notSeen": "Not seen",
+ "indexed": "Indexed"
+ },
+ "callKind": {
+ "llm": "LLM",
+ "multimodalLlm": "Multimodal LLM",
+ "embedding": "Embedding"
+ },
+ "callStage": {
+ "boundary": "Request boundary",
+ "strategy": "Strategy",
+ "cascade": "Cascade",
+ "episodeExtract": "Episode extraction",
+ "parse": "Multimodal parsing"
+ },
+ "callSummary": "{{kind}} · {{status}}",
+ "profileTrigger": "Triggered profile run",
+ "unavailable": "Unavailable: {{reason}}",
+ "omittedSteps": "{{count}} older timeline steps omitted.",
+ "callDetails": "Provider calls",
+ "callsNotRecorded": "Provider calls were not recorded or have expired.",
+ "omittedCalls": "{{count}} older provider calls omitted.",
+ "droppedCalls": "{{count}} provider calls were dropped before this row.",
+ "copyCall": "Copy request and response",
+ "finishReason": "Finish reason",
+ "usage": "Prompt / completion tokens",
+ "request": "Request",
+ "response": "Response",
+ "currentState": "Current Memory state",
+ "currentProfile": "Profile",
+ "currentIndexing": "Indexing",
+ "currentStateOnly": "This is current state, not a historical snapshot of this processing run."
+ }
+ },
+ "organization": {
+ "nav": {
+ "overview": "Overview",
+ "instances": "Avibes",
+ "members": "Members",
+ "groups": "Groups",
+ "resources": "Resources"
},
- "settings": {
- "loading": "Loading settings…",
- "loadFailed": "Couldn't load Memory settings.",
- "enableLabel": "Memory",
- "enableHint": "Distill eligible Workbench messages and bound, enabled private-IM messages into a per-user searchable memory. Durable facts your Agent records while working for you are included as well.",
- "dependencyNotReady": "The memory-runtime dependency isn't ready yet. Install or repair it from Settings → Dependencies, then try enabling Memory again.",
- "goToDependencies": "Open Dependencies",
- "llmTitle": "LLM endpoint",
- "embeddingTitle": "Embedding endpoint",
- "baseUrl": "Base URL",
- "baseUrlPlaceholder": "https://api.example.com/v1",
- "model": "Model",
- "modelPlaceholder": "model name",
- "apiKey": "API key",
- "apiKeySet": "A key is set — leave blank to keep it.",
- "apiKeyNotSet": "No key set.",
- "apiKeyPlaceholder": "sk-…",
- "apiKeyClearHint": "Keys are write-only — Avibe never shows a saved key back to you.",
- "embeddingLocked": "Changing the embedding endpoint or model is disabled while memory data exists. Run Clear all first.",
- "embeddingStatusPending": "Confirming Memory state… the embedding endpoint unlocks once it's confirmed no data exists.",
- "save": "Save settings",
- "saving": "Saving…",
- "saveFailed": "Couldn't save Memory settings.",
- "saved": "Memory settings saved.",
- "disclosureTitle": "Before you enable Memory",
- "disclosure": [
- "Eligible Workbench and bound, enabled private-IM text is copied into a bounded local queue for processing.",
- "Your Agent also records durable conclusions it distills from your conversations and from work on your machine — such as preferences, corrections, decisions, and lasting environment or account facts it encounters in files or tool output — into the same queue without an explicit request.",
- "Once a message succeeds or exhausts its retries, its text is scrubbed immediately; a content-free tombstone may remain for up to 90 days, bounded to the newest 100,000 rows.",
- "The Memory LLM and embedding endpoints are separate from your agent's model subscriptions.",
- "These remote endpoints receive captured text or search queries and may retain them under their own policy.",
- "Private-IM text has already traveled over that platform before capture and remains subject to that platform's own retention and sync.",
- "The local runtime retains unflushed raw messages and extracted data in local state in addition to the visible profile.",
- "Memory processing retains scrubbed, bounded provider request and response diagnostics for every user and project on this installation for up to 14 days or until Clear all.",
- "Disabling Memory freezes local data rather than deleting it — use Clear all to remove it.",
- "Clear all removes this install's local Memory data but cannot retract copies already sent to a remote endpoint or your original chat history.",
- "Delivery to the Memory endpoints is at-least-once — a rare duplicate derived memory is possible after a timeout or crash.",
- "Each platform user has a separate memory scope; identities are not linked across platforms."
- ],
- "clearKeyLabel": "Clear the saved key"
+ "actions": {
+ "backToControlPanel": "Control Panel",
+ "openRemoteAccess": "Open Remote Access",
+ "signIn": "Sign in with Avibe Cloud",
+ "signInAgain": "Sign in with the same account",
+ "signOut": "Sign out of Organization management",
+ "reload": "Review latest",
+ "saving": "Saving...",
+ "saveChanges": "Save changes",
+ "sendInvite": "Send invite",
+ "inviteMember": "Invite member",
+ "editMember": "Edit member",
+ "removeMember": "Remove member",
+ "resendInvite": "Resend invite",
+ "exportCsv": "Export CSV",
+ "newGroup": "New group",
+ "editGroup": "Edit group",
+ "archiveGroup": "Archive group",
+ "restoreGroup": "Restore group",
+ "manageMembers": "Manage members",
+ "saveMembers": "Save members",
+ "addAccess": "Add access",
+ "editAccess": "Edit access",
+ "removeAccess": "Remove access",
+ "addBinding": "Add binding",
+ "removeBinding": "Remove binding",
+ "manage": "Manage"
},
- "clear": {
- "button": "Clear all",
- "confirmTitle": "Clear all local Memory data?",
- "confirmDescription": "This removes your distilled profile, episodes, facts, pending queued text, and retained provider-call diagnostics on this install.",
- "removesTitle": "This removes:",
- "removes": [
- "Your visible distilled profile",
- "Hidden local buffers and indexes used to build it",
- "Pending and finished items in the local processing queue",
- "Retained provider request and response diagnostics"
- ],
- "keepsTitle": "This does not remove:",
- "keeps": [
- "Your original Avibe chat history",
- "Copies already sent to a remote Memory endpoint",
- "Copies or snapshots you created yourself",
- "Any data stored outside the dedicated Memory folder",
- "Existing logs, crash reports, or backups",
- "Physical traces on the storage device — this is not a secure wipe"
- ],
- "confirmLabel": "Clear all",
- "clearing": "Clearing…",
- "cleared": "Memory data cleared.",
- "failed": "Clear failed."
+ "roles": {
+ "owner": "Owner",
+ "admin": "Admin",
+ "member": "Member"
},
- "kind": {
- "profile": "Profile",
- "episode": "Episode",
- "fact": "Fact"
+ "status": {
+ "active": "Active",
+ "invited": "Invited",
+ "removed": "Removed"
+ },
+ "sync": {
+ "none": "No managed policies",
+ "in_sync": "In sync",
+ "applying": "Applying",
+ "offline": "Offline",
+ "error": "Error",
+ "deleted": "Deleted"
+ },
+ "sidebar": {
+ "section": "Organization",
+ "organizationCount": "{{count}} organizations",
+ "switchOrganization": "Switch Organization",
+ "cloudConnected": "Cloud connected",
+ "sessionRemaining": "management session · {{minutes}}m",
+ "openMenu": "Open Organization menu"
+ },
+ "states": {
+ "loadingTitle": "Loading Organization",
+ "loadingBody": "Fetching the latest Organization data from Avibe Cloud.",
+ "notConnectedTitle": "Avibe Cloud is not connected",
+ "notConnectedBody": "Connect this Avibe to Avibe Cloud before opening Organization management.",
+ "signInTitle": "Sign in required",
+ "signInBody": "Sign in to Avibe Cloud to establish a short-lived Organization management session.",
+ "reauthorizingTitle": "Reauthorizing",
+ "reauthorizingBody": "Restoring your Organization management session with the same Cloud account.",
+ "mismatchTitle": "Cloud account does not match",
+ "mismatchBody": "The Avibe session and Cloud account belong to different users. Sign in again with the same account used for this Avibe session.",
+ "unreachableTitle": "Avibe Cloud is unreachable",
+ "unreachableBody": "Organization data could not be reached. Your local Avibe remains available.",
+ "revokedTitle": "Organization access was revoked",
+ "revokedBody": "This management session is no longer valid. Sign in again to confirm your current access.",
+ "emptyTitle": "No Organizations available",
+ "emptyBody": "The signed-in Cloud account is not an active member of an Organization.",
+ "unavailableTitle": "This Organization page is unavailable",
+ "unavailableBody": "Your current Organization or Avibe access does not allow this page.",
+ "errorTitle": "Unable to complete the request",
+ "conflictTitle": "This policy changed elsewhere",
+ "conflictBody": "Your draft was not saved. Review it, then reload the latest version before making changes again."
+ },
+ "errors": {
+ "generic": "Avibe could not complete this Organization request.",
+ "forbidden": "Your current Organization role does not allow this action.",
+ "organization_not_found": "This Organization is unavailable.",
+ "organization_member_not_found": "This member is no longer available.",
+ "organization_group_not_found": "This group is no longer available.",
+ "organization_group_archived": "Archived groups cannot be added to a new policy.",
+ "instance_not_found": "This Avibe is unavailable.",
+ "project_not_found": "This Project is unavailable.",
+ "resource_not_found": "This resource is unavailable.",
+ "member_email_taken": "That email already belongs to this Organization.",
+ "group_name_taken": "A group with that name already exists.",
+ "too_many_entries": "This policy has too many entries.",
+ "invalid_project_access_intent": "Choose a valid Project access rule.",
+ "invalid_project_access_principal": "One Project access principal is invalid.",
+ "invalid_project_access_role": "One Project access role is invalid.",
+ "invalid_resource_acl_intent": "Choose a valid Resource audience.",
+ "invalid_email": "Enter a valid email address.",
+ "invalid_domain": "Enter a valid email domain.",
+ "duplicate_instance_access_principal": "Each Avibe access principal can appear only once.",
+ "duplicate_project_access_principal": "Each Project principal can appear only once.",
+ "owner_entry_locked": "The Avibe owner's implicit access cannot be changed.",
+ "resource_sync_conflict": "This policy changed elsewhere. Review the latest version before saving.",
+ "organization_member_conflict": "This member changed elsewhere. Review the latest version before trying again.",
+ "organization_group_conflict": "This group changed elsewhere. Review the latest version before trying again."
+ },
+ "fields": {
+ "name": "Name",
+ "description": "Description",
+ "color": "Color",
+ "email": "Email",
+ "role": "Role",
+ "groups": "Groups",
+ "member": "Member",
+ "status": "Status",
+ "principalType": "Principal type",
+ "principal": "Principal"
+ },
+ "colors": {
+ "mint": "Mint",
+ "cyan": "Cyan",
+ "blue": "Blue",
+ "violet": "Violet",
+ "rose": "Rose",
+ "gold": "Gold"
+ },
+ "principals": {
+ "organization_group": "Group",
+ "email": "Email",
+ "email_domain": "Email domain"
+ },
+ "breadcrumb": {
+ "overview": "Organization / Overview",
+ "members": "Organization / Members",
+ "groups": "Organization / Groups",
+ "groupDetail": "Organization / Groups / {{name}}",
+ "instances": "Organization / Avibes",
+ "resources": "Organization / Resources"
+ },
+ "overview": {
+ "description": "Manage membership, access, and policy health for this Organization.",
+ "memberDescription": "Your Organization membership and the Avibes available to you.",
+ "memberBreakdown": "{{invited}} invited · {{removed}} removed",
+ "groupBreakdown": "{{archived}} archived",
+ "projects": "Projects",
+ "projectCountUnavailable": "Count unavailable",
+ "policySync": "Policy sync",
+ "needsAttention": "Needs attention",
+ "instanceNeedsAttention": "{{name}} has policy changes that need attention.",
+ "projectSyncNeedsAttention": "{{name}} has Project policies that need attention.",
+ "resourceSyncNeedsAttention": "{{name}} has Resource policies that need attention.",
+ "noAttention": "All visible managed policies are healthy.",
+ "pendingInvites": "Pending invites",
+ "pendingInvitesBody": "{{count}} invitation(s) are waiting to be accepted.",
+ "viewAllInstances": "View all Avibes",
+ "memberSafeTitle": "Member view",
+ "memberSafeBody": "You can see your own membership and the Avibes available to you. Member directories and Resource policy composition are visible only to Organization managers."
+ },
+ "members": {
+ "description": "Invite members, assign Organization roles, and manage group membership.",
+ "memberDescription": "View your Organization role and group membership.",
+ "filterLabel": "Filter members",
+ "filterAll": "All",
+ "active": "Active",
+ "invited": "Invited",
+ "removed": "Removed",
+ "admins": "Admins",
+ "searchPlaceholder": "Search members...",
+ "emptyTitle": "No members found",
+ "emptyBody": "No members match the current view.",
+ "inviteTitle": "Invite a member",
+ "inviteBody": "Send an Organization invitation and optionally assign initial groups.",
+ "editTitle": "Edit member",
+ "editBody": "Changes to role and complete group membership share one revision.",
+ "emailPlaceholder": "[email protected]",
+ "downgradeTitle": "Downgrade this admin?",
+ "downgradeBody": "{{email}} will lose Organization management access. Their membership and group assignments will remain unchanged.",
+ "downgradeConfirm": "Downgrade to member",
+ "removeTitle": "Remove this member?",
+ "removeBody": "{{email}} will lose Organization membership and any access derived from it."
+ },
+ "groups": {
+ "description": "Build reusable Organization audiences and inspect every policy that references them.",
+ "memberDescription": "View Organization groups and your own group membership.",
+ "active": "Active",
+ "archived": "Archived",
+ "filterLabel": "Filter groups",
+ "searchPlaceholder": "Search groups...",
+ "emptyTitle": "No groups found",
+ "emptyBody": "No groups match the current view.",
+ "noDescription": "No description",
+ "yourGroup": "Your group",
+ "createTitle": "Create group",
+ "createBody": "Create an Organization group and optionally add initial members.",
+ "editTitle": "Edit group",
+ "editBody": "Update the group's display details.",
+ "initialMembers": "Initial members",
+ "manageMembersTitle": "Manage group members",
+ "manageMembersBody": "Replace the complete member list for {{name}}.",
+ "referencedBy": "Referenced by",
+ "moreReferences": "+{{count}} more",
+ "archiveTitle": "Archive this group?",
+ "archiveBody": "{{name}} is referenced by {{count}} active policy item(s).",
+ "archiveImpactTitle": "Archive impact",
+ "archiveImpactBody": "Existing references remain visible but stop granting access. The archived group cannot be selected for new policies."
+ },
+ "instances": {
+ "description": "Organization-bound Avibes you can see. Manage access and Project policy without changing pairing or hostnames.",
+ "searchPlaceholder": "Search Avibes...",
+ "emptyTitle": "No Avibes found",
+ "emptyBody": "No Organization-bound Avibes are available in this view.",
+ "you": "You",
+ "organizationOwner": "Avibe owner",
+ "ownerProtected": "Owner identity protected",
+ "youAreOwner": "you are the Avibe owner",
+ "paired": "Paired",
+ "notPaired": "Not paired",
+ "accessCount": "{{count}} access entries",
+ "accessTab": "Access",
+ "projectsTab": "Projects",
+ "tabsLabel": "Avibe management views",
+ "columns": {
+ "instance": "Avibe",
+ "owner": "Owner",
+ "address": "Public address",
+ "status": "Status",
+ "access": "Access",
+ "sync": "Sync"
+ },
+ "status": {
+ "pending": "Pending",
+ "active": "Online",
+ "disabled": "Disabled",
+ "deleted": "Deleted"
+ }
+ },
+ "access": {
+ "viewer": "Viewer",
+ "editor": "Editor",
+ "ownerTitle": "{{owner}} · Avibe owner",
+ "ownerBody": "Implicit owner-equivalent access. It cannot be edited or removed as an entry.",
+ "emptyTitle": "No explicit access entries",
+ "emptyBody": "Only the implicit Avibe owner currently has access.",
+ "addTitle": "Add Avibe access",
+ "editTitle": "Edit Avibe access",
+ "dialogBody": "Grant a group, individual email, or email domain Viewer or Editor access.",
+ "emailPlaceholder": "[email protected]",
+ "domainPlaceholder": "example.com",
+ "narrowTitle": "Narrow this access entry?",
+ "narrowBody": "The previous principal or Editor capability will stop applying after this change.",
+ "removeTitle": "Remove this access entry?",
+ "removeBody": "{{principal}} will lose access granted by this entry.",
+ "columns": {
+ "principal": "Principal",
+ "type": "Type",
+ "role": "Role"
+ }
+ },
+ "projects": {
+ "searchPlaceholder": "Search Projects...",
+ "safeDescriptorNotice": "Safe descriptors only. Local Project paths are never displayed or sent. Project access can only narrow the Avibe role.",
+ "emptyTitle": "No Projects found",
+ "emptyBody": "This Avibe has not published any active managed Project descriptors.",
+ "accessRule": "Access rule",
+ "bindings": "Restricted bindings",
+ "bindingRequired": "Restricted access requires at least one binding.",
+ "usesAvibeRole": "Uses Avibe role",
+ "ownerOnlyAudience": "Avibe owner only",
+ "bindingCount": "{{count}} binding(s)",
+ "dialogTitle": "Manage {{name}} access",
+ "dialogBody": "Organization management authority lets you change this policy; it does not grant you permission to use the Project.",
+ "narrowTitle": "Narrow this Project's access?",
+ "narrowBody": "This change removes an existing audience, downgrades Editor access, or switches to a more restrictive rule.",
+ "modes": {
+ "inherit": "Inherit",
+ "restricted": "Restricted",
+ "owner_only": "Owner-only"
+ },
+ "modeHelp": {
+ "inherit": "Use each principal's effective Avibe role.",
+ "restricted": "Allow one or more explicit groups, emails, or domains. This rule can only narrow the Avibe role.",
+ "owner_only": "Only the canonical owner of this Avibe can use this Project. Organization managers can manage the policy but do not gain use access."
+ },
+ "columns": {
+ "project": "Project",
+ "rule": "Access rule",
+ "bindings": "Bindings",
+ "sync": "Sync"
+ }
+ },
+ "resources": {
+ "description": "Manage which Organization audience may use each resource. Resource use never grants permission to edit, delete, or re-share it.",
+ "tabsLabel": "Resource kinds",
+ "accessLevel": "Audience",
+ "selectGroups": "Selected groups",
+ "groupRequired": "Select at least one group.",
+ "dialogTitle": "Manage {{name}} audience",
+ "dialogBody": "Choose Private, the whole Organization, or selected Organization groups.",
+ "narrowTitle": "Narrow this resource audience?",
+ "narrowBody": "Some people who can use this resource now will lose access after this change.",
+ "emptyTitle": "No resources found",
+ "emptyBody": "No active {{kind}} descriptors are available.",
+ "everyActiveMember": "Every active member",
+ "ownerOnly": "Resource owner only",
+ "kinds": {
+ "agent": "Agents",
+ "vault_secret": "Vault secrets",
+ "skill": "Skills",
+ "show_page": "Show Pages"
+ },
+ "levels": {
+ "private": "Private",
+ "public": "Organization",
+ "scope": "Selected groups"
+ },
+ "levelHelp": {
+ "private": "Only the resource owner can use it through this Organization ACL.",
+ "public": "Every active member of this Organization may use it, subject to all other access layers.",
+ "scope": "Only active members of the selected groups may use it, subject to all other access layers."
+ },
+ "columns": {
+ "access": "Access",
+ "audience": "Audience",
+ "sync": "Sync"
+ }
}
}
}
diff --cc ui/src/i18n/zh.json
index b908d0a55,632a28396..ddf7a61c2
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@@ -1313,8 -1309,8 +1311,12 @@@
"memory_runtime_unpublished": "当前 Avibe 版本尚未发布记忆运行时。",
"memory_runtime_manifest_missing": "记忆运行时的清单缺失。",
"memory_runtime_manifest_unavailable": "无法下载记忆运行时的清单。",
- "memory_runtime_archive_unavailable": "记忆运行时的下载包当前不可用。"
+ "memory_runtime_archive_unavailable": "记忆运行时的下载包当前不可用。",
- "remote_execution_disabled": "当前版本的远程访问仅支持查看,不能执行 Agent、Harness、终端或文件操作。请在运行 Avibe 的机器上执行此操作。"
++ "remote_execution_disabled": "当前版本的远程访问仅支持查看,不能执行 Agent、Harness、终端或文件操作。请在运行 Avibe 的机器上执行此操作。",
++ "memory_log_entry_not_found": "该记忆处理条目已不可用。",
++ "memory_access_denied": "该调用方无权读取此记忆数据。",
++ "memory_reconcile_failed": "Avibe 无法应用记忆设置。请查看运行时日志了解失败步骤。",
++ "memory_restart_failed": "重启记忆引擎失败。"
},
"apps": {
"title": "应用",
@@@ -3014,8 -2982,7 +3016,9 @@@
"escalation": "失败后 → 交给 Agent",
"triagePrompt": "排查提示词",
"cwdFromSession": "跟随绑定会话,否则运行时默认目录或 Avibe 状态目录",
- "cwdRuntimeDefault": "运行时默认目录,否则 Avibe 状态目录"
+ "cwdRuntimeDefault": "运行时默认目录,否则 Avibe 状态目录",
- "definition": "定义"
++ "definition": "定义",
++ "eventProcessing": "事件处理"
},
"taskKind": {
"command": "命令"
@@@ -3110,20 -3082,6 +3113,25 @@@
"sat": "六"
},
"weekdaySeparator": "、"
+ },
+ "soon": "敬请期待",
+ "webhooksSoon": "Webhook 即将上线",
+ "webhooksSoonBody": "入站 HTTP 触发将在后续版本中落地。Tasks 和 Watches 已覆盖定时与事件驱动的运行。",
+ "schedule": {
+ "cron": "周期 · {{value}}",
+ "oneShot": "一次性 · {{value}}"
+ },
+ "runtime": {
+ "running": "运行中",
+ "paused": "已暂停",
+ "idle": "空闲",
+ "enabled": "已启用",
+ "disabled": "已禁用"
++ },
++ "processingHealth": {
++ "failing": "处理失败",
++ "degraded": "近期处理失败",
++ "unknown": "处理状态未知"
}
},
"chat": {
@@@ -3207,7 -3165,14 +3215,14 @@@
"showIntent": "页面操作",
"harness": "来自 Agent",
"from": "来自",
- "agentFallback": "智能体"
++ "agentFallback": "智能体",
+ "vault": "来自 Vault",
+ "vaultProvided": "填写完成",
+ "vaultAccessApproved": "访问已批准",
+ "vaultSigned": "签名完成",
+ "vaultDenied": "已拒绝",
+ "vaultFailed": "处理失败",
- "vaultExpired": "已过期",
- "agentFallback": "智能体"
++ "vaultExpired": "已过期"
},
"annotation": {
"titleUser": "用户批注",
@@@ -3261,7 -3227,7 +3276,8 @@@
"voiceStartFailed": "当前浏览器无法启动语音录制,请刷新页面或更换支持的浏览器。",
"voiceDraftChanged": "语音输入期间草稿已变化,已保留整理结果供复制。",
"removeAttachment": "移除",
-- "dropOverlay": "拖放文件以添加"
++ "dropOverlay": "拖放文件以添加",
++ "voicePreview": "实时转写预览"
},
"media": {
"preview": "预览",
@@@ -3617,11 -3583,12 +3633,12 @@@
"status": "状态",
"profile": "画像",
"search": "搜索",
- "log": "日志",
-- "settings": "设置"
++ "settings": "设置",
++ "log": "日志"
},
"remoteUnavailable": {
- "title": "仅限本机访问",
- "description": "记忆的设置和数据仅在直接连接到本机 Avibe 时可见——通过 Avibe Cloud 或其他远程方式无法访问。"
+ "title": "当前连接无法访问记忆",
+ "description": "请直接连接本机 Avibe,或使用已认证的 Avibe Cloud 会话。其他远程连接仍会被拒绝。"
},
"status": {
"title": "状态",
@@@ -3685,7 -3652,7 +3702,9 @@@
"distillation_rejected": "提炼被拒绝",
"result_unknown": "处理结果未知"
}
-- }
++ },
++ "restartEngine": "重启引擎",
++ "engineRestartCompleted": "记忆引擎已重启。"
},
"profile": {
"description": "由已捕获的消息提炼出的、你当前的画像。",
@@@ -3695,7 -3662,12 +3714,12 @@@
"warningUnavailable": "该提供方暂不支持画像。这是预期行为,不是错误——可以试试搜索,或稍后再来看看。",
"disabledHint": "启用记忆后即可查看画像。",
"refresh": "刷新",
- "sourceNote": "由你的对话历史提炼而来。"
++ "sourceNote": "由你的对话历史,以及 Agent 记录的内容(如有)提炼而来。",
+ "summary": "概览",
+ "explicitInfo": "明确信息",
+ "implicitTraits": "推断特征",
+ "basis": "推断依据",
- "evidence": "相关证据",
- "sourceNote": "由你的对话历史,以及 Agent 记录的内容(如有)提炼而来。"
++ "evidence": "相关证据"
},
"search": {
"description": "搜索你的画像、事件和事实。",
@@@ -3705,407 -3677,172 +3729,504 @@@
"empty": "没有结果。",
"searchFailed": "搜索失败。",
"disabledHint": "启用记忆后即可搜索。",
- "sourceNote": "由你的对话历史提炼而来。"
+ "sourceNote": "由你的对话历史,以及 Agent 记录的内容(如有)提炼而来。"
},
+ "settings": {
+ "loading": "正在加载设置…",
+ "loadFailed": "无法加载记忆设置。",
+ "enableLabel": "记忆",
- "enableHint": "将符合条件的 Workbench 消息和已绑定、已启用用户的私聊消息提炼为按用户隔离的可搜索记忆。",
++ "enableHint": "将符合条件的 Workbench 消息,以及已绑定且已启用用户的私聊消息,提炼为按用户隔离的可搜索记忆。Agent 在为你工作时记录的长期事实也会包含在内。",
+ "dependencyNotReady": "memory-runtime 依赖尚未就绪。请先在「设置 → 依赖」中安装或修复,然后重新尝试启用记忆。",
+ "goToDependencies": "前往依赖页面",
+ "llmTitle": "LLM 端点",
+ "embeddingTitle": "Embedding 端点",
+ "baseUrl": "Base URL",
+ "baseUrlPlaceholder": "https://api.example.com/v1",
+ "model": "模型",
+ "modelPlaceholder": "模型名称",
+ "apiKey": "API Key",
+ "apiKeySet": "已设置密钥——留空可保留原值。",
+ "apiKeyNotSet": "尚未设置密钥。",
+ "apiKeyPlaceholder": "sk-…",
+ "apiKeyClearHint": "密钥仅可写入——Avibe 不会把已保存的密钥回显给你。",
+ "embeddingLocked": "已有记忆数据时无法更改 Embedding 端点或模型,请先执行「清除全部」。",
+ "embeddingStatusPending": "正在确认记忆状态……确认没有数据后,Embedding 端点将解锁。",
+ "save": "保存设置",
+ "saving": "保存中…",
+ "saveFailed": "无法保存记忆设置。",
+ "saved": "记忆设置已保存。",
+ "disclosureTitle": "启用记忆前请了解",
+ "disclosure": [
+ "符合条件的 Workbench 文本和已绑定、已启用用户的私聊文本会被复制到有界本地队列中等待处理。",
++ "Agent 还会在没有明确要求的情况下,把它从对话以及在本机工作中提炼的长期结论(如偏好、纠偏、决策,以及在文件或工具输出中遇到的持久环境或账户事实)记录到同一队列。",
+ "一条消息处理成功或重试耗尽后,其文本会立即被清除;一个不含内容的去重标记最多保留 90 天,且以最新的 100,000 条为上限。",
+ "记忆使用的 LLM 与 Embedding 端点与你的 Agent 模型订阅是分开的。",
+ "这些远程端点会接收到被捕获的文本或搜索查询,并可能按其自身策略保留。",
+ "私聊文本在被捕获前已经过该平台传输,并继续受该平台自身的留存与同步策略约束。",
+ "本地运行时除了可见的画像外,还会在本地状态中保留尚未处理的原始消息和提取数据。",
++ "记忆处理会为本安装的所有用户和项目保留经脱敏且有大小限制的提供方请求与响应诊断,最长 14 天或直到执行「清除全部」。",
+ "禁用记忆只会冻结本地数据,不会删除——如需删除请使用「清除全部」。",
+ "「清除全部」只会移除本机上的本地记忆数据,无法追回已发送到远程端点的副本,也不会影响原始聊天记录。",
+ "发往记忆端点的投递是至少一次——超时或崩溃后偶尔可能出现重复的派生记忆。",
+ "每个平台用户拥有独立的记忆范围;不同平台之间不会自动关联身份。"
+ ],
+ "clearKeyLabel": "清除已保存的密钥"
+ },
+ "clear": {
+ "button": "清除全部",
+ "confirmTitle": "清除全部本地记忆数据?",
- "confirmDescription": "这会移除你的画像、事件、事实,以及本机上任何尚未处理的排队文本。",
++ "confirmDescription": "这会移除你的画像、事件、事实、本机上尚未处理的排队文本,以及已保留的提供方调用诊断。",
+ "removesTitle": "将会移除:",
+ "removes": [
+ "你可见的画像",
+ "用于构建画像的隐藏本地缓冲区和索引",
- "本地处理队列中待处理和已完成的条目"
++ "本地处理队列中待处理和已完成的条目",
++ "已保留的提供方请求和响应诊断"
+ ],
+ "keepsTitle": "不会移除:",
+ "keeps": [
+ "你原始的 Avibe 聊天记录",
+ "已发送到远程记忆端点的副本",
+ "你自己创建的副本或快照",
+ "存储在专用记忆目录之外的任何数据",
+ "现有的日志、崩溃报告或备份",
+ "存储设备上的物理残留——这不是安全擦除"
+ ],
+ "confirmLabel": "清除全部",
+ "clearing": "清除中…",
+ "cleared": "记忆数据已清除。",
+ "failed": "清除失败。"
+ },
+ "kind": {
+ "profile": "画像",
+ "episode": "事件",
+ "fact": "事实"
++ },
+ "log": {
+ "description": "查看所有项目和用户的消息如何转化为记忆状态。",
+ "loading": "正在加载处理日志…",
+ "loadFailed": "无法加载处理日志。",
+ "detailLoading": "正在加载处理详情…",
+ "detailFailed": "无法加载处理详情。",
+ "detailUnavailable": "处理详情不可用。",
+ "forbidden": "当前连接无法访问处理日志。",
+ "disabledHint": "启用记忆后即可查看处理日志。",
+ "empty": "还没有已处理的记忆条目。",
+ "refresh": "刷新",
+ "loadMore": "加载更多",
+ "limitReached": "当前显示前 {{count}} 条记录。刷新后可查看最新处理活动。",
+ "back": "返回处理日志",
+ "messages": "{{count}} 条消息",
+ "runs": "{{count}} 次运行",
+ "providerCalls": "{{count}} 次调用",
+ "projectId": "项目 ID",
+ "userId": "用户 ID",
+ "noPreview": "没有可用的文本预览。",
+ "recorderDegraded": "新的提供方调用未被记录,已有记录仍可读取。",
+ "recorderCorrupt": "提供方调用日志已损坏。必须先通过「清除全部」移除该日志,之后才能恢复记录。",
+ "clearAction": "打开「清除全部」",
+ "sectionUnavailable": "{{section}}不可用({{reason}}),其他部分可能仍然完整。",
+ "sectionPartial": "{{section}}部分可用({{reason}})。",
+ "section": {
+ "everos": "时间线数据",
+ "capture": "捕获关联",
+ "calls": "提供方调用"
+ },
+ "timeline": "处理时间线",
+ "step": {
+ "capture": "捕获与投递",
+ "memcell": "已创建 Memcell",
+ "strategy": "记忆策略"
+ },
+ "reason": {
+ "missing": "来源数据缺失",
+ "busy": "来源数据正忙",
+ "malformed": "来源数据格式异常",
+ "expired": "关联信息已过期",
+ "runsMissing": "处理运行记录缺失",
+ "runsBusy": "处理运行记录正忙",
+ "runsMalformed": "处理运行记录格式异常"
+ },
+ "status": {
+ "created": "已创建",
+ "mixed": "多种状态",
+ "pending": "等待中",
+ "processing": "处理中",
+ "delivered": "已投递",
+ "dead": "已停止",
+ "running": "运行中",
+ "ok": "成功",
+ "success": "成功",
+ "failed": "失败",
+ "deadLetter": "重试后停止",
+ "crashed": "已崩溃",
+ "error": "错误",
+ "present": "已存在",
+ "missing": "缺失",
+ "notSeen": "尚未发现",
+ "indexed": "已索引"
+ },
+ "callKind": {
+ "llm": "LLM",
+ "multimodalLlm": "多模态 LLM",
+ "embedding": "Embedding"
+ },
+ "callStage": {
+ "boundary": "请求边界",
+ "strategy": "处理策略",
+ "cascade": "级联处理",
+ "episodeExtract": "事件提取",
+ "parse": "多模态解析"
+ },
+ "callSummary": "{{kind}} · {{status}}",
+ "profileTrigger": "触发画像运行",
+ "unavailable": "不可用:{{reason}}",
+ "omittedSteps": "已省略 {{count}} 个较早的时间线步骤。",
+ "callDetails": "提供方调用",
+ "callsNotRecorded": "提供方调用未被记录或已经过期。",
+ "omittedCalls": "已省略 {{count}} 个较早的提供方调用。",
+ "droppedCalls": "此记录之前有 {{count}} 次提供方调用被丢弃。",
+ "copyCall": "复制请求和响应",
+ "finishReason": "结束原因",
+ "usage": "提示 / 补全 token",
+ "request": "请求",
+ "response": "响应",
+ "currentState": "当前记忆状态",
+ "currentProfile": "画像",
+ "currentIndexing": "索引",
+ "currentStateOnly": "这里显示的是当前状态,不是本次处理运行的历史快照。"
+ }
+ },
+ "organization": {
+ "nav": {
+ "overview": "概览",
+ "instances": "Avibe",
+ "members": "成员",
+ "groups": "群组",
+ "resources": "资源"
},
- "settings": {
- "loading": "正在加载设置…",
- "loadFailed": "无法加载记忆设置。",
- "enableLabel": "记忆",
- "enableHint": "将符合条件的 Workbench 消息,以及已绑定且已启用用户的私聊消息,提炼为按用户隔离的可搜索记忆。Agent 在为你工作时记录的长期事实也会包含在内。",
- "dependencyNotReady": "memory-runtime 依赖尚未就绪。请先在「设置 → 依赖」中安装或修复,然后重新尝试启用记忆。",
- "goToDependencies": "前往依赖页面",
- "llmTitle": "LLM 端点",
- "embeddingTitle": "Embedding 端点",
- "baseUrl": "Base URL",
- "baseUrlPlaceholder": "https://api.example.com/v1",
- "model": "模型",
- "modelPlaceholder": "模型名称",
- "apiKey": "API Key",
- "apiKeySet": "已设置密钥——留空可保留原值。",
- "apiKeyNotSet": "尚未设置密钥。",
- "apiKeyPlaceholder": "sk-…",
- "apiKeyClearHint": "密钥仅可写入——Avibe 不会把已保存的密钥回显给你。",
- "embeddingLocked": "已有记忆数据时无法更改 Embedding 端点或模型,请先执行「清除全部」。",
- "embeddingStatusPending": "正在确认记忆状态……确认没有数据后,Embedding 端点将解锁。",
- "save": "保存设置",
- "saving": "保存中…",
- "saveFailed": "无法保存记忆设置。",
- "saved": "记忆设置已保存。",
- "disclosureTitle": "启用记忆前请了解",
- "disclosure": [
- "符合条件的 Workbench 文本和已绑定、已启用用户的私聊文本会被复制到有界本地队列中等待处理。",
- "Agent 还会在没有明确要求的情况下,把它从对话以及在本机工作中提炼的长期结论(如偏好、纠偏、决策,以及在文件或工具输出中遇到的持久环境或账户事实)记录到同一队列。",
- "一条消息处理成功或重试耗尽后,其文本会立即被清除;一个不含内容的去重标记最多保留 90 天,且以最新的 100,000 条为上限。",
- "记忆使用的 LLM 与 Embedding 端点与你的 Agent 模型订阅是分开的。",
- "这些远程端点会接收到被捕获的文本或搜索查询,并可能按其自身策略保留。",
- "私聊文本在被捕获前已经过该平台传输,并继续受该平台自身的留存与同步策略约束。",
- "本地运行时除了可见的画像外,还会在本地状态中保留尚未处理的原始消息和提取数据。",
- "记忆处理会为本安装的所有用户和项目保留经脱敏且有大小限制的提供方请求与响应诊断,最长 14 天或直到执行「清除全部」。",
- "禁用记忆只会冻结本地数据,不会删除——如需删除请使用「清除全部」。",
- "「清除全部」只会移除本机上的本地记忆数据,无法追回已发送到远程端点的副本,也不会影响原始聊天记录。",
- "发往记忆端点的投递是至少一次——超时或崩溃后偶尔可能出现重复的派生记忆。",
- "每个平台用户拥有独立的记忆范围;不同平台之间不会自动关联身份。"
- ],
- "clearKeyLabel": "清除已保存的密钥"
+ "actions": {
+ "backToControlPanel": "控制面板",
+ "openRemoteAccess": "打开远程访问",
+ "signIn": "登录 Avibe Cloud",
+ "signInAgain": "使用同一账号重新登录",
+ "signOut": "退出组织管理",
+ "reload": "查看最新版本",
+ "saving": "保存中...",
+ "saveChanges": "保存更改",
+ "sendInvite": "发送邀请",
+ "inviteMember": "邀请成员",
+ "editMember": "编辑成员",
+ "removeMember": "移除成员",
+ "resendInvite": "重新发送邀请",
+ "exportCsv": "导出 CSV",
+ "newGroup": "新建群组",
+ "editGroup": "编辑群组",
+ "archiveGroup": "归档群组",
+ "restoreGroup": "恢复群组",
+ "manageMembers": "管理成员",
+ "saveMembers": "保存成员",
+ "addAccess": "添加访问权限",
+ "editAccess": "编辑访问权限",
+ "removeAccess": "移除访问权限",
+ "addBinding": "添加绑定",
+ "removeBinding": "移除绑定",
+ "manage": "管理"
},
- "clear": {
- "button": "清除全部",
- "confirmTitle": "清除全部本地记忆数据?",
- "confirmDescription": "这会移除你的画像、事件、事实、本机上尚未处理的排队文本,以及已保留的提供方调用诊断。",
- "removesTitle": "将会移除:",
- "removes": [
- "你可见的画像",
- "用于构建画像的隐藏本地缓冲区和索引",
- "本地处理队列中待处理和已完成的条目",
- "已保留的提供方请求和响应诊断"
- ],
- "keepsTitle": "不会移除:",
- "keeps": [
- "你原始的 Avibe 聊天记录",
- "已发送到远程记忆端点的副本",
- "你自己创建的副本或快照",
- "存储在专用记忆目录之外的任何数据",
- "现有的日志、崩溃报告或备份",
- "存储设备上的物理残留——这不是安全擦除"
- ],
- "confirmLabel": "清除全部",
- "clearing": "清除中…",
- "cleared": "记忆数据已清除。",
- "failed": "清除失败。"
+ "roles": {
+ "owner": "所有者",
+ "admin": "管理员",
+ "member": "成员"
},
- "kind": {
- "profile": "画像",
- "episode": "事件",
- "fact": "事实"
+ "status": {
+ "active": "活跃",
+ "invited": "已邀请",
+ "removed": "已移除"
+ },
+ "sync": {
+ "none": "没有受管策略",
+ "in_sync": "已同步",
+ "applying": "应用中",
+ "offline": "离线",
+ "error": "错误",
+ "deleted": "已删除"
+ },
+ "sidebar": {
+ "section": "组织",
+ "organizationCount": "{{count}} 个组织",
+ "switchOrganization": "切换组织",
+ "cloudConnected": "Cloud 已连接",
+ "sessionRemaining": "管理会话 · {{minutes}} 分钟",
+ "openMenu": "打开组织菜单"
+ },
+ "states": {
+ "loadingTitle": "正在加载组织",
+ "loadingBody": "正在从 Avibe Cloud 获取最新组织数据。",
+ "notConnectedTitle": "尚未连接 Avibe Cloud",
+ "notConnectedBody": "请先将此 Avibe 连接到 Avibe Cloud,再打开组织管理。",
+ "signInTitle": "需要登录",
+ "signInBody": "登录 Avibe Cloud,以建立短期有效的组织管理会话。",
+ "reauthorizingTitle": "正在重新授权",
+ "reauthorizingBody": "正在使用同一 Cloud 账号恢复组织管理会话。",
+ "mismatchTitle": "Cloud 账号不匹配",
+ "mismatchBody": "当前 Avibe 会话与 Cloud 账号属于不同用户。请使用建立此 Avibe 会话的同一账号重新登录。",
+ "unreachableTitle": "无法连接 Avibe Cloud",
+ "unreachableBody": "暂时无法获取组织数据,本地 Avibe 仍可正常使用。",
+ "revokedTitle": "组织访问权限已撤销",
+ "revokedBody": "此管理会话已失效。请重新登录以确认当前权限。",
+ "emptyTitle": "没有可用组织",
+ "emptyBody": "当前 Cloud 账号不是任何组织的活跃成员。",
+ "unavailableTitle": "无法访问此组织页面",
+ "unavailableBody": "当前组织权限或 Avibe 权限不允许访问此页面。",
+ "errorTitle": "无法完成请求",
+ "conflictTitle": "策略已在其他位置更改",
+ "conflictBody": "你的草稿尚未保存。请先检查草稿,再重新加载最新版本后继续修改。"
+ },
+ "errors": {
+ "generic": "Avibe 无法完成此组织请求。",
+ "forbidden": "当前组织角色不允许执行此操作。",
+ "organization_not_found": "无法访问此组织。",
+ "organization_member_not_found": "此成员已不可用。",
+ "organization_group_not_found": "此群组已不可用。",
+ "organization_group_archived": "不能把已归档群组添加到新策略。",
+ "instance_not_found": "无法访问此 Avibe。",
+ "project_not_found": "无法访问此 Project。",
+ "resource_not_found": "无法访问此资源。",
+ "member_email_taken": "该邮箱已属于此组织。",
+ "group_name_taken": "已存在同名群组。",
+ "too_many_entries": "此策略包含过多条目。",
+ "invalid_project_access_intent": "请选择有效的 Project 访问规则。",
+ "invalid_project_access_principal": "某个 Project 访问主体无效。",
+ "invalid_project_access_role": "某个 Project 访问角色无效。",
+ "invalid_resource_acl_intent": "请选择有效的资源受众。",
+ "invalid_email": "请输入有效的邮箱地址。",
+ "invalid_domain": "请输入有效的邮箱域名。",
+ "duplicate_instance_access_principal": "同一个 Avibe 访问主体只能出现一次。",
+ "duplicate_project_access_principal": "同一个 Project 主体只能出现一次。",
+ "owner_entry_locked": "不能修改 Avibe 所有者的隐式访问权限。",
+ "resource_sync_conflict": "策略已在其他位置更改,请检查最新版本后再保存。",
+ "organization_member_conflict": "成员已在其他位置更改,请检查最新版本后重试。",
+ "organization_group_conflict": "群组已在其他位置更改,请检查最新版本后重试。"
+ },
+ "fields": {
+ "name": "名称",
+ "description": "描述",
+ "color": "颜色",
+ "email": "邮箱",
+ "role": "角色",
+ "groups": "群组",
+ "member": "成员",
+ "status": "状态",
+ "principalType": "主体类型",
+ "principal": "访问主体"
+ },
+ "colors": {
+ "mint": "薄荷绿",
+ "cyan": "青色",
+ "blue": "蓝色",
+ "violet": "紫罗兰",
+ "rose": "玫红",
+ "gold": "金色"
+ },
+ "principals": {
+ "organization_group": "群组",
+ "email": "邮箱",
+ "email_domain": "邮箱域名"
+ },
+ "breadcrumb": {
+ "overview": "组织 / 概览",
+ "members": "组织 / 成员",
+ "groups": "组织 / 群组",
+ "groupDetail": "组织 / 群组 / {{name}}",
+ "instances": "组织 / Avibe",
+ "resources": "组织 / 资源"
+ },
+ "overview": {
+ "description": "管理此组织的成员、访问权限和策略同步状态。",
+ "memberDescription": "查看你的组织成员身份和可访问的 Avibe。",
+ "memberBreakdown": "{{invited}} 个已邀请 · {{removed}} 个已移除",
+ "groupBreakdown": "{{archived}} 个已归档",
+ "projects": "Project",
+ "projectCountUnavailable": "计数暂不可用",
+ "policySync": "策略同步",
+ "needsAttention": "需要处理",
+ "instanceNeedsAttention": "{{name}} 的策略变更需要处理。",
+ "projectSyncNeedsAttention": "{{name}} 的 Project 策略需要处理。",
+ "resourceSyncNeedsAttention": "{{name}} 的资源策略需要处理。",
+ "noAttention": "所有可见的受管策略状态正常。",
+ "pendingInvites": "待接受邀请",
+ "pendingInvitesBody": "有 {{count}} 个邀请等待接受。",
+ "viewAllInstances": "查看全部 Avibe",
+ "memberSafeTitle": "成员视图",
+ "memberSafeBody": "你可以查看自己的成员身份和可访问的 Avibe。成员目录和资源策略构成仅对组织管理者可见。"
+ },
+ "members": {
+ "description": "邀请成员、分配组织角色并管理群组成员关系。",
+ "memberDescription": "查看你的组织角色和群组成员关系。",
+ "filterLabel": "筛选成员",
+ "filterAll": "全部",
+ "active": "活跃",
+ "invited": "已邀请",
+ "removed": "已移除",
+ "admins": "管理员",
+ "searchPlaceholder": "搜索成员...",
+ "emptyTitle": "没有找到成员",
+ "emptyBody": "当前视图中没有匹配的成员。",
+ "inviteTitle": "邀请成员",
+ "inviteBody": "发送组织邀请,并可选择初始群组。",
+ "editTitle": "编辑成员",
+ "editBody": "角色和完整群组成员关系共用同一 revision。",
+ "emailPlaceholder": "[email protected]",
+ "downgradeTitle": "将此管理员降级?",
+ "downgradeBody": "{{email}} 将失去组织管理权限,其成员身份和群组分配保持不变。",
+ "downgradeConfirm": "降级为成员",
+ "removeTitle": "移除此成员?",
+ "removeBody": "{{email}} 将失去组织成员身份以及由此获得的全部权限。"
+ },
+ "groups": {
+ "description": "创建可复用的组织受众,并检查引用这些群组的全部策略。",
+ "memberDescription": "查看组织群组和你自己的群组成员关系。",
+ "active": "活跃",
+ "archived": "已归档",
+ "filterLabel": "筛选群组",
+ "searchPlaceholder": "搜索群组...",
+ "emptyTitle": "没有找到群组",
+ "emptyBody": "当前视图中没有匹配的群组。",
+ "noDescription": "没有描述",
+ "yourGroup": "我的群组",
+ "createTitle": "创建群组",
+ "createBody": "创建组织群组,并可选择初始成员。",
+ "editTitle": "编辑群组",
+ "editBody": "更新群组的展示信息。",
+ "initialMembers": "初始成员",
+ "manageMembersTitle": "管理群组成员",
+ "manageMembersBody": "替换 {{name}} 的完整成员列表。",
+ "referencedBy": "引用位置",
+ "moreReferences": "另有 {{count}} 项",
+ "archiveTitle": "归档此群组?",
+ "archiveBody": "{{name}} 被 {{count}} 个活跃策略项引用。",
+ "archiveImpactTitle": "归档影响",
+ "archiveImpactBody": "现有引用仍会显示,但不再授予访问权限;已归档群组不能加入新策略。"
+ },
+ "instances": {
+ "description": "你可以看到的组织 Avibe。可管理访问权限和 Project 策略,但不会改变配对或域名。",
+ "searchPlaceholder": "搜索 Avibe...",
+ "emptyTitle": "没有找到 Avibe",
+ "emptyBody": "当前视图中没有可用的组织 Avibe。",
+ "you": "你",
+ "organizationOwner": "Avibe 所有者",
+ "ownerProtected": "所有者身份受保护",
+ "youAreOwner": "你是此 Avibe 的所有者",
+ "paired": "已配对",
+ "notPaired": "未配对",
+ "accessCount": "{{count}} 条访问规则",
+ "accessTab": "访问权限",
+ "projectsTab": "Project",
+ "tabsLabel": "Avibe 管理视图",
+ "columns": {
+ "instance": "Avibe",
+ "owner": "所有者",
+ "address": "公开地址",
+ "status": "状态",
+ "access": "访问规则",
+ "sync": "同步"
+ },
+ "status": {
+ "pending": "等待中",
+ "active": "在线",
+ "disabled": "已停用",
+ "deleted": "已删除"
+ }
+ },
+ "access": {
+ "viewer": "查看者",
+ "editor": "编辑者",
+ "ownerTitle": "{{owner}} · Avibe 所有者",
+ "ownerBody": "这是隐式的所有者同等权限,不能作为普通条目编辑或移除。",
+ "emptyTitle": "没有显式访问条目",
+ "emptyBody": "当前只有隐式的 Avibe 所有者可以访问。",
+ "addTitle": "添加 Avibe 访问权限",
+ "editTitle": "编辑 Avibe 访问权限",
+ "dialogBody": "为群组、单个邮箱或邮箱域名授予查看者或编辑者权限。",
+ "emailPlaceholder": "[email protected]",
+ "domainPlaceholder": "example.com",
+ "narrowTitle": "收窄此访问权限?",
+ "narrowBody": "保存后,原访问主体或编辑能力将不再生效。",
+ "removeTitle": "移除此访问条目?",
+ "removeBody": "{{principal}} 将失去此条目授予的访问权限。",
+ "columns": {
+ "principal": "访问主体",
+ "type": "类型",
+ "role": "角色"
+ }
+ },
+ "projects": {
+ "searchPlaceholder": "搜索 Project...",
+ "safeDescriptorNotice": "这里只显示安全描述信息,不会显示或发送本地 Project 路径。Project 权限只能收窄 Avibe 角色。",
+ "emptyTitle": "没有找到 Project",
+ "emptyBody": "此 Avibe 尚未发布活跃的受管 Project 描述信息。",
+ "accessRule": "访问规则",
+ "bindings": "受限绑定",
+ "bindingRequired": "受限访问至少需要一个绑定。",
+ "usesAvibeRole": "使用 Avibe 角色",
+ "ownerOnlyAudience": "仅 Avibe 所有者",
+ "bindingCount": "{{count}} 个绑定",
+ "dialogTitle": "管理 {{name}} 的访问权限",
+ "dialogBody": "组织管理权限只允许你修改此策略,不会因此获得 Project 使用权限。",
+ "narrowTitle": "收窄此 Project 的访问权限?",
+ "narrowBody": "此更改会移除现有受众、将编辑者降为查看者,或切换到更严格的规则。",
+ "modes": {
+ "inherit": "继承",
+ "restricted": "受限",
+ "owner_only": "仅所有者"
+ },
+ "modeHelp": {
+ "inherit": "使用各访问主体在此 Avibe 上的有效角色。",
+ "restricted": "允许一个或多个明确的群组、邮箱或域名;此规则只能收窄 Avibe 角色。",
+ "owner_only": "只有此 Avibe 的所有者可以使用此 Project。组织管理者可以管理策略,但不会因此获得使用权限。"
+ },
+ "columns": {
+ "project": "Project",
+ "rule": "访问规则",
+ "bindings": "绑定",
+ "sync": "同步"
+ }
+ },
+ "resources": {
+ "description": "管理每项资源可由哪些组织受众使用。可以使用资源不代表可以编辑、删除或再次分享资源。",
+ "tabsLabel": "资源类型",
+ "accessLevel": "受众",
+ "selectGroups": "选择群组",
+ "groupRequired": "请至少选择一个群组。",
+ "dialogTitle": "管理 {{name}} 的受众",
+ "dialogBody": "选择私有、整个组织或指定组织群组。",
+ "narrowTitle": "收窄此资源的受众?",
+ "narrowBody": "部分当前可以使用此资源的成员将在更改后失去访问权限。",
+ "emptyTitle": "没有找到资源",
+ "emptyBody": "没有可用的活跃{{kind}}描述信息。",
+ "everyActiveMember": "每个活跃成员",
+ "ownerOnly": "仅资源所有者",
+ "kinds": {
+ "agent": "Agent",
+ "vault_secret": "Vault 密钥",
+ "skill": "Skill",
+ "show_page": "Show Page"
+ },
+ "levels": {
+ "private": "私有",
+ "public": "组织",
+ "scope": "指定群组"
+ },
+ "levelHelp": {
+ "private": "通过此组织 ACL,仅资源所有者可以使用。",
+ "public": "此组织的每个活跃成员都可以使用,但仍需满足其他全部权限层。",
+ "scope": "只有指定群组的活跃成员可以使用,并且仍需满足其他全部权限层。"
+ },
+ "columns": {
+ "access": "访问级别",
+ "audience": "受众",
+ "sync": "同步"
+ }
}
}
}
diff --cc ui/src/lib/applicationRoutes.ts
index 000000000,2f80a53e0..27738ddaf
mode 000000,100644..100644
--- a/ui/src/lib/applicationRoutes.ts
+++ b/ui/src/lib/applicationRoutes.ts
@@@ -1,0 -1,81 +1,90 @@@
+ // Exact routes declared in App.tsx. Keep this as the shared policy for any
+ // feature that must distinguish an AppShell destination from another
+ // same-origin path, such as local-file Markdown links and iOS PWA navigation.
+ // Exact matching is deliberate: `/projects/report.md` may be a real local file.
+ export const APPLICATION_ROUTE_PATHS = [
+ '/',
+ '/setup',
+ '/inbox',
+ '/search',
+ '/agents',
+ '/skills',
+ '/harness',
+ '/vaults',
+ '/projects',
+ '/more',
+ '/apps',
+ '/apps/files',
+ '/apps/terminal',
+ '/apps/editor',
+ '/apps/library',
+ '/admin',
+ '/admin/dashboard',
++ '/admin/organization',
++ '/admin/organization/overview',
++ '/admin/organization/members',
++ '/admin/organization/groups',
++ '/admin/organization/instances',
++ '/admin/organization/resources',
+ '/admin/remote-access',
+ '/admin/groups',
+ '/admin/users',
+ '/admin/show-pages',
+ '/admin/logs',
+ '/admin/settings/service',
+ '/admin/settings/platforms',
+ '/admin/settings/backends',
+ '/admin/settings/backends/opencode',
+ '/admin/settings/backends/claude',
+ '/admin/settings/backends/codex',
+ '/admin/settings/models',
+ '/admin/settings/dependencies',
+ '/admin/settings/memory',
+ '/admin/settings/messaging',
+ '/admin/settings/diagnostics',
+ '/admin/settings/logs',
+ '/dashboard',
+ '/groups',
+ '/channels',
+ '/users',
+ '/logs',
+ '/settings',
+ '/settings/service',
+ '/settings/platforms',
+ '/settings/backends',
+ '/settings/backends/opencode',
+ '/settings/backends/claude',
+ '/settings/backends/codex',
+ '/settings/models',
+ '/settings/dependencies',
+ '/settings/memory',
+ '/settings/messaging',
+ '/settings/diagnostics',
+ '/settings/logs',
+ '/remote-access',
+ '/doctor',
+ '/doctor/logs',
+ ] as const;
+
+ export const APPLICATION_DYNAMIC_ROUTE_PATHS = [
+ '/apps/show/:sessionId',
+ '/chat/:sessionId',
++ '/admin/organization/groups/:groupId',
++ '/admin/organization/instances/:instanceId/access',
++ '/admin/organization/instances/:instanceId/projects',
+ ] as const;
+
+ const APPLICATION_ROUTES = new Set<string>(APPLICATION_ROUTE_PATHS);
+ const APPLICATION_ROUTE_PATTERNS = APPLICATION_DYNAMIC_ROUTE_PATHS.map((path) => {
+ const pattern = path.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/:[^/]+/g, '[^/]+');
+ return new RegExp(`^${pattern}$`);
+ });
+
+ export function isApplicationRouteHref(href: string): boolean {
+ const rawPathname = href.split(/[?#]/, 1)[0];
+ const pathname = rawPathname.replace(/\/+$/, '') || '/';
+ return (
+ APPLICATION_ROUTES.has(pathname) ||
+ APPLICATION_ROUTE_PATTERNS.some((pattern) => pattern.test(pathname))
+ );
+ }
diff --cc vibe/api.py
index f72611d11,fdc87dc7f..8034e1ee9
--- a/vibe/api.py
+++ b/vibe/api.py
@@@ -1232,39 -1230,6 +1232,37 @@@ def client_config_payload(config: V2Con
return payload
+_REMOTE_CONFIG_UI_FIELDS = (
+ "instance_name",
+ "default_instance_name",
+ "chat_message_font_size",
+ "show_agent_activity",
+ "show_tool_calls",
+)
+
+
+def remote_config_payload(config: V2Config) -> dict:
+ """Return the explicit remote-safe projection of generic configuration.
+
+ Instance role determines which remote routes a caller may use, but it does
+ not make the caller trusted to inspect local filesystem layout, executable
+ paths, or runtime configuration. Keep this as an allowlist so new local
+ settings remain local by default.
+ """
+
+ payload = client_config_payload(config)
+ ui_payload = payload.get("ui")
+ return {
+ "mode": payload.get("mode"),
+ "version": payload.get("version"),
+ "setup_state": payload.get("setup_state"),
+ "language": payload.get("language"),
+ "ui": {
+ key: ui_payload[key]
+ for key in _REMOTE_CONFIG_UI_FIELDS
+ if isinstance(ui_payload, dict) and key in ui_payload
+ },
+ }
-
-
def _merge_legacy_discord_guild_scope_fields(
merged_payload: dict,
request_payload: dict,
diff --cc vibe/internal_client.py
index 2d9aebf1b,3695a7a44..afe6d8aa9
--- a/vibe/internal_client.py
+++ b/vibe/internal_client.py
@@@ -30,10 -30,9 +30,10 @@@ from config import path
logger = logging.getLogger(__name__)
- _SOCKET_ERRORS = (httpx.ConnectError, httpx.TimeoutException, OSError)
+ _SOCKET_ERRORS = (httpx.TransportError, OSError)
_SOCKET_CONNECT_ERRORS = (httpx.ConnectError, httpx.ConnectTimeout, OSError)
_OWNER_ONLY_SOCKET_MODES = frozenset({0o600, 0o700})
+_CHECK_POSIX_SOCKET_MODE = os.name != "nt"
# A transport deadline shorter than the operation it wraps turns a slow
# success into a reported failure while the controller keeps working, and
@@@ -109,69 -108,6 +109,67 @@@ async def _verified_socket_path_async(s
return await asyncio.to_thread(_verified_socket_path, socket_path)
+async def stream_dispatch(
+ payload: dict[str, Any],
+ *,
+ socket_path: Optional[Path] = None,
+ timeout: float = 1800.0,
+) -> AsyncIterator[tuple[str, dict[str, Any]]]:
+ """Send a dispatch request and yield the turn's SSE events as they arrive.
+
+ Each yielded tuple is ``(event_name, parsed_data)`` — e.g. ``("turn.start",
+ {...})``, ``("turn.chunk", {...})``, ``("turn.end", {...})``. The caller
+ re-encodes them for the browser. Raises ``InternalServerUnavailable`` for
+ connect-time failures so the caller can degrade.
+
+ NB: the web **Chat** page no longer uses this (it's fire-and-forget +
+ ``message.new``); this streaming round-trip backs the **Show-page** dispatch
+ flow (``_run_show_event_dispatch`` re-publishes each event as ``show.dispatch``).
+ """
+
+ target = await _verified_socket_path_async(socket_path)
+
+ transport = httpx.AsyncHTTPTransport(uds=str(target))
+ try:
+ async with httpx.AsyncClient(
+ transport=transport,
+ base_url="http://localhost",
+ timeout=httpx.Timeout(timeout, connect=5.0),
+ ) as client:
+ try:
+ stream = client.stream("POST", "/internal/dispatch", json=payload)
+ except _SOCKET_ERRORS as exc:
+ raise InternalServerUnavailable(str(exc)) from exc
+
+ async with stream as resp:
+ if resp.status_code >= 400:
+ detail = await resp.aread()
+ raise InternalServerUnavailable(
+ f"dispatch endpoint returned {resp.status_code}: {detail!r}"
+ )
+
+ current_event: Optional[str] = None
+ async for line in resp.aiter_lines():
+ if not line:
+ # Blank line ends an SSE event block; reset the
+ # event-name buffer so a missing ``event:`` field
+ # on the next block defaults to ``message``.
+ current_event = None
+ continue
+ if line.startswith("event:"):
+ current_event = line.split(":", 1)[1].strip()
+ elif line.startswith("data:"):
+ raw = line[5:].lstrip()
+ try:
+ parsed = json.loads(raw)
+ except json.JSONDecodeError:
+ logger.warning("internal_client: invalid SSE data line %r", raw)
+ continue
+ yield (current_event or "message", parsed)
+ except InternalServerUnavailable:
+ raise
+ except _SOCKET_ERRORS as exc:
+ raise InternalServerUnavailable(str(exc)) from exc
-
-
async def stream_events(
*,
socket_path: Optional[Path] = None,