File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
packages/desktop/src/context Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -6,26 +6,30 @@ import { usePlatform } from "./platform"
66export const { use : useGlobalSDK , provider : GlobalSDKProvider } = createSimpleContext ( {
77 name : "GlobalSDK" ,
88 init : ( props : { url : string } ) => {
9- const platform = usePlatform ( )
10-
11- const sdk = createOpencodeClient ( {
9+ const eventSdk = createOpencodeClient ( {
1210 baseUrl : props . url ,
1311 signal : AbortSignal . timeout ( 1000 * 60 * 10 ) ,
14- fetch : platform . fetch ,
1512 throwOnError : true ,
1613 } )
17-
1814 const emitter = createGlobalEmitter < {
1915 [ key : string ] : Event
2016 } > ( )
2117
22- sdk . global . event ( ) . then ( async ( events ) => {
18+ eventSdk . global . event ( ) . then ( async ( events ) => {
2319 for await ( const event of events . stream ) {
2420 // console.log("event", event)
2521 emitter . emit ( event . directory ?? "global" , event . payload )
2622 }
2723 } )
2824
25+ const platform = usePlatform ( )
26+ const sdk = createOpencodeClient ( {
27+ baseUrl : props . url ,
28+ signal : AbortSignal . timeout ( 1000 * 60 * 10 ) ,
29+ fetch : platform . fetch ,
30+ throwOnError : true ,
31+ } )
32+
2933 return { url : props . url , client : sdk , event : emitter }
3034 } ,
3135} )
You can’t perform that action at this time.
0 commit comments