import { getScenarioWorkbenchConfig, type WorkbenchConfig, type WorkbenchScenarioId, } from './workbench' export type ViewOptions = { debug: boolean snapshot: boolean scenario: WorkbenchScenarioId } const SCENARIOS = new Set([ 'default', 'olmo-pretraining', 'olmo-long-context', 'llama-pretraining', 'llama-long-context', 'trinity-pretraining', 'trinity-long-context', 'infeasible-memory', ]) const truthyValues = new Set(['1', 'true', 'yes', 'on']) function isTruthy(value: string | null) { if (value === null) { return false } return truthyValues.has(value.toLowerCase()) } export function getViewOptions(search = window.location.search): ViewOptions { const params = new URLSearchParams(search) const scenarioParam = params.get('scenario') const scenario = SCENARIOS.has(scenarioParam as WorkbenchScenarioId) ? (scenarioParam as WorkbenchScenarioId) : 'default' return { debug: isTruthy(params.get('debug')), snapshot: isTruthy(params.get('snapshot')), scenario, } } export function getScenarioConfig(scenario: WorkbenchScenarioId): WorkbenchConfig { return getScenarioWorkbenchConfig(scenario) }