import type { ModelRosterConfig, Policy, PolicyCaps, PriceCatalog, PrivacyProfile, UltraConfig } from "../types.js"; export const ULTRAPI_VERSION = "1.0.0"; export const PI_VERSION = "0.84.1"; export const PI_AGENTS_VERSION = "0.13.2"; export const DEFAULT_ANALYTICS_RETENTION_DAYS = 365; /** * Example rosters, not a policy. They are what a fresh install declares so that the * two reference setups work out of the box; any model id from any provider is * equally valid once it appears in `models.tiers`. Order is weakest to strongest. */ export const PRIVATE_MODELS = [ "openai-codex/gpt-5.6-luna", "openai-codex/gpt-5.6-terra", "openai-codex/gpt-5.6-sol", ] as const; export const FREE_ROLES = { scout: "opencode/big-pickle", normal: "opencode/deepseek-v4-flash-free", deep: "opencode/deepseek-v4-flash-free", } as const; export const FREE_MODELS = [...new Set(Object.values(FREE_ROLES))] as readonly string[]; export const DEFAULT_ROSTERS: Record = { private: { tiers: [...PRIVATE_MODELS] }, free: { tiers: [...FREE_MODELS], nonCritical: [FREE_ROLES.scout] }, }; export function defaultRosterConfig(profile: PrivacyProfile): ModelRosterConfig { return structuredClone(DEFAULT_ROSTERS[profile]); } /** * The rate used to price a model the catalogue does not name, from what the provider charges for it. * * 125 is the highest credits-per-USD among the three models the shipped catalogue prices (luna 125, * terra 31.25, sol 25 — the catalogue is a capability-rank curve pinned to luna's dollar price, not * a dollar scale). Taking the highest is the conservative direction both ways this number is used: * a larger credit charge per dollar means the budget bites sooner, and a smaller USD ceiling comes * back out of `usdBudgetForCredits`. It is also the only value that keeps those two inverse — for a * purely derived roster `usdBudgetForCredits` returns exactly `credits / 125`, so the ceiling a * delegated run is handed and the charge it is billed cannot drift apart. */ export const DEFAULT_CREDITS_PER_USD = 125; export const DEFAULT_PRICE_CATALOG: PriceCatalog = { version: "2026-08-09", currency: "credits", creditsPerUsd: DEFAULT_CREDITS_PER_USD, models: { "openai-codex/gpt-5.6-luna": { input: 25, cached: 2.5, output: 150 }, "openai-codex/gpt-5.6-terra": { input: 62.5, cached: 6.25, output: 375 }, "openai-codex/gpt-5.6-sol": { input: 125, cached: 12.5, output: 750 }, // Declared zero, not unknown. The registry reports all-zero both for a model that is genuinely // free and for one whose provider declared no cost at all, and cannot tell them apart — so a // free price has to be written down here for it to be believed. [FREE_ROLES.scout]: { input: 0, cached: 0, output: 0 }, [FREE_ROLES.normal]: { input: 0, cached: 0, output: 0 }, }, }; export const POLICY_CAPS: Record = { economy: { softCap: 4, internalStopTarget: 7, hardCap: 8, maxRepairCycles: 1, initialScouts: 1, maxParallel: 2, maxTotal: 4, maxWaves: 1 }, balanced: { softCap: 10, internalStopTarget: 17, hardCap: 20, maxRepairCycles: 2, initialScouts: 2, maxParallel: 4, maxTotal: 8, maxWaves: 2 }, quality: { softCap: 25, internalStopTarget: 43, hardCap: 50, maxRepairCycles: 3, initialScouts: 3, maxParallel: 6, maxTotal: 12, maxWaves: 2 }, max: { softCap: 60, internalStopTarget: 100, hardCap: 120, maxRepairCycles: 4, initialScouts: 3, maxParallel: 8, maxTotal: 16, maxWaves: 3 }, }; export function defaultConfig(profile: UltraConfig["profile"] = "private"): UltraConfig { const free = profile === "free"; return { schemaVersion: 1, configVersion: ULTRAPI_VERSION, policyVersion: ULTRAPI_VERSION, profile, mode: "auto", policy: "balanced", budgets: { acknowledged: false }, models: defaultRosterConfig(profile), root: { model: free ? "opencode/deepseek-v4-flash-free" : "openai-codex/gpt-5.6-terra", thinking: "medium" }, scout: { model: free ? "opencode/big-pickle" : "openai-codex/gpt-5.6-luna", thinking: "low", initial: 2, maxParallel: free ? 2 : 4, maxTotal: 8, maxTurns: 8, maxOutputTokens: 800 }, boundedWriter: { model: free ? "opencode/deepseek-v4-flash-free" : "openai-codex/gpt-5.6-luna", thinking: "high", maxTurns: 20, maxOutputTokens: 1000 }, repair: { model: free ? "opencode/deepseek-v4-flash-free" : "openai-codex/gpt-5.6-luna", thinking: "high", maxAttempts: 2, sameFingerprintEscalation: true }, deep: { model: free ? "opencode/deepseek-v4-flash-free" : "openai-codex/gpt-5.6-sol", thinking: "high", maxTurns: 50 }, arbitration: { model: free ? "opencode/deepseek-v4-flash-free" : "openai-codex/gpt-5.6-sol", thinking: "xhigh", maxTurns: 20 }, warRoom: { autoEnabled: false, maxSpecialists: 2, maxRounds: 2, maxMessagesPerMember: 4 }, piAgentsBudgets: { maxAgents: 8, maxParallelism: free ? 2 : 4, maxIterations: 2, maxDepth: 1, maxTurns: 30 }, context: { envelopeTargetTokens: 5000, envelopeHardCapTokens: 8000, compactAtRatio: 0.68, blockWideSwarmAtRatio: 0.75 }, telemetry: { rawVaultEnabled: true, rawRetentionDays: 30, analyticsRetentionDays: DEFAULT_ANALYTICS_RETENTION_DAYS }, experiment: { challengerAllocation: 0.1, stopLossSuccessDrop: 0.05, stopLossCostIncrease: 0.2 }, compatibility: { piVersion: PI_VERSION, piAgentsVersion: PI_AGENTS_VERSION }, }; }