Skip to content

feat: P0+P1+P2 backend completion — 67 REST endpoints - #154

Closed
ULookup wants to merge 33 commits into
mainfrom
feat/p1-backend-completion
Closed

ULookup wants to merge 33 commits into
mainfrom
feat/p1-backend-completion

Conversation

@ULookup

@ULookup ULookup commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • P0: Dashboard, CRUD, agent-driven previews, consistency checks, suggestions, scene generation, outline generation, rewrite(30 endpoints)
  • P1: Agent card/diary/relations CRUD, chapter export, scene/chapter PATCH, image upload, character appearances, Pipeline management(18 endpoints)
  • P2: Pipeline retreat/clear-error, diary search/patch, memory summaries, voice fingerprint, relations upsert, world export/import, knowledge graph queries, timeline(19 endpoints)

Changes

  • libs/http/ — WorldbuildingHttpHandler: 19 new handlers
  • libs/worldbuilding/ — PipelineManager (+retreat_to_phase), WorldbuildingService (+export/import), NarrativeStore (+timeline queries)
  • docs/api-reference.md — full API reference for all 67 endpoints

Test plan

  • Build passes: cmake --build build
  • Pipeline retreat validates allowed_retreat and cleans active_scene_id
  • World export produces valid share-snapshot-v1 JSON
  • World import remaps all cross-reference IDs correctly
  • KG entity list/search filtered by type
  • Timeline advance enforces forward-only progression

ULookup added 30 commits June 19, 2026 06:37
- Add std::mutex to protect pending_agent_runs_ from concurrent access
  across HTTP threads, eliminating data race in start_agent_run and
  capture_agent_result.
- In capture_agent_result, always erase the map entry regardless of run
  completion status, preventing unbounded memory growth from abandoned runs.
Add POST /api/worldbuilding/:wid/scenes/:sid/rewrite to start an
agent-driven rewrite, and GET .../:sid/rewrite-result to retrieve it.
Adds a background poller thread that monitors pending agent runs and
calls capture_agent_result when a run reaches Completed state.
Terminal states (Failed, Cancelled, Interrupted) are cleaned up
without capturing. The poller wakes immediately when a new run
is started via start_agent_run, then falls back to a 2-second
interval when idle.
19 endpoints across 5 modules: Pipeline control, Diary/Memory/Relation
APIs, World import/export, Knowledge Graph queries, Timeline API.
All synchronous CRUD, no async agent-driven flows.
- Wrap state fields under "state" key, add "ok": true at top level
- Validate to_phase against creative_phase_from_string before retreating
- Include recent_history in retreat response matching pipeline/state handler
Implements POST /api/worldbuilding/import to import a snapshot JSON exported
by the export-full endpoint. Remaps all IDs to new IDs via make_id() and
creates all entities in dependency order:

- World, locations (two-pass parent fixup), agents (individuals, managers,
  groups), relations, arcs, chapters, scenes, diaries, memory summaries,
  factions (two-pass rival fixup), knowledge, foreshadowing (two-pass
  cross-refs), secrets, timeline events
- Stores import metadata in world config
- Imports inline base64 images (up to 256KB) via image_service_
- Adds base64_decode to ids.hpp for inline image decoding
- Returns world_id, full id_mapping, and images_imported count
ULookup added 3 commits June 19, 2026 11:38
Add list_timeline_events and get_timeline_event to NarrativeStore,
plus three HTTP endpoints: timeline list, timeline event get, and
timeline advance (using time_label field).
@ULookup ULookup closed this Jun 19, 2026
@ULookup
ULookup deleted the feat/p1-backend-completion branch June 19, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant