/** * @module @nhtio/adk/eslint/rules/require_string_empty_disposition * * Flags a `validator.string()` chain — written literally inside an `inputSchema` value passed to * `new Tool({...})` or `new ArtifactTool({...})` — that is `.optional()`/`.default(…)`-shaped but has * no explicit empty-string disposition. * * Why: confirmed empirically against the actual installed `@nhtio/validation` package (Joi under the * hood), `validator.string()` rejects `""` with `"{{#label}} is not allowed to be empty"` regardless * of whether the chain is bare, `.optional()`, `.default(x)`, or even `.required()` — including the * absurd case where `""` is the schema's own configured default (`validator.string().default('')` * still rejects an explicit `''`). A model filling in a tool call will often send `""` instead of * omitting an unwanted optional parameter; without an explicit disposition, that fails schema * validation instead of degrading gracefully. This is the same category of footgun * `adk/require-validator-any-required` polices for `.any()` — a silent, non-obvious default that only * bites at the worst time. * * Scope, deliberately narrow (read this before assuming the rule catches more than it does): this * rule only flags a `.string()` chain that is *(1)* rooted directly in `validator.string()`, *(2)* * `.optional()`/`.default(…)`-shaped (a bare `.required()`-only or fully bare chain is out of scope — * demanding `''`-handling there would mostly add noise around ids/expressions/JSON payloads that * should keep rejecting empty input), and *(3)* written literally inside the `inputSchema` value of a * `new Tool({...})`/`new ArtifactTool({...})` call — including nested inside a `validator.object( * {...})` that is itself the `inputSchema` value. It does **not** trace a schema assembled in a * helper function and handed in via a variable, it does **not** track cross-branch/conditional * reassignment of a schema-holding variable, and it does **not** recognize any project-specific * "param spec" object-literal pattern. A `validator.string()` chain anywhere else — a battery's own * construction-options `validation.ts`, an embeddings/generation/TTS config schema, etc. — is out of * scope entirely, on purpose: a plugin shipped to arbitrary consumers cannot assume any particular * file layout or authoring convention, so it reasons only from the `new Tool(...)`/`new * ArtifactTool(...)` call shape itself, the one thing it can see without executing code. A * file-glob-scoped, pattern-aware sibling rule with a broader detection surface exists for this * repository's own internal use (not part of what ships to external consumers). * * Clearing methods (an unambiguous empty-string disposition — any one of these clears the rule): * - `.allow('')` — only when a `''` string literal is among the call's arguments; `.allow(null)` * alone does NOT clear it (confirmed empirically: `.allow(null)` still rejects `''`). * - `.empty('')` — same argument-literal check. * - `.valid(...)` — ANY `.valid(...)` call clears the rule, regardless of whether `''` is among its * arguments. An explicit closed enum is sufficient, intentional disposition on its own — a model * sending `''` against a `.valid('a', 'b')` enum gets Joi's normal enum-rejection message, which * is exactly the tool author's intent by writing a closed enum. * - `.forbidden()` — the value must be absent entirely; trivially clears. * * Opt-out (e.g. a deliberately strict optional/default string that should keep rejecting `''`): * // eslint-disable-next-line adk/require-string-empty-disposition -- */ /** * ESLint rule: flags a `validator.string()` chain inside a `new Tool`/`new ArtifactTool` * `inputSchema` value that is `.optional()`/`.default(…)`-shaped with no empty-string disposition. */ declare const requireStringEmptyDispositionRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"requireEmptyDisposition", [ ], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & { name: string; }; export default requireStringEmptyDispositionRule;