1+ import fs from "node:fs" ;
2+ import {
3+ validateJsonSchemaValue ,
4+ type JsonSchemaObject ,
5+ } from "openclaw/plugin-sdk/json-schema-runtime" ;
16import type {
27 OpenClawPluginApi ,
38 OpenClawPluginNodeHostCommand ,
@@ -7,6 +12,17 @@ import type {
712import { describe , expect , it , vi } from "vitest" ;
813import plugin from "./index.js" ;
914
15+ function validateManifestConfig ( value : unknown ) {
16+ const manifest = JSON . parse (
17+ fs . readFileSync ( new URL ( "./openclaw.plugin.json" , import . meta. url ) , "utf8" ) ,
18+ ) as { configSchema : JsonSchemaObject } ;
19+ return validateJsonSchemaValue ( {
20+ cacheKey : "cua-computer.manifest.config.test" ,
21+ schema : manifest . configSchema ,
22+ value,
23+ } ) ;
24+ }
25+
1026describe ( "cua-computer plugin registration" , ( ) => {
1127 it ( "registers the screen and dangerous computer node-host commands" , ( ) => {
1228 const commands : OpenClawPluginNodeHostCommand [ ] = [ ] ;
@@ -26,6 +42,28 @@ describe("cua-computer plugin registration", () => {
2642 expect ( policies [ 0 ] ?. defaultPlatforms ) . toBeUndefined ( ) ;
2743 } ) ;
2844
45+ it ( "accepts the retired driver path as a no-op while keeping both schemas strict" , ( ) => {
46+ const config = { driverPath : "/usr/local/bin/cua-driver" } ;
47+ const runtimeResult = plugin . configSchema . safeParse ?.( config ) ;
48+
49+ expect ( runtimeResult ) . toEqual ( { success : true , data : config } ) ;
50+ expect ( validateManifestConfig ( config ) . ok ) . toBe ( true ) ;
51+ expect ( plugin . configSchema . safeParse ?.( { unexpected : true } ) . success ) . toBe ( false ) ;
52+ expect ( validateManifestConfig ( { unexpected : true } ) . ok ) . toBe ( false ) ;
53+
54+ const commands : OpenClawPluginNodeHostCommand [ ] = [ ] ;
55+ plugin . register ( {
56+ pluginConfig : config ,
57+ registerNodeHostCommand : ( command : OpenClawPluginNodeHostCommand ) => commands . push ( command ) ,
58+ registerNodeInvokePolicy : ( ) => { } ,
59+ } as unknown as OpenClawPluginApi ) ;
60+
61+ expect ( commands . map ( ( { command, cap, dangerous } ) => ( { command, cap, dangerous } ) ) ) . toEqual ( [
62+ { command : "screen.snapshot" , cap : "screen" , dangerous : false } ,
63+ { command : "computer.act" , cap : "computer" , dangerous : true } ,
64+ ] ) ;
65+ } ) ;
66+
2967 it ( "forwards an explicitly armed computer action and preserves node refusals" , async ( ) => {
3068 const policies : OpenClawPluginNodeInvokePolicy [ ] = [ ] ;
3169 plugin . register ( {
0 commit comments