File tree Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @codesandbox/sdk" ,
3
- "version" : " 1.1.5 " ,
3
+ "version" : " 1.1.6 " ,
4
4
"description" : " The CodeSandbox SDK" ,
5
5
"author" : " CodeSandbox" ,
6
6
"license" : " MIT" ,
Original file line number Diff line number Diff line change 9
9
} from "./api-clients/client" ;
10
10
import { Sandbox } from "./Sandbox" ;
11
11
import {
12
- getDefaultTemplateId ,
12
+ getDefaultTemplateTag ,
13
13
getStartOptions ,
14
14
getStartResponse ,
15
15
handleResponse ,
@@ -62,7 +62,7 @@ export async function startVm(
62
62
*/
63
63
export class Sandboxes {
64
64
get defaultTemplateId ( ) {
65
- return getDefaultTemplateId ( this . apiClient ) ;
65
+ return getDefaultTemplateTag ( this . apiClient ) ;
66
66
}
67
67
68
68
constructor ( private apiClient : Client ) { }
Original file line number Diff line number Diff line change @@ -149,6 +149,16 @@ export const buildCommand: yargs.CommandModule<
149
149
updateSpinnerMessage ( index , "Starting sandbox..." , sandboxId )
150
150
) ;
151
151
152
+ // This is a hack, we need to tell the global scheduler that the VM is running
153
+ // in a different cluster than the one it'd like to default to.
154
+ const baseUrl = apiClient
155
+ . getConfig ( )
156
+ . baseUrl ?. replace ( "api" , "global-scheduler" ) ;
157
+
158
+ await fetch (
159
+ `${ baseUrl } /api/v1/cluster/${ sandboxId } ?preferredManager=${ cluster } `
160
+ ) . then ( ( res ) => res . json ( ) ) ;
161
+
152
162
const startResponse = await startVm ( clusterApiClient , sandboxId , {
153
163
vmTier : VMTier . fromName ( "Micro" ) ,
154
164
} ) ;
Original file line number Diff line number Diff line change @@ -51,12 +51,20 @@ export function getBaseUrl(token: string) {
51
51
return "https://api.together.ai/csb/sdk" ;
52
52
}
53
53
54
+ export function getDefaultTemplateTag ( apiClient : Client ) : string {
55
+ if ( apiClient . getConfig ( ) . baseUrl ?. includes ( "codesandbox.stream" ) ) {
56
+ return "7ngcrf" ;
57
+ }
58
+
59
+ return "pt_LAVK5kxK8XciqgV2642xRk" ;
60
+ }
61
+
54
62
export function getDefaultTemplateId ( apiClient : Client ) : string {
55
63
if ( apiClient . getConfig ( ) . baseUrl ?. includes ( "codesandbox.stream" ) ) {
56
64
return "7ngcrf" ;
57
65
}
58
66
59
- return "pt_UAYyadeQTA9jw8bXqzgy6v " ;
67
+ return "pcz35m " ;
60
68
}
61
69
62
70
export function handleResponse < D , E > (
You can’t perform that action at this time.
0 commit comments