FEAT - TASKER CODEX: user-scoped multi-workspace grants

This commit is contained in:
DCCONSTRUCTIONS
2026-05-16 14:22:33 +03:00
parent 8f87f03ee6
commit 491a2b52c8
7 changed files with 544 additions and 125 deletions
@@ -77,6 +77,31 @@ export type TCodexAgentGrantListResponse = {
grants: TCodexAgentGrant[];
};
export type TCodexAgentProjectGrantInput = {
project_id: string;
workspace_slug: string;
};
export type TCodexAgentGrantableProject = {
id: string;
workspace_slug: string;
name: string;
identifier?: string | null;
};
export type TCodexAgentGrantableWorkspace = {
id: string;
slug: string;
name: string;
role: number;
projects: TCodexAgentGrantableProject[];
};
export type TCodexAgentProjectAccessResponse = {
ok: boolean;
workspaces: TCodexAgentGrantableWorkspace[];
};
export type TCodexAgentSetupResponse = {
ok: boolean;
setup?: TCodexAgentSetupPacket;
@@ -95,6 +120,14 @@ export class WorkspaceCodexAgentService extends APIService {
});
}
async listProjectAccess(workspaceSlug: string): Promise<TCodexAgentProjectAccessResponse> {
return this.get(`/api/workspaces/${workspaceSlug}/codex-agent-api/project-access/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async createAgent(
workspaceSlug: string,
data: { display_name: string; avatar_url?: string | null }
@@ -158,6 +191,25 @@ export class WorkspaceCodexAgentService extends APIService {
});
}
async replaceProjectGrantsAcrossWorkspaces(
workspaceSlug: string,
agentId: string,
data: {
grants: TCodexAgentProjectGrantInput[];
mode?: TCodexAgentGrantMode;
scopes: string[];
}
): Promise<TCodexAgentGrantListResponse> {
return this.post(
`/api/workspaces/${workspaceSlug}/codex-agent-api/agents/${agentId}/grants/replace-projects/`,
data
)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async createToken(
workspaceSlug: string,
agentId: string,