new RPG system

This commit is contained in:
2026-06-05 14:57:15 +03:00
parent 6189a5fb74
commit 01b16dbeaa
29 changed files with 2395 additions and 311 deletions
+2
View File
@@ -0,0 +1,2 @@
# generated module - copied to services/rpg_story.py by apply script
PLACEHOLDER = True
+2
View File
@@ -0,0 +1,2 @@
"""Apply linear story refactor — run once: python tools/apply_linear_story.py"""
print("placeholder")
+37
View File
@@ -0,0 +1,37 @@
from pathlib import Path
Path("../services/rpg_context.py").write_text('''"""Shared context blocks for RPG narrator / plot LLM calls."""
import json
from services.rpg_story import (
format_step_for_narrator,
normalize_story_arc,
step_progress,
)
def format_narrator_context(
arc: dict | None,
quests: list | None,
status_quo: str = "",
) -> str:
arc = normalize_story_arc(arc or {}) if arc else {}
return format_step_for_narrator(arc, quests, status_quo)
def format_arc_summary_for_runtime(arc: dict | None) -> str:
arc = normalize_story_arc(arc or {}) if arc else {}
if not arc:
return ""
cur, total = step_progress(arc)
return json.dumps(
{
"title": arc.get("title"),
"global_story": (arc.get("global_story") or "")[:300],
"step": f"{cur}/{total}",
"status": arc.get("status", "active"),
},
ensure_ascii=False,
)
''', encoding='utf-8')
print('done')