Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat(sync): show sync status for all enabled snapshot categories

Adam Eivyec770cb723b0
diff --git a/client/src/pages/Instances.jsx b/client/src/pages/Instances.jsx
index 1c461d6cf9..f2659cdb64 100644
--- a/client/src/pages/Instances.jsx
+++ b/client/src/pages/Instances.jsx
@@ -372,6 +372,34 @@ function SyncCategoriesPanel({ peer, onRefresh }) {
);
}
+function SnapshotSyncBadge({ label, icon: Icon, cursorChecksum, remoteChecksum }) {
+ const synced = cursorChecksum && remoteChecksum && cursorChecksum === remoteChecksum;
+ const behind = cursorChecksum && remoteChecksum && cursorChecksum !== remoteChecksum;
+
+ return (
+ <div className="flex items-center gap-1.5 text-xs">
+ <Icon size={12} className="text-gray-500" />
+ <span className="text-gray-500">{label}:</span>
+ {synced ? (
+ <>
+ <CheckCircle2 size={11} className="text-port-success" />
+ <span className="text-port-success">synced</span>
+ </>
+ ) : behind ? (
+ <>
+ <AlertCircle size={11} className="text-port-warning" />
+ <span className="text-port-warning">behind</span>
+ </>
+ ) : (
+ <>
+ <Clock size={11} className="text-gray-500" />
+ <span className="text-gray-400">pending</span>
+ </>
+ )}
+ </div>
+ );
+}
+
function SyncStatusSection({ peer, syncStatus }) {
if (!syncStatus || !peer.instanceId) return null;
@@ -386,14 +414,15 @@ function SyncStatusSection({ peer, syncStatus }) {
const showBrain = categories.brain;
const showMemory = categories.memory;
- // Show snapshot category sync status from checksums
- const checksums = cursor?.checksums || {};
- const syncedSnapshots = SYNC_CATEGORY_META
+ // Show snapshot category sync status for all enabled snapshot categories
+ const cursorChecksums = cursor?.checksums || {};
+ const remoteChecksums = remoteSyncSeqs?.checksums || {};
+ const enabledSnapshots = SYNC_CATEGORY_META
.filter(m => m.key !== 'brain' && m.key !== 'memory')
.map(m => m.key)
- .filter(cat => categories[cat] && checksums[cat]);
+ .filter(cat => categories[cat]);
- if (!showBrain && !showMemory && syncedSnapshots.length === 0) return null;
+ if (!showBrain && !showMemory && enabledSnapshots.length === 0) return null;
return (
<div className="mt-2 pt-2 border-t border-port-border/50">
@@ -423,17 +452,17 @@ function SyncStatusSection({ peer, syncStatus }) {
cursorSeq={cursor?.memorySeq}
/>
)}
- {syncedSnapshots.map(cat => {
+ {enabledSnapshots.map(cat => {
const meta = SYNC_CATEGORY_META.find(m => m.key === cat);
if (!meta) return null;
- const CatIcon = meta.icon;
return (
- <div key={cat} className="flex items-center gap-1.5 text-xs">
- <CatIcon size={12} className="text-gray-500" />
- <span className="text-gray-500">{meta.label}:</span>
- <CheckCircle2 size={11} className="text-port-success" />
- <span className="text-port-success">synced</span>
- </div>
+ <SnapshotSyncBadge
+ key={cat}
+ label={meta.label}
+ icon={meta.icon}
+ cursorChecksum={cursorChecksums[cat]}
+ remoteChecksum={remoteChecksums[cat]}
+ />
);
})}
</div>
diff --git a/server/routes/instances.js b/server/routes/instances.js
index 61e98fca8a..f1b05c21ee 100644
--- a/server/routes/instances.js
+++ b/server/routes/instances.js
@@ -58,10 +58,14 @@ router.get('/', asyncHandler(async (req, res) => {
res.json({ self, peers, syncStatus });
}));
-// GET /api/instances/sync-status — local sync sequences (used by peers during probe)
+// GET /api/instances/sync-status — local sync sequences + checksums (used by peers during probe)
router.get('/sync-status', asyncHandler(async (req, res) => {
- const status = await getSyncStatus();
- res.json({ brainSeq: status.local.brainSeq, memorySeq: status.local.memorySeq });
+ const status = await getSyncStatus({ includeChecksums: true });
+ res.json({
+ brainSeq: status.local.brainSeq,
+ memorySeq: status.local.memorySeq,
+ checksums: status.local.checksums
+ });
}));
// GET /api/instances/self — get this instance's identity
diff --git a/server/services/syncOrchestrator.js b/server/services/syncOrchestrator.js
index d63b51244c..c72f1344df 100644
--- a/server/services/syncOrchestrator.js
+++ b/server/services/syncOrchestrator.js
@@ -75,19 +75,25 @@ async function fetchPeer(peer, path) {
// --- Status ---
/**
- * Get sync status: local sequences + per-peer cursors
+ * Get sync status: local sequences + per-peer cursors + optional local checksums
*/
-export async function getSyncStatus() {
+export async function getSyncStatus({ includeChecksums = false } = {}) {
const isPostgres = getBackendName() === 'postgres';
- const [brainSeq, memorySeq, cursors] = await Promise.all([
+ const snapshotCategories = includeChecksums ? dataSync.getSupportedCategories() : [];
+ const [brainSeq, memorySeq, cursors, ...checksumResults] = await Promise.all([
Promise.resolve(brainSyncLog.getCurrentSeq()),
isPostgres ? memorySync.getMaxSequence() : Promise.resolve(null),
- loadCursors()
+ loadCursors(),
+ ...snapshotCategories.map(cat => dataSync.getChecksum(cat).catch(() => null))
]);
- return {
- local: { brainSeq, memorySeq },
- cursors
- };
+ const local = { brainSeq, memorySeq };
+ if (includeChecksums) {
+ local.checksums = {};
+ for (let i = 0; i < snapshotCategories.length; i++) {
+ local.checksums[snapshotCategories[i]] = checksumResults[i]?.checksum ?? null;
+ }
+ }
+ return { local, cursors };
}
// --- Sync logic ---