UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

10 lines (9 loc) • 660 B
import { CACHE_RETENTION_WORDS, isCacheRetention } from "../internal/llm.js"; import { describeRejectedValue } from "../core/tool-search-setting.js"; const SHOWN_STRING_MAX = 40; export function cacheRetentionDefect(value, field) { if (value === undefined || isCacheRetention(value)) return undefined; const shown = typeof value === "string" && value.length > SHOWN_STRING_MAX ? `a string of ${value.length} characters` : describeRejectedValue(value); return `${field} must be one of ${CACHE_RETENTION_WORDS.join(" | ")}, or absent (got ${shown}) — a retention value the engine cannot read is refused rather than sent as the default.`; }