Endpoint List Merger (lib/mergeEndpoints.ts)

agent-orchestrator · packages/mobile/lib/mergeEndpoints.ts · typescript · Apache-2.0
infra, integration, tag:merge, tag:self‑healing, tag:mobile

Merges freshly advertised daemon endpoints into the stored list, preserving unknown kinds and enabling self‑healing tunnel reconnections for mobile agents.

// Source: https://github.com/Untrivial-ai/agent-orchestrator | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import type { Endpoint, EndpointKind } from "./endpoints";

/**
 * Fold a freshly advertised endpoint list into the stored one.
 *
 * The daemon's list is authoritative for every kind it mentions — a rotated
 * tunnel hostname or a changed DHCP lease must replace the old value, which is
 * what makes a pairing self-healing.
 *
 * But a kind the daemon omits entirely is treated as *unknown*, not as
 * *absent*. Measured on device: a quick tunnel takes ~34s to restart and
 * settle, and throughout that window the daemon advertises no tunnel at all,
 * so a refresh landing in

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key