feat(editor): open server sequences with proxies, hero frame to the index, export sync and saved copies

Server sequences that are not in the local index open through a RemoteSequenceSource:
proxies from the cache, project from the server's settings with their version (a 409
merges again), analysis report from the server, analyses and renders posted as server
jobs (one per preset) and followed through the server's events. Set hero now reaches the
index (SequenceEdit.HeroFrameId) so the Library card shows it. The Export tab gains the
Sync option (remembered in the project) and restores "Save both" copies through undo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-03 11:38:11 +00:00
1 parent 90321a7e53
commit 2ff3a6503b
36 files changed
+1307 -116

No files matched your search

+14 -3
View File
@@ -48,14 +48,25 @@ internal sealed class ProjectStore(TitanoDatabase db, SequenceWriter writer)
var row = await db.Sequences.GetAsync(sequence.Id, cancellationToken).ConfigureAwait(false) ?? sequence;
var current = Read(row, folder);
var before = current.ToJson();
var after = edit(current).ToJson();
var edited = edit(current);
var after = edited.ToJson();
if (after == before) return false;
AtomicFile.WriteAllText(folder.ProjectPath, after);
var result = await db.Sequences.EditAsync(sequence.Id, new SequenceEdit { SettingsJson = after }, row.SettingsVersion, cancellationToken)
.ConfigureAwait(false);
// The Library shows the project's hero frame (advice fills it, a sync takes another PC's).
var hero = edited.HeroFrame == current.HeroFrame ? (Guid?)null : await HeroFrameIdAsync(sequence.Id, edited.HeroFrame, cancellationToken).ConfigureAwait(false);
var result = await db.Sequences.EditAsync(sequence.Id, new SequenceEdit { SettingsJson = after, HeroFrameId = hero }, row.SettingsVersion,
cancellationToken).ConfigureAwait(false);
// A conflict means the API changed the settings meanwhile: apply the edit again on top of them.
if (result.Outcome != SequenceEditOutcome.Conflict || attempt == Attempts) return true;
}
}
}
/// <summary>The id of the frame at <paramref name="index"/> (frame indices are positions), or <see cref="Guid.Empty"/> to clear the hero.</summary>
private async Task<Guid> HeroFrameIdAsync(Guid sequenceId, int? index, CancellationToken cancellationToken)
{
if (index is not >= 0) return Guid.Empty;
var frames = await db.Frames.ListBySequenceAsync(sequenceId, index.Value - 1, 1, cancellationToken).ConfigureAwait(false);
return frames is [{ } frame] && frame.Index == index ? frame.Id : Guid.Empty;
}
}