Files
test1/app/api/nova-config.ts
2026-03-20 07:33:46 +00:00

38 lines
895 B
TypeScript

import { readFileSync } from 'fs'
import { join } from 'path'
interface NovaAgent {
agent_id: string
agent_name: string
agent_description: string
}
interface NovaConfig {
agents: NovaAgent[]
}
let _config: NovaConfig | null = null
export function getNovaConfig(): NovaConfig {
if (!_config) {
const configPath = join(process.cwd(), '.nova', 'config.json')
_config = JSON.parse(readFileSync(configPath, 'utf-8'))
}
return _config!
}
export function getDefaultAgentId(): string {
const config = getNovaConfig()
if (!config.agents.length) {
throw new Error('No agents configured in .nova/config.json')
}
return config.agents[0].agent_id
}
export function getDefaultAgentName(): string {
const config = getNovaConfig()
if (!config.agents.length) {
throw new Error('No agents configured in .nova/config.json')
}
return config.agents[0].agent_name
}