feat: make Rivet endpoint optional for self-hosted runtime
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).
This commit is contained in:
@@ -80,9 +80,10 @@ export const executeAgentOsAttempt = async (
|
||||
decodeWorkAttemptExecutionInput(rawInput)
|
||||
);
|
||||
const env = parseAgentEnv(process.env);
|
||||
const endpoint = env.RIVET_PUBLIC_ENDPOINT ?? env.RIVET_ENDPOINT;
|
||||
const client = createClient<typeof runtimeRegistry>({
|
||||
disableMetadataLookup: true,
|
||||
endpoint: env.RIVET_PUBLIC_ENDPOINT ?? env.RIVET_ENDPOINT,
|
||||
...(endpoint ? { endpoint } : {}),
|
||||
});
|
||||
const vm = client.workspace.getOrCreate([input.workspaceKey], {
|
||||
params: { token: env.RIVET_WORKSPACE_TOKEN },
|
||||
@@ -243,9 +244,10 @@ export const cancelAgentOsAttempt = async (
|
||||
attemptId: string
|
||||
) => {
|
||||
const env = parseAgentEnv(process.env);
|
||||
const endpoint = env.RIVET_PUBLIC_ENDPOINT ?? env.RIVET_ENDPOINT;
|
||||
const client = createClient<typeof runtimeRegistry>({
|
||||
disableMetadataLookup: true,
|
||||
endpoint: env.RIVET_PUBLIC_ENDPOINT ?? env.RIVET_ENDPOINT,
|
||||
...(endpoint ? { endpoint } : {}),
|
||||
});
|
||||
await client.workspace
|
||||
.getOrCreate([workspaceKey], {
|
||||
|
||||
10
packages/env/src/agent.ts
vendored
10
packages/env/src/agent.ts
vendored
@@ -14,8 +14,14 @@ const agentEnvSchema = z.object({
|
||||
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.url(),
|
||||
RIVET_PUBLIC_ENDPOINT: z.url().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"),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user