Expand description
Layered mission configuration (plan §6).
Configuration is resolved from three layers, later layers winning:
MissionConfig::default()— compiled-in defaults~/.kranz/config.json— the user’s global config (crate::paths::global_config)<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§
- Local
Endpoint - 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.
- Model
Tier - Coarse model capability tiers used by config safety floors.
- Patch
Source - Where a runtime
config-changepatch 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 asmaxParallelWorkersapplies — 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.createdconfig already reflects the routing decision. Pure: never touchesconfig.validator_scrutinyorconfig.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_patchwith 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-changepatch that reaches past the keys its source is allowed to set. - deep_
merge - Recursively merge
patchintobase: 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::Confignaming 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_layerswith 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.
Nonemeans 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 rawtask-classstring directly.crate::orchestrator::MissionEngine::createcalls this with the class recovered from itsgoalargument viacrate::ticket::parse_task_class_from_goal—createonly ever sees a folded goal string, never the originatingcrate::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 resultingmission.createdconfig already reflects the routing decision — the single engine-side entry point both thekranz draftandkranz execseed paths call beforecrate::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-classfrontmatter to an executor tier. Literal table only — no heuristics:execution-class(case- and whitespace-insensitive) routes toExecutorTier::Local; every other value, including absence, stays onExecutorTier::Frontier. - validate
- Validate invariants the engine relies on (plan §6). Returns
EngineError::Configdescribing the first violation found. - validate_
claude_ binary - Refuse a
claudeBinarywhose resolution depends on where kranz was invoked, or which the repository itself supplies.