@@ -85,26 +85,16 @@ function oauth(http: HttpClient.HttpClient) {
8585 method : {
8686 id : methodID ,
8787 type : "oauth" ,
88- label : "Sign in with OpenCode" ,
89- prompts : [
90- {
91- type : "text" ,
92- key : "server" ,
93- message : "OpenCode server" ,
94- placeholder : defaultServer ,
95- } ,
96- ] ,
88+ label : "OpenCode Console account" ,
9789 } ,
98- authorize : ( inputs ) =>
90+ authorize : ( ) =>
9991 Effect . gen ( function * ( ) {
100- const url = new URL ( inputs . server || defaultServer )
101- const server = `${ url . origin } ${ url . pathname . replace ( / \/ + $ / , "" ) } `
102- const device = yield * post ( http , `${ server } /auth/device/code` , { client_id : clientID } , Device )
92+ const device = yield * post ( http , `${ defaultServer } /auth/device/code` , { client_id : clientID } , Device )
10393 return {
10494 mode : "auto" as const ,
105- url : `${ server } ${ device . verification_uri_complete } ` ,
95+ url : `${ defaultServer } ${ device . verification_uri_complete } ` ,
10696 instructions : `Enter code: ${ device . user_code } ` ,
107- callback : poll ( http , server , device . device_code , Duration . seconds ( device . interval ) ) ,
97+ callback : poll ( http , defaultServer , device . device_code , Duration . seconds ( device . interval ) ) ,
10898 }
10999 } ) ,
110100 refresh : ( credential ) =>
@@ -157,7 +147,7 @@ export const OpencodePlugin = define<HttpClient.HttpClient | EventV2.Service | S
157147 integration . name = "OpenCode"
158148 } )
159149 draft . method . update ( oauth ( http ) )
160- draft . method . update ( { integrationID : "opencode" , method : { type : "key" , label : "API key" } } )
150+ draft . method . update ( { integrationID : "opencode" , method : { type : "key" , label : "API key (service account) " } } )
161151 } )
162152
163153 yield * load ( )
@@ -302,7 +292,7 @@ function credential(http: HttpClient.HttpClient, server: string, token: typeof T
302292 ] ,
303293 { concurrency : 2 } ,
304294 )
305- const org = orgs . toSorted ( ( a , b ) => a . id . localeCompare ( b . id ) ) [ 0 ]
295+ const org = orgs . toSorted ( ( a , b ) => a . name . localeCompare ( b . name ) || a . id . localeCompare ( b . id ) ) [ 0 ]
306296 return new Credential . OAuth ( {
307297 type : "oauth" as const ,
308298 methodID,
0 commit comments