@velum-labs/routekit-config
v1.3.2
Published
RouteKit router configuration discovery, loading, validation, and atomic writes.
Downloads
10,708
Readme
@velum-labs/routekit-config
packages/config publishes @velum-labs/routekit-config: reusable RouteKit
router-config loading, provider validation, live-model selection, and atomic
writes.
Resolution
loadRouterConfig() loads the canonical
~/.config/routekit/router.yaml, or one explicit complete document when an
embedding supplies configPath. Configuration rejects inline credentials;
providers obtain credential and optional base-URL environment-variable names
from @velum-labs/routekit-registry.
import {
assertModelsAvailable,
configuredProviderIds,
loadRouterConfig,
resolveModelId,
writeRouterConfig
} from "@velum-labs/routekit-config";
const loaded = loadRouterConfig();
const providers = configuredProviderIds(loaded.config);
const liveModels = ["openai/gpt-5.5"];
const model = resolveModelId(loaded.config, liveModels);
assertModelsAvailable([model], liveModels);configuredProviderIds() preserves declaration order. missingModelIds() and
assertModelsAvailable() compare configured model requirements with a
discovered live catalog. resolveModelId() validates an
explicit namespaced model, or selects the configured default/first live model
only when none was requested. Explicit unknown models are rejected; they never
fall through to the default. writeRouterConfig() and updateRouterConfig()
validate before atomically writing mode-0600 YAML.
loadRepositoryRoutingProfile({ repositoryRoot, name }) resolves one
read-only committed manifest from
.routekit/routing/profiles/<name>.yaml. It verifies the filename/name
binding, repository-contained activation and evidence paths, and the
activation basis reference without writing global router or daemon state.
Docs
- Configuration reference: ../../docs/configuration.md
- Maintainer reference: ../../docs/typescript-reference.md
