Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(control-ui): reattach JSDoc to the function it documents in k8sValidation

Miguelon Peluchon0c365c59b2f9
diff --git a/control-ui/lib/k8sValidation.ts b/control-ui/lib/k8sValidation.ts
index 7a749a5b3..e4134a45d 100644
--- a/control-ui/lib/k8sValidation.ts
+++ b/control-ui/lib/k8sValidation.ts
@@ -18,6 +18,21 @@ export function isValidK8sName(name: string): boolean {
* e.g. `@test-oss-jose/helloo` → `test-oss-jose-helloo`. May return `""` when
* the input has no usable characters (the caller then leaves the field empty).
*/
+export function toK8sName(raw: string): string {
+ return raw
+ .toLowerCase()
+ .replace(/[^a-z0-9-]+/g, '-') // non-label chars (@, /, …) → single hyphen
+ .replace(/-+/g, '-') // collapse runs
+ .replace(/^-+|-+$/g, '') // trim edges (labels must start/end alphanumeric)
+ .slice(0, 63)
+ .replace(/-+$/g, '') // re-trim if the 63-cap left a trailing hyphen
+}
+
+/**
+ * Validate an agent name (RFC 1123 DNS label plus a 3-char minimum). Returns
+ * an empty string when the name is acceptable, or a human-readable error
+ * otherwise. Used by the create-agent wizard to surface inline validation.
+ */
export function getAgentNameError(name: string): string {
if (!name.trim()) return 'Agent name is required.'
if (!/^[a-z0-9-]+$/.test(name))
@@ -28,13 +43,3 @@ export function getAgentNameError(name: string): string {
if (name.length < 3) return 'Agent name must be at least 3 characters long.'
return ''
}
-
-export function toK8sName(raw: string): string {
- return raw
- .toLowerCase()
- .replace(/[^a-z0-9-]+/g, '-') // non-label chars (@, /, …) → single hyphen
- .replace(/-+/g, '-') // collapse runs
- .replace(/^-+|-+$/g, '') // trim edges (labels must start/end alphanumeric)
- .slice(0, 63)
- .replace(/-+$/g, '') // re-trim if the 63-cap left a trailing hyphen
-}