@@ -12,10 +12,7 @@ import { registerDiagnosticSensitiveValue } from '@agent-device/host-kit/diagnos
1212import { AppError } from '@agent-device/kernel/errors' ;
1313import { stripUndefined } from '@agent-device/kernel/record' ;
1414import { executeRunScriptFile } from './run-script-execution.ts' ;
15- import {
16- mapMaestroSetPermissions ,
17- type MaestroPermissionMutation ,
18- } from './set-permissions-mapping.ts' ;
15+ import type { MaestroPermissionMutation } from './set-permissions-mapping.ts' ;
1916import { waitForMaestroAnimationToEnd } from './wait-for-animation-to-end.ts' ;
2017import {
2118 observeTypedMaestroCondition ,
@@ -167,6 +164,9 @@ function createDaemonMaestroRuntimeParts(options: CreateDaemonMaestroRuntimeOper
167164 const clearState = input . clearState === true ;
168165 const relaunch = ! clearState && input . stopApp !== false ;
169166 if ( input . permissions ) {
167+ // Lazy so the daemon-port entry stays within its eager-closure budget:
168+ // set-permissions-mapping pulls contracts/settings, only needed here.
169+ const { mapMaestroSetPermissions } = await import ( './set-permissions-mapping.ts' ) ;
170170 const mutations = mapMaestroSetPermissions ( input . permissions , platform ) ;
171171 if ( clearState ) {
172172 await invokeMutation ( { kind : 'clearState' , ...( appId ? { appId } : { } ) } , context ) ;
@@ -190,6 +190,7 @@ function createDaemonMaestroRuntimeParts(options: CreateDaemonMaestroRuntimeOper
190190 await invokeMutation ( { kind : 'stopApp' , ...( appId ? { appId } : { } ) } , context ) ;
191191 } ,
192192 setPermissions : async ( input , context ) => {
193+ const { mapMaestroSetPermissions } = await import ( './set-permissions-mapping.ts' ) ;
193194 await applyPermissionMutations (
194195 input . appId ?? context . appId ,
195196 mapMaestroSetPermissions ( input . permissions , platform ) ,
0 commit comments