Here you go, this code will check if select layer is smart object and which filter is applied to it. You should use Alchemist Plugin it will save you a lot of time.
const batchPlay = require("photoshop").action.batchPlay;
const layerKind = app.activeDocument.layers[0].kind;
if (layerKind === "smartObject") {
const result = await batchPlay(
[
{
_obj: "get",
_target: [
{
_property: "smartObjectMore",
},
{
_ref: "layer",
_id: app.activeDocument.activeLayers[0]._id,
},
{
_ref: "document",
_id: app.activeDocument?.id,
},
],
_options: {
dialogOptions: "dontDisplay",
},
},
],
{}
);
const pinned = result[0].smartObjectMore.filterFX.filterFXList[0];
console.log(pinned.filter);
} else {
// select layer is not a smart object
require("photoshop").core.showAlert(
"Please make sure the slected layer is a smart object"
);
}