@@ -33,15 +33,14 @@ export async function createKernel(options: KernelOptions) {
3333 console . log ( '[KernelFactory] Loading app:' , appConfig . manifest ?. id || appConfig . name || 'unknown' ) ;
3434 await kernel . use ( new AppPlugin ( appConfig ) ) ;
3535 }
36-
37- // MSW Plugin
38- await kernel . use ( new MSWPlugin ( {
39- enableBrowser : enableBrowser ,
40- baseUrl : '/api/v1' ,
41- logRequests : true
42- } ) ) ;
4336
44- // --- BROKER SHIM START ---
37+ // Protocol service is registered automatically by ObjectQLPlugin.init()
38+ // via ObjectStackProtocolImplementation (which uses SchemaRegistry internally).
39+ // Do NOT manually set 'protocol' on kernel.services — it would conflict with
40+ // ObjectQLPlugin's ctx.registerService('protocol', ...) during bootstrap.
41+ console . log ( '[KernelFactory] Protocol service will be registered by ObjectQLPlugin' ) ;
42+
43+ // --- BROKER SHIM (MUST be registered BEFORE MSWPlugin) ---
4544 // HttpDispatcher requires a broker to function. We inject a shim.
4645 ( kernel as any ) . broker = {
4746 call : async ( action : string , params : any , _opts : any ) => {
@@ -290,6 +289,13 @@ export async function createKernel(options: KernelOptions) {
290289 }
291290 } ;
292291 // --- BROKER SHIM END ---
292+
293+ // MSW Plugin (AFTER protocol service and broker shim are registered)
294+ await kernel . use ( new MSWPlugin ( {
295+ enableBrowser : enableBrowser ,
296+ baseUrl : '/api/v1' ,
297+ logRequests : true
298+ } ) ) ;
293299
294300 await kernel . bootstrap ( ) ;
295301
@@ -320,20 +326,5 @@ export async function createKernel(options: KernelOptions) {
320326 }
321327 }
322328
323- // --- PROTOCOL SERVICE MOCK ---
324- if ( ( kernel as any ) . services instanceof Map ) {
325- ( kernel as any ) . services . set ( 'protocol' , {
326- getUiView : async ( { object, type } : any ) => {
327- return {
328- type : type || 'list' ,
329- name : 'default' ,
330- object : object ,
331- title : object ,
332- body : [ ]
333- } ;
334- }
335- } ) ;
336- }
337-
338329 return kernel ;
339330}
0 commit comments