- Add envVars field to Agent and Collection models in Prisma schema - Add envVars to UpdateAgentSchema and UpdateCollectionSchema types - Implement env vars merging logic (agent overrides collection) - Pass env vars through tool executor to sandbox - Add UI for managing env vars in agent and collection settings pages - Update API routes to handle envVars PATCH updates - Refactor discord tool execute functions for biome compatibility This allows users to configure tool-specific environment variables (like DISCORD_BOT_TOKEN) at both the collection and agent level, with agent settings taking precedence over collection settings.
24 lines
1 KiB
TypeScript
24 lines
1 KiB
TypeScript
import { createEnv } from '@tpmjs/env';
|
|
import { z } from 'zod';
|
|
|
|
export const env = createEnv({
|
|
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
|
NEXT_PUBLIC_API_URL: z.string().url().optional(),
|
|
CRON_SECRET: z.string().min(32).optional(), // Required for Vercel Cron security
|
|
RAILWAY_EXECUTOR_URL: z
|
|
.string()
|
|
.url()
|
|
.default('https://endearing-commitment-production.up.railway.app'), // Railway service for health checks
|
|
|
|
// Better Auth
|
|
BETTER_AUTH_SECRET: z.string().min(32).optional(), // Required for session encryption
|
|
BETTER_AUTH_URL: z.string().url().optional(), // Base URL for auth callbacks
|
|
|
|
// Resend (Email)
|
|
RESEND_API_KEY: z.string().startsWith('re_').optional(), // Resend API key for sending emails
|
|
|
|
// Discord Summary Agent
|
|
DISCORD_SUMMARY_AGENT_ID: z.string().optional(), // Agent ID for Discord summary cron
|
|
DISCORD_GUILD_ID: z.string().optional(), // Discord server ID to summarize
|
|
DISCORD_SUMMARY_CHANNEL_ID: z.string().optional(), // Channel to post summaries to
|
|
});
|