agent-relay-server 0.4.31 → 0.4.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-server",
3
- "version": "0.4.31",
3
+ "version": "0.4.32",
4
4
  "description": "Lightweight HTTP message relay for inter-agent communication across machines",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
@@ -1096,6 +1096,7 @@
1096
1096
 
1097
1097
  function isAgentStale(vm, agent) {
1098
1098
  if (!agent?.lastSeen || agent.status === "offline") return false;
1099
+ if (agent.id === "user" || agent.id === "system") return false;
1099
1100
  const lastSeenMs = new Date(agent.lastSeen).getTime();
1100
1101
  if (!Number.isFinite(lastSeenMs)) return false;
1101
1102
  return (vm.now || Date.now()) - lastSeenMs > 60_000;
package/src/db.ts CHANGED
@@ -629,6 +629,7 @@ export function heartbeat(id: string, guard?: AgentSessionGuard): boolean {
629
629
  export function reapStaleAgents(ttlMs: number = STALE_TTL_MS): string[] {
630
630
  const now = Date.now();
631
631
  const cutoff = now - ttlMs;
632
+ db.prepare("UPDATE agents SET last_seen = ? WHERE id IN ('user', 'system')").run(now);
632
633
  const rows = db
633
634
  .prepare(
634
635
  "UPDATE agents SET status = 'offline', ready = 0 WHERE status != 'offline' AND last_seen < ? AND id NOT IN ('user', 'system') RETURNING id"