Keep generated role selection server-owned
This commit is contained in:
parent
debdf609d3
commit
4995f261f6
5 changed files with 391 additions and 27 deletions
|
|
@ -265,7 +265,7 @@ impl WorldCompiler {
|
|||
let validation = if parsed.openings.len() != 3 {
|
||||
Err(anyhow!("world compiler must return exactly three openings"))
|
||||
} else {
|
||||
ensure_distinct_openings(&parsed.openings)
|
||||
validate_opening_suggestions(&parsed.openings, &source_receipts)
|
||||
};
|
||||
match validation {
|
||||
Ok(()) => {
|
||||
|
|
@ -332,7 +332,7 @@ impl WorldCompiler {
|
|||
let validation = if parsed.roles.len() != 3 {
|
||||
Err(anyhow!("world compiler must return exactly three roles"))
|
||||
} else {
|
||||
ensure_distinct_roles(&parsed.roles)
|
||||
validate_role_suggestions(&parsed.roles, &source_receipts)
|
||||
};
|
||||
match validation {
|
||||
Ok(()) => {
|
||||
|
|
@ -536,14 +536,32 @@ impl WorldCompiler {
|
|||
&self,
|
||||
start: SelectedStart,
|
||||
) -> Result<(WorldCompilePreview, Vec<ModelStageReceipt>)> {
|
||||
self.compile_custom(CustomStart {
|
||||
campaign_name: start.campaign_name,
|
||||
who: format!("{} — {}", start.role.name, start.role.premise),
|
||||
where_: start.opening.place,
|
||||
when: start.opening.era,
|
||||
goal: format!("{}; {}", start.opening.player_hook, start.opening.pressure),
|
||||
})
|
||||
.await
|
||||
let role = start.role.clone();
|
||||
let (mut preview, receipts) = self
|
||||
.compile_custom(CustomStart {
|
||||
campaign_name: start.campaign_name,
|
||||
who: format!("{} — {}", start.role.name, start.role.premise),
|
||||
where_: start.opening.place,
|
||||
when: start.opening.era,
|
||||
goal: format!("{}; {}", start.opening.player_hook, start.opening.pressure),
|
||||
})
|
||||
.await?;
|
||||
let player_id = preview.campaign.player_actor_id.clone();
|
||||
let player = preview
|
||||
.campaign
|
||||
.actors
|
||||
.get_mut(&player_id)
|
||||
.ok_or_else(|| anyhow!("compiled campaign lost its player actor"))?;
|
||||
player.capabilities.extend(role.capabilities.clone());
|
||||
player.obligations.extend(role.obligations.clone());
|
||||
preview.branch_assumptions.push(format!(
|
||||
"The approved generated role '{}' grants the player capabilities [{}] and obligations [{}].",
|
||||
role.name,
|
||||
role.capabilities.join(", "),
|
||||
role.obligations.join(", ")
|
||||
));
|
||||
validate_campaign_seed(&preview.campaign)?;
|
||||
Ok((preview, receipts))
|
||||
}
|
||||
|
||||
pub async fn compile_fission(
|
||||
|
|
@ -1744,6 +1762,69 @@ fn ensure_distinct_roles(items: &[RoleSuggestion]) -> Result<()> {
|
|||
)
|
||||
}
|
||||
|
||||
fn validate_opening_suggestions(items: &[OpeningSuggestion], receipts: &[String]) -> Result<()> {
|
||||
ensure_distinct_openings(items)?;
|
||||
let mut ids = BTreeSet::new();
|
||||
for item in items {
|
||||
validate_user_text("opening id", &item.id, 160)?;
|
||||
validate_user_text("opening title", &item.title, 160)?;
|
||||
validate_user_text("opening era", &item.era, 160)?;
|
||||
validate_user_text("opening place", &item.place, 240)?;
|
||||
validate_user_text("opening pressure", &item.pressure, 500)?;
|
||||
validate_user_text("opening player hook", &item.player_hook, 500)?;
|
||||
if !ids.insert(item.id.trim().to_owned()) {
|
||||
return Err(anyhow!("opening ids must be unique"));
|
||||
}
|
||||
validate_suggestion_evidence("opening", &item.evidence_receipt_ids, receipts)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_role_suggestions(items: &[RoleSuggestion], receipts: &[String]) -> Result<()> {
|
||||
ensure_distinct_roles(items)?;
|
||||
let mut ids = BTreeSet::new();
|
||||
for item in items {
|
||||
validate_user_text("role id", &item.id, 160)?;
|
||||
validate_user_text("role name", &item.name, 160)?;
|
||||
validate_user_text("role premise", &item.premise, 500)?;
|
||||
if !ids.insert(item.id.trim().to_owned()) {
|
||||
return Err(anyhow!("role ids must be unique"));
|
||||
}
|
||||
if item.capabilities.is_empty()
|
||||
|| item.capabilities.len() > 8
|
||||
|| item.obligations.is_empty()
|
||||
|| item.obligations.len() > 8
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"each role needs between 1 and 8 capabilities and obligations"
|
||||
));
|
||||
}
|
||||
for capability in &item.capabilities {
|
||||
validate_user_text("role capability", capability, 160)?;
|
||||
}
|
||||
for obligation in &item.obligations {
|
||||
validate_user_text("role obligation", obligation, 160)?;
|
||||
}
|
||||
validate_suggestion_evidence("role", &item.evidence_receipt_ids, receipts)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_suggestion_evidence(
|
||||
label: &str,
|
||||
supplied: &[String],
|
||||
allowed: &[String],
|
||||
) -> Result<()> {
|
||||
let unique = supplied.iter().collect::<BTreeSet<_>>();
|
||||
let allowed = allowed.iter().collect::<BTreeSet<_>>();
|
||||
if supplied.len() > 8 || unique.len() != supplied.len() || !unique.is_subset(&allowed) {
|
||||
return Err(anyhow!(
|
||||
"{label} evidence may contain at most 8 unique supplied receipt ids"
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn ensure_distinct_fields<const N: usize>(
|
||||
subject: &str,
|
||||
axes: [(&str, Vec<&str>); N],
|
||||
|
|
@ -2799,6 +2880,50 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn selected_role_capabilities_and_obligations_survive_world_compilation() {
|
||||
let compiler = WorldCompiler::new(
|
||||
vault(),
|
||||
Arc::new(CompilerModel {
|
||||
invalid_route: false,
|
||||
}),
|
||||
"flash",
|
||||
"pro",
|
||||
);
|
||||
let (preview, _) = compiler
|
||||
.compile_selected(SelectedStart {
|
||||
campaign_name: "Selected role".into(),
|
||||
opening: OpeningSuggestion {
|
||||
id: "opening".into(),
|
||||
title: "Opening".into(),
|
||||
era: "fixture".into(),
|
||||
place: "yard".into(),
|
||||
pressure: "A gate is closed".into(),
|
||||
player_hook: "Learn why".into(),
|
||||
evidence_receipt_ids: vec![],
|
||||
},
|
||||
role: RoleSuggestion {
|
||||
id: "courier".into(),
|
||||
name: "Courier".into(),
|
||||
premise: "Carry a disputed manifest.".into(),
|
||||
capabilities: vec!["route knowledge".into()],
|
||||
obligations: vec!["deliver the manifest".into()],
|
||||
evidence_receipt_ids: vec![],
|
||||
},
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
let player = &preview.campaign.actors[&preview.campaign.player_actor_id];
|
||||
assert!(player.capabilities.contains("route knowledge"));
|
||||
assert!(player.obligations.contains("deliver the manifest"));
|
||||
assert!(
|
||||
preview
|
||||
.branch_assumptions
|
||||
.iter()
|
||||
.any(|assumption| assumption.contains("Courier"))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn evidence_projection_carries_exact_receipt_ids_and_deduplicates_witnesses() {
|
||||
let witness = SourceWitness {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ use ghostlight_dungeon::windows_secret::unprotect_machine_utf8;
|
|||
use ghostlight_dungeon::{
|
||||
assessor::ActionAssessor,
|
||||
compiler::{
|
||||
CustomStart, GestaltFissionRequest, OpeningRequest, OpeningSuggestion, SelectedStart,
|
||||
SuggestedOpenings, SuggestedRoles, WorldCompiler,
|
||||
CustomStart, GestaltFissionRequest, OpeningRequest, OpeningSuggestion, RoleSuggestion,
|
||||
SelectedStart, SuggestedOpenings, SuggestedRoles, WorldCompiler,
|
||||
},
|
||||
domain::{
|
||||
ActionIntent, Campaign, GestaltFissionPreview, NarrationProjection, RegionExpansionPreview,
|
||||
|
|
@ -55,6 +55,8 @@ struct AppState {
|
|||
assessor: Option<Arc<ActionAssessor>>,
|
||||
model: Option<Arc<dyn ModelPort>>,
|
||||
compile_previews: Arc<Mutex<BTreeMap<String, OwnedPreview<WorldCompilePreview>>>>,
|
||||
opening_suggestions: Arc<Mutex<BTreeMap<String, SuggestedOpenings>>>,
|
||||
role_suggestions: Arc<Mutex<BTreeMap<String, OwnedRoleSuggestions>>>,
|
||||
expansion_previews: Arc<Mutex<BTreeMap<String, OwnedPreview<RegionExpansionPreview>>>>,
|
||||
fission_previews: Arc<Mutex<BTreeMap<String, OwnedFissionPreview>>>,
|
||||
live_turns: Arc<AtomicUsize>,
|
||||
|
|
@ -99,6 +101,24 @@ struct OwnedFissionPreview {
|
|||
model_receipts: Vec<ghostlight_dungeon::model::ModelStageReceipt>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct OwnedRoleSuggestions {
|
||||
opening_id: String,
|
||||
value: SuggestedRoles,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct OpeningSelectionRequest {
|
||||
opening_id: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct SelectedStartRequest {
|
||||
campaign_name: String,
|
||||
opening_id: String,
|
||||
role_id: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct ProviderParallelismRequest {
|
||||
expected_provider_configuration_epoch: u64,
|
||||
|
|
@ -246,6 +266,8 @@ async fn main() -> anyhow::Result<()> {
|
|||
assessor,
|
||||
model: shared_model,
|
||||
compile_previews: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
opening_suggestions: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
role_suggestions: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
expansion_previews: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
fission_previews: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
live_turns: Arc::new(AtomicUsize::new(0)),
|
||||
|
|
@ -410,9 +432,10 @@ async fn compile_openings(
|
|||
State(state): State<AppState>,
|
||||
Json(request): Json<OpeningRequest>,
|
||||
) -> Response {
|
||||
if !authorized(&headers, &state).await {
|
||||
return StatusCode::UNAUTHORIZED.into_response();
|
||||
}
|
||||
let session = match authenticated_session(&headers, &state).await {
|
||||
Some(value) => value,
|
||||
None => return StatusCode::UNAUTHORIZED.into_response(),
|
||||
};
|
||||
let _live = LiveTurnGuard::enter(&state).await;
|
||||
let Some(compiler) = &state.compiler else {
|
||||
return (
|
||||
|
|
@ -422,7 +445,15 @@ async fn compile_openings(
|
|||
.into_response();
|
||||
};
|
||||
match compiler.suggest_openings(request).await {
|
||||
Ok(value) => Json(opening_suggestions_projection(&value)).into_response(),
|
||||
Ok(value) => {
|
||||
state
|
||||
.opening_suggestions
|
||||
.lock()
|
||||
.await
|
||||
.insert(session.clone(), value.clone());
|
||||
state.role_suggestions.lock().await.remove(&session);
|
||||
Json(opening_suggestions_projection(&value)).into_response()
|
||||
}
|
||||
Err(error) => (StatusCode::BAD_GATEWAY, error.to_string()).into_response(),
|
||||
}
|
||||
}
|
||||
|
|
@ -462,11 +493,31 @@ async fn compile_custom(
|
|||
async fn compile_roles(
|
||||
headers: HeaderMap,
|
||||
State(state): State<AppState>,
|
||||
Json(opening): Json<OpeningSuggestion>,
|
||||
Json(request): Json<OpeningSelectionRequest>,
|
||||
) -> Response {
|
||||
if !authorized(&headers, &state).await {
|
||||
return StatusCode::UNAUTHORIZED.into_response();
|
||||
}
|
||||
let session = match authenticated_session(&headers, &state).await {
|
||||
Some(value) => value,
|
||||
None => return StatusCode::UNAUTHORIZED.into_response(),
|
||||
};
|
||||
let opening = state
|
||||
.opening_suggestions
|
||||
.lock()
|
||||
.await
|
||||
.get(&session)
|
||||
.and_then(|suggestions| {
|
||||
suggestions
|
||||
.openings
|
||||
.iter()
|
||||
.find(|opening| opening.id == request.opening_id)
|
||||
.cloned()
|
||||
});
|
||||
let Some(opening) = opening else {
|
||||
return (
|
||||
StatusCode::CONFLICT,
|
||||
"opening selection is missing, expired, or not owned by this session",
|
||||
)
|
||||
.into_response();
|
||||
};
|
||||
let _live = LiveTurnGuard::enter(&state).await;
|
||||
let Some(compiler) = &state.compiler else {
|
||||
return (
|
||||
|
|
@ -476,7 +527,16 @@ async fn compile_roles(
|
|||
.into_response();
|
||||
};
|
||||
match compiler.suggest_roles(&opening).await {
|
||||
Ok(value) => Json(role_suggestions_projection(&value)).into_response(),
|
||||
Ok(value) => {
|
||||
state.role_suggestions.lock().await.insert(
|
||||
session,
|
||||
OwnedRoleSuggestions {
|
||||
opening_id: opening.id,
|
||||
value: value.clone(),
|
||||
},
|
||||
);
|
||||
Json(role_suggestions_projection(&value)).into_response()
|
||||
}
|
||||
Err(error) => (StatusCode::BAD_GATEWAY, error.to_string()).into_response(),
|
||||
}
|
||||
}
|
||||
|
|
@ -484,7 +544,7 @@ async fn compile_roles(
|
|||
async fn compile_selected(
|
||||
headers: HeaderMap,
|
||||
State(state): State<AppState>,
|
||||
Json(request): Json<SelectedStart>,
|
||||
Json(request): Json<SelectedStartRequest>,
|
||||
) -> Response {
|
||||
let session = match authenticated_session(&headers, &state).await {
|
||||
Some(value) => value,
|
||||
|
|
@ -510,7 +570,121 @@ async fn compile_selected(
|
|||
)
|
||||
.into_response();
|
||||
};
|
||||
store_preview(&state, session, compiler.compile_selected(request).await).await
|
||||
let opening_bundle = state
|
||||
.opening_suggestions
|
||||
.lock()
|
||||
.await
|
||||
.get(&session)
|
||||
.cloned();
|
||||
let role_bundle = state.role_suggestions.lock().await.get(&session).cloned();
|
||||
let Some(opening_bundle) = opening_bundle else {
|
||||
return (
|
||||
StatusCode::CONFLICT,
|
||||
"opening selection is missing or expired",
|
||||
)
|
||||
.into_response();
|
||||
};
|
||||
let Some(role_bundle) = role_bundle.filter(|roles| roles.opening_id == request.opening_id)
|
||||
else {
|
||||
return (
|
||||
StatusCode::CONFLICT,
|
||||
"role selection is missing, expired, or belongs to another opening",
|
||||
)
|
||||
.into_response();
|
||||
};
|
||||
let selected = match resolve_selected_start(
|
||||
request,
|
||||
&opening_bundle.openings,
|
||||
&role_bundle.opening_id,
|
||||
&role_bundle.value.roles,
|
||||
) {
|
||||
Ok(value) => value,
|
||||
Err(error) => return (StatusCode::CONFLICT, error).into_response(),
|
||||
};
|
||||
let result = compiler
|
||||
.compile_selected(selected)
|
||||
.await
|
||||
.map(|value| enrich_selected_preview(value, &opening_bundle, &role_bundle.value));
|
||||
store_preview(&state, session, result).await
|
||||
}
|
||||
|
||||
fn resolve_selected_start(
|
||||
request: SelectedStartRequest,
|
||||
openings: &[OpeningSuggestion],
|
||||
role_opening_id: &str,
|
||||
roles: &[RoleSuggestion],
|
||||
) -> Result<SelectedStart, &'static str> {
|
||||
if role_opening_id != request.opening_id {
|
||||
return Err("selected role belongs to another opening");
|
||||
}
|
||||
let opening = openings
|
||||
.iter()
|
||||
.find(|opening| opening.id == request.opening_id)
|
||||
.cloned()
|
||||
.ok_or("selected opening is not owned by this session")?;
|
||||
let role = roles
|
||||
.iter()
|
||||
.find(|role| role.id == request.role_id)
|
||||
.cloned()
|
||||
.ok_or("selected role is not owned by this session")?;
|
||||
Ok(SelectedStart {
|
||||
campaign_name: request.campaign_name,
|
||||
opening,
|
||||
role,
|
||||
})
|
||||
}
|
||||
|
||||
fn enrich_selected_preview(
|
||||
(mut preview, mut compile_receipts): (
|
||||
WorldCompilePreview,
|
||||
Vec<ghostlight_dungeon::model::ModelStageReceipt>,
|
||||
),
|
||||
openings: &SuggestedOpenings,
|
||||
roles: &SuggestedRoles,
|
||||
) -> (
|
||||
WorldCompilePreview,
|
||||
Vec<ghostlight_dungeon::model::ModelStageReceipt>,
|
||||
) {
|
||||
let mut known_evidence = preview
|
||||
.evidence_receipts
|
||||
.iter()
|
||||
.map(|receipt| receipt.id.clone())
|
||||
.collect::<BTreeSet<_>>();
|
||||
for receipt in openings
|
||||
.evidence_receipts
|
||||
.iter()
|
||||
.chain(&roles.evidence_receipts)
|
||||
{
|
||||
if known_evidence.insert(receipt.id.clone()) {
|
||||
for source_id in receipt
|
||||
.witnesses
|
||||
.iter()
|
||||
.map(|witness| witness.source_id.clone())
|
||||
.chain(std::iter::once(receipt.id.clone()).filter(|_| receipt.witnesses.is_empty()))
|
||||
{
|
||||
preview.evidence_coverage.push(ghostlight_dungeon::domain::EvidenceCoverage {
|
||||
source_id,
|
||||
lane: ghostlight_dungeon::domain::EvidenceUseLane::SettingBackground,
|
||||
rationale: "Used to generate the selected opening or player role; not admitted as direct causal world evidence.".into(),
|
||||
});
|
||||
}
|
||||
preview.evidence_receipts.push(receipt.clone());
|
||||
}
|
||||
}
|
||||
let mut known_model_receipts = compile_receipts
|
||||
.iter()
|
||||
.map(|receipt| receipt.receipt_hash.clone())
|
||||
.collect::<BTreeSet<_>>();
|
||||
for receipt in std::iter::once(&openings.retrieval_receipt)
|
||||
.chain(&openings.model_receipts)
|
||||
.chain(std::iter::once(&roles.retrieval_receipt))
|
||||
.chain(&roles.model_receipts)
|
||||
{
|
||||
if known_model_receipts.insert(receipt.receipt_hash.clone()) {
|
||||
compile_receipts.push(receipt.clone());
|
||||
}
|
||||
}
|
||||
(preview, compile_receipts)
|
||||
}
|
||||
|
||||
async fn store_preview(
|
||||
|
|
@ -2278,6 +2452,8 @@ mod tests {
|
|||
assessor: None,
|
||||
model: None,
|
||||
compile_previews: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
opening_suggestions: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
role_suggestions: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
expansion_previews: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
fission_previews: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
live_turns: Arc::new(AtomicUsize::new(0)),
|
||||
|
|
@ -2333,6 +2509,67 @@ mod tests {
|
|||
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn generated_start_selection_uses_only_server_owned_ids() {
|
||||
let opening = OpeningSuggestion {
|
||||
id: "opening-a".into(),
|
||||
title: "Opening A".into(),
|
||||
era: "fixture".into(),
|
||||
place: "yard".into(),
|
||||
pressure: "strike".into(),
|
||||
player_hook: "choose".into(),
|
||||
evidence_receipt_ids: vec![],
|
||||
};
|
||||
let role = RoleSuggestion {
|
||||
id: "role-a".into(),
|
||||
name: "Courier".into(),
|
||||
premise: "Carry the message.".into(),
|
||||
capabilities: vec!["route knowledge".into()],
|
||||
obligations: vec!["deliver the message".into()],
|
||||
evidence_receipt_ids: vec![],
|
||||
};
|
||||
let selected = resolve_selected_start(
|
||||
SelectedStartRequest {
|
||||
campaign_name: "Campaign".into(),
|
||||
opening_id: opening.id.clone(),
|
||||
role_id: role.id.clone(),
|
||||
},
|
||||
std::slice::from_ref(&opening),
|
||||
&opening.id,
|
||||
std::slice::from_ref(&role),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(selected.opening, opening);
|
||||
assert_eq!(selected.role, role);
|
||||
|
||||
assert!(
|
||||
resolve_selected_start(
|
||||
SelectedStartRequest {
|
||||
campaign_name: "Campaign".into(),
|
||||
opening_id: "forged-opening".into(),
|
||||
role_id: "role-a".into(),
|
||||
},
|
||||
std::slice::from_ref(&selected.opening),
|
||||
&selected.opening.id,
|
||||
std::slice::from_ref(&selected.role),
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
resolve_selected_start(
|
||||
SelectedStartRequest {
|
||||
campaign_name: "Campaign".into(),
|
||||
opening_id: selected.opening.id.clone(),
|
||||
role_id: "forged-role".into(),
|
||||
},
|
||||
std::slice::from_ref(&selected.opening),
|
||||
&selected.opening.id,
|
||||
std::slice::from_ref(&selected.role),
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn live_turn_cancels_background_inference_and_excludes_its_commit_gate() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
|
|
@ -2455,6 +2692,8 @@ mod tests {
|
|||
assessor: None,
|
||||
model: None,
|
||||
compile_previews: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
opening_suggestions: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
role_suggestions: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
expansion_previews: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
fission_previews: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
live_turns: Arc::new(AtomicUsize::new(0)),
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
web/dist/index.html
vendored
2
web/dist/index.html
vendored
|
|
@ -1,5 +1,5 @@
|
|||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>GhostlightDungeon</title> <script type="module" crossorigin src="/assets/index-CGgopXvh.js"></script>
|
||||
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>GhostlightDungeon</title> <script type="module" crossorigin src="/assets/index-B_0anyiQ.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-B7Qh0xAi.css">
|
||||
</head>
|
||||
<body><header><p class="eyebrow">STARFIRE / PRIVATE VERSE</p><h1>GhostlightDungeon</h1><p id="status" role="status" aria-live="polite">Reading the world…</p></header><main>
|
||||
|
|
|
|||
|
|
@ -252,8 +252,8 @@ document.querySelector<HTMLFormElement>("#suggest-form")!.addEventListener("subm
|
|||
event.preventDefault();
|
||||
const result = await compilerPost("/api/compiler/openings", { setting: document.querySelector<HTMLInputElement>("#setting")!.value, constraints: [] });
|
||||
showCards(result.openings, "Choose opening", async opening => {
|
||||
const roles = await compilerPost("/api/compiler/roles", opening);
|
||||
showCards(roles.roles, "Choose role", async role => showPreview(await compilerPost("/api/compiler/selected", { campaign_name: opening.title, opening, role })));
|
||||
const roles = await compilerPost("/api/compiler/roles", { opening_id: opening.id });
|
||||
showCards(roles.roles, "Choose role", async role => showPreview(await compilerPost("/api/compiler/selected", { campaign_name: opening.title, opening_id: opening.id, role_id: role.id })));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue