feat(sync): seamless conversation sync, git-like version control, and offline remote notification

This commit is contained in:
Agent committed 2026-10-21 18:43:29 +00:00
1 parent 8e150dcacd
commit 0f866b1bbd
6 files changed
+471 -17

No files matched your search

+31
View File
@@ -157,4 +157,35 @@ export class Store {
this.data.master = m
this.save()
}
// ---- session version control & offline notification queue ----------------
sessionLineage() { return (this.data.sessionLineage ||= {}) }
recordLineage(sessionId, info) {
const table = this.sessionLineage()
table[sessionId] = { ...(table[sessionId] || {}), ...info, updatedAt: Date.now() }
this.save()
return table[sessionId]
}
pendingMoves() { return (this.data.pendingMoves ||= {}) }
queueMoveNotice(notice) {
const key = `${notice.fromDevice}:${notice.sessionId}`
this.pendingMoves()[key] = { ...notice, queuedAt: Date.now() }
this.save()
}
popPendingMovesForDevice(deviceId) {
const moves = this.pendingMoves()
const matching = []
for (const [k, v] of Object.entries(moves)) {
if (v.fromDevice === deviceId) {
matching.push(v)
delete moves[k]
}
}
if (matching.length > 0) this.save()
return matching
}
}