donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
25 lines • 892 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTool = createTool;
/**
* Factory function to create a Donobu Tool instance for Donobu plugins.
*
* See https://www.npmjs.com/package/create-donobu-plugin for details.
*/
function createTool(deps, options) {
class AnonymousTool extends deps.donobu.Tool {
constructor() {
super(options.name, options.description, options.schema, (options.gptSchema ?? options.schema), options.requiresGpt);
}
async call(ctx, params) {
return options.call(ctx, params);
}
async callFromGpt(ctx, params) {
return options.callFromGpt
? options.callFromGpt(ctx, params)
: this.call(ctx, this.inputSchema.parse(params));
}
}
return new AnonymousTool();
}
//# sourceMappingURL=createTool.js.map