( name: string, )
| 74 | * Uses the public environment_providers route (same auth as fetchEnvironments). |
| 75 | */ |
| 76 | export async function createDefaultCloudEnvironment( |
| 77 | name: string, |
| 78 | ): Promise<EnvironmentResource> { |
| 79 | const accessToken = getClaudeAIOAuthTokens()?.accessToken |
| 80 | if (!accessToken) { |
| 81 | throw new Error('No access token available') |
| 82 | } |
| 83 | const orgUUID = await getOrganizationUUID() |
| 84 | if (!orgUUID) { |
| 85 | throw new Error('Unable to get organization UUID') |
| 86 | } |
| 87 | |
| 88 | const url = `${getOauthConfig().BASE_API_URL}/v1/environment_providers/cloud/create` |
| 89 | const response = await axios.post<EnvironmentResource>( |
| 90 | url, |
| 91 | { |
| 92 | name, |
| 93 | kind: 'anthropic_cloud', |
| 94 | description: '', |
| 95 | config: { |
| 96 | environment_type: 'anthropic', |
| 97 | cwd: '/home/user', |
| 98 | init_script: null, |
| 99 | environment: {}, |
| 100 | languages: [ |
| 101 | { name: 'python', version: '3.11' }, |
| 102 | { name: 'node', version: '20' }, |
| 103 | ], |
| 104 | network_config: { |
| 105 | allowed_hosts: [], |
| 106 | allow_default_hosts: true, |
| 107 | }, |
| 108 | }, |
| 109 | }, |
| 110 | { |
| 111 | headers: { |
| 112 | ...getOAuthHeaders(accessToken), |
| 113 | 'anthropic-beta': 'ccr-byoc-2025-07-29', |
| 114 | 'x-organization-uuid': orgUUID, |
| 115 | }, |
| 116 | timeout: 15000, |
| 117 | }, |
| 118 | ) |
| 119 | return response.data |
| 120 | } |
| 121 |
no test coverage detected