@@ -38,6 +38,10 @@ import {
3838 runInstalledWorkspaceBootstrapSmoke ,
3939 WORKSPACE_TEMPLATE_PACK_PATHS ,
4040} from "./lib/workspace-bootstrap-smoke.mjs" ;
41+ import {
42+ collectInstalledPackageErrors ,
43+ normalizeInstalledBinaryVersion ,
44+ } from "./openclaw-npm-postpublish-verify.ts" ;
4145import { listStaticExtensionAssetOutputs } from "./runtime-postbuild.mjs" ;
4246import { sparkleBuildFloorsFromShortVersion , type SparkleBuildFloors } from "./sparkle-build.ts" ;
4347import { buildCmdExeCommandLine } from "./windows-cmd-helpers.mjs" ;
@@ -330,6 +334,58 @@ function runPackedBundledPluginPostinstall(packageRoot: string): void {
330334 } ) ;
331335}
332336
337+ export function collectPackedInstalledPackageVerificationErrors ( params : {
338+ expectedVersion: string ;
339+ installedBinaryVersion ? : string ;
340+ packageRoot: string ;
341+ } ) : string [ ] {
342+ const packageJson = JSON . parse (
343+ readFileSync ( join ( params . packageRoot , "package.json" ) , "utf8" ) ,
344+ ) as { version ?: string } ;
345+ const errors = collectInstalledPackageErrors ( {
346+ expectedVersion : params . expectedVersion ,
347+ installedVersion : packageJson . version ?. trim ( ) ?? "" ,
348+ packageRoot : params . packageRoot ,
349+ } ) ;
350+ if (
351+ params . installedBinaryVersion !== undefined &&
352+ normalizeInstalledBinaryVersion ( params . installedBinaryVersion ) !== params . expectedVersion
353+ ) {
354+ errors . push (
355+ `installed openclaw binary version mismatch: expected ${ params . expectedVersion } , found ${ params . installedBinaryVersion || "<missing>" } .` ,
356+ ) ;
357+ }
358+ return errors ;
359+ }
360+
361+ function verifyPackedInstalledPackage ( params : {
362+ expectedVersion : string ;
363+ packageRoot: string ;
364+ prefixDir: string ;
365+ tmpRoot: string ;
366+ } ) : void {
367+ const installedBinaryVersion = execFileSync (
368+ resolveInstalledBinaryPath ( params . prefixDir ) ,
369+ [ "--version" ] ,
370+ {
371+ cwd : params . tmpRoot ,
372+ encoding : "utf8" ,
373+ shell : process . platform === "win32" ,
374+ stdio : [ "ignore" , "pipe" , "pipe" ] ,
375+ } ,
376+ ) . trim ( ) ;
377+ const errors = collectPackedInstalledPackageVerificationErrors ( {
378+ expectedVersion : params . expectedVersion ,
379+ installedBinaryVersion,
380+ packageRoot : params . packageRoot ,
381+ } ) ;
382+ if ( errors . length > 0 ) {
383+ throw new Error (
384+ `release-check: packed installed package verification failed:\n- ${ errors . join ( "\n- " ) } ` ,
385+ ) ;
386+ }
387+ }
388+
333389export function writePackedBundledPluginActivationConfig ( homeDir : string ) : void {
334390 const configPath = join ( homeDir , ".openclaw" , "openclaw.json" ) ;
335391 mkdirSync ( join ( homeDir , ".openclaw" ) , { recursive : true } ) ;
@@ -464,6 +520,14 @@ function runPackedCliSmoke(params: {
464520function runPackedBundledChannelEntrySmoke ( ) : void {
465521 const tmpRoot = mkdtempSync ( join ( tmpdir ( ) , "openclaw-release-pack-smoke-" ) ) ;
466522 try {
523+ const expectedVersion = (
524+ JSON . parse ( readFileSync ( resolve ( "package.json" ) , "utf8" ) ) as {
525+ version ?: string ;
526+ }
527+ ) . version ;
528+ if ( ! expectedVersion ) {
529+ throw new Error ( "release-check: root package.json is missing version." ) ;
530+ }
467531 const packDir = join ( tmpRoot , "pack" ) ;
468532 mkdirSync ( packDir ) ;
469533
@@ -473,6 +537,12 @@ function runPackedBundledChannelEntrySmoke(): void {
473537 installPackedTarball ( prefixDir , tarballPath , tmpRoot ) ;
474538
475539 const packageRoot = join ( resolveGlobalRoot ( prefixDir , tmpRoot ) , "openclaw" ) ;
540+ verifyPackedInstalledPackage ( {
541+ expectedVersion,
542+ packageRoot,
543+ prefixDir,
544+ tmpRoot,
545+ } ) ;
476546 const homeDir = join ( tmpRoot , "home" ) ;
477547 const stateDir = join ( tmpRoot , "state" ) ;
478548 mkdirSync ( homeDir , { recursive : true } ) ;
0 commit comments