History

feat(orchestration): bound thread history and resume payloads

- Add paginated thread history with bounded snapshots and replay limits - Trim oversized wire payloads and support progressive mobile history loading

Julius Marminge committed 3 months ago

Commit 7d42d311 parent e3883a943 files · +4239 −211Browse files

Showing the changes to packages/client-runtime/src/state/shellReducer.ts (1 of 43 files). Show all

Unified · Split

packages/client-runtime/src/state/shellReducer.ts+6−6
@@ -29,8 +29,8 @@ function retainRepositoryIdentity( · 28 unmodified lines
29 29
30export interface MergeShellSnapshotOptions {30export interface MergeShellSnapshotOptions {
31 /**31 /**
32 * Enrichment refresh: structure and sequence must not roll back when at or32 * Metadata-only enrichment refresh: structure and sequence never change;
33 * below cache; listed roots accept identity exactly (including null).33 * listed roots accept identity exactly (including null).
34 * Omit this options object for authoritative HTTP/initial WebSocket snapshots.34 * Omit this options object for authoritative HTTP/initial WebSocket snapshots.
35 */35 */
36 readonly resolvedRepositoryIdentityRoots: ReadonlyArray<string>;36 readonly resolvedRepositoryIdentityRoots: ReadonlyArray<string>;
@@ -43,9 +43,9 @@ export interface MergeShellSnapshotOptions { · 6 unmodified lines
43 * lower than cache, while retaining a prior non-null identity when the candidate43 * lower than cache, while retaining a prior non-null identity when the candidate
44 * is still unresolved/null for the same root.44 * is still unresolved/null for the same root.
45 *45 *
46 * Enrichment snapshots (options present) never resurrect or roll back46 * Enrichment snapshots (options present) only patch repository identity for
47 * projects/threads/archives/sequence when at or below cache; they only patch47 * matching current projects. They never replace projects, threads, archives,
48 * repository identity for matching current projects.48 * or sequence, regardless of the incoming snapshot sequence.
49 */49 */
50export function mergeShellSnapshotProjects(50export function mergeShellSnapshotProjects(
51 previous: OrchestrationV2ShellSnapshot | null | undefined,51 previous: OrchestrationV2ShellSnapshot | null | undefined,
@@ -59,7 +59,7 @@ export function mergeShellSnapshotProjects( · 7 unmodified lines
59 const isEnrichment = options !== undefined;59 const isEnrichment = options !== undefined;
60 const resolvedRootSet = isEnrichment ? new Set(options.resolvedRepositoryIdentityRoots) : null;60 const resolvedRootSet = isEnrichment ? new Set(options.resolvedRepositoryIdentityRoots) : null;
61 61
62 if (isEnrichment && next.snapshotSequence <= previous.snapshotSequence) {62 if (isEnrichment) {
63 const nextById = new Map(next.projects.map((project) => [project.id, project] as const));63 const nextById = new Map(next.projects.map((project) => [project.id, project] as const));
64 return {64 return {
65 ...previous,65 ...previous,