Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
Merge remote-tracking branch 'origin/main' into gateway-permission-gates
Abel Dantas19ec59b83549
diff --cc core/switch_core/gateway/rooms.pyindex 8556752ef,07f102526..cc66970c7--- a/core/switch_core/gateway/rooms.py+++ b/core/switch_core/gateway/rooms.py@@@ -258,8 -251,11 +262,13 @@@ async def _build_room_detailjoin_event_listeners=join_event_listeners,archived_at=str(room.archived_at) if room.archived_at else None,channel_on_delete=_channel_on_delete(room, bridge_type),+ can_write=can(principal, "write", room),+ can_manage=can_manage(principal, room.owner_id),+ linked_channel_name=(+ (room.metadata_ or {}).get(LINKED_CHANNEL_NAME_KEY)+ if room.external_channel_id+ else None+ ),)@@@ -399,8 -395,8 +409,10 @@@ async def list_roomswrite_visibility=room.write_visibility,created_at=str(room.created_at),archived=room.archived_at is not None,+ can_write=can(principal, "write", room),+ can_manage=can_manage(principal, room.owner_id),+ viewer_is_member=room.id in involved,+ is_console_chat="chat_operation_id" in (room.metadata_ or {}),))@@@ -955,14 -938,11 +967,17 @@@ async def patch_roomroom = await room_store.get(session, room_id)if room is None:raise HTTPException(status_code=404, detail="Room not found")+ # The update was written on another session; this one still holds the row+ # as it was read for the access check.+ await session.refresh(room)return await _build_room_detail(- session, room, room_store, bridge_store, external_user_store, protocol+ session,+ room,+ room_store,+ bridge_store,+ external_user_store,+ protocol,+ principal=Principal(user.id, is_admin),)@@@ -1321,6 -1253,40 +1336,46 @@@ async def _set_archived)+ @router.post("/{room_id}/sync-name")+ async def sync_room_name(+ room_id: str,+ session: Annotated[AsyncSession, Depends(get_session)],+ room_service: Annotated[RoomService, Depends(get_room_service)],+ room_store: Annotated[RoomStore, Depends(get_room_store)],+ bridge_store: Annotated[CollaborationBridgeStore, Depends(get_bridge_store)],+ external_user_store: Annotated[ExternalUserStore, Depends(get_external_user_store)],+ protocol: Annotated[AgentCore, Depends(get_protocol)],+ user: Annotated[User, Depends(get_current_user)],+ is_admin: Annotated[bool, Depends(get_tenant_is_admin)],+ ) -> RoomDetail:+ """Name the room after its linked channel (`linked_channel_name`), as the+ bridge names its own rooms, so it follows the channel's renames from now+ on. The room's owner or an admin only."""+ room = await _require_room(session, room_store, room_id, user, "delete", is_admin)+ channel_name = (room.metadata_ or {}).get(LINKED_CHANNEL_NAME_KEY)+ bridge = await bridge_store.get(session, room.bridge_id) if room.bridge_id else None+ if not room.external_channel_id or bridge is None or not channel_name:+ raise HTTPException(+ status_code=409,+ detail="Switch has not seen the name of a channel linked to this room.",+ )+ # `take_platform_name` opens a session of its own (`_require_room_released`).+ await session.commit()+ await room_service.take_platform_name(+ room.id, f"{bridge.display_name}: {channel_name}", channel_name+ )+ await session.refresh(room)+ return await _build_room_detail(- session, room, room_store, bridge_store, external_user_store, protocol++ session,++ room,++ room_store,++ bridge_store,++ external_user_store,++ protocol,++ principal=Principal(user.id, is_admin),+ )++@router.post("/{room_id}/archive")async def archive_room(room_id: str,diff --cc core/switch_core/gateway/schemas.pyindex e91d8b118,fac1d44ee..f19eb68ef--- a/core/switch_core/gateway/schemas.py+++ b/core/switch_core/gateway/schemas.py@@@ -85,12 -85,11 +85,17 @@@ class RoomSummary(BaseModel)created_at: str# True when the room is archived (hidden from the default active list).archived: bool = False+ # What the caller may do with the room, decided here by `switch_core.authz`+ # so the Gateway shows the right controls without repeating the rules.+ # Write: edit its fields, add agents and people, attach resources. Manage:+ # also change who may see or write to it, and delete it.+ can_write: bool = False+ can_manage: bool = False+ # The caller owns the room, is in it (in Switch Console or through a+ # platform account they claimed), or owns an agent in it.+ viewer_is_member: bool = False+ # A Switch Console chat (made through the chats API): only its members can open it.+ is_console_chat: bool = Falseclass RoomDetail(RoomSummary):