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
Cover organization member removal and the operator workspace list in e2e
Petr Bauch593445d653c8
diff --git a/console/tooling-e2e/src/clients/switch-client.ts b/console/tooling-e2e/src/clients/switch-client.tsindex e7ac76e22..775aac93a 100644--- a/console/tooling-e2e/src/clients/switch-client.ts+++ b/console/tooling-e2e/src/clients/switch-client.ts@@ -834,6 +834,39 @@ export class SwitchClient {);}+ /** `DELETE /gateway/organizations/current/members/{user_id}` — remove someone from the organization. */+ async removeOrganizationMember(userId: string): Promise<void> {+ await this.gateway<unknown>(+ "DELETE",+ `/organizations/current/members/${encodeURIComponent(userId)}`,+ );+ }++ /** `GET /gateway/tenants/{tenant_id}/members` — the workspace roster, with each person's organization role. */+ async workspaceMembers(tenantId: string): Promise<+ {+ user_id: string;+ role: string;+ organization_role: string | null;+ via_organization: boolean;+ }[]+ > {+ return this.gateway("GET", `/tenants/${encodeURIComponent(tenantId)}/members`);+ }++ /** `DELETE /gateway/tenants/{tenant_id}/members/{user_id}` — remove someone from a workspace. */+ async removeWorkspaceMember(tenantId: string, userId: string): Promise<void> {+ await this.gateway<unknown>(+ "DELETE",+ `/tenants/${encodeURIComponent(tenantId)}/members/${encodeURIComponent(userId)}`,+ );+ }++ /** `GET /gateway/operator/workspaces` — every workspace on the server, platform operator only. */+ async operatorWorkspaces(): Promise<{ id: string; name: string }[]> {+ return this.gateway<{ id: string; name: string }[]>("GET", "/operator/workspaces");+ }+/** `GET /gateway/auth/session` — the workspace this admin session is bound to. */async tenantId(): Promise<string> {const state = await this.gateway<{diff --git a/console/tooling-e2e/src/fast/organization-members.ts b/console/tooling-e2e/src/fast/organization-members.tsindex 68eda1dab..100db9e36 100644--- a/console/tooling-e2e/src/fast/organization-members.ts+++ b/console/tooling-e2e/src/fast/organization-members.ts@@ -6,7 +6,11 @@ import type { FastScenario } from './scenario.ts';* An organization's admins manage who else is one: the harness admin, the* default workspace's organization admin, lists its members, makes a* colleague organization admin, and takes it back. The colleague can list- * the members only while they hold the role.+ * the members only while they hold the role. The workspace roster shows each+ * person's organization role. Removing the colleague from the organization is+ * refused while they are still in its workspace, and goes through once they+ * are not. Only the harness admin, a platform operator, lists every+ * workspace.** Users cannot be deleted, so this runs only on a stack thrown away after* the run.@@ -17,6 +21,10 @@ export const organizationMembers: FastScenario = {covers: ['GET /gateway/organizations/current/members','PATCH /gateway/organizations/current/members/{user_id}',+ 'DELETE /gateway/organizations/current/members/{user_id}',+ 'GET /gateway/operator/workspaces',+ 'GET /gateway/tenants/{tenant_id}/members',+ 'DELETE /gateway/tenants/{tenant_id}/members/{user_id}',],lane: 'fast',environments: ['ephemeral'],@@ -58,12 +66,40 @@ export const organizationMembers: FastScenario = {expect(taken.role).toBe('member');expect(await refused(), 'a member again').toBe(403);- try {- await switchClient.setOrganizationRole(id, 'owner' as 'member');- throw new Error('an unknown organization role was accepted');- } catch (error) {- if (!(error instanceof SwitchHttpError)) throw error;- expect(error.status, errorDetail(error.body)).toBe(422);- }+ const status = async (call: () => Promise<unknown>): Promise<[number, string]> => {+ try {+ await call();+ } catch (error) {+ if (error instanceof SwitchHttpError) return [error.status, errorDetail(error.body)];+ throw error;+ }+ return [200, ''];+ };++ const [unknownRole] = await status(() =>+ switchClient.setOrganizationRole(id, 'owner' as 'member')+ );+ expect(unknownRole, 'an unknown organization role').toBe(422);++ const tenantId = await switchClient.tenantId();+ const roster = await switchClient.workspaceMembers(tenantId);+ expect(+ roster.find((row) => row.user_id === id),+ 'the colleague on the workspace roster'+ ).toMatchObject({ role: 'member', organization_role: 'member', via_organization: false });++ const everyWorkspace = await switchClient.operatorWorkspaces();+ expect(everyWorkspace.map((row) => row.id), 'the operator list').toContain(tenantId);+ const [notOperator] = await status(() => colleague.operatorWorkspaces());+ expect(notOperator, 'a non-operator listing every workspace').toBe(403);++ const [stillIn, why] = await status(() => switchClient.removeOrganizationMember(id));+ expect(stillIn, 'removing someone still in a workspace').toBe(409);+ expect(why).toContain('first');++ await switchClient.removeWorkspaceMember(tenantId, id);+ await switchClient.removeOrganizationMember(id);+ const after = await switchClient.organizationMembers();+ expect(after.map((row) => row.user_id), 'removed from the organization').not.toContain(id);},};diff --git a/console/tooling-e2e/surface/exemptions.json b/console/tooling-e2e/surface/exemptions.jsonindex abe2f44ec..3b005f184 100644--- a/console/tooling-e2e/surface/exemptions.json+++ b/console/tooling-e2e/surface/exemptions.json@@ -129,7 +129,6 @@"DELETE /gateway/tenants/{tenant_id}/budgets/{budget_id}","DELETE /gateway/tenants/{tenant_id}/invitations/{invitation_id}","DELETE /gateway/tenants/{tenant_id}/join-domains/{domain}",- "DELETE /gateway/tenants/{tenant_id}/members/{user_id}","DELETE /gateway/trust-settings","GET /gateway/agent-sessions/approvals","GET /gateway/agents/avatar-settings",@@ -210,7 +209,6 @@"GET /gateway/tenants/{tenant_id}/budgets","GET /gateway/tenants/{tenant_id}/invitations","GET /gateway/tenants/{tenant_id}/join-domains",- "GET /gateway/tenants/{tenant_id}/members","GET /gateway/tenants/{tenant_id}/usage","GET /gateway/trust-settings","GET /gateway/users",diff --git a/console/tooling-e2e/surface/server-surface.json b/console/tooling-e2e/surface/server-surface.jsonindex 5d37b1b35..cf8bb3620 100644--- a/console/tooling-e2e/surface/server-surface.json+++ b/console/tooling-e2e/surface/server-surface.json@@ -156,6 +156,11 @@"auth": "session","flags": []},+ {+ "route": "DELETE /gateway/organizations/current/members/{user_id}",+ "auth": "session",+ "flags": []+ },{"route": "DELETE /gateway/packages/{package_id}","auth": "session",@@ -581,6 +586,11 @@"auth": "none","flags": []},+ {+ "route": "GET /gateway/operator/workspaces",+ "auth": "session",+ "flags": []+ },{"route": "GET /gateway/organizations/current/members","auth": "session",