fix(web): preserve the visible chat window during rewind (#1766)

* fix(web): preserve chat window during rewind

* fix(web): scope rewind invalidation preservation

* fix(web): clear unknown rewind boundaries

* fix(web): deduplicate rewind invalidations

* fix(web): retain rewind dedupe history
This commit is contained in:
Ananovo
2026-09-09 09:23:31 +08:00
committed by GitHub
parent fa1caf7d71
commit 17ee052d9a
9 changed files with 208 additions and 12 deletions
+12
View File
@@ -81,6 +81,18 @@ describe('resume schemas', () => {
}).success).toBe(true)
})
it('accepts rewind details on messages-invalidated events', () => {
expect(SyncEventSchema.parse({
type: 'messages-invalidated',
sessionId: 'session-1',
reason: 'rewind',
truncateFromLocalId: 'user-message-1'
})).toMatchObject({
reason: 'rewind',
truncateFromLocalId: 'user-message-1'
})
})
it('validates structured session and machine update patches', () => {
expect(SyncEventSchema.safeParse({
type: 'session-updated',
+3 -1
View File
@@ -558,7 +558,9 @@ export const SyncEventSchema = z.discriminatedUnion('type', [
message: DecryptedMessageSchema
}),
SessionChangedSchema.extend({
type: z.literal('messages-invalidated')
type: z.literal('messages-invalidated'),
reason: z.literal('rewind').optional(),
truncateFromLocalId: z.string().min(1).optional()
}),
SessionChangedSchema.extend({
type: z.literal('scheduled-matured')