Skip to content

Commit ee1ba4a

Browse files
authored
feat(sdk): migrate toolbox calls from API to proxy (#2406)
Signed-off-by: MDzaja <[email protected]>
1 parent c848bb0 commit ee1ba4a

File tree

470 files changed

+87162
-5224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

470 files changed

+87162
-5224
lines changed

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ libs/api-client-go/** linguist-generated=true
44
libs/api-client-python/** linguist-generated=true
55
libs/api-client-python-async/** linguist-generated=true
66
libs/runner-api-client/** linguist-generated=true
7-
apps/runner/pkg/api/docs/** linguist-generated=true
7+
apps/runner/pkg/api/docs/** linguist-generated=true
8+
libs/toolbox-api-client-python/** linguist-generated=true
9+
libs/toolbox-api-client-python-async/** linguist-generated=true

.licenserc-clients.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@ header:
2222
- 'apps/docs/**'
2323
- 'libs/computer-use/**'
2424
- 'hack/**'
25+
- 'libs/toolbox-api-client/**'
26+
- 'libs/toolbox-api-client-python/**'
27+
- 'libs/toolbox-api-client-python-async/**'
2528

2629
comment: on-failure

.licenserc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ header:
2121
- 'examples/**'
2222
- 'apps/docs/**'
2323
- 'hack/**'
24+
- 'apps/daemon/pkg/toolbox/docs/docs.go'
2425

2526
comment: on-failure

apps/api/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ SSH_GATEWAY_COMMAND="ssh -p 2222 {{TOKEN}}@localhost"
7676
SSH_GATEWAY_PUBLIC_KEY="c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCZ1FEZUtocFdOYVhVNkpSMnJXekc1NlZJeksrcmsrdForcCtVUmwyeWF5cWRnZGg2bnVOL1NtVnJsYmV4MGlrRVZZemdRWUIwWno5M2dqOVhxSkd4WjJiMHVoSDFzNkp2bnhKZVdIK05rbjBNMzRiRjZkeVloZ3o4M0JaTitWcElJdnVDT1pxYWE4VnlRWjhPdjVLMU00enlmQnFCMld3ejcwZEVWUnFaMnVZckd5U0RqUUIrU3hRQ3phY0djb2JRQTFUd2QxdEJvSk5BaVpPWXFSU3d6TmNoTk5hZHlxSHRGdkZRQ0hhNjZWaVBmQ0FVUGt2cEN6ZGh3TmJGdVhGVWkxbnZOWkx4M056RU41M05LWUhZcWU3Y3dXZkI4QjBoRDhDd3hmSDd6T0o1b1RCMnBMVVlsUWpZRDNsN3k4SkFTbDZpYkpuR1A1SWczVXpZWlRIdUdkNzVXWktnNTRJTVROQlFPMWpJdE9HL0orUm1XbzB0YTdpRkF6ZExyL1BmbDdXTVMwbEZhSm9scTdUVmJLUG1JODFTOU04VEgrbXhLbGZ5b2NqZzhwSUdlQUllcEo3dXl1Vk1xT2wxeVVuSFNycDRlVEVlR0k3NlpCOFRoUzhkYnBLUTIvb2RYMHkwc3FSZDI0Y2lGdnM0dnZVaW80NFdYNlNWRG54dXpWRHc1Rzg9IGRheXRvbmFAMDQwNjZiZDIwY2Vi"
7777

7878
PROXY_TEMPLATE_URL=http://{{PORT}}-{{sandboxId}}.proxy.localhost:4000
79+
PROXY_TOOLBOX_BASE_URL=http://proxy.localhost:4000
7980

8081
PYLON_APP_ID=
8182

apps/api/src/config/configuration.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ const configuration = {
8989
protocol: process.env.PROXY_PROTOCOL,
9090
apiKey: process.env.PROXY_API_KEY,
9191
templateUrl: process.env.PROXY_TEMPLATE_URL,
92+
toolboxUrl:
93+
(process.env.PROXY_TOOLBOX_BASE_URL || `${process.env.PROXY_PROTOCOL}://${process.env.PROXY_DOMAIN}`) +
94+
'/toolbox',
9295
},
9396
audit: {
9497
toolboxRequestsEnabled: process.env.AUDIT_TOOLBOX_REQUESTS_ENABLED === 'true',

apps/api/src/config/dto/configuration.dto.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ export class ConfigurationDto {
118118
@IsString()
119119
proxyTemplateUrl: string
120120

121+
@ApiProperty({
122+
description: 'Toolbox template URL',
123+
example: 'https://proxy.example.com/toolbox',
124+
})
125+
@IsString()
126+
proxyToolboxUrl: string
127+
121128
@ApiProperty({
122129
description: 'Default snapshot for sandboxes',
123130
example: 'ubuntu:22.04',
@@ -187,6 +194,7 @@ export class ConfigurationDto {
187194
}
188195
this.linkedAccountsEnabled = configService.get('oidc.managementApi.enabled')
189196
this.proxyTemplateUrl = configService.getOrThrow('proxy.templateUrl')
197+
this.proxyToolboxUrl = configService.getOrThrow('proxy.toolboxUrl')
190198
this.defaultSnapshot = configService.getOrThrow('defaultSnapshot')
191199
this.dashboardUrl = configService.getOrThrow('dashboardUrl')
192200
this.maxAutoArchiveInterval = configService.getOrThrow('maxAutoArchiveInterval')
@@ -210,6 +218,6 @@ export class ConfigurationDto {
210218
this.pylonAppId = configService.get('pylonAppId')
211219
}
212220
// TODO: announcements
213-
// this.announcements = configService.get('announcements')
221+
this.announcements = {}
214222
}
215223
}

apps/api/src/sandbox/controllers/preview.controller.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ export class PreviewController {
119119
summary: 'Check if user has access to the sandbox',
120120
operationId: 'hasSandboxAccess',
121121
})
122+
@ApiResponse({
123+
status: 200,
124+
description: 'User access status to the sandbox',
125+
type: Boolean,
126+
})
122127
@UseGuards(CombinedAuthGuard)
123128
@ApiOAuth2(['openid', 'profile', 'email'])
124129
@ApiBearerAuth()

0 commit comments

Comments
 (0)