Lane models are deploy config: six compiled defaults deleted, an unset lane refuses startup by name, recipe requires the six variables (cut-mp-lane-models-deploy-config)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fcedfa0411
commit
44396a3cdd
2 changed files with 86 additions and 48 deletions
|
|
@ -106,31 +106,40 @@ fn connector_binding() -> anyhow::Result<ConnectorBinding> {
|
|||
})
|
||||
}
|
||||
|
||||
/// The model each lane runs on, from env over the defaults the rulings set
|
||||
/// (dungeon-models-dm-opus): Opus for the play table (the DM) and the narrator (the projector),
|
||||
/// Sonnet for the NPC Personas and the elaborator (which also
|
||||
/// seeds), Haiku for the interpreter and the operational agent.
|
||||
fn lane_models() -> (ControllerModels, String) {
|
||||
/// The model each lane runs on. The deployment names every one: a lane's model
|
||||
/// is an opaque exact id the deployment writes (a provider's own id, with
|
||||
/// whatever slashes, dots or colons it carries), and the binary holds none, so
|
||||
/// a Dungeon with a lane unset refuses to start rather than guess a provider.
|
||||
/// Which model fills which role is the deployer's choice under the role split
|
||||
/// of the ruling `dungeon-models-dm-opus`: the play table (the DM) and the
|
||||
/// narrator (the projector) are the heaviest roles, the NPC Personas and the
|
||||
/// elaborator (which also seeds) the middle, the interpreter and the
|
||||
/// operational agent the lightest.
|
||||
fn lane_models() -> anyhow::Result<(ControllerModels, String)> {
|
||||
lane_models_from(|name| std::env::var(name).ok())
|
||||
}
|
||||
|
||||
fn lane_models_from(read: impl Fn(&str) -> Option<String>) -> (ControllerModels, String) {
|
||||
let lane = |name: &str, default: &str| read(name).unwrap_or_else(|| default.into());
|
||||
(
|
||||
fn lane_models_from(
|
||||
read: impl Fn(&str) -> Option<String>,
|
||||
) -> anyhow::Result<(ControllerModels, String)> {
|
||||
let lane = |name: &str| {
|
||||
read(name).with_context(|| format!("{name} is required: it names the model this lane runs on"))
|
||||
};
|
||||
Ok((
|
||||
ControllerModels {
|
||||
projector: lane("GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL", "claude-opus-5-5"),
|
||||
persona: lane("GHOSTLIGHT_CONTROLLER_PERSONA_MODEL", "claude-sonnet-5-5"),
|
||||
interpreter: lane("GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL", "claude-haiku-5-5"),
|
||||
operational_agent: lane("GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL", "claude-haiku-5-5"),
|
||||
elaborator: lane("GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL", "claude-sonnet-5-5"),
|
||||
projector: lane("GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL")?,
|
||||
persona: lane("GHOSTLIGHT_CONTROLLER_PERSONA_MODEL")?,
|
||||
interpreter: lane("GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL")?,
|
||||
operational_agent: lane("GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL")?,
|
||||
elaborator: lane("GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL")?,
|
||||
},
|
||||
lane("GHOSTLIGHT_PLAY_MODEL", "claude-opus-5-5"),
|
||||
)
|
||||
lane("GHOSTLIGHT_PLAY_MODEL")?,
|
||||
))
|
||||
}
|
||||
|
||||
/// The one routed inference port every timeline and lane shares.
|
||||
pub(crate) fn open_shared() -> anyhow::Result<Shared> {
|
||||
let (models, play_model) = lane_models();
|
||||
let (models, play_model) = lane_models()?;
|
||||
let mut all: Vec<&str> = models.each().to_vec();
|
||||
all.push(&play_model);
|
||||
let inference: Arc<dyn InferencePort> =
|
||||
|
|
@ -696,33 +705,62 @@ mod tests {
|
|||
report("after run-ahead", &host.world.snapshot().await.unwrap());
|
||||
}
|
||||
|
||||
const LANES: [&str; 6] = [
|
||||
"GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_PERSONA_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL",
|
||||
"GHOSTLIGHT_PLAY_MODEL",
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn lanes_default_to_the_ruled_tiers_and_each_reads_its_own_override() {
|
||||
let (models, play) = lane_models_from(|_| None);
|
||||
assert_eq!(models.projector, "claude-opus-5-5", "the narrator");
|
||||
assert_eq!(models.persona, "claude-sonnet-5-5");
|
||||
assert_eq!(models.elaborator, "claude-sonnet-5-5");
|
||||
assert_eq!(play, "claude-opus-5-5", "the DM");
|
||||
assert_eq!(models.interpreter, "claude-haiku-5-5");
|
||||
assert_eq!(models.operational_agent, "claude-haiku-5-5");
|
||||
for (name, lane) in [
|
||||
("GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL", 0),
|
||||
("GHOSTLIGHT_CONTROLLER_PERSONA_MODEL", 1),
|
||||
("GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL", 2),
|
||||
("GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL", 3),
|
||||
("GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL", 4),
|
||||
("GHOSTLIGHT_PLAY_MODEL", 5),
|
||||
] {
|
||||
let (models, play) = lane_models_from(|asked| (asked == name).then(|| "override".to_owned()));
|
||||
let mut all = models.each().to_vec();
|
||||
all.push(&play);
|
||||
let overridden: Vec<usize> = all
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, model)| **model == "override")
|
||||
.map(|(index, _)| index)
|
||||
.collect();
|
||||
assert_eq!(overridden, vec![lane], "{name} moves exactly its own lane");
|
||||
fn lane_models_refuse_an_unset_lane_by_name() {
|
||||
for unset in LANES {
|
||||
let error = lane_models_from(|asked| {
|
||||
(asked != unset).then(|| crate::test_support::TEST_LANE_MODEL.to_owned())
|
||||
})
|
||||
.err()
|
||||
.unwrap_or_else(|| panic!("{unset} unset was accepted"));
|
||||
let message = format!("{error:#}");
|
||||
assert!(message.contains(&format!("{unset} is required")), "{message}");
|
||||
for other in LANES.into_iter().filter(|other| *other != unset) {
|
||||
assert!(!message.contains(other), "{unset}: the error also names {other}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lane_models_pass_ids_through_verbatim() {
|
||||
let ids = [
|
||||
"deepseek/deepseek-v4-pro",
|
||||
"ollama/qwen3:8b",
|
||||
"vendor/model.v1.5-x",
|
||||
"plain-id",
|
||||
"a/b/c:d.e",
|
||||
"UPPER/Case",
|
||||
];
|
||||
for offset in 0..ids.len() {
|
||||
// Each lane reads its own variable and nothing else: give every
|
||||
// lane a distinct id and read each back from where it belongs.
|
||||
let (models, play) = lane_models_from(|asked| {
|
||||
LANES
|
||||
.iter()
|
||||
.position(|lane| *lane == asked)
|
||||
.map(|at| ids[(at + offset) % ids.len()].to_owned())
|
||||
})
|
||||
.unwrap();
|
||||
let held = [
|
||||
models.projector.as_str(),
|
||||
models.persona.as_str(),
|
||||
models.interpreter.as_str(),
|
||||
models.operational_agent.as_str(),
|
||||
models.elaborator.as_str(),
|
||||
play.as_str(),
|
||||
];
|
||||
for (at, lane) in LANES.iter().enumerate() {
|
||||
assert_eq!(held[at], ids[(at + offset) % ids.len()], "{lane} at offset {offset}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,21 +44,21 @@ required_environment = [
|
|||
"GAMECULT_IDUNN_RUNTIME_BUNDLE",
|
||||
"GHOSTLIGHT_CONNECTOR_ADDR",
|
||||
"GHOSTLIGHT_CONNECTOR_KEY_FILE",
|
||||
"GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_PERSONA_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL",
|
||||
"GHOSTLIGHT_HEIMDALL_APP_SECRET_FILE",
|
||||
"GHOSTLIGHT_HEIMDALL_BASE_URL",
|
||||
"GHOSTLIGHT_ODIN_RUDP",
|
||||
"GHOSTLIGHT_PLAY_MODEL",
|
||||
"GHOSTLIGHT_PUBLIC_APP_URL",
|
||||
"GHOSTLIGHT_SESSION_WRAPPING_KEY_FILE",
|
||||
]
|
||||
optional_environment = [
|
||||
"GHOSTLIGHT_AUTH_PROVIDERS",
|
||||
"GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_MAX_CONCURRENT",
|
||||
"GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_PERSONA_MODEL",
|
||||
"GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL",
|
||||
"GHOSTLIGHT_PLAY_MODEL",
|
||||
"RUST_LOG",
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue