feat(app): define trusted rewind branch flow

This commit is contained in:
Codex
2026-07-28 03:23:57 -04:00
parent cf9507a9dd
commit 497c127e87
15 changed files with 671 additions and 26 deletions
+25
View File
@@ -720,6 +720,31 @@ pub struct TurnRequest {
pub input: String,
}
/// Requests a new playable branch rooted at an already committed story node.
///
/// The caller identifies the branch head it observed so the trusted runtime can
/// reject a rewind racing with a newer turn. The new branch id is generated by
/// the runtime from these trusted inputs and is never supplied by the UI or the
/// model.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(rename_all = "camelCase")]
pub struct ForkBranchRequest {
pub story_id: String,
pub current_branch_id: String,
pub expected_current_node_id: String,
pub source_node_id: String,
pub action_id: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(rename_all = "camelCase")]
pub struct ForkBranchResult {
pub branch_id: String,
pub player_view: PlayerView,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(rename_all = "camelCase")]