Watch
0
0
Fork
You've already forked hyperhive
0

derive an agent's backend hosts into the egress allow list at the controller

This commit is contained in:
atlas 2026-10-29 01:10:38 +01:00 • committed by mara
commit c5a876b845

View file

@ -7,6 +7,11 @@ export interface AllowedDomain {
domain: string;
/** Absent for an entry that holds for every agent in the swarm. */
agent?: string;
/**
* Kept by the controller from the agent's backend environment: shown as
* automatic, and the route refuses to remove it.
*/
derived?: boolean;
}
export const ALLOWED_DOMAINS_URL = "/api/egress/allowed-domains";
@ -28,10 +33,12 @@ export function entriesFor(
export function allowedSummary(shown: AllowedDomain[]): string {
if (shown.length === 0) return "none added";
const swarmWide = shown.filter((e) => e.agent === undefined).length;
const own = shown.length - swarmWide;
const automatic = shown.filter((e) => e.derived === true).length;
const own = shown.length - swarmWide - automatic;
return [
swarmWide > 0 ? `${swarmWide} swarm-wide` : null,
own > 0 ? `${own} for this agent` : null,
automatic > 0 ? `${automatic} automatic` : null,
]
.filter((part) => part !== null)
.join(", ");