@@ -240,16 +240,19 @@ describe("plugin npm runtime build planning", () => {
240240 expect ( plan . runtimeBuildOutputs ) . toContain ( "./dist/setup-api.js" ) ;
241241 } ) ;
242242
243- it ( "keeps published Codex runtime imports resolvable from the host package" , async ( ) => {
244- const result = await buildPluginNpmRuntime ( {
245- repoRoot,
246- packageDir : "extensions/codex" ,
247- logLevel : "silent" ,
248- } ) ;
249- const plan = expectPluginNpmRuntimeBuildPlan ( result ) ;
243+ it . each ( [ "codex" , "copilot" ] ) (
244+ "keeps published %s runtime imports resolvable from the host package" ,
245+ async ( pluginId ) => {
246+ const result = await buildPluginNpmRuntime ( {
247+ repoRoot,
248+ packageDir : `extensions/${ pluginId } ` ,
249+ logLevel : "silent" ,
250+ } ) ;
251+ const plan = expectPluginNpmRuntimeBuildPlan ( result ) ;
250252
251- expect ( listMissingPluginNpmRuntimeHostExports ( plan ) ) . toEqual ( [ ] ) ;
252- } ) ;
253+ expect ( listMissingPluginNpmRuntimeHostExports ( plan ) ) . toEqual ( [ ] ) ;
254+ } ,
255+ ) ;
253256
254257 it ( "detects unresolved side-effect host imports in built plugin runtimes" , ( ) => {
255258 const outDir = tempDirs . make ( "openclaw-plugin-runtime-host-import-" ) ;
@@ -275,6 +278,45 @@ describe("plugin npm runtime build planning", () => {
275278 ] ) ;
276279 } ) ;
277280
281+ it ( "allows private harness authority imports only for their official package owners" , ( ) => {
282+ const outDir = tempDirs . make ( "openclaw-plugin-runtime-private-owner-import-" ) ;
283+ writeFileSync (
284+ path . join ( outDir , "index.js" ) ,
285+ [
286+ 'import "openclaw/plugin-sdk/agent-harness-tool-authority-runtime";' ,
287+ 'import "openclaw/plugin-sdk/not-owner-restricted";' ,
288+ "" ,
289+ ] . join ( "\n" ) ,
290+ ) ;
291+ const plan = expectPluginNpmRuntimeBuildPlan (
292+ resolvePluginNpmRuntimeBuildPlan ( {
293+ repoRoot,
294+ packageDir : path . join ( repoRoot , "extensions" , "codex" ) ,
295+ } ) ,
296+ ) ;
297+
298+ expect ( listMissingPluginNpmRuntimeHostExports ( { ...plan , outDir } ) ) . toEqual ( [
299+ "openclaw/plugin-sdk/not-owner-restricted" ,
300+ ] ) ;
301+ expect (
302+ listMissingPluginNpmRuntimeHostExports ( {
303+ ...plan ,
304+ outDir,
305+ packageJson : { ...plan . packageJson , name : "@openclaw/copilot" } ,
306+ } ) ,
307+ ) . toEqual ( [ "openclaw/plugin-sdk/not-owner-restricted" ] ) ;
308+ expect (
309+ listMissingPluginNpmRuntimeHostExports ( {
310+ ...plan ,
311+ outDir,
312+ packageJson : { ...plan . packageJson , name : "@openclaw/demo" } ,
313+ } ) ,
314+ ) . toEqual ( [
315+ "openclaw/plugin-sdk/agent-harness-tool-authority-runtime" ,
316+ "openclaw/plugin-sdk/not-owner-restricted" ,
317+ ] ) ;
318+ } ) ;
319+
278320 it ( "does not require host metadata when the runtime has no host imports" , ( ) => {
279321 const syntheticRepoRoot = tempDirs . make ( "openclaw-plugin-runtime-synthetic-repo-" ) ;
280322 const outDir = tempDirs . make ( "openclaw-plugin-runtime-no-host-import-" ) ;
0 commit comments