Skip to content

feat: P1+P2 backend completion — 37 REST endpoints - #156

Merged
ULookup merged 33 commits into
mainfrom
feat/p1-backend-completion
Jun 19, 2026
Merged

ULookup merged 33 commits into
mainfrom
feat/p1-backend-completion

Conversation

@ULookup

@ULookup ULookup commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

P1+P2 backend completion: 37 REST endpoints on top of P0.

P1 (18 endpoints)

Agent card/diary/relations CRUD, chapter export, scene/chapter PATCH, image upload, character appearances, Pipeline management, agent-driven previews, consistency checks, suggestions, scene generation, outline generation, rewrite

P2 (19 endpoints)

Pipeline retreat/clear-error, diary search/patch, memory summaries, voice fingerprint, relations upsert, world export/import, knowledge graph queries, timeline

Changes

  • libs/http/ — WorldbuildingHttpHandler: 37 new handlers
  • libs/worldbuilding/ — PipelineManager, WorldbuildingService, NarrativeStore: 5 new methods
  • docs/api-reference.md — full API reference, endpoint count 104 → 123

Test plan

  • Build: cmake --build build
  • World export/import ID remapping
  • Timeline forward-only validation
  • Pipeline retreat allowed_retreat validation

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 merged commit 6b617ac into main Jun 19, 2026
0 of 10 checks passed
@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