Route sessions through isolated campaign runtimes
This commit is contained in:
parent
c7c87bd6c2
commit
8defc96133
9 changed files with 807 additions and 337 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -40,6 +40,9 @@ impl CampaignRegistry {
|
|||
let mut found = BTreeMap::new();
|
||||
for entry in fs::read_dir(&self.root)? {
|
||||
let entry = entry?;
|
||||
let Ok(id) = Uuid::parse_str(&entry.file_name().to_string_lossy()) else {
|
||||
continue;
|
||||
};
|
||||
let path = entry.path().join("campaign.cc");
|
||||
if !path.is_file() {
|
||||
continue;
|
||||
|
|
@ -49,7 +52,9 @@ impl CampaignRegistry {
|
|||
if keys.len() != 1 {
|
||||
return Err(anyhow!("campaign store must contain exactly one campaign"));
|
||||
}
|
||||
let id = Uuid::parse_str(&keys[0])?;
|
||||
if keys[0] != id.to_string() {
|
||||
return Err(anyhow!("campaign directory and stored id disagree"));
|
||||
}
|
||||
found.insert(
|
||||
id,
|
||||
CampaignRuntime {
|
||||
|
|
|
|||
|
|
@ -516,6 +516,13 @@ branch from the campaign's approved seed/export rather than rewriting history
|
|||
in place. Export snapshots the selected `.cc` plus manifest and evidence
|
||||
receipts without granting the export path write authority over live state.
|
||||
|
||||
The service auth row stores only hashed session IDs, each session's owned
|
||||
campaign-ID set, and its selected campaign ID. Routes resolve that selection to
|
||||
the registry before loading state or dispatching commands. Preview ownership is
|
||||
also session-bound; a different authenticated tester receives `403` without
|
||||
consuming the owner's preview. The scheduler enumerates registry runtimes and
|
||||
submits ticks to each campaign's own mailbox.
|
||||
|
||||
### Vault provider and world compiler
|
||||
|
||||
`VaultProvider` exposes source search, surrounding context, exact documents,
|
||||
|
|
|
|||
|
|
@ -254,6 +254,6 @@ data_flow:
|
|||
- If state grows faster than understanding, cut it back.
|
||||
|
||||
current_status:
|
||||
summary: GhostlightDungeon is the active MVP program. The approval-gated world compiler now persists evidence, canon candidates, and bounded on-demand region expansion through the WorldKernel. Fiction-first assessments use model proposals with deterministic DC and state-reference validation. Away-time ticks move institutions and gate news by information access. Present NPCs appraise live events in parallel Persona waves, and the kernel atomically validates their private deltas and world-action proposals. Gestalt populations can materialize durable individuals and fold them back into persistent member deltas. Live DeepSeek plus VoidBot compilation and disposable authenticated HTTP restart smokes have passed. The broader hosted MVP remains incomplete.
|
||||
next_action: Replace the daemon's process-global default store/kernel with the tested CampaignRegistry and persisted session-to-campaign selection, then expose fork/reset/CultCache export and operator controls; acceptance-test cross-session isolation before calling campaign management complete.
|
||||
summary: GhostlightDungeon is the active MVP program. The approval-gated compiler persists evidence, canon candidates, and bounded region expansion. Fiction-first player and NPC attempts use deterministic initiative, model assessment, server-side d20, and prevalidated typed outcome deltas. Present NPCs appraise events in parallel; gestalt populations materialize durable individuals and fold them into member deltas. Narration is a revision-bound noncanonical projection. A CampaignRegistry now isolates per-campaign stores/mailboxes, persists hashed session ownership and selection, routes scheduler and HTTP work through the selected runtime, and supports fork/reset/select/CultCache export. Live DeepSeek plus VoidBot compilation and an earlier authenticated HTTP restart smoke passed; the expanded multi-campaign runtime still needs live acceptance.
|
||||
next_action: Add operator inspection and live-inference priority gating, then run two-session HTTP, model-failure, restart, scheduler, live gestalt, typed-outcome, performance, and deployment acceptance against the registry runtime.
|
||||
gestalt_population: Gestalt Personas own shared population baselines; persistent member deltas own named individuality; WorldKernel materialization commands compose and demote active actors without deleting member identity.
|
||||
|
|
|
|||
153
web/dist/assets/index-BkVLQG59.js
vendored
153
web/dist/assets/index-BkVLQG59.js
vendored
File diff suppressed because one or more lines are too long
153
web/dist/assets/index-CSZpdeJl.js
vendored
Normal file
153
web/dist/assets/index-CSZpdeJl.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
web/dist/index.html
vendored
3
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-BkVLQG59.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-CSZpdeJl.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Dt7lvyL0.css">
|
||||
</head>
|
||||
<body><header><p class="eyebrow">STARFIRE / PRIVATE VERSE</p><h1>GhostlightDungeon</h1><p id="status">Reading the world…</p></header><main>
|
||||
|
|
@ -9,4 +9,5 @@
|
|||
</div><div id="compiler-results"></div></section><section id="surface"></section>
|
||||
<form id="composer"><label for="attempt">Describe what you attempt</label><textarea id="attempt" required></textarea><div><button type="submit">Assess</button><button type="button" id="wait">Wait one hour</button></div></form><pre id="receipt" hidden></pre>
|
||||
<form id="destination-form"><label>Compile a destination without moving there</label><input name="origin_location_id" placeholder="Current location id" required><input name="destination" placeholder="Where do you want the world to extend?" required><button type="submit">Retrieve destination</button></form>
|
||||
<section id="campaign-lab" hidden><h2>Campaign laboratory</h2><div id="campaign-list"></div><form id="fork-form"><input name="name" placeholder="Fork name" required><button type="submit">Fork selected campaign</button></form><form id="reset-form"><input name="name" placeholder="Reset branch name" required><button type="submit">Reset from approved seed</button></form><a href="/api/campaigns/export" download>Export selected CultCache .cc</a></section>
|
||||
</main></body></html>
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
</div><div id="compiler-results"></div></section><section id="surface"></section>
|
||||
<form id="composer"><label for="attempt">Describe what you attempt</label><textarea id="attempt" required></textarea><div><button type="submit">Assess</button><button type="button" id="wait">Wait one hour</button></div></form><pre id="receipt" hidden></pre>
|
||||
<form id="destination-form"><label>Compile a destination without moving there</label><input name="origin_location_id" placeholder="Current location id" required><input name="destination" placeholder="Where do you want the world to extend?" required><button type="submit">Retrieve destination</button></form>
|
||||
<section id="campaign-lab" hidden><h2>Campaign laboratory</h2><div id="campaign-list"></div><form id="fork-form"><input name="name" placeholder="Fork name" required><button type="submit">Fork selected campaign</button></form><form id="reset-form"><input name="name" placeholder="Reset branch name" required><button type="submit">Reset from approved seed</button></form><a href="/api/campaigns/export" download>Export selected CultCache .cc</a></section>
|
||||
</main><script type="module" src="/src/main.ts"></script></body></html>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ const compiler = document.querySelector<HTMLElement>("#compiler")!;
|
|||
const composer = document.querySelector<HTMLFormElement>("#composer")!;
|
||||
const destinationForm = document.querySelector<HTMLFormElement>("#destination-form")!;
|
||||
const compilerResults = document.querySelector<HTMLElement>("#compiler-results")!;
|
||||
const campaignLab = document.querySelector<HTMLElement>("#campaign-lab")!;
|
||||
const campaignList = document.querySelector<HTMLElement>("#campaign-list")!;
|
||||
let revision = 0;
|
||||
|
||||
async function refresh() {
|
||||
|
|
@ -16,10 +18,13 @@ async function refresh() {
|
|||
if (response.status === 401) { status.textContent = "This laboratory requires an unused invite link."; return; }
|
||||
const surface = await response.json();
|
||||
const needsCompilation = surface.surface_id === "ghostlight.compiler";
|
||||
compiler.hidden = !needsCompilation; composer.hidden = needsCompilation; destinationForm.hidden = needsCompilation; host.hidden = needsCompilation;
|
||||
compiler.hidden = !needsCompilation; composer.hidden = needsCompilation; destinationForm.hidden = needsCompilation; host.hidden = needsCompilation; campaignLab.hidden = needsCompilation;
|
||||
if (needsCompilation) { status.textContent = "No campaign exists. Retrieve the Vault and approve a world seed."; return; }
|
||||
revision = Number(surface.version ?? 0);
|
||||
renderEveSurface(surface, host, { body: document.body, clientId: "ghostlight.browser", statusElement: status });
|
||||
const campaigns = await fetch("/api/campaigns").then(response => response.json());
|
||||
campaignList.innerHTML = campaigns.campaigns.map((item: any) => `<button data-campaign-id="${item.id}" ${item.selected ? "disabled" : ""}>${item.selected ? "●" : "○"} ${item.name} · revision ${item.revision}</button>`).join("");
|
||||
campaignList.querySelectorAll<HTMLButtonElement>("button:not(:disabled)").forEach(button=>button.addEventListener("click",async()=>{await compilerPost(`/api/campaigns/select/${button.dataset.campaignId}`,{});await refresh();}));
|
||||
}
|
||||
|
||||
async function compilerPost(path: string, body: unknown) {
|
||||
|
|
@ -57,4 +62,6 @@ async function send(command: unknown) { status.textContent = "The world is consi
|
|||
composer.addEventListener("submit", async event => { event.preventDefault(); const text = document.querySelector<HTMLTextAreaElement>("#attempt")!.value.trim(); if (!text) return; const result=await send({ type: "assess", expected_revision: revision, intent: { actor_id: "player", description: text, intended_effect: text } }); if(result?.kind==="assessed"){const button=document.createElement("button");button.textContent=result.assessment.admissible?"Confirm server roll":"Revise attempt";button.addEventListener("click",async()=>{if(result.assessment.admissible){await send({type:"attempt",assessment_digest:result.assessment.digest});button.remove();}else{document.querySelector<HTMLTextAreaElement>("#attempt")!.focus();}});composer.append(button);} });
|
||||
document.querySelector<HTMLButtonElement>("#wait")!.addEventListener("click", () => void send({ type: "wait", expected_revision: revision, minutes: 60 }));
|
||||
destinationForm.addEventListener("submit",async event=>{event.preventDefault();const result=await compilerPost("/api/compiler/destination",Object.fromEntries(new FormData(destinationForm)));const preview=result.preview;receipt.hidden=false;receipt.textContent=JSON.stringify(preview,null,2);status.textContent="Destination preview compiled; topology is unchanged until approval.";const button=document.createElement("button");button.textContent="Approve destination";button.addEventListener("click",async()=>{await compilerPost(`/api/compiler/destination/approve/${result.preview_id}`,{});button.remove();await refresh();});destinationForm.append(button);});
|
||||
document.querySelector<HTMLFormElement>("#fork-form")!.addEventListener("submit",async event=>{event.preventDefault();await compilerPost("/api/campaigns/fork",Object.fromEntries(new FormData(event.currentTarget as HTMLFormElement)));await refresh();});
|
||||
document.querySelector<HTMLFormElement>("#reset-form")!.addEventListener("submit",async event=>{event.preventDefault();await compilerPost("/api/campaigns/reset",Object.fromEntries(new FormData(event.currentTarget as HTMLFormElement)));await refresh();});
|
||||
void refresh();
|
||||
|
|
|
|||
Loading…
Reference in a new issue