donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
24 lines • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveTargetRuntime = resolveTargetRuntime;
const InvalidParamValueException_1 = require("../exceptions/InvalidParamValueException");
/**
* Resolve a {@link TargetRuntime} for the given flow parameters.
*
* Looks up the {@link TargetRuntimePlugin} in the provided registry for the
* flow's target type, validates the target-specific parameters, and creates
* a live runtime.
*
* @throws {@link InvalidParamValueException} if no plugin is registered for
* the requested target type.
*/
async function resolveTargetRuntime(params, targetRuntimePlugins) {
const targetType = params.flowParams.target;
const plugin = targetRuntimePlugins.get(targetType);
if (!plugin) {
throw new InvalidParamValueException_1.InvalidParamValueException('target', targetType, `no target runtime plugin is registered for '${targetType}'`);
}
await plugin.validate(params.flowParams);
return plugin.createRuntime(params);
}
//# sourceMappingURL=resolveTargetRuntime.js.map