Skip to main content

Module config

Module config 

Source
Expand description

Layered mission configuration (plan §6).

Configuration is resolved from three layers, later layers winning:

  1. MissionConfig::default() — compiled-in defaults
  2. ~/.kranz/config.json — the user’s global config (crate::paths::global_config)
  3. <repo>/.kranz/config.json — per-project config (crate::paths::project_config)

Files may be partial: any subset of keys. The merge happens on serde_json::Value trees so a project file can override a single nested field (e.g. only worker.model) without restating the rest. Unknown keys are ignored on deserialization.

Structs§

LocalEndpoint
An operator-configured OpenAI-compatible endpoint the Worker can be routed to for the local tier. Mirrors crate::types::RoleConfig’s local-backend fields (base_url/context_budget/temperature).

Enums§

Layer
Which layer of the merge order a config file occupies — and therefore who is trusted to have written it.
ModelTier
Coarse model capability tiers used by config safety floors.
PatchSource
Where a runtime config-change patch came from.

Constants§

MAX_WORKER_CANDIDATES
Maximum dispatch-pool size (workerCandidates, KRZ-303). Each candidate is a full paid worker session per unit of work, so the same 8-wide bound as maxParallelWorkers applies — well past any useful fan-out.

Functions§

apply_executor_routing
Apply executor-tier routing to a mission config at seed time, so a fresh mission’s mission.created config already reflects the routing decision. Pure: never touches config.validator_scrutiny or config.validator_functional.
apply_validated_patch
Apply a partial JSON patch to an effective mission config and validate the merged result exactly as the engine would before accepting it.
apply_validated_patch_from
apply_validated_patch with the patch’s origin declared, so the consent-bearing keys can be refused when the patch came off the unauthenticated control inbox.
check_project_layer_keys
Refuse a project-layer patch that sets an operator-only key.
check_runtime_patch
Refuse a runtime config-change patch that reaches past the keys its source is allowed to set.
deep_merge
Recursively merge patch into base: objects merge key-wise, everything else (scalars, arrays, nulls) is replaced wholesale by the patch value.
effective_model
Return the model actually sent to the backend for this role selection.
load
Load the effective config for a repo: defaults, then the global file, then the project file (later layers win). Missing files are fine; unreadable or unparseable files are a EngineError::Config naming the offending path. The project layer is additionally held to the operator-only key rule (check_project_layer_keys).
load_layers
Merge the given config files (in order, later wins) over the compiled-in defaults. Exposed so callers (and tests) can supply explicit layer paths instead of the real home directory.
load_layers_with_roles
load_layers with each layer’s provenance declared, so the operator-only key rule (check_project_layer_keys) can refuse a repository-owned layer that names the binary kranz executes, the endpoint it POSTs prompts to, a credential, or a containment escape.
model_tier
Classify a validated backend/model pair. None means this model is not a supported model for the selected backend.
parse_backend
Parse the optional role backend field.
role_model_tier
Classify the role’s configured selection after applying legacy/default model normalization.
route_task_class_executor
Core of route_ticket_executor, taking the raw task-class string directly. crate::orchestrator::MissionEngine::create calls this with the class recovered from its goal argument via crate::ticket::parse_task_class_from_goalcreate only ever sees a folded goal string, never the originating crate::ticket::Ticket, so the class has to travel through that one channel.
route_ticket_executor
Route the executor tier for a mission seeded from ticket, so the resulting mission.created config already reflects the routing decision — the single engine-side entry point both the kranz draft and kranz exec seed paths call before crate::orchestrator::MissionEngine::create. Returns the applied tier and a decision summary to record against the mission once it exists.
task_class_to_tier
Deterministically map a ticket’s task-class frontmatter to an executor tier. Literal table only — no heuristics: execution-class (case- and whitespace-insensitive) routes to ExecutorTier::Local; every other value, including absence, stays on ExecutorTier::Frontier.
validate
Validate invariants the engine relies on (plan §6). Returns EngineError::Config describing the first violation found.
validate_claude_binary
Refuse a claudeBinary whose resolution depends on where kranz was invoked, or which the repository itself supplies.