GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — headlesscode/src/rsi/roles.ts at master · Capsize-Games/headlesscode Expand file tree/ Copy pathroles.tsMore file actions 59 lines (55 loc) · 2.68 KB / Copy pathroles.tsFile metadata and controls59 lines (55 loc) · 2.68 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 import { DEFAULT_RSI_MODEL } from "./config.js" import { openRouterProfileForModel, RSI_DEFAULT_OPENROUTER_PROFILE_ID } from "./inference-broker.js" import type { ModelRole, RsiRoleConfig, RoleModelConfig } from "./types.js" const ROLE_ENV_NAMES: ModelRole[] = [ "worker", "mutation-architect", "failure-analyst", "critic", "adversary", "reviewer", "curriculum-designer", "training-data-curator", ] function envKey(role: ModelRole): string { return `HEADLESSCODE_RSI_ROLE_${role.toUpperCase().replace(/-/g, "_")}_MODEL` } export function defaultRoles(workerModel = DEFAULT_RSI_MODEL): RsiRoleConfig { return { worker: { provider: "ollama", model: workerModel } } } export function resolveRoles( configured: RsiRoleConfig | undefined, env: NodeJS.ProcessEnv = process.env, workerModel = DEFAULT_RSI_MODEL, ): RsiRoleConfig { const roles: RsiRoleConfig = { ...defaultRoles(workerModel), ...configured } for (const role of ROLE_ENV_NAMES) { const model = env[envKey(role)] const prefix = `HEADLESSCODE_RSI_ROLE_${role.toUpperCase().replace(/-/g, "_")}_` const provider = env[`${prefix}PROVIDER`]?.trim() const baseUrl = env[`${prefix}BASE_URL`]?.trim() const command = env[`${prefix}COMMAND`]?.trim() const openRouterProfile = env[`${prefix}OPENROUTER_PROFILE`]?.trim() if (provider && !["ollama", "openrouter", "command"].includes(provider)) throw new Error(`${prefix}PROVIDER must be ollama, openrouter, or command`) if (openRouterProfile && role !== "worker") throw new Error(`${prefix}OPENROUTER_PROFILE is supported only for worker jobs`) if (openRouterProfile && !(openRouterProfile === "deepseek-deepinfra-fp8" || openRouterProfile === "muse-spark-contributor")) throw new Error(`${prefix}OPENROUTER_PROFILE is not an admitted RSI profile`) if (model || provider || baseUrl || command || openRouterProfile) { roles[role] = { ...(roles[role] ?? { provider: "ollama" as const, model: workerModel }), ...(model ? { model } : {}), ...(provider ? { provider: provider as RoleModelConfig["provider"] } : {}), ...(baseUrl ? { baseUrl } : {}), ...(command ? { command } : {}), ...(openRouterProfile ? { openRouterProfile: openRouterProfile as NonNullable<RoleModelConfig["openRouterProfile"]> } : {}), } } } const worker = roles.worker if (worker?.provider === "openrouter") { const profile = openRouterProfileForModel(worker.model, worker.openRouterProfile) if (profile.id !== RSI_DEFAULT_OPENROUTER_PROFILE_ID || worker.openRouterProfile) roles.worker = { ...worker, openRouterProfile: profile.id } } else if (worker?.openRouterProfile) { throw new Error("HEADLESSCODE_RSI_ROLE_WORKER_OPENROUTER_PROFILE requires the OpenRouter worker provider") } return roles } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |