Something went wrong. Try again.
fork of prime agent with changes i want but are not upstreamable probqbly (and some fixes)
Something went wrong. Try again.
898 B · 31 lines
TypeScript
at main
1234567891011121314151617181920212223242526272829303132import type { AgentConnectionHeartbeat, AgentConnectionRlmChildAgentSnapshot } from "../agent-connection/types.js";
interface HeartbeatSessionIdentity { activeSessionId?: string; sessionId: string;}
export function scopeHeartbeatsToSession( heartbeats: readonly AgentConnectionHeartbeat[], session: HeartbeatSessionIdentity | undefined, children: Iterable<Pick<AgentConnectionRlmChildAgentSnapshot, "activeSessionId">>,): AgentConnectionHeartbeat[] { if (!session) { return []; }
const activeSessionIds = new Set<string>(); if (session.activeSessionId) { activeSessionIds.add(session.activeSessionId); } for (const child of children) { if (child.activeSessionId) { activeSessionIds.add(child.activeSessionId); } }
return heartbeats.filter( (heartbeat) => heartbeat.job.sessionId === session.sessionId || activeSessionIds.has(heartbeat.job.activeSessionId), );}