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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: connection direction badges + immediate probe on announce
Adam Eivya045951b83a5
diff --git a/client/src/pages/Instances.jsx b/client/src/pages/Instances.jsxindex 303ef31a57..c80dfb686e 100644--- a/client/src/pages/Instances.jsx+++ b/client/src/pages/Instances.jsx@@ -2,7 +2,8 @@ import { useState, useEffect, useCallback } from 'react';import {Network, Plus, Trash2, RefreshCw, Edit3, Check, X,Wifi, WifiOff, CircleDot, ChevronDown, ChevronRight,- Cpu, HardDrive, Activity, Bot, MonitorSmartphone, Search+ Cpu, HardDrive, Activity, Bot, MonitorSmartphone, Search,+ ArrowUpRight, ArrowDownLeft, ArrowLeftRight} from 'lucide-react';import toast from 'react-hot-toast';import socket from '../services/socket';@@ -272,6 +273,34 @@ function QueryPanel({ peerId }) {);}+function DirectionBadge({ directions = [] }) {+ const hasInbound = directions.includes('inbound');+ const hasOutbound = directions.includes('outbound');++ if (hasInbound && hasOutbound) {+ return (+ <span className="inline-flex items-center gap-1 text-[10px] text-port-success bg-port-success/10 rounded px-1.5 py-0.5" title="Bidirectional — we added them and they added us">+ <ArrowLeftRight size={10} /> mutual+ </span>+ );+ }+ if (hasOutbound) {+ return (+ <span className="inline-flex items-center gap-1 text-[10px] text-port-accent bg-port-accent/10 rounded px-1.5 py-0.5" title="Outbound — we added this peer">+ <ArrowUpRight size={10} /> outbound+ </span>+ );+ }+ if (hasInbound) {+ return (+ <span className="inline-flex items-center gap-1 text-[10px] text-port-warning bg-port-warning/10 rounded px-1.5 py-0.5" title="Inbound — this peer added us">+ <ArrowDownLeft size={10} /> inbound+ </span>+ );+ }+ return null;+}+function PeerCard({ peer, onRefresh }) {const [editingName, setEditingName] = useState(false);const [name, setName] = useState('');@@ -366,7 +395,10 @@ function PeerCard({ peer, onRefresh }) {</div></div>- <p className="text-xs text-gray-500 font-mono mb-3">{peer.address}:{peer.port}</p>+ <div className="flex items-center gap-2 mb-3">+ <p className="text-xs text-gray-500 font-mono">{peer.address}:{peer.port}</p>+ <DirectionBadge directions={peer.directions} />+ </div><HealthSummary health={peer.lastHealth} />diff --git a/server/services/instances.js b/server/services/instances.jsindex 0915639ea6..1dd235773d 100644--- a/server/services/instances.js+++ b/server/services/instances.js@@ -96,7 +96,8 @@ export async function addPeer({ address, port = 5554, name }) {lastSeen: null,lastHealth: null,status: 'unknown',- enabled: true+ enabled: true,+ directions: ['outbound']};data.peers.push(entry);console.log(`🌐 Peer added: ${entry.name} (${entry.address}:${entry.port})`);@@ -209,7 +210,7 @@ export async function queryPeer(id, apiPath) {// --- Announce (Bidirectional Registration) ---export async function handleAnnounce({ address, port, instanceId, name }) {- return withData(async (data) => {+ const result = await withData(async (data) => {// Check for existing peer by instanceIdlet existing = data.peers.find(p => p.instanceId === instanceId);// Fallback: check by address + port@@ -222,12 +223,15 @@ export async function handleAnnounce({ address, port, instanceId, name }) {existing.status = 'online';existing.instanceId = instanceId;if (name) existing.name = name;+ // Mark that this peer has announced to us (inbound connection)+ existing.directions = existing.directions || [];+ if (!existing.directions.includes('inbound')) existing.directions.push('inbound');console.log(`🌐 Peer announced (existing): ${existing.name} (${address}:${port})`);instanceEvents.emit('peers:updated', data.peers);return { created: false, peer: existing };}- // Create new peer entry+ // Create new peer entry from remote announcementconst peer = {id: crypto.randomUUID(),address,@@ -238,13 +242,21 @@ export async function handleAnnounce({ address, port, instanceId, name }) {lastSeen: new Date().toISOString(),lastHealth: null,status: 'online',- enabled: true+ enabled: true,+ directions: ['inbound']};data.peers.push(peer);console.log(`🌐 Peer announced (new): ${peer.name} (${address}:${port})`);instanceEvents.emit('peers:updated', data.peers);return { created: true, peer };});++ // Immediately probe newly announced peers to populate health data+ if (result.created) {+ probePeer(result.peer).catch(() => {});+ }++ return result;}async function announceSelf(address, port) {@@ -269,6 +281,8 @@ async function announceSelf(address, port) {});if (res.ok) {console.log(`🌐 Announced self to ${address}:${port}`);+ // Mark outbound direction on the local peer record+ await markDirection(address, port, 'outbound');} else {console.log(`🌐 Announce to ${address}:${port} failed: HTTP ${res.status}`);}@@ -279,6 +293,18 @@ async function announceSelf(address, port) {}}+async function markDirection(address, port, direction) {+ await withData(async (data) => {+ const peer = data.peers.find(p => p.address === address && p.port === port);+ if (!peer) return;+ peer.directions = peer.directions || [];+ if (!peer.directions.includes(direction)) {+ peer.directions.push(direction);+ instanceEvents.emit('peers:updated', data.peers);+ }+ });+}+// --- Polling ---export function startPolling() {