DSH integration
Each roleplay session maps to a real DSH session named session-<roleplay UUID>. All roleplay chats share one DSH workspace rooted at the roleplay directory, while the roleplay session folder is resolved through its UUID.
The opening message is persisted as a complete first turn before the DSH controller adopts the session. Appending it after constructing the live agent would leave the loop's cached last-turn state inconsistent.
Most integration uses public Cordis and DSH services: workspace registry, session controller, persistence, tools, slots, configuration forms, attachments and language models.
Character and record-keeper children use DSH's composition helpers below the public sub-agent API. This is deliberate: simultaneous characters need different private tools and results under the same tool names. Contract tests pin the required helper surface to DSH 0.2.x.
Before upgrading DSH:
- run the DSH contract tests;
- verify child creation and scoped tools;
- start and reopen a roleplay session;
- confirm the authored opening remains turn 1;
- test take-back, branching and chat retirement;
- verify browser slots and the shared world editor.
How the browser learns that the story changed
The transcript follows DSH's conversation events. Everything else on screen — strips, the interface tab, suggestions, the journal — shows story state from the session's SQLite database, which a DSH session projection cannot carry: a projection folds the session log, and the story is not in the log.
So the browser reads those values over /roleplay-api and looks again:
- when it has a reason to: a turn starting or ending (
useSession(state => state.running)in the input dock, on the pack's own tab and on its page in the right sidebar), or the tab that shows the value being opened; - on a timer while the value is on screen and the page is visible (
pageVisible()insrc/client/visibility.ts); - never while the tab is in the background: a hidden page skips the request, and a poll built as a timeout chain keeps its attempt for when the player comes back;
- at once when the page comes back into view: the values that would have polled in the background look again through
onPageVisible(), so a tab left in the background does not make the player wait for the next tick.
Current intervals: interface pack 10 s, player view 5 s, suggestions 2 s only until the first answer arrives (30 s for messages the characters send on their own), reflection 4 s, sync 2 s, playtest 2 s, a gallery with pictures still being described 3 s, reference pages 8 s, a scene image still generating 1.5 s. They are bounds on waiting, not a replacement for the turn signal: a change of turn looks again at once.