Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: preprocess empty endpoint on providerSchema (iter 10)

[._.]/ Adam Eivyf2101e348ddc
diff --git a/server/lib/aiToolkit/validation.js b/server/lib/aiToolkit/validation.js
index 020612e276..6d23d0404d 100644
--- a/server/lib/aiToolkit/validation.js
+++ b/server/lib/aiToolkit/validation.js
@@ -9,7 +9,12 @@ export const providerSchema = z.object({
type: z.enum(['cli', 'api']),
command: z.string().optional(),
args: z.array(z.string()).optional(),
- endpoint: z.string().url().optional(),
+ // CLI providers send `endpoint: ''` from the form; coerce empty/null to
+ // undefined so the URL check only runs for actual values (API providers).
+ endpoint: z.preprocess(
+ (v) => (v === '' || v === null ? undefined : v),
+ z.string().url().optional()
+ ),
apiKey: z.string().optional(),
models: z.array(z.string()).optional(),
defaultModel: z.string().nullable().optional(),