RIVET_ENDPOINT and RIVET_PUBLIC_ENDPOINT are now optional in the agent env schema; empty strings are coerced to undefined. The agent runtime only passes an endpoint override to the Rivet client when one is set, so the client falls back to its default (suitable for self-hosted Rivet where no explicit endpoint is required).
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { z } from "zod";
|
|
|
|
const agentEnvSchema = z.object({
|
|
AGENT_MODEL_API: z.literal("openai-completions"),
|
|
AGENT_MODEL_API_KEY: z.string().min(1),
|
|
AGENT_MODEL_BASE_URL: z.url(),
|
|
AGENT_MODEL_CONTEXT_WINDOW: z.coerce.number().int().positive(),
|
|
AGENT_MODEL_MAX_TOKENS: z.coerce.number().int().positive(),
|
|
AGENT_MODEL_NAME: z.string().min(1),
|
|
AGENT_MODEL_PROVIDER: z.string().min(1),
|
|
CONVEX_URL: z.url(),
|
|
DAEMON_ID: z.string().min(1),
|
|
FLUE_DB_TOKEN: z.string().min(1),
|
|
GITEA_TOKEN: z.string().min(1).optional(),
|
|
GITEA_URL: z.url().default("https://git.openputer.com"),
|
|
OPENROUTER_API_KEY: z.string().min(1).optional(),
|
|
RIVET_ENDPOINT: z.preprocess(
|
|
(value) => (value === "" ? undefined : value),
|
|
z.url().optional()
|
|
),
|
|
RIVET_PUBLIC_ENDPOINT: z.preprocess(
|
|
(value) => (value === "" ? undefined : value),
|
|
z.url().optional()
|
|
),
|
|
RIVET_WORKSPACE_TOKEN: z.string().min(32),
|
|
ZOPU_SOURCE_REPOSITORY: z.string().min(1).default("/opt/zopu-source"),
|
|
});
|
|
|
|
export type AgentEnv = z.infer<typeof agentEnvSchema>;
|
|
|
|
export const parseAgentEnv = (
|
|
runtimeEnv: Record<string, string | undefined>
|
|
): AgentEnv => agentEnvSchema.parse(runtimeEnv);
|