UNPKG

jorel

Version:

A unified wrapper for working with LLMs from multiple providers, including streams, images, documents & automatic tool use.

39 lines (38 loc) 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateAgentDelegateTemplate = exports.validateAgentCoreMessageTemplate = exports.validateAgentName = void 0; const validateAgentName = (name) => { if (name.length < 3) { throw new Error("Agent name must be at least 3 characters long"); } if (name.length > 50) { throw new Error("Agent name must not exceed 50 characters"); } if (!/^[a-z0-9_]+$/.test(name)) { throw new Error("Agent name must only contain lowercase letters, numbers, and underscores"); } return name; }; exports.validateAgentName = validateAgentName; const validateAgentCoreMessageTemplate = (template) => { const _template = template.trim(); if (_template.length < 1) { throw new Error("Agent core message template must not be empty"); } return _template; }; exports.validateAgentCoreMessageTemplate = validateAgentCoreMessageTemplate; const validateAgentDelegateTemplate = (template) => { const _template = template.trim(); if (_template.length < 1) { throw new Error("Agent delegate template must not be empty"); } if (!_template.includes("{{name}}")) { throw new Error("Agent delegate template must include the {{name}} placeholder"); } if (!_template.includes("{{description}}")) { throw new Error("Agent delegate template must include the {{description}} placeholder"); } return _template; }; exports.validateAgentDelegateTemplate = validateAgentDelegateTemplate;