[PR #1025] [MERGED] feat(gacha-forge): 1.8.5 — an optional opening story, a saved wizard … #1256

Closed
opened 2026-10-21 05:06:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1025
Author: @SonaGat3
Created: 9/21/2026
Status: ✅ Merged
Merged: 9/22/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feature/gacha-forge-1.8.5


📝 Commits (2)

  • 4fcdae5 feat(gacha-forge): 1.8.5 — an optional opening story, a saved wizard with presets, and room for models that think
  • cd42500 Merge branch 'staging' into feature/gacha-forge-1.8.5

📊 Changes

12 files changed (+408 additions, -345 deletions)

View changed files

➕ artifacts/gacha-forge-1.8.5.zip (+0 -0)
📝 catalog/catalog.json (+8 -8)
📝 catalog/notes.json (+6 -0)
📝 catalog/v2/catalog.json (+8 -8)
📝 catalog/v2/notes.json (+6 -0)
📝 catalog/v3/catalog.json (+8 -8)
📝 catalog/v3/notes.json (+6 -0)
📝 packages/gacha-forge/CHANGELOG.md (+7 -0)
📝 packages/gacha-forge/README.md (+2 -0)
📝 packages/gacha-forge/client.js (+248 -215)
📝 packages/gacha-forge/manifest.json (+5 -5)
📝 packages/gacha-forge/server.mjs (+104 -101)

📄 Description

Linked issue

Closes #1023

Why this change

staging carries Gacha Forge 1.8.2. This is what players ran into creating worlds, plus one player's
ledger that explains why a reasoning model "fails constantly".

A world that cannot write its first chapter cannot exist. Creating a world ended on the opening story:
more than half of the wait and the heaviest calls of the creation (measured: 20k tokens in for the plan,
13.6k for the first scene). When that forge failed, the ways out were Retry and deleting the world.

A reasoning model lost the first try of nearly every call. GLM 5.3, 149 calls: 82% of what came back
was reasoning; 12 of 15 scenes and 3 of 3 chapter plans were cut at exactly their cap (text + a fixed
6,000) with no answer; every doubled retry landed under 9.6k. A cap saves nothing — tokens are paid as
written — and a call cut short is paid in full for nothing.

What you type in world creation was lost on a reload, on leaving, on Cancel, and when a creation
failed or was cancelled.

What changed

  • The opening story is optional (run.storyDeferred). One prologueOwed() answers the four readers
    (/state, the locks, the gift, /story/start); a postponed world owes no prologue, so Summon, its gift
    and the guides open on the first Home. "Forge this world" asks are you sure? and then now or later, in
    a two-page pop-up drawn in place over the wizard (a repaint would empty its seven steps). A world whose
    story waits forges nothing by itself: the state machine, Modes > Story, _openChapter and the plan that
    creation fired behind the art all ask first. Modes > Story answers with a question; Write it now forges
    chapter one and opens its first scene through /story/start, which answers spent: 0, opening: true
    for that one node. POST /story/defer is the third way out of a failed opening forge (the plan or the
    first scene). The Summon gift of a postponed world is named "Starting reward": it completed no prologue.
  • The wizard, saved (setup-store.js, one package-wide document, declared in NON_RUN_KINDS so
    deleting a world cannot take it). The draft and every preset are the wizard's own snapshot(),
    whitelisted and byte-capped (200 KB) by one function. The draft is read once per visit and mounted from;
    nothing is saved until that read settles, and a player already typing is never overwritten. /run stamps
    it with the world it became: held while that world is being created, back if it is cancelled, spent once
    the founding cast stands and no prologue is owed. Presets: up to 30, unique names, save / overwrite /
    rename / delete; load prunes what the Engine no longer has (connection, persona, lorebooks, cards,
    themes) and counts it, and a list that could not be read prunes nothing. "Save as preset" on a world is
    built in the client by the schema (snapshotFromRun) and kept through the same route.
  • Room to think (REASONING_HEADROOM 6,000 → 16,000, learnedHeadroom, capWithinContext). The
    headroom is learned per connection from the ledger's own rows — half as much again for a call that
    finished thinking, double for one cut off still thinking, never over 64,000 — seeded from the stored
    ledger once per process. The Engine takes maxTokens out of the connection's context window and trims
    the prompt to fit, so on a small window the headroom gives way first, never below text + 6,000; the window
    comes from the /api/connections read that already fetched the player's parameters. The first budget
    cut of a generation spends no attempt, the cap grows from where it is, and the ledger records ms and
    cap.
  • The Engine's lists re-read (watchEngine in api.js): away is a press outside the game, a hidden tab
    or a blurred window; back is the pointer or focus entering the game, the tab showing, the window
    focusing; after a touch outside it re-reads once the outside goes quiet. The six loads (cards, lorebooks,
    connections, image options, personas; connections and image options in Settings) repaint on change
    only, keep what was chosen and never trade a good list for an error. The watch is anchored to a node of
    its paint and ends itself when repainted.
  • World lore keys see who is being minted (loreSubject, subjects on buildRunLore): the card's name
    and text, the Cast-book sheet the call just drew (the Cast book is drawn first now), the persona, and the
    five-stars of a signature weapon. The haystack is matched and never sent: it costs no tokens, and what
    it wakes still fits the World budget.

Generated outputs

packages/gacha-forge/client.js, server.mjs, manifest.json, the artifact zip, the catalog family and
the release-notes sidecars were re-derived by node scripts/build-gacha-forge-package.mjs from the
committed payload bytes. Nothing was hand-edited; re-running the builder after the commit leaves the tree
clean.

Package and security impact

  • capabilityApi, the engine range, permissions, contribution slots, assets, builtAgainst and
    restartRequired are unchanged.
    The only manifest field that moved is version, verified by diffing
    against the staging manifest with the hash lines filtered out.
  • Routes: 113 → 121. Added: GET/POST /setup/draft, POST /setup/draft/clear, GET /setup/presets,
    POST /setup/preset/save | delete | load, POST /story/defer. None removed.
  • No new external services. The new reads are the Engine asking itself over loopback
    (/api/connections, /api/characters/personas/list, /api/characters/catalog, /api/lorebooks), each
    with a 2 s ceiling, and only when a preset is loaded.
  • Stored input is treated as untrusted: a snapshot is plain JSON, its known keys only, under a byte
    cap; a preset's name is one line, trimmed and capped at 60; every row of the presets pop-up is escaped
    (the probe feeds it <img onerror> and <script>).
  • Payload: client.js 1,412,419 → 1,433,495 bytes, server.mjs 483,868 → 492,116, artifact
    7,796,444 → 7,825,768. No art changes (245 of 247 payload files are byte-identical).

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

⚠️ Why the fourth box is unticked. 1.8.5 is not published, so it cannot be installed through the
Engine's download path. The same bytes were installed by sideload into a staging Engine: the Engine
pings 1.8.5, the new routes answer, and a world was created from a preset with its story postponed.

Manual verification notes

  • Branch hygiene. Branched from the current origin/staging (d64cac96); git ls-files --eol | grep -c w/crlf → 0; git diff --check "origin/staging...HEAD" clean; the build is reproducible.
  • Repo checks run locally, in the workflow's own order — the script is generated from
    pull-request-checks.yml at origin/staging, so its 24 steps cannot go stale: 23 of 24 green -- npm ci, npm run check (0 errors), typecheck:packages, the Calls, Memory Nag, Pixelforge and Beholder regressions (Beholder parity 239/239), vendored-engine, test-catalog-lanes, the locale validators, validate-catalog (v2=38, v3=38), catalog-generatedat-determinism, catalog-release-notes, ruleset-package, the World Maps and Long-Term Memory UI contracts, validate-pr-triage, test-owner-approval, git diff --check. ⚠️ npm run test:security fails on Windows for a reason unrelated to this change (catalog-path-safety.regression.mjs expects a POSIX path and gets D:\tmp\package\assets\icon.png); its log never names gacha-forge, and it failed identically on a clean staging checkout for the 1.8.2 PR.
  • Package's own suite: eleven probes plus a 132-script bench compared run to run, all green. Every
    change carries a check verified failing against the previous code.
  • Measured in a real browser (the built client over a scripted server): the wizard's lists re-read on
    the way back and keep what was chosen; the two pages of Forge's question; Modes > Story's question; the
    three ways out of a failed opening forge; the draft coming back on its step; the presets pop-up, a taken
    name, a loaded preset saying what it left out; "Save as preset" on a world.
  • The headroom rule replayed on the player's real ledger: after the first cut, scenes leave with
    24,288 on their first attempt and chapter plans with 22,692.

Documentation impact

  • Updated this README catalog and package guidance
  • No documentation changes needed
  • Updated linked Marinara Engine documentation

packages/gacha-forge/README.md gains the 1.8.5 paragraph; packages/gacha-forge/CHANGELOG.md gains
1.8.5. The repository README is unchanged.

UI evidence (if applicable)

59-3-borrar 59-4-nombre-repetido 59-5-cargado 59-6-desde-un-mundo 58-1-asistente 58-1b-seguro 58-1c-ahora-o-despues 58-2-pregunta 58-3-forja-fallo 59-1-borrador 59-2-presets

Summary by CodeRabbit

  • New Features

    • Opening stories are now optional, with confirmation and write-later choices.
    • World creation preserves drafts across devices and supports reusable setup presets.
    • Reasoning models receive improved, context-aware output budgets.
  • Bug Fixes

    • Marinara-created cards, lorebooks, connections, and personas now appear in-game immediately.
    • Characters derived from cards or Cast lorebook entries can access relevant World lore.
  • Documentation

    • Added release notes for Gacha Forge version 1.8.5.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/1025 **Author:** [@SonaGat3](https://github.com/SonaGat3) **Created:** 9/21/2026 **Status:** ✅ Merged **Merged:** 9/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feature/gacha-forge-1.8.5` --- ### 📝 Commits (2) - [`4fcdae5`](https://github.com/Pasta-Devs/Marinara-Agents/commit/4fcdae5658f766f6dd2686750c2a4f917cd26391) feat(gacha-forge): 1.8.5 — an optional opening story, a saved wizard with presets, and room for models that think - [`cd42500`](https://github.com/Pasta-Devs/Marinara-Agents/commit/cd425009ad85c778e83160c65c425c85c836e451) Merge branch 'staging' into feature/gacha-forge-1.8.5 ### 📊 Changes **12 files changed** (+408 additions, -345 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/gacha-forge-1.8.5.zip` (+0 -0) 📝 `catalog/catalog.json` (+8 -8) 📝 `catalog/notes.json` (+6 -0) 📝 `catalog/v2/catalog.json` (+8 -8) 📝 `catalog/v2/notes.json` (+6 -0) 📝 `catalog/v3/catalog.json` (+8 -8) 📝 `catalog/v3/notes.json` (+6 -0) 📝 `packages/gacha-forge/CHANGELOG.md` (+7 -0) 📝 `packages/gacha-forge/README.md` (+2 -0) 📝 `packages/gacha-forge/client.js` (+248 -215) 📝 `packages/gacha-forge/manifest.json` (+5 -5) 📝 `packages/gacha-forge/server.mjs` (+104 -101) </details> ### 📄 Description ## Linked issue Closes #1023 ## Why this change `staging` carries Gacha Forge **1.8.2**. This is what players ran into creating worlds, plus one player's ledger that explains why a reasoning model "fails constantly". **A world that cannot write its first chapter cannot exist.** Creating a world ended on the opening story: more than half of the wait and the heaviest calls of the creation (measured: 20k tokens in for the plan, 13.6k for the first scene). When that forge failed, the ways out were Retry and deleting the world. **A reasoning model lost the first try of nearly every call.** GLM 5.3, 149 calls: 82% of what came back was reasoning; 12 of 15 scenes and 3 of 3 chapter plans were cut at **exactly** their cap (text + a fixed 6,000) with no answer; every doubled retry landed under 9.6k. A cap saves nothing — tokens are paid as written — and a call cut short is paid in full for nothing. **What you type in world creation was lost** on a reload, on leaving, on Cancel, and when a creation failed or was cancelled. ## What changed - **The opening story is optional** (`run.storyDeferred`). One `prologueOwed()` answers the four readers (`/state`, the locks, the gift, `/story/start`); a postponed world owes no prologue, so Summon, its gift and the guides open on the first Home. "Forge this world" asks *are you sure?* and then *now or later*, in a two-page pop-up drawn in place over the wizard (a repaint would empty its seven steps). A world whose story waits forges nothing by itself: the state machine, Modes > Story, `_openChapter` and the plan that creation fired behind the art all ask first. Modes > Story answers with a question; *Write it now* forges chapter one and opens its first scene through `/story/start`, which answers `spent: 0, opening: true` for that one node. `POST /story/defer` is the third way out of a failed opening forge (the plan or the first scene). The Summon gift of a postponed world is named "Starting reward": it completed no prologue. - **The wizard, saved** (`setup-store.js`, one package-wide document, declared in `NON_RUN_KINDS` so deleting a world cannot take it). The draft and every preset are the wizard's own `snapshot()`, whitelisted and byte-capped (200 KB) by one function. The draft is read once per visit and mounted from; nothing is saved until that read settles, and a player already typing is never overwritten. `/run` stamps it with the world it became: held while that world is being created, back if it is cancelled, spent once the founding cast stands and no prologue is owed. Presets: up to 30, unique names, save / overwrite / rename / delete; **load prunes what the Engine no longer has** (connection, persona, lorebooks, cards, themes) and counts it, and a list that could not be read prunes nothing. "Save as preset" on a world is built in the client by the schema (`snapshotFromRun`) and kept through the same route. - **Room to think** (`REASONING_HEADROOM` 6,000 → 16,000, `learnedHeadroom`, `capWithinContext`). The headroom is learned per connection from the ledger's own rows — half as much again for a call that finished thinking, double for one cut off still thinking, never over 64,000 — seeded from the stored ledger once per process. The Engine takes `maxTokens` out of the connection's context window and trims the prompt to fit, so on a small window the headroom gives way first, never below text + 6,000; the window comes from the `/api/connections` read that already fetched the player's parameters. The first budget cut of a generation spends no attempt, the cap grows from where it is, and the ledger records `ms` and `cap`. - **The Engine's lists re-read** (`watchEngine` in `api.js`): away is a press outside the game, a hidden tab or a blurred window; back is the pointer or focus entering the game, the tab showing, the window focusing; after a touch outside it re-reads once the outside goes quiet. The six loads (cards, lorebooks, connections, image options, personas; connections and image options in Settings) repaint on change only, keep what was chosen and never trade a good list for an error. The watch is anchored to a node of its paint and ends itself when repainted. - **World lore keys see who is being minted** (`loreSubject`, `subjects` on `buildRunLore`): the card's name and text, the Cast-book sheet the call just drew (the Cast book is drawn first now), the persona, and the five-stars of a signature weapon. The haystack is matched and never sent: it costs no tokens, and what it wakes still fits the World budget. ### Generated outputs `packages/gacha-forge/client.js`, `server.mjs`, `manifest.json`, the artifact zip, the catalog family and the release-notes sidecars were **re-derived** by `node scripts/build-gacha-forge-package.mjs` from the committed payload bytes. Nothing was hand-edited; re-running the builder after the commit leaves the tree clean. ## Package and security impact - **`capabilityApi`, the `engine` range, permissions, contribution slots, assets, `builtAgainst` and `restartRequired` are unchanged.** The only manifest field that moved is `version`, verified by diffing against the `staging` manifest with the hash lines filtered out. - **Routes: 113 → 121.** Added: `GET/POST /setup/draft`, `POST /setup/draft/clear`, `GET /setup/presets`, `POST /setup/preset/save | delete | load`, `POST /story/defer`. None removed. - **No new external services.** The new reads are the Engine asking itself over loopback (`/api/connections`, `/api/characters/personas/list`, `/api/characters/catalog`, `/api/lorebooks`), each with a 2 s ceiling, and only when a preset is loaded. - **Stored input is treated as untrusted**: a snapshot is plain JSON, its known keys only, under a byte cap; a preset's name is one line, trimmed and capped at 60; every row of the presets pop-up is escaped (the probe feeds it `<img onerror>` and `<script>`). - **Payload:** `client.js` 1,412,419 → 1,433,495 bytes, `server.mjs` 483,868 → 492,116, artifact 7,796,444 → 7,825,768. No art changes (245 of 247 payload files are byte-identical). ## Validation - [x] `node scripts/validate-catalog.mjs` passes locally - [x] `git diff --check` passes locally - [x] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [x] Checked supported modes, restart behavior, and uninstall cleanup - [x] Read and followed `CONTRIBUTING.md` > ⚠️ **Why the fourth box is unticked.** 1.8.5 is not published, so it cannot be installed *through* the > Engine's download path. The same bytes were installed by sideload into a `staging` Engine: the Engine > pings 1.8.5, the new routes answer, and a world was created from a preset with its story postponed. ### Manual verification notes - **Branch hygiene.** Branched from the current `origin/staging` (`d64cac96`); `git ls-files --eol | grep -c w/crlf` → **0**; `git diff --check "origin/staging...HEAD"` clean; the build is reproducible. - **Repo checks run locally, in the workflow's own order** — the script is generated from `pull-request-checks.yml` at `origin/staging`, so its 24 steps cannot go stale: **23 of 24 green** -- `npm ci`, `npm run check` (0 errors), `typecheck:packages`, the Calls, Memory Nag, Pixelforge and Beholder regressions (Beholder parity 239/239), `vendored-engine`, `test-catalog-lanes`, the locale validators, `validate-catalog` (v2=38, v3=38), `catalog-generatedat-determinism`, `catalog-release-notes`, `ruleset-package`, the World Maps and Long-Term Memory UI contracts, `validate-pr-triage`, `test-owner-approval`, `git diff --check`. ⚠️ `npm run test:security` fails on Windows for a reason unrelated to this change (`catalog-path-safety.regression.mjs` expects a POSIX path and gets `D:\tmp\package\assets\icon.png`); its log never names gacha-forge, and it failed identically on a clean `staging` checkout for the 1.8.2 PR. - **Package's own suite:** eleven probes plus a 132-script bench compared run to run, all green. Every change carries a check verified failing against the previous code. - **Measured in a real browser** (the built client over a scripted server): the wizard's lists re-read on the way back and keep what was chosen; the two pages of Forge's question; Modes > Story's question; the three ways out of a failed opening forge; the draft coming back on its step; the presets pop-up, a taken name, a loaded preset saying what it left out; "Save as preset" on a world. - **The headroom rule replayed on the player's real ledger:** after the first cut, scenes leave with 24,288 on their first attempt and chapter plans with 22,692. ## Documentation impact - [x] Updated this README catalog and package guidance - [ ] No documentation changes needed - [ ] Updated linked Marinara Engine documentation `packages/gacha-forge/README.md` gains the 1.8.5 paragraph; `packages/gacha-forge/CHANGELOG.md` gains 1.8.5. The repository README is unchanged. ## UI evidence (if applicable) <img width="1440" height="900" alt="59-3-borrar" src="https://github.com/user-attachments/assets/d250a9f3-80c0-46b2-84a5-66f44dec766c" /> <img width="1440" height="900" alt="59-4-nombre-repetido" src="https://github.com/user-attachments/assets/06c93911-289f-4b09-8931-afd2bc587cf8" /> <img width="1440" height="900" alt="59-5-cargado" src="https://github.com/user-attachments/assets/5d551732-9236-403c-84d0-787fe91673b2" /> <img width="1440" height="900" alt="59-6-desde-un-mundo" src="https://github.com/user-attachments/assets/6e62e6eb-4853-435d-b36f-bf0ec853397b" /> <img width="1440" height="900" alt="58-1-asistente" src="https://github.com/user-attachments/assets/720eaf6b-9914-46bd-bc53-4d9d679b424b" /> <img width="1440" height="900" alt="58-1b-seguro" src="https://github.com/user-attachments/assets/88df2b58-183b-4a88-90de-38f35ee515c1" /> <img width="1440" height="900" alt="58-1c-ahora-o-despues" src="https://github.com/user-attachments/assets/f7e924a2-155c-48c1-827e-d6b64cb72299" /> <img width="1440" height="900" alt="58-2-pregunta" src="https://github.com/user-attachments/assets/bf9bd0c0-1374-40dd-be20-e9d81f965992" /> <img width="1440" height="900" alt="58-3-forja-fallo" src="https://github.com/user-attachments/assets/2ea8a780-e193-4ed1-8488-ba6a540b7e06" /> <img width="1440" height="900" alt="59-1-borrador" src="https://github.com/user-attachments/assets/64037367-6513-4f9d-91ff-af9a42d7e46c" /> <img width="1440" height="900" alt="59-2-presets" src="https://github.com/user-attachments/assets/45f19343-136d-4d72-bf05-fc21beed0918" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Opening stories are now optional, with confirmation and write-later choices. - World creation preserves drafts across devices and supports reusable setup presets. - Reasoning models receive improved, context-aware output budgets. - **Bug Fixes** - Marinara-created cards, lorebooks, connections, and personas now appear in-game immediately. - Characters derived from cards or Cast lorebook entries can access relevant World lore. - **Documentation** - Added release notes for Gacha Forge version 1.8.5. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-21 05:06:55 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#1256
No description provided.