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

refactor(instances): extract isIPAddress helper, pre-compute snapshot categories

Adam Eivy1007c80f45bc
diff --git a/client/src/pages/Instances.jsx b/client/src/pages/Instances.jsx
index f8127f9150..063eeef2c7 100644
--- a/client/src/pages/Instances.jsx
+++ b/client/src/pages/Instances.jsx
@@ -141,9 +141,7 @@ function SelfCard({ self, onUpdate, syncStatus }) {
<span className="flex items-center gap-1.5">
<Database size={12} /> Memory seq: {syncStatus.local.memorySeq}
</span>
- {SYNC_CATEGORY_META
- .filter(m => m.key !== 'brain' && m.key !== 'memory')
- .map(({ key, label, icon: Icon }) => {
+ {SNAPSHOT_CATEGORIES.map(({ key, label, icon: Icon }) => {
const hasChecksum = !!syncStatus.local.checksums?.[key];
return (
<span key={key} className="flex items-center gap-1.5">
@@ -303,6 +301,9 @@ const SYNC_CATEGORY_META = [
{ key: 'meatspace', label: 'Meatspace', icon: HeartPulse, description: 'Daily logs, blood tests, body metrics, eyes' }
];
+// Snapshot categories (excludes delta-based brain/memory)
+const SNAPSHOT_CATEGORIES = SYNC_CATEGORY_META.filter(m => m.key !== 'brain' && m.key !== 'memory');
+
function SyncCategoriesPanel({ peer, onRefresh }) {
const [expanded, setExpanded] = useState(false);
const categories = peer.syncCategories || {};
@@ -437,8 +438,7 @@ function SyncStatusSection({ peer, syncStatus }) {
const cursorChecksums = cursor?.checksums || {};
const remoteChecksums = remoteSyncSeqs?.checksums || {};
const localChecksums = syncStatus.local?.checksums || {};
- const enabledSnapshots = SYNC_CATEGORY_META
- .filter(m => m.key !== 'brain' && m.key !== 'memory')
+ const enabledSnapshots = SNAPSHOT_CATEGORIES
.map(m => m.key)
.filter(cat => categories[cat]);
diff --git a/server/services/instances.js b/server/services/instances.js
index 8f1df8d4dd..a701a2591a 100644
--- a/server/services/instances.js
+++ b/server/services/instances.js
@@ -114,6 +114,10 @@ function validName(name, fallback) {
return name.trim();
}
+function isIPAddress(str) {
+ return /^\d+\.\d+\.\d+\.\d+$/.test(str);
+}
+
// Default sync categories — all disabled until explicitly enabled per-peer
const DEFAULT_SYNC_CATEGORIES = {
brain: false,
@@ -239,7 +243,7 @@ export async function probePeer(peer) {
if (status === 'online') entry.version = remoteVersion;
// Auto-update name from hostname if current name is just an IP address
const remoteHostname = validName(lastHealth?.hostname, null);
- if (remoteHostname && /^\d+\.\d+\.\d+\.\d+$/.test(entry.name)) {
+ if (remoteHostname && isIPAddress(entry.name)) {
entry.name = remoteHostname;
}
@@ -337,7 +341,7 @@ export async function handleAnnounce({ address, port, instanceId, name }) {
existing.port = port;
// Only auto-update name if still an IP address (preserve user-set names)
const sanitized = validName(name, null);
- if (sanitized && /^\d+\.\d+\.\d+\.\d+$/.test(existing.name)) {
+ if (sanitized && isIPAddress(existing.name)) {
existing.name = sanitized;
}
// Mark that this peer has announced to us (inbound connection)