UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

14 lines (13 loc) • 846 B
import { PROTOCOL_TABLE, carriesNamespaceSeparator, isNameableToolName } from "@sema-agent/primitives"; export const NAMESPACED_NAME_SHAPES = PROTOCOL_TABLE.map((ns) => `${ns.prefix}<peer>__<tool>`).join(", "); export function callerToolNameProblem(name) { if (!isNameableToolName(name)) { return (`a caller tool name or alias must be a name a rule can name — ASCII letters, digits and "_" "-" "." ":" "*", ` + `starting with a letter, a digit or "_", not ending with "." or ":", and not the lone wildcard "*" — ` + `or no allow or deny list could name the tool; rename it`); } if (carriesNamespaceSeparator(name)) { return `"__" is reserved for the engine's protocol tool namespaces (${NAMESPACED_NAME_SHAPES}) and no caller tool name or alias may carry it`; } return undefined; }