@@ -110,6 +110,7 @@ function createGlobalSync() {
110110 } )
111111
112112 const children : Record < string , [ Store < State > , SetStoreFunction < State > ] > = { }
113+
113114 function child ( directory : string ) {
114115 if ( ! directory ) console . error ( "No directory provided" )
115116 if ( ! children [ directory ] ) {
@@ -122,29 +123,33 @@ function createGlobalSync() {
122123 if ( ! cache ) throw new Error ( "Failed to create persisted cache" )
123124 vcsCache . set ( directory , { store : cache [ 0 ] , setStore : cache [ 1 ] , ready : cache [ 3 ] } )
124125
125- children [ directory ] = createStore < State > ( {
126- project : "" ,
127- provider : { all : [ ] , connected : [ ] , default : { } } ,
128- config : { } ,
129- path : { state : "" , config : "" , worktree : "" , directory : "" , home : "" } ,
130- status : "loading" as const ,
131- agent : [ ] ,
132- command : [ ] ,
133- session : [ ] ,
134- sessionTotal : 0 ,
135- session_status : { } ,
136- session_diff : { } ,
137- todo : { } ,
138- permission : { } ,
139- question : { } ,
140- mcp : { } ,
141- lsp : [ ] ,
142- vcs : cache [ 0 ] . value ,
143- limit : 5 ,
144- message : { } ,
145- part : { } ,
146- } )
147- bootstrapInstance ( directory )
126+ const init = ( ) => {
127+ children [ directory ] = createStore < State > ( {
128+ project : "" ,
129+ provider : { all : [ ] , connected : [ ] , default : { } } ,
130+ config : { } ,
131+ path : { state : "" , config : "" , worktree : "" , directory : "" , home : "" } ,
132+ status : "loading" as const ,
133+ agent : [ ] ,
134+ command : [ ] ,
135+ session : [ ] ,
136+ sessionTotal : 0 ,
137+ session_status : { } ,
138+ session_diff : { } ,
139+ todo : { } ,
140+ permission : { } ,
141+ question : { } ,
142+ mcp : { } ,
143+ lsp : [ ] ,
144+ vcs : cache [ 0 ] . value ,
145+ limit : 5 ,
146+ message : { } ,
147+ part : { } ,
148+ } )
149+ bootstrapInstance ( directory )
150+ }
151+
152+ runWithOwner ( owner , init )
148153 }
149154 const childStore = children [ directory ]
150155 if ( ! childStore ) throw new Error ( "Failed to create store" )
0 commit comments