Converting old action to New Photoshop version 22 Alchemist batch code

Hello,
im having an issue where when my code hits this portion of code it crashes Photoshop version 22.
Im trying to resolve the issue. Does anyone know what photoshop command this is exactly? What can i click or what button combination can i press to generate the below code? Is it possible for someone out there to convert this code to the new one using the alchemist plugin? Any help would help.
Thank you so much

    function command() {
        var desc143 = new ActionDescriptor();
        var ref73 = new ActionReference();
        ref73.putClass(charIDToTypeID('Dcmn'));
        desc143.putReference(charIDToTypeID('null'), ref73);
        desc143.putString(charIDToTypeID('Nm  '), activeDocument.activeLayer.name);
        var ref74 = new ActionReference();
        ref74.putEnumerated(charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt'));
        desc143.putReference(charIDToTypeID('Usng'), ref74);
        executeAction(charIDToTypeID('Mk  '), desc143, DialogModes.NO);
    }

Are you trying to rename a layer ?

here in this site, someone named it dupLayers();
This is a snip of code i grabbed online thats part of a bigger operation.

what the bigger operation does is basically grab a layer, copies it to a new document and saves the file. im not sure if this code is duplicating the layer and sending it to a new document but overall, thats the process and this code is part of that

i figured out what it was doing… its duplicating the layer and sending it to new document… its equivalent to right clicking a layer > selecting “duplicate layer/artboard” and in the popup selecting > Document: “new”. What i dont understand is why is photoshop crashing at this point… in older versions it doesnt crash. i dont think i can use the code that alchemist is using because i am using CEP (i believe) the old extendscript/legacy dev enviroment. Is there a way for alchemist to pump out old legacy code instead? im not sure how to proceed

You could try Humanizer. This way you can use code very similar to the modern batchPlay. It is very similar but you might need to do some adjustments. E.g. in reference GitHub - jardicc/ActionManagerHumanizer: This tool will reveal for you occult mystery of Photoshop ActionDescriptors and will transform them into well known JSON strings and JS objects

Thank you, it looks promising,
But everytime i include the Humanizer.jsx my whole script fails.

so if i use:
//@include Humanizer.jsx or #include Humanizer.jsx

it fails.

I have the Humanizer.jsx file alongside my index.jsx file.

When i go back and remove the include statement above, my code goes back to working.

My whole project and folder structure is based off this one:

i think one of the issues is that its using JSON object. I dont think the JSON object exists in this old Adobe Photoshop CEP API. The JavaScript it uses is ECMAScript version 3 i believe. its very old school version. so not sure if thats an issue.

Yes you need additional polyfil

I see, would you happen to know all the polyfills required for this plug-in? Just wondering. Thanks