Bind expansion previews to canonical location

This commit is contained in:
Meta Vens 2026-08-18 21:20:40 +02:00
commit 5e198dfa87
8 changed files with 43 additions and 10 deletions

File diff suppressed because one or more lines are too long

4
web/dist/index.html vendored
View file

@ -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-Cdu4csne.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-DbDnq-RC.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>
@ -8,7 +8,7 @@
<form id="custom-form"><p class="form-heading">Or describe your own beginning</p><label for="campaign-name">Campaign name</label><input id="campaign-name" name="campaign_name" required><label for="custom-who">Who are you?</label><input id="custom-who" name="who" required><label for="custom-where">Where are you?</label><input id="custom-where" name="where_" required><label for="custom-when">When?</label><input id="custom-when" name="when" required><label for="custom-goal">What do you want?</label><textarea id="custom-goal" name="goal" required></textarea><button type="submit">Compile custom start</button></form>
</div><div id="compiler-results"></div></section><section id="surface"></section>
<form id="composer"><label for="attempt">What does your character do or say?</label><textarea id="attempt" name="attempt" required></textarea><label for="intended-effect">What outcome are they trying to cause?</label><input id="intended-effect" name="intended_effect" required><p class="quiet">Speech can happen even when persuasion, deception, or intimidation fails.</p><div><button type="submit">Assess</button><button type="button" id="wait">Wait one hour</button></div></form><section id="receipt" class="card" hidden aria-live="polite"></section>
<form id="destination-form"><p class="form-heading">Compile a destination without moving there</p><label for="destination-origin">Current location id</label><input id="destination-origin" name="origin_location_id" required><label for="destination-request">Where do you want the world to extend?</label><input id="destination-request" name="destination" required><button type="submit">Retrieve destination</button></form>
<form id="destination-form"><p class="form-heading">Compile a destination without moving there</p><label for="destination-origin">Current location id</label><input id="destination-origin" name="origin_location_id" readonly required><label for="destination-request">Where do you want the world to extend?</label><input id="destination-request" name="destination" required><button type="submit">Retrieve destination</button></form>
<section id="campaign-lab" hidden><h2>Campaign laboratory</h2><div id="campaign-list"></div>
<form id="resolution-form"><label for="active-cell-budget">Active Persona-cell budget: <output id="active-cell-budget-value">8</output></label><input id="active-cell-budget" name="active_cell_budget" type="range" min="1" max="32" value="8"><p id="resolution-status"></p><button type="submit">Apply at safe boundary</button></form>
<form id="pin-form"><label for="pin-kind">Resolution pin</label><select id="pin-kind" name="kind"><option value="minimum_individual_detail">Keep one subject individual</option><option value="keep_separate">Keep subjects separate</option><option value="keep_together">Keep subjects together</option></select><label for="pin-subjects">Exact subject IDs, comma separated</label><input id="pin-subjects" name="subject_ids" required><label for="pin-reason">Why preserve this cut?</label><input id="pin-reason" name="reason" required><button type="submit">Add pin</button><div id="pin-list"></div></form>

View file

@ -6,7 +6,7 @@
<form id="custom-form"><p class="form-heading">Or describe your own beginning</p><label for="campaign-name">Campaign name</label><input id="campaign-name" name="campaign_name" required><label for="custom-who">Who are you?</label><input id="custom-who" name="who" required><label for="custom-where">Where are you?</label><input id="custom-where" name="where_" required><label for="custom-when">When?</label><input id="custom-when" name="when" required><label for="custom-goal">What do you want?</label><textarea id="custom-goal" name="goal" required></textarea><button type="submit">Compile custom start</button></form>
</div><div id="compiler-results"></div></section><section id="surface"></section>
<form id="composer"><label for="attempt">What does your character do or say?</label><textarea id="attempt" name="attempt" required></textarea><label for="intended-effect">What outcome are they trying to cause?</label><input id="intended-effect" name="intended_effect" required><p class="quiet">Speech can happen even when persuasion, deception, or intimidation fails.</p><div><button type="submit">Assess</button><button type="button" id="wait">Wait one hour</button></div></form><section id="receipt" class="card" hidden aria-live="polite"></section>
<form id="destination-form"><p class="form-heading">Compile a destination without moving there</p><label for="destination-origin">Current location id</label><input id="destination-origin" name="origin_location_id" required><label for="destination-request">Where do you want the world to extend?</label><input id="destination-request" name="destination" required><button type="submit">Retrieve destination</button></form>
<form id="destination-form"><p class="form-heading">Compile a destination without moving there</p><label for="destination-origin">Current location id</label><input id="destination-origin" name="origin_location_id" readonly required><label for="destination-request">Where do you want the world to extend?</label><input id="destination-request" name="destination" required><button type="submit">Retrieve destination</button></form>
<section id="campaign-lab" hidden><h2>Campaign laboratory</h2><div id="campaign-list"></div>
<form id="resolution-form"><label for="active-cell-budget">Active Persona-cell budget: <output id="active-cell-budget-value">8</output></label><input id="active-cell-budget" name="active_cell_budget" type="range" min="1" max="32" value="8"><p id="resolution-status"></p><button type="submit">Apply at safe boundary</button></form>
<form id="pin-form"><label for="pin-kind">Resolution pin</label><select id="pin-kind" name="kind"><option value="minimum_individual_detail">Keep one subject individual</option><option value="keep_separate">Keep subjects separate</option><option value="keep_together">Keep subjects together</option></select><label for="pin-subjects">Exact subject IDs, comma separated</label><input id="pin-subjects" name="subject_ids" required><label for="pin-reason">Why preserve this cut?</label><input id="pin-reason" name="reason" required><button type="submit">Add pin</button><div id="pin-list"></div></form>

View file

@ -127,6 +127,9 @@ async function refresh() {
revision = Number(surface.world_revision ?? surface.version ?? 0);
playerActorId = String(surface.player_actor_id ?? "");
if (!playerActorId) throw new Error("Campaign surface omitted its canonical player actor ID.");
const playerLocationId = String(surface.player_location_id ?? "");
if (!playerLocationId) throw new Error("Campaign surface omitted its canonical player location ID.");
document.querySelector<HTMLInputElement>("#destination-origin")!.value = playerLocationId;
resolutionEpoch = Number(surface.resolution?.policy?.resolution_epoch ?? 0);
providerConfigurationEpoch = Number(surface.resolution?.policy?.provider_configuration_epoch ?? 0);
resolutionPins = surface.resolution?.pins ?? [];
@ -343,7 +346,26 @@ document.querySelector<HTMLFormElement>("#pin-form")!.addEventListener("submit",
};
await send({ type: "replace_resolution_pins", expected_revision: revision, expected_resolution_epoch: resolutionEpoch, pins: [...resolutionPins, pin] });
});
destinationForm.addEventListener("submit",async event=>{event.preventDefault();const result=await compilerPost("/api/compiler/destination",Object.fromEntries(new FormData(destinationForm)));const preview=result.preview;showSummary("Destination preview",[...(preview.locations ?? []).map((location:any)=>location.name),...(preview.gaps ?? []).map((gap:string)=>`Material gap: ${gap}`)]);status.textContent="Destination preview compiled; topology is unchanged until approval.";const button=node("button","Approve destination");button.type="button";button.addEventListener("click",async()=>{await compilerPost(`/api/compiler/destination/approve/${result.preview_id}`,{});button.remove();await refresh();});receipt.append(button);});
destinationForm.addEventListener("submit", async event => {
event.preventDefault();
const result = await compilerPost("/api/compiler/destination", Object.fromEntries(new FormData(destinationForm)));
const preview = result.preview;
showSummary("Destination preview", (preview.gaps ?? []).map((gap: string) => `Material gap: ${gap}`));
appendDetailList(receipt, `Compiled topology · ${preview.locations?.length ?? 0} locations`, (preview.locations ?? []).map((location: any) => {
const routes = Object.keys(location.routes ?? {});
const features = [...(location.persistent_features ?? [])];
return `${location.name} · ${location.id}${location.container_id ? ` · inside ${location.container_id}` : ""}${routes.length ? ` · routes to ${routes.join(", ")}` : " · no compiled route"}${features.length ? ` · ${features.join(", ")}` : ""}`;
}));
status.textContent = "Destination preview compiled; topology is unchanged until approval.";
const button = node("button", "Approve destination");
button.type = "button";
button.addEventListener("click", async () => {
await compilerPost(`/api/compiler/destination/approve/${result.preview_id}`, {});
button.remove();
await refresh();
});
receipt.append(button);
});
document.querySelector<HTMLFormElement>("#fission-form")!.addEventListener("submit", async event => {
event.preventDefault();
const data = new FormData(event.currentTarget as HTMLFormElement);
@ -354,9 +376,9 @@ document.querySelector<HTMLFormElement>("#fission-form")!.addEventListener("subm
reason: data.get("reason"),
});
showSummary("Population fission preview", [
...(result.preview?.children ?? []).map((child: any) => `${child.name} · ${child.id}`),
...(result.preview?.gaps ?? []).map((gap: string) => `Material gap: ${gap}`),
]);
appendDetailList(receipt, `Canonical child leaves · ${result.preview?.children?.length ?? 0}`, (result.preview?.children ?? []).map((child: any) => `${child.name} · ${child.id} · ${child.partition_value ?? "other/unknown"} · at ${child.home_location_id}`));
status.textContent = "Fission preview compiled. Canonical leaves are unchanged until approval.";
const button = document.createElement("button");
button.type = "button";