# Architecture The repository follows the DeepSeek Harness extension model: behavior is contributed by plugins and durable UI state is reconstructed from the session log. ## Package roles The root `dsh-client-ui-session-rerun` package is the installable bundle. Its `cordis.patch.yml` inserts the Host Remote and Web Client rows. The package registers a conversation view, projects `session/event` data into Turn and Step models, and calls the typed Remote when the user selects replay. `packages/host` contains `dsh-session-rerun`. It owns replay validation, durable-prefix selection, current preset and model selection, workspace resolution, session creation, and Subagent orchestration. ## Normal Step replay 1. Validate that the requested Turn and Step use positive integers and identify a complete `step/start` / `step/end` pair. 2. Copy the durable event prefix before the selected Step into a new session. 3. Preserve the source workspace, preset, and logged request model selection. 4. Start the new main Agent with the selected Step's logged user input. 5. Leave the source session unchanged. ## Subagent Step replay 1. Resolve the durable child descriptor and its unique parent delegation call. 2. Create a new main session in the source main session's workspace and a new child session under that main composition. 3. Replay the selected child Step from the child's own durable prefix. 4. Recreate exactly one delegation call in the new main session and wait for the child to settle. 5. Deliver only the new child result to the new main Agent, then allow the main Agent to continue normally. The old child output and the main Agent's later output are not copied into the new sessions. This keeps replay causal: every result in the new session belongs to work performed by the new child. ## UI projection The Web Client renders only durable events. Tool calls are kept in log order. File badges are derived from path-like tool arguments and show the basename of script and Markdown references without changing the model-visible transcript. ## Invariants - Source sessions are read-only. - Every new model-visible input is present in the new session log. - A Subagent replay uses the original workspace but new session identities. - The main replay session owns the recreated delegation and its new result. - Plugin registrations use Cordis lifecycle effects and unwind on disposal.