@@ -14,12 +14,18 @@ const repoRoot = resolveRepoRoot(import.meta.url);
1414const smokeEntryPath = path . join ( repoRoot , "dist" , "plugins" , "build-smoke-entry.js" ) ;
1515assert . ok ( fs . existsSync ( smokeEntryPath ) , `missing build output: ${ smokeEntryPath } ` ) ;
1616
17- const { clearPluginCommands, getPluginCommandSpecs, loadOpenClawPlugins, matchPluginCommand } =
18- await import ( pathToFileURL ( smokeEntryPath ) . href ) ;
17+ const {
18+ clearPluginCommands,
19+ getPluginCommandSpecs,
20+ getPluginModuleLoaderStats,
21+ loadOpenClawPlugins,
22+ matchPluginCommand,
23+ } = await import ( pathToFileURL ( smokeEntryPath ) . href ) ;
1924
2025assert . equal ( typeof loadOpenClawPlugins , "function" , "built loader export missing" ) ;
2126assert . equal ( typeof clearPluginCommands , "function" , "clearPluginCommands missing" ) ;
2227assert . equal ( typeof getPluginCommandSpecs , "function" , "getPluginCommandSpecs missing" ) ;
28+ assert . equal ( typeof getPluginModuleLoaderStats , "function" , "plugin loader stats missing" ) ;
2329assert . equal ( typeof matchPluginCommand , "function" , "matchPluginCommand missing" ) ;
2430
2531const tempRoot = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "openclaw-build-smoke-" ) ) ;
@@ -105,6 +111,12 @@ stageBundledPluginRuntime({ repoRoot });
105111
106112const runtimeEntryPath = path . join ( runtimePluginDir , "index.js" ) ;
107113assert . ok ( fs . existsSync ( runtimeEntryPath ) , "runtime overlay entry missing" ) ;
114+ const smsRuntimeEntryPath = path . join ( repoRoot , "dist-runtime" , "extensions" , "sms" , "index.js" ) ;
115+ assert . ok ( fs . existsSync ( smsRuntimeEntryPath ) , "compiled SMS runtime entry missing" ) ;
116+ assert . ok (
117+ fs . existsSync ( path . join ( repoRoot , "dist-runtime" , "extensions" , "mxc" , "mxc-spawn-launcher.mjs" ) ) ,
118+ "compiled MXC runtime asset missing" ,
119+ ) ;
108120assert . equal (
109121 fs . existsSync ( path . join ( repoRoot , "dist-runtime" , "plugins" , "commands.js" ) ) ,
110122 false ,
@@ -113,6 +125,54 @@ assert.equal(
113125
114126clearPluginCommands ( ) ;
115127
128+ const smsStatsBefore = getPluginModuleLoaderStats ( ) ;
129+ const smsRegistry = loadOpenClawPlugins ( {
130+ cache : false ,
131+ preferBuiltPluginArtifacts : true ,
132+ workspaceDir : tempRoot ,
133+ env : {
134+ ...process . env ,
135+ OPENCLAW_BUNDLED_PLUGINS_DIR : path . join ( repoRoot , "dist-runtime" , "extensions" ) ,
136+ } ,
137+ config : {
138+ plugins : {
139+ enabled : true ,
140+ allow : [ "sms" ] ,
141+ entries : {
142+ sms : { enabled : true } ,
143+ } ,
144+ } ,
145+ } ,
146+ } ) ;
147+ const smsRecord = smsRegistry . plugins . find ( ( entry : { id : string } ) => entry . id === "sms" ) ;
148+ assert . ok ( smsRecord , "SMS plugin missing from registry" ) ;
149+ assert . equal ( smsRecord . status , "loaded" , smsRecord . error ?? "SMS plugin failed to load" ) ;
150+ const smsStatsAfter = getPluginModuleLoaderStats ( ) ;
151+ assert . ok (
152+ smsStatsAfter . nativeHits > smsStatsBefore . nativeHits ,
153+ "compiled SMS runtime did not use native loading" ,
154+ ) ;
155+ for ( const counter of [
156+ "nativeMisses" ,
157+ "sourceTransformForced" ,
158+ "sourceTransformFallbacks" ,
159+ ] as const ) {
160+ assert . equal (
161+ smsStatsAfter [ counter ] ,
162+ smsStatsBefore [ counter ] ,
163+ `compiled SMS runtime changed ${ counter } ` ,
164+ ) ;
165+ }
166+ assert . equal (
167+ smsStatsAfter . topSourceTransformTargets . some ( ( { target } : { target : string } ) =>
168+ target . replaceAll ( "\\" , "/" ) . includes ( "/extensions/sms/" ) ,
169+ ) ,
170+ false ,
171+ "compiled SMS runtime reached the source transformer" ,
172+ ) ;
173+
174+ clearPluginCommands ( ) ;
175+
116176const registry = loadOpenClawPlugins ( {
117177 cache : false ,
118178 workspaceDir : tempRoot ,
0 commit comments