import { readFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { CONTRACT_VERSIONS } from "agent-relay-sdk"; import { gitShaFromEnv } from "./config"; const __dirname = dirname(fileURLToPath(import.meta.url)); const pkg = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf8")) as { name?: string; version?: string }; export const PACKAGE_NAME = pkg.name || "agent-relay-orchestrator"; export const VERSION = pkg.version || "0.0.0"; // Protocol versions are owned by the SDK (CONTRACT_VERSIONS) — derive, never redeclare. export const ORCHESTRATOR_PROTOCOL_VERSION = CONTRACT_VERSIONS.orchestratorProtocol; export const RUNNER_PROTOCOL_VERSION = CONTRACT_VERSIONS.runnerProtocol; export const PROVIDER_PLUGIN_PROTOCOL_VERSION = CONTRACT_VERSIONS.providerPluginProtocol; export const GIT_SHA = gitShaFromEnv(); export const CONTRACTS = { orchestratorProtocol: ORCHESTRATOR_PROTOCOL_VERSION, runnerProtocol: RUNNER_PROTOCOL_VERSION, providerPluginProtocol: PROVIDER_PLUGIN_PROTOCOL_VERSION, } as const; export const RUNTIME_CAPABILITIES = { directoryBrowse: true, relayCommandBus: true, selfUpgrade: true, authenticatedLogProxy: true, artifactProxy: true, managedAgentReports: true, durableRunnerSupervisor: true, migrateProviderConfig: true, } as const; export function runtimeMetadata() { return { package: { name: PACKAGE_NAME, version: VERSION, }, contracts: CONTRACTS, capabilities: RUNTIME_CAPABILITIES, }; }