"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    runSkillCLI: ()=>runSkillCLI
});
const cli_namespaceObject = require("@midscene/shared/cli");
const mcp_namespaceObject = require("@midscene/shared/mcp");
const agent_js_namespaceObject = require("../agent/agent.js");
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
class SkillMidsceneTools extends mcp_namespaceObject.BaseMidsceneTools {
    createTemporaryDevice() {
        return new this.DeviceClass();
    }
    async ensureAgent() {
        if (!this.agent) {
            const device = new this.DeviceClass();
            this.agent = new agent_js_namespaceObject.Agent(device);
        }
        return this.agent;
    }
    constructor(DeviceClass){
        super(), _define_property(this, "DeviceClass", void 0), this.DeviceClass = DeviceClass;
    }
}
function runSkillCLI(options) {
    const tools = new SkillMidsceneTools(options.DeviceClass);
    return (0, cli_namespaceObject.runToolsCLI)(tools, options.scriptName).catch((e)=>{
        if (!(e instanceof cli_namespaceObject.CLIError)) console.error(e);
        process.exit(e instanceof cli_namespaceObject.CLIError ? e.exitCode : 1);
    });
}
exports.runSkillCLI = __webpack_exports__.runSkillCLI;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "runSkillCLI"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});

//# sourceMappingURL=index.js.map