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.

chore(auth): merge latest org dependencies

Maxvintaa5781018306
diff --cc ui/src/context/ApiContext.tsx
index 67dabf343,6cc887d94..5425edea1
--- a/ui/src/context/ApiContext.tsx
+++ b/ui/src/context/ApiContext.tsx
@@@ -945,7 -980,7 +981,11 @@@ export type WorkbenchEventHandlers =
onConnected?: (data: { sub_id: number; source?: 'browser' | 'controller' }) => void;
onConnectionState?: (state: WorkbenchEventConnectionState) => void;
onEventBridgeStatus?: (data: { connected: boolean }) => void;
- onAuthorizationChanged?: (data: { project_ids: string[]; resource_kinds?: string[] }) => void;
- onAuthorizationChanged?: (data: { project_ids: string[] }) => void;
++ onAuthorizationChanged?: (data: {
++ project_ids?: string[];
++ resource_kinds?: string[];
++ instance_authorization_revision?: number;
++ }) => void;
onMessageNew?: (data: WorkbenchMessage) => void;
// ``visibility`` (contract A6): the backend carries the session's current
// foreground/background on visibility/scope changes so the Inbox can drop /
@@@ -2177,9 -2208,16 +2217,13 @@@ export const ApiProvider: React.FC<{ ch
}
});
source.addEventListener('authorization.changed', (e: MessageEvent) => {
- const envelope = parseWorkbenchEnvelope<{ project_ids: string[]; resource_kinds?: string[] }>(e.data);
- const envelope = parseWorkbenchEnvelope<{ project_ids: string[] }>(e.data);
++ const envelope = parseWorkbenchEnvelope<{
++ project_ids?: string[];
++ resource_kinds?: string[];
++ instance_authorization_revision?: number;
++ }>(e.data);
if (!envelope) return;
- clearReadCacheMatching((path) =>
- path.startsWith('/api/projects') ||
- path.startsWith('/api/workbench/projects-bootstrap') ||
- path.startsWith('/api/sessions') ||
- path.startsWith('/api/inbox') ||
- path.startsWith('/api/search') ||
- path.startsWith('/api/show-pages'),
- );
+ clearReadCacheMatching(isAuthorizationSensitiveReadPath);
dispatchToWorkbenchHandlers((handlers) => {
handlers.onAny?.(envelope);
handlers.onAuthorizationChanged?.(envelope.data);
diff --cc vibe/ui_server.py
index 23acec2e9,8f067fc9b..0a8860e02
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@@ -2636,9 -2656,13 +2660,13 @@@ async def show_runtime_hmr_websocket(we
await websocket.close(code=_AUTHORIZATION_REFRESH_WEBSOCKET_CLOSE_CODE)
elif proxy_task in done:
await proxy_task
+ elif authorization_revision_task is not None and authorization_revision_task in done:
+ await authorization_revision_task
+ logger.info("show_runtime.authorization_revoked session=%s", session_id)
+ await websocket.close(code=_AUTHORIZATION_REFRESH_WEBSOCKET_CLOSE_CODE)
else:
await revocation_task
- logger.info("show_runtime.project_access_revoked session=%s", session_id)
+ logger.info("show_runtime.authorization_revoked session=%s", session_id)
await websocket.close(code=_AUTHORIZATION_REFRESH_WEBSOCKET_CLOSE_CODE)
except Exception:
logger.debug("Show runtime HMR websocket unavailable", exc_info=True)
@@@ -2846,19 -2907,16 +2915,29 @@@ async def _wait_for_project_session_acc
return
+def _show_page_resource_access_allowed(context: Any, session_id: str) -> bool:
+ from storage import resource_access_service
+
+ try:
+ return resource_access_service.can_use_resource(
+ context,
+ "show_page",
+ session_id,
+ )
+ except resource_access_service.ResourceAccessError:
+ return False
+
+
+ async def _wait_for_remote_session_authorization_loss(
+ config: V2Config,
+ payload: Mapping[str, Any],
+ ) -> None:
+ from vibe import remote_access
+
+ while remote_access.session_authorization_is_current(config, payload):
+ await asyncio.sleep(_AUTHORIZATION_REVISION_RECHECK_SECONDS)
+
+
def _show_runtime_websocket_resource_context(websocket: Any):
"""Build the ACL context from the same signed session used by the socket gate."""
@@@ -10333,17 -10442,13 +10463,19 @@@ async def _show_events_stream
store = _show_session_event_store()
try:
cursor = after_id
+ if not _authorization_is_current():
+ return
yield ": show events connected\n\n"
- if not public and not _project_session_access_allowed(
- authorization_context,
- session_id,
- "viewer",
+ if not public and (
+ not _project_session_access_allowed(
+ authorization_context,
+ session_id,
+ "viewer",
+ )
+ or not _show_page_resource_access_allowed(
+ authorization_context,
+ session_id,
+ )
):
return
while True: