@devries-cameron20 / t3code-1 / commits / ccabed086a
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

feat(web): the environments page is a map of your machines (#39445)

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>

Julius Marminge committed Nov 20, 2026 at 12:57 UTC ccabed086ad47294173769c77d2d44e55bb8bd0d
40 files changed +8747 -264
apps/mobile/src/i18n/translations/de.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Diese App ist nicht damit verbunden",
79 "95f18b6ad4a409de": "Deine Sitzung dort kann keine Kopplungscodes erstellen",
80 "26847ec0357c8600": "Keine Adresse, die ein anderer Rechner erreichen kann",
81 + "ec1a698b0821ec66": "{target} kann nicht zurückverknüpfen: Verknüpfte Umgebungen sind dort aus.",
82 + "6cf74ace5a766699": "{target} kann nicht zurückverknüpfen: Deine Sitzung dort kann keine Verknüpfungen erstellen.",
83 + "a995255a0f303086": "{target} kann nicht zurückverknüpfen: Deine Sitzung auf {source} kann keine Kopplungscodes erstellen.",
84 + "a51c8cdfccb5b4ca": "{target} kann nicht zurückverknüpfen: Diese App kennt keine Adresse, unter der {source} erreichbar ist.",
85 "cba6d3e3a22f2efe": "Nicht erreichbar",
86 "0eb1a18deaf06b76": "Kopplungscode abgelehnt",
87 "7d6fc963ebf9a9c5": "Eine andere Umgebung hat geantwortet",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "Die Routenreihenfolge muss jede gespeicherte Route genau einmal enthalten.",
486 "18de69e3b6ac3891": "Verbindungsprofil {connectionId} ist keine Bearer-Verbindung.",
487 "0a84ce2f4fb90d82": "Verbindungsprofil {connectionId} ist keine SSH-Verbindung.",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "Remote-Verbindung",
490 "0b367ce72b45a911": "Die Verbindung zu {host} ist unerwartet fehlgeschlagen.",
491 "91ca7e48f40bfa3c": "{host} hat während der Verbindungseinrichtung nicht geantwortet.",
apps/mobile/src/i18n/translations/en.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "This app is not connected to it",
79 "95f18b6ad4a409de": "Your session there cannot create pairing codes",
80 "26847ec0357c8600": "No address another machine can reach",
81 + "ec1a698b0821ec66": "{target} cannot link back: Linked environments is off there.",
82 + "6cf74ace5a766699": "{target} cannot link back: your session there cannot create links.",
83 + "a995255a0f303086": "{target} cannot link back: your session on {source} cannot create pairing codes.",
84 + "a51c8cdfccb5b4ca": "{target} cannot link back: this app has no address for {source} it can reach.",
85 "cba6d3e3a22f2efe": "Unreachable",
86 "0eb1a18deaf06b76": "Pairing code refused",
87 "7d6fc963ebf9a9c5": "Another environment answered",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "The route order must list every saved route once.",
486 "18de69e3b6ac3891": "Connection profile {connectionId} is not a bearer connection.",
487 "0a84ce2f4fb90d82": "Connection profile {connectionId} is not an SSH connection.",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "Remote link",
490 "0b367ce72b45a911": "{host} connection failed unexpectedly.",
491 "91ca7e48f40bfa3c": "{host} did not respond during connection setup.",
apps/mobile/src/i18n/translations/es.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Esta app no está conectada a ella",
79 "95f18b6ad4a409de": "Tu sesión allí no puede crear códigos de emparejamiento",
80 "26847ec0357c8600": "Ninguna dirección a la que pueda llegar otra máquina",
81 + "ec1a698b0821ec66": "{target} no puede vincularse de vuelta: Entornos vinculados está desactivado allí.",
82 + "6cf74ace5a766699": "{target} no puede vincularse de vuelta: tu sesión allí no puede crear vínculos.",
83 + "a995255a0f303086": "{target} no puede vincularse de vuelta: tu sesión en {source} no puede crear códigos de emparejamiento.",
84 + "a51c8cdfccb5b4ca": "{target} no puede vincularse de vuelta: esta app no tiene ninguna dirección en la que pueda alcanzar a {source}.",
85 "cba6d3e3a22f2efe": "Inaccesible",
86 "0eb1a18deaf06b76": "Código de emparejamiento rechazado",
87 "7d6fc963ebf9a9c5": "Respondió otro entorno",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "El orden de rutas debe incluir cada ruta guardada una vez.",
486 "18de69e3b6ac3891": "El perfil de conexión {connectionId} no es una conexión bearer.",
487 "0a84ce2f4fb90d82": "El perfil de conexión {connectionId} no es una conexión SSH.",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "Enlace remoto",
490 "0b367ce72b45a911": "La conexión con {host} falló de forma inesperada.",
491 "91ca7e48f40bfa3c": "{host} no respondió durante la configuración de la conexión.",
apps/mobile/src/i18n/translations/fr.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Cette app n’y est pas connectée",
79 "95f18b6ad4a409de": "Votre session là-bas ne peut pas créer de codes d’appairage",
80 "26847ec0357c8600": "Aucune adresse joignable par une autre machine",
81 + "ec1a698b0821ec66": "{target} ne peut pas s’associer en retour : Environnements associés y est désactivé.",
82 + "6cf74ace5a766699": "{target} ne peut pas s’associer en retour : votre session là-bas ne peut pas créer d’associations.",
83 + "a995255a0f303086": "{target} ne peut pas s’associer en retour : votre session sur {source} ne peut pas créer de codes d’appairage.",
84 + "a51c8cdfccb5b4ca": "{target} ne peut pas s’associer en retour : cette app n’a aucune adresse à laquelle {source} est joignable.",
85 "cba6d3e3a22f2efe": "Injoignable",
86 "0eb1a18deaf06b76": "Code d’appairage refusé",
87 "7d6fc963ebf9a9c5": "Un autre environnement a répondu",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "L’ordre des routes doit lister chaque route enregistrée une seule fois.",
486 "18de69e3b6ac3891": "Le profil de connexion {connectionId} n’est pas une connexion bearer.",
487 "0a84ce2f4fb90d82": "Le profil de connexion {connectionId} n’est pas une connexion SSH.",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "Lien distant",
490 "0b367ce72b45a911": "La connexion à {host} a échoué de manière inattendue.",
491 "91ca7e48f40bfa3c": "{host} n’a pas répondu pendant la configuration de la connexion.",
apps/mobile/src/i18n/translations/ja.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "このアプリはこのマシンに接続していません",
79 "95f18b6ad4a409de": "そのマシンでのセッションではペアリングコードを作成できません",
80 "26847ec0357c8600": "他のマシンから到達できるアドレスがありません",
81 + "ec1a698b0821ec66": "{target} からは逆方向にリンクできません: そのマシンではリンクされた環境がオフです。",
82 + "6cf74ace5a766699": "{target} からは逆方向にリンクできません: そのマシンでのセッションではリンクを作成できません。",
83 + "a995255a0f303086": "{target} からは逆方向にリンクできません: {source} でのセッションではペアリングコードを作成できません。",
84 + "a51c8cdfccb5b4ca": "{target} からは逆方向にリンクできません: このアプリには {source} に到達できるアドレスがありません。",
85 "cba6d3e3a22f2efe": "到達不能",
86 "0eb1a18deaf06b76": "ペアリングコードが拒否されました",
87 "7d6fc963ebf9a9c5": "別の環境が応答しました",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "ルートの順序には、保存されたすべてのルートを 1 回ずつ含める必要があります。",
486 "18de69e3b6ac3891": "接続プロファイル {connectionId} はベアラー接続ではありません。",
487 "0a84ce2f4fb90d82": "接続プロファイル {connectionId} は SSH 接続ではありません。",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "リモートリンク",
490 "0b367ce72b45a911": "{host} への接続が予期せず失敗しました。",
491 "91ca7e48f40bfa3c": "{host} は接続のセットアップ中に応答しませんでした。",
apps/mobile/src/i18n/translations/ko.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "이 앱이 해당 머신에 연결되어 있지 않습니다",
79 "95f18b6ad4a409de": "그곳의 세션으로는 페어링 코드를 만들 수 없습니다",
80 "26847ec0357c8600": "다른 머신이 접근할 수 있는 주소가 없습니다",
81 + "ec1a698b0821ec66": "{target}에서 반대 방향으로 연결할 수 없습니다. 그곳에서 연결된 환경이 꺼져 있습니다.",
82 + "6cf74ace5a766699": "{target}에서 반대 방향으로 연결할 수 없습니다. 그곳의 세션으로는 링크를 만들 수 없습니다.",
83 + "a995255a0f303086": "{target}에서 반대 방향으로 연결할 수 없습니다. {source}의 세션으로는 페어링 코드를 만들 수 없습니다.",
84 + "a51c8cdfccb5b4ca": "{target}에서 반대 방향으로 연결할 수 없습니다. 이 앱에 {source}에 도달할 수 있는 주소가 없습니다.",
85 "cba6d3e3a22f2efe": "연결할 수 없음",
86 "0eb1a18deaf06b76": "페어링 코드가 거부됨",
87 "7d6fc963ebf9a9c5": "다른 환경이 응답함",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "경로 순서에는 저장된 모든 경로가 한 번씩 있어야 합니다.",
486 "18de69e3b6ac3891": "연결 프로필 {connectionId}은(는) bearer 연결이 아닙니다.",
487 "0a84ce2f4fb90d82": "연결 프로필 {connectionId}은(는) SSH 연결이 아닙니다.",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "원격 링크",
490 "0b367ce72b45a911": "{host} 연결이 예기치 않게 실패했습니다.",
491 "91ca7e48f40bfa3c": "{host}이(가) 연결 설정 중에 응답하지 않았습니다.",
apps/mobile/src/i18n/translations/pt-BR.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Este app não está conectado a ela",
79 "95f18b6ad4a409de": "Sua sessão lá não pode criar códigos de pareamento",
80 "26847ec0357c8600": "Nenhum endereço que outra máquina consiga acessar",
81 + "ec1a698b0821ec66": "{target} não pode vincular de volta: Ambientes vinculados está desativado lá.",
82 + "6cf74ace5a766699": "{target} não pode vincular de volta: sua sessão lá não pode criar vínculos.",
83 + "a995255a0f303086": "{target} não pode vincular de volta: sua sessão em {source} não pode criar códigos de pareamento.",
84 + "a51c8cdfccb5b4ca": "{target} não pode vincular de volta: este app não tem um endereço em que {source} possa ser alcançado.",
85 "cba6d3e3a22f2efe": "Inacessível",
86 "0eb1a18deaf06b76": "Código de pareamento recusado",
87 "7d6fc963ebf9a9c5": "Outro ambiente respondeu",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "A ordem das rotas precisa listar cada rota salva uma vez.",
486 "18de69e3b6ac3891": "O perfil de conexão {connectionId} não é uma conexão bearer.",
487 "0a84ce2f4fb90d82": "O perfil de conexão {connectionId} não é uma conexão SSH.",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "Link remoto",
490 "0b367ce72b45a911": "A conexão com {host} falhou inesperadamente.",
491 "91ca7e48f40bfa3c": "{host} não respondeu durante a configuração da conexão.",
apps/mobile/src/i18n/translations/ru.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Это приложение к ней не подключено",
79 "95f18b6ad4a409de": "Ваш сеанс там не может создавать коды сопряжения",
80 "26847ec0357c8600": "Нет адреса, доступного с другой машины",
81 + "ec1a698b0821ec66": "{target} не может привязаться в ответ: привязанные окружения там выключены.",
82 + "6cf74ace5a766699": "{target} не может привязаться в ответ: ваш сеанс там не может создавать привязки.",
83 + "a995255a0f303086": "{target} не может привязаться в ответ: ваш сеанс на {source} не может создавать коды сопряжения.",
84 + "a51c8cdfccb5b4ca": "{target} не может привязаться в ответ: у этого приложения нет адреса, по которому доступна {source}.",
85 "cba6d3e3a22f2efe": "Недоступна",
86 "0eb1a18deaf06b76": "Код сопряжения отклонён",
87 "7d6fc963ebf9a9c5": "Ответило другое окружение",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "Порядок маршрутов должен содержать каждый сохранённый маршрут ровно один раз.",
486 "18de69e3b6ac3891": "Профиль подключения {connectionId} не является bearer-подключением.",
487 "0a84ce2f4fb90d82": "Профиль подключения {connectionId} не является SSH-подключением.",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "Удалённая ссылка",
490 "0b367ce72b45a911": "Неожиданная ошибка подключения к {host}.",
491 "91ca7e48f40bfa3c": "{host} не ответил во время настройки подключения.",
apps/mobile/src/i18n/translations/sv.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Den här appen är inte ansluten till den",
79 "95f18b6ad4a409de": "Din session där kan inte skapa parkopplingskoder",
80 "26847ec0357c8600": "Ingen adress som en annan dator kan nå",
81 + "ec1a698b0821ec66": "{target} kan inte länka tillbaka: Länkade miljöer är avstängt där.",
82 + "6cf74ace5a766699": "{target} kan inte länka tillbaka: din session där kan inte skapa länkar.",
83 + "a995255a0f303086": "{target} kan inte länka tillbaka: din session på {source} kan inte skapa parkopplingskoder.",
84 + "a51c8cdfccb5b4ca": "{target} kan inte länka tillbaka: den här appen har ingen adress där {source} kan nås.",
85 "cba6d3e3a22f2efe": "Inte nåbar",
86 "0eb1a18deaf06b76": "Parkopplingskoden nekades",
87 "7d6fc963ebf9a9c5": "En annan miljö svarade",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "Ruttordningen måste ta med varje sparad rutt en gång.",
486 "18de69e3b6ac3891": "Anslutningsprofilen {connectionId} är ingen bearer-anslutning.",
487 "0a84ce2f4fb90d82": "Anslutningsprofilen {connectionId} är ingen SSH-anslutning.",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "Fjärrlänk",
490 "0b367ce72b45a911": "Anslutningen till {host} misslyckades oväntat.",
491 "91ca7e48f40bfa3c": "{host} svarade inte när anslutningen konfigurerades.",
apps/mobile/src/i18n/translations/zh.json
+5
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "此应用未连接到该机器",
79 "95f18b6ad4a409de": "你在该机器上的会话无法创建配对码",
80 "26847ec0357c8600": "没有其他机器可访问的地址",
81 + "ec1a698b0821ec66": "{target} 无法反向关联:该机器上的关联环境已关闭。",
82 + "6cf74ace5a766699": "{target} 无法反向关联:你在该机器上的会话无法创建关联。",
83 + "a995255a0f303086": "{target} 无法反向关联:你在 {source} 上的会话无法创建配对码。",
84 + "a51c8cdfccb5b4ca": "{target} 无法反向关联:此应用没有可访问 {source} 的地址。",
85 "cba6d3e3a22f2efe": "无法访问",
86 "0eb1a18deaf06b76": "配对码被拒绝",
87 "7d6fc963ebf9a9c5": "应答的是另一个环境",
@@ -481,6 +485,7 @@
485 "7eabeed193759388": "路由顺序必须包含每条已保存的路由,且不能重复。",
486 "18de69e3b6ac3891": "连接配置 {connectionId} 不是 Bearer 连接。",
487 "0a84ce2f4fb90d82": "连接配置 {connectionId} 不是 SSH 连接。",
488 + "468d32c6b30df608": "Tailscale HTTPS",
489 "4d022ee84149d47f": "远程连接",
490 "0b367ce72b45a911": "{host} 连接意外失败。",
491 "91ca7e48f40bfa3c": "{host} 在连接设置期间无响应。",
apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx
+13 -4
@@ -34,7 +34,7 @@ import { environmentCatalog } from "~/connection/catalog";
34 import { isDesktopLocalConnectionTarget } from "~/connection/desktopLocal";
35 import { cn } from "~/lib/utils";
36 import { relayEnvironmentDiscovery } from "~/state/relay";
37 -import { useRelayEnvironmentDiscovery } from "~/state/environments";
37 +import { useRelayEnvironmentDiscovery, useRetainedRelayEnvironments } from "~/state/environments";
38 import { useAtomCommand } from "~/state/use-atom-command";
39 import { ConnectionStatusDot } from "../ConnectionStatusDot";
40 import { EnvironmentMachineIcon } from "../EnvironmentMachineIcon";
@@ -85,7 +85,10 @@ export function CloudEnvironmentConnectRows({
85 empty = null,
86 selection,
87 onDiscoveryReady,
88 + only,
89 }: {
90 + /** Show this machine's row alone, for a view that picks one machine at a time. */
91 + readonly only?: EnvironmentId;
92 readonly primaryEnvironmentId: EnvironmentId | null;
93 readonly savedEnvironments: ReadonlyArray<SavedCloudEnvironmentConnection>;
94 readonly showSavedEnvironments?: boolean;
@@ -101,6 +104,9 @@ export function CloudEnvironmentConnectRows({
104 const gt = useGT();
105 const m = useMessages();
106 const environmentsState = useRelayEnvironmentDiscovery();
107 + const retainedEnvironments = useRetainedRelayEnvironments();
108 + // A single row is a machine the user picked: it stays through a refresh, as it does on the map.
109 + const discovered = only === undefined ? environmentsState.environments : retainedEnvironments;
110 const registerEnvironment = useAtomCommand(environmentCatalog.register, {
111 reportFailure: false,
112 });
@@ -142,6 +148,8 @@ export function CloudEnvironmentConnectRows({
148 // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fetches relay discovery when its inputs change, unless hidden polling covers it, and reports readiness
149 useEffect(() => {
150 let active = true;
151 + // A single row belongs to a view that already listed the machines; listing again empties it.
152 + if (only !== undefined) return;
153 if (onDiscoveryReady || !refreshWhileEmpty || document.visibilityState === "visible") {
154 void refreshRelayEnvironments().then(() => {
155 if (active) onDiscoveryReady?.();
@@ -150,7 +158,7 @@ export function CloudEnvironmentConnectRows({
158 return () => {
159 active = false;
160 };
153 - }, [refreshRelayEnvironments, refreshWhileEmpty, onDiscoveryReady]);
161 + }, [refreshRelayEnvironments, refreshWhileEmpty, onDiscoveryReady, only]);
162
163 const connectEnvironment = async (environment: RelayClientEnvironmentRecord) => {
164 if (
@@ -208,12 +216,13 @@ export function CloudEnvironmentConnectRows({
216
217 // Omit machines saved over other routes; onboarding selection must not add a T3 Connect route.
218 const isVisibleEnvironment = (environmentId: EnvironmentId) =>
219 + (only === undefined || environmentId === only) &&
220 environmentId !== primaryEnvironmentId &&
221 !desktopLocalIds.has(environmentId) &&
222 (showSavedEnvironments || !savedById.has(environmentId)) &&
223 !(selection && savedWithoutRelay.has(environmentId));
215 - const visibleEnvironments = [...environmentsState.environments.values()].filter(
216 - ({ environment }) => isVisibleEnvironment(environment.environmentId),
224 + const visibleEnvironments = [...discovered.values()].filter(({ environment }) =>
225 + isVisibleEnvironment(environment.environmentId),
226 );
227 const selectNewComputers = useEffectEvent(
228 (environments: typeof environmentsState.environments) => {
apps/web/src/components/settings/AddEnvironmentDialog.tsx
+5 -2
@@ -82,6 +82,7 @@ export function AddEnvironmentDialog({
82 routeTarget,
83 error,
84 savedEnvironments,
85 + initialHost = "",
86 onOpenChange,
87 onErrorChange,
88 }: {
@@ -89,6 +90,8 @@ export function AddEnvironmentDialog({
90 /** A machine the user chose elsewhere to pair with; they supply only the pairing code. */
91 readonly prefill?: AddEnvironmentPrefill | null;
92 readonly routeTarget: EnvironmentPresentation | null;
93 + /** An address already known for the machine being added, such as one a link uses. */
94 + readonly initialHost?: string;
95 readonly error: string | null;
96 readonly savedEnvironments: ReadonlyArray<EnvironmentPresentation>;
97 readonly onOpenChange: (open: boolean) => void;
@@ -123,7 +126,7 @@ export function AddEnvironmentDialog({
126 return keys;
127 })();
128 const [savedBackendMode, setSavedBackendMode] = useState<"remote" | "ssh">("remote");
126 - const [savedBackendHost, setSavedBackendHost] = useState(prefill?.host ?? "");
129 + const [savedBackendHost, setSavedBackendHost] = useState(prefill?.host ?? initialHost);
130 const [savedBackendPairingCode, setSavedBackendPairingCode] = useState("");
131 const [savedBackendSshHost, setSavedBackendSshHost] = useState("");
132 const [savedBackendSshUsername, setSavedBackendSshUsername] = useState("");
@@ -165,7 +168,7 @@ export function AddEnvironmentDialog({
168 if (!nextOpen) {
169 savedBackendSessionRef.current += 1;
170 setSavedBackendMode("remote");
168 - setSavedBackendHost("");
171 + setSavedBackendHost(initialHost);
172 setSavedBackendPairingCode("");
173 setSavedBackendSshHost("");
174 setSavedBackendSshUsername("");
apps/web/src/components/settings/ConnectionsSettings.tsx
+98 -26
@@ -49,8 +49,11 @@ import { useSearchableSetting } from "./settingsSearch";
49 import { ConnectDeviceApprovalSettings } from "./ConnectDeviceApprovalSettings";
50 import { EnvironmentIconMenu } from "./EnvironmentIconPicker";
51 import { FoldedSettingsSection } from "./FoldedSettingsSection";
52 +import { EnvironmentsMap } from "./EnvironmentsMap";
53 import { LinkedEnvironmentsSettings } from "./LinkedEnvironmentsSettings";
54 import { addEnvironmentPrefillAtom } from "~/state/linkedThreadView";
55 +import { Toggle, ToggleGroup } from "../ui/toggle-group";
56 +import { useMediaQuery } from "~/hooks/useMediaQuery";
57 import { usePeerLinkHosts } from "~/state/peerLinks";
58 import { LoadBalancingSettings } from "./LoadBalancingSettings";
59 import { PullRequestRoutingSettings } from "./PullRequestRoutingSettings";
@@ -356,6 +359,8 @@ function ConnectionsSettingsContent({
359 const [isRevokingOtherDesktopClients, setIsRevokingOtherDesktopClients] = useState(false);
360 const [addBackendDialogOpen, setAddBackendDialogOpen] = useState(false);
361 const [routeTarget, setRouteTarget] = useState<EnvironmentPresentation | null>(null);
362 + // An address the map already knows for the machine being added; remounts the dialog with it.
363 + const [addBackendHost, setAddBackendHost] = useState("");
364 const [savedBackendError, setSavedBackendError] = useState<string | null>(null);
365 // Set by a read-only linked thread whose machine this client is about to pair with.
366 const [addPrefill, setAddPrefill] = useAtom(addEnvironmentPrefillAtom);
@@ -363,11 +368,28 @@ function ConnectionsSettingsContent({
368 setAddBackendDialogOpen(open);
369 if (open) {
370 setRouteTarget(null);
371 + setAddBackendHost("");
372 } else {
373 setSavedBackendError(null);
374 setAddPrefill(null);
375 }
376 };
377 + const openAddRoute = (target: EnvironmentPresentation) => {
378 + setRouteTarget(target);
379 + setAddBackendHost("");
380 + setSavedBackendError(null);
381 + setAddBackendDialogOpen(true);
382 + };
383 + const openAddEnvironment = (host = "") => {
384 + setRouteTarget(null);
385 + setAddBackendHost(host);
386 + setSavedBackendError(null);
387 + setAddBackendDialogOpen(true);
388 + };
389 + // The map is the page's main view where there is room; the list is its equivalent everywhere.
390 + const roomForMap = useMediaQuery("md");
391 + const [pickedEnvironmentsView, setPickedEnvironmentsView] = useState<"map" | "list" | null>(null);
392 + const environmentsView = roomForMap ? (pickedEnvironmentsView ?? "map") : "list";
393 const [removingSavedEnvironmentId, setRemovingSavedEnvironmentId] =
394 useState<EnvironmentId | null>(null);
395 const [isUpdatingDesktopServerExposure, setIsUpdatingDesktopServerExposure] = useState(false);
@@ -1812,16 +1834,37 @@ function ConnectionsSettingsContent({
1834 <SettingsSection
1835 {...searchableSetting("remote-environments")}
1836 title={gt("Environments")}
1837 + titleAction={
1838 + roomForMap ? (
1839 + <ToggleGroup
1840 + aria-label={gt("Show environments as")}
1841 + value={[environmentsView]}
1842 + onValueChange={(next) => {
1843 + const value = next[0];
1844 + if (value === "map" || value === "list") setPickedEnvironmentsView(value);
1845 + }}
1846 + >
1847 + <Toggle value="map">
1848 + {gt("Map", { $context: "view switch: show machines as a diagram" })}
1849 + </Toggle>
1850 + <Toggle value="list">
1851 + {gt("List", { $context: "view switch: show items as a list" })}
1852 + </Toggle>
1853 + </ToggleGroup>
1854 + ) : null
1855 + }
1856 headerAction={
1857 <div className="flex items-center gap-1">
1858 {savedServerUpdateTargets.length > 0 ? (
1859 <ServerUpdatesAction targets={savedServerUpdateTargets} variant="ghost-muted" />
1860 ) : null}
1861 + {/* Actions on several machines at once, such as linking several, go here. */}
1862 <AddEnvironmentDialog
1821 - key={addPrefill?.environmentId ?? "any"}
1863 + key={`${addPrefill?.environmentId ?? "any"}:${addBackendHost}`}
1864 open={addBackendDialogOpen || addPrefill !== null}
1865 prefill={addPrefill}
1866 routeTarget={routeTarget}
1867 + initialHost={addBackendHost}
1868 error={savedBackendError}
1869 savedEnvironments={savedEnvironments}
1870 onOpenChange={handleAddBackendDialogOpenChange}
@@ -1830,24 +1873,51 @@ function ConnectionsSettingsContent({
1873 </div>
1874 }
1875 >
1833 - {listedEnvironments.map((environment) => (
1834 - <SavedBackendListRow
1835 - key={environment.environmentId}
1836 - environment={environment}
1837 - removingEnvironmentId={removingSavedEnvironmentId}
1838 - onSetEnabled={handleSetSavedBackendEnabled}
1839 - onRemove={handleRemoveSavedBackend}
1840 - onAddRoute={(target) => {
1841 - setRouteTarget(target);
1842 - setSavedBackendError(null);
1843 - setAddBackendDialogOpen(true);
1844 - }}
1876 + {environmentsView === "map" ? (
1877 + <EnvironmentsMap
1878 + footerId={searchableSetting("linked-environments").id}
1879 + onAddEnvironment={openAddEnvironment}
1880 + renderSavedEnvironment={(environment) =>
1881 + listedEnvironments.some(
1882 + (listed) => listed.environmentId === environment.environmentId,
1883 + ) ? (
1884 + <SavedBackendListRow
1885 + key={environment.environmentId}
1886 + environment={environment}
1887 + initialRoutesOpen
1888 + removingEnvironmentId={removingSavedEnvironmentId}
1889 + onSetEnabled={handleSetSavedBackendEnabled}
1890 + onRemove={handleRemoveSavedBackend}
1891 + onAddRoute={openAddRoute}
1892 + />
1893 + ) : null
1894 + }
1895 + renderConnectMachine={(environmentId) => (
1896 + <CloudRemoteEnvironmentRows
1897 + only={environmentId}
1898 + primaryEnvironmentId={primaryEnvironmentId}
1899 + savedEnvironments={savedEnvironments}
1900 + />
1901 + )}
1902 />
1846 - ))}
1847 - <CloudRemoteEnvironmentRows
1848 - primaryEnvironmentId={primaryEnvironmentId}
1849 - savedEnvironments={savedEnvironments}
1850 - />
1903 + ) : (
1904 + <>
1905 + {listedEnvironments.map((environment) => (
1906 + <SavedBackendListRow
1907 + key={environment.environmentId}
1908 + environment={environment}
1909 + removingEnvironmentId={removingSavedEnvironmentId}
1910 + onSetEnabled={handleSetSavedBackendEnabled}
1911 + onRemove={handleRemoveSavedBackend}
1912 + onAddRoute={openAddRoute}
1913 + />
1914 + ))}
1915 + <CloudRemoteEnvironmentRows
1916 + primaryEnvironmentId={primaryEnvironmentId}
1917 + savedEnvironments={savedEnvironments}
1918 + />
1919 + </>
1920 + )}
1921 </SettingsSection>
1922 {hasCloudPublicConfig() ? (
1923 <RemoveT3ConnectEnvironmentDialog
@@ -1861,14 +1931,16 @@ function ConnectionsSettingsContent({
1931 }}
1932 />
1933 ) : null}
1864 - {peerLinkHosts.map((environment, index) => (
1865 - <LinkedEnvironmentsSettings
1866 - key={environment.environmentId}
1867 - environmentId={environment.environmentId}
1868 - environmentLabel={peerLinkHosts.length > 1 ? environment.label : null}
1869 - isSearchTarget={index === 0}
1870 - />
1871 - ))}
1934 + {environmentsView === "list"
1935 + ? peerLinkHosts.map((environment, index) => (
1936 + <LinkedEnvironmentsSettings
1937 + key={environment.environmentId}
1938 + environmentId={environment.environmentId}
1939 + environmentLabel={peerLinkHosts.length > 1 ? environment.label : null}
1940 + isSearchTarget={index === 0}
1941 + />
1942 + ))
1943 + : null}
1944 <LoadBalancingSettings environments={loadBalancingEnvironments} />
1945 <PullRequestRoutingSettings environments={loadBalancingEnvironments} />
1946 </SettingsPageContainer>
apps/web/src/components/settings/EnvironmentRoutesList.browser.test.tsx
+1 -1
@@ -76,7 +76,7 @@ it("shows a route added after a reorder was saved, once another route is removed
76 await userEvent.keyboard("{ArrowDown}");
77 await userEvent.keyboard(" ");
78 await expect
79 - .element(screen.getByRole("button", { name: "Reorder Tailscale, position 1" }))
79 + .element(screen.getByRole("button", { name: "Reorder Tailscale HTTPS, position 1" }))
80 .toBeVisible();
81
82 await screen.rerender(routesList([TAILNET, LAN]));
apps/web/src/components/settings/EnvironmentsMap.tsx new
+2273
@@ -0,0 +1,2273 @@
1 +import { RegistryContext, useAtomValue } from "@effect/atom-react";
2 +import {
3 + type ConnectionRouteKind,
4 + connectionRouteId,
5 + connectionRouteKind,
6 + connectionRouteLabelText,
7 + connectionRoutes,
8 + routeHttpBaseUrl,
9 +} from "@t3tools/client-runtime/connection";
10 +import {
11 + ANOTHER_ADDRESS,
12 + linkableMachines,
13 + offersLinkedEnvironments,
14 +} from "@t3tools/client-runtime/link-request";
15 +import { thrownErrorMessage } from "@t3tools/client-runtime/errors";
16 +import type { PeerLinkHealth } from "@t3tools/client-runtime/state/peerLinks";
17 +import { AuthAccessWriteScope, type EnvironmentId } from "@t3tools/contracts";
18 +import * as DateTime from "effect/DateTime";
19 +import * as Option from "effect/Option";
20 +import { useGT, useMessages } from "gt-react";
21 +import {
22 + AppWindowIcon,
23 + ArrowUpDownIcon,
24 + CheckIcon,
25 + CircleHelpIcon,
26 + CloudIcon,
27 + GlobeIcon,
28 + MaximizeIcon,
29 + MinusIcon,
30 + PlusIcon,
31 + SearchIcon,
32 + TriangleAlertIcon,
33 + UnfoldVerticalIcon,
34 + FoldVerticalIcon,
35 + XIcon,
36 +} from "lucide-react";
37 +import {
38 + memo,
39 + type FocusEvent,
40 + type KeyboardEvent,
41 + type MouseEvent,
42 + type PointerEvent,
43 + type ReactNode,
44 + useContext,
45 + useEffect,
46 + useEffectEvent,
47 + useRef,
48 + useState,
49 +} from "react";
50 +
51 +import { hasCloudPublicConfig } from "~/cloud/publicConfig";
52 +import { isElectron } from "~/env";
53 +import { useLiveRefresh } from "~/hooks/useLiveRefresh";
54 +import { useNowMinute } from "~/hooks/useNowMinute";
55 +import { useStableCallback } from "~/hooks/useStableCallback";
56 +import { observeResize } from "~/lib/observeResize";
57 +import { cn } from "~/lib/utils";
58 +import {
59 + type EnvironmentPresentation,
60 + useEnvironments,
61 + useRelayEnvironmentDiscovery,
62 + useRetainedRelayEnvironments,
63 +} from "~/state/environments";
64 +import { environmentIdsKey } from "~/state/environmentAtomList";
65 +import { peerLinkEnvironment, peerLinkListsAtom, usePeerLinkHosts } from "~/state/peerLinks";
66 +import { formatEnvironmentQueryError } from "~/state/query";
67 +import { relayEnvironmentDiscovery } from "~/state/relay";
68 +import { preparedConnectionsAtom, useEnvironmentsWithScope } from "~/state/session";
69 +import { useAtomCommand } from "~/state/use-atom-command";
70 +import { accessConfig } from "../auth/ConnectAgentSurface";
71 +import { connectionPhaseDotClassName } from "../ConnectionStatusDot";
72 +import { EnvironmentMachineIcon } from "../EnvironmentMachineIcon";
73 +import { Button } from "../ui/button";
74 +import { InputGroup, InputGroupAddon, InputGroupInput } from "../ui/input-group";
75 +import { Menu, MenuItem, MenuPopup, MenuTrigger } from "../ui/menu";
76 +import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
77 +import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
78 +import {
79 + buildFleetGraph,
80 + anchorFleetView,
81 + fitFleetLayout,
82 + fleetCanvasHeight,
83 + FLEET_CLIENT_NODE_ID,
84 + fleetDrawnLinkId,
85 + fleetEnvironmentNodeId,
86 + fleetFocusRects,
87 + fleetLinkAction,
88 + fleetLinkOffer,
89 + fleetMoreNodeId,
90 + fleetNeighborhood,
91 + fleetNodesInBox,
92 + fleetSearch,
93 + fleetLayoutWidth,
94 + fleetShapeKey,
95 + fleetStackPartial,
96 + fleetStacks,
97 + fleetTwoWayLinks,
98 + type FleetArrow,
99 + type FleetColumn,
100 + type FleetDirection,
101 + type FleetEnvironmentInput,
102 + type FleetEnvironmentNode,
103 + type FleetFocus,
104 + type FleetFoldGroup,
105 + type FleetGraph,
106 + type FleetHeldView,
107 + type FleetLayout,
108 + type FleetLinkAction,
109 + type FleetLinkEdge,
110 + type FleetLinkOffer,
111 + type FleetNode,
112 + type FleetRect,
113 + type FleetRouteEdge,
114 + type FleetRouteState,
115 + type FleetStack,
116 + type FleetViewTransform,
117 + isLinkEdge,
118 + isRouteEdge,
119 + layoutFleetGraph,
120 + linkNeedsAttention,
121 + linkTroubleRank,
122 + worseLinkHealth,
123 + zoomFleetView,
124 + nextFleetNode,
125 +} from "./environmentsMap.logic";
126 +import {
127 + AccessMeter,
128 + accessLevel,
129 + FleetDetails,
130 + type FleetDetailsProps,
131 + HealthGlyph,
132 + healthLabel,
133 + healthTone,
134 +} from "./EnvironmentsMapDetails";
135 +import { LinkEnvironmentDialog, type LinkEnvironmentPrefill } from "./LinkedEnvironmentsSettings";
136 +import { LinkSeveralEnvironmentsDialog } from "./LinkSeveralEnvironments";
137 +import { savedBackendStatus } from "./SavedEnvironmentRows";
138 +import { SettingsSearchTarget } from "./settingsLayout";
139 +
140 +type GT = ReturnType<typeof useGT>;
141 +type Messages = ReturnType<typeof useMessages>;
142 +
143 +/** One ordinal scale for access, read only to full access: a link's line gets heavier and darker. */
144 +const ACCESS_STROKE_WIDTHS = [1.25, 1.75, 2.25, 2.75, 3.5];
145 +const ACCESS_STROKE_OPACITIES = [0.4, 0.5, 0.62, 0.76, 0.9];
146 +/** Short maps get a short canvas; a tall one grows to this, then the fit shrinks it or it pans. */
147 +const CANVAS_HEIGHT = { min: 180, max: 840 };
148 +const ARROW_ROVE: Record<string, FleetDirection> = {
149 + ArrowUp: "up",
150 + ArrowDown: "down",
151 + ArrowLeft: "left",
152 + ArrowRight: "right",
153 +};
154 +const NO_STACKS: ReadonlySet<string> = new Set();
155 +const NO_SELECTION: ReadonlySet<string> = new Set();
156 +/** Search centres a machine at a scale it can be read at, however far out the map was. */
157 +const FOUND_MIN_SCALE = 0.85;
158 +
159 +/** What an opened stack adds fades in over the same time the view takes to make room for it. */
160 +const APPEAR =
161 + "transition-opacity duration-200 ease-out starting:opacity-0 motion-reduce:transition-none";
162 +
163 +/** Dashes repeat a link's health without colour, one pattern per kind of trouble. */
164 +function healthDash(health: PeerLinkHealth): string | undefined {
165 + if (health.kind === "expired") return "1 5";
166 + if (health.kind === "failing") return "8 3 1 3";
167 + return health.kind === "unreachable" ? "5 4" : undefined;
168 +}
169 +
170 +/** Worst first: a machine several hosts link to wears the health of its most troubled link. */
171 +const byTrouble = (left: FleetLinkEdge, right: FleetLinkEdge) =>
172 + linkTroubleRank(left.health) - linkTroubleRank(right.health);
173 +
174 +/** A machine's outline carries its link's health too. */
175 +function healthBorder(health: PeerLinkHealth): string {
176 + if (health.kind === "expired") return "border-dotted border-destructive/70";
177 + if (health.kind === "failing") return "border-destructive/70";
178 + if (health.kind === "unreachable") return "border-dashed border-foreground/35";
179 + return health.expiresInDays === null ? "border-border" : "border-warning/70";
180 +}
181 +
182 +/** How each route state is drawn: the one in use stands out, the rest stay quiet. */
183 +const ROUTE_STYLES: Record<
184 + FleetRouteState,
185 + { readonly wire: string; readonly width: number; readonly dash?: string; readonly pill: string }
186 +> = {
187 + "in-use": {
188 + wire: "text-success",
189 + width: 1.75,
190 + pill: "border-success/70 font-medium text-foreground",
191 + },
192 + standby: { wire: "text-muted-foreground/60", width: 1, pill: "border-border" },
193 + trying: { wire: "text-warning", width: 1, dash: "1 4", pill: "border-warning/60" },
194 + down: { wire: "text-muted-foreground/60", width: 1, dash: "4 4", pill: "border-dashed" },
195 + idle: { wire: "text-muted-foreground/40", width: 1, dash: "4 4", pill: "border-dashed" },
196 + refused: {
197 + wire: "text-destructive/80",
198 + width: 1,
199 + dash: "4 4",
200 + pill: "border-dashed border-destructive/60 text-destructive",
201 + },
202 + offered: { wire: "text-muted-foreground/50", width: 1, dash: "1 4", pill: "border-dotted" },
203 +};
204 +
205 +function routeKindLabel(kind: ConnectionRouteKind, gt: GT): string {
206 + switch (kind) {
207 + case "relay":
208 + return "T3 Connect";
209 + case "loopback":
210 + return gt("This device");
211 + case "lan":
212 + return "LAN";
213 + case "tailnet":
214 + return "Tailscale";
215 + case "vpn":
216 + return "VPN";
217 + case "ssh":
218 + return "SSH";
219 + case "public":
220 + return gt("Public", { $context: "kind of network route: a public internet address" });
221 + }
222 +}
223 +
224 +function routeStateLabel(state: FleetRouteState, gt: GT): string {
225 + switch (state) {
226 + case "in-use":
227 + return gt("In use");
228 + case "standby":
229 + return gt("Standby", { $context: "a network route that is saved but not carrying traffic" });
230 + case "trying":
231 + return gt("Connecting");
232 + case "down":
233 + return gt("Not connected");
234 + case "idle":
235 + return gt("Not in use");
236 + case "refused":
237 + return gt("Sign-in refused");
238 + case "offered":
239 + return gt("Not added");
240 + }
241 +}
242 +
243 +/** Asks T3 Connect for the account's machines once, as the list's own rows do on mount. */
244 +function useConnectMachines() {
245 + const gt = useGT();
246 + const m = useMessages();
247 + const discovery = useRelayEnvironmentDiscovery();
248 + const refresh = useAtomCommand(relayEnvironmentDiscovery.refresh, { reportFailure: false });
249 + const discoverIfUnasked = useEffectEvent(() => {
250 + if (hasCloudPublicConfig() && !discovery.listed && !discovery.refreshing) void refresh();
251 + });
252 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- one T3 Connect listing when the map mounts, the request the list makes on mount
253 + useEffect(() => {
254 + discoverIfUnasked();
255 + }, []);
256 + const machines = useRetainedRelayEnvironments();
257 + // A failed listing is not an account with no machines: say so, with a way to ask again.
258 + const message = discovery.refreshing
259 + ? null
260 + : discovery.offline && !discovery.listed
261 + ? gt("You appear to be offline.")
262 + : thrownErrorMessage(Option.getOrNull(discovery.error), m);
263 + return {
264 + machines,
265 + problem: message === null ? null : { message, retry: () => void refresh() },
266 + };
267 +}
268 +
269 +function useFleetGraph() {
270 + const gt = useGT();
271 + const m = useMessages();
272 + const { environments } = useEnvironments();
273 + const hosts = usePeerLinkHosts();
274 + const nowMinute = useNowMinute();
275 + const hostsKey = environmentIdsKey(hosts.map((host) => host.environmentId));
276 + const lists = useAtomValue(peerLinkListsAtom(hostsKey));
277 + const registry = useContext(RegistryContext);
278 + // Links made from another client or the CLI bump nothing these lists read, so coming back to
279 + // the window asks again, as the list view does, and so does a change in which machines can be
280 + // asked. Listing probes every linked machine: too costly for a timer.
281 + useLiveRefresh(
282 + () => {
283 + for (const host of hosts) {
284 + const list = peerLinkEnvironment.list({ environmentId: host.environmentId, input: {} });
285 + if (!registry.get(list).waiting) registry.refresh(list);
286 + }
287 + },
288 + { key: `environments-map:${hostsKey}`, intervalMs: null, refreshOnShow: true },
289 + );
290 + const prepared = useAtomValue(
291 + preparedConnectionsAtom(
292 + environmentIdsKey(environments.map((environment) => environment.environmentId)),
293 + ),
294 + );
295 + const writable = useEnvironmentsWithScope(environments, AuthAccessWriteScope);
296 + const { machines: connect, problem: connectProblem } = useConnectMachines();
297 + const machines = linkableMachines({
298 + environments,
299 + threadEnvironmentId: null,
300 + links: [],
301 + connect,
302 + });
303 + const machineById = new Map(machines.map((machine) => [machine.environmentId, machine]));
304 + const listByHost = new Map(hosts.map((host, index) => [host.environmentId, lists[index]]));
305 + const inputs = environments.map((environment, index): FleetEnvironmentInput => {
306 + const list = listByHost.get(environment.environmentId);
307 + const connected = environment.connection.phase === "connected";
308 + const active = connected ? Option.getOrNull(prepared[index] ?? Option.none()) : null;
309 + const offersLinks = offersLinkedEnvironments(environment.serverConfig);
310 + return {
311 + environmentId: environment.environmentId,
312 + label: environment.label,
313 + machine: machineById.get(environment.environmentId)?.machine ?? null,
314 + phase: environment.connection.phase,
315 + enabled: environment.entry.enabled,
316 + routes: connectionRoutes(environment.entry).map((route) => ({
317 + id: connectionRouteId(route.target),
318 + kind: connectionRouteKind(route),
319 + ...(connectionRouteKind(route) === "tailnet" &&
320 + routeHttpBaseUrl(route)?.startsWith("https:") === true
321 + ? { label: connectionRouteLabelText(route, m) }
322 + : {}),
323 + })),
324 + activeRouteId: active === null ? null : connectionRouteId(active.target),
325 + refusedRouteIds: environment.refusedRouteIds,
326 + offersLinks,
327 + canWriteAccess: writable.has(environment.environmentId),
328 + hasLinkAddress: (machineById.get(environment.environmentId)?.urls.length ?? 0) > 0,
329 + outgoing:
330 + list === undefined
331 + ? { state: connected && !offersLinks ? "off" : "unknown" }
332 + : list._tag === "Success"
333 + ? { state: "loaded", links: list.value.links }
334 + : list._tag === "Failure"
335 + ? { state: "error", message: formatEnvironmentQueryError(list.cause, m) }
336 + : { state: "loading" },
337 + };
338 + });
339 + const graph = buildFleetGraph({
340 + clientLabel: isElectron ? gt("This device") : gt("This browser"),
341 + environments: inputs,
342 + connectMachines: machines
343 + .filter((machine) => machine.connectOnly)
344 + .map((machine) => ({
345 + environmentId: machine.environmentId,
346 + label: machine.label,
347 + machine: machine.machine,
348 + availability: connect.get(machine.environmentId)?.availability ?? "checking",
349 + })),
350 + now: DateTime.makeUnsafe(nowMinute),
351 + });
352 + return { graph, environments, connectProblem };
353 +}
354 +
355 +/**
356 + * The layout for the graph's current shape at the canvas's width; a health or status change
357 + * reuses the last one.
358 + */
359 +function useFleetLayout(
360 + graph: FleetGraph,
361 + stacks: ReadonlyArray<FleetStack>,
362 + shapeKey: string,
363 + canvasWidth: number | null,
364 +) {
365 + const width = canvasWidth === null ? undefined : fleetLayoutWidth(canvasWidth);
366 + const key = `${shapeKey}\n${width}`;
367 + const [laid, setLaid] = useState(() => ({ key, layout: layoutFleetGraph(graph, stacks, width) }));
368 + if (laid.key === key) return laid;
369 + const next = { key, layout: layoutFleetGraph(graph, stacks, width) };
370 + setLaid(next);
371 + return next;
372 +}
373 +
374 +interface LinkRequest {
375 + readonly serial: number;
376 + readonly environmentId: EnvironmentId;
377 + readonly prefill: LinkEnvironmentPrefill;
378 + readonly open: boolean;
379 +}
380 +
381 +interface BatchRequest {
382 + readonly serial: number;
383 + readonly environmentId: EnvironmentId;
384 + readonly preset: ReadonlyArray<EnvironmentId>;
385 + /** The machines were dropped on or selected for this link, so the dialog lists only them. */
386 + readonly presetOnly: boolean;
387 + readonly open: boolean;
388 +}
389 +
390 +/** A drop the client cannot link in one go, explained where it happened. */
391 +type CodeOnlyDrop = Extract<FleetLinkAction, { kind: "code-only" }>;
392 +
393 +/**
394 + * Every machine this app knows about, how it reaches each one, and which of them are linked.
395 + * Selecting a machine shows the controls the list has for it.
396 + */
397 +export function EnvironmentsMap(
398 + props: Pick<
399 + FleetDetailsProps,
400 + "renderSavedEnvironment" | "renderConnectMachine" | "onAddEnvironment"
401 + > & { readonly footerId?: string },
402 +) {
403 + const { graph, environments, connectProblem } = useFleetGraph();
404 + const [expanded, setExpanded] = useState(NO_STACKS);
405 + const stacks = fleetStacks(graph, expanded);
406 + const key = fleetShapeKey(graph, stacks);
407 + const [picked, setPicked] = useState<FleetFocus | null>(null);
408 + // Machines ticked for a batch link: apart from `picked`, which is what the details show.
409 + const [ticked, setTicked] = useState(NO_SELECTION);
410 + // The machine a search landed on inside a stack, for the stack's list to scroll to.
411 + const [found, setFound] = useState<string | null>(null);
412 + const [linkRequest, setLinkRequest] = useState<LinkRequest | null>(null);
413 + const [batchRequest, setBatchRequest] = useState<BatchRequest | null>(null);
414 + const [dropped, setDropped] = useState<CodeOnlyDrop | null>(null);
415 + const pairs = fleetTwoWayLinks(graph);
416 + const present =
417 + picked === null
418 + ? null
419 + : (picked.kind === "stack"
420 + ? stacks
421 + : picked.kind === "node"
422 + ? graph.nodes
423 + : graph.edges
424 + ).some((item) => item.id === picked.id)
425 + ? picked
426 + : null;
427 + // Either link of a two-way link selects the one line drawn for both.
428 + const selection =
429 + present?.kind === "edge" ? { ...present, id: fleetDrawnLinkId(pairs, present.id) } : present;
430 + // A machine that left the map leaves the selection with it.
431 + const selected =
432 + ticked.size === 0
433 + ? NO_SELECTION
434 + : new Set(graph.nodes.filter((node) => ticked.has(node.id)).map((node) => node.id));
435 + const toggleStack = (stackId: string) =>
436 + setExpanded((current) => {
437 + const next = new Set(current);
438 + if (!next.delete(stackId)) next.add(stackId);
439 + return next;
440 + });
441 + const tick = (ids: ReadonlyArray<string>, mode: "toggle" | "add") =>
442 + setTicked((current) => {
443 + const next = new Set(current);
444 + for (const id of ids) {
445 + if (mode === "toggle" && next.delete(id)) continue;
446 + next.add(id);
447 + }
448 + return next;
449 + });
450 + const openLinkDialog = (
451 + environmentId: EnvironmentId,
452 + offer: Extract<FleetLinkOffer, { kind: "link" }> | null,
453 + ) => {
454 + setDropped(null);
455 + setLinkRequest((current) => ({
456 + serial: (current?.serial ?? 0) + 1,
457 + environmentId,
458 + open: true,
459 + prefill:
460 + offer === null
461 + ? { choice: null }
462 + : offer.target.kind === "machine"
463 + ? { choice: offer.target.environmentId }
464 + : { choice: ANOTHER_ADDRESS, address: offer.target.address ?? "" },
465 + }));
466 + };
467 + /** One link from `sourceId` to `targetId`, whatever is selected. */
468 + const requestOneLink = (sourceId: string, targetId: string) => {
469 + const offer = fleetLinkOffer(graph, sourceId, targetId);
470 + if (offer.kind === "link") openLinkDialog(offer.sourceEnvironmentId, offer);
471 + };
472 + // One way in for every gesture: the handle, a drop, the details and the toolbar.
473 + const requestLink = (sourceId: string, targetId: string | null) => {
474 + const action = fleetLinkAction(graph, stacks, selected, sourceId, targetId);
475 + if (action === null) return;
476 + if (action.kind === "code-only") {
477 + setDropped(action);
478 + return;
479 + }
480 + if (action.kind === "batch") {
481 + setDropped(null);
482 + setBatchRequest((current) => ({
483 + serial: (current?.serial ?? 0) + 1,
484 + environmentId: action.sourceEnvironmentId,
485 + preset: action.environmentIds,
486 + presetOnly: true,
487 + open: true,
488 + }));
489 + return;
490 + }
491 + openLinkDialog(action.sourceEnvironmentId, action.offer);
492 + };
493 + const requestBatch = (sourceId: string) => {
494 + const source = graph.nodes.find((node) => node.id === sourceId);
495 + if (source?.kind !== "environment" || source.linking !== "ready") return;
496 + const action = fleetLinkAction(graph, stacks, selected, sourceId, null);
497 + setDropped(null);
498 + setBatchRequest((current) => ({
499 + serial: (current?.serial ?? 0) + 1,
500 + environmentId: source.environmentId,
501 + preset: action?.kind === "batch" ? action.environmentIds : [],
502 + presetOnly: false,
503 + open: true,
504 + }));
505 + };
506 + const select = (focus: FleetFocus | null) => {
507 + setPicked(focus);
508 + setFound(null);
509 + };
510 + return (
511 + <>
512 + <FleetCanvas
513 + graph={graph}
514 + stacks={stacks}
515 + shapeKey={key}
516 + environments={environments}
517 + selection={selection}
518 + selected={selected}
519 + onSelect={select}
520 + onTick={tick}
521 + onClearTicked={() => setTicked(NO_SELECTION)}
522 + onLink={requestLink}
523 + onLinkSeveral={requestBatch}
524 + dropped={dropped}
525 + onLinkOne={requestOneLink}
526 + onDismissDropped={() => setDropped(null)}
527 + onToggleStack={toggleStack}
528 + onFind={(stackId, memberId) => {
529 + setPicked({ kind: "stack", id: stackId });
530 + setFound(memberId);
531 + }}
532 + />
533 + <SettingsSearchTarget id={props.footerId}>
534 + <FleetDetails
535 + {...props}
536 + graph={graph}
537 + stacks={stacks}
538 + environments={environments}
539 + connectProblem={connectProblem}
540 + selection={selection}
541 + found={found}
542 + onSelect={select}
543 + onLinkFrom={(sourceId) => requestLink(sourceId, null)}
544 + onLinkBack={(edge) => requestOneLink(edge.to, edge.from)}
545 + onToggleStack={toggleStack}
546 + />
547 + </SettingsSearchTarget>
548 + {linkRequest ? (
549 + <LinkEnvironmentDialog
550 + key={linkRequest.serial}
551 + environmentId={linkRequest.environmentId}
552 + open={linkRequest.open}
553 + prefill={linkRequest.prefill}
554 + onOpenChange={(open) =>
555 + setLinkRequest((current) => (current === null ? null : { ...current, open }))
556 + }
557 + />
558 + ) : null}
559 + {batchRequest ? (
560 + <LinkSeveralEnvironmentsDialog
561 + key={batchRequest.serial}
562 + environmentId={batchRequest.environmentId}
563 + open={batchRequest.open}
564 + preset={batchRequest.preset}
565 + presetOnly={batchRequest.presetOnly}
566 + onOpenChange={(open) =>
567 + setBatchRequest((current) => (current === null ? null : { ...current, open }))
568 + }
569 + />
570 + ) : null}
571 + </>
572 + );
573 +}
574 +
575 +interface FleetSceneProps {
576 + readonly graph: FleetGraph;
577 + readonly stacks: ReadonlyArray<FleetStack>;
578 + readonly layout: FleetLayout;
579 + readonly environments: ReadonlyArray<EnvironmentPresentation>;
580 + readonly selection: FleetFocus | null;
581 + /** Machines ticked for a batch link. */
582 + readonly selected: ReadonlySet<string>;
583 + readonly onSelect: (focus: FleetFocus | null) => void;
584 + readonly onTick: (ids: ReadonlyArray<string>, mode: "toggle" | "add") => void;
585 + readonly onLink: (sourceId: string, targetId: string | null) => void;
586 + readonly onToggleStack: (stackId: string) => void;
587 +}
588 +
589 +interface FleetCanvasProps extends Omit<FleetSceneProps, "layout"> {
590 + /** The graph's shape. The canvas lays it out at its own width. */
591 + readonly shapeKey: string;
592 + readonly onClearTicked: () => void;
593 + readonly onLinkSeveral: (sourceId: string) => void;
594 + readonly dropped: CodeOnlyDrop | null;
595 + readonly onLinkOne: (sourceId: string, targetId: string) => void;
596 + readonly onDismissDropped: () => void;
597 + /** A search landed on a machine drawn only inside a stack. */
598 + readonly onFind: (stackId: string, memberId: string) => void;
599 +}
600 +
601 +function FleetCanvas({
602 + shapeKey: graphKey,
603 + onClearTicked,
604 + onLinkSeveral,
605 + dropped,
606 + onLinkOne,
607 + onDismissDropped,
608 + onFind,
609 + ...scene
610 +}: FleetCanvasProps) {
611 + const gt = useGT();
612 + const { graph, stacks, selection, selected, onSelect, onTick } = scene;
613 + const [canvas, setCanvas] = useState<HTMLDivElement | null>(null);
614 + const [width, setWidth] = useState<number | null>(null);
615 + const { key: layoutKey, layout } = useFleetLayout(graph, stacks, graphKey, width);
616 + const [query, setQuery] = useState("");
617 + // A held view lasts while the map keeps its shape, whatever the width; otherwise it fits itself.
618 + const [manual, setManual] = useState<FleetHeldView | null>(null);
619 + // What was last drawn, to tell a stack opening or closing from any other change of shape.
620 + const [drawn, setDrawn] = useState({ graphKey, layoutKey, layout, stacks });
621 + const [dragging, setDragging] = useState(false);
622 + // The selection box, in canvas pixels, while Shift is held through a drag on empty canvas.
623 + const [box, setBox] = useState<FleetRect | null>(null);
624 + const drag = useRef<{
625 + readonly pointerId: number;
626 + readonly key: string;
627 + readonly mode: "pan" | "box";
628 + readonly x: number;
629 + readonly y: number;
630 + readonly left: number;
631 + readonly top: number;
632 + readonly origin: FleetViewTransform;
633 + moved: boolean;
634 + } | null>(null);
635 + if (drawn.layoutKey !== layoutKey) {
636 + setDrawn({ graphKey, layoutKey, layout, stacks });
637 + if (drawn.graphKey !== graphKey) {
638 + const toggled = stacks.find((stack) =>
639 + drawn.stacks.some((was) => was.id === stack.id && was.expanded !== stack.expanded),
640 + );
641 + const before = toggled === undefined ? undefined : drawn.layout.stacks.get(toggled.id);
642 + const after = toggled === undefined ? undefined : layout.stacks.get(toggled.id);
643 + if (width !== null && before !== undefined && after !== undefined) {
644 + // The stack stays where it is and the rest makes room, in the one render that opens it.
645 + const was = manual?.key === drawn.graphKey ? manual : null;
646 + const from = {
647 + width,
648 + height: was?.height ?? fleetCanvasHeight(drawn.layout, width, CANVAS_HEIGHT),
649 + };
650 + setManual(
651 + anchorFleetView({
652 + key: graphKey,
653 + from: {
654 + key: drawn.graphKey,
655 + held: was,
656 + view: was?.view ?? fitFleetLayout(drawn.layout, from),
657 + size: from,
658 + face: before.face,
659 + },
660 + stack: after,
661 + layout,
662 + bounds: CANVAS_HEIGHT,
663 + }),
664 + );
665 + } else if (manual !== null && manual.key !== "") {
666 + // Any other new shape drops the held view for good: returning to an old shape must
667 + // fit, not restore a pan made before the map changed.
668 + setManual({ ...manual, key: "" });
669 + }
670 + }
671 + }
672 + const held = manual?.key === graphKey ? manual : null;
673 + // Not measured: the height follows from the layout and the view, so it never feeds back.
674 + const size =
675 + width === null
676 + ? null
677 + : { width, height: held?.height ?? fleetCanvasHeight(layout, width, CANVAS_HEIGHT) };
678 + const view = held?.view ?? (size === null ? null : fitFleetLayout(layout, size));
679 + const glide = manual !== null && (held === null || held.glide);
680 + const setView = (next: FleetViewTransform, eased: boolean) => {
681 + if (size === null) return;
682 + setManual({ key: graphKey, view: next, height: size.height, glide: eased, undo: null });
683 + };
684 + const zoom = (
685 + factor: number,
686 + anchor?: { readonly x: number; readonly y: number },
687 + eased = true,
688 + ) => {
689 + if (view === null || size === null) return;
690 + setView(
691 + zoomFleetView(
692 + view,
693 + factor,
694 + anchor ?? { x: size.width / 2, y: size.height / 2 },
695 + fitFleetLayout(layout, size).scale,
696 + ),
697 + eased,
698 + );
699 + };
700 + // Keeps the entry so the scene eases back to the fit; its stale key marks it as not held.
701 + const fit = () => setManual((current) => (current === null ? null : { ...current, key: "" }));
702 + const onWheel = useEffectEvent((event: WheelEvent) => {
703 + // Plain scrolling stays the page's; a pinch or Ctrl/Cmd + wheel zooms the map.
704 + if (!event.ctrlKey && !event.metaKey) return;
705 + event.preventDefault();
706 + const bounds = (event.currentTarget as HTMLElement).getBoundingClientRect();
707 + zoom(
708 + Math.exp(-event.deltaY * 0.01),
709 + { x: event.clientX - bounds.left, y: event.clientY - bounds.top },
710 + false,
711 + );
712 + });
713 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the canvas with ResizeObserver, and React's wheel listener is passive so it cannot stop the page zooming
714 + useEffect(() => {
715 + if (canvas === null) return;
716 + const stopObserving = observeResize(canvas, ([entry]) => {
717 + if (entry) setWidth(entry.contentRect.width);
718 + });
719 + canvas.addEventListener("wheel", onWheel, { passive: false });
720 + return () => {
721 + stopObserving();
722 + canvas.removeEventListener("wheel", onWheel);
723 + };
724 + }, [canvas]);
725 +
726 + // Reads the view inside the updater so the scene's props stay the same while panning.
727 + const reveal = useStableCallback((rect: FleetRect) => {
728 + if (size === null) return;
729 + setManual((current) => {
730 + const shown = current?.key === graphKey ? current.view : fitFleetLayout(layout, size);
731 + const left = rect.x * shown.scale + shown.x;
732 + const top = rect.y * shown.scale + shown.y;
733 + const inside =
734 + left >= 0 &&
735 + top >= 0 &&
736 + left + rect.width * shown.scale <= size.width &&
737 + top + rect.height * shown.scale <= size.height;
738 + if (inside) return current;
739 + return {
740 + key: graphKey,
741 + height: size.height,
742 + glide: true,
743 + undo: null,
744 + view: {
745 + scale: shown.scale,
746 + x: size.width / 2 - (rect.x + rect.width / 2) * shown.scale,
747 + y: size.height / 2 - (rect.y + rect.height / 2) * shown.scale,
748 + },
749 + };
750 + });
751 + });
752 + const centre = (rect: FleetRect) => {
753 + if (size === null || view === null) return;
754 + const scale = Math.max(view.scale, FOUND_MIN_SCALE);
755 + setView(
756 + {
757 + scale,
758 + x: size.width / 2 - (rect.x + rect.width / 2) * scale,
759 + y: size.height / 2 - (rect.y + rect.height / 2) * scale,
760 + },
761 + true,
762 + );
763 + };
764 +
765 + const matchIds = fleetSearch(graph, query);
766 + const matches = query.trim() === "" ? null : new Set(matchIds);
767 + const goToFirstMatch = () => {
768 + const first = matchIds[0];
769 + if (first === undefined) return;
770 + const rect = layout.nodes.get(first);
771 + if (rect !== undefined) {
772 + onSelect({ kind: "node", id: first });
773 + centre(rect);
774 + canvas
775 + ?.querySelector<HTMLElement>(`[data-fleet-node="${CSS.escape(first)}"]`)
776 + ?.focus({ preventScroll: true });
777 + return;
778 + }
779 + // Folded away: its stack's list in the details scrolls to it.
780 + const stack = stacks.find((entry) => entry.memberIds.includes(first));
781 + const face = stack === undefined ? undefined : layout.stacks.get(stack.id)?.face;
782 + if (stack === undefined || face === undefined) return;
783 + onFind(stack.id, first);
784 + centre(face);
785 + };
786 +
787 + const onPointerDown = (event: PointerEvent<HTMLDivElement>) => {
788 + // One pointer owns a drag: a second finger neither restarts it nor ends it.
789 + if (event.button !== 0 || view === null || drag.current !== null) return;
790 + if ((event.target as Element).closest("[data-fleet-item]")) return;
791 + const bounds = event.currentTarget.getBoundingClientRect();
792 + drag.current = {
793 + pointerId: event.pointerId,
794 + key: layoutKey,
795 + mode: event.shiftKey ? "box" : "pan",
796 + x: event.clientX,
797 + y: event.clientY,
798 + left: bounds.left,
799 + top: bounds.top,
800 + origin: view,
801 + moved: false,
802 + };
803 + event.currentTarget.setPointerCapture(event.pointerId);
804 + };
805 + const boxAt = (current: NonNullable<typeof drag.current>, event: PointerEvent): FleetRect => ({
806 + x: Math.min(current.x, event.clientX) - current.left,
807 + y: Math.min(current.y, event.clientY) - current.top,
808 + width: Math.abs(event.clientX - current.x),
809 + height: Math.abs(event.clientY - current.y),
810 + });
811 + const onPointerMove = (event: PointerEvent<HTMLDivElement>) => {
812 + const current = drag.current;
813 + if (current === null || current.pointerId !== event.pointerId) return;
814 + // The map was laid out again mid-drag, so the origin belongs to a view that is gone.
815 + if (current.key !== layoutKey) {
816 + drag.current = null;
817 + setDragging(false);
818 + setBox(null);
819 + return;
820 + }
821 + const dx = event.clientX - current.x;
822 + const dy = event.clientY - current.y;
823 + if (!current.moved && Math.hypot(dx, dy) < 4) return;
824 + current.moved = true;
825 + if (current.mode === "box") {
826 + setBox(boxAt(current, event));
827 + return;
828 + }
829 + setDragging(true);
830 + setView({ ...current.origin, x: current.origin.x + dx, y: current.origin.y + dy }, false);
831 + };
832 + const endDrag = (event: PointerEvent<HTMLDivElement>, cancelled: boolean) => {
833 + const current = drag.current;
834 + if (current === null || current.pointerId !== event.pointerId) return;
835 + drag.current = null;
836 + setDragging(false);
837 + setBox(null);
838 + if (cancelled) return;
839 + if (!current.moved) {
840 + if (current.mode === "pan") onSelect(null);
841 + return;
842 + }
843 + if (current.mode !== "box" || current.key !== layoutKey) return;
844 + const drawn = boxAt(current, event);
845 + // The box is in screen space: a zoom made mid-drag moved the map under it.
846 + const origin = view ?? current.origin;
847 + onTick(
848 + fleetNodesInBox(layout, {
849 + x: (drawn.x - origin.x) / origin.scale,
850 + y: (drawn.y - origin.y) / origin.scale,
851 + width: drawn.width / origin.scale,
852 + height: drawn.height / origin.scale,
853 + }),
854 + "add",
855 + );
856 + };
857 + const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
858 + if (event.ctrlKey || event.metaKey || event.altKey) return;
859 + if (event.key === "+" || event.key === "=") zoom(1.25);
860 + else if (event.key === "-") zoom(0.8);
861 + else if (event.key === "0") fit();
862 + else if (event.key === "Escape") onSelect(null);
863 + else return;
864 + event.preventDefault();
865 + };
866 +
867 + const sources = graph.nodes.filter(
868 + (node): node is FleetEnvironmentNode => node.kind === "environment" && node.linking === "ready",
869 + );
870 + // The environment in the details is the one the user means; a lone one needs no asking.
871 + const source =
872 + sources.find((node) => selection?.kind === "node" && node.id === selection.id) ??
873 + (sources.length === 1 ? sources[0] : undefined);
874 + const selectSeveral = gt("Shift-click or Shift-drag to select several");
875 +
876 + return (
877 + <>
878 + <div className="flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-t-xl border-b border-border/60 bg-background/50 px-3 py-1.5">
879 + <div className="w-48">
880 + <InputGroup>
881 + <InputGroupAddon>
882 + <SearchIcon aria-hidden />
883 + </InputGroupAddon>
884 + <InputGroupInput
885 + size="sm"
886 + type="search"
887 + value={query}
888 + aria-label={gt("Find a machine on the map")}
889 + placeholder={gt("Find a machine")}
890 + spellCheck={false}
891 + autoComplete="off"
892 + onChange={(event) => setQuery(event.target.value)}
893 + onKeyDown={(event) => {
894 + if (event.key === "Enter") {
895 + event.preventDefault();
896 + goToFirstMatch();
897 + } else if (event.key === "Escape" && query !== "") {
898 + event.stopPropagation();
899 + setQuery("");
900 + }
901 + }}
902 + />
903 + </InputGroup>
904 + </div>
905 + <p role="status" className="min-w-0 text-2xs text-muted-foreground">
906 + {matches === null
907 + ? null
908 + : matchIds.length === 0
909 + ? gt("No machine by that name")
910 + : gt("{count, plural, one {# match} other {# matches}}", {
911 + count: matchIds.length,
912 + $context: "how many machines a search by name found",
913 + })}
914 + </p>
915 + <div className="ml-auto flex items-center gap-2">
916 + {selected.size > 0 ? (
917 + <span className="flex items-center gap-1 text-2xs text-foreground">
918 + <span role="status" className="tabular-nums">
919 + {gt("{count, plural, one {# selected} other {# selected}}", {
920 + count: selected.size,
921 + $context: "how many machines are selected on a map",
922 + })}
923 + </span>
924 + <Button size="xs" variant="ghost-muted" onClick={onClearTicked}>
925 + {gt("Clear", { $context: "clears the selection of machines" })}
926 + </Button>
927 + </span>
928 + ) : null}
929 + {sources.length === 0 ? null : source !== undefined ? (
930 + <Tooltip>
931 + <TooltipTrigger
932 + render={
933 + <Button size="xs" variant="outline" onClick={() => onLinkSeveral(source.id)}>
934 + {gt("Link several…")}
935 + </Button>
936 + }
937 + />
938 + <TooltipPopup>{selectSeveral}</TooltipPopup>
939 + </Tooltip>
940 + ) : (
941 + <Menu>
942 + <Tooltip>
943 + <TooltipTrigger
944 + render={
945 + <MenuTrigger
946 + render={
947 + <Button size="xs" variant="outline">
948 + {gt("Link several…")}
949 + </Button>
950 + }
951 + />
952 + }
953 + />
954 + <TooltipPopup>{selectSeveral}</TooltipPopup>
955 + </Tooltip>
956 + <MenuPopup align="end">
957 + {sources.map((node) => (
958 + <MenuItem key={node.id} onClick={() => onLinkSeveral(node.id)}>
959 + {gt("From {source}", {
960 + source: node.label,
961 + $context: "menu item: link several machines from this environment",
962 + })}
963 + </MenuItem>
964 + ))}
965 + </MenuPopup>
966 + </Menu>
967 + )}
968 + <Popover>
969 + <PopoverTrigger
970 + render={
971 + <Button size="icon-xs" variant="ghost" aria-label={gt("How to use the map")}>
972 + <CircleHelpIcon />
973 + </Button>
974 + }
975 + />
976 + <PopoverPopup align="end" width="sm" padding="compact">
977 + <ul className="list-disc space-y-1 pl-4 text-xs text-muted-foreground">
978 + <li>{gt("Select a machine to manage it.")}</li>
979 + {sources.length === 0 ? null : (
980 + <>
981 + <li>{gt("Drag a plus onto a machine to link them.")}</li>
982 + <li>{selectSeveral}</li>
983 + </>
984 + )}
985 + <li>{gt("A link reaches one machine and stops there.")}</li>
986 + </ul>
987 + </PopoverPopup>
988 + </Popover>
989 + </div>
990 + </div>
991 + {dropped === null ? null : (
992 + <CodeOnlyNotice
993 + graph={graph}
994 + dropped={dropped}
995 + onLinkOne={onLinkOne}
996 + onDismiss={onDismissDropped}
997 + />
998 + )}
999 + <div
1000 + ref={setCanvas}
1001 + data-dragging={dragging || undefined}
1002 + data-glide={glide || undefined}
1003 + className="relative min-h-45 cursor-grab touch-none overflow-clip bg-background/50 select-none data-dragging:cursor-grabbing data-glide:transition-[height,background-size,background-position] data-glide:duration-200 data-glide:ease-out motion-reduce:transition-none"
1004 + style={
1005 + view === null || size === null
1006 + ? undefined
1007 + : {
1008 + height: size.height,
1009 + backgroundImage: "radial-gradient(circle, var(--border) 1px, transparent 1.5px)",
1010 + backgroundSize: `${24 * view.scale}px ${24 * view.scale}px`,
1011 + backgroundPosition: `${view.x}px ${view.y}px`,
1012 + }
1013 + }
1014 + onPointerDown={onPointerDown}
1015 + onPointerMove={onPointerMove}
1016 + onPointerUp={(event) => endDrag(event, false)}
1017 + onPointerCancel={(event) => endDrag(event, true)}
1018 + onLostPointerCapture={(event) => endDrag(event, true)}
1019 + onKeyDown={onKeyDown}
1020 + >
1021 + {view === null ? null : (
1022 + <div
1023 + data-fleet-scene
1024 + className="absolute top-0 left-0 origin-top-left in-data-dragging:will-change-transform in-data-glide:transition-transform in-data-glide:duration-200 in-data-glide:ease-out motion-reduce:transition-none"
1025 + style={{
1026 + width: layout.width,
1027 + height: layout.height,
1028 + transform: `translate(${view.x}px, ${view.y}px) scale(${view.scale})`,
1029 + }}
1030 + >
1031 + <FleetScene {...scene} layout={layout} matches={matches} onReveal={reveal} />
1032 + </div>
1033 + )}
1034 + {box === null ? null : (
1035 + <div
1036 + aria-hidden
1037 + style={{ left: box.x, top: box.y, width: box.width, height: box.height }}
1038 + className="pointer-events-none absolute rounded-sm border border-primary bg-primary/10 forced-colors:border-2"
1039 + />
1040 + )}
1041 + </div>
1042 + {/* Below the canvas, not over it: nothing on the map can end up under the controls. */}
1043 + <div className="flex items-end justify-between gap-3 bg-background/50 px-3 pb-2">
1044 + <FleetLegend twoWay={fleetTwoWayLinks(graph).size > 0} />
1045 + <div className="flex shrink-0 items-center gap-1 rounded-lg border border-border/60 bg-popover/90 p-0.5 shadow-xs/5">
1046 + <Button
1047 + size="icon-xs"
1048 + variant="ghost"
1049 + aria-label={gt("Zoom out")}
1050 + onClick={() => zoom(0.8)}
1051 + >
1052 + <MinusIcon />
1053 + </Button>
1054 + <Button
1055 + size="icon-xs"
1056 + variant="ghost"
1057 + aria-label={gt("Zoom in")}
1058 + onClick={() => zoom(1.25)}
1059 + >
1060 + <PlusIcon />
1061 + </Button>
1062 + <Button
1063 + size="icon-xs"
1064 + variant="ghost"
1065 + aria-label={gt("Fit the map to view")}
1066 + disabled={held === null}
1067 + onClick={fit}
1068 + >
1069 + <MaximizeIcon />
1070 + </Button>
1071 + </div>
1072 + </div>
1073 + </>
1074 + );
1075 +}
1076 +
1077 +/** How the two families of line are read: routes by state, links by weight. */
1078 +function FleetLegend({ twoWay }: { readonly twoWay: boolean }) {
1079 + const gt = useGT();
1080 + const sample = (state: FleetRouteState) => (
1081 + <svg aria-hidden viewBox="0 0 18 4" className={cn("h-1 w-4.5", ROUTE_STYLES[state].wire)}>
1082 + <path
1083 + d="M0 2H18"
1084 + stroke="currentColor"
1085 + strokeWidth={ROUTE_STYLES[state].width + 0.25}
1086 + strokeDasharray={ROUTE_STYLES[state].dash}
1087 + />
1088 + </svg>
1089 + );
1090 + return (
1091 + <ul
1092 + aria-label={gt("How to read the lines")}
1093 + className="flex min-w-0 items-center gap-x-3 overflow-clip pb-1 text-2xs whitespace-nowrap text-muted-foreground"
1094 + >
1095 + <li className="flex items-center gap-1.5">
1096 + {sample("in-use")}
1097 + {routeStateLabel("in-use", gt)}
1098 + </li>
1099 + <li className="flex items-center gap-1.5">
1100 + {sample("standby")}
1101 + {routeStateLabel("standby", gt)}
1102 + </li>
1103 + <li className="flex items-center gap-1.5">
1104 + {sample("down")}
1105 + {gt("Offline")}
1106 + </li>
1107 + <li className="flex items-center gap-1.5">
1108 + <svg aria-hidden viewBox="0 0 22 6" className="h-1.5 w-5.5 text-foreground/70">
1109 + <path d="M0 3L22 0.5V5.5Z" fill="currentColor" />
1110 + </svg>
1111 + {gt("Link", { $context: "noun, in a map legend: a line joining two linked machines" })}
1112 + </li>
1113 + {twoWay ? (
1114 + <li className="flex items-center gap-1.5">
1115 + <svg aria-hidden viewBox="0 0 22 8" className="h-2 w-5.5 text-foreground/70">
1116 + <path d="M5 4H17" stroke="currentColor" strokeWidth="1.75" />
1117 + <path d="M0 4L6 0.5V7.5ZM22 4L16 0.5V7.5Z" fill="currentColor" />
1118 + </svg>
1119 + {gt("Two-way", { $context: "in a map legend: a link that goes both ways" })}
1120 + </li>
1121 + ) : null}
1122 + </ul>
1123 + );
1124 +}
1125 +
1126 +/** A state short enough for a card. The reason behind it is in the details and the name. */
1127 +function connectionStateText(
1128 + node: FleetEnvironmentNode,
1129 + environment: EnvironmentPresentation | undefined,
1130 + refused: boolean,
1131 + gt: GT,
1132 +): string {
1133 + if (!node.enabled && node.phase !== "unsupported") {
1134 + return gt("Off", { $context: "environment switched off" });
1135 + }
1136 + if (refused) return gt("Sign-in refused");
1137 + switch (node.phase) {
1138 + case "connected":
1139 + return gt("Connected");
1140 + case "connecting":
1141 + return gt("Connecting…");
1142 + case "reconnecting":
1143 + return environment?.connection.awaitingApproval
1144 + ? gt("Waiting for approval")
1145 + : gt("Reconnecting…");
1146 + case "unsupported":
1147 + return gt("Client not supported");
1148 + case "error":
1149 + return gt("Connection failed");
1150 + case "offline":
1151 + return gt("Offline");
1152 + case "available":
1153 + return gt("Not connected");
1154 + }
1155 +}
1156 +
1157 +function environmentStatusText(
1158 + node: FleetEnvironmentNode,
1159 + environment: EnvironmentPresentation | undefined,
1160 + refused: boolean,
1161 + linkCount: number,
1162 + gt: GT,
1163 +): string {
1164 + if (node.phase !== "connected") return connectionStateText(node, environment, refused, gt);
1165 + switch (node.outgoing) {
1166 + case "loading":
1167 + return gt("Loading links…");
1168 + case "error":
1169 + return gt("Links could not be loaded");
1170 + case "off":
1171 + return gt("Linked environments is off");
1172 + case "unknown":
1173 + return gt("Links not readable from here");
1174 + case "loaded":
1175 + return gt("{count, plural, =0 {No links out} one {# link out} other {# links out}}", {
1176 + count: linkCount,
1177 + });
1178 + }
1179 +}
1180 +
1181 +function connectAvailabilityText(
1182 + availability: Extract<FleetNode, { kind: "connect" }>["availability"],
1183 + gt: GT,
1184 +): string {
1185 + switch (availability) {
1186 + case "online":
1187 + return gt("Relay online");
1188 + case "offline":
1189 + return gt("Relay offline");
1190 + case "checking":
1191 + return gt("Checking relay status…");
1192 + case "error":
1193 + return gt("Relay status unavailable");
1194 + }
1195 +}
1196 +
1197 +function linkSummary(edge: FleetLinkEdge, gt: GT, m: Messages): string {
1198 + return `${m(accessConfig[edge.link.access].label)}, ${healthLabel(edge.health, gt)}`;
1199 +}
1200 +
1201 +/** A link in words, for the pointer and for assistive tech. A two-way link names each direction. */
1202 +function linkName(
1203 + edge: FleetLinkEdge,
1204 + back: FleetLinkEdge | undefined,
1205 + labelOf: (id: string) => string,
1206 + gt: GT,
1207 + m: Messages,
1208 +): string {
1209 + const source = labelOf(edge.from);
1210 + const target = labelOf(edge.to);
1211 + return back === undefined
1212 + ? gt("Link from {source} to {target}: {summary}", {
1213 + source,
1214 + target,
1215 + summary: linkSummary(edge, gt, m),
1216 + })
1217 + : gt(
1218 + "Two-way link between {source} and {target}, {access}. {source} to {target}: {forward}. {target} to {source}: {back}",
1219 + {
1220 + source,
1221 + target,
1222 + access: m(accessConfig[edge.link.access].label),
1223 + forward: healthLabel(edge.health, gt),
1224 + back: healthLabel(back.health, gt),
1225 + },
1226 + );
1227 +}
1228 +
1229 +/**
1230 + * Says in place why a drop cannot be linked in one go, and offers what works: one machine at
1231 + * a time, with a pairing code from it.
1232 + */
1233 +function CodeOnlyNotice({
1234 + graph,
1235 + dropped,
1236 + onLinkOne,
1237 + onDismiss,
1238 +}: {
1239 + readonly graph: FleetGraph;
1240 + readonly dropped: CodeOnlyDrop;
1241 + readonly onLinkOne: (sourceId: string, targetId: string) => void;
1242 + readonly onDismiss: () => void;
1243 +}) {
1244 + const gt = useGT();
1245 + const byId = new Map(graph.nodes.map((node) => [node.id, node]));
1246 + const source = byId.get(dropped.sourceId);
1247 + const machines = dropped.machineIds.flatMap((id) => byId.get(id) ?? []);
1248 + if (source === undefined || machines.length === 0) return null;
1249 + return (
1250 + <div
1251 + role="status"
1252 + className="flex flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-border/60 bg-background/50 px-3 py-2 text-xs"
1253 + >
1254 + <p className="min-w-0 flex-1 basis-64 text-muted-foreground">
1255 + {needsCodeText(machines.length, gt)}
1256 + </p>
1257 + {/* Linking through an environment that already reaches these machines would be offered here. */}
1258 + <Menu>
1259 + <MenuTrigger
1260 + render={
1261 + <Button size="xs" variant="outline">
1262 + {gt("Link one with a code…")}
1263 + </Button>
1264 + }
1265 + />
1266 + <MenuPopup align="end">
1267 + {machines.map((machine) => (
1268 + <MenuItem key={machine.id} onClick={() => onLinkOne(dropped.sourceId, machine.id)}>
1269 + {machine.label}
1270 + </MenuItem>
1271 + ))}
1272 + </MenuPopup>
1273 + </Menu>
1274 + <Button size="icon-xs" variant="ghost" aria-label={gt("Dismiss")} onClick={onDismiss}>
1275 + <XIcon />
1276 + </Button>
1277 + </div>
1278 + );
1279 +}
1280 +
1281 +const needsCodeText = (count: number, gt: GT) =>
1282 + gt(
1283 + "{count, plural, one {# machine needs a pairing code} other {# machines each need a pairing code}}",
1284 + { count },
1285 + );
1286 +
1287 +function actionText(action: FleetLinkAction | null, target: string, gt: GT): string {
1288 + if (action === null) return gt("Cannot link to this");
1289 + if (action.kind === "code-only") return needsCodeText(action.machineIds.length, gt);
1290 + if (action.kind === "batch") {
1291 + return gt("{count, plural, one {Link to # machine} other {Link to # machines}}", {
1292 + count: action.environmentIds.length,
1293 + });
1294 + }
1295 + const { offer } = action;
1296 + if (offer === null) return gt("Cannot link to this");
1297 + if (offer.path === "code-less") {
1298 + return offer.renews
1299 + ? gt("Renew link to {target}", { target })
1300 + : gt("Link to {target}", { target });
1301 + }
1302 + return offer.renews
1303 + ? gt("Renew link to {target} with a pairing code", { target })
1304 + : gt("Link to {target} with a pairing code", { target });
1305 +}
1306 +
1307 +function foldGroupLabel(group: FleetFoldGroup, gt: GT): string {
1308 + switch (group) {
1309 + case "offline":
1310 + return gt("Offline");
1311 + case "off":
1312 + return gt("Switched off", { $context: "environments the user has switched off in this app" });
1313 + case "update":
1314 + return gt("Need an update", {
1315 + $context: "environments running a version this app cannot talk to",
1316 + });
1317 + case "not-added":
1318 + return gt("Not added");
1319 + }
1320 +}
1321 +
1322 +const COLUMN_TITLES = (gt: GT): Record<FleetColumn, string> => ({
1323 + client: gt("This app"),
1324 + environments: gt("Environments"),
1325 + targets: gt("Linked machines"),
1326 +});
1327 +
1328 +interface LinkDrag {
1329 + readonly sourceId: string;
1330 + readonly x: number;
1331 + readonly y: number;
1332 + readonly overId: string | null;
1333 +}
1334 +
1335 +const FleetScene = memo(function FleetScene({
1336 + graph,
1337 + stacks,
1338 + layout,
1339 + environments,
1340 + selection,
1341 + selected,
1342 + matches,
1343 + onSelect,
1344 + onTick,
1345 + onLink,
1346 + onToggleStack,
1347 + onReveal,
1348 +}: FleetSceneProps & {
1349 + /** Machines a search names; the rest step back. Null when nothing is searched for. */
1350 + readonly matches: ReadonlySet<string> | null;
1351 + readonly onReveal: (rect: FleetRect) => void;
1352 +}) {
1353 + const gt = useGT();
1354 + const m = useMessages();
1355 + const [hover, setHover] = useState<FleetFocus | null>(null);
1356 + const [roving, setRoving] = useState(FLEET_CLIENT_NODE_ID);
1357 + const [linkDrag, setLinkDrag] = useState<LinkDrag | null>(null);
1358 + const handleDrag = useRef<{
1359 + readonly pointerId: number;
1360 + readonly x: number;
1361 + readonly y: number;
1362 + moved: boolean;
1363 + } | null>(null);
1364 + // A drag ends with a click on the handle it started from; that click must not open the dialog.
1365 + const swallowClick = useRef(false);
1366 + const focus = linkDrag === null ? (hover ?? selection) : null;
1367 + const lit = focus === null ? null : fleetNeighborhood(graph, stacks, focus);
1368 + const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));
1369 + const environmentById = new Map(
1370 + environments.map((environment) => [
1371 + fleetEnvironmentNodeId(environment.environmentId),
1372 + environment,
1373 + ]),
1374 + );
1375 + const links = graph.edges.filter(isLinkEdge);
1376 + const pairs = fleetTwoWayLinks(graph);
1377 + const labelOf = (id: string) => nodeById.get(id)?.label ?? "";
1378 + /** The other link of the two-way link `edge` is drawn for. */
1379 + const backOf = (edge: FleetLinkEdge) => pairs.get(edge.id)?.back;
1380 + const routeEdges = graph.edges.filter(isRouteEdge);
1381 + const focusRects = fleetFocusRects(layout);
1382 + const tabStop = focusRects.has(roving) ? roving : FLEET_CLIENT_NODE_ID;
1383 + const titles = COLUMN_TITLES(gt);
1384 + const isSelected = (kind: FleetFocus["kind"], id: string) =>
1385 + selection?.kind === kind && selection.id === id;
1386 + const fade = (dimmed: boolean) =>
1387 + cn(
1388 + "transition-opacity duration-150 motion-reduce:transition-none",
1389 + dimmed && "opacity-40 forced-colors:opacity-60",
1390 + );
1391 + // Lines run the length of the map and cross each other, so one out of focus fades further
1392 + // than a machine does.
1393 + const fadeLine = (dimmed: boolean) =>
1394 + cn(
1395 + "transition-opacity duration-150 motion-reduce:transition-none",
1396 + dimmed && "opacity-25 forced-colors:opacity-40",
1397 + );
1398 + // A name on a line stays solid when out of focus, so the lines under it never show through:
1399 + // its text and outline step back instead.
1400 + const fadeName = (dimmed: boolean) =>
1401 + cn(
1402 + "transition-colors duration-150 motion-reduce:transition-none",
1403 + dimmed && "border-border/50 font-normal text-muted-foreground/45",
1404 + );
1405 + const routeLit = (edge: FleetRouteEdge) => lit === null || lit.edges.has(edge.id);
1406 + // Painted last, so the routes in focus lie over the ones that are not.
1407 + const routePaintOrder =
1408 + lit === null ? routeEdges : routeEdges.toSorted((a, b) => +routeLit(a) - +routeLit(b));
1409 + const linkLit = (edge: FleetLinkEdge) =>
1410 + isSelected("edge", edge.id) || (lit?.edges.has(edge.id) ?? false);
1411 + // Painted last, so the links in focus lie over the ones that are not.
1412 + const paintOrder = lit === null ? links : links.toSorted((a, b) => +linkLit(a) - +linkLit(b));
1413 + const dragAction = (targetId: string) =>
1414 + linkDrag === null
1415 + ? null
1416 + : fleetLinkAction(graph, stacks, selected, linkDrag.sourceId, targetId);
1417 + // A stack fades as a whole, by the links and machines it stands for.
1418 + const nodeDimmed = (id: string) =>
1419 + layout.stacks.has(id)
1420 + ? false
1421 + : linkDrag !== null
1422 + ? id !== linkDrag.sourceId && dragAction(id) === null
1423 + : (lit !== null && !lit.nodes.has(id)) || (matches !== null && !matches.has(id));
1424 + // By the links it stands for: a host and a member can both be lit through other links.
1425 + const stackLit = (stack: FleetStack) =>
1426 + lit === null || stack.edgeIds.some((id) => lit.edges.has(id));
1427 + const stackDimmed = (stack: FleetStack) =>
1428 + linkDrag !== null
1429 + ? false
1430 + : !stackLit(stack) || (matches !== null && !stack.memberIds.some((id) => matches.has(id)));
1431 + // A machine drawn on its own can be ticked for a batch link; the client and stacks cannot.
1432 + const tickable = (id: string) => id !== FLEET_CLIENT_NODE_ID && layout.nodes.has(id);
1433 + // A machine shown in the details but folded into a stack marks the stack it is in.
1434 + const holdsSelection = (stack: FleetStack) =>
1435 + selection?.kind === "node" &&
1436 + !layout.nodes.has(selection.id) &&
1437 + stack.memberIds.includes(selection.id);
1438 + const hoverProps = (target: FleetFocus) => ({
1439 + onPointerEnter: () => setHover(target),
1440 + onPointerLeave: () => setHover(null),
1441 + });
1442 +
1443 + const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
1444 + const direction = ARROW_ROVE[event.key];
1445 + const from = (event.target as HTMLElement).closest<HTMLElement>("[data-fleet-node]");
1446 + if (event.key === " " && from !== null && tickable(from.dataset.fleetNode ?? "")) {
1447 + // Space ticks the machine for a batch link; Enter still opens its details.
1448 + event.preventDefault();
1449 + if (!event.repeat) onTick([from.dataset.fleetNode ?? ""], "toggle");
1450 + return;
1451 + }
1452 + if (direction === undefined || from === null) return;
1453 + event.preventDefault();
1454 + const next = nextFleetNode(focusRects, from.dataset.fleetNode ?? "", direction);
1455 + const rect = next === null ? undefined : focusRects.get(next);
1456 + if (next === null || rect === undefined) return;
1457 + event.currentTarget
1458 + .querySelector<HTMLElement>(`[data-fleet-node="${CSS.escape(next)}"]`)
1459 + ?.focus({ preventScroll: true });
1460 + onReveal(rect);
1461 + };
1462 +
1463 + const focusProps = (target: FleetFocus, rect: FleetRect, label: string) => ({
1464 + type: "button" as const,
1465 + "data-fleet-item": "",
1466 + "data-fleet-node": target.id,
1467 + "aria-label": selected.has(target.id)
1468 + ? gt("{label}, selected", { label, $context: "a machine ticked on a map" })
1469 + : label,
1470 + "aria-pressed": isSelected(target.kind, target.id),
1471 + tabIndex: target.id === tabStop ? 0 : -1,
1472 + style: { left: rect.x, top: rect.y, width: rect.width, height: rect.height },
1473 + onClick: (event: MouseEvent<HTMLElement>) => {
1474 + if ((event.shiftKey || event.metaKey || event.ctrlKey) && tickable(target.id)) {
1475 + onTick([target.id], "toggle");
1476 + return;
1477 + }
1478 + onSelect(isSelected(target.kind, target.id) ? null : target);
1479 + },
1480 + // The keydown ticked the machine; without this the button would also click.
1481 + onKeyUp: (event: KeyboardEvent<HTMLElement>) => {
1482 + if (event.key === " " && tickable(target.id)) event.preventDefault();
1483 + },
1484 + onFocus: (event: FocusEvent<HTMLElement>) => {
1485 + setRoving(target.id);
1486 + setHover(target);
1487 + // Tabbing back in can land on a machine panned out of view; a click cannot.
1488 + if (event.currentTarget.matches(":focus-visible")) onReveal(rect);
1489 + },
1490 + onBlur: () => setHover(null),
1491 + ...hoverProps(target),
1492 + });
1493 + const nodeClass = (id: string) =>
1494 + cn(
1495 + "absolute flex cursor-pointer items-center text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset aria-pressed:ring-2 aria-pressed:ring-primary aria-pressed:ring-inset forced-colors:focus-visible:outline-2 forced-colors:aria-pressed:outline-2",
1496 + fade(nodeDimmed(id)),
1497 + linkDrag?.overId === id && "ring-2 ring-primary ring-inset",
1498 + );
1499 +
1500 + const toScene = (event: PointerEvent<HTMLElement>) => {
1501 + const bounds = event.currentTarget.closest("[data-fleet-scene]")?.getBoundingClientRect();
1502 + if (!bounds || bounds.width === 0) return null;
1503 + const scale = bounds.width / layout.width;
1504 + return { x: (event.clientX - bounds.left) / scale, y: (event.clientY - bounds.top) / scale };
1505 + };
1506 + const dropTargetAt = (sourceId: string, event: PointerEvent<HTMLElement>) => {
1507 + const over = document
1508 + .elementFromPoint(event.clientX, event.clientY)
1509 + ?.closest<HTMLElement>("[data-fleet-node]")?.dataset.fleetNode;
1510 + return over !== undefined && fleetLinkAction(graph, stacks, selected, sourceId, over) !== null
1511 + ? over
1512 + : null;
1513 + };
1514 + const handleProps = (sourceId: string) => ({
1515 + onPointerDown: (event: PointerEvent<HTMLButtonElement>) => {
1516 + if (event.button !== 0 || handleDrag.current !== null) return;
1517 + swallowClick.current = false;
1518 + handleDrag.current = {
1519 + pointerId: event.pointerId,
1520 + x: event.clientX,
1521 + y: event.clientY,
1522 + moved: false,
1523 + };
1524 + event.currentTarget.setPointerCapture(event.pointerId);
1525 + },
1526 + onPointerMove: (event: PointerEvent<HTMLButtonElement>) => {
1527 + const current = handleDrag.current;
1528 + if (current === null || current.pointerId !== event.pointerId) return;
1529 + if (!current.moved && Math.hypot(event.clientX - current.x, event.clientY - current.y) < 4) {
1530 + return;
1531 + }
1532 + current.moved = true;
1533 + const point = toScene(event);
1534 + if (point === null) return;
1535 + setLinkDrag({ sourceId, ...point, overId: dropTargetAt(sourceId, event) });
1536 + },
1537 + onPointerUp: (event: PointerEvent<HTMLButtonElement>) => {
1538 + const current = handleDrag.current;
1539 + if (current === null || current.pointerId !== event.pointerId) return;
1540 + handleDrag.current = null;
1541 + if (!current.moved) return;
1542 + swallowClick.current = true;
1543 + // Asked again at release: the map can move under a pointer that has stopped.
1544 + const overId = dropTargetAt(sourceId, event);
1545 + setLinkDrag(null);
1546 + if (overId !== null) onLink(sourceId, overId);
1547 + },
1548 + onLostPointerCapture: () => {
1549 + if (handleDrag.current === null) return;
1550 + handleDrag.current = null;
1551 + setLinkDrag(null);
1552 + },
1553 + onClick: () => {
1554 + if (swallowClick.current) {
1555 + swallowClick.current = false;
1556 + return;
1557 + }
1558 + onLink(sourceId, null);
1559 + },
1560 + });
1561 +
1562 + const dragSource = linkDrag === null ? undefined : layout.handles.get(linkDrag.sourceId);
1563 + const dragOver = linkDrag?.overId ?? null;
1564 +
1565 + return (
1566 + <div
1567 + role="group"
1568 + aria-label={gt("Map of your machines")}
1569 + aria-description={gt(
1570 + "Arrow keys move between machines. Enter opens a machine's details, with its routes and links. Space selects a machine for linking several at once. Tab from an environment reaches its link button. Plus and minus zoom, zero fits the map.",
1571 + )}
1572 + onKeyDown={onKeyDown}
1573 + >
1574 + {layout.columns.map((column) => (
1575 + <p
1576 + key={column.id}
1577 + aria-hidden
1578 + style={{ left: column.x }}
1579 + className="absolute top-0 text-2xs font-medium whitespace-nowrap text-muted-foreground"
1580 + >
1581 + {titles[column.id]}
1582 + </p>
1583 + ))}
1584 + <svg
1585 + width={layout.width}
1586 + height={layout.height}
1587 + className="absolute top-0 left-0 overflow-visible"
1588 + fill="none"
1589 + strokeLinecap="round"
1590 + >
1591 + {routePaintOrder.map((edge) => {
1592 + const geometry = layout.routes.get(edge.id);
1593 + if (geometry === undefined) return null;
1594 + const style = ROUTE_STYLES[edge.state];
1595 + return (
1596 + <path
1597 + key={edge.id}
1598 + d={geometry.d}
1599 + stroke="currentColor"
1600 + strokeWidth={style.width}
1601 + strokeDasharray={style.dash}
1602 + className={cn(style.wire, fadeLine(!routeLit(edge)))}
1603 + />
1604 + );
1605 + })}
1606 + {stacks.map((stack) => {
1607 + const geometry = layout.stacks.get(stack.id);
1608 + if (geometry === undefined) return null;
1609 + const onPath = stackLit(stack);
1610 + return geometry.lines.map((line) => {
1611 + // A folded group of environments has one wire for all its routes, none in use.
1612 + if (line.access === null) {
1613 + return (
1614 + <path
1615 + key={`${stack.id}:routes`}
1616 + d={line.d}
1617 + stroke="currentColor"
1618 + strokeWidth={ROUTE_STYLES.idle.width}
1619 + strokeDasharray={ROUTE_STYLES.idle.dash}
1620 + className={cn(ROUTE_STYLES.idle.wire, fadeLine(lit !== null && !onPath))}
1621 + />
1622 + );
1623 + }
1624 + const level = accessLevel(line.access);
1625 + const mine = lit === null || lit.nodes.has(line.sourceId ?? "");
1626 + return (
1627 + <g
1628 + key={`${stack.id}:${line.sourceId}`}
1629 + className={cn("text-foreground", fadeLine(lit !== null && !(onPath && mine)))}
1630 + opacity={lit !== null && onPath && mine ? 1 : ACCESS_STROKE_OPACITIES[level]}
1631 + >
1632 + <path d={line.d} stroke="currentColor" strokeWidth={ACCESS_STROKE_WIDTHS[level]} />
1633 + {line.arrow === null ? null : (
1634 + <path
1635 + d={`M${line.arrow.x - 8} ${line.arrow.y - 4.5}L${line.arrow.x} ${line.arrow.y}L${line.arrow.x - 8} ${line.arrow.y + 4.5}Z`}
1636 + fill="currentColor"
1637 + />
1638 + )}
1639 + </g>
1640 + );
1641 + });
1642 + })}
1643 + {paintOrder.map((edge) => {
1644 + const geometry = layout.links.get(edge.id);
1645 + if (geometry === undefined) return null;
1646 + const selected = isSelected("edge", edge.id);
1647 + const level = accessLevel(edge.link.access);
1648 + const back = backOf(edge);
1649 + // A two-way link is drawn in halves, each leading into the machine its link reaches,
1650 + // so a direction in trouble shows at its own end.
1651 + const parts: ReadonlyArray<readonly [string, FleetArrow, PeerLinkHealth]> =
1652 + geometry.twoWay !== null && back !== undefined
1653 + ? [
1654 + [geometry.twoWay.forward, geometry.arrow, edge.health],
1655 + [geometry.twoWay.back, geometry.twoWay.backArrow, back.health],
1656 + ]
1657 + : [[geometry.d, geometry.arrow, edge.health]];
1658 + return (
1659 + <g
1660 + key={edge.id}
1661 + className={cn("pointer-events-none", fadeLine(lit !== null && !linkLit(edge)))}
1662 + opacity={linkLit(edge) ? 1 : ACCESS_STROKE_OPACITIES[level]}
1663 + >
1664 + {parts.map(([d, arrow, health]) => (
1665 + <g
1666 + key={d}
1667 + className={
1668 + selected
1669 + ? "text-primary"
1670 + : linkNeedsAttention(health)
1671 + ? healthTone(health)
1672 + : "text-foreground"
1673 + }
1674 + >
1675 + <path
1676 + d={d}
1677 + stroke="currentColor"
1678 + // Selection also thickens the line, for when colour is forced.
1679 + strokeWidth={(ACCESS_STROKE_WIDTHS[level] ?? 2) + (selected ? 1 : 0)}
1680 + strokeDasharray={healthDash(health)}
1681 + />
1682 + <path
1683 + d={`M${arrow.x - arrow.dir * 7} ${arrow.y - 4}L${arrow.x} ${arrow.y}L${arrow.x - arrow.dir * 7} ${arrow.y + 4}Z`}
1684 + fill="currentColor"
1685 + />
1686 + </g>
1687 + ))}
1688 + </g>
1689 + );
1690 + })}
1691 + {/* Pointer shortcut only: each link is also a row in its machines' details. Kept in a
1692 + fixed order apart from the painted lines, so focus never moves one under the pointer. */}
1693 + {links.map((edge) => {
1694 + const geometry = layout.links.get(edge.id);
1695 + if (geometry === undefined) return null;
1696 + const selected = isSelected("edge", edge.id);
1697 + return (
1698 + <path
1699 + key={edge.id}
1700 + aria-hidden
1701 + data-fleet-item=""
1702 + d={geometry.d}
1703 + stroke="transparent"
1704 + strokeWidth="14"
1705 + className="cursor-pointer"
1706 + onClick={() => onSelect(selected ? null : { kind: "edge", id: edge.id })}
1707 + {...hoverProps({ kind: "edge", id: edge.id })}
1708 + >
1709 + <title>{linkName(edge, backOf(edge), labelOf, gt, m)}</title>
1710 + </path>
1711 + );
1712 + })}
1713 + {linkDrag !== null && dragSource !== undefined ? (
1714 + <path
1715 + d={`M${dragSource.x} ${dragSource.y}C${dragSource.x + 48} ${dragSource.y} ${linkDrag.x - 48} ${linkDrag.y} ${linkDrag.x} ${linkDrag.y}`}
1716 + stroke="currentColor"
1717 + strokeWidth="1.75"
1718 + strokeDasharray="5 4"
1719 + className="pointer-events-none text-primary"
1720 + />
1721 + ) : null}
1722 + </svg>
1723 + {routeEdges.map((edge) => {
1724 + const geometry = layout.routes.get(edge.id);
1725 + if (geometry === undefined) return null;
1726 + const { pill } = geometry;
1727 + return (
1728 + <span
1729 + key={edge.id}
1730 + aria-hidden
1731 + style={{ left: pill.x, top: pill.y, width: pill.width, height: pill.height }}
1732 + className={cn(
1733 + "absolute flex items-center justify-center rounded-full border bg-background px-1.5 text-2xs leading-none text-muted-foreground",
1734 + routeLit(edge) && ROUTE_STYLES[edge.state].pill,
1735 + // Lit routes sit over the others, whose wires pass beside them on the way in.
1736 + routeLit(edge) && "z-1",
1737 + fadeName(!routeLit(edge)),
1738 + )}
1739 + >
1740 + <span className="truncate">
1741 + {edge.routeLabel ?? routeKindLabel(edge.routeKind, gt)}
1742 + </span>
1743 + </span>
1744 + );
1745 + })}
1746 + {links.map((edge) => {
1747 + const badge = layout.links.get(edge.id)?.badge;
1748 + if (!badge) return null;
1749 + const target = { kind: "edge", id: edge.id } as const;
1750 + const back = backOf(edge);
1751 + const health = back === undefined ? edge.health : worseLinkHealth(edge.health, back.health);
1752 + // With no clear place of its own, the name shows only while its link is the one in focus.
1753 + if (
1754 + badge.onDemand &&
1755 + !isSelected("edge", edge.id) &&
1756 + !(focus?.kind === "edge" && focus.id === edge.id)
1757 + ) {
1758 + return null;
1759 + }
1760 + return (
1761 + <button
1762 + key={edge.id}
1763 + type="button"
1764 + data-fleet-item=""
1765 + tabIndex={-1}
1766 + aria-pressed={isSelected("edge", edge.id)}
1767 + aria-label={linkName(edge, back, labelOf, gt, m)}
1768 + // Hangs off its own lane and grows away from the lanes beside it.
1769 + style={{
1770 + top: badge.y,
1771 + height: badge.height,
1772 + maxWidth: badge.width,
1773 + ...(badge.side === 1
1774 + ? { left: badge.x }
1775 + : { right: layout.width - badge.x - badge.width }),
1776 + }}
1777 + className={cn(
1778 + "absolute flex cursor-pointer items-center gap-1.5 rounded-full border border-border bg-card px-1.5 text-2xs leading-none outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset aria-pressed:border-primary aria-pressed:text-primary",
1779 + lit === null || lit.edges.has(edge.id) ? healthTone(health) : null,
1780 + badge.onDemand && "z-10 shadow-sm/5",
1781 + fadeName(lit !== null && !lit.edges.has(edge.id)),
1782 + )}
1783 + onClick={() => onSelect(isSelected("edge", edge.id) ? null : target)}
1784 + onFocus={() => setHover(target)}
1785 + onBlur={() => setHover(null)}
1786 + {...hoverProps(target)}
1787 + >
1788 + {back === undefined ? null : (
1789 + <ArrowUpDownIcon aria-hidden className="size-3 shrink-0" />
1790 + )}
1791 + <AccessMeter
1792 + access={edge.link.access}
1793 + className={cn(lit !== null && !lit.edges.has(edge.id) && "opacity-45")}
1794 + />
1795 + <span className="truncate">{m(accessConfig[edge.link.access].label)}</span>
1796 + </button>
1797 + );
1798 + })}
1799 + {stacks.map((stack) => {
1800 + const geometry = layout.stacks.get(stack.id);
1801 + if (geometry === undefined) return null;
1802 + const { face, tray, more } = geometry;
1803 + const count = stack.memberIds.length;
1804 + const range =
1805 + stack.firstLabel === stack.lastLabel
1806 + ? stack.firstLabel
1807 + : `${stack.firstLabel} … ${stack.lastLabel}`;
1808 + const group = stack.group === null ? null : foldGroupLabel(stack.group, gt);
1809 + const [only] = stack.sources;
1810 + const summary =
1811 + group !== null
1812 + ? range
1813 + : stack.sources.length === 1 && only !== undefined
1814 + ? gt("{access}. {reachable} of {count} reachable", {
1815 + access: m(accessConfig[only.access].label),
1816 + reachable: stack.reachable,
1817 + count,
1818 + })
1819 + : gt("{reachable} of {count} reachable, from {sources} environments", {
1820 + reachable: stack.reachable,
1821 + count,
1822 + sources: stack.sources.length,
1823 + });
1824 + const spoken =
1825 + group !== null
1826 + ? gt("{group}: {count} environments with no links, {range}", { group, count, range })
1827 + : gt("{range}, {count} machines linked from {sources}. {summary}", {
1828 + range,
1829 + count,
1830 + sources: stack.sources
1831 + .map((source) => nodeById.get(source.sourceId)?.label ?? "")
1832 + .join(", "),
1833 + summary,
1834 + });
1835 + const partial = fleetStackPartial(stack);
1836 + // The room the card adds below its name when some machines do not answer.
1837 + const partialBand = partial ? 20 : 0;
1838 + const ToggleIcon = stack.expanded ? FoldVerticalIcon : UnfoldVerticalIcon;
1839 + const hidden = count - stack.shownIds.length;
1840 + return (
1841 + <div key={stack.id} className={fade(stackDimmed(stack))}>
1842 + {/* The card is the same open or closed, so it does not change under the pointer. */}
1843 + {[8, 4].map((lift) => (
1844 + <div
1845 + key={lift}
1846 + aria-hidden
1847 + style={{
1848 + left: face.x + lift,
1849 + top: face.y - lift,
1850 + width: face.width,
1851 + height: face.height,
1852 + }}
1853 + className={cn(
1854 + "absolute rounded-lg border border-border bg-card transition-opacity duration-200 ease-out motion-reduce:transition-none",
1855 + group !== null && "border-dashed",
1856 + stack.expanded && "opacity-0",
1857 + )}
1858 + />
1859 + ))}
1860 + {tray === null ? null : (
1861 + <div
1862 + aria-hidden
1863 + style={{ left: tray.x, top: tray.y, width: tray.width, height: tray.height }}
1864 + className={cn(
1865 + "absolute rounded-xl border border-border/70 bg-foreground/3",
1866 + APPEAR,
1867 + )}
1868 + />
1869 + )}
1870 + <button
1871 + {...focusProps({ kind: "stack", id: stack.id }, face, spoken)}
1872 + className={cn(
1873 + nodeClass(stack.id),
1874 + "flex-col items-stretch overflow-clip rounded-lg border bg-card hover:border-foreground/50",
1875 + partialBand > 0 ? "border-warning/60" : "border-foreground/25",
1876 + group !== null && "border-dashed",
1877 + holdsSelection(stack) && "ring-2 ring-primary ring-inset forced-colors:outline-2",
1878 + )}
1879 + >
1880 + <span className="flex min-h-0 min-w-0 flex-1 flex-col justify-center px-2.5 pr-8">
1881 + <span className="flex items-center gap-1.5">
1882 + <span className="truncate text-xs leading-4 font-semibold text-foreground">
1883 + {group ?? range}
1884 + </span>
1885 + {group === null ? null : (
1886 + <span className="shrink-0 rounded-full bg-muted px-1.5 text-2xs leading-4 text-muted-foreground tabular-nums forced-colors:border">
1887 + {count}
1888 + </span>
1889 + )}
1890 + </span>
1891 + {group !== null ? (
1892 + <span className="block truncate text-2xs leading-4 text-muted-foreground">
1893 + {range}
1894 + </span>
1895 + ) : (
1896 + <span className="flex items-center gap-1.5 text-2xs leading-4 text-muted-foreground">
1897 + {only !== undefined && stack.sources.length === 1 ? (
1898 + <AccessMeter access={only.access} className="text-foreground/70" />
1899 + ) : null}
1900 + <span className="whitespace-nowrap tabular-nums">
1901 + {gt("{machines, plural, one {# machine} other {# machines}}", {
1902 + machines: count,
1903 + })}
1904 + </span>
1905 + </span>
1906 + )}
1907 + </span>
1908 + {partialBand === 0 ? null : (
1909 + // The headline of a stack that is partly down: its own band, never cut short.
1910 + <span
1911 + style={{ height: partialBand }}
1912 + className="flex shrink-0 items-center gap-1.5 border-t border-warning/30 bg-warning/16 px-2.5 text-2xs leading-none font-semibold text-warning-foreground forced-colors:border-t-2"
1913 + >
1914 + <TriangleAlertIcon aria-hidden className="size-3 shrink-0 text-warning" />
1915 + <span className="shrink-0 whitespace-nowrap tabular-nums">
1916 + {gt("{reachable, plural, =0 {None reachable} other {# reachable}}", {
1917 + reachable: stack.reachable,
1918 + $context:
1919 + "on a card for a group of linked machines: how many of them answer right now",
1920 + })}
1921 + </span>
1922 + <span className="h-1 min-w-0 flex-1 overflow-clip rounded-full bg-warning/25 forced-colors:hidden">
1923 + <span
1924 + className="block h-full rounded-full bg-warning"
1925 + style={{ width: `${(stack.reachable / count) * 100}%` }}
1926 + />
1927 + </span>
1928 + </span>
1929 + )}
1930 + </button>
1931 + <button
1932 + type="button"
1933 + data-fleet-item=""
1934 + tabIndex={stack.id === tabStop ? 0 : -1}
1935 + aria-label={
1936 + stack.expanded
1937 + ? gt("Collapse these machines")
1938 + : hidden > 0
1939 + ? gt("Show the first {shown} machines on the map", {
1940 + shown: stack.shownIds.length,
1941 + })
1942 + : gt("Show each machine on the map")
1943 + }
1944 + aria-expanded={stack.expanded}
1945 + style={{
1946 + left: face.x + face.width - 28,
1947 + top: face.y + (face.height - partialBand) / 2 - 11,
1948 + }}
1949 + className="absolute flex size-5.5 cursor-pointer items-center justify-center rounded-md text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"
1950 + onClick={() => onToggleStack(stack.id)}
1951 + >
1952 + <ToggleIcon aria-hidden className="size-3.5" />
1953 + </button>
1954 + {more === null ? null : (
1955 + // The rest are never drawn: the details list every machine, and can be searched.
1956 + <button
1957 + type="button"
1958 + data-fleet-item=""
1959 + data-fleet-node={fleetMoreNodeId(stack.id)}
1960 + tabIndex={fleetMoreNodeId(stack.id) === tabStop ? 0 : -1}
1961 + style={{ left: more.x, top: more.y, width: more.width, height: more.height }}
1962 + className={cn(
1963 + "absolute flex cursor-pointer items-center rounded-md border border-dashed border-foreground/30 px-2 text-2xs leading-none text-muted-foreground outline-none hover:border-foreground/55 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
1964 + APPEAR,
1965 + )}
1966 + onClick={() => onSelect({ kind: "stack", id: stack.id })}
1967 + onFocus={() => setRoving(fleetMoreNodeId(stack.id))}
1968 + >
1969 + <span className="truncate">
1970 + {gt("and {count} more", {
1971 + count: hidden,
1972 + $context: "a card standing for the machines of a group that are not drawn",
1973 + })}
1974 + </span>
1975 + </button>
1976 + )}
1977 + </div>
1978 + );
1979 + })}
1980 + {graph.nodes.map((node) => {
1981 + const rect = layout.nodes.get(node.id);
1982 + if (rect === undefined) return null;
1983 + const target = { kind: "node", id: node.id } as const;
1984 + if (node.kind === "client") {
1985 + const ClientIcon = isElectron ? AppWindowIcon : GlobeIcon;
1986 + return (
1987 + <button
1988 + key={node.id}
1989 + {...focusProps(target, rect, node.label)}
1990 + className={cn(
1991 + nodeClass(node.id),
1992 + "gap-2 rounded-full border border-foreground/25 bg-card px-3.5 text-foreground hover:border-foreground/50",
1993 + )}
1994 + >
1995 + <ClientIcon aria-hidden className="size-4 shrink-0 text-muted-foreground" />
1996 + <span className="truncate text-xs font-semibold">{node.label}</span>
1997 + </button>
1998 + );
1999 + }
2000 + const incoming = links.filter((edge) => edge.to === node.id);
2001 + if (node.kind === "target") {
2002 + // One link in names its access here. Several are told apart by the one in focus:
2003 + // hovering or selecting a host shows what that host may do on this machine.
2004 + const focused = incoming.filter((edge) => lit?.edges.has(edge.id));
2005 + const shown =
2006 + incoming.length === 1 ? incoming[0] : focused.length === 1 ? focused[0] : undefined;
2007 + const first = shown ?? incoming.toSorted(byTrouble)[0];
2008 + const compact = rect.height < 32;
2009 + return (
2010 + <button
2011 + key={node.id}
2012 + {...focusProps(
2013 + target,
2014 + rect,
2015 + [
2016 + node.label,
2017 + gt("known only through a link"),
2018 + ...incoming.map((edge) =>
2019 + gt("from {source}: {summary}", {
2020 + source: nodeById.get(edge.from)?.label ?? "",
2021 + summary: linkSummary(edge, gt, m),
2022 + }),
2023 + ),
2024 + ].join(", "),
2025 + )}
2026 + className={cn(
2027 + nodeClass(node.id),
2028 + "gap-2 border bg-card text-foreground/90 hover:border-foreground/50 hover:text-foreground",
2029 + compact ? cn("rounded-md px-2", APPEAR) : "rounded-lg px-2.5",
2030 + first ? healthBorder(first.health) : "border-border",
2031 + )}
2032 + >
2033 + <span className="flex w-3 shrink-0 justify-center">
2034 + {first ? <HealthGlyph health={first.health} /> : null}
2035 + </span>
2036 + <span className="min-w-0 flex-1">
2037 + <span
2038 + className={cn(
2039 + "block truncate",
2040 + compact ? "text-2xs leading-none" : "text-xs leading-4 font-medium",
2041 + )}
2042 + >
2043 + {node.label}
2044 + </span>
2045 + {compact || !first ? null : (
2046 + <span
2047 + className={cn(
2048 + "block truncate text-2xs leading-4",
2049 + first.health.kind === "reachable" && first.health.expiresInDays === null
2050 + ? "text-muted-foreground"
2051 + : healthTone(first.health),
2052 + )}
2053 + >
2054 + {shown === undefined
2055 + ? gt("{count, plural, one {# link in} other {# links in}}", {
2056 + count: incoming.length,
2057 + $context:
2058 + "how many machines hold a link to this machine; pairs with '# links out'",
2059 + })
2060 + : first.health.kind === "reachable" && first.health.expiresInDays === null
2061 + ? m(accessConfig[first.link.access].label)
2062 + : `${m(accessConfig[first.link.access].label)} · ${healthLabel(first.health, gt)}`}
2063 + </span>
2064 + )}
2065 + </span>
2066 + {compact || !shown ? null : (
2067 + <AccessMeter access={shown.link.access} className="text-foreground/70" />
2068 + )}
2069 + </button>
2070 + );
2071 + }
2072 + if (rect.height < 32) {
2073 + // Inside an open group of environments: its name and state; the details have the rest.
2074 + const state =
2075 + node.kind === "connect"
2076 + ? connectAvailabilityText(node.availability, gt)
2077 + : connectionStateText(node, environmentById.get(node.id), false, gt);
2078 + return (
2079 + <button
2080 + key={node.id}
2081 + {...focusProps(target, rect, `${node.label}, ${state}`)}
2082 + className={cn(
2083 + nodeClass(node.id),
2084 + "gap-1.5 rounded-md border border-dashed border-foreground/25 bg-card px-2 text-foreground/90 hover:border-foreground/50 hover:text-foreground",
2085 + APPEAR,
2086 + )}
2087 + >
2088 + <span
2089 + aria-hidden
2090 + className={cn(
2091 + "size-2 shrink-0 rounded-full",
2092 + node.kind === "environment" && node.enabled
2093 + ? connectionPhaseDotClassName(node.phase)
2094 + : "bg-muted-foreground/40",
2095 + )}
2096 + />
2097 + <span className="truncate text-2xs leading-none">{node.label}</span>
2098 + </button>
2099 + );
2100 + }
2101 + if (node.kind === "connect") {
2102 + const status = `${gt("Not added")} · ${connectAvailabilityText(node.availability, gt)}`;
2103 + return (
2104 + <button
2105 + key={node.id}
2106 + {...focusProps(
2107 + target,
2108 + rect,
2109 + gt("{label}, on your T3 Connect account, not added to this app. {status}", {
2110 + label: node.label,
2111 + status: connectAvailabilityText(node.availability, gt),
2112 + }),
2113 + )}
2114 + className={cn(
2115 + nodeClass(node.id),
2116 + "gap-2 rounded-lg border border-dashed border-foreground/30 bg-card/60 px-2.5 hover:border-foreground/55",
2117 + )}
2118 + >
2119 + <CloudIcon aria-hidden className="size-4 shrink-0 text-muted-foreground" />
2120 + <span className="min-w-0 flex-1">
2121 + <span className="block truncate text-xs leading-4 font-semibold text-foreground">
2122 + {node.label}
2123 + </span>
2124 + <span className="block truncate text-2xs leading-4 text-muted-foreground">
2125 + {status}
2126 + </span>
2127 + </span>
2128 + </button>
2129 + );
2130 + }
2131 + const environment = environmentById.get(node.id);
2132 + const routes = routeEdges.filter((edge) => edge.to === node.id);
2133 + const status = environmentStatusText(
2134 + node,
2135 + environment,
2136 + routes.length > 0 && routes.every((edge) => edge.state === "refused"),
2137 + links.filter((edge) => edge.from === node.id).length,
2138 + gt,
2139 + );
2140 + // The card's state is short; the name carries the reason and what it leaves unknown.
2141 + const spoken =
2142 + node.phase === "connected"
2143 + ? status
2144 + : gt("{status}. Links unknown", {
2145 + status: environment ? savedBackendStatus(environment, m).text : status,
2146 + });
2147 + const dimmed = !node.enabled || node.phase === "unsupported";
2148 + const handle = layout.handles.get(node.id);
2149 + const over = linkDrag?.overId === node.id;
2150 + return (
2151 + <div key={node.id}>
2152 + <button
2153 + {...focusProps(
2154 + target,
2155 + rect,
2156 + [
2157 + node.label,
2158 + spoken,
2159 + ...routes.map(
2160 + (edge) =>
2161 + `${edge.routeLabel ?? routeKindLabel(edge.routeKind, gt)}: ${routeStateLabel(edge.state, gt)}`,
2162 + ),
2163 + ].join(", "),
2164 + )}
2165 + className={cn(
2166 + nodeClass(node.id),
2167 + "gap-2 rounded-lg border bg-card px-2.5 text-card-foreground shadow-sm/5 hover:border-foreground/45",
2168 + dimmed ? "border-dashed border-foreground/25" : "border-foreground/20",
2169 + over && "border-primary",
2170 + )}
2171 + >
2172 + <span
2173 + className={cn(
2174 + "relative flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-foreground/80 forced-colors:border",
2175 + dimmed && "opacity-60",
2176 + )}
2177 + >
2178 + <EnvironmentMachineIcon kind={node.machine ?? "server"} className="size-3.5" />
2179 + <span
2180 + aria-hidden
2181 + className={cn(
2182 + "absolute -right-1 -bottom-1 size-2.5 rounded-full border-2 border-card",
2183 + node.enabled
2184 + ? connectionPhaseDotClassName(node.phase)
2185 + : "bg-muted-foreground/40",
2186 + )}
2187 + />
2188 + </span>
2189 + <span className={cn("min-w-0 flex-1 pr-1.5", dimmed && "opacity-70")}>
2190 + <span className="line-clamp-2 text-xs leading-4 font-semibold [overflow-wrap:anywhere]">
2191 + {node.label}
2192 + </span>
2193 + <span
2194 + className={cn(
2195 + "block truncate text-2xs leading-4",
2196 + node.outgoing === "error" && node.phase === "connected"
2197 + ? "text-destructive"
2198 + : "text-muted-foreground",
2199 + )}
2200 + >
2201 + {status}
2202 + </span>
2203 + </span>
2204 + </button>
2205 + {handle !== undefined && node.linking === "ready" ? (
2206 + <button
2207 + type="button"
2208 + data-fleet-item=""
2209 + tabIndex={node.id === tabStop ? 0 : -1}
2210 + aria-label={gt("Link {label} to another machine", { label: node.label })}
2211 + style={{ left: handle.x - 9, top: handle.y - 9 }}
2212 + onFocus={(event) => {
2213 + // Its own bounds: it straddles the card's edge, so the card can be in view
2214 + // while half the handle is not.
2215 + if (event.currentTarget.matches(":focus-visible")) {
2216 + onReveal({ x: handle.x - 9, y: handle.y - 9, width: 18, height: 18 });
2217 + }
2218 + }}
2219 + className={cn(
2220 + "absolute flex size-4.5 cursor-crosshair touch-none items-center justify-center rounded-full bg-primary text-primary-foreground outline-none hover:scale-110 focus-visible:ring-2 focus-visible:ring-foreground focus-visible:ring-inset motion-safe:transition-transform motion-safe:duration-150 forced-colors:border",
2221 + fade(nodeDimmed(node.id)),
2222 + )}
2223 + {...handleProps(node.id)}
2224 + >
2225 + <PlusIcon aria-hidden className="size-3" strokeWidth={2.5} />
2226 + </button>
2227 + ) : null}
2228 + </div>
2229 + );
2230 + })}
2231 + {[...selected].map((id) => {
2232 + const rect = layout.nodes.get(id);
2233 + if (rect === undefined) return null;
2234 + return (
2235 + <span
2236 + key={id}
2237 + aria-hidden
2238 + style={{
2239 + left: rect.x - 3,
2240 + top: rect.y - 3,
2241 + width: rect.width + 6,
2242 + height: rect.height + 6,
2243 + }}
2244 + className="pointer-events-none absolute rounded-xl border-2 border-primary bg-primary/6"
2245 + >
2246 + <span className="absolute -top-2 -left-2 flex size-4 items-center justify-center rounded-full bg-primary text-primary-foreground forced-colors:border">
2247 + <CheckIcon className="size-2.5" strokeWidth={3} />
2248 + </span>
2249 + </span>
2250 + );
2251 + })}
2252 + {linkDrag !== null ? (
2253 + <DragHint x={linkDrag.x} y={linkDrag.y}>
2254 + {dragOver !== null
2255 + ? actionText(dragAction(dragOver), nodeById.get(dragOver)?.label ?? "", gt)
2256 + : gt("Drop on a machine to link")}
2257 + </DragHint>
2258 + ) : null}
2259 + </div>
2260 + );
2261 +});
2262 +
2263 +function DragHint({ x, y, children }: { x: number; y: number; children: ReactNode }) {
2264 + return (
2265 + <p
2266 + role="status"
2267 + style={{ left: x + 14, top: y + 14 }}
2268 + className="pointer-events-none absolute z-10 rounded-md border border-border bg-popover px-2 py-1 text-2xs whitespace-nowrap text-popover-foreground shadow-sm/5"
2269 + >
2270 + {children}
2271 + </p>
2272 + );
2273 +}
apps/web/src/components/settings/EnvironmentsMapDetails.tsx new
+874
@@ -0,0 +1,874 @@
1 +import { useAtomValue } from "@effect/atom-react";
2 +import { connectionStatusTitle } from "@t3tools/client-runtime/connection";
3 +import type { PeerLinkHealth } from "@t3tools/client-runtime/state/peerLinks";
4 +import {
5 + AuthMcpClientAccess,
6 + type EnvironmentId,
7 + resolveEnvironmentMachineKind,
8 +} from "@t3tools/contracts";
9 +import * as DateTime from "effect/DateTime";
10 +import { T, useGT, useMessages } from "gt-react";
11 +import { ArrowRightIcon, ClockAlertIcon, PlusIcon, TriangleAlertIcon, XIcon } from "lucide-react";
12 +import { LegendList } from "@legendapp/list/react";
13 +import { type ReactNode, useRef, useState } from "react";
14 +
15 +import { environmentCatalog } from "~/connection/catalog";
16 +import { cn } from "~/lib/utils";
17 +import type { EnvironmentPresentation } from "~/state/environments";
18 +import { peerLinkEnvironment } from "~/state/peerLinks";
19 +import { useAtomCommand } from "~/state/use-atom-command";
20 +import { accessConfig } from "../auth/ConnectAgentSurface";
21 +import { Button } from "../ui/button";
22 +import { Input } from "../ui/input";
23 +import { formatAccessTimestamp } from "./ConnectionsSettings.logic";
24 +import { EnvironmentRow, EnvironmentTransportLabel } from "./EnvironmentRow";
25 +import {
26 + type FleetEnvironmentNode,
27 + type FleetFocus,
28 + type FleetGraph,
29 + type FleetLinkEdge,
30 + type FleetNode,
31 + type FleetStack,
32 + fleetLinkBackOffered,
33 + fleetSummary,
34 + fleetTwoWayLinks,
35 + isLinkEdge,
36 + linkNeedsAttention,
37 + linkTroubleRank,
38 +} from "./environmentsMap.logic";
39 +import { peerLinkStatusText, useForgetPeerLink } from "./LinkedEnvironmentsSettings";
40 +import { savedBackendStatus } from "./SavedEnvironmentRows";
41 +
42 +type GT = ReturnType<typeof useGT>;
43 +
44 +const ACCESS_LEVELS = AuthMcpClientAccess.literals;
45 +export const accessLevel = (access: AuthMcpClientAccess) => ACCESS_LEVELS.indexOf(access);
46 +
47 +/** Colour says how a link is doing; a healthy one stays neutral so trouble stands out. */
48 +export function healthTone(health: PeerLinkHealth): string {
49 + if (health.kind === "expired" || health.kind === "failing") return "text-destructive";
50 + if (health.kind === "unreachable") return "text-muted-foreground";
51 + return health.expiresInDays === null ? "text-foreground/70" : "text-warning";
52 +}
53 +
54 +export function healthLabel(health: PeerLinkHealth, gt: GT): string {
55 + switch (health.kind) {
56 + case "expired":
57 + return gt("Expired", { $context: "status of a link between two machines" });
58 + case "unreachable":
59 + return gt("Not answering");
60 + case "failing":
61 + return gt("Failing", { $context: "status of a link between two machines" });
62 + case "reachable":
63 + return health.expiresInDays === null
64 + ? gt("Reachable")
65 + : gt("{days, plural, one {Expires in {days} day} other {Expires in {days} days}}", {
66 + days: health.expiresInDays,
67 + });
68 + }
69 +}
70 +
71 +/** Five rising bars, filled up to the access a link grants: read only is one, full access five. */
72 +export function AccessMeter({
73 + access,
74 + className,
75 +}: {
76 + access: AuthMcpClientAccess;
77 + className?: string;
78 +}) {
79 + const level = accessLevel(access);
80 + return (
81 + <svg aria-hidden viewBox="0 0 19 12" className={cn("h-3 w-[19px] shrink-0", className)}>
82 + {ACCESS_LEVELS.map((step, index) => (
83 + <rect
84 + key={step}
85 + x={index * 4}
86 + y={8 - index * 2}
87 + width="3"
88 + height={4 + index * 2}
89 + rx="0.75"
90 + fill="currentColor"
91 + opacity={index <= level ? 1 : 0.22}
92 + />
93 + ))}
94 + </svg>
95 + );
96 +}
97 +
98 +export function HealthGlyph({ health }: { health: PeerLinkHealth }) {
99 + const tone = healthTone(health);
100 + if (health.kind === "expired") return <XIcon aria-hidden className={cn("size-3", tone)} />;
101 + if (health.kind === "failing") {
102 + return <TriangleAlertIcon aria-hidden className={cn("size-3", tone)} />;
103 + }
104 + if (health.kind === "unreachable") {
105 + return <span aria-hidden className="size-2 rounded-full border border-muted-foreground" />;
106 + }
107 + return health.expiresInDays === null ? (
108 + <span aria-hidden className="size-2 rounded-full bg-success forced-colors:border-4" />
109 + ) : (
110 + <ClockAlertIcon aria-hidden className={cn("size-3", tone)} />
111 + );
112 +}
113 +
114 +export interface FleetDetailsProps {
115 + readonly graph: FleetGraph;
116 + readonly stacks: ReadonlyArray<FleetStack>;
117 + readonly environments: ReadonlyArray<EnvironmentPresentation>;
118 + /** Why the account's T3 Connect machines are missing from the map, and how to ask again. */
119 + readonly connectProblem: { readonly message: string; readonly retry: () => void } | null;
120 + readonly selection: FleetFocus | null;
121 + /** The machine a map search landed on inside the selected stack. */
122 + readonly found: string | null;
123 + readonly onSelect: (focus: FleetFocus | null) => void;
124 + /** Opens the link flow from an environment, with no target picked yet. */
125 + readonly onLinkFrom: (sourceId: string) => void;
126 + /** Opens the link flow from a one-way link's target back to its source. */
127 + readonly onLinkBack: (edge: FleetLinkEdge) => void;
128 + readonly onToggleStack: (stackId: string) => void;
129 + /** The list's own row for a saved environment, or null where the list has none. */
130 + readonly renderSavedEnvironment: (environment: EnvironmentPresentation) => ReactNode;
131 + readonly renderConnectMachine: (environmentId: EnvironmentId) => ReactNode;
132 + readonly onAddEnvironment: (host?: string) => void;
133 +}
134 +
135 +const SECTION = "px-3 py-3 sm:px-4";
136 +
137 +/** What is selected on the map, with the controls the list keeps on each row. */
138 +export function FleetDetails(props: FleetDetailsProps) {
139 + const { graph, stacks, selection, onSelect, connectProblem } = props;
140 + const gt = useGT();
141 + const panel = useRef<HTMLDivElement>(null);
142 + const links = graph.edges.filter(isLinkEdge);
143 + const node =
144 + selection?.kind === "node" ? graph.nodes.find((entry) => entry.id === selection.id) : undefined;
145 + const edge =
146 + selection?.kind === "edge" ? links.find((entry) => entry.id === selection.id) : undefined;
147 + const stack =
148 + selection?.kind === "stack" ? stacks.find((entry) => entry.id === selection.id) : undefined;
149 + const labelOf = (id: string) => graph.nodes.find((entry) => entry.id === id)?.label ?? "";
150 + const pair = edge === undefined ? undefined : fleetTwoWayLinks(graph).get(edge.id);
151 + // Choosing inside the panel replaces the control that was pressed, so focus stays on the panel.
152 + const selectWithin = (focus: FleetFocus) => {
153 + onSelect(focus);
154 + panel.current?.focus();
155 + };
156 + return (
157 + <div
158 + ref={panel}
159 + tabIndex={-1}
160 + role="group"
161 + aria-label={gt("Details")}
162 + className="min-h-20 border-t border-border/60 text-xs outline-none"
163 + >
164 + {connectProblem ? (
165 + <div className="flex flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-border/60 px-3 py-2 sm:px-4">
166 + <p className="min-w-0 flex-1 text-muted-foreground">
167 + <span className="font-medium text-destructive">
168 + <T>Could not load T3 Connect environments</T>
169 + </span>{" "}
170 + {connectProblem.message}
171 + </p>
172 + <Button size="xs" variant="outline" onClick={connectProblem.retry}>
173 + {gt("Try again")}
174 + </Button>
175 + </div>
176 + ) : null}
177 + {pair ? (
178 + <div className={SECTION}>
179 + <p className="mb-3 text-muted-foreground">{gt("Two links, one each way.")}</p>
180 + <div className="space-y-4">
181 + {[pair.forward, pair.back].map((link) => (
182 + <LinkDetails
183 + key={link.id}
184 + edge={link}
185 + sourceLabel={labelOf(link.from)}
186 + targetLabel={labelOf(link.to)}
187 + onSelect={selectWithin}
188 + {...(fleetLinkBackOffered(graph, link)
189 + ? { onLinkBack: () => props.onLinkBack(link) }
190 + : {})}
191 + />
192 + ))}
193 + </div>
194 + </div>
195 + ) : edge ? (
196 + <div className={SECTION}>
197 + <LinkDetails
198 + key={edge.id}
199 + edge={edge}
200 + sourceLabel={labelOf(edge.from)}
201 + targetLabel={labelOf(edge.to)}
202 + onSelect={selectWithin}
203 + {...(fleetLinkBackOffered(graph, edge)
204 + ? { onLinkBack: () => props.onLinkBack(edge) }
205 + : {})}
206 + />
207 + </div>
208 + ) : stack ? (
209 + <StackDetails
210 + key={`${stack.id}:${props.found ?? ""}`}
211 + stack={stack}
212 + graph={graph}
213 + links={links}
214 + environments={props.environments}
215 + found={props.found}
216 + onSelect={selectWithin}
217 + onToggle={() => props.onToggleStack(stack.id)}
218 + />
219 + ) : node ? (
220 + <NodeDetails {...props} key={node.id} node={node} links={links} onSelect={selectWithin} />
221 + ) : (
222 + <FleetSummary graph={graph} links={links} />
223 + )}
224 + </div>
225 + );
226 +}
227 +
228 +function Heading({ children, detail }: { children: ReactNode; detail?: ReactNode }) {
229 + return (
230 + <div className="mb-2 flex flex-wrap items-baseline gap-x-2 gap-y-0.5">
231 + <h3 className="text-sm font-medium text-foreground">{children}</h3>
232 + {detail ? <span className="text-muted-foreground">{detail}</span> : null}
233 + </div>
234 + );
235 +}
236 +
237 +function FleetSummary({
238 + graph,
239 + links,
240 +}: {
241 + readonly graph: FleetGraph;
242 + readonly links: ReadonlyArray<FleetLinkEdge>;
243 +}) {
244 + const gt = useGT();
245 + const summary = fleetSummary(graph);
246 + const attention = links.filter((edge) => linkNeedsAttention(edge.health)).length;
247 + const { machines } = summary;
248 + return (
249 + <div className={SECTION}>
250 + <Heading
251 + detail={
252 + summary.loading
253 + ? gt("Loading links…")
254 + : attention > 0
255 + ? gt("{count, plural, one {# needs attention} other {# need attention}}", {
256 + count: attention,
257 + $context: "after a count of links: how many of those links have a problem",
258 + })
259 + : null
260 + }
261 + >
262 + {summary.links !== null
263 + ? gt(
264 + "{machines, plural, one {# machine} other {# machines}}, {links, plural, =0 {no links} one {# link} other {# links}}",
265 + { machines, links: summary.links },
266 + )
267 + : gt("{machines, plural, one {# machine} other {# machines}}", { machines })}
268 + </Heading>
269 + </div>
270 + );
271 +}
272 +
273 +/** One link as a row: what it reaches, the access in words, where, and how it is doing. */
274 +function LinkButton({
275 + edge,
276 + label,
277 + onSelect,
278 +}: {
279 + readonly edge: FleetLinkEdge;
280 + readonly label: string;
281 + readonly onSelect: (focus: FleetFocus) => void;
282 +}) {
283 + const gt = useGT();
284 + const m = useMessages();
285 + const attention = linkNeedsAttention(edge.health);
286 + return (
287 + <li>
288 + <button
289 + type="button"
290 + className="grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)_auto] items-center gap-x-3 rounded-md px-1.5 py-1 text-left outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset lg:grid-cols-[auto_minmax(0,10rem)_minmax(0,10rem)_minmax(0,1fr)_auto]"
291 + onClick={() => onSelect({ kind: "edge", id: edge.id })}
292 + >
293 + <AccessMeter access={edge.link.access} className="text-foreground/80" />
294 + <span className="truncate font-medium text-foreground">{label}</span>
295 + <span className="truncate text-foreground/80">
296 + {m(accessConfig[edge.link.access].label)}
297 + </span>
298 + <span className="hidden truncate font-mono text-2xs text-muted-foreground lg:block">
299 + {edge.link.urls[0]}
300 + </span>
301 + <span
302 + className={cn(
303 + "flex shrink-0 items-center gap-1.5",
304 + attention ? healthTone(edge.health) : "text-muted-foreground",
305 + )}
306 + >
307 + <HealthGlyph health={edge.health} />
308 + {attention
309 + ? healthLabel(edge.health, gt)
310 + : gt("Expires {date}", {
311 + date: formatAccessTimestamp(DateTime.formatIso(edge.link.expiresAt)),
312 + $context: "the date a link between two machines stops working",
313 + })}
314 + </span>
315 + </button>
316 + </li>
317 + );
318 +}
319 +
320 +const MEMBER_ROW_HEIGHT = 28;
321 +const MEMBER_LIST_ROWS = 9;
322 +
323 +interface StackMember {
324 + readonly id: string;
325 + readonly label: string;
326 + /** What the row says about the machine: its link's access, or why it is not connected. */
327 + readonly detail: string;
328 + readonly address: string | null;
329 + /** The link that most wants attention, for a machine known through links. */
330 + readonly worst: FleetLinkEdge | null;
331 +}
332 +
333 +/**
334 + * Every machine a stack stands for, however many: the list mounts only the rows in view, and
335 + * a machine's own details, with its actions, are one click away.
336 + */
337 +function StackDetails({
338 + stack,
339 + graph,
340 + links,
341 + environments,
342 + found,
343 + onSelect,
344 + onToggle,
345 +}: {
346 + readonly stack: FleetStack;
347 + readonly graph: FleetGraph;
348 + readonly links: ReadonlyArray<FleetLinkEdge>;
349 + readonly environments: ReadonlyArray<EnvironmentPresentation>;
350 + /** The machine a map search landed on: the list opens narrowed to it. */
351 + readonly found: string | null;
352 + readonly onSelect: (focus: FleetFocus) => void;
353 + readonly onToggle: () => void;
354 +}) {
355 + const gt = useGT();
356 + const m = useMessages();
357 + const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));
358 + const [query, setQuery] = useState(found === null ? "" : (nodeById.get(found)?.label ?? ""));
359 + const memberIds = new Set(stack.memberIds);
360 + const incoming = new Map<string, FleetLinkEdge[]>();
361 + for (const edge of links) {
362 + if (!memberIds.has(edge.to)) continue;
363 + const into = incoming.get(edge.to);
364 + if (into === undefined) incoming.set(edge.to, [edge]);
365 + else into.push(edge);
366 + }
367 + const environmentById = new Map(
368 + environments.map((environment) => [environment.environmentId, environment]),
369 + );
370 + const members = stack.memberIds.flatMap((id): StackMember[] => {
371 + const node = nodeById.get(id);
372 + if (node === undefined || node.kind === "client") return [];
373 + if (node.kind === "target") {
374 + const into = incoming.get(id) ?? [];
375 + const worst = into.toSorted(
376 + (left, right) => linkTroubleRank(left.health) - linkTroubleRank(right.health),
377 + )[0];
378 + return [
379 + {
380 + id,
381 + label: node.label,
382 + detail:
383 + into.length === 1 && worst !== undefined
384 + ? m(accessConfig[worst.link.access].label)
385 + : gt("{count, plural, one {# link in} other {# links in}}", { count: into.length }),
386 + address: node.address,
387 + worst: worst ?? null,
388 + },
389 + ];
390 + }
391 + const environment = environmentById.get(node.environmentId);
392 + return [
393 + {
394 + id,
395 + label: node.label,
396 + detail:
397 + environment === undefined ? gt("Not added") : savedBackendStatus(environment, m).text,
398 + address: null,
399 + worst: null,
400 + },
401 + ];
402 + });
403 + const needle = query.trim().toLocaleLowerCase();
404 + const shown =
405 + needle === ""
406 + ? members
407 + : members.filter((member) => member.label.toLocaleLowerCase().includes(needle));
408 + const range =
409 + stack.firstLabel === stack.lastLabel
410 + ? stack.firstLabel
411 + : `${stack.firstLabel} … ${stack.lastLabel}`;
412 + const sources = stack.sources.map((source) => nodeById.get(source.sourceId)?.label ?? "");
413 + const [only] = stack.sources;
414 + return (
415 + <div className={SECTION}>
416 + <div className="flex flex-wrap items-start justify-between gap-2">
417 + <Heading
418 + detail={(stack.kind === "environments"
419 + ? [
420 + gt("{count, plural, one {# environment} other {# environments}}", {
421 + count: members.length,
422 + }),
423 + gt("No links", { $context: "these environments take part in no link" }),
424 + ]
425 + : [
426 + gt("{machines, plural, one {# machine} other {# machines}}", {
427 + machines: members.length,
428 + }),
429 + sources.join(", "),
430 + ...(stack.sources.length === 1 && only !== undefined
431 + ? [m(accessConfig[only.access].label)]
432 + : []),
433 + gt("{reachable, plural, =0 {None reachable} other {# reachable}}", {
434 + reachable: stack.reachable,
435 + $context:
436 + "on a card for a group of linked machines: how many of them answer right now",
437 + }),
438 + ]
439 + ).join(" · ")}
440 + >
441 + {range}
442 + </Heading>
443 + <Button size="xs" variant="outline" onClick={onToggle}>
444 + {stack.expanded
445 + ? gt("Collapse", { $context: "button: folds a group of machines back into one card" })
446 + : gt("Show on map")}
447 + </Button>
448 + </div>
449 + {members.length > MEMBER_LIST_ROWS ? (
450 + <div className="mb-1.5 flex items-center gap-3">
451 + <div className="w-56">
452 + <Input
453 + size="compact"
454 + type="search"
455 + value={query}
456 + aria-label={gt("Filter these machines by name")}
457 + placeholder={gt("Filter by name")}
458 + onChange={(event) => setQuery(event.target.value)}
459 + />
460 + </div>
461 + {needle === "" ? null : (
462 + <span role="status" className="text-muted-foreground">
463 + {gt("{shown} of {count}", { shown: shown.length, count: members.length })}
464 + </span>
465 + )}
466 + </div>
467 + ) : null}
468 + <div
469 + className="-mx-1.5"
470 + style={{ height: Math.min(shown.length, MEMBER_LIST_ROWS) * MEMBER_ROW_HEIGHT }}
471 + >
472 + <LegendList<StackMember>
473 + data={shown}
474 + keyExtractor={(member) => member.id}
475 + estimatedItemSize={MEMBER_ROW_HEIGHT}
476 + drawDistance={MEMBER_ROW_HEIGHT * MEMBER_LIST_ROWS}
477 + recycleItems
478 + className="h-full overscroll-contain"
479 + renderItem={({ item }) => <MemberButton member={item} onSelect={onSelect} />}
480 + />
481 + </div>
482 + </div>
483 + );
484 +}
485 +
486 +function MemberButton({
487 + member,
488 + onSelect,
489 +}: {
490 + readonly member: StackMember;
491 + readonly onSelect: (focus: FleetFocus) => void;
492 +}) {
493 + const gt = useGT();
494 + const { worst } = member;
495 + const attention = worst !== null && linkNeedsAttention(worst.health);
496 + return (
497 + <button
498 + type="button"
499 + style={{ height: MEMBER_ROW_HEIGHT }}
500 + className="grid w-full cursor-pointer grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] items-center gap-x-3 rounded-md px-1.5 text-left outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset lg:grid-cols-[minmax(0,12rem)_minmax(0,10rem)_minmax(0,1fr)_auto]"
501 + onClick={() => onSelect({ kind: "node", id: member.id })}
502 + >
503 + <span className="truncate font-medium text-foreground">{member.label}</span>
504 + <span className="truncate text-foreground/80">{member.detail}</span>
505 + <span className="hidden truncate font-mono text-2xs text-muted-foreground lg:block">
506 + {member.address}
507 + </span>
508 + {worst === null ? (
509 + <span />
510 + ) : (
511 + <span
512 + className={cn(
513 + "flex shrink-0 items-center gap-1.5",
514 + attention ? healthTone(worst.health) : "text-muted-foreground",
515 + )}
516 + >
517 + <HealthGlyph health={worst.health} />
518 + {healthLabel(worst.health, gt)}
519 + </span>
520 + )}
521 + </button>
522 + );
523 +}
524 +
525 +function LinkAnother({
526 + node,
527 + onLinkFrom,
528 +}: {
529 + readonly node: FleetEnvironmentNode;
530 + readonly onLinkFrom: (sourceId: string) => void;
531 +}) {
532 + const gt = useGT();
533 + // The command's own permission, which follows the session as the node's snapshot cannot.
534 + const canLink = useAtomValue(peerLinkEnvironment.link.permissionAtom(node.environmentId));
535 + if (!canLink || node.linking !== "ready") return null;
536 + return (
537 + <Button size="xs" onClick={() => onLinkFrom(node.id)}>
538 + <PlusIcon className="size-3" />
539 + {gt("Link", { $context: "verb, links an environment" })}
540 + </Button>
541 + );
542 +}
543 +
544 +function Reconnect({ environment }: { readonly environment: EnvironmentPresentation }) {
545 + const gt = useGT();
546 + const m = useMessages();
547 + const retryNow = useAtomCommand(environmentCatalog.retryNow);
548 + const { phase } = environment.connection;
549 + if (!environment.entry.enabled || phase === "connected" || phase === "unsupported") return null;
550 + return (
551 + <div className="flex flex-wrap items-center gap-2">
552 + <span className="text-muted-foreground">{savedBackendStatus(environment, m).text}</span>
553 + <Button
554 + size="xs"
555 + variant="outline"
556 + disabled={phase === "connecting"}
557 + onClick={() => void retryNow(environment.environmentId)}
558 + >
559 + {gt("Reconnect")}
560 + </Button>
561 + </div>
562 + );
563 +}
564 +
565 +function linksNote(node: FleetEnvironmentNode, gt: GT): string | null {
566 + if (node.phase !== "connected") {
567 + return gt("Not connected, so its links are not shown.");
568 + }
569 + switch (node.outgoing) {
570 + case "off":
571 + return gt("To link from {label}, turn on Linked environments in its Labs settings.", {
572 + label: node.label,
573 + });
574 + case "unknown":
575 + return gt("This app may not read the links {label} holds.", { label: node.label });
576 + case "error":
577 + return gt("Could not load the links {label} holds: {error}", {
578 + label: node.label,
579 + error: node.outgoingError ?? "",
580 + });
581 + case "loading":
582 + return gt("Loading linked environments…");
583 + case "loaded":
584 + return null;
585 + }
586 +}
587 +
588 +function LinkList({
589 + title,
590 + action,
591 + edges,
592 + labelOf,
593 + onSelect,
594 +}: {
595 + readonly title: string | null;
596 + readonly action?: ReactNode;
597 + readonly edges: ReadonlyArray<FleetLinkEdge>;
598 + readonly labelOf: (edge: FleetLinkEdge) => string;
599 + readonly onSelect: (focus: FleetFocus) => void;
600 +}) {
601 + return (
602 + <section>
603 + <div className="mb-1 flex min-h-6 items-center gap-3">
604 + {title === null ? null : <h4 className="font-medium text-foreground">{title}</h4>}
605 + {action}
606 + </div>
607 + {edges.length > 0 ? (
608 + <ul className="-mx-1.5 max-h-48 overflow-y-auto">
609 + {edges.map((edge) => (
610 + <LinkButton key={edge.id} edge={edge} label={labelOf(edge)} onSelect={onSelect} />
611 + ))}
612 + </ul>
613 + ) : null}
614 + </section>
615 + );
616 +}
617 +
618 +function NodeDetails({
619 + node,
620 + graph,
621 + links,
622 + environments,
623 + onSelect,
624 + onLinkFrom,
625 + renderSavedEnvironment,
626 + renderConnectMachine,
627 + onAddEnvironment,
628 +}: Omit<FleetDetailsProps, "selection" | "found" | "stacks" | "onToggleStack" | "onSelect"> & {
629 + readonly node: FleetNode;
630 + readonly links: ReadonlyArray<FleetLinkEdge>;
631 + readonly onSelect: (focus: FleetFocus) => void;
632 +}) {
633 + const gt = useGT();
634 + const m = useMessages();
635 + const labelOf = (id: string) => graph.nodes.find((entry) => entry.id === id)?.label ?? "";
636 + if (node.kind === "client") {
637 + const hosts = graph.nodes.filter((entry) => entry.kind === "environment");
638 + return (
639 + <div className={SECTION}>
640 + <Heading
641 + detail={gt("{connected} of {total} connected", {
642 + connected: hosts.filter((entry) => entry.phase === "connected").length,
643 + total: hosts.length,
644 + })}
645 + >
646 + {node.label}
647 + </Heading>
648 + <p className="text-muted-foreground">
649 + {gt("Each line from here is a saved route to an environment.")}
650 + </p>
651 + </div>
652 + );
653 + }
654 + const out = links.filter((edge) => edge.from === node.id);
655 + const incoming = links.filter((edge) => edge.to === node.id);
656 + const linkedFrom = (
657 + <LinkList
658 + title={gt(
659 + "{count, plural, =0 {No known machine links here} one {Linked from # machine} other {Linked from # machines}}",
660 + { count: incoming.length },
661 + )}
662 + edges={incoming}
663 + labelOf={(edge) => labelOf(edge.from)}
664 + onSelect={onSelect}
665 + />
666 + );
667 + if (node.kind === "connect") {
668 + return (
669 + <>
670 + {renderConnectMachine(node.environmentId)}
671 + <div className={cn(SECTION, "space-y-3 border-t border-border/60")}>
672 + <p className="max-w-2xl text-muted-foreground">
673 + {gt("Add {label} to this app to connect to it.", { label: node.label })}
674 + </p>
675 + {incoming.length > 0 ? linkedFrom : null}
676 + </div>
677 + </>
678 + );
679 + }
680 + if (node.kind === "target") {
681 + return (
682 + <div className={SECTION}>
683 + <div className="flex flex-wrap items-start justify-between gap-2">
684 + <Heading detail={gt("Known only through a link")}>{node.label}</Heading>
685 + <Button
686 + size="xs"
687 + variant="outline"
688 + onClick={() => onAddEnvironment(node.address ?? undefined)}
689 + >
690 + <PlusIcon className="size-3" />
691 + {gt("Add environment")}
692 + </Button>
693 + </div>
694 + {/* A machine known only through its links is its links, so each one is shown in full. */}
695 + <div className="space-y-4">
696 + {incoming.map((edge) => (
697 + <LinkDetails
698 + key={edge.id}
699 + edge={edge}
700 + sourceLabel={labelOf(edge.from)}
701 + targetLabel={node.label}
702 + onSelect={onSelect}
703 + />
704 + ))}
705 + </div>
706 + <p className="mt-3 max-w-2xl text-muted-foreground">
707 + {gt("Not connected, so its links are not shown.")}
708 + </p>
709 + </div>
710 + );
711 + }
712 + const environment = environments.find((entry) => entry.environmentId === node.environmentId);
713 + const saved = environment ? renderSavedEnvironment(environment) : null;
714 + const note = linksNote(node, gt);
715 + const loaded = node.outgoing === "loaded";
716 + return (
717 + <>
718 + {saved ??
719 + (environment ? (
720 + <EnvironmentRow
721 + kind={resolveEnvironmentMachineKind(environment.serverConfig)}
722 + label={environment.label}
723 + subtitle={
724 + <>
725 + <EnvironmentTransportLabel environment={environment} />
726 + {" · "}
727 + {connectionStatusTitle(environment.connection, m)}
728 + {environment.serverConfig
729 + ? ` · ${environment.serverConfig.environment.serverVersion}`
730 + : ""}
731 + </>
732 + }
733 + />
734 + ) : null)}
735 + <div className={cn(SECTION, "space-y-3 border-t border-border/60")}>
736 + {environment && saved !== null ? <Reconnect environment={environment} /> : null}
737 + {note ? <p className="max-w-2xl text-muted-foreground">{note}</p> : null}
738 + <LinkList
739 + title={
740 + loaded
741 + ? gt(
742 + "{count, plural, =0 {Links to no one} one {Links to # machine} other {Links to # machines}}",
743 + { count: out.length },
744 + )
745 + : null
746 + }
747 + action={<LinkAnother node={node} onLinkFrom={onLinkFrom} />}
748 + edges={out}
749 + labelOf={(edge) => labelOf(edge.to)}
750 + onSelect={onSelect}
751 + />
752 + {linkedFrom}
753 + </div>
754 + </>
755 + );
756 +}
757 +
758 +function LinkDetails({
759 + edge,
760 + sourceLabel,
761 + targetLabel,
762 + onSelect,
763 + onLinkBack,
764 +}: {
765 + readonly edge: FleetLinkEdge;
766 + readonly sourceLabel: string;
767 + readonly targetLabel: string;
768 + readonly onSelect: (focus: FleetFocus) => void;
769 + /** Set where this app can link the target back to the source with no pasted code. */
770 + readonly onLinkBack?: () => void;
771 +}) {
772 + const gt = useGT();
773 + const m = useMessages();
774 + const { link, health } = edge;
775 + const canUnlink = useAtomValue(
776 + peerLinkEnvironment.unlink.permissionAtom(edge.sourceEnvironmentId),
777 + );
778 + const { busy, forget } = useForgetPeerLink(edge.sourceEnvironmentId, link);
779 + const access = accessConfig[link.access];
780 + const when = (value: DateTime.Utc) => formatAccessTimestamp(DateTime.formatIso(value));
781 + const term = "text-muted-foreground";
782 + const endpoint =
783 + "cursor-pointer rounded-sm font-medium text-foreground underline-offset-2 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset";
784 + return (
785 + <div>
786 + <div className="mb-2 flex flex-wrap items-center justify-between gap-2">
787 + <h3 className="flex min-w-0 flex-wrap items-center gap-1.5 text-sm">
788 + <button
789 + type="button"
790 + className={endpoint}
791 + onClick={() => onSelect({ kind: "node", id: edge.from })}
792 + >
793 + {sourceLabel}
794 + </button>
795 + <ArrowRightIcon
796 + role="img"
797 + aria-label={gt("links to", { $context: "between two machine names: A links to B" })}
798 + className="size-3.5 text-muted-foreground"
799 + />
800 + <button
801 + type="button"
802 + className={endpoint}
803 + onClick={() => onSelect({ kind: "node", id: edge.to })}
804 + >
805 + {targetLabel}
806 + </button>
807 + </h3>
808 + <div className="flex items-center gap-2">
809 + {onLinkBack ? (
810 + <Button size="xs" variant="outline" onClick={onLinkBack}>
811 + {gt("Link back…", {
812 + $context: "button: also link the second machine to the first one",
813 + })}
814 + </Button>
815 + ) : null}
816 + {canUnlink ? (
817 + <Button
818 + size="xs"
819 + variant="destructive-outline"
820 + disabled={busy}
821 + onClick={() => void forget()}
822 + >
823 + {busy ? gt("Forgetting…") : gt("Forget")}
824 + </Button>
825 + ) : null}
826 + </div>
827 + </div>
828 + <dl className="grid max-w-2xl grid-cols-[auto_1fr] gap-x-4 gap-y-1.5">
829 + <dt className={term}>{gt("Access", { $context: "access level" })}</dt>
830 + <dd>
831 + <span className="flex items-center gap-2 font-medium text-foreground">
832 + <AccessMeter access={link.access} className="text-foreground/80" />
833 + {m(access.label)}
834 + </span>
835 + <span className="text-muted-foreground">{m(access.description)}</span>
836 + </dd>
837 + <dt className={term}>
838 + {gt("Status", { $context: "state of a link between two machines" })}
839 + </dt>
840 + <dd
841 + className={cn(
842 + "flex items-center gap-1.5",
843 + linkNeedsAttention(health) ? healthTone(health) : "text-foreground",
844 + )}
845 + >
846 + <HealthGlyph health={health} />
847 + {peerLinkStatusText(health, gt)}
848 + </dd>
849 + <dt className={term}>
850 + {gt("Expires", { $context: "label before the date a link expires" })}
851 + </dt>
852 + <dd className="text-foreground">{when(link.expiresAt)}</dd>
853 + <dt className={term}>{gt("Addresses")}</dt>
854 + <dd className="min-w-0 font-mono text-2xs break-all text-foreground">
855 + {link.urls.map((url) => (
856 + <span key={url} className="block">
857 + {url}
858 + </span>
859 + ))}
860 + </dd>
861 + <dt className={term}>
862 + {gt("Linked", { $context: "label before the date a link was made" })}
863 + </dt>
864 + <dd className="text-foreground">{when(link.linkedAt)}</dd>
865 + {link.lastReachedAt ? (
866 + <>
867 + <dt className={term}>{gt("Last reached")}</dt>
868 + <dd className="text-foreground">{when(link.lastReachedAt)}</dd>
869 + </>
870 + ) : null}
871 + </dl>
872 + </div>
873 + );
874 +}
apps/web/src/components/settings/LinkSeveralEnvironments.tsx
+148 -21
@@ -17,8 +17,9 @@ import * as Result from "effect/Result";
17 import { T, useGT, useMessages } from "gt-react";
18 import { useId, useRef, useState } from "react";
19
20 +import { useEnvironments } from "~/state/environments";
21 import { mintPairingCodeOn } from "~/state/peerPairingCode";
21 -import { peerLinkEnvironment, useLinkableMachines } from "~/state/peerLinks";
22 +import { peerLinkEnvironment, useLinkableMachines, useLinkBackOffers } from "~/state/peerLinks";
23 import { useEnvironmentQuery } from "~/state/query";
24 import { useEnvironmentsWithScope } from "~/state/session";
25 import { useAtomCommand } from "~/state/use-atom-command";
@@ -34,60 +35,118 @@ import {
35 DialogPanel,
36 DialogPopup,
37 DialogTitle,
37 - DialogTrigger,
38 } from "../ui/dialog";
39 import { LinkAccessPicker } from "./LinkAccessPicker";
40
41 const NO_MACHINES: ReadonlySet<EnvironmentId> = new Set();
42 const NO_OUTCOMES: ReadonlyMap<EnvironmentId, LinkBatchOutcome> = new Map();
43
44 +export function LinkSeveralEnvironmentsAction({
45 + environmentId,
46 +}: {
47 + readonly environmentId: EnvironmentId;
48 +}) {
49 + const [open, setOpen] = useState(false);
50 + return (
51 + <>
52 + <Button size="xs" variant="outline" onClick={() => setOpen(true)}>
53 + <T>Link several…</T>
54 + </Button>
55 + <LinkSeveralEnvironmentsDialog
56 + environmentId={environmentId}
57 + open={open}
58 + onOpenChange={setOpen}
59 + />
60 + </>
61 + );
62 +}
63 +
64 /**
65 * Links the machines this app already reaches in one go. Each pairing code is
66 * minted on its machine and passed straight to the linking environment; none
67 * is ever held in state, shown, or logged.
68 */
49 -export function LinkSeveralEnvironmentsAction({
69 +export function LinkSeveralEnvironmentsDialog({
70 environmentId,
71 + open,
72 + onOpenChange,
73 + preset,
74 + presetOnly = false,
75 }: {
76 readonly environmentId: EnvironmentId;
77 + readonly open: boolean;
78 + readonly onOpenChange: (open: boolean) => void;
79 + /** Machines picked before the dialog opened. Those a batch cannot link stay unticked. */
80 + readonly preset?: ReadonlyArray<EnvironmentId>;
81 + /** Lists only the `preset` machines: they were picked for this link, not as a suggestion. */
82 + readonly presetOnly?: boolean;
83 }) {
84 const gt = useGT();
85 const m = useMessages();
86 const formId = useId();
57 - const [open, setOpen] = useState(false);
58 - const machines = useLinkableMachines(environmentId, open);
87 + const sourceLabel = useEnvironments().environments.find(
88 + (environment) => environment.environmentId === environmentId,
89 + )?.label;
90 + const known = useLinkableMachines(environmentId, open);
91 + const machines =
92 + presetOnly && preset !== undefined
93 + ? known.filter((machine) => preset.includes(machine.environmentId))
94 + : known;
95 // The same shared list `useLinkableMachines` reads `linked` from.
96 const links = useEnvironmentQuery(
97 open ? peerLinkEnvironment.list({ environmentId, input: {} }) : null,
98 );
99 const linksState = linkListState(links);
100 const writable = useEnvironmentsWithScope(machines, AuthAccessWriteScope);
65 - const [selected, setSelected] = useState(NO_MACHINES);
101 + const [selected, setSelected] = useState<ReadonlySet<EnvironmentId>>(() => new Set(preset));
102 const [access, setAccess] = useState<AuthMcpClientAccess>("approval-required");
103 const [outcomes, setOutcomes] = useState(NO_OUTCOMES);
104 const [linking, setLinking] = useState(NO_MACHINES);
105 // Enter then a click can both run before a re-render; this guard is synchronous.
106 const inFlight = useRef(false);
107 + // The failure cause holds the request, and with it the code; keep it out of the console.
108 + const quiet = { reportFailure: false, reportDefect: false };
109 const link = useAtomCommand(peerLinkEnvironment.linkInBatch, {
110 label: "link several environments",
73 - // The failure cause holds the request, and with it the code; keep it out of the console.
74 - reportFailure: false,
75 - reportDefect: false,
111 + ...quiet,
112 });
113 + // Each machine links back once, so each refreshes its own list.
114 + const linkOn = useAtomCommand(peerLinkEnvironment.link, {
115 + label: "link environment back",
116 + ...quiet,
117 + });
118 + const [alsoLinkBack, setAlsoLinkBack] = useState(false);
119 const candidates = linkBatchCandidates(machines, writable, linksState);
120 const selectable = candidates.flatMap(({ machine, blocked }) =>
121 blocked === null && outcomes.get(machine.environmentId)?.kind !== "linked" ? [machine] : [],
122 );
123 const chosen = selectable.filter((machine) => selected.has(machine.environmentId));
124 + const linkBack = useLinkBackOffers(
125 + environmentId,
126 + selectable.map((machine) => machine.environmentId),
127 + open,
128 + );
129 + const canLinkBack = (machine: { readonly environmentId: EnvironmentId }) =>
130 + linkBack.offerFor(machine.environmentId).kind === "offered";
131 + const backOffered = linkBack.source !== null && selectable.some(canLinkBack);
132 + const oneWayOnly = chosen.filter((machine) => !canLinkBack(machine)).length;
133 const busy = linking.size > 0;
134 const summary = linkBatchSummary(outcomes);
135 + const backFailed = [...outcomes.values()].filter(
136 + (outcome) => outcome.kind === "linked" && outcome.back?.kind === "failed",
137 + ).length;
138 + // Picked on the map, but only another machine's link names them: this app has no session there.
139 + const unlisted = (preset ?? []).filter(
140 + (id) => !candidates.some(({ machine }) => machine.environmentId === id),
141 + ).length;
142
143 const handleOpenChange = (next: boolean) => {
86 - setOpen(next);
144 + onOpenChange(next);
145 if (!next) {
146 setSelected(NO_MACHINES);
147 setOutcomes(NO_OUTCOMES);
148 setAccess("approval-required");
149 + setAlsoLinkBack(false);
150 }
151 };
152 const toggle = (id: EnvironmentId, checked: boolean) =>
@@ -111,6 +170,20 @@ export function LinkSeveralEnvironmentsAction({
170 ? Result.succeed(result.value)
171 : Result.fail(squashAtomCommandFailure(result));
172 },
173 + ...(alsoLinkBack && linkBack.source !== null
174 + ? {
175 + back: {
176 + source: linkBack.source,
177 + targets: new Set(chosen.filter(canLinkBack).map((machine) => machine.environmentId)),
178 + link: async (targetId, input) => {
179 + const result = await linkOn({ environmentId: targetId, input });
180 + return result._tag === "Success"
181 + ? Result.succeed(result.value)
182 + : Result.fail(squashAtomCommandFailure(result));
183 + },
184 + },
185 + }
186 + : {}),
187 refreshLinks: links.refresh,
188 onOutcome: (id, outcome) => {
189 setOutcomes((current) => new Map(current).set(id, outcome));
@@ -135,17 +208,12 @@ export function LinkSeveralEnvironmentsAction({
208 handleOpenChange(next);
209 }}
210 >
138 - <DialogTrigger
139 - render={
140 - <Button size="xs" variant="outline">
141 - <T>Link several…</T>
142 - </Button>
143 - }
144 - />
211 <DialogPopup className="max-w-md">
212 <DialogHeader>
213 <DialogTitle>
148 - <T>Link several environments</T>
214 + {sourceLabel === undefined
215 + ? gt("Link several environments")
216 + : gt("Link several machines from {source}", { source: sourceLabel })}
217 </DialogTitle>
218 <DialogDescription>
219 <T>
@@ -166,7 +234,11 @@ export function LinkSeveralEnvironmentsAction({
234 >
235 {candidates.length === 0 ? (
236 <p className="text-sm text-muted-foreground">
169 - <T>This app knows no other machines. Add them under Environments first.</T>
237 + {presetOnly ? (
238 + <T>This app is not connected to any of the machines you picked.</T>
239 + ) : (
240 + <T>This app knows no other machines. Add them under Environments first.</T>
241 + )}
242 </p>
243 ) : (
244 <div className="space-y-1.5">
@@ -225,10 +297,21 @@ export function LinkSeveralEnvironmentsAction({
297 const id = machine.environmentId;
298 const outcome = outcomes.get(id);
299 const available = blocked === null && outcome?.kind !== "linked";
300 + const back = outcome?.kind === "linked" ? outcome.back : undefined;
301 const status = linking.has(id)
302 ? gt("Linking…")
303 : outcome?.kind === "linked"
231 - ? gt("Linked", { $context: "status of a machine that was just linked" })
304 + ? back?.kind === "linked"
305 + ? gt("Linked both ways", {
306 + $context:
307 + "status of a machine that was just linked in both directions",
308 + })
309 + : back?.kind === "failed"
310 + ? gt("Linked one way", {
311 + $context:
312 + "status of a machine: the link to it was made, the link back from it failed",
313 + })
314 + : gt("Linked", { $context: "status of a machine that was just linked" })
315 : outcome?.kind === "failed"
316 ? linkBatchFailureLabel(outcome.failure, m)
317 : blocked === null
@@ -253,11 +336,18 @@ export function LinkSeveralEnvironmentsAction({
336 {outcome.detail}
337 </span>
338 ) : null}
339 + {back?.kind === "failed" ? (
340 + <span className="block text-xs text-destructive">
341 + {gt("Could not link back: {reason}", {
342 + reason: back.detail ?? linkBatchFailureLabel(back.failure, m),
343 + })}
344 + </span>
345 + ) : null}
346 </span>
347 {status === null ? null : (
348 <span
349 className={
260 - outcome?.kind === "failed"
350 + outcome?.kind === "failed" || back?.kind === "failed"
351 ? "shrink-0 text-xs text-destructive"
352 : "shrink-0 text-xs text-muted-foreground"
353 }
@@ -272,6 +362,14 @@ export function LinkSeveralEnvironmentsAction({
362 </ul>
363 </div>
364 )}
365 + {unlisted > 0 ? (
366 + <p className="text-xs text-muted-foreground">
367 + {gt(
368 + "{count, plural, one {# machine needs a pairing code, so it is not listed.} other {# machines need a pairing code, so they are not listed.}}",
369 + { count: unlisted },
370 + )}
371 + </p>
372 + ) : null}
373 {outcomes.size > 0 && !busy ? (
374 <p role="status" className="text-xs text-muted-foreground">
375 {summary.failed.length === 0
@@ -282,9 +380,38 @@ export function LinkSeveralEnvironmentsAction({
380 "Linked {linked} of {total}. The ones that failed stay selected, so you can try them again.",
381 { linked: summary.linked, total: outcomes.size },
382 )}
383 + {backFailed > 0
384 + ? ` ${gt(
385 + "{count, plural, one {# machine could not link back.} other {# machines could not link back.}}",
386 + { count: backFailed },
387 + )}`
388 + : null}
389 </p>
390 ) : null}
391 <LinkAccessPicker value={access} onChange={setAccess} disabled={busy} />
392 + {backOffered && sourceLabel !== undefined ? (
393 + <label className="flex cursor-pointer items-start gap-2.5 text-sm has-data-disabled:cursor-default">
394 + <Checkbox
395 + checked={alsoLinkBack}
396 + disabled={busy}
397 + onCheckedChange={setAlsoLinkBack}
398 + />
399 + <span className="min-w-0 space-y-0.5">
400 + <span className="block font-medium text-foreground">
401 + {gt("Also link each machine back to {source}", { source: sourceLabel })}
402 + </span>
403 + <span className="block text-xs text-muted-foreground">
404 + {gt("Agents there can then work on {source} too.", { source: sourceLabel })}
405 + {alsoLinkBack && oneWayOnly > 0
406 + ? ` ${gt(
407 + "{count, plural, one {# machine stays one-way.} other {# machines stay one-way.}}",
408 + { count: oneWayOnly },
409 + )}`
410 + : null}
411 + </span>
412 + </span>
413 + </label>
414 + ) : null}
415 </form>
416 </DialogPanel>
417 <DialogFooter variant="bare">
apps/web/src/components/settings/LinkedEnvironmentsSettings.tsx
+190 -49
@@ -1,4 +1,9 @@
1 import { useAtomValue } from "@effect/atom-react";
2 +import {
3 + linkBackBlockLabel,
4 + linkBatchFailureLabel,
5 + linkWithMintedCode,
6 +} from "@t3tools/client-runtime/link-batch";
7 import { ANOTHER_ADDRESS, linkRequestFailureMessage } from "@t3tools/client-runtime/link-request";
8 import {
9 AuthAccessWriteScope,
@@ -10,17 +15,18 @@ import {
15 isAtomCommandInterrupted,
16 squashAtomCommandFailure,
17 } from "@t3tools/client-runtime/state/runtime";
13 -import { peerLinkHealth } from "@t3tools/client-runtime/state/peerLinks";
18 +import { peerLinkHealth, type PeerLinkHealth } from "@t3tools/client-runtime/state/peerLinks";
19 import * as DateTime from "effect/DateTime";
20 import * as Option from "effect/Option";
21 import * as Result from "effect/Result";
22 import { PlusIcon } from "lucide-react";
23 import { T, useGT, useMessages, Var } from "gt-react";
19 -import { useId, useRef, useState } from "react";
24 +import { type ReactNode, useId, useRef, useState } from "react";
25
26 import { requestConfirmDialog } from "~/confirmDialog";
27 +import { useEnvironment } from "~/state/environments";
28 import { mintPairingCodeOn } from "~/state/peerPairingCode";
23 -import { peerLinkEnvironment, useLinkableMachines } from "~/state/peerLinks";
29 +import { peerLinkEnvironment, useLinkableMachines, useLinkBackOffers } from "~/state/peerLinks";
30 import { useEnvironments } from "~/state/environments";
31 import { useEnvironmentQuery } from "~/state/query";
32 import { useEnvironmentScope, usePreparedConnection } from "~/state/session";
@@ -28,6 +34,7 @@ import { useAtomCommand } from "~/state/use-atom-command";
34 import { accessConfig } from "../auth/ConnectAgentSurface";
35 import { ConnectionStatusDot } from "../ConnectionStatusDot";
36 import { Button } from "../ui/button";
37 +import { Checkbox } from "../ui/checkbox";
38 import {
39 Dialog,
40 DialogClose,
@@ -140,38 +147,9 @@ function LinkedEnvironmentRow({
147 const m = useMessages();
148 const nowMinute = useNowMinute();
149 const health = peerLinkHealth(link, DateTime.makeUnsafe(nowMinute));
143 - const unlink = useAtomCommand(peerLinkEnvironment.unlink, { label: UNLINK_COMMAND_LABEL });
150 const canUnlink = useAtomValue(peerLinkEnvironment.unlink.permissionAtom(environmentId));
145 - const [busy, setBusy] = useState(false);
146 - const forget = async () => {
147 - const confirmed = await (requestConfirmDialog(
148 - gt(
149 - "Forget {label}? Agents here stop working there. Revoke \"T3 Code · …\" in {label}''s Sharing & access to end the session there too.",
150 - { label: link.label },
151 - ),
152 - { variant: "destructive" },
153 - ) ?? Promise.resolve(false));
154 - if (!confirmed) return;
155 - setBusy(true);
156 - const result = await unlink({ environmentId, input: { environmentId: link.environmentId } });
157 - setBusy(false);
158 - if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
159 - failureToast(gt("Could not forget the link"), String(squashAtomCommandFailure(result)));
160 - }
161 - };
162 - const status =
163 - health.kind === "expired"
164 - ? gt("Expired. Link it again with a new pairing code.")
165 - : health.kind === "unreachable"
166 - ? (health.detail ?? gt("Not answering right now."))
167 - : health.kind === "failing"
168 - ? health.detail
169 - : health.expiresInDays !== null
170 - ? gt(
171 - "{days, plural, one {Expires in {days} day. Link it again to renew.} other {Expires in {days} days. Link it again to renew.}}",
172 - { days: health.expiresInDays },
173 - )
174 - : gt("Reachable");
151 + const { busy, forget } = useForgetPeerLink(environmentId, link);
152 + const status = peerLinkStatusText(health, gt);
153 return (
154 <div className={ITEM_ROW_CLASSNAME}>
155 <div className={ITEM_ROW_INNER_CLASSNAME}>
@@ -217,10 +195,58 @@ function LinkedEnvironmentRow({
195 function LinkEnvironmentAction({ environmentId }: { readonly environmentId: EnvironmentId }) {
196 const gt = useGT();
197 const [open, setOpen] = useState(false);
198 + return (
199 + <LinkEnvironmentDialog
200 + environmentId={environmentId}
201 + open={open}
202 + onOpenChange={setOpen}
203 + trigger={
204 + <DialogTrigger
205 + render={
206 + <Button size="xs" variant="default">
207 + <PlusIcon className="size-3" />
208 + {gt("Link", { $context: "verb, links an environment" })}
209 + </Button>
210 + }
211 + />
212 + }
213 + />
214 + );
215 +}
216 +
217 +/** What the link dialog opens with when something other than its own button opened it. */
218 +export interface LinkEnvironmentPrefill {
219 + /** The machine to link to, by environment id, or `ANOTHER_ADDRESS` with `address`. */
220 + readonly choice: string | null;
221 + readonly address?: string;
222 +}
223 +
224 +/**
225 + * The one link flow. When this client is connected to the picked machine and may create pairing
226 + * links there, it mints the code itself; otherwise it asks for one.
227 + */
228 +export function LinkEnvironmentDialog({
229 + environmentId,
230 + open,
231 + onOpenChange,
232 + trigger = null,
233 + prefill,
234 +}: {
235 + readonly environmentId: EnvironmentId;
236 + readonly open: boolean;
237 + readonly onOpenChange: (open: boolean) => void;
238 + readonly trigger?: ReactNode;
239 + readonly prefill?: LinkEnvironmentPrefill;
240 +}) {
241 + const gt = useGT();
242 + const m = useMessages();
243 + const setOpen = onOpenChange;
244 + // Named in the title: from the map, nothing else on screen says which machine is linking.
245 + const source = useEnvironment(environmentId);
246 const machines = useLinkableMachines(environmentId, open);
247 // Null until the user picks; with no other machines known, only an address is left.
222 - const [choice, setChoice] = useState<string | null>(null);
223 - const [address, setAddress] = useState("");
248 + const [choice, setChoice] = useState<string | null>(prefill?.choice ?? null);
249 + const [address, setAddress] = useState(prefill?.address ?? "");
250 const [pairingCode, setPairingCode] = useState("");
251 const [access, setAccess] = useState<AuthMcpClientAccess>("approval-required");
252 const [busy, setBusy] = useState(false);
@@ -230,6 +256,13 @@ function LinkEnvironmentAction({ environmentId }: { readonly environmentId: Envi
256 const inFlight = useRef(false);
257 const formId = useId();
258 const link = useAtomCommand(peerLinkEnvironment.link, { label: LINK_COMMAND_LABEL });
259 + const linkOnTarget = useAtomCommand(peerLinkEnvironment.link, {
260 + label: "link environment back",
261 + // The failure cause holds the request, and with it the code; keep it out of the console.
262 + reportFailure: false,
263 + reportDefect: false,
264 + });
265 + const [alsoLinkBack, setAlsoLinkBack] = useState(false);
266 const selected = choice ?? (machines.length === 0 ? ANOTHER_ADDRESS : null);
267 const machine = machines.find((candidate) => candidate.environmentId === selected) ?? null;
268 const targetId = machine?.environmentId ?? null;
@@ -246,6 +279,8 @@ function LinkEnvironmentAction({ environmentId }: { readonly environmentId: Envi
279 Option.isSome(connected) &&
280 mayMint &&
281 !mintFailed.has(targetId);
282 + const linkBack = useLinkBackOffers(environmentId, targetId === null ? [] : [targetId], open);
283 + const backOffer = linkBack.offerFor(targetId);
284 const ready =
285 selected !== null &&
286 (!needsAddress || address.trim().length > 0) &&
@@ -253,11 +288,12 @@ function LinkEnvironmentAction({ environmentId }: { readonly environmentId: Envi
288 const handleOpenChange = (next: boolean) => {
289 setOpen(next);
290 if (!next) {
256 - setChoice(null);
257 - setAddress("");
291 + setChoice(prefill?.choice ?? null);
292 + setAddress(prefill?.address ?? "");
293 setPairingCode("");
294 setAccess("approval-required");
295 setMintFailed(new Set());
296 + setAlsoLinkBack(false);
297 }
298 };
299 // Settles to the code to link with, or null after reporting why there is none.
@@ -295,14 +331,45 @@ function LinkEnvironmentAction({ environmentId }: { readonly environmentId: Envi
331 access,
332 },
333 });
334 + // The link back is its own link, made on the other machine: it never undoes this one.
335 + const back =
336 + result?._tag === "Success" &&
337 + alsoLinkBack &&
338 + backOffer.kind === "offered" &&
339 + linkBack.source !== null &&
340 + targetId !== null &&
341 + // A typed address can answer as another machine: the picked one links back only if it did.
342 + result.value.environmentId === targetId
343 + ? await linkWithMintedCode({
344 + machine: linkBack.source,
345 + access,
346 + mint: mintPairingCodeOn,
347 + link: async (input) => {
348 + const reverse = await linkOnTarget({ environmentId: targetId, input });
349 + return reverse._tag === "Success"
350 + ? Result.succeed(reverse.value)
351 + : Result.fail(squashAtomCommandFailure(reverse));
352 + },
353 + })
354 + : null;
355 inFlight.current = false;
356 setBusy(false);
357 if (result === null) return;
358 if (result._tag === "Success") {
359 + const names = { source: source?.label ?? "", target: result.value.label };
360 toastManager.add({
361 type: "success",
304 - title: gt("Linked {label}", { label: result.value.label }),
362 + title:
363 + back?.kind === "linked"
364 + ? gt("Linked {source} and {target} both ways", names)
365 + : gt("Linked {label}", { label: result.value.label }),
366 });
367 + if (back?.kind === "failed") {
368 + failureToast(
369 + gt("Could not link {target} back to {source}", names),
370 + back.detail ?? linkBatchFailureLabel(back.failure, m),
371 + );
372 + }
373 handleOpenChange(false);
374 } else if (!isAtomCommandInterrupted(result)) {
375 failureToast(gt("Could not link the environment"), String(squashAtomCommandFailure(result)));
@@ -316,18 +383,17 @@ function LinkEnvironmentAction({ environmentId }: { readonly environmentId: Envi
383 handleOpenChange(next);
384 }}
385 >
319 - <DialogTrigger
320 - render={
321 - <Button size="xs" variant="default">
322 - <PlusIcon className="size-3" />
323 - {gt("Link", { $context: "verb, links an environment" })}
324 - </Button>
325 - }
326 - />
386 + {trigger}
387 <DialogPopup className="max-w-md">
388 <DialogHeader>
389 <DialogTitle>
330 - <T>Link an environment</T>
390 + {source === null ? (
391 + <T>Link an environment</T>
392 + ) : machine === null ? (
393 + gt("Link {label} to another machine", { label: source.label })
394 + ) : (
395 + gt("Link {source} to {target}", { source: source.label, target: machine.label })
396 + )}
397 </DialogTitle>
398 <DialogDescription>
399 <T>
@@ -351,7 +417,11 @@ function LinkEnvironmentAction({ environmentId }: { readonly environmentId: Envi
417 machines={machines}
418 value={selected}
419 disabled={busy}
354 - onChange={setChoice}
420 + onChange={(next) => {
421 + // The opt-in names one machine: it does not carry over to another.
422 + if (next !== selected) setAlsoLinkBack(false);
423 + setChoice(next);
424 + }}
425 />
426 ) : null}
427 {machine?.linked ? (
@@ -417,6 +487,37 @@ function LinkEnvironmentAction({ environmentId }: { readonly environmentId: Envi
487 </label>
488 )}
489 <LinkAccessPicker value={access} onChange={setAccess} disabled={busy} />
490 + {machine === null || source === null ? null : backOffer.kind === "offered" ? (
491 + <label className="flex cursor-pointer items-start gap-2.5 text-sm has-data-disabled:cursor-default">
492 + <Checkbox
493 + checked={alsoLinkBack}
494 + disabled={busy}
495 + onCheckedChange={setAlsoLinkBack}
496 + />
497 + <span className="min-w-0 space-y-0.5">
498 + <span className="block font-medium text-foreground">
499 + {gt("Also link {target} back to {source}", {
500 + source: source.label,
501 + target: machine.label,
502 + })}
503 + </span>
504 + <span className="block text-xs text-muted-foreground">
505 + {gt("Agents on {target} can then work on {source} too.", {
506 + source: source.label,
507 + target: machine.label,
508 + })}
509 + </span>
510 + </span>
511 + </label>
512 + ) : backOffer.kind === "blocked" ? (
513 + <p className="text-xs text-muted-foreground">
514 + {linkBackBlockLabel(
515 + backOffer.reason,
516 + { source: source.label, target: machine.label },
517 + m,
518 + )}
519 + </p>
520 + ) : null}
521 </form>
522 </DialogPanel>
523 <DialogFooter variant="bare">
@@ -431,3 +532,43 @@ function LinkEnvironmentAction({ environmentId }: { readonly environmentId: Envi
532 </Dialog>
533 );
534 }
535 +
536 +/** What a link's health means for the user, in a sentence. */
537 +export function peerLinkStatusText(health: PeerLinkHealth, gt: ReturnType<typeof useGT>): string {
538 + return health.kind === "expired"
539 + ? gt("Expired. Link it again with a new pairing code.")
540 + : health.kind === "unreachable"
541 + ? (health.detail ?? gt("Not answering right now."))
542 + : health.kind === "failing"
543 + ? health.detail
544 + : health.expiresInDays !== null
545 + ? gt(
546 + "{days, plural, one {Expires in {days} day. Link it again to renew.} other {Expires in {days} days. Link it again to renew.}}",
547 + { days: health.expiresInDays },
548 + )
549 + : gt("Reachable");
550 +}
551 +
552 +/** Forgets `link` from `environmentId` after the user confirms. */
553 +export function useForgetPeerLink(environmentId: EnvironmentId, link: PeerLinkSummary) {
554 + const gt = useGT();
555 + const unlink = useAtomCommand(peerLinkEnvironment.unlink, { label: UNLINK_COMMAND_LABEL });
556 + const [busy, setBusy] = useState(false);
557 + const forget = async () => {
558 + const confirmed = await (requestConfirmDialog(
559 + gt(
560 + "Forget {label}? Agents here stop working there. Revoke \"T3 Code · …\" in {label}''s Sharing & access to end the session there too.",
561 + { label: link.label },
562 + ),
563 + { variant: "destructive" },
564 + ) ?? Promise.resolve(false));
565 + if (!confirmed) return;
566 + setBusy(true);
567 + const result = await unlink({ environmentId, input: { environmentId: link.environmentId } });
568 + setBusy(false);
569 + if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
570 + failureToast(gt("Could not forget the link"), String(squashAtomCommandFailure(result)));
571 + }
572 + };
573 + return { busy, forget };
574 +}
apps/web/src/components/settings/SavedEnvironmentRows.tsx
+16 -2
@@ -78,9 +78,11 @@ type SavedBackendListRowProps = {
78 onSetEnabled: (environmentId: EnvironmentId, enabled: boolean) => void;
79 onRemove: (environment: EnvironmentPresentation) => void;
80 onAddRoute: (environment: EnvironmentPresentation) => void;
81 + /** The map's details open on a machine's routes; the list keeps them folded. */
82 + initialRoutesOpen?: boolean;
83 };
84
83 -function savedBackendStatus(
85 +export function savedBackendStatus(
86 environment: EnvironmentPresentation,
87 resolve: MessageResolver = m,
88 ): {
@@ -128,10 +130,11 @@ export function SavedBackendListRow({
130 onSetEnabled,
131 onRemove,
132 onAddRoute,
133 + initialRoutesOpen = false,
134 }: SavedBackendListRowProps) {
135 const messages = useMessages();
136 const gt = useGT();
134 - const [routesOpen, setRoutesOpen] = useState(false);
137 + const [routesOpen, setRoutesOpen] = useState(initialRoutesOpen);
138 const [permissionsOpen, setPermissionsOpen] = useState(false);
139 const [diagnosisOpen, setDiagnosisOpen] = useState(false);
140 const environmentId = environment.environmentId;
@@ -913,10 +916,21 @@ function EmptyRemoteEnvironments({ cloudEnabled = true }: { readonly cloudEnable
916 export function CloudRemoteEnvironmentRows({
917 primaryEnvironmentId,
918 savedEnvironments,
919 + only,
920 }: {
921 readonly primaryEnvironmentId: EnvironmentId | null;
922 readonly savedEnvironments: ReadonlyArray<EnvironmentPresentation>;
923 + readonly only?: EnvironmentId;
924 }) {
925 + if (only !== undefined) {
926 + return (
927 + <CloudEnvironmentConnectRows
928 + only={only}
929 + primaryEnvironmentId={primaryEnvironmentId}
930 + savedEnvironments={savedEnvironments}
931 + />
932 + );
933 + }
934 return hasCloudPublicConfig() ? (
935 <CloudEnvironmentConnectRows
936 primaryEnvironmentId={primaryEnvironmentId}
apps/web/src/components/settings/environmentsMap.logic.test.ts new
+1413
@@ -0,0 +1,1413 @@
1 +import { EnvironmentId, type PeerLinkSummary } from "@t3tools/contracts";
2 +import * as DateTime from "effect/DateTime";
3 +import { describe, expect, it } from "vite-plus/test";
4 +
5 +import {
6 + anchorFleetView,
7 + buildFleetGraph,
8 + FLEET_FIT_LEGIBLE_SCALE,
9 + fitFleetLayout,
10 + fleetCanvasHeight,
11 + fleetStackPartial,
12 + FLEET_CLIENT_NODE_ID,
13 + fleetEnvironmentNodeId,
14 + FLEET_FOLD_ENVIRONMENTS_OVER,
15 + FLEET_LANE_PITCH,
16 + FLEET_ROUTE_PITCH,
17 + FLEET_STACK_SHOWN_MAX,
18 + fleetFocusRects,
19 + fleetDrawnLinkId,
20 + fleetLinkAction,
21 + fleetLinkBackOffered,
22 + fleetLinkOffer,
23 + fleetMoreNodeId,
24 + fleetNeighborhood,
25 + fleetNodesInBox,
26 + fleetSearch,
27 + fleetShapeKey,
28 + fleetStacks,
29 + fleetSummary,
30 + fleetTwoWayLinks,
31 + isLinkEdge,
32 + isRouteEdge,
33 + layoutFleetGraph,
34 + nextFleetNode,
35 + zoomFleetView,
36 + type FleetConnectMachineInput,
37 + type FleetEnvironmentInput,
38 + type FleetLayout,
39 + type FleetRect,
40 +} from "./environmentsMap.logic";
41 +
42 +const now = DateTime.makeUnsafe("2026-11-19T12:00:00.000Z");
43 +const id = (value: string) => EnvironmentId.make(value);
44 +const node = (value: string) => fleetEnvironmentNodeId(id(value));
45 +
46 +const link = (target: string, overrides: Partial<PeerLinkSummary> = {}): PeerLinkSummary => ({
47 + environmentId: id(target),
48 + label: target,
49 + urls: [`https://${target}.example.ts.net`],
50 + access: "approval-required",
51 + linkedAt: DateTime.makeUnsafe("2026-11-01T00:00:00.000Z"),
52 + expiresAt: DateTime.makeUnsafe("2027-01-01T00:00:00.000Z"),
53 + lastReachedAt: null,
54 + lastError: null,
55 + status: "reachable",
56 + ...overrides,
57 +});
58 +
59 +const environment = (
60 + name: string,
61 + links: ReadonlyArray<PeerLinkSummary> | FleetEnvironmentInput["outgoing"]["state"] = [],
62 + overrides: Partial<FleetEnvironmentInput> = {},
63 +): FleetEnvironmentInput => ({
64 + environmentId: id(name),
65 + label: name,
66 + machine: "server",
67 + phase: "connected",
68 + enabled: true,
69 + routes: [{ id: "tailnet", kind: "tailnet" }],
70 + activeRouteId: "tailnet",
71 + refusedRouteIds: [],
72 + offersLinks: true,
73 + canWriteAccess: true,
74 + hasLinkAddress: true,
75 + outgoing:
76 + typeof links !== "string"
77 + ? { state: "loaded", links }
78 + : links === "error"
79 + ? { state: "error", message: "boom" }
80 + : links === "loaded"
81 + ? { state: "loaded", links: [] }
82 + : { state: links },
83 + ...overrides,
84 +});
85 +
86 +const connectMachine = (name: string): FleetConnectMachineInput => ({
87 + environmentId: id(name),
88 + label: name,
89 + machine: "server",
90 + availability: "online",
91 +});
92 +
93 +const build = (
94 + environments: ReadonlyArray<FleetEnvironmentInput>,
95 + connectMachines: ReadonlyArray<FleetConnectMachineInput> = [],
96 +) => buildFleetGraph({ clientLabel: "This browser", environments, connectMachines, now });
97 +
98 +const vms = (count: number, prefix = "vm", overrides: Partial<PeerLinkSummary> = {}) =>
99 + Array.from({ length: count }, (_, index) => link(`${prefix}-${index + 1}`, overrides));
100 +
101 +const routeStates = (graph: ReturnType<typeof build>, name: string) =>
102 + Object.fromEntries(
103 + graph.edges
104 + .filter(isRouteEdge)
105 + .filter((edge) => edge.to === node(name))
106 + .map((edge) => [edge.routeId, edge.state]),
107 + );
108 +
109 +/** Six environments in every state, 45 link targets, 40 of them under one host. */
110 +const largeSetup = () =>
111 + build(
112 + [
113 + environment(
114 + "nucbox",
115 + [...vms(40, "fs", { access: "full-access" }), link("ci"), link("cups", { access: "auto" })],
116 + {
117 + routes: [
118 + { id: "tailnet", kind: "tailnet" },
119 + { id: "lan", kind: "lan" },
120 + { id: "relay", kind: "relay" },
121 + ],
122 + },
123 + ),
124 + environment("cups", [link("nucbox"), link("staging", { access: "read-only" }), link("ci")]),
125 + environment("mbp", "unknown", { phase: "offline" }),
126 + environment("win", "unknown", { phase: "error" }),
127 + environment("vps", [
128 + link("db-1"),
129 + link("db-2"),
130 + link("db-3"),
131 + link("ci", { access: "read-only" }),
132 + link("staging", { access: "auto" }),
133 + link("cups", { access: "full-access" }),
134 + ]),
135 + environment("old", "unknown", { enabled: false, phase: "available" }),
136 + ],
137 + [connectMachine("gpu")],
138 + );
139 +
140 +/** The brief's setup: two hosts share three machines, one has three more and links to the other. */
141 +const sharedSetup = () =>
142 + build([
143 + environment("nucbox", [
144 + link("fs-1", { access: "full-access" }),
145 + link("fs-2", { access: "auto" }),
146 + link("fs-3", { access: "read-only" }),
147 + ]),
148 + environment("mbp", "unknown", { phase: "reconnecting" }),
149 + environment("cups", [
150 + link("fs-1", { access: "full-access" }),
151 + link("fs-2", { access: "full-access" }),
152 + link("fs-3", { access: "auto" }),
153 + link("fs-4", { access: "auto-accept-edits" }),
154 + link("fs-5"),
155 + link("fs-6", { access: "read-only" }),
156 + link("nucbox", { access: "auto" }),
157 + ]),
158 + ]);
159 +
160 +/** Twenty environments, five of them folding by state, and 1000 machines two hosts both link to. */
161 +const hugeSetup = () =>
162 + build([
163 + environment("nucbox", [...vms(1000, "vm", { access: "full-access" }), link("cups")]),
164 + environment("cups", vms(1000, "vm", { access: "full-access" })),
165 + environment("mbp", [link("nucbox", { access: "auto" })]),
166 + ...Array.from({ length: 5 }, (_, index) => environment(`gpu-${index + 1}`)),
167 + ...Array.from({ length: 6 }, (_, index) =>
168 + environment(`lab-${index + 1}`, "unknown", { phase: "offline" }),
169 + ),
170 + ...Array.from({ length: 4 }, (_, index) =>
171 + environment(`old-${index + 1}`, "unknown", { enabled: false, phase: "available" }),
172 + ),
173 + ...Array.from({ length: 2 }, (_, index) =>
174 + environment(`legacy-${index + 1}`, "unknown", { phase: "unsupported" }),
175 + ),
176 + ]);
177 +
178 +/** Points along a path the layout wrote: absolute M, H, V, Q and C only. */
179 +function samplePath(d: string): Array<{ x: number; y: number }> {
180 + const points: Array<{ x: number; y: number }> = [];
181 + let x = 0;
182 + let y = 0;
183 + const curve = (controls: ReadonlyArray<number>) => {
184 + const xs = [x, ...controls.filter((_, index) => index % 2 === 0)];
185 + const ys = [y, ...controls.filter((_, index) => index % 2 === 1)];
186 + const at = (values: ReadonlyArray<number>, t: number): number =>
187 + values.length === 1
188 + ? values[0]!
189 + : at(
190 + values.slice(1).map((value, index) => values[index]! * (1 - t) + value * t),
191 + t,
192 + );
193 + for (let step = 1; step <= 24; step += 1) {
194 + points.push({ x: at(xs, step / 24), y: at(ys, step / 24) });
195 + }
196 + x = xs.at(-1)!;
197 + y = ys.at(-1)!;
198 + };
199 + for (const [, command, rest] of d.matchAll(/([MHVQC])([^MHVQC]*)/g)) {
200 + const values = rest!.trim().split(/[ ,]+/).map(Number);
201 + if (command === "M") points.push({ x: (x = values[0]!), y: (y = values[1]!) });
202 + else if (command === "H") curve([values[0]!, y]);
203 + else if (command === "V") curve([x, values[0]!]);
204 + else curve(values);
205 + }
206 + return points;
207 +}
208 +
209 +const overlaps = (a: FleetRect, b: FleetRect) =>
210 + a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
211 +
212 +/** Every box the layout draws that must not sit on another. */
213 +const solidRects = (layout: FleetLayout) => [
214 + ...[...layout.nodes].map(([key, rect]) => ({ key, rect, within: null as string | null })),
215 + ...[...layout.routes].map(([key, geometry]) => ({ key, rect: geometry.pill, within: null })),
216 + ...[...layout.stacks].map(([key, geometry]) => ({ key, rect: geometry.rect, within: key })),
217 +];
218 +
219 +function expectNoOverlap(layout: FleetLayout, members: ReadonlyMap<string, string>) {
220 + const rects = solidRects(layout);
221 + for (const [index, left] of rects.entries()) {
222 + for (const right of rects.slice(index + 1)) {
223 + // An open stack's frame holds its own machines.
224 + if (members.get(left.key) === right.within || members.get(right.key) === left.within) {
225 + if (left.within !== null || right.within !== null) continue;
226 + }
227 + expect(overlaps(left.rect, right.rect), `${left.key} overlaps ${right.key}`).toBe(false);
228 + }
229 + expect(left.rect.x).toBeGreaterThanOrEqual(0);
230 + expect(left.rect.y).toBeGreaterThanOrEqual(0);
231 + expect(left.rect.x + left.rect.width).toBeLessThanOrEqual(layout.width);
232 + expect(left.rect.y + left.rect.height).toBeLessThanOrEqual(layout.height);
233 + }
234 +}
235 +
236 +describe("buildFleetGraph", () => {
237 + it("draws each saved route as its own edge and reads its state from what the client knows", () => {
238 + const routes = [
239 + { id: "tailnet", kind: "tailnet" as const },
240 + { id: "lan", kind: "lan" as const },
241 + { id: "relay", kind: "relay" as const },
242 + ];
243 + const graph = build([
244 + environment("up", [], { routes, activeRouteId: "lan", refusedRouteIds: ["relay"] }),
245 + environment("dialling", "unknown", { routes, phase: "connecting", activeRouteId: null }),
246 + environment("gone", "unknown", { routes, phase: "error", activeRouteId: null }),
247 + environment("off", "unknown", { routes, enabled: false, phase: "available" }),
248 + environment("old", "unknown", { routes, phase: "unsupported" }),
249 + ]);
250 + expect(routeStates(graph, "up")).toEqual({
251 + tailnet: "standby",
252 + lan: "in-use",
253 + relay: "refused",
254 + });
255 + expect(routeStates(graph, "dialling")).toEqual({
256 + tailnet: "trying",
257 + lan: "trying",
258 + relay: "trying",
259 + });
260 + expect(routeStates(graph, "gone")).toEqual({ tailnet: "down", lan: "down", relay: "down" });
261 + expect(routeStates(graph, "off")).toEqual({ tailnet: "idle", lan: "idle", relay: "idle" });
262 + expect(routeStates(graph, "old")).toEqual({ tailnet: "idle", lan: "idle", relay: "idle" });
263 + });
264 +
265 + it("adds T3 Connect machines the client has not saved, and only those", () => {
266 + const graph = build([environment("cups")], [connectMachine("cups"), connectMachine("gpu")]);
267 + expect(graph.nodes.map((entry) => `${entry.kind}:${entry.label}`)).toEqual([
268 + "client:This browser",
269 + "environment:cups",
270 + "connect:gpu",
271 + ]);
272 + expect(routeStates(graph, "gpu")).toEqual({ offer: "offered" });
273 + });
274 +
275 + it("keeps one node per machine and one edge per link, whatever names it twice", () => {
276 + const graph = build(
277 + [
278 + environment("cups", [link("vps"), link("vps"), link("cups"), link("gpu"), link("nucbox")]),
279 + environment("cups", [link("other")]),
280 + environment("nucbox"),
281 + ],
282 + [connectMachine("gpu")],
283 + );
284 + expect(graph.nodes.map((entry) => `${entry.kind}:${entry.label}`)).toEqual([
285 + "client:This browser",
286 + "environment:cups",
287 + "environment:nucbox",
288 + "connect:gpu",
289 + "target:vps",
290 + ]);
291 + expect(graph.edges.filter((edge) => edge.kind === "link").map((edge) => edge.id)).toEqual([
292 + `link:${node("cups")}>${node("vps")}`,
293 + `link:${node("cups")}>${node("gpu")}`,
294 + `link:${node("cups")}>${node("nucbox")}`,
295 + ]);
296 + });
297 +
298 + it("keeps unknown, off, loading and failed link lists apart from an empty one", () => {
299 + const graph = build([
300 + environment("a", "loaded"),
301 + environment("b", "loading"),
302 + environment("c", "error"),
303 + environment("d", "off", { offersLinks: false }),
304 + environment("e", "unknown", { phase: "offline" }),
305 + environment("f", [], { canWriteAccess: false }),
306 + ]);
307 + const states = graph.nodes.flatMap((entry) =>
308 + entry.kind === "environment"
309 + ? [[entry.label, entry.outgoing, entry.linking, entry.outgoingError]]
310 + : [],
311 + );
312 + expect(states).toEqual([
313 + ["a", "loaded", "ready", null],
314 + ["b", "loading", "ready", null],
315 + ["c", "error", "ready", "boom"],
316 + ["d", "off", "off", null],
317 + ["e", "unknown", "disconnected", null],
318 + ["f", "loaded", "forbidden", null],
319 + ]);
320 + });
321 +
322 + it("reads a link's health at the given time", () => {
323 + const graph = build([
324 + environment("cups", [
325 + link("soon", { expiresAt: DateTime.makeUnsafe("2026-11-21T12:00:00.000Z") }),
326 + link("gone", { status: "expired" }),
327 + ]),
328 + ]);
329 + expect(graph.edges.flatMap((edge) => (edge.kind === "link" ? [edge.health] : []))).toEqual([
330 + { kind: "reachable", expiresInDays: 2 },
331 + { kind: "expired" },
332 + ]);
333 + });
334 +});
335 +
336 +describe("fleetSummary", () => {
337 + it("counts links only when every connected environment's list was read", () => {
338 + const summary = (...environments: FleetEnvironmentInput[]) => fleetSummary(build(environments));
339 + expect(summary(environment("a", [link("x")]), environment("b"))).toEqual({
340 + machines: 3,
341 + links: 1,
342 + loading: false,
343 + });
344 + expect(summary(environment("a"), environment("b"))).toMatchObject({ links: 0 });
345 + // One failed list among several leaves the total unknown, not zero.
346 + expect(summary(environment("a"), environment("b", "error"))).toMatchObject({ links: null });
347 + expect(summary(environment("a", "unknown"))).toMatchObject({ links: null });
348 + expect(summary(environment("a"), environment("b", "loading"))).toMatchObject({
349 + links: null,
350 + loading: true,
351 + });
352 + // A machine that is not connected says nothing either way.
353 + expect(
354 + summary(environment("a", [link("x")]), environment("b", "unknown", { phase: "offline" })),
355 + ).toMatchObject({ links: 1 });
356 + });
357 +});
358 +
359 +describe("fleetStacks", () => {
360 + it("collapses many machines under one host and one access level, and nothing smaller", () => {
361 + const graph = build([
362 + environment("nucbox", [
363 + ...vms(40, "fs", { access: "full-access" }),
364 + ...vms(4, "few"),
365 + link("fs-41", { access: "full-access", status: "unreachable" }),
366 + ]),
367 + ]);
368 + const stacks = fleetStacks(graph, new Set());
369 + expect(
370 + stacks.map((stack) => [
371 + stack.id,
372 + stack.memberIds.length,
373 + stack.reachable,
374 + stack.firstLabel,
375 + stack.lastLabel,
376 + stack.expanded,
377 + ]),
378 + ).toEqual([[`stack:${node("nucbox")}:full-access`, 41, 40, "fs-1", "fs-41", false]]);
379 + const [open] = fleetStacks(graph, new Set([stacks[0]!.id]));
380 + expect(open!.expanded).toBe(true);
381 + // An open stack draws its first machines; the rest stay in the details.
382 + expect(open!.shownIds).toEqual(open!.memberIds.slice(0, FLEET_STACK_SHOWN_MAX));
383 + });
384 +
385 + it("folds machines that share the exact set of links in, and keeps other sets apart", () => {
386 + const graph = build([
387 + environment("nucbox", [
388 + ...vms(8, "vm", { access: "full-access" }),
389 + ...vms(6, "ro", { access: "read-only" }),
390 + ...vms(5, "solo"),
391 + ]),
392 + environment("cups", [
393 + link("vm-1", { access: "full-access", status: "unreachable" }),
394 + ...vms(8, "vm", { access: "full-access" }).slice(1),
395 + // The same two hosts, but one at another access level: a set of its own.
396 + ...vms(6, "ro", { access: "full-access" }),
397 + ]),
398 + ]);
399 + const stacks = fleetStacks(graph, new Set());
400 + expect(
401 + stacks.map((stack) => [
402 + stack.sources.map((source) => `${source.sourceId}:${source.access}`),
403 + stack.memberIds.length,
404 + stack.edgeIds.length,
405 + stack.reachable,
406 + ]),
407 + ).toEqual([
408 + [[`${node("nucbox")}:full-access`, `${node("cups")}:full-access`], 8, 16, 7],
409 + [[`${node("nucbox")}:read-only`, `${node("cups")}:full-access`], 6, 12, 6],
410 + [[`${node("nucbox")}:approval-required`], 5, 5, 5],
411 + ]);
412 + });
413 +
414 + it("folds unlinked environments by state once there are many, and never a linked or connected one", () => {
415 + const few = build(
416 + Array.from({ length: FLEET_FOLD_ENVIRONMENTS_OVER }, (_, index) =>
417 + environment(`lab-${index}`, "unknown", { phase: "offline" }),
418 + ),
419 + );
420 + expect(fleetStacks(few, new Set())).toEqual([]);
421 + const graph = build(
422 + [
423 + environment("nucbox", [link("linked-offline")]),
424 + environment("linked-offline", "unknown", { phase: "offline" }),
425 + environment("idle"),
426 + environment("dialling", "unknown", { phase: "connecting" }),
427 + ...Array.from({ length: 4 }, (_, index) =>
428 + environment(`lab-${index + 1}`, "unknown", { phase: index === 0 ? "error" : "offline" }),
429 + ),
430 + ...Array.from({ length: 3 }, (_, index) =>
431 + environment(`old-${index + 1}`, "unknown", { enabled: false, phase: "available" }),
432 + ),
433 + // Two is too few to be worth a stack.
434 + environment("legacy-1", "unknown", { phase: "unsupported" }),
435 + environment("legacy-2", "unknown", { phase: "unsupported" }),
436 + ],
437 + ["gpu-1", "gpu-2", "gpu-3"].map(connectMachine),
438 + );
439 + expect(
440 + fleetStacks(graph, new Set()).map((stack) => [stack.kind, stack.group, stack.memberIds]),
441 + ).toEqual([
442 + ["environments", "offline", ["lab-1", "lab-2", "lab-3", "lab-4"].map(node)],
443 + ["environments", "off", ["old-1", "old-2", "old-3"].map(node)],
444 + ["environments", "not-added", ["gpu-1", "gpu-2", "gpu-3"].map(node)],
445 + ]);
446 + });
447 +
448 + it("leaves out a machine a second host links to, and a machine the client knows", () => {
449 + const graph = build([
450 + environment("nucbox", [...vms(6, "fs"), link("cups")]),
451 + environment("cups", [link("fs-1")]),
452 + ]);
453 + const [stack] = fleetStacks(graph, new Set());
454 + expect(stack!.memberIds).toEqual(["fs-2", "fs-3", "fs-4", "fs-5", "fs-6"].map(node));
455 + });
456 +});
457 +
458 +describe("fleetLinkOffer", () => {
459 + const graph = build(
460 + [
461 + environment("cups", [link("vm"), link("old", { status: "expired" }), link("nucbox")]),
462 + environment("nucbox"),
463 + environment("guest", [], { canWriteAccess: false }),
464 + environment("nolabs", "off", { offersLinks: false }),
465 + environment("ssh-only", [], { hasLinkAddress: false }),
466 + environment("asleep", "unknown", { phase: "offline" }),
467 + ],
468 + [connectMachine("gpu")],
469 + );
470 + const offer = (source: string, target: string) =>
471 + fleetLinkOffer(graph, node(source), target === "client" ? FLEET_CLIENT_NODE_ID : node(target));
472 +
473 + it("links without a code only where the client can mint one on the target", () => {
474 + expect(offer("nucbox", "cups")).toEqual({
475 + kind: "link",
476 + sourceEnvironmentId: id("nucbox"),
477 + path: "code-less",
478 + renews: false,
479 + target: { kind: "machine", environmentId: id("cups") },
480 + });
481 + expect(offer("cups", "nucbox")).toMatchObject({ path: "code-less", renews: true });
482 + for (const target of ["guest", "ssh-only", "asleep", "gpu"]) {
483 + expect(offer("cups", target), target).toMatchObject({
484 + path: "pairing-code",
485 + target: { kind: "machine", environmentId: id(target) },
486 + });
487 + }
488 + });
489 +
490 + it("links to a machine known only through a link by its address, with a code", () => {
491 + expect(offer("nucbox", "vm")).toMatchObject({
492 + path: "pairing-code",
493 + renews: false,
494 + target: { kind: "address", address: "https://vm.example.ts.net" },
495 + });
496 + expect(offer("cups", "vm")).toMatchObject({ renews: true });
497 + expect(offer("cups", "old")).toMatchObject({ renews: false });
498 + });
499 +
500 + it("offers nothing from a machine that cannot link, or to itself or the client", () => {
501 + const reason = (source: string, target: string) => {
502 + const result = offer(source, target);
503 + return result.kind === "unavailable" ? result.reason : result.kind;
504 + };
505 + expect(reason("cups", "cups")).toBe("same-machine");
506 + expect(reason("cups", "client")).toBe("not-an-environment");
507 + expect(reason("gpu", "cups")).toBe("not-an-environment");
508 + expect(reason("vm", "cups")).toBe("not-an-environment");
509 + expect(reason("asleep", "cups")).toBe("source-disconnected");
510 + expect(reason("nolabs", "cups")).toBe("source-off");
511 + expect(reason("guest", "cups")).toBe("source-forbidden");
512 + });
513 +});
514 +
515 +describe("fleetLinkAction", () => {
516 + const graph = build([
517 + environment("nucbox", [...vms(6, "fs")]),
518 + environment("cups"),
519 + environment("mbp", "unknown", { phase: "offline" }),
520 + environment("vps", [], { canWriteAccess: false }),
521 + ]);
522 + const stacks = fleetStacks(graph, new Set());
523 + const batch = (environmentIds: ReadonlyArray<string>) => ({
524 + kind: "batch",
525 + sourceEnvironmentId: id("nucbox"),
526 + environmentIds: environmentIds.map(id),
527 + });
528 +
529 + it("links to the selection when the drop lands on it, or the handle is pressed with one", () => {
530 + const selected = new Set([node("cups"), node("mbp"), node("nucbox"), FLEET_CLIENT_NODE_ID]);
531 + // The source and the client are never among the machines to link.
532 + expect(fleetLinkAction(graph, stacks, selected, node("nucbox"), node("cups"))).toEqual(
533 + batch(["cups", "mbp"]),
534 + );
535 + expect(fleetLinkAction(graph, stacks, selected, node("nucbox"), null)).toEqual(
536 + batch(["cups", "mbp"]),
537 + );
538 + });
539 +
540 + it("links one machine when the drop lands outside the selection, or nothing is selected", () => {
541 + const selected = new Set([node("mbp")]);
542 + expect(fleetLinkAction(graph, stacks, selected, node("nucbox"), node("cups"))).toMatchObject({
543 + kind: "single",
544 + offer: { path: "code-less", target: { environmentId: id("cups") } },
545 + });
546 + expect(fleetLinkAction(graph, stacks, new Set(), node("nucbox"), null)).toEqual({
547 + kind: "single",
548 + sourceEnvironmentId: id("nucbox"),
549 + offer: null,
550 + });
551 + // A selection of only the source is no batch.
552 + expect(
553 + fleetLinkAction(graph, stacks, new Set([node("nucbox")]), node("nucbox"), null),
554 + ).toMatchObject({ kind: "single" });
555 + });
556 +
557 + it("opens no batch for machines the client has no session on, and offers nothing from a host that cannot link", () => {
558 + const members = ["fs-1", "fs-2", "fs-3", "fs-4", "fs-5", "fs-6"].map(node);
559 + // A stack of machines known only through links: each needs a code, so no batch can link one.
560 + expect(fleetLinkAction(graph, stacks, new Set(), node("cups"), stacks[0]!.id)).toEqual({
561 + kind: "code-only",
562 + sourceId: node("cups"),
563 + sourceEnvironmentId: id("cups"),
564 + machineIds: members,
565 + });
566 + // One such machine alone, ticked and dropped on, is asked for its code like any other.
567 + expect(
568 + fleetLinkAction(graph, stacks, new Set([node("fs-1")]), node("cups"), node("fs-1")),
569 + ).toMatchObject({
570 + kind: "single",
571 + sourceEnvironmentId: id("cups"),
572 + offer: { path: "pairing-code", target: { kind: "address" } },
573 + });
574 + // One the client is connected to among them makes it a batch, which says why for the rest.
575 + const mixed = new Set([node("fs-1"), node("fs-2"), node("mbp")]);
576 + expect(fleetLinkAction(graph, stacks, mixed, node("cups"), node("mbp"))).toEqual({
577 + ...batch(["fs-1", "fs-2", "mbp"]),
578 + sourceEnvironmentId: id("cups"),
579 + });
580 + for (const source of ["mbp", "vps"]) {
581 + expect(fleetLinkAction(graph, stacks, new Set(), node(source), stacks[0]!.id)).toBeNull();
582 + expect(fleetLinkAction(graph, stacks, new Set(), node(source), null)).toBeNull();
583 + }
584 + expect(fleetLinkAction(graph, stacks, new Set(), node("nucbox"), node("nucbox"))).toBeNull();
585 + });
586 +});
587 +
588 +describe("fleetTwoWayLinks", () => {
589 + const graph = build([
590 + environment("a", [link("b"), link("c", { access: "full-access" }), link("d")]),
591 + environment("b", [link("a", { status: "unreachable" })]),
592 + environment("c", [link("a", { access: "auto" })]),
593 + environment("d"),
594 + ]);
595 + const pairs = fleetTwoWayLinks(graph);
596 + const edge = (from: string, to: string) => `link:${node(from)}>${node(to)}`;
597 +
598 + it("merges two links between the same machines only at the same access", () => {
599 + expect([...pairs.keys()].toSorted()).toEqual([edge("a", "b"), edge("b", "a")]);
600 + // Both links select the one line, drawn as the link from the machine listed first.
601 + expect(fleetDrawnLinkId(pairs, edge("b", "a"))).toBe(edge("a", "b"));
602 + expect(fleetDrawnLinkId(pairs, edge("a", "b"))).toBe(edge("a", "b"));
603 + // Different access says two different things, and a one-way link has no other half.
604 + expect(fleetDrawnLinkId(pairs, edge("c", "a"))).toBe(edge("c", "a"));
605 + expect(fleetDrawnLinkId(pairs, edge("a", "d"))).toBe(edge("a", "d"));
606 + });
607 +
608 + it("keeps each direction's own health, and counts both links", () => {
609 + const pair = pairs.get(edge("a", "b"))!;
610 + expect(pair.forward.health.kind).toBe("reachable");
611 + expect(pair.back.health.kind).toBe("unreachable");
612 + expect(fleetSummary(graph).links).toBe(5);
613 + });
614 +
615 + it("lights both links and both machines' routes from either one", () => {
616 + const lit = fleetNeighborhood(graph, [], { kind: "edge", id: edge("a", "b") });
617 + expect(lit.edges.has(edge("a", "b")) && lit.edges.has(edge("b", "a"))).toBe(true);
618 + expect(lit.edges.has(`route:${node("a")}:tailnet`)).toBe(true);
619 + expect(lit.edges.has(`route:${node("b")}:tailnet`)).toBe(true);
620 + expect(lit.edges.has(edge("a", "d"))).toBe(false);
621 + });
622 +
623 + it("offers the link back on a one-way link only where the client can make it", () => {
624 + const linkEdge = (from: ReturnType<typeof build>, source: string, target: string) =>
625 + from.edges.filter(isLinkEdge).find((entry) => entry.id === edge(source, target))!;
626 + expect(fleetLinkBackOffered(graph, linkEdge(graph, "a", "d"))).toBe(true);
627 + // Already linked back, at whatever access.
628 + expect(fleetLinkBackOffered(graph, linkEdge(graph, "a", "c"))).toBe(false);
629 + for (const target of [
630 + environment("d", "unknown", { phase: "offline" }),
631 + environment("d", "off", { offersLinks: false }),
632 + environment("d", [], { canWriteAccess: false }),
633 + environment("d", "loading"),
634 + ]) {
635 + const other = build([environment("a", [link("d")]), target]);
636 + expect(fleetLinkBackOffered(other, linkEdge(other, "a", "d"))).toBe(false);
637 + }
638 + for (const source of [{ canWriteAccess: false }, { hasLinkAddress: false }]) {
639 + const other = build([environment("a", [link("d")], source), environment("d")]);
640 + expect(fleetLinkBackOffered(other, linkEdge(other, "a", "d"))).toBe(false);
641 + }
642 + // A machine known only through the link is not one the client can link from.
643 + const unknown = build([environment("a", [link("x")])]);
644 + expect(fleetLinkBackOffered(unknown, linkEdge(unknown, "a", "x"))).toBe(false);
645 + });
646 +});
647 +
648 +describe("selecting and finding machines", () => {
649 + it("selects the machines a box touches, and never the client or a stack", () => {
650 + const graph = largeSetup();
651 + const layout = layoutFleetGraph(graph, fleetStacks(graph, new Set()));
652 + const everything = { x: 0, y: 0, width: layout.width, height: layout.height };
653 + expect(fleetNodesInBox(layout, everything).toSorted()).toEqual(
654 + [...layout.nodes.keys()].filter((key) => key !== FLEET_CLIENT_NODE_ID).toSorted(),
655 + );
656 + const cups = layout.nodes.get(node("cups"))!;
657 + expect(fleetNodesInBox(layout, { x: cups.x + 4, y: cups.y + 4, width: 2, height: 2 })).toEqual([
658 + node("cups"),
659 + ]);
660 + });
661 +
662 + it("finds machines by name wherever they are drawn, in name order", () => {
663 + const graph = largeSetup();
664 + expect(fleetSearch(graph, " FS-1 ").slice(0, 3)).toEqual(["fs-1", "fs-10", "fs-11"].map(node));
665 + expect(fleetSearch(graph, "")).toEqual([]);
666 + expect(fleetSearch(graph, "this browser")).toEqual([]);
667 + });
668 +});
669 +
670 +describe("fleetNeighborhood", () => {
671 + const graph = build([
672 + environment("a", [link("b"), ...vms(5)]),
673 + environment("b", [link("c")]),
674 + environment("c"),
675 + ]);
676 + const stacks = fleetStacks(graph, new Set());
677 +
678 + it("lights one hop from a machine and its routes, and does not follow a link through", () => {
679 + const lit = fleetNeighborhood(graph, stacks, { kind: "node", id: node("b") });
680 + expect([...lit.nodes].toSorted()).toEqual(
681 + [FLEET_CLIENT_NODE_ID, node("a"), node("b"), node("c")].toSorted(),
682 + );
683 + expect(lit.edges.has(`link:${node("a")}>${node("vm-1")}`)).toBe(false);
684 + expect(lit.edges.has(`route:${node("b")}:tailnet`)).toBe(true);
685 + expect(lit.edges.has(`route:${node("a")}:tailnet`)).toBe(true);
686 + expect(lit.edges.has(`route:${node("c")}:tailnet`)).toBe(false);
687 + });
688 +
689 + it("lights a stack's machines, their host and the route to it", () => {
690 + const lit = fleetNeighborhood(graph, stacks, { kind: "stack", id: stacks[0]!.id });
691 + expect(lit.nodes.has(node("vm-3"))).toBe(true);
692 + expect(lit.nodes.has(node("b"))).toBe(false);
693 + expect(lit.edges.has(`route:${node("a")}:tailnet`)).toBe(true);
694 + });
695 +});
696 +
697 +describe("layoutFleetGraph", () => {
698 + const membersOf = (stacks: ReturnType<typeof fleetStacks>) =>
699 + new Map(stacks.flatMap((stack) => stack.memberIds.map((member) => [member, stack.id])));
700 +
701 + it("places one environment, and a large setup, with nothing overlapping or out of bounds", () => {
702 + const one = build([environment("cups")]);
703 + expectNoOverlap(layoutFleetGraph(one), new Map());
704 + const large = largeSetup();
705 + const closed = fleetStacks(large, new Set());
706 + const layout = layoutFleetGraph(large, closed);
707 + expectNoOverlap(layout, membersOf(closed));
708 + // Forty machines cost one node: 6 environments, the client, the Connect machine, 5 targets.
709 + expect(layout.nodes.size).toBe(13);
710 + expect(layout.stacks.size).toBe(1);
711 + expect(layout.routes.size).toBe(9);
712 + expect(layout.columns.map((column) => column.id)).toEqual([
713 + "client",
714 + "environments",
715 + "targets",
716 + ]);
717 + });
718 +
719 + it("opens a stack where its card is, each machine in the tray below it", () => {
720 + const large = largeSetup();
721 + const closed = fleetStacks(large, new Set());
722 + const stackId = closed[0]!.id;
723 + const open = fleetStacks(large, new Set([stackId]));
724 + for (const width of [undefined, 560, 900, 1400]) {
725 + const before = layoutFleetGraph(large, closed, width);
726 + const layout = layoutFleetGraph(large, open, width);
727 + expectNoOverlap(layout, membersOf(open));
728 + // Forty machines open to the first 24 and one card for the other 16, never forty cards.
729 + expect(layout.nodes.size).toBe(13 + FLEET_STACK_SHOWN_MAX);
730 + const { face, tray } = layout.stacks.get(stackId)!;
731 + const more = fleetFocusRects(layout).get(fleetMoreNodeId(stackId))!;
732 + expect(layout.nodes.has(open[0]!.memberIds[FLEET_STACK_SHOWN_MAX]!)).toBe(false);
733 + for (const rect of [more, ...open[0]!.shownIds.map((member) => layout.nodes.get(member)!)]) {
734 + expect(rect.x).toBeGreaterThanOrEqual(tray!.x);
735 + expect(rect.y).toBeGreaterThanOrEqual(tray!.y);
736 + expect(rect.x + rect.width).toBeLessThanOrEqual(tray!.x + tray!.width);
737 + expect(rect.y + rect.height).toBeLessThanOrEqual(tray!.y + tray!.height);
738 + }
739 + // The card, its lines, every route and every column stay put: the width's measures are
740 + // those of the closed map, so opening never closes the columns up.
741 + expect(face).toEqual(before.stacks.get(stackId)!.face);
742 + expect(layout.stacks.get(stackId)!.lines.map((line) => line.arrow)).toEqual(
743 + before.stacks.get(stackId)!.lines.map((line) => line.arrow),
744 + );
745 + expect(layout.routes).toEqual(before.routes);
746 + expect(layout.columns).toEqual(before.columns);
747 + expect(tray!.y).toBeGreaterThanOrEqual(face.y + face.height);
748 + // Only machines the tray would cover move, and only down.
749 + for (const [nodeId, rect] of before.nodes) {
750 + const now = layout.nodes.get(nodeId)!;
751 + if (rect.x === face.x && rect.y > face.y) {
752 + expect(now.y, nodeId).toBeGreaterThanOrEqual(tray!.y + tray!.height);
753 + expect({ ...now, y: rect.y }, nodeId).toEqual(rect);
754 + } else {
755 + expect(now, nodeId).toEqual(rect);
756 + }
757 + }
758 + }
759 + });
760 +
761 + it("opens a group of environments where its card is, moving only the cards below it", () => {
762 + const graph = hugeSetup();
763 + const closed = fleetStacks(graph, new Set());
764 + const fold = closed.find((stack) => stack.kind === "environments")!;
765 + const open = fleetStacks(graph, new Set([fold.id]));
766 + for (const width of [560, 1400]) {
767 + const before = layoutFleetGraph(graph, closed, width);
768 + const layout = layoutFleetGraph(graph, open, width);
769 + expectNoOverlap(layout, membersOf(open));
770 + const { face } = layout.stacks.get(fold.id)!;
771 + expect(face).toEqual(before.stacks.get(fold.id)!.face);
772 + for (const [nodeId, rect] of before.nodes) {
773 + const now = layout.nodes.get(nodeId)!;
774 + if (rect.y < face.y) expect(now, nodeId).toEqual(rect);
775 + else expect({ ...now, y: rect.y }, nodeId).toEqual(rect);
776 + }
777 + }
778 + });
779 +
780 + it("draws the same map whatever order links arrive in", () => {
781 + const forward = build([environment("a", [...vms(7), link("x"), link("y")])]);
782 + const backward = build([environment("a", [link("y"), link("x"), ...vms(7).toReversed()])]);
783 + const lay = (graph: ReturnType<typeof build>) => {
784 + const layout = layoutFleetGraph(graph, fleetStacks(graph, new Set()));
785 + return [...layout.nodes].toSorted(([left], [right]) => (left < right ? -1 : 1));
786 + };
787 + expect(lay(backward)).toEqual(lay(forward));
788 + });
789 +
790 + it("names the access of links between environments on their own lane, clear of everything", () => {
791 + const graph = build([
792 + environment("a", [link("b"), link("c"), link("x")]),
793 + // At another access than the links back, so each of the four is its own line.
794 + environment("b", [link("a", { access: "auto" }), link("x")]),
795 + environment("c", [link("a", { access: "auto" })]),
796 + ]);
797 + const layout = layoutFleetGraph(graph);
798 + const geometry = (from: string, to: string) =>
799 + layout.links.get(`link:${node(from)}>${node(to)}`)!;
800 + expect(geometry("a", "x").badge).toBeNull();
801 + expect(geometry("b", "x").badge).toBeNull();
802 + const badges = [
803 + ["a", "b"],
804 + ["a", "c"],
805 + ["b", "a"],
806 + ["c", "a"],
807 + ].map(([from, to]) => {
808 + const { badge, d } = geometry(from!, to!);
809 + // On the link's own vertical run, between the two machines it joins.
810 + const run = samplePath(d).filter(
811 + (point) => point.y > badge!.y && point.y < badge!.y + badge!.height,
812 + );
813 + expect(run.length).toBeGreaterThan(0);
814 + for (const point of run) {
815 + expect(point.x).toBeGreaterThan(badge!.x);
816 + expect(point.x).toBeLessThan(badge!.x + badge!.width);
817 + }
818 + const ends = [layout.nodes.get(node(from!))!, layout.nodes.get(node(to!))!];
819 + expect(badge!.y).toBeGreaterThan(Math.min(...ends.map((rect) => rect.y)));
820 + expect(badge!.y).toBeLessThan(Math.max(...ends.map((rect) => rect.y + rect.height)));
821 + expect(badge!.x).toBeGreaterThanOrEqual(0);
822 + expect(badge!.x + badge!.width).toBeLessThanOrEqual(layout.width);
823 + return badge!;
824 + });
825 + const boxes = [...badges, ...solidRects(layout).map((box) => box.rect)];
826 + for (const [index, badge] of badges.entries()) {
827 + for (const other of boxes) {
828 + if (other !== badge && boxes.indexOf(other) > index) {
829 + expect(overlaps(badge, other)).toBe(false);
830 + }
831 + }
832 + }
833 + });
834 +
835 + it("runs links between environments left of them and links to other machines right", () => {
836 + const graph = largeSetup();
837 + const layout = layoutFleetGraph(graph, fleetStacks(graph, new Set()));
838 + const card = layout.nodes.get(node("nucbox"))!;
839 + for (const edge of graph.edges) {
840 + const geometry = edge.kind === "link" ? layout.links.get(edge.id) : undefined;
841 + if (geometry === undefined) continue;
842 + const between = layout.nodes.get(edge.to)!.x === card.x;
843 + for (const point of samplePath(geometry.d)) {
844 + if (between) expect(point.x, edge.id).toBeLessThanOrEqual(card.x);
845 + else expect(point.x, edge.id).toBeGreaterThanOrEqual(card.x + card.width);
846 + }
847 + }
848 + });
849 +
850 + it("keeps two hosts' links into one machine apart, and every link clear of other boxes", () => {
851 + for (const graph of [sharedSetup(), largeSetup(), hugeSetup()]) {
852 + for (const expanded of [false, true]) {
853 + const closed = fleetStacks(graph, new Set());
854 + const stacks = expanded
855 + ? fleetStacks(graph, new Set(closed.map((stack) => stack.id)))
856 + : closed;
857 + const layout = layoutFleetGraph(graph, stacks);
858 + expectNoOverlap(layout, membersOf(stacks));
859 + const boxes = solidRects(layout);
860 + const drawn = [
861 + ...[...layout.links].map(([key, geometry]) => ({ key, d: geometry.d })),
862 + ...[...layout.stacks].flatMap(([key, geometry]) =>
863 + geometry.lines.map((line) => ({ key, d: line.d })),
864 + ),
865 + ];
866 + for (const { key, d } of drawn) {
867 + for (const point of samplePath(d)) {
868 + const hit = boxes.find(
869 + ({ rect }) =>
870 + point.x > rect.x + 0.5 &&
871 + point.x < rect.x + rect.width - 0.5 &&
872 + point.y > rect.y + 0.5 &&
873 + point.y < rect.y + rect.height - 0.5,
874 + );
875 + expect(hit?.key, `${key} passes through ${hit?.key}`).toBeUndefined();
876 + }
877 + }
878 + // The last stretch into a machine is level, so two that differ in height never share it.
879 + const arrivals = new Map<string, number[]>();
880 + for (const edge of graph.edges) {
881 + const geometry = edge.kind === "link" ? layout.links.get(edge.id) : undefined;
882 + if (geometry === undefined) continue;
883 + const [before, last] = samplePath(geometry.d).slice(-2);
884 + // A machine an open stack pushed far down is reached by a steeper curve.
885 + expect(Math.abs(before!.y - geometry.arrow.y)).toBeLessThan(1);
886 + expect(last!.y).toBe(geometry.arrow.y);
887 + arrivals.set(edge.to, [...(arrivals.get(edge.to) ?? []), geometry.arrow.y]);
888 + }
889 + // A stack several hosts link to takes one line from each, each with its own entry.
890 + for (const [stackId, geometry] of layout.stacks) {
891 + for (const line of geometry.lines) {
892 + if (line.arrow === null) continue;
893 + if (geometry.lines.length > 1) {
894 + expect(samplePath(line.d).at(-2)!.y).toBeCloseTo(line.arrow.y, 0);
895 + }
896 + arrivals.set(stackId, [...(arrivals.get(stackId) ?? []), line.arrow.y]);
897 + }
898 + }
899 + for (const [target, heights] of arrivals) {
900 + const sorted = heights.toSorted((left, right) => left - right);
901 + for (const [index, height] of sorted.entries()) {
902 + if (index > 0) {
903 + expect(height - sorted[index - 1]!, `into ${target}`).toBeGreaterThanOrEqual(6);
904 + }
905 + }
906 + }
907 + }
908 + }
909 + });
910 +
911 + it("draws 1000 shared machines and 20 environments as a few stacks, open or closed", () => {
912 + const graph = hugeSetup();
913 + const closed = fleetStacks(graph, new Set());
914 + expect(closed.map((stack) => [stack.kind, stack.memberIds.length])).toEqual([
915 + ["targets", 1000],
916 + ["environments", 6],
917 + ["environments", 4],
918 + ]);
919 + const layout = layoutFleetGraph(graph, closed);
920 + expectNoOverlap(layout, membersOf(closed));
921 + // The client and the ten environments that stay cards: nothing per folded machine.
922 + expect(layout.nodes.size).toBe(11);
923 + expect(layout.links.size).toBe(2);
924 + expect(layout.routes.size).toBe(10);
925 + expect(layout.stacks.get(closed[0]!.id)!.lines.map((line) => line.sourceId)).toEqual([
926 + node("nucbox"),
927 + node("cups"),
928 + ]);
929 + const open = fleetStacks(graph, new Set(closed.map((stack) => stack.id)));
930 + const opened = layoutFleetGraph(graph, open);
931 + expectNoOverlap(opened, membersOf(open));
932 + expect(opened.nodes.size).toBe(11 + FLEET_STACK_SHOWN_MAX + 6 + 4);
933 + expect(layoutFleetGraph(graph, open)).toEqual(opened);
934 + });
935 +
936 + it("sizes a card by its name alone, whatever routes and links attach to it", () => {
937 + const routes = (count: number) =>
938 + Array.from({ length: count }, (_, index) => ({ id: `r${index}`, kind: "tailnet" as const }));
939 + const names = ["a", "b", "c", "d", "e"];
940 + const mesh = build(
941 + names.map((name, index) =>
942 + environment(
943 + name,
944 + names.filter((other) => other !== name).map((other) => link(other)),
945 + { routes: routes(index * 2 + 1) },
946 + ),
947 + ),
948 + );
949 + const layout = layoutFleetGraph(mesh);
950 + expectNoOverlap(layout, new Map());
951 + const plain = layoutFleetGraph(build([environment("a")])).nodes.get(node("a"))!;
952 + const cards = names.map((name) => layout.nodes.get(node(name))!);
953 + // Nine routes and eight links leave a card the size of one with a single route.
954 + expect(cards.map((card) => card.height)).toEqual(names.map(() => plain.height));
955 + expect(plain.height).toBeLessThanOrEqual(64);
956 + const long = layoutFleetGraph(build([environment("Julius's MacBook Pro")]));
957 + const wrapped = long.nodes.get(node("Julius's MacBook Pro"))!.height;
958 + expect(wrapped).toBeGreaterThan(plain.height);
959 + expect(wrapped).toBeLessThanOrEqual(72);
960 + for (const [index, name] of names.entries()) {
961 + const card = cards[index]!;
962 + const pills = mesh.edges
963 + .filter(isRouteEdge)
964 + .filter((edge) => edge.to === node(name))
965 + .map((edge) => layout.routes.get(edge.id)!);
966 + const centers = pills.map(({ pill }) => pill.y + pill.height / 2);
967 + // The route names keep their own pitch, centred on the card, and may reach past it.
968 + expect((centers[0]! + centers.at(-1)!) / 2).toBeCloseTo(card.y + card.height / 2, 5);
969 + for (const [at, center] of centers.entries()) {
970 + if (at > 0) expect(center - centers[at - 1]!).toBe(FLEET_ROUTE_PITCH);
971 + }
972 + // Their wires close up and enter the card as one bundle, each at its own height.
973 + const entries = pills.map(({ d }) => samplePath(d).at(-1)!.y);
974 + expect(new Set(entries).size).toBe(entries.length);
975 + expect(Math.max(...entries) - Math.min(...entries)).toBeLessThanOrEqual(10);
976 + for (const entry of entries) {
977 + expect(entry).toBeGreaterThan(card.y);
978 + expect(entry).toBeLessThan(card.y + card.height);
979 + }
980 + }
981 + // The gap between two cards grows only by what the taller column of route names needs.
982 + const gap = (upper: number) => cards[upper + 1]!.y - cards[upper]!.y - cards[upper]!.height;
983 + const two = layoutFleetGraph(build([environment("a"), environment("b")]));
984 + expect(gap(0)).toBe(two.nodes.get(node("b"))!.y - plain.y - plain.height);
985 + expect(gap(3)).toBeGreaterThan(gap(0));
986 + });
987 +
988 + it("gives every link into a card its own arrowhead on the edge the card already has", () => {
989 + const fan = build([
990 + ...["a", "b", "c", "d"].map((name) => environment(name, [link("e")])),
991 + environment("e"),
992 + ]);
993 + const pair = build([
994 + environment("a", [link("b"), link("c")]),
995 + environment("b"),
996 + environment("c", [link("b")]),
997 + ]);
998 + const names = ["a", "b", "c", "d", "e"];
999 + const mesh = build(
1000 + names.map((name) =>
1001 + environment(
1002 + name,
1003 + names.filter((other) => other !== name).map((other) => link(other)),
1004 + ),
1005 + ),
1006 + );
1007 + for (const [graph, roomy] of [
1008 + [pair, true],
1009 + [fan, false],
1010 + [mesh, false],
1011 + ] as const) {
1012 + const layout = layoutFleetGraph(graph);
1013 + expectNoOverlap(layout, new Map());
1014 + const arrivals = new Map<string, number[]>();
1015 + for (const edge of graph.edges) {
1016 + const geometry = edge.kind === "link" ? layout.links.get(edge.id) : undefined;
1017 + if (edge.kind !== "link" || geometry === undefined) continue;
1018 + const from = layout.nodes.get(edge.from)!;
1019 + const leaves = samplePath(geometry.d)[0]!.y;
1020 + expect(leaves).toBeGreaterThan(from.y);
1021 + expect(leaves).toBeLessThan(from.y + from.height);
1022 + arrivals.set(edge.to, [...(arrivals.get(edge.to) ?? []), geometry.arrow.y]);
1023 + if (geometry.twoWay !== null) {
1024 + const into = arrivals.get(edge.from) ?? [];
1025 + arrivals.set(edge.from, [...into, geometry.twoWay.backArrow.y]);
1026 + }
1027 + }
1028 + for (const [id, heights] of arrivals) {
1029 + const card = layout.nodes.get(id)!;
1030 + const sorted = heights.toSorted((left, right) => left - right);
1031 + expect(sorted[0]!).toBeGreaterThan(card.y);
1032 + expect(sorted.at(-1)!).toBeLessThan(card.y + card.height);
1033 + for (const [index, height] of sorted.entries()) {
1034 + if (index === 0) continue;
1035 + // With room they are a full lane apart; a crowded edge closes them up, never onto
1036 + // one another.
1037 + expect(height - sorted[index - 1]!, `at ${id}`).toBeGreaterThanOrEqual(
1038 + roomy ? FLEET_LANE_PITCH : 3,
1039 + );
1040 + }
1041 + }
1042 + }
1043 + });
1044 +
1045 + it("draws a two-way link once, on one lane, with an arrowhead into each card", () => {
1046 + const setup = (back: Partial<PeerLinkSummary>) =>
1047 + build([environment("a", [link("b")]), environment("b", [link("a", back)])]);
1048 + const merged = setup({});
1049 + const apart = setup({ access: "auto" });
1050 + const forward = `link:${node("a")}>${node("b")}`;
1051 + const reverse = `link:${node("b")}>${node("a")}`;
1052 + const layout = layoutFleetGraph(merged);
1053 + const two = layoutFleetGraph(apart);
1054 + expect([...layout.links.keys()]).toEqual([forward]);
1055 + expect([...two.links.keys()].toSorted()).toEqual([forward, reverse]);
1056 + // Two lines need two lanes left of the cards; the merged one needs a single lane.
1057 + expect(two.nodes.get(node("a"))!.x - layout.nodes.get(node("a"))!.x).toBeGreaterThan(0);
1058 + expect(two.links.get(forward)!.twoWay).toBeNull();
1059 + const geometry = layout.links.get(forward)!;
1060 + const { twoWay } = geometry;
1061 + expect(twoWay).not.toBeNull();
1062 + for (const [arrow, cardId] of [
1063 + [geometry.arrow, "b"],
1064 + [twoWay!.backArrow, "a"],
1065 + ] as const) {
1066 + const card = layout.nodes.get(node(cardId))!;
1067 + expect(arrow.x).toBe(card.x);
1068 + expect(arrow.y).toBeGreaterThan(card.y);
1069 + expect(arrow.y).toBeLessThan(card.y + card.height);
1070 + }
1071 + // Each half ends at its own arrowhead and the two meet, so one direction's state shows at
1072 + // its end without a gap in the line.
1073 + const forwardHalf = samplePath(twoWay!.forward);
1074 + const backHalf = samplePath(twoWay!.back);
1075 + expect(forwardHalf.at(-1)!.y).toBe(geometry.arrow.y);
1076 + expect(backHalf[0]!.y).toBe(twoWay!.backArrow.y);
1077 + expect(backHalf.at(-1)).toEqual(forwardHalf[0]);
1078 + expect(geometry.badge?.onDemand).toBe(false);
1079 + // Health is no part of the shape: one direction failing redraws nothing.
1080 + expect(fleetShapeKey(setup({ status: "unreachable" }), [])).toBe(fleetShapeKey(merged, []));
1081 + });
1082 +
1083 + it("shows a link's name only on demand where it has no clear place", () => {
1084 + const names = ["a", "b", "c", "d", "e"];
1085 + const graph = build(
1086 + names.map((name) =>
1087 + environment(
1088 + name,
1089 + names.filter((other) => other !== name).map((other) => link(other)),
1090 + ),
1091 + ),
1092 + );
1093 + const layout = layoutFleetGraph(graph);
1094 + const between = [...layout.links.values()];
1095 + const always = between.flatMap(({ badge }) => (badge && !badge.onDemand ? [badge] : []));
1096 + // Every link keeps a name; the ones always drawn sit on no other link's lane and no other name.
1097 + expect(between.every(({ badge }) => badge !== null)).toBe(true);
1098 + expect(always.length).toBeGreaterThan(0);
1099 + expect(always.length).toBeLessThan(between.length);
1100 + for (const [index, badge] of always.entries()) {
1101 + for (const other of always.slice(index + 1)) expect(overlaps(badge, other)).toBe(false);
1102 + const crossing = between.filter(({ badge: own, d }) => {
1103 + if (own === badge) return false;
1104 + return samplePath(d).some(
1105 + (point) =>
1106 + point.x > badge.x + 0.5 &&
1107 + point.x < badge.x + badge.width - 0.5 &&
1108 + point.y > badge.y + 0.5 &&
1109 + point.y < badge.y + badge.height - 0.5,
1110 + );
1111 + });
1112 + expect(crossing).toEqual([]);
1113 + }
1114 + });
1115 +
1116 + it("puts a machine several hosts link to between them, and one host's machines beside it", () => {
1117 + const layout = layoutFleetGraph(sharedSetup());
1118 + const center = (name: string) => {
1119 + const rect = layout.nodes.get(node(name))!;
1120 + return rect.y + rect.height / 2;
1121 + };
1122 + for (const name of ["fs-1", "fs-2", "fs-3"]) {
1123 + expect(center(name)).toBeGreaterThan(center("nucbox"));
1124 + expect(center(name)).toBeLessThan(center("cups"));
1125 + }
1126 + expect(center("fs-5")).toBe(center("cups"));
1127 + // The upper host's link arrives above the lower host's.
1128 + const arrival = (from: string) => layout.links.get(`link:${node(from)}>${node("fs-2")}`)!.arrow;
1129 + expect(arrival("nucbox").y).toBeLessThan(arrival("cups").y);
1130 + });
1131 +
1132 + it("gives up gutters before scale: a real setup stays legible from 560 to 1400 wide", () => {
1133 + const routes = (...kinds: ReadonlyArray<"lan" | "tailnet" | "relay">) =>
1134 + kinds.map((kind, index) => ({ id: `${kind}-${index}`, kind }));
1135 + const graph = build([
1136 + environment("cups", "unknown", {
1137 + phase: "offline",
1138 + routes: routes("tailnet", "tailnet", "relay"),
1139 + }),
1140 + environment(
1141 + "nucbox-1",
1142 + [
1143 + link("Julius's MacBook Pro", { access: "full-access" }),
1144 + ...vms(7, "fs", { access: "full-access" }),
1145 + ...vms(37, "gs", { access: "full-access", status: "unreachable" }),
1146 + ],
1147 + { routes: routes("lan", "tailnet", "tailnet", "relay"), activeRouteId: "lan-0" },
1148 + ),
1149 + environment("Julius's MacBook Pro"),
1150 + ]);
1151 + const stacks = fleetStacks(graph, new Set());
1152 + expect(stacks.map((stack) => [stack.memberIds.length, stack.reachable])).toEqual([[44, 7]]);
1153 + const regular = layoutFleetGraph(graph, stacks);
1154 + const widths = [560, 900, 1400].map((width) => {
1155 + const layout = layoutFleetGraph(graph, stacks, width);
1156 + expectNoOverlap(layout, membersOf(stacks));
1157 + const height = fleetCanvasHeight(layout, width, { min: 0, max: 840 });
1158 + expect(fitFleetLayout(layout, { width, height }).scale, `at ${width}`).toBeGreaterThanOrEqual(
1159 + FLEET_FIT_LEGIBLE_SCALE,
1160 + );
1161 + // Only the columns move: every height, and so every lane and entry, is the regular one.
1162 + expect(layout.height).toBe(regular.height);
1163 + // Each route enters its machine at its own height, and a link's arrowhead stands clear
1164 + // of all of them.
1165 + const arrivals = new Map<string, { routes: number[]; links: number[] }>();
1166 + const into = (id: string) =>
1167 + arrivals.get(id) ?? arrivals.set(id, { routes: [], links: [] }).get(id)!;
1168 + for (const edge of graph.edges) {
1169 + if (edge.kind === "route") {
1170 + into(edge.to).routes.push(samplePath(layout.routes.get(edge.id)!.d).at(-1)!.y);
1171 + } else if (layout.links.has(edge.id)) {
1172 + into(edge.to).links.push(layout.links.get(edge.id)!.arrow.y);
1173 + }
1174 + }
1175 + for (const [id, { routes: entries, links: arrows }] of arrivals) {
1176 + expect(new Set(entries).size, `into ${id}`).toBe(entries.length);
1177 + for (const arrow of arrows) {
1178 + for (const entry of entries) {
1179 + expect(Math.abs(arrow - entry), `into ${id}`).toBeGreaterThanOrEqual(8);
1180 + }
1181 + }
1182 + }
1183 + // Every wire and link still ends level, however short its run became.
1184 + for (const { d } of [...layout.routes.values(), ...layout.links.values()]) {
1185 + const [before, last] = samplePath(d).slice(-2);
1186 + expect(before!.y).toBe(last!.y);
1187 + }
1188 + return layout.width;
1189 + });
1190 + expect(widths[0]).toBeLessThan(regular.width);
1191 + expect(widths[2]).toBeGreaterThan(regular.width);
1192 + });
1193 +
1194 + it("gives a stack room to say how many machines answer only when some do not", () => {
1195 + const face = (links: ReadonlyArray<PeerLinkSummary>) => {
1196 + const graph = build([environment("host", links)]);
1197 + const stacks = fleetStacks(graph, new Set());
1198 + expect(fleetStackPartial(stacks[0]!)).toBe(
1199 + links.some((entry) => entry.status !== "reachable"),
1200 + );
1201 + return {
1202 + key: fleetShapeKey(graph, stacks),
1203 + height: layoutFleetGraph(graph, stacks).stacks.get(stacks[0]!.id)!.face.height,
1204 + };
1205 + };
1206 + const whole = face(vms(6));
1207 + const partial = face([...vms(5), link("vm-6", { status: "unreachable" })]);
1208 + expect(partial.height).toBeGreaterThan(whole.height);
1209 + // The card changes size, so the layout has to be made again.
1210 + expect(partial.key).not.toBe(whole.key);
1211 + });
1212 +
1213 + it("keeps the shape key when only health, route state or status changes", () => {
1214 + const key = (graph: ReturnType<typeof build>) =>
1215 + fleetShapeKey(graph, fleetStacks(graph, new Set()));
1216 + // One machine already not answering: how many more go quiet does not resize the card.
1217 + const before = build([environment("a", [...vms(5), link("vm-6", { status: "unreachable" })])]);
1218 + const after = build([
1219 + environment("a", [...vms(6, "vm", { status: "unreachable" })], {
1220 + activeRouteId: null,
1221 + phase: "connected",
1222 + }),
1223 + ]);
1224 + expect(key(after)).toBe(key(before));
1225 + const moved = build([environment("a", [...vms(6, "vm", { access: "read-only" })])]);
1226 + expect(key(moved)).not.toBe(key(before));
1227 + const stacks = fleetStacks(before, new Set());
1228 + expect(fleetShapeKey(before, fleetStacks(before, new Set([stacks[0]!.id])))).not.toBe(
1229 + key(before),
1230 + );
1231 + // An environment that comes back leaves its folded group, with the group's id unchanged.
1232 + const labs = (firstPhase: FleetEnvironmentInput["phase"]) =>
1233 + build(
1234 + Array.from({ length: 14 }, (_, index) =>
1235 + environment(`lab-${index}`, "unknown", { phase: index === 0 ? firstPhase : "offline" }),
1236 + ),
1237 + );
1238 + expect(key(labs("connecting"))).not.toBe(key(labs("offline")));
1239 + });
1240 +});
1241 +
1242 +describe("nextFleetNode", () => {
1243 + it("steps between columns and down a column, stacks included", () => {
1244 + const graph = build([
1245 + environment("a", [...vms(5), link("x", { access: "read-only" })]),
1246 + environment("b"),
1247 + ]);
1248 + const stacks = fleetStacks(graph, new Set());
1249 + const rects = fleetFocusRects(layoutFleetGraph(graph, stacks));
1250 + expect(nextFleetNode(rects, FLEET_CLIENT_NODE_ID, "right")).toBe(node("a"));
1251 + expect(nextFleetNode(rects, node("a"), "down")).toBe(node("b"));
1252 + expect(nextFleetNode(rects, node("a"), "right")).toBe(stacks[0]!.id);
1253 + expect(nextFleetNode(rects, stacks[0]!.id, "down")).toBe(node("x"));
1254 + expect(nextFleetNode(rects, FLEET_CLIENT_NODE_ID, "left")).toBeNull();
1255 + });
1256 +});
1257 +
1258 +describe("fitting the view", () => {
1259 + it("fills the canvas but caps the zoom for a small map", () => {
1260 + const view = fitFleetLayout({ width: 300, height: 60 }, { width: 900, height: 400 });
1261 + expect(view.scale).toBe(1.15);
1262 + expect(view.x).toBeCloseTo((900 - 300 * 1.15) / 2);
1263 + });
1264 +
1265 + it("fits a map taller than the manual minimum allows, and zooming out does not jump back", () => {
1266 + const view = fitFleetLayout({ width: 700, height: 1572 }, { width: 800, height: 360 });
1267 + expect(view.scale).toBeLessThan(0.3);
1268 + expect(1572 * view.scale).toBeLessThanOrEqual(360);
1269 + expect(zoomFleetView(view, 0.8, { x: 0, y: 0 }).scale).toBe(view.scale);
1270 + const closer = zoomFleetView(view, 1.25, { x: 0, y: 0 }, view.scale);
1271 + expect(closer.scale).toBeGreaterThan(view.scale);
1272 + expect(zoomFleetView(closer, 0.8, { x: 0, y: 0 }, view.scale).scale).toBeCloseTo(view.scale);
1273 + });
1274 +
1275 + it("sizes the canvas to the fitted map within its bounds", () => {
1276 + const bounds = { min: 240, max: 640 };
1277 + expect(fleetCanvasHeight({ width: 400, height: 60 }, 900, bounds)).toBe(240);
1278 + expect(fleetCanvasHeight({ width: 800, height: 2000 }, 900, bounds)).toBe(640);
1279 + expect(fleetCanvasHeight({ width: 800, height: 300 }, 900, bounds)).toBe(
1280 + Math.ceil(300 * ((900 - 56) / 800) + 56),
1281 + );
1282 + });
1283 +
1284 + it("keeps a stack where it is on screen when it opens, and returns when it closes", () => {
1285 + const graph = largeSetup();
1286 + const closed = fleetStacks(graph, new Set());
1287 + const stackId = closed[0]!.id;
1288 + const open = fleetStacks(graph, new Set([stackId]));
1289 + const bounds = { min: 180, max: 840 };
1290 + const onScreen = (view: { x: number; y: number; scale: number }, rect: FleetRect) => ({
1291 + x: rect.x * view.scale + view.x,
1292 + y: rect.y * view.scale + view.y,
1293 + });
1294 + for (const width of [560, 640, 1400]) {
1295 + const before = layoutFleetGraph(graph, closed, width);
1296 + const after = layoutFleetGraph(graph, open, width);
1297 + const size = { width, height: fleetCanvasHeight(before, width, bounds) };
1298 + const fit = fitFleetLayout(before, size);
1299 + const face = before.stacks.get(stackId)!.face;
1300 + const opened = anchorFleetView({
1301 + key: "open",
1302 + from: { key: "closed", held: null, view: fit, size, face },
1303 + stack: after.stacks.get(stackId)!,
1304 + layout: after,
1305 + bounds,
1306 + });
1307 + expect(opened.key).toBe("open");
1308 + expect(opened.glide).toBe(true);
1309 + // The canvas only grows, to show what opened, and never past its bound.
1310 + expect(opened.height).toBeGreaterThanOrEqual(size.height);
1311 + expect(opened.height).toBeLessThanOrEqual(bounds.max);
1312 + // The scale holds, and the card and every machine beside it stay where they were.
1313 + expect(opened.view).toEqual(fit);
1314 + expect(onScreen(opened.view, after.nodes.get(node("nucbox"))!)).toEqual(
1315 + onScreen(fit, before.nodes.get(node("nucbox"))!),
1316 + );
1317 + const tray = after.stacks.get(stackId)!.rect;
1318 + expect(onScreen(opened.view, tray).x + tray.width * opened.view.scale).toBeLessThanOrEqual(
1319 + width,
1320 + );
1321 +
1322 + // Zoomed in until the stack is wider than the canvas, the view shrinks to its width, once.
1323 + const close = { x: fit.x - 600, y: fit.y, scale: 6 };
1324 + const shrunk = anchorFleetView({
1325 + key: "open",
1326 + from: { key: "closed", held: null, view: close, size, face },
1327 + stack: after.stacks.get(stackId)!,
1328 + layout: after,
1329 + bounds,
1330 + });
1331 + expect(shrunk.view.scale).toBeLessThan(6);
1332 + expect(onScreen(shrunk.view, tray).x).toBeGreaterThanOrEqual(0);
1333 + expect(onScreen(shrunk.view, tray).x + tray.width * shrunk.view.scale).toBeLessThanOrEqual(
1334 + width,
1335 + );
1336 + expect(onScreen(shrunk.view, face).y).toBeCloseTo(onScreen(close, face).y);
1337 +
1338 + // Closing it again goes back to the fit it came from.
1339 + const back = anchorFleetView({
1340 + key: "closed",
1341 + from: { key: "open", held: opened, view: opened.view, size, face },
1342 + stack: before.stacks.get(stackId)!,
1343 + layout: before,
1344 + bounds,
1345 + });
1346 + expect(back.key).toBe("");
1347 + expect(back.glide).toBe(true);
1348 +
1349 + // After a pan the view is the user's: closing keeps the card under the pointer instead.
1350 + const panned = { ...opened, view: { ...opened.view, x: opened.view.x - 40 }, undo: null };
1351 + const closedAgain = anchorFleetView({
1352 + key: "closed",
1353 + from: { key: "open", held: panned, view: panned.view, size, face },
1354 + stack: before.stacks.get(stackId)!,
1355 + layout: before,
1356 + bounds,
1357 + });
1358 + expect(closedAgain.key).toBe("closed");
1359 + expect(closedAgain.view.scale).toBe(panned.view.scale);
1360 + expect(onScreen(closedAgain.view, face)).toEqual(onScreen(panned.view, face));
1361 + expect(closedAgain.height).toBeLessThanOrEqual(size.height);
1362 + // The canvas that grew for the tray gives that room back, not just the pre-open size.
1363 + const grown = { width, height: opened.height };
1364 + const givenBack = anchorFleetView({
1365 + key: "closed",
1366 + from: { key: "open", held: panned, view: panned.view, size: grown, face },
1367 + stack: before.stacks.get(stackId)!,
1368 + layout: before,
1369 + bounds,
1370 + });
1371 + expect(givenBack.height).toBeLessThan(opened.height);
1372 + }
1373 + });
1374 +
1375 + it("returns to a view set by hand before the stack opened", () => {
1376 + const graph = largeSetup();
1377 + const closed = fleetStacks(graph, new Set());
1378 + const stackId = closed[0]!.id;
1379 + const before = layoutFleetGraph(graph, closed, 1400);
1380 + const after = layoutFleetGraph(graph, fleetStacks(graph, new Set([stackId])), 1400);
1381 + const bounds = { min: 180, max: 840 };
1382 + const size = { width: 1400, height: 500 };
1383 + const held = {
1384 + key: "closed",
1385 + view: { x: -120, y: 30, scale: 1.4 },
1386 + height: 500,
1387 + glide: false,
1388 + undo: null,
1389 + };
1390 + const face = before.stacks.get(stackId)!.face;
1391 + const opened = anchorFleetView({
1392 + key: "open",
1393 + from: { key: "closed", held, view: held.view, size, face },
1394 + stack: after.stacks.get(stackId)!,
1395 + layout: after,
1396 + bounds,
1397 + });
1398 + expect(opened.view.scale).toBe(1.4);
1399 + const back = anchorFleetView({
1400 + key: "closed",
1401 + from: { key: "open", held: opened, view: opened.view, size, face },
1402 + stack: before.stacks.get(stackId)!,
1403 + layout: before,
1404 + bounds,
1405 + });
1406 + expect(back).toEqual({ ...held, glide: true });
1407 + });
1408 +
1409 + it("zooms around the anchor", () => {
1410 + const view = zoomFleetView({ x: 10, y: 20, scale: 1 }, 2, { x: 100, y: 100 });
1411 + expect(view).toEqual({ scale: 2, x: -80, y: -60 });
1412 + });
1413 +});
apps/web/src/components/settings/environmentsMap.logic.ts new
+1940
@@ -0,0 +1,1940 @@
1 +import type {
2 + ConnectionRouteKind,
3 + EnvironmentConnectionPhase,
4 +} from "@t3tools/client-runtime/connection";
5 +import { linkBackOffer } from "@t3tools/client-runtime/link-batch";
6 +import { peerLinkHealth, type PeerLinkHealth } from "@t3tools/client-runtime/state/peerLinks";
7 +import {
8 + AuthMcpClientAccess,
9 + type EnvironmentId,
10 + type EnvironmentMachineKind,
11 + type PeerLinkSummary,
12 +} from "@t3tools/contracts";
13 +import type * as DateTime from "effect/DateTime";
14 +
15 +export const FLEET_CLIENT_NODE_ID = "client";
16 +
17 +/** What this client knows of the links an environment holds to others. */
18 +export type FleetOutgoingLinks =
19 + | { readonly state: "loaded"; readonly links: ReadonlyArray<PeerLinkSummary> }
20 + | { readonly state: "loading" }
21 + | { readonly state: "error"; readonly message: string }
22 + /** Connected, but linked environments is off or unsupported there. */
23 + | { readonly state: "off" }
24 + /** Not connected, or not allowed to read: it may hold links this client cannot see. */
25 + | { readonly state: "unknown" };
26 +
27 +export interface FleetRouteInput {
28 + readonly id: string;
29 + readonly kind: ConnectionRouteKind;
30 + /** The route's own label when it says more than its kind, such as "Tailscale HTTPS". */
31 + readonly label?: string;
32 +}
33 +
34 +export interface FleetEnvironmentInput {
35 + readonly environmentId: EnvironmentId;
36 + readonly label: string;
37 + readonly machine: EnvironmentMachineKind | null;
38 + readonly phase: EnvironmentConnectionPhase;
39 + /** Switched on in this client. A switched-off environment is saved but never dialled. */
40 + readonly enabled: boolean;
41 + /** Saved routes, preferred first. */
42 + readonly routes: ReadonlyArray<FleetRouteInput>;
43 + /** The route carrying the connection, when the client is connected and knows it. */
44 + readonly activeRouteId: string | null;
45 + readonly refusedRouteIds: ReadonlyArray<string>;
46 + readonly outgoing: FleetOutgoingLinks;
47 + /** Linked environments is supported and switched on there. */
48 + readonly offersLinks: boolean;
49 + /** This client's session there may create links from it and pairing codes on it. */
50 + readonly canWriteAccess: boolean;
51 + /** An address another machine can reach it at, so a link to it needs no typed address. */
52 + readonly hasLinkAddress: boolean;
53 +}
54 +
55 +/** A machine on the user's T3 Connect account that this client has not saved. */
56 +export interface FleetConnectMachineInput {
57 + readonly environmentId: EnvironmentId;
58 + readonly label: string;
59 + readonly machine: EnvironmentMachineKind | null;
60 + readonly availability: "checking" | "online" | "offline" | "error";
61 +}
62 +
63 +/**
64 + * How a route is doing, from what the client knows: which one carries the connection, which the
65 + * host refused, and the environment's phase. It never probes a route to find out.
66 + */
67 +export type FleetRouteState =
68 + | "in-use"
69 + | "standby"
70 + | "trying"
71 + /** The environment cannot be reached right now, over any route. */
72 + | "down"
73 + /** Not dialled: the environment is switched off, or needs an update first. */
74 + | "idle"
75 + | "refused"
76 + /** A T3 Connect machine this client could add; no route is saved yet. */
77 + | "offered";
78 +
79 +/** Why an environment can or cannot be the source of a new link. */
80 +export type FleetLinking = "ready" | "disconnected" | "off" | "forbidden";
81 +
82 +export type FleetNode =
83 + | { readonly id: string; readonly kind: "client"; readonly label: string }
84 + | {
85 + readonly id: string;
86 + readonly kind: "environment";
87 + readonly environmentId: EnvironmentId;
88 + readonly label: string;
89 + readonly machine: EnvironmentMachineKind | null;
90 + readonly phase: EnvironmentConnectionPhase;
91 + readonly enabled: boolean;
92 + readonly routeCount: number;
93 + readonly outgoing: FleetOutgoingLinks["state"];
94 + readonly outgoingError: string | null;
95 + readonly linking: FleetLinking;
96 + /** The client can mint a pairing code there itself, so linking to it asks for none. */
97 + readonly mintable: boolean;
98 + readonly canWriteAccess: boolean;
99 + readonly hasLinkAddress: boolean;
100 + }
101 + | {
102 + readonly id: string;
103 + readonly kind: "connect";
104 + readonly environmentId: EnvironmentId;
105 + readonly label: string;
106 + readonly machine: EnvironmentMachineKind | null;
107 + readonly availability: FleetConnectMachineInput["availability"];
108 + }
109 + /** Seen only as another environment's link target; the client is not connected to it. */
110 + | {
111 + readonly id: string;
112 + readonly kind: "target";
113 + readonly environmentId: EnvironmentId;
114 + readonly label: string;
115 + /** Where the first environment linking to it reaches it. */
116 + readonly address: string | null;
117 + };
118 +
119 +export type FleetEnvironmentNode = Extract<FleetNode, { kind: "environment" }>;
120 +
121 +export type FleetEdge =
122 + | {
123 + readonly id: string;
124 + readonly kind: "route";
125 + readonly from: string;
126 + readonly to: string;
127 + readonly routeId: string;
128 + readonly routeKind: ConnectionRouteKind;
129 + readonly routeLabel?: string;
130 + readonly state: FleetRouteState;
131 + }
132 + | {
133 + readonly id: string;
134 + readonly kind: "link";
135 + readonly from: string;
136 + readonly to: string;
137 + readonly sourceEnvironmentId: EnvironmentId;
138 + readonly link: PeerLinkSummary;
139 + readonly health: PeerLinkHealth;
140 + };
141 +
142 +export type FleetRouteEdge = Extract<FleetEdge, { kind: "route" }>;
143 +export type FleetLinkEdge = Extract<FleetEdge, { kind: "link" }>;
144 +
145 +export interface FleetGraph {
146 + readonly nodes: ReadonlyArray<FleetNode>;
147 + readonly edges: ReadonlyArray<FleetEdge>;
148 +}
149 +
150 +export const fleetEnvironmentNodeId = (environmentId: EnvironmentId) => `env:${environmentId}`;
151 +
152 +function routeState(environment: FleetEnvironmentInput, routeId: string): FleetRouteState {
153 + if (environment.refusedRouteIds.includes(routeId)) return "refused";
154 + if (!environment.enabled) return "idle";
155 + switch (environment.phase) {
156 + case "connected":
157 + return routeId === environment.activeRouteId ? "in-use" : "standby";
158 + case "connecting":
159 + return "trying";
160 + case "unsupported":
161 + case "available":
162 + return "idle";
163 + case "reconnecting":
164 + case "error":
165 + case "offline":
166 + return "down";
167 + }
168 +}
169 +
170 +function linking(environment: FleetEnvironmentInput): FleetLinking {
171 + if (environment.phase !== "connected") return "disconnected";
172 + if (!environment.offersLinks) return "off";
173 + return environment.canWriteAccess ? "ready" : "forbidden";
174 +}
175 +
176 +/**
177 + * One node per machine however often it is named: an environment listed twice, a link repeated
178 + * in a list, a T3 Connect machine the client also saved, and a link to a machine the client
179 + * knows all land on the same node. Each saved route is its own edge from the client.
180 + */
181 +export function buildFleetGraph(input: {
182 + readonly clientLabel: string;
183 + readonly environments: ReadonlyArray<FleetEnvironmentInput>;
184 + readonly connectMachines?: ReadonlyArray<FleetConnectMachineInput>;
185 + readonly now: DateTime.Utc;
186 +}): FleetGraph {
187 + const nodes = new Map<string, FleetNode>([
188 + [FLEET_CLIENT_NODE_ID, { id: FLEET_CLIENT_NODE_ID, kind: "client", label: input.clientLabel }],
189 + ]);
190 + const edges = new Map<string, FleetEdge>();
191 + const environments = input.environments.filter(
192 + (environment, index, all) =>
193 + all.findIndex((other) => other.environmentId === environment.environmentId) === index,
194 + );
195 + for (const environment of environments) {
196 + const id = fleetEnvironmentNodeId(environment.environmentId);
197 + nodes.set(id, {
198 + id,
199 + kind: "environment",
200 + environmentId: environment.environmentId,
201 + label: environment.label,
202 + machine: environment.machine,
203 + phase: environment.phase,
204 + enabled: environment.enabled,
205 + routeCount: environment.routes.length,
206 + outgoing: environment.outgoing.state,
207 + outgoingError: environment.outgoing.state === "error" ? environment.outgoing.message : null,
208 + linking: linking(environment),
209 + mintable:
210 + environment.phase === "connected" &&
211 + environment.canWriteAccess &&
212 + environment.hasLinkAddress,
213 + canWriteAccess: environment.canWriteAccess,
214 + hasLinkAddress: environment.hasLinkAddress,
215 + });
216 + for (const route of environment.routes) {
217 + const edgeId = `route:${id}:${route.id}`;
218 + if (edges.has(edgeId)) continue;
219 + edges.set(edgeId, {
220 + id: edgeId,
221 + kind: "route",
222 + from: FLEET_CLIENT_NODE_ID,
223 + to: id,
224 + routeId: route.id,
225 + routeKind: route.kind,
226 + ...(route.label === undefined ? {} : { routeLabel: route.label }),
227 + state: routeState(environment, route.id),
228 + });
229 + }
230 + }
231 + for (const machine of input.connectMachines ?? []) {
232 + const id = fleetEnvironmentNodeId(machine.environmentId);
233 + if (nodes.has(id)) continue;
234 + nodes.set(id, {
235 + id,
236 + kind: "connect",
237 + environmentId: machine.environmentId,
238 + label: machine.label,
239 + machine: machine.machine,
240 + availability: machine.availability,
241 + });
242 + edges.set(`route:${id}:offer`, {
243 + id: `route:${id}:offer`,
244 + kind: "route",
245 + from: FLEET_CLIENT_NODE_ID,
246 + to: id,
247 + routeId: "offer",
248 + routeKind: "relay",
249 + state: "offered",
250 + });
251 + }
252 + for (const environment of environments) {
253 + if (environment.outgoing.state !== "loaded") continue;
254 + const from = fleetEnvironmentNodeId(environment.environmentId);
255 + for (const link of environment.outgoing.links) {
256 + const to = fleetEnvironmentNodeId(link.environmentId);
257 + const id = `link:${from}>${to}`;
258 + if (to === from || edges.has(id)) continue;
259 + if (!nodes.has(to)) {
260 + nodes.set(to, {
261 + id: to,
262 + kind: "target",
263 + environmentId: link.environmentId,
264 + label: link.label,
265 + address: link.urls[0] ?? null,
266 + });
267 + }
268 + edges.set(id, {
269 + id,
270 + kind: "link",
271 + from,
272 + to,
273 + sourceEnvironmentId: environment.environmentId,
274 + link,
275 + health: peerLinkHealth(link, input.now),
276 + });
277 + }
278 + }
279 + return { nodes: [...nodes.values()], edges: [...edges.values()] };
280 +}
281 +
282 +export const isLinkEdge = (edge: FleetEdge): edge is FleetLinkEdge => edge.kind === "link";
283 +export const isRouteEdge = (edge: FleetEdge): edge is FleetRouteEdge => edge.kind === "route";
284 +
285 +/** Two machines linked to each other at the same access: two links the map draws as one line. */
286 +export interface FleetTwoWayLink {
287 + /** The one the line is drawn and selected as: from the machine listed first. */
288 + readonly forward: FleetLinkEdge;
289 + readonly back: FleetLinkEdge;
290 +}
291 +
292 +/**
293 + * Every two-way link, under the id of each of its two links. Links at different access levels
294 + * say different things, so they stay two lines.
295 + */
296 +export function fleetTwoWayLinks(graph: FleetGraph): ReadonlyMap<string, FleetTwoWayLink> {
297 + const links = new Map(graph.edges.filter(isLinkEdge).map((edge) => [edge.id, edge]));
298 + const pairs = new Map<string, FleetTwoWayLink>();
299 + for (const forward of links.values()) {
300 + const back = links.get(`link:${forward.to}>${forward.from}`);
301 + if (back === undefined || back.link.access !== forward.link.access || pairs.has(forward.id)) {
302 + continue;
303 + }
304 + const pair = { forward, back };
305 + pairs.set(forward.id, pair).set(back.id, pair);
306 + }
307 + return pairs;
308 +}
309 +
310 +/** The link whose line stands for `edge`: itself, or the other half of its two-way link. */
311 +export const fleetDrawnLinkId = (pairs: ReadonlyMap<string, FleetTwoWayLink>, edgeId: string) =>
312 + pairs.get(edgeId)?.forward.id ?? edgeId;
313 +
314 +/** Worst first: expired, failing, not answering, expiring soon, fine. */
315 +export const linkTroubleRank = (health: PeerLinkHealth) =>
316 + health.kind === "expired"
317 + ? 0
318 + : health.kind === "failing"
319 + ? 1
320 + : health.kind === "unreachable"
321 + ? 2
322 + : health.expiresInDays === null
323 + ? 4
324 + : 3;
325 +
326 +/** The health a two-way link's one label wears: that of the direction in more trouble. */
327 +export const worseLinkHealth = (left: PeerLinkHealth, right: PeerLinkHealth) =>
328 + linkTroubleRank(right) < linkTroubleRank(left) ? right : left;
329 +
330 +/**
331 + * Whether the map offers to link a one-way link's target back to its source: the same rule
332 + * the link dialogs use, read from what the map knows of the two machines.
333 + */
334 +export function fleetLinkBackOffered(graph: FleetGraph, edge: FleetLinkEdge): boolean {
335 + const source = graph.nodes.find((node) => node.id === edge.from);
336 + const target = graph.nodes.find((node) => node.id === edge.to);
337 + if (source?.kind !== "environment" || target?.kind !== "environment") return false;
338 + const offer = linkBackOffer({
339 + source: {
340 + environmentId: source.environmentId,
341 + connected: source.phase === "connected",
342 + writable: source.canWriteAccess,
343 + urls: source.hasLinkAddress ? [""] : [],
344 + },
345 + target: {
346 + connected: target.phase === "connected",
347 + offersLinks: target.linking !== "off",
348 + writable: target.canWriteAccess,
349 + links:
350 + target.outgoing === "loaded"
351 + ? graph.edges
352 + .filter(isLinkEdge)
353 + .filter((other) => other.from === target.id)
354 + .map((other) => other.link)
355 + : null,
356 + },
357 + });
358 + return offer.kind === "offered";
359 +}
360 +
361 +/**
362 + * The setup in two numbers. `links` is null when the total is not known: a list still loading,
363 + * none read, or one failed among several. A failed or unread list is not "no links".
364 + */
365 +export function fleetSummary(graph: FleetGraph): {
366 + readonly machines: number;
367 + readonly links: number | null;
368 + readonly loading: boolean;
369 +} {
370 + const connected = graph.nodes.filter(
371 + (node) => node.kind === "environment" && node.phase === "connected",
372 + ) as FleetEnvironmentNode[];
373 + const loading = connected.some((node) => node.outgoing === "loading");
374 + const known =
375 + !loading &&
376 + connected.some((node) => node.outgoing === "loaded") &&
377 + !connected.some((node) => node.outgoing === "error");
378 + return {
379 + machines: graph.nodes.length - 1,
380 + links: known ? graph.edges.filter(isLinkEdge).length : null,
381 + loading,
382 + };
383 +}
384 +
385 +/** Whether a link wants the user's attention: anything but reachable with time left. */
386 +export const linkNeedsAttention = (health: PeerLinkHealth) =>
387 + health.kind !== "reachable" || health.expiresInDays !== null;
388 +
389 +const ACCESS_ORDER = AuthMcpClientAccess.literals;
390 +/**
391 + * How far apart two links enter one card while it has the room: an arrowhead plus the heaviest
392 + * line. A card with more links than that fits keeps its size and they close up.
393 + */
394 +export const FLEET_LANE_PITCH = 12;
395 +const labelOrder = new Intl.Collator("en", { numeric: true, sensitivity: "base" });
396 +
397 +/** Why an environment with no links is folded away: what the client knows of it, never a probe. */
398 +export type FleetFoldGroup = "offline" | "off" | "update" | "not-added";
399 +
400 +/**
401 + * Machines drawn as a single node, each still listed in the details. `targets` are machines
402 + * known only through links, all linked from the same environments at the same access levels:
403 + * a thousand VMs under two hosts cost one node and two lines. `environments` are ones this app
404 + * is not connected to and that take part in no link, grouped by why.
405 + */
406 +export interface FleetStack {
407 + readonly id: string;
408 + readonly kind: "targets" | "environments";
409 + /** The environments linking to every member, uppermost first. Empty for `environments`. */
410 + readonly sources: ReadonlyArray<{
411 + readonly sourceId: string;
412 + readonly access: AuthMcpClientAccess;
413 + }>;
414 + readonly group: FleetFoldGroup | null;
415 + /** In name order, so the first and last name the range. */
416 + readonly memberIds: ReadonlyArray<string>;
417 + readonly edgeIds: ReadonlyArray<string>;
418 + /** Members every one of whose links answers. */
419 + readonly reachable: number;
420 + readonly firstLabel: string;
421 + readonly lastLabel: string;
422 + readonly expanded: boolean;
423 + /** The members an open stack draws on the map; the rest are in the details only. */
424 + readonly shownIds: ReadonlyArray<string>;
425 +}
426 +
427 +/** Below this many machines a group of link targets is clearer drawn one by one. */
428 +const FLEET_STACK_MIN = 5;
429 +/** Environments fold only once the client knows more than this many. */
430 +export const FLEET_FOLD_ENVIRONMENTS_OVER = 12;
431 +/** A folded group of environments needs at least this many; fewer stay as cards. */
432 +const FLEET_FOLD_MIN = 3;
433 +/** An open stack draws this many machines at most, then one card for the rest. */
434 +export const FLEET_STACK_SHOWN_MAX = 24;
435 +
436 +export const fleetMoreNodeId = (stackId: string) => `more:${stackId}`;
437 +
438 +function foldGroup(node: FleetNode): FleetFoldGroup | null {
439 + if (node.kind === "connect") return "not-added";
440 + if (node.kind !== "environment") return null;
441 + if (node.phase === "unsupported") return "update";
442 + if (!node.enabled) return "off";
443 + // One still dialling stays a card: it is about to change, and the user is watching it.
444 + return node.phase === "offline" || node.phase === "error" || node.phase === "available"
445 + ? "offline"
446 + : null;
447 +}
448 +
449 +const FOLD_ORDER: ReadonlyArray<FleetFoldGroup> = ["offline", "off", "update", "not-added"];
450 +
451 +export function fleetStacks(graph: FleetGraph, expanded: ReadonlySet<string>): FleetStack[] {
452 + const byId = new Map(graph.nodes.map((node) => [node.id, node]));
453 + const order = new Map(graph.nodes.map((node, index) => [node.id, index]));
454 + const label = (id: string) => byId.get(id)?.label ?? "";
455 + const byLabel = (left: string, right: string) =>
456 + labelOrder.compare(label(left), label(right)) || (left < right ? -1 : 1);
457 + const links = graph.edges.filter(isLinkEdge);
458 + const incoming = new Map<string, FleetLinkEdge[]>();
459 + for (const link of links) {
460 + if (byId.get(link.to)?.kind !== "target") continue;
461 + const into = incoming.get(link.to);
462 + if (into === undefined) incoming.set(link.to, [link]);
463 + else into.push(link);
464 + }
465 + // Keyed by the exact set of (host, access) links in, so every member is drawn by the same lines.
466 + const groups = new Map<string, Array<{ id: string; links: FleetLinkEdge[] }>>();
467 + for (const [id, unsorted] of incoming) {
468 + const into = unsorted.toSorted((a, b) => order.get(a.from)! - order.get(b.from)!);
469 + const key = `stack:${into.map((link) => `${link.from}:${link.link.access}`).join("|")}`;
470 + const group = groups.get(key);
471 + if (group === undefined) groups.set(key, [{ id, links: into }]);
472 + else group.push({ id, links: into });
473 + }
474 + const make = (
475 + id: string,
476 + kind: FleetStack["kind"],
477 + memberIds: ReadonlyArray<string>,
478 + rest: Pick<FleetStack, "sources" | "group" | "edgeIds" | "reachable">,
479 + ): FleetStack => ({
480 + id,
481 + kind,
482 + ...rest,
483 + memberIds,
484 + firstLabel: label(memberIds[0]!),
485 + lastLabel: label(memberIds.at(-1)!),
486 + expanded: expanded.has(id),
487 + shownIds:
488 + memberIds.length > FLEET_STACK_SHOWN_MAX
489 + ? memberIds.slice(0, FLEET_STACK_SHOWN_MAX)
490 + : memberIds,
491 + });
492 + const stacks: FleetStack[] = [];
493 + for (const [id, unsorted] of groups) {
494 + if (unsorted.length < FLEET_STACK_MIN) continue;
495 + const members = unsorted.toSorted((left, right) => byLabel(left.id, right.id));
496 + stacks.push(
497 + make(
498 + id,
499 + "targets",
500 + members.map((member) => member.id),
501 + {
502 + sources: members[0]!.links.map((link) => ({
503 + sourceId: link.from,
504 + access: link.link.access,
505 + })),
506 + group: null,
507 + edgeIds: members.flatMap((member) => member.links.map((link) => link.id)),
508 + reachable: members.filter((member) =>
509 + member.links.every((link) => link.health.kind === "reachable"),
510 + ).length,
511 + },
512 + ),
513 + );
514 + }
515 + const hosts = graph.nodes.filter(
516 + (node) => node.kind === "environment" || node.kind === "connect",
517 + );
518 + if (hosts.length <= FLEET_FOLD_ENVIRONMENTS_OVER) return stacks;
519 + const linked = new Set(links.flatMap((link) => [link.from, link.to]));
520 + const routesOf = new Map<string, string[]>();
521 + for (const edge of graph.edges) {
522 + if (edge.kind !== "route") continue;
523 + const routes = routesOf.get(edge.to);
524 + if (routes === undefined) routesOf.set(edge.to, [edge.id]);
525 + else routes.push(edge.id);
526 + }
527 + for (const group of FOLD_ORDER) {
528 + const memberIds = hosts
529 + .filter((host) => !linked.has(host.id) && foldGroup(host) === group)
530 + .map((host) => host.id)
531 + .toSorted(byLabel);
532 + if (memberIds.length < FLEET_FOLD_MIN) continue;
533 + stacks.push(
534 + make(`fold:${group}`, "environments", memberIds, {
535 + sources: [],
536 + group,
537 + edgeIds: memberIds.flatMap((id) => routesOf.get(id) ?? []),
538 + reachable: 0,
539 + }),
540 + );
541 + }
542 + return stacks;
543 +}
544 +
545 +export type FleetFocus =
546 + | { readonly kind: "node"; readonly id: string }
547 + | { readonly kind: "edge"; readonly id: string }
548 + | { readonly kind: "stack"; readonly id: string };
549 +
550 +export interface FleetNeighborhood {
551 + readonly nodes: ReadonlySet<string>;
552 + readonly edges: ReadonlySet<string>;
553 +}
554 +
555 +/**
556 + * What a node reaches and what reaches it, one hop only, plus how this client gets there. A link
557 + * does not chain: A linked to B and B linked to C gives A's agents nothing on C, so following
558 + * links further would lie.
559 + */
560 +export function fleetNeighborhood(
561 + graph: FleetGraph,
562 + stacks: ReadonlyArray<FleetStack>,
563 + focus: FleetFocus,
564 +): FleetNeighborhood {
565 + const nodes = new Set<string>();
566 + const edges = new Set<string>();
567 + const sources = new Set<string>();
568 + const stack = focus.kind === "stack" ? stacks.find((entry) => entry.id === focus.id) : undefined;
569 + const stackEdges = new Set(stack?.edgeIds);
570 + // A two-way link is one line: either of its links brings the other with it.
571 + const pair = focus.kind === "edge" ? fleetTwoWayLinks(graph).get(focus.id) : undefined;
572 + for (const edge of graph.edges) {
573 + const touches =
574 + focus.kind === "stack"
575 + ? stackEdges.has(edge.id)
576 + : focus.kind === "edge"
577 + ? edge.id === focus.id || edge.id === pair?.forward.id || edge.id === pair?.back.id
578 + : edge.from === focus.id || edge.to === focus.id;
579 + if (!touches) continue;
580 + edges.add(edge.id);
581 + nodes.add(edge.from).add(edge.to);
582 + if (edge.kind === "link" && (focus.kind !== "node" || edge.to === focus.id)) {
583 + sources.add(edge.from);
584 + }
585 + }
586 + // The client reaches the focus through whichever environment holds the link to it.
587 + for (const edge of graph.edges) {
588 + if (edge.kind !== "route" || !sources.has(edge.to)) continue;
589 + edges.add(edge.id);
590 + nodes.add(edge.from);
591 + }
592 + if (focus.kind === "node" && graph.nodes.some((node) => node.id === focus.id)) {
593 + nodes.add(focus.id);
594 + }
595 + return { nodes, edges };
596 +}
597 +
598 +/** What linking `sourceId` to `targetId` would take, or why the map does not offer it. */
599 +export type FleetLinkOffer =
600 + | {
601 + readonly kind: "unavailable";
602 + readonly reason:
603 + | "not-an-environment"
604 + | "same-machine"
605 + | "source-disconnected"
606 + | "source-off"
607 + | "source-forbidden";
608 + }
609 + | {
610 + readonly kind: "link";
611 + readonly sourceEnvironmentId: EnvironmentId;
612 + /**
613 + * `code-less`: the client mints the pairing code on the target with its own session there.
614 + * `pairing-code`: the user brings one from the target.
615 + */
616 + readonly path: "code-less" | "pairing-code";
617 + /** The pair is already linked, so linking again renews it. */
618 + readonly renews: boolean;
619 + readonly target:
620 + | { readonly kind: "machine"; readonly environmentId: EnvironmentId }
621 + /** A machine the client has no entry for: only an address another host uses. */
622 + | { readonly kind: "address"; readonly address: string | null };
623 + };
624 +
625 +export function fleetLinkOffer(
626 + graph: FleetGraph,
627 + sourceId: string,
628 + targetId: string,
629 +): FleetLinkOffer {
630 + const source = graph.nodes.find((node) => node.id === sourceId);
631 + const target = graph.nodes.find((node) => node.id === targetId);
632 + if (source?.kind !== "environment" || target === undefined || target.kind === "client") {
633 + return { kind: "unavailable", reason: "not-an-environment" };
634 + }
635 + if (source.id === target.id) return { kind: "unavailable", reason: "same-machine" };
636 + if (source.linking !== "ready") {
637 + return { kind: "unavailable", reason: `source-${source.linking}` as const };
638 + }
639 + const renews = graph.edges.some(
640 + (edge) =>
641 + edge.kind === "link" &&
642 + edge.from === source.id &&
643 + edge.to === target.id &&
644 + edge.health.kind !== "expired",
645 + );
646 + const base = { kind: "link", sourceEnvironmentId: source.environmentId, renews } as const;
647 + if (target.kind === "target") {
648 + return {
649 + ...base,
650 + path: "pairing-code",
651 + target: { kind: "address", address: target.address },
652 + };
653 + }
654 + return {
655 + ...base,
656 + path: target.kind === "environment" && target.mintable ? "code-less" : "pairing-code",
657 + target: { kind: "machine", environmentId: target.environmentId },
658 + };
659 +}
660 +
661 +/** Some of a stack's linked machines do not answer: its card grows a line to say how many do. */
662 +export const fleetStackPartial = (stack: FleetStack) =>
663 + stack.kind === "targets" && stack.reachable < stack.memberIds.length;
664 +
665 +/** Changes exactly when the layout would: membership, labels, routes, wiring and open stacks. */
666 +export function fleetShapeKey(graph: FleetGraph, stacks: ReadonlyArray<FleetStack>): string {
667 + return [
668 + ...graph.nodes.map((node) => `${node.kind}\u0000${node.id}\u0000${node.label}`),
669 + ...graph.edges.map((edge) =>
670 + edge.kind === "link" ? `${edge.id}\u0000${edge.link.access}` : edge.id,
671 + ),
672 + // Which environments fold follows their state, which nothing above carries.
673 + ...stacks.map(
674 + (stack) =>
675 + `${stack.id}\u0000${stack.expanded}\u0000${fleetStackPartial(stack)}\u0000${stack.kind === "environments" ? stack.memberIds.join() : ""}`,
676 + ),
677 + ].join("\n");
678 +}
679 +
680 +export interface FleetRect {
681 + readonly x: number;
682 + readonly y: number;
683 + readonly width: number;
684 + readonly height: number;
685 +}
686 +
687 +export interface FleetPoint {
688 + readonly x: number;
689 + readonly y: number;
690 +}
691 +
692 +export interface FleetRouteGeometry {
693 + readonly d: string;
694 + /** Where the route's kind is named, on the wire just before the environment. */
695 + readonly pill: FleetRect;
696 +}
697 +
698 +/**
699 + * Room for a link's access in words. `side` is the way it grows from the lane it sits on.
700 + * `onDemand` names one with no clear place: shown only while its link is in focus.
701 + */
702 +export type FleetLinkBadge = FleetRect & { readonly side: 1 | -1; readonly onDemand: boolean };
703 +
704 +export interface FleetArrow {
705 + readonly x: number;
706 + readonly y: number;
707 + readonly dir: 1 | -1;
708 +}
709 +
710 +export interface FleetLinkGeometry {
711 + readonly d: string;
712 + /** Arrowhead tip and the horizontal direction it points. */
713 + readonly arrow: FleetArrow;
714 + /**
715 + * Set for a two-way link, which is one line with an arrowhead at each end. `arrow` and
716 + * `forward` are the half leading into the machine the drawn link reaches; `backArrow` and
717 + * `back` the half leading into the one it leaves, which is the other link's.
718 + */
719 + readonly twoWay: {
720 + readonly backArrow: FleetArrow;
721 + readonly forward: string;
722 + readonly back: string;
723 + } | null;
724 + /** Where a link between two environments names its access; a target's card shows its own. */
725 + readonly badge: FleetLinkBadge | null;
726 +}
727 +
728 +/** A line a stack draws for all its machines: one environment's links, or the client's routes. */
729 +export interface FleetStackLine {
730 + readonly sourceId: string | null;
731 + readonly access: AuthMcpClientAccess | null;
732 + readonly d: string;
733 + readonly arrow: FleetPoint | null;
734 +}
735 +
736 +export interface FleetStackGeometry {
737 + /** The whole footprint: the sheets of a closed stack, or an open one's card and its tray. */
738 + readonly rect: FleetRect;
739 + /** The stack's card. Opening the stack leaves it where it is, and the tray grows out below. */
740 + readonly face: FleetRect;
741 + readonly lines: ReadonlyArray<FleetStackLine>;
742 + /** The panel an open stack draws its machines in, below its card. */
743 + readonly tray: FleetRect | null;
744 + /** In an open stack, the card standing for the machines it does not draw. */
745 + readonly more: FleetRect | null;
746 +}
747 +
748 +export type FleetColumn = "client" | "environments" | "targets";
749 +
750 +export interface FleetLayout {
751 + /** Every machine drawn on its own. Members of a closed stack are not here. */
752 + readonly nodes: ReadonlyMap<string, FleetRect>;
753 + readonly stacks: ReadonlyMap<string, FleetStackGeometry>;
754 + readonly routes: ReadonlyMap<string, FleetRouteGeometry>;
755 + /** Links drawn one by one. A stack's links are drawn by the stack. */
756 + readonly links: ReadonlyMap<string, FleetLinkGeometry>;
757 + /** Where an environment's links leave it and its link handle sits, on its right edge. */
758 + readonly handles: ReadonlyMap<string, FleetPoint>;
759 + readonly columns: ReadonlyArray<{ readonly id: FleetColumn; readonly x: number }>;
760 + readonly width: number;
761 + readonly height: number;
762 +}
763 +
764 +const HEADER = 28;
765 +const CLIENT = { height: 44 };
766 +const PILL = { height: 18 };
767 +/** How far apart route names sit in their column beside a card. */
768 +export const FLEET_ROUTE_PITCH = 22;
769 +/** How far that column may reach into the gap above and below its card's place. */
770 +const PILL_OVERHANG = 9;
771 +/** `nameLine` is the most characters of a name the narrowest card sets on one line. */
772 +const CARD = { height: 56, twoLines: 68, nameLine: 13 };
773 +/** Routes enter a card as one bundle: this far apart, and never wider than `spread`. */
774 +const ROUTE_ENTRY = { pitch: 4, spread: 10 };
775 +const OFFER = { height: 44 };
776 +const TARGET = { height: 44 };
777 +/** `partial` is the room a closed stack adds to say how many of its machines answer. */
778 +const STACK = { height: 50, partial: 20, lift: 8 };
779 +
780 +/**
781 + * Every horizontal measure the map can give up or take. Heights never change with the width, so
782 + * what is drawn where, lane by lane, is the same at every width and only the columns move.
783 + */
784 +interface FleetMetrics {
785 + /** The card for this app, where every route starts. */
786 + readonly app: number;
787 + /** The run from it to the route names. */
788 + readonly wire: number;
789 + readonly pill: number;
790 + /** The run in which a machine's routes close up from their names to its card. */
791 + readonly pillGap: number;
792 + readonly card: number;
793 + readonly target: number;
794 + /** The run from the environments, past their lanes, to the machines they link to. */
795 + readonly linkRun: number;
796 + readonly laneFirst: number;
797 + readonly betweenFirst: number;
798 + readonly betweenLast: number;
799 +}
800 +
801 +const REGULAR: FleetMetrics = {
802 + app: 136,
803 + wire: 72,
804 + pill: 82,
805 + pillGap: 20,
806 + card: 164,
807 + target: 188,
808 + linkRun: 92,
809 + laneFirst: 24,
810 + betweenFirst: 16,
811 + betweenLast: 6,
812 +};
813 +/** The least each measure can be with its text still whole: a narrow settings column. */
814 +const COMPACT: FleetMetrics = {
815 + app: 124,
816 + wire: 28,
817 + pill: 72,
818 + pillGap: 14,
819 + card: 148,
820 + target: 146,
821 + linkRun: 36,
822 + laneFirst: 18,
823 + betweenFirst: 14,
824 + betweenLast: 4,
825 +};
826 +/** Past this the map is enlarged instead: longer wires would only pull the columns apart. */
827 +const ROOMY: FleetMetrics = {
828 + app: 148,
829 + wire: 112,
830 + pill: 88,
831 + pillGap: 26,
832 + card: 180,
833 + target: 220,
834 + linkRun: 132,
835 + laneFirst: 24,
836 + betweenFirst: 16,
837 + betweenLast: 6,
838 +};
839 +
840 +const mixMetrics = (from: FleetMetrics, to: FleetMetrics, t: number): FleetMetrics => {
841 + const at = (key: keyof FleetMetrics) => Math.floor(from[key] + (to[key] - from[key]) * t);
842 + return {
843 + app: at("app"),
844 + wire: at("wire"),
845 + pill: at("pill"),
846 + pillGap: at("pillGap"),
847 + card: at("card"),
848 + target: at("target"),
849 + linkRun: at("linkRun"),
850 + laneFirst: at("laneFirst"),
851 + betweenFirst: at("betweenFirst"),
852 + betweenLast: at("betweenLast"),
853 + };
854 +};
855 +const CHIP = { width: 124, height: 26 };
856 +const CHIP_GAP = 6;
857 +const FRAME_PAD = 8;
858 +/** Between a stack's card and the tray it opens. */
859 +const TRAY_GAP = 4;
860 +/** Narrower than this a machine's name no longer reads, so a tray gives up a column instead. */
861 +const CHIP_MIN_WIDTH = 60;
862 +const GROUP_GAP = 28;
863 +const BAY_GAP = 12;
864 +const LANE_STEP = 14;
865 +const LANE_CLEARANCE = 10;
866 +const ARROW_LENGTH = 6;
867 +/** The least run a link keeps from the last lane to a machine: its turn and its arrowhead. */
868 +const LINK_RUN_MIN = 20;
869 +/** How far apart two hosts' links enter one machine, so each keeps its own last stretch. */
870 +const ENTRY_PITCH = 14;
871 +/** The channel left of the cards that links between environments keep to themselves. */
872 +const BETWEEN = { step: 14 };
873 +/**
874 + * Where those links meet a card's left edge: past its routes, the outermost lane innermost,
875 + * `margin` short of the corner. The card never grows for them: the pitch gives way instead.
876 + */
877 +const LINK_PORT = { first: 10, pitch: FLEET_LANE_PITCH, margin: 4 };
878 +const CORNER = 8;
879 +const BADGE = { width: 120, height: 20, overhang: 5, gap: 4 };
880 +
881 +/** Horizontal, a vertical run at `viaX`, then horizontal again, with rounded turns. */
882 +function elbowPath(x0: number, y0: number, viaX: number, x1: number, y1: number): string {
883 + const dy = y1 - y0;
884 + if (Math.abs(dy) < 1) return `M${x0} ${y0}H${x1}`;
885 + const r = Math.min(CORNER, Math.abs(dy) / 2, Math.abs(viaX - x0), Math.abs(x1 - viaX));
886 + const sy = Math.sign(dy);
887 + const inX = Math.sign(viaX - x0);
888 + const outX = Math.sign(x1 - viaX);
889 + return [
890 + `M${x0} ${y0}`,
891 + `H${viaX - inX * r}`,
892 + `Q${viaX} ${y0} ${viaX} ${y0 + sy * r}`,
893 + `V${y1 - sy * r}`,
894 + `Q${viaX} ${y1} ${viaX + outX * r} ${y1}`,
895 + `H${x1}`,
896 + ].join("");
897 +}
898 +
899 +/** `elbowPath` cut halfway along its vertical run: the half it starts with, then the other. */
900 +function elbowHalves(x0: number, y0: number, viaX: number, x1: number, y1: number) {
901 + const dy = y1 - y0;
902 + const mid = (y0 + y1) / 2;
903 + const r = Math.min(CORNER, Math.abs(dy) / 2, Math.abs(viaX - x0), Math.abs(x1 - viaX));
904 + const sy = Math.sign(dy);
905 + const inX = Math.sign(viaX - x0);
906 + const outX = Math.sign(x1 - viaX);
907 + return [
908 + `M${x0} ${y0}H${viaX - inX * r}Q${viaX} ${y0} ${viaX} ${y0 + sy * r}V${mid}`,
909 + `M${viaX} ${mid}V${y1 - sy * r}Q${viaX} ${y1} ${viaX + outX * r} ${y1}H${x1}`,
910 + ] as const;
911 +}
912 +
913 +/** Straight to `fanX`, across any lanes so they only ever meet it square, then a curve. */
914 +const sCurve = (x0: number, y0: number, x1: number, y1: number, fanX = x0) => {
915 + // A short run bends within itself, so it still arrives level instead of doubling back.
916 + const reach = Math.max(Math.min(24, (x1 - fanX) * 0.6), (x1 - fanX) / 2);
917 + const lead = fanX > x0 ? `H${fanX}` : "";
918 + return `M${x0} ${y0}${lead}C${fanX + reach} ${y0} ${x1 - reach} ${y1} ${x1} ${y1}`;
919 +};
920 +
921 +const frameColumns = (count: number) => Math.max(2, Math.min(4, Math.ceil(Math.sqrt(count / 2.2))));
922 +
923 +/** What an open stack draws: its shown machines, and one more card when some are left out. */
924 +const frameCells = (stack: FleetStack) =>
925 + stack.shownIds.length + Number(stack.memberIds.length > stack.shownIds.length);
926 +
927 +const trayWidth = (columns: number) => FRAME_PAD * 2 + columns * (CHIP.width + CHIP_GAP) - CHIP_GAP;
928 +
929 +/** What an open stack adds below its card. */
930 +const trayHeight = (stack: FleetStack, columns: number) =>
931 + TRAY_GAP +
932 + FRAME_PAD * 2 +
933 + Math.ceil(frameCells(stack) / columns) * (CHIP.height + CHIP_GAP) -
934 + CHIP_GAP;
935 +
936 +/**
937 + * What an open stack of link targets has to stay within, both read off the map with every stack
938 + * closed: the width its tray can take without the view shrinking to show it, and where its
939 + * column stood, so opening one neither rescales the map nor moves a column.
940 + */
941 +interface FleetTrayRoom {
942 + readonly width: number;
943 + readonly bayX: number | null;
944 +}
945 +
946 +const closedStacks = (stacks: ReadonlyArray<FleetStack>) =>
947 + stacks.some((stack) => stack.expanded)
948 + ? stacks.map((stack) => (stack.expanded ? { ...stack, expanded: false } : stack))
949 + : stacks;
950 +
951 +/** One line into a machine or a stack, from the environment holding the link. */
952 +interface BayEntry {
953 + readonly key: string;
954 + readonly from: string;
955 +}
956 +
957 +type BayItem =
958 + | {
959 + readonly kind: "target";
960 + readonly targetId: string;
961 + readonly label: string;
962 + readonly access: AuthMcpClientAccess;
963 + readonly entries: ReadonlyArray<BayEntry>;
964 + }
965 + | {
966 + readonly kind: "stack";
967 + readonly stack: FleetStack;
968 + readonly label: string;
969 + readonly access: AuthMcpClientAccess;
970 + readonly entries: ReadonlyArray<BayEntry>;
971 + };
972 +
973 +type ColumnEntry =
974 + | { readonly kind: "host"; readonly id: string; readonly host: FleetNode }
975 + | { readonly kind: "fold"; readonly id: string; readonly stack: FleetStack };
976 +
977 +interface FleetRow {
978 + readonly entries: ColumnEntry[];
979 + readonly items: ReadonlyArray<BayItem>;
980 +}
981 +
982 +/** One host's vertical run to a row of shared machines, kept to itself for its whole span. */
983 +interface FleetLane {
984 + readonly id: string;
985 + readonly from: number;
986 + readonly to: number;
987 + /** Where its links turn off towards their machines. */
988 + readonly branches: ReadonlyArray<number>;
989 + index: number;
990 +}
991 +
992 +const stackLineKey = (stackId: string, sourceId: string) => `${stackId}<${sourceId}`;
993 +
994 +const pushTo = <K, V>(into: Map<K, V[]>, key: K, value: V) => {
995 + const list = into.get(key);
996 + if (list === undefined) into.set(key, [value]);
997 + else list.push(value);
998 +};
999 +
1000 +/**
1001 + * The map at the width it is given. It gives up gutters, wire runs and card width before the fit
1002 + * has to shrink it, and takes more of each on a wide canvas, up to a point. With no width it is
1003 + * laid out at its regular measures.
1004 + */
1005 +export function layoutFleetGraph(
1006 + graph: FleetGraph,
1007 + stacks: ReadonlyArray<FleetStack> = [],
1008 + canvasWidth?: number,
1009 +): FleetLayout {
1010 + // The measures follow the map with every stack closed, so opening one moves no column.
1011 + const closed = closedStacks(stacks);
1012 + const { metrics, layout } = fitFleetMetrics(graph, closed, canvasWidth);
1013 + if (closed === stacks) return layout;
1014 + if (canvasWidth === undefined) {
1015 + const bayX = layout.columns.find((column) => column.id === "targets")?.x ?? null;
1016 + return layoutFleetGraphAt(graph, stacks, metrics, { width: Infinity, bayX });
1017 + }
1018 + const bayX = layout.columns.find((column) => column.id === "targets")?.x ?? null;
1019 + // How much of the map the closed fit shows across: the room a tray has at that same scale.
1020 + const room = canvasWidth - fleetFitPadding(canvasWidth) * 2;
1021 + const shown = room / Math.min(FLEET_FIT_MAX_SCALE, room / layout.width);
1022 + return layoutFleetGraphAt(graph, stacks, metrics, { width: shown - (bayX ?? 0), bayX });
1023 +}
1024 +
1025 +function fitFleetMetrics(
1026 + graph: FleetGraph,
1027 + stacks: ReadonlyArray<FleetStack>,
1028 + canvasWidth: number | undefined,
1029 +): { readonly metrics: FleetMetrics; readonly layout: FleetLayout } {
1030 + const regular = layoutFleetGraphAt(graph, stacks, REGULAR);
1031 + if (canvasWidth === undefined) return { metrics: REGULAR, layout: regular };
1032 + const room = canvasWidth - fleetFitPadding(canvasWidth) * 2;
1033 + const narrow = room < regular.width;
1034 + // Narrower than regular, the map fits at full size. Wider, it is enlarged first.
1035 + const wanted = narrow ? room : room / FLEET_FIT_MAX_SCALE;
1036 + if (!narrow && wanted <= regular.width) return { metrics: REGULAR, layout: regular };
1037 + const limit = narrow ? COMPACT : ROOMY;
1038 + const end = layoutFleetGraphAt(graph, stacks, limit);
1039 + if (narrow ? end.width >= wanted : end.width <= wanted) return { metrics: limit, layout: end };
1040 + // Width is a maximum of sums of the measures, so it never exceeds this straight-line estimate.
1041 + const t = (wanted - regular.width) / (end.width - regular.width);
1042 + const metrics = mixMetrics(REGULAR, limit, t);
1043 + return { metrics, layout: layoutFleetGraphAt(graph, stacks, metrics) };
1044 +}
1045 +
1046 +/**
1047 + * Links to machines seen only through a link run right of the environments, links between two
1048 + * environments left of them, each on its own lane with its own entry. A stack takes one place
1049 + * whatever it holds, so the cost follows what is drawn. Deterministic.
1050 + */
1051 +function layoutFleetGraphAt(
1052 + graph: FleetGraph,
1053 + stacks: ReadonlyArray<FleetStack>,
1054 + metrics: FleetMetrics,
1055 + room: FleetTrayRoom = { width: Infinity, bayX: null },
1056 +): FleetLayout {
1057 + const CLIENT_SIZE = { width: metrics.app, height: CLIENT.height };
1058 + const PILL_SIZE = { width: metrics.pill, height: PILL.height };
1059 + const nodes = new Map<string, FleetRect>();
1060 + const stackGeometry = new Map<string, FleetStackGeometry>();
1061 + const routes = new Map<string, FleetRouteGeometry>();
1062 + const linkGeometry = new Map<string, FleetLinkGeometry>();
1063 + const handles = new Map<string, FleetPoint>();
1064 + const links = graph.edges.filter(isLinkEdge);
1065 + const byId = new Map(graph.nodes.map((node) => [node.id, node]));
1066 + const folds = stacks.filter((stack) => stack.kind === "environments");
1067 + const folded = new Set(folds.flatMap((stack) => stack.memberIds));
1068 + const hosts = graph.nodes.filter(
1069 + (node) => (node.kind === "environment" || node.kind === "connect") && !folded.has(node.id),
1070 + );
1071 + const hostIndex = new Map(hosts.map((host, index) => [host.id, index]));
1072 + const indexOf = (hostId: string) => hostIndex.get(hostId) ?? 0;
1073 + const routesOf = new Map<string, FleetRouteEdge[]>();
1074 + for (const edge of graph.edges) if (edge.kind === "route") pushTo(routesOf, edge.to, edge);
1075 + const accessRank = (access: AuthMcpClientAccess) => -ACCESS_ORDER.indexOf(access);
1076 + const labelOf = (id: string) => byId.get(id)?.label ?? "";
1077 +
1078 + const stacked = new Set(stacks.flatMap((stack) => stack.edgeIds));
1079 + const incomingOf = new Map<string, FleetLinkEdge[]>();
1080 + for (const link of links) {
1081 + if (byId.get(link.to)?.kind !== "target" || stacked.has(link.id)) continue;
1082 + pushTo(incomingOf, link.to, link);
1083 + }
1084 + const items: BayItem[] = [];
1085 + for (const stack of stacks) {
1086 + if (stack.kind !== "targets") continue;
1087 + items.push({
1088 + kind: "stack",
1089 + stack,
1090 + label: stack.firstLabel,
1091 + access: stack.sources[0]!.access,
1092 + entries: stack.sources.map((source) => ({
1093 + key: stackLineKey(stack.id, source.sourceId),
1094 + from: source.sourceId,
1095 + })),
1096 + });
1097 + }
1098 + for (const [targetId, unsorted] of incomingOf) {
1099 + // Top to bottom in the order of the hosts, so the upper line is the upper host's.
1100 + const incoming = unsorted.toSorted((left, right) => indexOf(left.from) - indexOf(right.from));
1101 + items.push({
1102 + kind: "target",
1103 + targetId,
1104 + label: labelOf(targetId),
1105 + access: incoming[0]!.link.access,
1106 + entries: incoming.map((link) => ({ key: link.id, from: link.from })),
1107 + });
1108 + }
1109 + const itemId = (item: BayItem) => (item.kind === "stack" ? item.stack.id : item.targetId);
1110 + const byName = (left: BayItem, right: BayItem) =>
1111 + labelOrder.compare(left.label, right.label) || (itemId(left) < itemId(right) ? -1 : 1);
1112 + const bayOf = new Map<string, BayItem[]>();
1113 + const bandOf = new Map<string, BayItem[]>();
1114 + for (const item of items
1115 + .filter((entry) => entry.entries.length === 1)
1116 + .toSorted(
1117 + (left, right) =>
1118 + Number(right.kind === "stack") - Number(left.kind === "stack") ||
1119 + accessRank(left.access) - accessRank(right.access) ||
1120 + byName(left, right),
1121 + )) {
1122 + pushTo(bayOf, item.entries[0]!.from, item);
1123 + }
1124 + // Below the middle host of those linking to it: the shortest total reach, with ties going up.
1125 + const meanSource = (item: BayItem) =>
1126 + item.entries.reduce((sum, entry) => sum + indexOf(entry.from), 0) / item.entries.length;
1127 + for (const item of items
1128 + .filter((entry) => entry.entries.length > 1)
1129 + .toSorted((left, right) => meanSource(left) - meanSource(right) || byName(left, right))) {
1130 + pushTo(bandOf, item.entries[Math.floor((item.entries.length - 1) / 2)]!.from, item);
1131 + }
1132 +
1133 + // A machine with no links rides beside a shared row instead of pushing the hosts further apart.
1134 + const linked = new Set(links.flatMap((link) => [link.from, link.to]));
1135 + const rows: FleetRow[] = [];
1136 + let shared: FleetRow | null = null;
1137 + for (const host of hosts) {
1138 + const entry: ColumnEntry = { kind: "host", id: host.id, host };
1139 + if (shared !== null && !linked.has(host.id)) {
1140 + shared.entries.push(entry);
1141 + continue;
1142 + }
1143 + rows.push({ entries: [entry], items: bayOf.get(host.id) ?? [] });
1144 + const band = bandOf.get(host.id);
1145 + shared = band === undefined ? null : { entries: [], items: band };
1146 + if (shared !== null) rows.push(shared);
1147 + }
1148 + for (const stack of folds) {
1149 + const entry: ColumnEntry = { kind: "fold", id: stack.id, stack };
1150 + if (shared !== null) shared.entries.push(entry);
1151 + else rows.push({ entries: [entry], items: [] });
1152 + }
1153 +
1154 + // Links between environments: shorter ones take the lanes nearer the cards, and two share a
1155 + // lane when no host lies between both pairs, so a chain of links reads as one line.
1156 + const reach = (link: FleetLinkEdge) => Math.abs(indexOf(link.to) - indexOf(link.from));
1157 + const low = (link: FleetLinkEdge) => Math.min(indexOf(link.from), indexOf(link.to));
1158 + const high = (link: FleetLinkEdge) => Math.max(indexOf(link.from), indexOf(link.to));
1159 + // A two-way link is drawn once, as the link from the machine listed first.
1160 + const pairs = fleetTwoWayLinks(graph);
1161 + const twoWay = (link: FleetLinkEdge) => pairs.has(link.id);
1162 + const between = links
1163 + .filter(
1164 + (link) =>
1165 + hostIndex.has(link.from) &&
1166 + hostIndex.has(link.to) &&
1167 + fleetDrawnLinkId(pairs, link.id) === link.id,
1168 + )
1169 + .toSorted((left, right) => reach(left) - reach(right) || (left.id < right.id ? -1 : 1));
1170 + const betweenLanes: FleetLinkEdge[][] = [];
1171 + const betweenLane = new Map<string, number>();
1172 + for (const link of between) {
1173 + let index = 0;
1174 + while (
1175 + betweenLanes[index]?.some(
1176 + (other) => Math.max(low(other), low(link)) < Math.min(high(other), high(link)),
1177 + )
1178 + ) {
1179 + index += 1;
1180 + }
1181 + betweenLane.set(link.id, index);
1182 + (betweenLanes[index] ??= []).push(link);
1183 + }
1184 + // Such a link meets a card's left edge above its routes when the other machine is above,
1185 + // below them when it is below. Each arrowhead has its own port, the outer lane's nearer the
1186 + // middle so two never cross. Links out on a side share one port; a two-way link arrives at
1187 + // both its cards.
1188 + const leaves = new Set<string>();
1189 + const arrivalsOf = new Map<string, FleetLinkEdge[]>();
1190 + for (const link of between) {
1191 + const down = Math.sign(indexOf(link.to) - indexOf(link.from));
1192 + if (twoWay(link)) pushTo(arrivalsOf, `${link.from}:${down}`, link);
1193 + else leaves.add(`${link.from}:${down}`);
1194 + pushTo(arrivalsOf, `${link.to}:${-down}`, link);
1195 + }
1196 + for (const ports of arrivalsOf.values()) {
1197 + ports.sort((left, right) => betweenLane.get(right.id)! - betweenLane.get(left.id)!);
1198 + }
1199 + const routesInto = (hostId: string) => routesOf.get(hostId)?.length ?? 0;
1200 + // A card's size follows its name alone, so what attaches to it never stretches it. The name
1201 + // is measured in characters against the narrowest card, so no height changes with the width.
1202 + const cardHeight = (host: FleetNode) =>
1203 + host.kind === "connect"
1204 + ? OFFER.height
1205 + : host.label.length > CARD.nameLine
1206 + ? CARD.twoLines
1207 + : CARD.height;
1208 + const routeEntryPitch = (hostId: string) =>
1209 + routesInto(hostId) < 2
1210 + ? 0
1211 + : Math.min(ROUTE_ENTRY.pitch, ROUTE_ENTRY.spread / (routesInto(hostId) - 1));
1212 + const routesExtent = (hostId: string) =>
1213 + (Math.max(1, routesInto(hostId)) - 1) * routeEntryPitch(hostId) * 0.5;
1214 + const linkPortPitch = (host: FleetNode, side: number) => {
1215 + const key = `${host.id}:${side}`;
1216 + const ports = Number(leaves.has(key)) + (arrivalsOf.get(key)?.length ?? 0);
1217 + const room = cardHeight(host) / 2 - LINK_PORT.margin - routesExtent(host.id) - LINK_PORT.first;
1218 + return ports < 2 ? 0 : Math.min(LINK_PORT.pitch, room / (ports - 1));
1219 + };
1220 + const pillsHeight = (hostId: string) =>
1221 + (Math.max(1, routesInto(hostId)) - 1) * FLEET_ROUTE_PITCH + PILL.height;
1222 + const foldFace = { width: metrics.card - STACK.lift, height: STACK.height };
1223 + const closedWidth = metrics.target + STACK.lift;
1224 + /**
1225 + * A group of environments opens one machine wide, under its card. Link targets take the
1226 + * columns there is room for, and with no room to spare two narrow ones under the closed stack.
1227 + */
1228 + const trayShape = (stack: FleetStack) => {
1229 + if (stack.kind === "environments") return { columns: 1, width: metrics.card };
1230 + const wanted = frameColumns(frameCells(stack));
1231 + const fitting = Math.floor((room.width - FRAME_PAD * 2 + CHIP_GAP) / (CHIP.width + CHIP_GAP));
1232 + if (fitting >= 2) {
1233 + const columns = Math.min(wanted, fitting);
1234 + return { columns, width: Math.max(closedWidth, trayWidth(columns)) };
1235 + }
1236 + const width = Math.max(closedWidth, Math.min(room.width, trayWidth(2)));
1237 + return {
1238 + columns: (width - FRAME_PAD * 2 - CHIP_GAP) / 2 < CHIP_MIN_WIDTH ? 1 : 2,
1239 + width,
1240 + };
1241 + };
1242 + /** `open` false is the place an entry takes with its stack closed, which is where it starts. */
1243 + const entryHeight = (entry: ColumnEntry, open: boolean) =>
1244 + entry.kind === "host"
1245 + ? // The place a card takes in the column: its own height, or what its route names need.
1246 + Math.max(cardHeight(entry.host), pillsHeight(entry.id) - PILL_OVERHANG * 2)
1247 + : STACK.height +
1248 + STACK.lift +
1249 + (open && entry.stack.expanded
1250 + ? trayHeight(entry.stack, trayShape(entry.stack).columns)
1251 + : 0);
1252 + /** Tall enough that each line in keeps its own entry. */
1253 + const faceHeight = (item: BayItem, least: number) =>
1254 + Math.max(least, 20 + (item.entries.length - 1) * ENTRY_PITCH);
1255 + const itemSize = (item: BayItem, open: boolean) => {
1256 + if (item.kind === "target") {
1257 + return { width: metrics.target, height: faceHeight(item, TARGET.height) };
1258 + }
1259 + const closed = {
1260 + width: closedWidth,
1261 + height:
1262 + faceHeight(item, STACK.height + (fleetStackPartial(item.stack) ? STACK.partial : 0)) +
1263 + STACK.lift,
1264 + };
1265 + if (!open || !item.stack.expanded) return closed;
1266 + const shape = trayShape(item.stack);
1267 + return {
1268 + width: shape.width,
1269 + height: closed.height + trayHeight(item.stack, shape.columns),
1270 + };
1271 + };
1272 + /** Places an open stack's machines in the tray below its card, and returns the card for the rest. */
1273 + const fillTray = (stack: FleetStack, face: FleetRect): FleetRect | null => {
1274 + const { columns, width } = trayShape(stack);
1275 + const chipWidth = (width - FRAME_PAD * 2 - (columns - 1) * CHIP_GAP) / columns;
1276 + const cell = (index: number): FleetRect => ({
1277 + x: face.x + FRAME_PAD + (index % columns) * (chipWidth + CHIP_GAP),
1278 + y:
1279 + face.y +
1280 + face.height +
1281 + TRAY_GAP +
1282 + FRAME_PAD +
1283 + Math.floor(index / columns) * (CHIP.height + CHIP_GAP),
1284 + width: chipWidth,
1285 + height: CHIP.height,
1286 + });
1287 + stack.shownIds.forEach((memberId, index) => nodes.set(memberId, cell(index)));
1288 + return stack.memberIds.length > stack.shownIds.length ? cell(stack.shownIds.length) : null;
1289 + };
1290 + /** An open stack's footprint, its card and tray, and the tray alone. */
1291 + const openRects = (stack: FleetStack, face: FleetRect) => {
1292 + const { columns, width } = trayShape(stack);
1293 + const height = trayHeight(stack, columns);
1294 + return {
1295 + rect: { x: face.x, y: face.y, width, height: face.height + height },
1296 + tray: {
1297 + x: face.x,
1298 + y: face.y + face.height + TRAY_GAP,
1299 + width,
1300 + height: height - TRAY_GAP,
1301 + },
1302 + };
1303 + };
1304 +
1305 + const pillX = metrics.app + metrics.wire;
1306 + const cardX =
1307 + pillX +
1308 + metrics.pill +
1309 + metrics.pillGap +
1310 + (betweenLanes.length === 0
1311 + ? 0
1312 + : metrics.betweenLast + (betweenLanes.length - 1) * BETWEEN.step + metrics.betweenFirst);
1313 + const cardRight = cardX + metrics.card;
1314 +
1315 + // Heights first: which lanes the channel needs, and so how wide it is, follows from them.
1316 + // Rows are spaced as if every stack were closed, so an open one grows down from where its
1317 + // card was and moves only what its tray would otherwise cover.
1318 + const placed: Array<{
1319 + readonly item: BayItem;
1320 + readonly y: number;
1321 + readonly size: { readonly width: number; readonly height: number };
1322 + /** The item's height with its stack closed: where its card ends. */
1323 + readonly closedHeight: number;
1324 + }> = [];
1325 + const column: Array<{ readonly entry: ColumnEntry; readonly center: number }> = [];
1326 + /** Where each entry's middle is with every stack closed: this app's card is set by these. */
1327 + const restCenters: number[] = [];
1328 + /** Where a card's routes arrive and its links leave: its middle. */
1329 + const anchors = new Map<string, number>();
1330 + let y = HEADER;
1331 + let cardFloor = -Infinity;
1332 + let bayFloor = -Infinity;
1333 + for (const row of rows) {
1334 + const heights = row.entries.map((entry) => entryHeight(entry, false));
1335 + const cardsHeight = heights.reduce((sum, height) => sum + height + GROUP_GAP, -GROUP_GAP);
1336 + const sizes = row.items.map((item) => itemSize(item, false));
1337 + const bayHeight = sizes.reduce((sum, size) => sum + size.height + BAY_GAP, -BAY_GAP);
1338 + const rowHeight = Math.max(cardsHeight, bayHeight);
1339 + let restY = y + (rowHeight - cardsHeight) / 2;
1340 + row.entries.forEach((entry, index) => {
1341 + const rest = heights[index]!;
1342 + const cardY = Math.max(restY, cardFloor);
1343 + if (entry.kind === "host") {
1344 + const anchor = cardY + rest / 2;
1345 + const own = cardHeight(entry.host);
1346 + nodes.set(entry.id, { x: cardX, y: anchor - own / 2, width: metrics.card, height: own });
1347 + anchors.set(entry.id, anchor);
1348 + if (entry.host.kind === "environment") handles.set(entry.id, { x: cardRight, y: anchor });
1349 + column.push({ entry, center: anchor });
1350 + restCenters.push(restY + rest / 2);
1351 + } else {
1352 + const face = { x: cardX, y: cardY + STACK.lift, ...foldFace };
1353 + stackGeometry.set(entry.id, {
1354 + ...(entry.stack.expanded
1355 + ? openRects(entry.stack, face)
1356 + : { rect: { x: cardX, y: cardY, width: metrics.card, height: rest }, tray: null }),
1357 + face,
1358 + lines: [],
1359 + more: entry.stack.expanded ? fillTray(entry.stack, face) : null,
1360 + });
1361 + column.push({ entry, center: face.y + face.height / 2 });
1362 + restCenters.push(restY + STACK.lift + face.height / 2);
1363 + }
1364 + cardFloor = cardY + entryHeight(entry, true) + GROUP_GAP;
1365 + restY += rest + GROUP_GAP;
1366 + });
1367 + let restItemY = y + (rowHeight - bayHeight) / 2;
1368 + row.items.forEach((item, index) => {
1369 + const itemY = Math.max(restItemY, bayFloor);
1370 + const size = itemSize(item, true);
1371 + placed.push({ item, y: itemY, size, closedHeight: sizes[index]!.height });
1372 + bayFloor = itemY + size.height + BAY_GAP;
1373 + restItemY += sizes[index]!.height + BAY_GAP;
1374 + });
1375 + y += rowHeight + GROUP_GAP;
1376 + }
1377 + let height = Math.max(
1378 + HEADER + CLIENT.height,
1379 + y - GROUP_GAP,
1380 + cardFloor - GROUP_GAP,
1381 + bayFloor - BAY_GAP,
1382 + );
1383 +
1384 + const centerOf = (id: string) => anchors.get(id)!;
1385 +
1386 + /** What a line into the item points at: the machine, or the stack's card, open or closed. */
1387 + const faceOf = (item: BayItem, itemY: number, closedHeight: number) =>
1388 + item.kind === "target"
1389 + ? { top: itemY, height: closedHeight }
1390 + : { top: itemY + STACK.lift, height: closedHeight - STACK.lift };
1391 + /** Where each line into the item arrives. */
1392 + const entryY = new Map<string, number>();
1393 + for (const { item, y: itemY, closedHeight } of placed) {
1394 + const face = faceOf(item, itemY, closedHeight);
1395 + item.entries.forEach((entry, index) => {
1396 + entryY.set(
1397 + entry.key,
1398 + face.top + face.height / 2 + (index - (item.entries.length - 1) / 2) * ENTRY_PITCH,
1399 + );
1400 + });
1401 + }
1402 + const portY = (link: FleetLinkEdge, hostId: string) => {
1403 + const side = Math.sign(indexOf(link.from === hostId ? link.to : link.from) - indexOf(hostId));
1404 + const key = `${hostId}:${side}`;
1405 + const port =
1406 + link.from === hostId && !twoWay(link)
1407 + ? 0
1408 + : Number(leaves.has(key)) + arrivalsOf.get(key)!.indexOf(link);
1409 + return (
1410 + centerOf(hostId) +
1411 + side *
1412 + (routesExtent(hostId) + LINK_PORT.first + port * linkPortPitch(byId.get(hostId)!, side))
1413 + );
1414 + };
1415 +
1416 + // One lane per host for each shared row it reaches.
1417 + const trunkOf = new Map<string, FleetLane>();
1418 + const lanes: FleetLane[] = [];
1419 + for (const [anchor, band] of bandOf) {
1420 + const byHost = new Map<string, BayEntry[]>();
1421 + for (const item of band) for (const entry of item.entries) pushTo(byHost, entry.from, entry);
1422 + for (const [hostId, mine] of byHost) {
1423 + const from = centerOf(hostId);
1424 + const branches = mine.map((entry) => entryY.get(entry.key)!);
1425 + const lane: FleetLane = {
1426 + id: `${hostId}>${anchor}`,
1427 + from,
1428 + to: branches.reduce((far, at) => (Math.abs(at - from) > Math.abs(far - from) ? at : far)),
1429 + branches,
1430 + index: 0,
1431 + };
1432 + for (const entry of mine) trunkOf.set(entry.key, lane);
1433 + lanes.push(lane);
1434 + }
1435 + }
1436 + const span = (lane: FleetLane) => Math.abs(lane.to - lane.from);
1437 + const passes = (lane: FleetLane, at: number) =>
1438 + at > Math.min(lane.from, lane.to) && at < Math.max(lane.from, lane.to);
1439 + // What `inner` nearer the cards costs: each of its turn-offs that has to cross `outer`, and
1440 + // `outer` leaving its host across it. Of two lanes the one that costs less goes inside.
1441 + const crossings = (inner: FleetLane, outer: FleetLane) =>
1442 + inner.branches.filter((at) => passes(outer, at)).length + Number(passes(inner, outer.from));
1443 + const taken: FleetLane[][] = [];
1444 + for (const lane of lanes
1445 + .toSorted((left, right) => (left.id < right.id ? -1 : 1))
1446 + .toSorted(
1447 + (left, right) => crossings(left, right) - crossings(right, left) || span(left) - span(right),
1448 + )) {
1449 + const top = Math.min(lane.from, lane.to) - LANE_CLEARANCE;
1450 + const bottom = Math.max(lane.from, lane.to) + LANE_CLEARANCE;
1451 + let index = 0;
1452 + while (
1453 + taken[index]?.some(
1454 + (other) => Math.min(other.from, other.to) < bottom && top < Math.max(other.from, other.to),
1455 + )
1456 + ) {
1457 + index += 1;
1458 + }
1459 + lane.index = index;
1460 + (taken[index] ??= []).push(lane);
1461 + }
1462 + const laneX = (lane: FleetLane) => cardRight + metrics.laneFirst + lane.index * LANE_STEP;
1463 + const fanX =
1464 + taken.length === 0 ? cardRight : cardRight + metrics.laneFirst + taken.length * LANE_STEP;
1465 + // Machines an open stack pushed down can need a lane more. It comes out of the run to their
1466 + // column while that has any to give, so the column stays where it stood.
1467 + const bayX =
1468 + room.bayX === null
1469 + ? fanX + metrics.linkRun
1470 + : Math.max(room.bayX, fanX + Math.min(metrics.linkRun, LINK_RUN_MIN));
1471 + const endX = bayX - ARROW_LENGTH;
1472 + const lineInto = (entry: BayEntry) => {
1473 + const trunk = trunkOf.get(entry.key);
1474 + const targetY = entryY.get(entry.key)!;
1475 + return {
1476 + d:
1477 + trunk === undefined
1478 + ? sCurve(cardRight, centerOf(entry.from), endX, targetY, fanX)
1479 + : elbowPath(cardRight, trunk.from, laneX(trunk), endX, targetY),
1480 + arrow: { x: bayX, y: targetY },
1481 + };
1482 + };
1483 +
1484 + let width = fanX;
1485 + for (const { item, y: itemY, size, closedHeight } of placed) {
1486 + width = Math.max(width, bayX + size.width);
1487 + if (item.kind === "target") {
1488 + nodes.set(item.targetId, { x: bayX, y: itemY, ...size });
1489 + for (const entry of item.entries) {
1490 + const line = lineInto(entry);
1491 + linkGeometry.set(entry.key, {
1492 + d: line.d,
1493 + arrow: { ...line.arrow, dir: 1 },
1494 + twoWay: null,
1495 + badge: null,
1496 + });
1497 + }
1498 + continue;
1499 + }
1500 + const { stack } = item;
1501 + const { top, height: faceHeight } = faceOf(item, itemY, closedHeight);
1502 + const face = { x: bayX, y: top, width: metrics.target, height: faceHeight };
1503 + stackGeometry.set(stack.id, {
1504 + ...(stack.expanded
1505 + ? openRects(stack, face)
1506 + : { rect: { x: bayX, y: itemY, ...size }, tray: null }),
1507 + face,
1508 + lines: item.entries.map((entry, index) => ({
1509 + sourceId: entry.from,
1510 + access: stack.sources[index]!.access,
1511 + ...lineInto(entry),
1512 + })),
1513 + more: stack.expanded ? fillTray(stack, face) : null,
1514 + });
1515 + }
1516 +
1517 + const clientCenterY =
1518 + restCenters.length === 0
1519 + ? HEADER + CLIENT.height / 2
1520 + : (restCenters[0]! + restCenters.at(-1)!) / 2;
1521 + nodes.set(FLEET_CLIENT_NODE_ID, {
1522 + x: 0,
1523 + y: clientCenterY - CLIENT.height / 2,
1524 + ...CLIENT_SIZE,
1525 + });
1526 +
1527 + // Wires leave the client a little apart, in the order they arrive, so they never cross. A
1528 + // folded group of environments gets one wire, whatever its machines' routes are.
1529 + // Each route is named in a column beside its card, then closes up into the card's edge.
1530 + const wires = column.flatMap(
1531 + ({
1532 + entry,
1533 + center,
1534 + }): Array<{
1535 + entry: ColumnEntry;
1536 + edge: FleetRouteEdge | null;
1537 + portY: number;
1538 + entryY: number;
1539 + }> => {
1540 + if (entry.kind === "fold") return [{ entry, edge: null, portY: center, entryY: center }];
1541 + const hostRoutes = routesOf.get(entry.id) ?? [];
1542 + return hostRoutes.map((edge, index) => {
1543 + const offset = index - (hostRoutes.length - 1) / 2;
1544 + return {
1545 + entry,
1546 + edge,
1547 + portY: center + offset * FLEET_ROUTE_PITCH,
1548 + entryY: center + offset * routeEntryPitch(entry.id),
1549 + };
1550 + });
1551 + },
1552 + );
1553 + const pillRight = pillX + metrics.pill;
1554 + const closeX = pillRight + metrics.pillGap;
1555 + const pillColumns: FleetRect[] = [];
1556 + const fan = Math.min(CLIENT.height - 20, (wires.length - 1) * 4);
1557 + wires.forEach((wire, index) => {
1558 + const startY =
1559 + clientCenterY + (wires.length < 2 ? 0 : (index / (wires.length - 1) - 0.5) * fan);
1560 + const close =
1561 + wire.entryY === wire.portY
1562 + ? ""
1563 + : `H${pillRight}C${pillRight + metrics.pillGap / 2} ${wire.portY} ${closeX - metrics.pillGap / 2} ${wire.entryY} ${closeX} ${wire.entryY}`;
1564 + const d = `${sCurve(metrics.app, startY, pillX, wire.portY)}${close}H${cardX}`;
1565 + if (wire.edge === null) {
1566 + const geometry = stackGeometry.get(wire.entry.id)!;
1567 + stackGeometry.set(wire.entry.id, {
1568 + ...geometry,
1569 + lines: [{ sourceId: null, access: null, d, arrow: null }],
1570 + });
1571 + return;
1572 + }
1573 + const pill = { x: pillX, y: wire.portY - PILL.height / 2, ...PILL_SIZE };
1574 + routes.set(wire.edge.id, { d, pill });
1575 + pillColumns.push(pill);
1576 + height = Math.max(height, pill.y + pill.height);
1577 + });
1578 +
1579 + // A link between environments names its access on its own lane, in a gap between two cards:
1580 + // the one just past the environment it leaves, or the next one free. It grows away from the
1581 + // other lanes passing there. Where no place is clear of every lane and every other name, the
1582 + // name is shown only while its link is in focus, so it never covers a line that is being read.
1583 + const runs = between.map((link) => ({
1584 + link,
1585 + x: cardX - metrics.betweenFirst - betweenLane.get(link.id)! * BETWEEN.step,
1586 + from: portY(link, link.from),
1587 + to: portY(link, link.to),
1588 + }));
1589 + const badges: FleetLinkBadge[] = [];
1590 + for (const run of runs) {
1591 + const { link, x } = run;
1592 + const down = indexOf(link.to) > indexOf(link.from);
1593 + const gaps: number[] = [];
1594 + for (let index = low(link); index < high(link); index += 1) {
1595 + const above = nodes.get(hosts[index]!.id)!;
1596 + const below = nodes.get(hosts[index + 1]!.id)!;
1597 + gaps.push(above.y + above.height + GROUP_GAP / 2, below.y - GROUP_GAP / 2);
1598 + }
1599 + if (!down) gaps.reverse();
1600 + const place = (at: number, side: 1 | -1): FleetLinkBadge => ({
1601 + x: side === 1 ? x - BADGE.overhang : x + BADGE.overhang - BADGE.width,
1602 + y: at - BADGE.height / 2,
1603 + width: BADGE.width,
1604 + height: BADGE.height,
1605 + side,
1606 + onDemand: false,
1607 + });
1608 + const clearOfLanes = (badge: FleetLinkBadge) =>
1609 + !runs.some(
1610 + (other) =>
1611 + other !== run &&
1612 + other.x > badge.x &&
1613 + other.x < badge.x + badge.width &&
1614 + Math.min(other.from, other.to) < badge.y + badge.height &&
1615 + Math.max(other.from, other.to) > badge.y,
1616 + );
1617 + const clearOfNames = (badge: FleetLinkBadge) =>
1618 + !badges.some(
1619 + (other) =>
1620 + other.x < badge.x + badge.width + BADGE.gap &&
1621 + badge.x < other.x + other.width + BADGE.gap &&
1622 + other.y < badge.y + badge.height + BADGE.gap &&
1623 + badge.y < other.y + other.height + BADGE.gap,
1624 + );
1625 + // Route names reach past their card into the gaps a name would take on that side.
1626 + const clearOfRoutes = (badge: FleetLinkBadge) =>
1627 + !pillColumns.some(
1628 + (pill) =>
1629 + pill.x < badge.x + badge.width &&
1630 + badge.x < pill.x + pill.width &&
1631 + pill.y < badge.y + badge.height &&
1632 + badge.y < pill.y + pill.height,
1633 + );
1634 + const options = gaps.flatMap((at) => [place(at, 1), place(at, -1)]);
1635 + const clear = options.find(
1636 + (option) => clearOfNames(option) && clearOfLanes(option) && clearOfRoutes(option),
1637 + );
1638 + if (clear !== undefined) badges.push(clear);
1639 + const startX = twoWay(link) ? cardX - ARROW_LENGTH : cardX;
1640 + const [back, forward] = elbowHalves(startX, run.from, x, cardX - ARROW_LENGTH, run.to);
1641 + linkGeometry.set(link.id, {
1642 + d: elbowPath(startX, run.from, x, cardX - ARROW_LENGTH, run.to),
1643 + arrow: { x: cardX, y: run.to, dir: 1 },
1644 + twoWay: twoWay(link) ? { backArrow: { x: cardX, y: run.from, dir: 1 }, forward, back } : null,
1645 + badge: clear ?? { ...options[0]!, onDemand: true },
1646 + });
1647 + }
1648 +
1649 + return {
1650 + nodes,
1651 + stacks: stackGeometry,
1652 + routes,
1653 + links: linkGeometry,
1654 + handles,
1655 + columns: [
1656 + { id: "client", x: 0 },
1657 + ...(column.length > 0 ? [{ id: "environments" as const, x: cardX }] : []),
1658 + ...(placed.length > 0 ? [{ id: "targets" as const, x: bayX }] : []),
1659 + ],
1660 + width,
1661 + height,
1662 + };
1663 +}
1664 +
1665 +/** What the arrow keys move between: every machine drawn, and each stack's controls. */
1666 +export function fleetFocusRects(layout: FleetLayout): ReadonlyMap<string, FleetRect> {
1667 + const rects = new Map(layout.nodes);
1668 + for (const [id, geometry] of layout.stacks) {
1669 + rects.set(id, geometry.face);
1670 + if (geometry.more !== null) rects.set(fleetMoreNodeId(id), geometry.more);
1671 + }
1672 + return rects;
1673 +}
1674 +
1675 +/** The machines drawn on their own that a selection box touches. */
1676 +export function fleetNodesInBox(layout: FleetLayout, box: FleetRect): string[] {
1677 + const inside: string[] = [];
1678 + for (const [id, rect] of layout.nodes) {
1679 + if (
1680 + id !== FLEET_CLIENT_NODE_ID &&
1681 + rect.x < box.x + box.width &&
1682 + box.x < rect.x + rect.width &&
1683 + rect.y < box.y + box.height &&
1684 + box.y < rect.y + rect.height
1685 + ) {
1686 + inside.push(id);
1687 + }
1688 + }
1689 + return inside;
1690 +}
1691 +
1692 +/** What pressing or dropping an environment's link handle starts. */
1693 +export type FleetLinkAction =
1694 + /** The batch flow, opened on these machines. Which of them it can link is its own to say. */
1695 + | {
1696 + readonly kind: "batch";
1697 + readonly sourceEnvironmentId: EnvironmentId;
1698 + readonly environmentIds: ReadonlyArray<EnvironmentId>;
1699 + }
1700 + /**
1701 + * None of the machines dropped on can be linked from here in one go: this client has no
1702 + * session on any of them, so each needs a pairing code. `machineIds` are the map's nodes.
1703 + */
1704 + | {
1705 + readonly kind: "code-only";
1706 + readonly sourceId: string;
1707 + readonly sourceEnvironmentId: EnvironmentId;
1708 + readonly machineIds: ReadonlyArray<string>;
1709 + }
1710 + /** The single link flow; `offer` is null when no machine was named. */
1711 + | {
1712 + readonly kind: "single";
1713 + readonly sourceEnvironmentId: EnvironmentId;
1714 + readonly offer: Extract<FleetLinkOffer, { kind: "link" }> | null;
1715 + };
1716 +
1717 +/**
1718 + * A drop on a stack links to its machines; a drop on a selected machine, or a press of the
1719 + * handle while others are selected, links to the selection. Anything else is one link.
1720 + */
1721 +export function fleetLinkAction(
1722 + graph: FleetGraph,
1723 + stacks: ReadonlyArray<FleetStack>,
1724 + selected: ReadonlySet<string>,
1725 + sourceId: string,
1726 + targetId: string | null,
1727 +): FleetLinkAction | null {
1728 + const byId = new Map(graph.nodes.map((node) => [node.id, node]));
1729 + const source = byId.get(sourceId);
1730 + if (source?.kind !== "environment" || source.linking !== "ready") return null;
1731 + const sourceEnvironmentId = source.environmentId;
1732 + const batch = (picked: Iterable<string>): FleetLinkAction | null => {
1733 + const environmentIds = new Set<EnvironmentId>();
1734 + const machineIds: string[] = [];
1735 + let known = false;
1736 + for (const id of picked) {
1737 + const node = byId.get(id);
1738 + if (node === undefined || node.kind === "client" || node.id === source.id) continue;
1739 + if (!environmentIds.has(node.environmentId)) machineIds.push(node.id);
1740 + environmentIds.add(node.environmentId);
1741 + known ||= node.kind !== "target";
1742 + }
1743 + if (environmentIds.size === 0) return null;
1744 + if (known) return { kind: "batch", sourceEnvironmentId, environmentIds: [...environmentIds] };
1745 + const [only, ...rest] = machineIds;
1746 + if (rest.length > 0 || only === undefined) {
1747 + return { kind: "code-only", sourceId: source.id, sourceEnvironmentId, machineIds };
1748 + }
1749 + // One such machine is the single flow's, which asks for its code.
1750 + const offer = fleetLinkOffer(graph, sourceId, only);
1751 + return offer.kind === "link" ? { kind: "single", sourceEnvironmentId, offer } : null;
1752 + };
1753 + const stack = targetId === null ? undefined : stacks.find((entry) => entry.id === targetId);
1754 + if (stack !== undefined) return batch(stack.memberIds);
1755 + if (targetId === null || selected.has(targetId)) {
1756 + const picked = batch(selected);
1757 + if (picked !== null) return picked;
1758 + }
1759 + if (targetId === null) return { kind: "single", sourceEnvironmentId, offer: null };
1760 + const offer = fleetLinkOffer(graph, sourceId, targetId);
1761 + return offer.kind === "link" ? { kind: "single", sourceEnvironmentId, offer } : null;
1762 +}
1763 +
1764 +/** Machines whose name holds the query, drawn or folded, in name order. */
1765 +export function fleetSearch(graph: FleetGraph, query: string): string[] {
1766 + const needle = query.trim().toLocaleLowerCase();
1767 + if (needle === "") return [];
1768 + return graph.nodes
1769 + .filter((node) => node.kind !== "client" && node.label.toLocaleLowerCase().includes(needle))
1770 + .toSorted((left, right) => labelOrder.compare(left.label, right.label))
1771 + .map((node) => node.id);
1772 +}
1773 +
1774 +export type FleetDirection = "up" | "down" | "left" | "right";
1775 +
1776 +/** The nearest item in that direction, for arrow keys. Sideways distance counts double. */
1777 +export function nextFleetNode(
1778 + rects: ReadonlyMap<string, FleetRect>,
1779 + fromId: string,
1780 + direction: FleetDirection,
1781 +): string | null {
1782 + const from = rects.get(fromId);
1783 + if (!from) return null;
1784 + const horizontal = direction === "left" || direction === "right";
1785 + const sign = direction === "left" || direction === "up" ? -1 : 1;
1786 + const center = (rect: FleetRect) => ({
1787 + x: rect.x + rect.width / 2,
1788 + y: rect.y + rect.height / 2,
1789 + });
1790 + const origin = center(from);
1791 + let best: { readonly id: string; readonly score: number } | null = null;
1792 + for (const [id, rect] of rects) {
1793 + if (id === fromId) continue;
1794 + const point = center(rect);
1795 + const along = sign * (horizontal ? point.x - origin.x : point.y - origin.y);
1796 + const across = Math.abs(horizontal ? point.y - origin.y : point.x - origin.x);
1797 + if (along < 1) continue;
1798 + const score = along + across * 2;
1799 + if (best === null || score < best.score) best = { id, score };
1800 + }
1801 + return best?.id ?? null;
1802 +}
1803 +
1804 +export interface FleetViewTransform {
1805 + readonly x: number;
1806 + readonly y: number;
1807 + readonly scale: number;
1808 +}
1809 +
1810 +const FLEET_MIN_SCALE = 0.3;
1811 +const FLEET_MAX_SCALE = 2;
1812 +/** A small setup is enlarged to fill the canvas, but not until two machines look like a poster. */
1813 +const FLEET_FIT_MAX_SCALE = 1.15;
1814 +/** The fit never has to go below this on a map with its stacks closed, down to a 560px canvas. */
1815 +export const FLEET_FIT_LEGIBLE_SCALE = 0.85;
1816 +
1817 +/** The canvas width a layout is made for: steps, so dragging a window edge relays it rarely. */
1818 +export const fleetLayoutWidth = (canvasWidth: number) => Math.floor(canvasWidth / 16) * 16;
1819 +
1820 +/** The margin the fit leaves around the map: a narrow canvas spends less of itself on it. */
1821 +const fleetFitPadding = (canvasWidth: number) => (canvasWidth < 720 ? 16 : 28);
1822 +
1823 +const fitScale = (available: number, extent: number, padding: number) =>
1824 + Math.max(0.01, (available - padding * 2) / Math.max(1, extent));
1825 +
1826 +/** Centers the whole map in the viewport at the largest scale that shows all of it. */
1827 +export function fitFleetLayout(
1828 + layout: Pick<FleetLayout, "width" | "height">,
1829 + viewport: { readonly width: number; readonly height: number },
1830 +): FleetViewTransform {
1831 + const padding = fleetFitPadding(viewport.width);
1832 + const scale = Math.min(
1833 + FLEET_FIT_MAX_SCALE,
1834 + fitScale(viewport.width, layout.width, padding),
1835 + fitScale(viewport.height, layout.height, padding),
1836 + );
1837 + return {
1838 + scale,
1839 + x: (viewport.width - layout.width * scale) / 2,
1840 + y: (viewport.height - layout.height * scale) / 2,
1841 + };
1842 +}
1843 +
1844 +/** How tall the canvas wants to be at this width: the fitted map plus padding, within bounds. */
1845 +export function fleetCanvasHeight(
1846 + layout: Pick<FleetLayout, "width" | "height">,
1847 + width: number,
1848 + bounds: { readonly min: number; readonly max: number },
1849 +): number {
1850 + const padding = fleetFitPadding(width);
1851 + const scale = Math.min(FLEET_FIT_MAX_SCALE, fitScale(width, layout.width, padding));
1852 + const wanted = Math.ceil(layout.height * scale + padding * 2);
1853 + return Math.max(bounds.min, Math.min(bounds.max, wanted));
1854 +}
1855 +
1856 +/** Zooms by `factor`, keeping the map point under `anchor` where it is. */
1857 +export function zoomFleetView(
1858 + view: FleetViewTransform,
1859 + factor: number,
1860 + anchor: FleetPoint,
1861 + fitScale = view.scale,
1862 +): FleetViewTransform {
1863 + // A fit of a very large setup sits below the manual minimum: zooming out stops at the fit
1864 + // instead of jumping up, and can return to it after zooming in.
1865 + const floor = Math.min(FLEET_MIN_SCALE, fitScale, view.scale);
1866 + const scale = Math.max(floor, Math.min(FLEET_MAX_SCALE, view.scale * factor));
1867 + const ratio = scale / view.scale;
1868 + return {
1869 + scale,
1870 + x: anchor.x - (anchor.x - view.x) * ratio,
1871 + y: anchor.y - (anchor.y - view.y) * ratio,
1872 + };
1873 +}
1874 +
1875 +/** A view that is not the fit: set by hand, or kept in place while a stack opened or closed. */
1876 +export interface FleetHeldView {
1877 + /** The shape it was set on. It holds while the map keeps that shape. */
1878 + readonly key: string;
1879 + readonly view: FleetViewTransform;
1880 + readonly height: number;
1881 + /** Eased into; a drag or pinch tracks the hand instead. */
1882 + readonly glide: boolean;
1883 + /** What closing the stack again returns to, while nothing else has moved the view since. */
1884 + readonly undo: { readonly key: string; readonly held: FleetHeldView | null } | null;
1885 +}
1886 +
1887 +/**
1888 + * The view after a stack opened or closed. Its card stays where it was on screen and the scale
1889 + * holds, so nothing is fitted again. The canvas grows to show what the stack added, up to its
1890 + * bound; past that the user pans. Only a stack wider than the canvas at this scale shrinks the
1891 + * view, and then just to its width. Toggling it back returns the view it had before.
1892 + */
1893 +export function anchorFleetView(input: {
1894 + readonly key: string;
1895 + /** The shape, the view held on it and the canvas before the change. */
1896 + readonly from: {
1897 + readonly key: string;
1898 + readonly held: FleetHeldView | null;
1899 + readonly view: FleetViewTransform;
1900 + readonly size: { readonly width: number; readonly height: number };
1901 + readonly face: FleetPoint;
1902 + };
1903 + /** The stack and the map after it. */
1904 + readonly stack: Pick<FleetStackGeometry, "rect" | "face" | "tray">;
1905 + readonly layout: Pick<FleetLayout, "width" | "height">;
1906 + readonly bounds: { readonly min: number; readonly max: number };
1907 +}): FleetHeldView {
1908 + const { from, stack, layout, bounds } = input;
1909 + const { size } = from;
1910 + if (from.held?.undo?.key === input.key) {
1911 + const { held } = from.held.undo;
1912 + // With no view held before, a stale entry eases the scene back to the fit.
1913 + return held === null
1914 + ? { key: "", view: from.view, height: size.height, glide: true, undo: null }
1915 + : { ...held, glide: true };
1916 + }
1917 + const padding = fleetFitPadding(size.width);
1918 + const top = from.face.y * from.view.scale + from.view.y;
1919 + const scale = Math.min(from.view.scale, fitScale(size.width, stack.rect.width, padding));
1920 + const view =
1921 + scale < from.view.scale
1922 + ? { scale, x: padding - stack.face.x * scale, y: top - stack.face.y * scale }
1923 + : {
1924 + scale,
1925 + x: from.view.x + (from.face.x - stack.face.x) * scale,
1926 + y: from.view.y + (from.face.y - stack.face.y) * scale,
1927 + };
1928 + const wanted = Math.ceil(view.y + layout.height * scale + padding);
1929 + const opened = stack.tray !== null;
1930 + return {
1931 + key: input.key,
1932 + view,
1933 + height: Math.max(
1934 + bounds.min,
1935 + Math.min(bounds.max, opened ? Math.max(size.height, wanted) : Math.min(size.height, wanted)),
1936 + ),
1937 + glide: true,
1938 + undo: { key: from.key, held: from.held },
1939 + };
1940 +}
apps/web/src/i18n/translations/de.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Diese App ist nicht damit verbunden",
79 "95f18b6ad4a409de": "Deine Sitzung dort kann keine Kopplungscodes erstellen",
80 "26847ec0357c8600": "Keine Adresse, die ein anderer Rechner erreichen kann",
81 + "ec1a698b0821ec66": "{target} kann nicht zurückverknüpfen: Verknüpfte Umgebungen sind dort aus.",
82 + "6cf74ace5a766699": "{target} kann nicht zurückverknüpfen: Deine Sitzung dort kann keine Verknüpfungen erstellen.",
83 + "a995255a0f303086": "{target} kann nicht zurückverknüpfen: Deine Sitzung auf {source} kann keine Kopplungscodes erstellen.",
84 + "a51c8cdfccb5b4ca": "{target} kann nicht zurückverknüpfen: Diese App kennt keine Adresse, unter der {source} erreichbar ist.",
85 "cba6d3e3a22f2efe": "Nicht erreichbar",
86 "0eb1a18deaf06b76": "Kopplungscode abgelehnt",
87 "7d6fc963ebf9a9c5": "Eine andere Umgebung hat geantwortet",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "Die Routenreihenfolge muss jede gespeicherte Route genau einmal enthalten.",
487 "18de69e3b6ac3891": "Verbindungsprofil {connectionId} ist keine Bearer-Verbindung.",
488 "0a84ce2f4fb90d82": "Verbindungsprofil {connectionId} ist keine SSH-Verbindung.",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "Remote-Verbindung",
491 "0b367ce72b45a911": "Die Verbindung zu {host} ist unerwartet fehlgeschlagen.",
492 "91ca7e48f40bfa3c": "{host} hat während der Verbindungseinrichtung nicht geantwortet.",
@@ -8092,6 +8097,9 @@
8097 "d087da5017f20fa2": "Keine Umgebung ausgewählt",
8098 "cb553d31c9d1b1c7": "Verbinde eine Umgebung, um ihre Einstellungen und Zugriffe zu sehen.",
8099 "9a84dc0e80037e05": "Diese App",
8100 + "3d96310c2214fe2d": "Umgebungen anzeigen als",
8101 + "41e0e5e03e07db42": "Karte",
8102 + "3a8adb207fb5e078": "Liste",
8103 "493685e264877b13": "Zugriff wird angezeigt für",
8104 "5b2287f7b10cfa2f": "Offline",
8105 "03f150efa96ec728": "Zu Windows wechseln",
@@ -8394,6 +8402,110 @@
8402 "191fa21f1cfda1ef": "Der Host hat die Anmeldung dieses Geräts abgelehnt. Kopple diese Adresse erneut über „Route hinzufügen“.",
8403 "219bc3612d646a01": "Route entfernen",
8404 "b2877341429675aa": "über {route}",
8405 + "537e7cf4df7a0af1": "Dieser Browser",
8406 + "d18ad97175bd2028": "Umschalt-Klick oder Umschalt-Ziehen wählt mehrere aus",
8407 + "692153ec34a9a7bd": "Einen Rechner auf der Karte finden",
8408 + "288ab5c45a9539a3": "Rechner finden",
8409 + "c263859f8bcc7b1c": "Kein Rechner mit diesem Namen",
8410 + "ebe6ecf547a0636b": "{count, plural, one {# Treffer} other {# Treffer}}",
8411 + "2bb44d78cb85c097": "{count, plural, one {# ausgewählt} other {# ausgewählt}}",
8412 + "bcf01a26153f6425": "Auswahl aufheben",
8413 + "d9665bd69e7fd4f4": "Mehrere verknüpfen…",
8414 + "8d5882faf1e5fb96": "Von {source}",
8415 + "2b9e6257e6995ada": "So funktioniert die Karte",
8416 + "743b93767ec7ebf8": "Wähle einen Rechner aus, um ihn zu verwalten.",
8417 + "49712bceec027141": "Ziehe ein Plus auf einen Rechner, um beide zu verknüpfen.",
8418 + "aba23d86b0f4b66b": "Eine Verknüpfung reicht bis zu einem Rechner und endet dort.",
8419 + "601e0c9e6a45a54f": "Karte einpassen",
8420 + "feec58f6653f5673": "So liest man die Linien",
8421 + "46e0a0c6ff391521": "In Verwendung",
8422 + "1151e8a9fb7bdfcf": "Bereit",
8423 + "a322337b6655de2a": "Nicht in Verwendung",
8424 + "e31c7e76ef900ef4": "Anmeldung abgelehnt",
8425 + "c032d479f9bbb166": "Verknüpfung",
8426 + "d4160421f6e651bb": "Beidseitig",
8427 + "d3751f456814b2b2": "{count, plural, one {# Rechner braucht einen Kopplungscode} other {# Rechner brauchen je einen Kopplungscode}}",
8428 + "e0a8e0b87dca8241": "Einen mit Code verknüpfen…",
8429 + "ad095a37f818d67e": "Verknüpfte Rechner",
8430 + "afc01d2ee8048b4b": "{label}, ausgewählt",
8431 + "aa34f7bc5aaf6bb0": "Karte deiner Rechner",
8432 + "edb6cb27ff7f446b": "Mit den Pfeiltasten wechselst du zwischen Rechnern. Die Eingabetaste öffnet die Details eines Rechners mit seinen Routen und Verknüpfungen. Die Leertaste wählt einen Rechner aus, um mehrere auf einmal zu verknüpfen. Tab führt von einer Umgebung zu ihrer Verknüpfen-Schaltfläche. Plus und Minus zoomen, Null passt die Karte ein.",
8433 + "753b4a8ec5521c98": "Verknüpfung von {source} zu {target}: {summary}",
8434 + "bb6a74a47a3852c7": "Abgelaufen",
8435 + "3076117d81a9c1c0": "Antwortet nicht",
8436 + "96fdb2fd529b1fbb": "Fehlerhaft",
8437 + "8971602c42718d72": "Erreichbar",
8438 + "1b256867b95ee022": "{days, plural, one {Läuft in {days} Tag ab} other {Läuft in {days} Tagen ab}}",
8439 + "9d02cb328944fb27": "Verknüpfung in beide Richtungen zwischen {source} und {target}, {access}. {source} zu {target}: {forward}. {target} zu {source}: {back}",
8440 + "aae31cf2017dab5b": "Öffentlich",
8441 + "b4f6c341033a3c91": "Ausgeschaltet",
8442 + "960255d19109dcd9": "Update nötig",
8443 + "19f6a3505837907d": "{access}. {reachable} von {count} erreichbar",
8444 + "6f8f71c20ba546af": "{reachable} von {count} erreichbar, von {sources} Umgebungen",
8445 + "0d731c951986fac8": "{group}: {count} Umgebungen ohne Verknüpfungen, {range}",
8446 + "5feb96736385be01": "{range}, {count} Rechner, verknüpft von {sources}. {summary}",
8447 + "706ac721bf99036c": "{machines, plural, one {# Rechner} other {# Rechner}}",
8448 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {Keiner erreichbar} other {# erreichbar}}",
8449 + "35b783cfc817cb6f": "Diese Rechner einklappen",
8450 + "14dcd5c89fd0f67f": "Die ersten {shown} Rechner auf der Karte zeigen",
8451 + "b8f2d917d3a592df": "Jeden Rechner auf der Karte zeigen",
8452 + "ddc2106217bbde2d": "und {count} weitere",
8453 + "b0d81579d80fb94a": "nur über eine Verknüpfung bekannt",
8454 + "2d3dc930fd1cdd55": "von {source}: {summary}",
8455 + "911bc3bcde1aba3b": "{count, plural, one {# eingehende Verknüpfung} other {# eingehende Verknüpfungen}}",
8456 + "930f9e01fc4591b4": "Aus",
8457 + "0fecb34fd1ae531f": "{label}, in deinem T3-Connect-Konto, dieser App nicht hinzugefügt. {status}",
8458 + "4a84ad9b7f8e4909": "Verknüpfungen werden geladen…",
8459 + "9c88c8e716354091": "Verknüpfungen konnten nicht geladen werden",
8460 + "f9733c7b64c6f5d9": "Verknüpfte Umgebungen sind aus",
8461 + "ba30444f6d79cbdd": "Verknüpfungen von hier nicht lesbar",
8462 + "6a34b35812bb4ad0": "{count, plural, =0 {Keine ausgehenden Verknüpfungen} one {# ausgehende Verknüpfung} other {# ausgehende Verknüpfungen}}",
8463 + "5d252c8bbc3b24d0": "{status}. Verknüpfungen unbekannt",
8464 + "ec2c609c028d63b4": "{label} mit einem anderen Rechner verknüpfen",
8465 + "0a72d33781010657": "Damit ist keine Verknüpfung möglich",
8466 + "e93eaf3bfa0ff76b": "{count, plural, one {Mit # Rechner verknüpfen} other {Mit # Rechnern verknüpfen}}",
8467 + "96bd315e3441c52a": "Verknüpfung zu {target} erneuern",
8468 + "9f752f912897416a": "Mit {target} verknüpfen",
8469 + "b40f4891ccc7af6d": "Verknüpfung zu {target} mit Kopplungscode erneuern",
8470 + "d51a7a2bb6b8c406": "Mit {target} per Kopplungscode verknüpfen",
8471 + "f4ca5e62fb54a3a7": "Zum Verknüpfen auf einem Rechner ablegen",
8472 + "11e67016507a6daa": "Zwei Verknüpfungen, eine je Richtung.",
8473 + "352169e91766aeb4": "{count, plural, one {# braucht Aufmerksamkeit} other {# brauchen Aufmerksamkeit}}",
8474 + "d53ada50331e6041": "{machines, plural, one {# Rechner} other {# Rechner}}, {links, plural, =0 {keine Verknüpfungen} one {# Verknüpfung} other {# Verknüpfungen}}",
8475 + "3e8441af6148878f": "Läuft am {date} ab",
8476 + "4daaa2288b63a801": "{count, plural, one {# eingehende Verknüpfung} other {# eingehende Verknüpfungen}}",
8477 + "baf297d0add1d61b": "{count, plural, one {# Umgebung} other {# Umgebungen}}",
8478 + "ddb9150bfa8ce6f0": "Keine Verknüpfungen",
8479 + "a780bc462b60c3c0": "Einklappen",
8480 + "059c335b1da34f63": "Auf der Karte zeigen",
8481 + "c7e1635b229d7249": "Diese Rechner nach Namen filtern",
8482 + "52a07016be1bea99": "Nach Namen filtern",
8483 + "a7061489aec79ba8": "{shown} von {count}",
8484 + "eefe994332120d82": "Verknüpfen",
8485 + "c20e4b94dddc33e7": "{connected} von {total} verbunden",
8486 + "c7a9759d8578279f": "Jede Linie von hier ist eine gespeicherte Route zu einer Umgebung.",
8487 + "398cee23ca4dabec": "{count, plural, =0 {Kein bekannter Rechner ist hierher verknüpft} one {Von # Rechner verknüpft} other {Von # Rechnern verknüpft}}",
8488 + "79e98f4a48d3df43": "Füge {label} dieser App hinzu, um dich damit zu verbinden.",
8489 + "da2990354cbe0fab": "Nur über eine Verknüpfung bekannt",
8490 + "dfaeed73f86107ea": "Nicht verbunden, daher werden die Verknüpfungen nicht angezeigt.",
8491 + "2ff64d143a690a99": "Um von {label} aus zu verknüpfen, schalte dort in den Labs-Einstellungen „Verknüpfte Umgebungen“ ein.",
8492 + "eb3226bab4946cfa": "Diese App darf die Verknüpfungen von {label} nicht lesen.",
8493 + "59bb2a50641eb2a9": "Verknüpfungen von {label} konnten nicht geladen werden: {error}",
8494 + "58cb9c075da185fb": "Verknüpfte Umgebungen werden geladen…",
8495 + "126e2b7a117f01d5": "{count, plural, =0 {Mit keinem Rechner verknüpft} one {Verknüpft mit # Rechner} other {Verknüpft mit # Rechnern}}",
8496 + "285d95a8e5ad0ec5": "ist verknüpft mit",
8497 + "ee2a5f5571bca358": "Zurückverknüpfen…",
8498 + "57f38a04b1e5c033": "Wird vergessen…",
8499 + "20ffe8337f8f30ba": "Vergessen",
8500 + "1f221fe54654ed13": "Zugriff",
8501 + "8b0cd4f77cc74c37": "Status",
8502 + "33386c89f3b07fea": "Abgelaufen. Verknüpfe es erneut mit einem neuen Kopplungscode.",
8503 + "13d91e967cd9065c": "Antwortet gerade nicht.",
8504 + "42e613ac8acac777": "{days, plural, one {Läuft in {days} Tag ab. Verknüpfe es erneut, um es zu verlängern.} other {Läuft in {days} Tagen ab. Verknüpfe es erneut, um es zu verlängern.}}",
8505 + "0990edee7035bcfe": "Läuft ab",
8506 + "1c161c630d28d225": "Adressen",
8507 + "7ee376c7db73ab57": "Verknüpft",
8508 + "e9f7a62ecd609a46": "Zuletzt erreicht",
8509 "70bae47e93a2f207": "Vollständigen Fehler anzeigen",
8510 "e4099af6d85770ff": "„{font}“ ist keine Monospace-Schrift",
8511 "a8448493d83279e2": "Code und Terminal brauchen eine Schrift mit fester Breite, daher wurde die aktuelle Schrift beibehalten.",
@@ -8717,35 +8829,42 @@
8829 "03ce9bea5f88ddbd": "Diese App kann nicht bestätigen, dass es einer deiner Rechner ist. Der eingefügte Kopplungscode wird dorthin gesendet.",
8830 "30b696434167411f": "Verknüpft",
8831 "80bbda74ee500b82": "Rechner",
8832 + "4e7b0a3ced2d0f97": "Mehrere Umgebungen verknüpfen",
8833 + "0f3a6d9b3350d800": "Mehrere Rechner von {source} aus verknüpfen",
8834 "e5ac7abeaeb78750": "Nichts auswählen",
8835 "ab520df47bca22d2": "Alles auswählen",
8836 "3a57c9bbcd12529f": "Es konnte nicht geprüft werden, welche Rechner bereits verknüpft sind, daher kann keiner ausgewählt werden: {error}",
8837 + "4381e144bbeaddb2": "In beide Richtungen verknüpft",
8838 + "692450a6537f52a8": "In eine Richtung verknüpft",
8839 "78ccf685018ef797": "Verknüpft",
8840 + "956b5c20a1fba7c1": "Zurückverknüpfen fehlgeschlagen: {reason}",
8841 + "641c3b24cbc7d86b": "{count, plural, one {# Rechner braucht einen Kopplungscode und ist daher nicht aufgeführt.} other {# Rechner brauchen einen Kopplungscode und sind daher nicht aufgeführt.}}",
8842 "87433cf138dc3e2c": "{linked, plural, one {# Rechner verknüpft.} other {# Rechner verknüpft.}}",
8843 "d044bb95248da10c": "{linked} von {total} verknüpft. Die fehlgeschlagenen bleiben ausgewählt, damit du es erneut versuchen kannst.",
8844 + "079237b461191c9a": "{count, plural, one {# Rechner konnte nicht zurückverknüpfen.} other {# Rechner konnten nicht zurückverknüpfen.}}",
8845 + "86d17c42dae16356": "Auch jeden Rechner zurück mit {source} verknüpfen",
8846 + "23fd4db8faa1a001": "Agenten dort können dann auch auf {source} arbeiten.",
8847 + "35d59319f62bd505": "{count, plural, one {# Rechner bleibt einseitig verknüpft.} other {# Rechner bleiben einseitig verknüpft.}}",
8848 "d2fbaffe08b6cf60": "{count, plural, one {# Rechner verknüpfen} other {# Rechner verknüpfen}}",
8849 "8e3378b526d615f4": "Mehrere verknüpfen…",
8728 - "7f8d6d1af69829d8": "Mehrere Umgebungen verknüpfen",
8850 "b550d04490078bda": "Agenten hier können dann auf jedem ausgewählten Rechner Threads starten, ihnen Nachrichten senden und auf sie warten. Jede Verknüpfung erscheint unter „Autorisierte Clients“ in „Freigabe & Zugriff“ des jeweiligen Rechners und kann dort widerrufen werden.",
8851 + "e1c2c3bd84d7bcd7": "Diese App ist mit keinem der ausgewählten Rechner verbunden.",
8852 "c2553b323479499a": "Diese App kennt keine anderen Rechner. Füge sie zuerst unter „Umgebungen“ hinzu.",
8853 "18b1d4d42b945b34": "Rechner",
8854 "03860d65c4052ab5": "Es wird geprüft, welche Rechner bereits verknüpft sind…",
8855 "4cea6be0fe6be16f": "Verknüpfte Umgebungen konnten nicht geladen werden",
8734 - "58cb9c075da185fb": "Verknüpfte Umgebungen werden geladen…",
8856 "25b74062dc03079e": "Keine verknüpften Umgebungen",
8857 "6698127fcc912f23": "Verknüpfe einen anderen Rechner mit T3 Code, etwa einen VPS, damit Agenten hier dort Threads starten und steuern können.",
8737 - "ad5ed0ce61b966eb": "{label} vergessen? Agenten von hier arbeiten dort nicht mehr. Widerrufe „T3 Code · …“ unter „Freigabe & Zugriff“ auf {label}, um die Sitzung auch dort zu beenden.",
8738 - "81c9796bf61b306a": "Verknüpfung konnte nicht vergessen werden",
8739 - "33386c89f3b07fea": "Abgelaufen. Verknüpfe es erneut mit einem neuen Kopplungscode.",
8740 - "13d91e967cd9065c": "Antwortet gerade nicht.",
8741 - "42e613ac8acac777": "{days, plural, one {Läuft in {days} Tag ab. Verknüpfe es erneut, um es zu verlängern.} other {Läuft in {days} Tagen ab. Verknüpfe es erneut, um es zu verlängern.}}",
8742 - "8971602c42718d72": "Erreichbar",
8743 - "57f38a04b1e5c033": "Wird vergessen…",
8744 - "20ffe8337f8f30ba": "Vergessen",
8858 "e1789f863205ad5a": "Umgebung konnte nicht verknüpft werden",
8859 + "836dde1b729e6f0a": "{source} und {target} in beide Richtungen verknüpft",
8860 "40cde51afa218290": "{label} verknüpft",
8747 - "eefe994332120d82": "Verknüpfen",
8861 + "ca4e4015b89ed9a8": "{target} konnte nicht zurück mit {source} verknüpft werden",
8862 + "64ac3d1579ca9f5b": "{source} mit {target} verknüpfen",
8863 "fb71127e5746a6bc": "Unter „Freigabe & Zugriff“ dort oder mit t3 pair",
8864 + "1e3fee7084791773": "Auch {target} zurück mit {source} verknüpfen",
8865 + "ea34a190b0bd804c": "Agenten auf {target} können dann auch auf {source} arbeiten.",
8866 + "ad5ed0ce61b966eb": "{label} vergessen? Agenten von hier arbeiten dort nicht mehr. Widerrufe „T3 Code · …“ unter „Freigabe & Zugriff“ auf {label}, um die Sitzung auch dort zu beenden.",
8867 + "81c9796bf61b306a": "Verknüpfung konnte nicht vergessen werden",
8868 "130e51beb6cf5aad": "Umgebung verknüpfen",
8869 "122c3e355699e69d": "Agenten hier können dort dann Threads starten, ihnen Nachrichten senden und auf sie warten. Sie erscheint unter „Autorisierte Clients“ in „Freigabe & Zugriff“ dieser Umgebung und kann dort widerrufen werden.",
8870 "dc9a0b68d101e904": "Bereits verknüpft. Erneutes Verknüpfen verlängert sie mit dem gewählten Zugriff.",
@@ -9433,7 +9552,6 @@
9552 "e3349eb2353ee27c": "Die Genehmigung neuer Geräte ist aus, daher kann sich ein widerrufenes Gerät, das bei deinem T3-Connect-Konto angemeldet ist, von selbst wieder verbinden.",
9553 "080160002915c666": "Genehmigung für neue Geräte verlangen",
9554 "73dd0f86f5363431": "Das Gerät muss hier genehmigt werden, bevor es sich erneut verbinden kann.",
9436 - "930f9e01fc4591b4": "Aus",
9555 "6c7762bd72cea808": "Verbindung wird wiederhergestellt: {error}",
9556 "6cced6a88a19f1f2": "Verbindung wird wiederhergestellt",
9557 "8cbb63fdff9fde72": "Verbindung fehlgeschlagen: {error}",
@@ -11702,7 +11820,6 @@
11820 "8ac2984f4e732091": "ausschalten einschalten deaktivieren aktivieren lokaler server agenten nur remote neustart",
11821 "3a54b8d98911331a": "Netzwerkzugriff",
11822 "1a31308f0884a68b": "backend freigeben remote kopplung lokaler rechner schnittstellen host neustart",
11705 - "468d32c6b30df608": "Tailscale HTTPS",
11823 "92c2528040ca7442": "serve magicdns endpunkt remote sicher netzwerk",
11824 "ab23b9c923cc4e80": "windows subsystem linux distro zweiter server projekte stoppen windows backend neustart nur wsl",
11825 "814c6f3ba7c29f7c": "verwalteter tunnel cloud andere geräte remote tunnel limit t3 chat",
apps/web/src/i18n/translations/en.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "This app is not connected to it",
79 "95f18b6ad4a409de": "Your session there cannot create pairing codes",
80 "26847ec0357c8600": "No address another machine can reach",
81 + "ec1a698b0821ec66": "{target} cannot link back: Linked environments is off there.",
82 + "6cf74ace5a766699": "{target} cannot link back: your session there cannot create links.",
83 + "a995255a0f303086": "{target} cannot link back: your session on {source} cannot create pairing codes.",
84 + "a51c8cdfccb5b4ca": "{target} cannot link back: this app has no address for {source} it can reach.",
85 "cba6d3e3a22f2efe": "Unreachable",
86 "0eb1a18deaf06b76": "Pairing code refused",
87 "7d6fc963ebf9a9c5": "Another environment answered",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "The route order must list every saved route once.",
487 "18de69e3b6ac3891": "Connection profile {connectionId} is not a bearer connection.",
488 "0a84ce2f4fb90d82": "Connection profile {connectionId} is not an SSH connection.",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "Remote link",
491 "0b367ce72b45a911": "{host} connection failed unexpectedly.",
492 "91ca7e48f40bfa3c": "{host} did not respond during connection setup.",
@@ -8099,6 +8104,9 @@
8104 "d087da5017f20fa2": "No environment selected",
8105 "cb553d31c9d1b1c7": "Connect an environment to view its settings and access.",
8106 "9a84dc0e80037e05": "This app",
8107 + "3d96310c2214fe2d": "Show environments as",
8108 + "41e0e5e03e07db42": "Map",
8109 + "3a8adb207fb5e078": "List",
8110 "493685e264877b13": "Showing access for",
8111 "5b2287f7b10cfa2f": "Offline",
8112 "03f150efa96ec728": "Switch to Windows",
@@ -8402,6 +8410,110 @@
8410 "191fa21f1cfda1ef": "The host refused this device's sign-in. Pair this address again with Add route.",
8411 "219bc3612d646a01": "Remove route",
8412 "b2877341429675aa": "via {route}",
8413 + "537e7cf4df7a0af1": "This browser",
8414 + "d18ad97175bd2028": "Shift-click or Shift-drag to select several",
8415 + "692153ec34a9a7bd": "Find a machine on the map",
8416 + "288ab5c45a9539a3": "Find a machine",
8417 + "c263859f8bcc7b1c": "No machine by that name",
8418 + "ebe6ecf547a0636b": "{count, plural, one {# match} other {# matches}}",
8419 + "2bb44d78cb85c097": "{count, plural, one {# selected} other {# selected}}",
8420 + "bcf01a26153f6425": "Clear",
8421 + "d9665bd69e7fd4f4": "Link several…",
8422 + "8d5882faf1e5fb96": "From {source}",
8423 + "2b9e6257e6995ada": "How to use the map",
8424 + "743b93767ec7ebf8": "Select a machine to manage it.",
8425 + "49712bceec027141": "Drag a plus onto a machine to link them.",
8426 + "aba23d86b0f4b66b": "A link reaches one machine and stops there.",
8427 + "601e0c9e6a45a54f": "Fit the map to view",
8428 + "feec58f6653f5673": "How to read the lines",
8429 + "46e0a0c6ff391521": "In use",
8430 + "1151e8a9fb7bdfcf": "Standby",
8431 + "a322337b6655de2a": "Not in use",
8432 + "e31c7e76ef900ef4": "Sign-in refused",
8433 + "c032d479f9bbb166": "Link",
8434 + "d4160421f6e651bb": "Two-way",
8435 + "d3751f456814b2b2": "{count, plural, one {# machine needs a pairing code} other {# machines each need a pairing code}}",
8436 + "e0a8e0b87dca8241": "Link one with a code…",
8437 + "ad095a37f818d67e": "Linked machines",
8438 + "afc01d2ee8048b4b": "{label}, selected",
8439 + "aa34f7bc5aaf6bb0": "Map of your machines",
8440 + "edb6cb27ff7f446b": "Arrow keys move between machines. Enter opens a machine's details, with its routes and links. Space selects a machine for linking several at once. Tab from an environment reaches its link button. Plus and minus zoom, zero fits the map.",
8441 + "753b4a8ec5521c98": "Link from {source} to {target}: {summary}",
8442 + "bb6a74a47a3852c7": "Expired",
8443 + "3076117d81a9c1c0": "Not answering",
8444 + "96fdb2fd529b1fbb": "Failing",
8445 + "8971602c42718d72": "Reachable",
8446 + "1b256867b95ee022": "{days, plural, one {Expires in {days} day} other {Expires in {days} days}}",
8447 + "9d02cb328944fb27": "Two-way link between {source} and {target}, {access}. {source} to {target}: {forward}. {target} to {source}: {back}",
8448 + "aae31cf2017dab5b": "Public",
8449 + "b4f6c341033a3c91": "Switched off",
8450 + "960255d19109dcd9": "Need an update",
8451 + "19f6a3505837907d": "{access}. {reachable} of {count} reachable",
8452 + "6f8f71c20ba546af": "{reachable} of {count} reachable, from {sources} environments",
8453 + "0d731c951986fac8": "{group}: {count} environments with no links, {range}",
8454 + "5feb96736385be01": "{range}, {count} machines linked from {sources}. {summary}",
8455 + "706ac721bf99036c": "{machines, plural, one {# machine} other {# machines}}",
8456 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {None reachable} other {# reachable}}",
8457 + "35b783cfc817cb6f": "Collapse these machines",
8458 + "14dcd5c89fd0f67f": "Show the first {shown} machines on the map",
8459 + "b8f2d917d3a592df": "Show each machine on the map",
8460 + "ddc2106217bbde2d": "and {count} more",
8461 + "b0d81579d80fb94a": "known only through a link",
8462 + "2d3dc930fd1cdd55": "from {source}: {summary}",
8463 + "911bc3bcde1aba3b": "{count, plural, one {# link in} other {# links in}}",
8464 + "930f9e01fc4591b4": "Off",
8465 + "0fecb34fd1ae531f": "{label}, on your T3 Connect account, not added to this app. {status}",
8466 + "4a84ad9b7f8e4909": "Loading links…",
8467 + "9c88c8e716354091": "Links could not be loaded",
8468 + "f9733c7b64c6f5d9": "Linked environments is off",
8469 + "ba30444f6d79cbdd": "Links not readable from here",
8470 + "6a34b35812bb4ad0": "{count, plural, =0 {No links out} one {# link out} other {# links out}}",
8471 + "5d252c8bbc3b24d0": "{status}. Links unknown",
8472 + "ec2c609c028d63b4": "Link {label} to another machine",
8473 + "0a72d33781010657": "Cannot link to this",
8474 + "e93eaf3bfa0ff76b": "{count, plural, one {Link to # machine} other {Link to # machines}}",
8475 + "96bd315e3441c52a": "Renew link to {target}",
8476 + "9f752f912897416a": "Link to {target}",
8477 + "b40f4891ccc7af6d": "Renew link to {target} with a pairing code",
8478 + "d51a7a2bb6b8c406": "Link to {target} with a pairing code",
8479 + "f4ca5e62fb54a3a7": "Drop on a machine to link",
8480 + "11e67016507a6daa": "Two links, one each way.",
8481 + "352169e91766aeb4": "{count, plural, one {# needs attention} other {# need attention}}",
8482 + "d53ada50331e6041": "{machines, plural, one {# machine} other {# machines}}, {links, plural, =0 {no links} one {# link} other {# links}}",
8483 + "3e8441af6148878f": "Expires {date}",
8484 + "4daaa2288b63a801": "{count, plural, one {# link in} other {# links in}}",
8485 + "baf297d0add1d61b": "{count, plural, one {# environment} other {# environments}}",
8486 + "ddb9150bfa8ce6f0": "No links",
8487 + "a780bc462b60c3c0": "Collapse",
8488 + "059c335b1da34f63": "Show on map",
8489 + "c7e1635b229d7249": "Filter these machines by name",
8490 + "52a07016be1bea99": "Filter by name",
8491 + "a7061489aec79ba8": "{shown} of {count}",
8492 + "eefe994332120d82": "Link",
8493 + "c20e4b94dddc33e7": "{connected} of {total} connected",
8494 + "c7a9759d8578279f": "Each line from here is a saved route to an environment.",
8495 + "398cee23ca4dabec": "{count, plural, =0 {No known machine links here} one {Linked from # machine} other {Linked from # machines}}",
8496 + "79e98f4a48d3df43": "Add {label} to this app to connect to it.",
8497 + "da2990354cbe0fab": "Known only through a link",
8498 + "dfaeed73f86107ea": "Not connected, so its links are not shown.",
8499 + "2ff64d143a690a99": "To link from {label}, turn on Linked environments in its Labs settings.",
8500 + "eb3226bab4946cfa": "This app may not read the links {label} holds.",
8501 + "59bb2a50641eb2a9": "Could not load the links {label} holds: {error}",
8502 + "58cb9c075da185fb": "Loading linked environments…",
8503 + "126e2b7a117f01d5": "{count, plural, =0 {Links to no one} one {Links to # machine} other {Links to # machines}}",
8504 + "285d95a8e5ad0ec5": "links to",
8505 + "ee2a5f5571bca358": "Link back…",
8506 + "57f38a04b1e5c033": "Forgetting…",
8507 + "20ffe8337f8f30ba": "Forget",
8508 + "1f221fe54654ed13": "Access",
8509 + "8b0cd4f77cc74c37": "Status",
8510 + "33386c89f3b07fea": "Expired. Link it again with a new pairing code.",
8511 + "13d91e967cd9065c": "Not answering right now.",
8512 + "42e613ac8acac777": "{days, plural, one {Expires in {days} day. Link it again to renew.} other {Expires in {days} days. Link it again to renew.}}",
8513 + "0990edee7035bcfe": "Expires",
8514 + "1c161c630d28d225": "Addresses",
8515 + "7ee376c7db73ab57": "Linked",
8516 + "e9f7a62ecd609a46": "Last reached",
8517 "70bae47e93a2f207": "Show full error",
8518 "e4099af6d85770ff": "\"{font}\" isn't monospace",
8519 "a8448493d83279e2": "Code and terminal need a fixed-width font, so the current font was kept.",
@@ -8725,35 +8837,42 @@
8837 "03ce9bea5f88ddbd": "This app cannot confirm it is one of your machines. The pairing code you paste is sent there.",
8838 "30b696434167411f": "Linked",
8839 "80bbda74ee500b82": "Machine",
8840 + "4e7b0a3ced2d0f97": "Link several environments",
8841 + "0f3a6d9b3350d800": "Link several machines from {source}",
8842 "e5ac7abeaeb78750": "Select none",
8843 "ab520df47bca22d2": "Select all",
8844 "3a57c9bbcd12529f": "Could not check which machines are already linked, so none can be picked: {error}",
8845 + "4381e144bbeaddb2": "Linked both ways",
8846 + "692450a6537f52a8": "Linked one way",
8847 "78ccf685018ef797": "Linked",
8848 + "956b5c20a1fba7c1": "Could not link back: {reason}",
8849 + "641c3b24cbc7d86b": "{count, plural, one {# machine needs a pairing code, so it is not listed.} other {# machines need a pairing code, so they are not listed.}}",
8850 "87433cf138dc3e2c": "{linked, plural, one {Linked # machine.} other {Linked # machines.}}",
8851 "d044bb95248da10c": "Linked {linked} of {total}. The ones that failed stay selected, so you can try them again.",
8852 + "079237b461191c9a": "{count, plural, one {# machine could not link back.} other {# machines could not link back.}}",
8853 + "86d17c42dae16356": "Also link each machine back to {source}",
8854 + "23fd4db8faa1a001": "Agents there can then work on {source} too.",
8855 + "35d59319f62bd505": "{count, plural, one {# machine stays one-way.} other {# machines stay one-way.}}",
8856 "d2fbaffe08b6cf60": "{count, plural, one {Link # machine} other {Link # machines}}",
8857 "8e3378b526d615f4": "Link several…",
8736 - "7f8d6d1af69829d8": "Link several environments",
8858 "b550d04490078bda": "Agents here can then launch, message and wait on threads on each machine you pick. Each appears under Authorized clients in that machine's Sharing & access, where it can be revoked.",
8859 + "e1c2c3bd84d7bcd7": "This app is not connected to any of the machines you picked.",
8860 "c2553b323479499a": "This app knows no other machines. Add them under Environments first.",
8861 "18b1d4d42b945b34": "Machines",
8862 "03860d65c4052ab5": "Checking which machines are already linked…",
8863 "4cea6be0fe6be16f": "Could not load linked environments",
8742 - "58cb9c075da185fb": "Loading linked environments…",
8864 "25b74062dc03079e": "No linked environments",
8865 "6698127fcc912f23": "Link another machine running T3 Code, such as a VPS, so agents here can launch and drive threads there.",
8745 - "ad5ed0ce61b966eb": "Forget {label}? Agents here stop working there. Revoke \"T3 Code · …\" in {label}''s Sharing & access to end the session there too.",
8746 - "81c9796bf61b306a": "Could not forget the link",
8747 - "33386c89f3b07fea": "Expired. Link it again with a new pairing code.",
8748 - "13d91e967cd9065c": "Not answering right now.",
8749 - "42e613ac8acac777": "{days, plural, one {Expires in {days} day. Link it again to renew.} other {Expires in {days} days. Link it again to renew.}}",
8750 - "8971602c42718d72": "Reachable",
8751 - "57f38a04b1e5c033": "Forgetting…",
8752 - "20ffe8337f8f30ba": "Forget",
8866 "e1789f863205ad5a": "Could not link the environment",
8867 + "836dde1b729e6f0a": "Linked {source} and {target} both ways",
8868 "40cde51afa218290": "Linked {label}",
8755 - "eefe994332120d82": "Link",
8869 + "ca4e4015b89ed9a8": "Could not link {target} back to {source}",
8870 + "64ac3d1579ca9f5b": "Link {source} to {target}",
8871 "fb71127e5746a6bc": "From Sharing & access there, or t3 pair",
8872 + "1e3fee7084791773": "Also link {target} back to {source}",
8873 + "ea34a190b0bd804c": "Agents on {target} can then work on {source} too.",
8874 + "ad5ed0ce61b966eb": "Forget {label}? Agents here stop working there. Revoke \"T3 Code · …\" in {label}''s Sharing & access to end the session there too.",
8875 + "81c9796bf61b306a": "Could not forget the link",
8876 "130e51beb6cf5aad": "Link an environment",
8877 "122c3e355699e69d": "Agents here can then launch, message and wait on threads there. It appears under Authorized clients in that environment's Sharing & access, where it can be revoked.",
8878 "dc9a0b68d101e904": "Already linked. Linking again renews it with the access you pick.",
@@ -9441,7 +9560,6 @@
9560 "e3349eb2353ee27c": "Approval for new devices is off, so a revoked device signed in to your T3 Connect account can connect again on its own.",
9561 "080160002915c666": "Require approval for new devices",
9562 "73dd0f86f5363431": "The device has to be approved here before it can connect again.",
9444 - "930f9e01fc4591b4": "Off",
9563 "6c7762bd72cea808": "Reconnecting: {error}",
9564 "6cced6a88a19f1f2": "Reconnecting",
9565 "8cbb63fdff9fde72": "Connection failed: {error}",
@@ -11710,7 +11828,6 @@
11828 "8ac2984f4e732091": "turn off on disable enable local server agents remote only restart",
11829 "3a54b8d98911331a": "Network access",
11830 "1a31308f0884a68b": "expose backend remote pairing local machine interfaces host restart",
11713 - "468d32c6b30df608": "Tailscale HTTPS",
11831 "92c2528040ca7442": "serve magicdns endpoint remote secure network",
11832 "ab23b9c923cc4e80": "windows subsystem linux distro second server projects stop windows backend restart wsl only",
11833 "814c6f3ba7c29f7c": "managed tunnel cloud other devices remote tunnels limit t3 chat",
apps/web/src/i18n/translations/es.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Esta app no está conectada a ella",
79 "95f18b6ad4a409de": "Tu sesión allí no puede crear códigos de emparejamiento",
80 "26847ec0357c8600": "Ninguna dirección a la que pueda llegar otra máquina",
81 + "ec1a698b0821ec66": "{target} no puede vincularse de vuelta: Entornos vinculados está desactivado allí.",
82 + "6cf74ace5a766699": "{target} no puede vincularse de vuelta: tu sesión allí no puede crear vínculos.",
83 + "a995255a0f303086": "{target} no puede vincularse de vuelta: tu sesión en {source} no puede crear códigos de emparejamiento.",
84 + "a51c8cdfccb5b4ca": "{target} no puede vincularse de vuelta: esta app no tiene ninguna dirección en la que pueda alcanzar a {source}.",
85 "cba6d3e3a22f2efe": "Inaccesible",
86 "0eb1a18deaf06b76": "Código de emparejamiento rechazado",
87 "7d6fc963ebf9a9c5": "Respondió otro entorno",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "El orden de rutas debe incluir cada ruta guardada una vez.",
487 "18de69e3b6ac3891": "El perfil de conexión {connectionId} no es una conexión bearer.",
488 "0a84ce2f4fb90d82": "El perfil de conexión {connectionId} no es una conexión SSH.",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "Enlace remoto",
491 "0b367ce72b45a911": "La conexión con {host} falló de forma inesperada.",
492 "91ca7e48f40bfa3c": "{host} no respondió durante la configuración de la conexión.",
@@ -8091,6 +8096,9 @@
8096 "d087da5017f20fa2": "No hay ningún entorno seleccionado",
8097 "cb553d31c9d1b1c7": "Conecta un entorno para ver sus ajustes y su acceso.",
8098 "9a84dc0e80037e05": "Esta app",
8099 + "3d96310c2214fe2d": "Mostrar entornos como",
8100 + "41e0e5e03e07db42": "Mapa",
8101 + "3a8adb207fb5e078": "Lista",
8102 "493685e264877b13": "Mostrando el acceso de",
8103 "5b2287f7b10cfa2f": "Sin conexión",
8104 "03f150efa96ec728": "Cambiar a Windows",
@@ -8392,6 +8400,110 @@
8400 "191fa21f1cfda1ef": "El host rechazó el inicio de sesión de este dispositivo. Vuelve a emparejar esta dirección con Añadir ruta.",
8401 "219bc3612d646a01": "Quitar ruta",
8402 "b2877341429675aa": "vía {route}",
8403 + "537e7cf4df7a0af1": "Este navegador",
8404 + "d18ad97175bd2028": "Mayús-clic o Mayús-arrastrar para seleccionar varias",
8405 + "692153ec34a9a7bd": "Buscar una máquina en el mapa",
8406 + "288ab5c45a9539a3": "Buscar una máquina",
8407 + "c263859f8bcc7b1c": "Ninguna máquina con ese nombre",
8408 + "ebe6ecf547a0636b": "{count, plural, one {# coincidencia} other {# coincidencias}}",
8409 + "2bb44d78cb85c097": "{count, plural, one {# seleccionada} other {# seleccionadas}}",
8410 + "bcf01a26153f6425": "Borrar",
8411 + "d9665bd69e7fd4f4": "Vincular varias…",
8412 + "8d5882faf1e5fb96": "Desde {source}",
8413 + "2b9e6257e6995ada": "Cómo usar el mapa",
8414 + "743b93767ec7ebf8": "Selecciona una máquina para gestionarla.",
8415 + "49712bceec027141": "Arrastra un más sobre una máquina para vincularlas.",
8416 + "aba23d86b0f4b66b": "Un vínculo llega a una máquina y termina ahí.",
8417 + "601e0c9e6a45a54f": "Ajustar el mapa a la vista",
8418 + "feec58f6653f5673": "Cómo leer las líneas",
8419 + "46e0a0c6ff391521": "En uso",
8420 + "1151e8a9fb7bdfcf": "En espera",
8421 + "a322337b6655de2a": "Sin usar",
8422 + "e31c7e76ef900ef4": "Inicio de sesión rechazado",
8423 + "c032d479f9bbb166": "Vínculo",
8424 + "d4160421f6e651bb": "Bidireccional",
8425 + "d3751f456814b2b2": "{count, plural, one {# máquina necesita un código de emparejamiento} other {# máquinas necesitan cada una un código de emparejamiento}}",
8426 + "e0a8e0b87dca8241": "Vincular una con un código…",
8427 + "ad095a37f818d67e": "Máquinas vinculadas",
8428 + "afc01d2ee8048b4b": "{label}, seleccionada",
8429 + "aa34f7bc5aaf6bb0": "Mapa de tus máquinas",
8430 + "edb6cb27ff7f446b": "Las flechas mueven entre máquinas. Intro abre los detalles de una máquina, con sus rutas y vínculos. Espacio selecciona una máquina para vincular varias a la vez. Tab desde un entorno llega a su botón de vincular. Más y menos hacen zoom, cero ajusta el mapa.",
8431 + "753b4a8ec5521c98": "Vínculo de {source} a {target}: {summary}",
8432 + "bb6a74a47a3852c7": "Caducado",
8433 + "3076117d81a9c1c0": "No responde",
8434 + "96fdb2fd529b1fbb": "Con errores",
8435 + "8971602c42718d72": "Accesible",
8436 + "1b256867b95ee022": "{days, plural, one {Caduca en {days} día} other {Caduca en {days} días}}",
8437 + "9d02cb328944fb27": "Vínculo en ambos sentidos entre {source} y {target}, {access}. De {source} a {target}: {forward}. De {target} a {source}: {back}",
8438 + "aae31cf2017dab5b": "Pública",
8439 + "b4f6c341033a3c91": "Apagados",
8440 + "960255d19109dcd9": "Necesitan actualización",
8441 + "19f6a3505837907d": "{access}. {reachable} de {count} accesibles",
8442 + "6f8f71c20ba546af": "{reachable} de {count} accesibles, desde {sources} entornos",
8443 + "0d731c951986fac8": "{group}: {count} entornos sin vínculos, {range}",
8444 + "5feb96736385be01": "{range}, {count} máquinas vinculadas desde {sources}. {summary}",
8445 + "706ac721bf99036c": "{machines, plural, one {# máquina} other {# máquinas}}",
8446 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {Ninguna accesible} one {# accesible} other {# accesibles}}",
8447 + "35b783cfc817cb6f": "Contraer estas máquinas",
8448 + "14dcd5c89fd0f67f": "Mostrar las primeras {shown} máquinas en el mapa",
8449 + "b8f2d917d3a592df": "Mostrar cada máquina en el mapa",
8450 + "ddc2106217bbde2d": "y {count} más",
8451 + "b0d81579d80fb94a": "conocida solo por un vínculo",
8452 + "2d3dc930fd1cdd55": "desde {source}: {summary}",
8453 + "911bc3bcde1aba3b": "{count, plural, one {# vínculo entrante} other {# vínculos entrantes}}",
8454 + "930f9e01fc4591b4": "Desactivado",
8455 + "0fecb34fd1ae531f": "{label}, en tu cuenta de T3 Connect, no añadida a esta app. {status}",
8456 + "4a84ad9b7f8e4909": "Cargando vínculos…",
8457 + "9c88c8e716354091": "No se pudieron cargar los vínculos",
8458 + "f9733c7b64c6f5d9": "Entornos vinculados está desactivado",
8459 + "ba30444f6d79cbdd": "Vínculos no legibles desde aquí",
8460 + "6a34b35812bb4ad0": "{count, plural, =0 {Sin vínculos salientes} one {# vínculo saliente} other {# vínculos salientes}}",
8461 + "5d252c8bbc3b24d0": "{status}. Vínculos desconocidos",
8462 + "ec2c609c028d63b4": "Vincular {label} con otra máquina",
8463 + "0a72d33781010657": "No se puede vincular con esto",
8464 + "e93eaf3bfa0ff76b": "{count, plural, one {Vincular a # máquina} other {Vincular a # máquinas}}",
8465 + "96bd315e3441c52a": "Renovar el vínculo con {target}",
8466 + "9f752f912897416a": "Vincular con {target}",
8467 + "b40f4891ccc7af6d": "Renovar el vínculo con {target} con un código de emparejamiento",
8468 + "d51a7a2bb6b8c406": "Vincular con {target} con un código de emparejamiento",
8469 + "f4ca5e62fb54a3a7": "Suelta sobre una máquina para vincular",
8470 + "11e67016507a6daa": "Dos vínculos, uno en cada sentido.",
8471 + "352169e91766aeb4": "{count, plural, one {# requiere atención} other {# requieren atención}}",
8472 + "d53ada50331e6041": "{machines, plural, one {# máquina} other {# máquinas}}, {links, plural, =0 {sin vínculos} one {# vínculo} other {# vínculos}}",
8473 + "3e8441af6148878f": "Caduca el {date}",
8474 + "4daaa2288b63a801": "{count, plural, one {# vínculo entrante} other {# vínculos entrantes}}",
8475 + "baf297d0add1d61b": "{count, plural, one {# entorno} other {# entornos}}",
8476 + "ddb9150bfa8ce6f0": "Sin vínculos",
8477 + "a780bc462b60c3c0": "Contraer",
8478 + "059c335b1da34f63": "Mostrar en el mapa",
8479 + "c7e1635b229d7249": "Filtrar estas máquinas por nombre",
8480 + "52a07016be1bea99": "Filtrar por nombre",
8481 + "a7061489aec79ba8": "{shown} de {count}",
8482 + "eefe994332120d82": "Vincular",
8483 + "c20e4b94dddc33e7": "{connected} de {total} conectados",
8484 + "c7a9759d8578279f": "Cada línea que sale de aquí es una ruta guardada hacia un entorno.",
8485 + "398cee23ca4dabec": "{count, plural, =0 {Ninguna máquina conocida vincula aquí} one {Vinculada desde # máquina} other {Vinculada desde # máquinas}}",
8486 + "79e98f4a48d3df43": "Añade {label} a esta app para conectarte.",
8487 + "da2990354cbe0fab": "Conocida solo por un vínculo",
8488 + "dfaeed73f86107ea": "No conectada, así que sus vínculos no se muestran.",
8489 + "2ff64d143a690a99": "Para vincular desde {label}, activa Entornos vinculados en sus ajustes de Experimentos.",
8490 + "eb3226bab4946cfa": "Esta app no tiene permiso para leer los vínculos de {label}.",
8491 + "59bb2a50641eb2a9": "No se pudieron cargar los vínculos de {label}: {error}",
8492 + "58cb9c075da185fb": "Cargando entornos vinculados…",
8493 + "126e2b7a117f01d5": "{count, plural, =0 {No vincula con ninguna máquina} one {Vincula con # máquina} other {Vincula con # máquinas}}",
8494 + "285d95a8e5ad0ec5": "vincula con",
8495 + "ee2a5f5571bca358": "Vincular de vuelta…",
8496 + "57f38a04b1e5c033": "Olvidando…",
8497 + "20ffe8337f8f30ba": "Olvidar",
8498 + "1f221fe54654ed13": "Acceso",
8499 + "8b0cd4f77cc74c37": "Estado",
8500 + "33386c89f3b07fea": "Caducado. Vuelve a vincularlo con un código de emparejamiento nuevo.",
8501 + "13d91e967cd9065c": "No responde en este momento.",
8502 + "42e613ac8acac777": "{days, plural, one {Caduca en {days} día. Vuelve a vincularlo para renovarlo.} other {Caduca en {days} días. Vuelve a vincularlo para renovarlo.}}",
8503 + "0990edee7035bcfe": "Caduca",
8504 + "1c161c630d28d225": "Direcciones",
8505 + "7ee376c7db73ab57": "Vinculado",
8506 + "e9f7a62ecd609a46": "Último contacto",
8507 "70bae47e93a2f207": "Mostrar error completo",
8508 "e4099af6d85770ff": "\"{font}\" no es monoespaciada",
8509 "a8448493d83279e2": "El código y la terminal necesitan una fuente de ancho fijo, así que se mantuvo la fuente actual.",
@@ -8715,35 +8827,42 @@
8827 "03ce9bea5f88ddbd": "Esta app no puede confirmar que sea una de tus máquinas. El código de emparejamiento que pegues se envía allí.",
8828 "30b696434167411f": "Vinculado",
8829 "80bbda74ee500b82": "Máquina",
8830 + "4e7b0a3ced2d0f97": "Vincular varios entornos",
8831 + "0f3a6d9b3350d800": "Vincular varias máquinas desde {source}",
8832 "e5ac7abeaeb78750": "No seleccionar nada",
8833 "ab520df47bca22d2": "Seleccionar todo",
8834 "3a57c9bbcd12529f": "No se pudo comprobar qué máquinas ya están vinculadas, así que no se puede elegir ninguna: {error}",
8835 + "4381e144bbeaddb2": "Vinculada en ambos sentidos",
8836 + "692450a6537f52a8": "Vinculada en un sentido",
8837 "78ccf685018ef797": "Vinculada",
8838 + "956b5c20a1fba7c1": "No se pudo vincular de vuelta: {reason}",
8839 + "641c3b24cbc7d86b": "{count, plural, one {# máquina necesita un código de emparejamiento, así que no aparece en la lista.} other {# máquinas necesitan un código de emparejamiento, así que no aparecen en la lista.}}",
8840 "87433cf138dc3e2c": "{linked, plural, one {Se vinculó # máquina.} other {Se vincularon # máquinas.}}",
8841 "d044bb95248da10c": "Se vincularon {linked} de {total}. Las que fallaron siguen seleccionadas para que puedas reintentarlas.",
8842 + "079237b461191c9a": "{count, plural, one {# máquina no pudo vincularse de vuelta.} other {# máquinas no pudieron vincularse de vuelta.}}",
8843 + "86d17c42dae16356": "Vincular también cada máquina de vuelta a {source}",
8844 + "23fd4db8faa1a001": "Los agentes de allí podrán trabajar también en {source}.",
8845 + "35d59319f62bd505": "{count, plural, one {# máquina queda vinculada en un sentido.} other {# máquinas quedan vinculadas en un sentido.}}",
8846 "d2fbaffe08b6cf60": "{count, plural, one {Vincular # máquina} other {Vincular # máquinas}}",
8847 "8e3378b526d615f4": "Vincular varios…",
8726 - "7f8d6d1af69829d8": "Vincular varios entornos",
8848 "b550d04490078bda": "Así los agentes de aquí podrán iniciar hilos en cada máquina que elijas, enviarles mensajes y esperarlos. Cada vínculo aparece en Clientes autorizados, en Compartir y acceso de esa máquina, donde se puede revocar.",
8849 + "e1c2c3bd84d7bcd7": "Esta app no está conectada a ninguna de las máquinas que elegiste.",
8850 "c2553b323479499a": "Esta app no conoce otras máquinas. Añádelas primero en Entornos.",
8851 "18b1d4d42b945b34": "Máquinas",
8852 "03860d65c4052ab5": "Comprobando qué máquinas ya están vinculadas…",
8853 "4cea6be0fe6be16f": "No se pudieron cargar los entornos vinculados",
8732 - "58cb9c075da185fb": "Cargando entornos vinculados…",
8854 "25b74062dc03079e": "No hay entornos vinculados",
8855 "6698127fcc912f23": "Vincula otra máquina que ejecute T3 Code, como un VPS, para que los agentes de aquí puedan iniciar y controlar hilos allí.",
8735 - "ad5ed0ce61b966eb": "¿Olvidar {label}? Los agentes de aquí dejarán de trabajar allí. Revoca \"T3 Code · …\" en Compartir y acceso de {label} para cerrar también la sesión allí.",
8736 - "81c9796bf61b306a": "No se pudo olvidar el vínculo",
8737 - "33386c89f3b07fea": "Caducado. Vuelve a vincularlo con un código de emparejamiento nuevo.",
8738 - "13d91e967cd9065c": "No responde en este momento.",
8739 - "42e613ac8acac777": "{days, plural, one {Caduca en {days} día. Vuelve a vincularlo para renovarlo.} other {Caduca en {days} días. Vuelve a vincularlo para renovarlo.}}",
8740 - "8971602c42718d72": "Accesible",
8741 - "57f38a04b1e5c033": "Olvidando…",
8742 - "20ffe8337f8f30ba": "Olvidar",
8856 "e1789f863205ad5a": "No se pudo vincular el entorno",
8857 + "836dde1b729e6f0a": "{source} y {target} vinculados en ambos sentidos",
8858 "40cde51afa218290": "{label} vinculado",
8745 - "eefe994332120d82": "Vincular",
8859 + "ca4e4015b89ed9a8": "No se pudo vincular {target} de vuelta a {source}",
8860 + "64ac3d1579ca9f5b": "Vincular {source} con {target}",
8861 "fb71127e5746a6bc": "Desde Compartir y acceso allí, o t3 pair",
8862 + "1e3fee7084791773": "Vincular también {target} de vuelta a {source}",
8863 + "ea34a190b0bd804c": "Los agentes de {target} podrán trabajar también en {source}.",
8864 + "ad5ed0ce61b966eb": "¿Olvidar {label}? Los agentes de aquí dejarán de trabajar allí. Revoca \"T3 Code · …\" en Compartir y acceso de {label} para cerrar también la sesión allí.",
8865 + "81c9796bf61b306a": "No se pudo olvidar el vínculo",
8866 "130e51beb6cf5aad": "Vincular un entorno",
8867 "122c3e355699e69d": "Así los agentes de aquí podrán iniciar hilos allí, enviarles mensajes y esperarlos. Aparece en Clientes autorizados, en Compartir y acceso de ese entorno, donde se puede revocar.",
8868 "dc9a0b68d101e904": "Ya está vinculado. Vincularlo de nuevo lo renueva con el acceso que elijas.",
@@ -9429,7 +9548,6 @@
9548 "e3349eb2353ee27c": "La aprobación de nuevos dispositivos está desactivada, así que un dispositivo revocado con sesión iniciada en tu cuenta de T3 Connect puede volver a conectarse por sí solo.",
9549 "080160002915c666": "Requerir aprobación para dispositivos nuevos",
9550 "73dd0f86f5363431": "El dispositivo tiene que aprobarse aquí antes de poder volver a conectarse.",
9432 - "930f9e01fc4591b4": "Desactivado",
9551 "6c7762bd72cea808": "Reconectando: {error}",
9552 "6cced6a88a19f1f2": "Reconectando",
9553 "8cbb63fdff9fde72": "Falló la conexión: {error}",
@@ -11695,7 +11813,6 @@
11813 "8ac2984f4e732091": "apagar encender desactivar activar servidor local agentes solo remoto reiniciar",
11814 "3a54b8d98911331a": "Acceso a la red",
11815 "1a31308f0884a68b": "exponer backend remoto emparejamiento máquina local interfaces host reiniciar",
11698 - "468d32c6b30df608": "Tailscale HTTPS",
11816 "92c2528040ca7442": "serve magicdns endpoint remoto seguro red",
11817 "ab23b9c923cc4e80": "windows subsistema linux distro segundo servidor proyectos detener backend de windows reiniciar solo wsl",
11818 "814c6f3ba7c29f7c": "túnel gestionado nube otros dispositivos remoto túneles límite t3 chat",
apps/web/src/i18n/translations/fr.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Cette app n’y est pas connectée",
79 "95f18b6ad4a409de": "Votre session là-bas ne peut pas créer de codes d’appairage",
80 "26847ec0357c8600": "Aucune adresse joignable par une autre machine",
81 + "ec1a698b0821ec66": "{target} ne peut pas s’associer en retour : Environnements associés y est désactivé.",
82 + "6cf74ace5a766699": "{target} ne peut pas s’associer en retour : votre session là-bas ne peut pas créer d’associations.",
83 + "a995255a0f303086": "{target} ne peut pas s’associer en retour : votre session sur {source} ne peut pas créer de codes d’appairage.",
84 + "a51c8cdfccb5b4ca": "{target} ne peut pas s’associer en retour : cette app n’a aucune adresse à laquelle {source} est joignable.",
85 "cba6d3e3a22f2efe": "Injoignable",
86 "0eb1a18deaf06b76": "Code d’appairage refusé",
87 "7d6fc963ebf9a9c5": "Un autre environnement a répondu",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "L’ordre des routes doit lister chaque route enregistrée une seule fois.",
487 "18de69e3b6ac3891": "Le profil de connexion {connectionId} n’est pas une connexion bearer.",
488 "0a84ce2f4fb90d82": "Le profil de connexion {connectionId} n’est pas une connexion SSH.",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "Lien distant",
491 "0b367ce72b45a911": "La connexion à {host} a échoué de manière inattendue.",
492 "91ca7e48f40bfa3c": "{host} n’a pas répondu pendant la configuration de la connexion.",
@@ -8092,6 +8097,9 @@
8097 "d087da5017f20fa2": "Aucun environnement sélectionné",
8098 "cb553d31c9d1b1c7": "Connectez un environnement pour voir ses paramètres et ses accès.",
8099 "9a84dc0e80037e05": "Cette app",
8100 + "3d96310c2214fe2d": "Afficher les environnements en",
8101 + "41e0e5e03e07db42": "Carte",
8102 + "3a8adb207fb5e078": "Liste",
8103 "493685e264877b13": "Accès affichés pour",
8104 "5b2287f7b10cfa2f": "Hors ligne",
8105 "03f150efa96ec728": "Passer à Windows",
@@ -8393,6 +8401,110 @@
8401 "191fa21f1cfda1ef": "L’hôte a refusé la connexion de cet appareil. Appairez à nouveau cette adresse avec Ajouter une route.",
8402 "219bc3612d646a01": "Supprimer la route",
8403 "b2877341429675aa": "via {route}",
8404 + "537e7cf4df7a0af1": "Ce navigateur",
8405 + "d18ad97175bd2028": "Maj-clic ou Maj-glisser pour en sélectionner plusieurs",
8406 + "692153ec34a9a7bd": "Trouver une machine sur la carte",
8407 + "288ab5c45a9539a3": "Trouver une machine",
8408 + "c263859f8bcc7b1c": "Aucune machine de ce nom",
8409 + "ebe6ecf547a0636b": "{count, plural, one {# résultat} other {# résultats}}",
8410 + "2bb44d78cb85c097": "{count, plural, one {# sélectionnée} other {# sélectionnées}}",
8411 + "bcf01a26153f6425": "Effacer",
8412 + "d9665bd69e7fd4f4": "Lier plusieurs…",
8413 + "8d5882faf1e5fb96": "Depuis {source}",
8414 + "2b9e6257e6995ada": "Comment utiliser la carte",
8415 + "743b93767ec7ebf8": "Sélectionnez une machine pour la gérer.",
8416 + "49712bceec027141": "Faites glisser un plus sur une machine pour les associer.",
8417 + "aba23d86b0f4b66b": "Une association atteint une machine et s’arrête là.",
8418 + "601e0c9e6a45a54f": "Ajuster la carte à la vue",
8419 + "feec58f6653f5673": "Comment lire les lignes",
8420 + "46e0a0c6ff391521": "Utilisée",
8421 + "1151e8a9fb7bdfcf": "En attente",
8422 + "a322337b6655de2a": "Non utilisée",
8423 + "e31c7e76ef900ef4": "Connexion refusée",
8424 + "c032d479f9bbb166": "Association",
8425 + "d4160421f6e651bb": "Dans les deux sens",
8426 + "d3751f456814b2b2": "{count, plural, one {# machine nécessite un code d’appairage} other {# machines nécessitent chacune un code d’appairage}}",
8427 + "e0a8e0b87dca8241": "Associer une machine avec un code…",
8428 + "ad095a37f818d67e": "Machines associées",
8429 + "afc01d2ee8048b4b": "{label}, sélectionnée",
8430 + "aa34f7bc5aaf6bb0": "Carte de vos machines",
8431 + "edb6cb27ff7f446b": "Les flèches déplacent entre les machines. Entrée ouvre les détails d'une machine, avec ses routes et ses liens. Espace sélectionne une machine pour en lier plusieurs à la fois. Tab depuis un environnement atteint son bouton de lien. Plus et moins zooment, zéro ajuste la carte.",
8432 + "753b4a8ec5521c98": "Association de {source} vers {target} : {summary}",
8433 + "bb6a74a47a3852c7": "Expirée",
8434 + "3076117d81a9c1c0": "Ne répond pas",
8435 + "96fdb2fd529b1fbb": "En échec",
8436 + "8971602c42718d72": "Joignable",
8437 + "1b256867b95ee022": "{days, plural, one {Expire dans {days} jour} other {Expire dans {days} jours}}",
8438 + "9d02cb328944fb27": "Association dans les deux sens entre {source} et {target}, {access}. De {source} vers {target} : {forward}. De {target} vers {source} : {back}",
8439 + "aae31cf2017dab5b": "Publique",
8440 + "b4f6c341033a3c91": "Désactivés",
8441 + "960255d19109dcd9": "Mise à jour requise",
8442 + "19f6a3505837907d": "{access}. {reachable} sur {count} joignables",
8443 + "6f8f71c20ba546af": "{reachable} sur {count} joignables, depuis {sources} environnements",
8444 + "0d731c951986fac8": "{group} : {count} environnements sans lien, {range}",
8445 + "5feb96736385be01": "{range}, {count} machines liées depuis {sources}. {summary}",
8446 + "706ac721bf99036c": "{machines, plural, one {# machine} other {# machines}}",
8447 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {Aucune joignable} one {# joignable} other {# joignables}}",
8448 + "35b783cfc817cb6f": "Replier ces machines",
8449 + "14dcd5c89fd0f67f": "Afficher les {shown} premières machines sur la carte",
8450 + "b8f2d917d3a592df": "Afficher chaque machine sur la carte",
8451 + "ddc2106217bbde2d": "et {count} de plus",
8452 + "b0d81579d80fb94a": "connue uniquement par une association",
8453 + "2d3dc930fd1cdd55": "depuis {source} : {summary}",
8454 + "911bc3bcde1aba3b": "{count, plural, one {# association entrante} other {# associations entrantes}}",
8455 + "930f9e01fc4591b4": "Éteint",
8456 + "0fecb34fd1ae531f": "{label}, sur votre compte T3 Connect, non ajoutée à cette app. {status}",
8457 + "4a84ad9b7f8e4909": "Chargement des associations…",
8458 + "9c88c8e716354091": "Impossible de charger les associations",
8459 + "f9733c7b64c6f5d9": "Environnements associés est désactivé",
8460 + "ba30444f6d79cbdd": "Associations illisibles d’ici",
8461 + "6a34b35812bb4ad0": "{count, plural, =0 {Aucune association sortante} one {# association sortante} other {# associations sortantes}}",
8462 + "5d252c8bbc3b24d0": "{status}. Associations inconnues",
8463 + "ec2c609c028d63b4": "Associer {label} à une autre machine",
8464 + "0a72d33781010657": "Association impossible avec cet élément",
8465 + "e93eaf3bfa0ff76b": "{count, plural, one {Associer à # machine} other {Associer à # machines}}",
8466 + "96bd315e3441c52a": "Renouveler l’association avec {target}",
8467 + "9f752f912897416a": "Associer à {target}",
8468 + "b40f4891ccc7af6d": "Renouveler l’association avec {target} avec un code d’appairage",
8469 + "d51a7a2bb6b8c406": "Associer à {target} avec un code d’appairage",
8470 + "f4ca5e62fb54a3a7": "Déposez sur une machine pour associer",
8471 + "11e67016507a6daa": "Deux associations, une dans chaque sens.",
8472 + "352169e91766aeb4": "{count, plural, one {# demande votre attention} other {# demandent votre attention}}",
8473 + "d53ada50331e6041": "{machines, plural, one {# machine} other {# machines}}, {links, plural, =0 {aucune association} one {# association} other {# associations}}",
8474 + "3e8441af6148878f": "Expire le {date}",
8475 + "4daaa2288b63a801": "{count, plural, one {# lien entrant} other {# liens entrants}}",
8476 + "baf297d0add1d61b": "{count, plural, one {# environnement} other {# environnements}}",
8477 + "ddb9150bfa8ce6f0": "Aucune association",
8478 + "a780bc462b60c3c0": "Replier",
8479 + "059c335b1da34f63": "Afficher sur la carte",
8480 + "c7e1635b229d7249": "Filtrer ces machines par nom",
8481 + "52a07016be1bea99": "Filtrer par nom",
8482 + "a7061489aec79ba8": "{shown} sur {count}",
8483 + "eefe994332120d82": "Associer",
8484 + "c20e4b94dddc33e7": "{connected} sur {total} connectés",
8485 + "c7a9759d8578279f": "Chaque ligne partant d’ici est une route enregistrée vers un environnement.",
8486 + "398cee23ca4dabec": "{count, plural, =0 {Aucune machine connue n’est associée ici} one {Associé depuis # machine} other {Associé depuis # machines}}",
8487 + "79e98f4a48d3df43": "Ajoutez {label} à cette app pour vous y connecter.",
8488 + "da2990354cbe0fab": "Connue uniquement par une association",
8489 + "dfaeed73f86107ea": "Non connectée, ses associations ne sont donc pas affichées.",
8490 + "2ff64d143a690a99": "Pour associer depuis {label}, activez Environnements associés dans ses réglages Labs.",
8491 + "eb3226bab4946cfa": "Cette app n’est pas autorisée à lire les associations de {label}.",
8492 + "59bb2a50641eb2a9": "Impossible de charger les associations de {label} : {error}",
8493 + "58cb9c075da185fb": "Chargement des environnements associés…",
8494 + "126e2b7a117f01d5": "{count, plural, =0 {Associé à aucune machine} one {Associé à # machine} other {Associé à # machines}}",
8495 + "285d95a8e5ad0ec5": "est associé à",
8496 + "ee2a5f5571bca358": "Associer en retour…",
8497 + "57f38a04b1e5c033": "Oubli en cours…",
8498 + "20ffe8337f8f30ba": "Oublier",
8499 + "1f221fe54654ed13": "Accès",
8500 + "8b0cd4f77cc74c37": "État",
8501 + "33386c89f3b07fea": "Expirée. Associez-la à nouveau avec un nouveau code d’appairage.",
8502 + "13d91e967cd9065c": "Ne répond pas pour le moment.",
8503 + "42e613ac8acac777": "{days, plural, one {Expire dans {days} jour. Associez-la à nouveau pour la renouveler.} other {Expire dans {days} jours. Associez-la à nouveau pour la renouveler.}}",
8504 + "0990edee7035bcfe": "Expire",
8505 + "1c161c630d28d225": "Adresses",
8506 + "7ee376c7db73ab57": "Associé",
8507 + "e9f7a62ecd609a46": "Dernier contact",
8508 "70bae47e93a2f207": "Afficher l’erreur complète",
8509 "e4099af6d85770ff": "« {font} » n’est pas à chasse fixe",
8510 "a8448493d83279e2": "Le code et le terminal nécessitent une police à chasse fixe, la police actuelle a donc été conservée.",
@@ -8717,35 +8829,42 @@
8829 "03ce9bea5f88ddbd": "Cette app ne peut pas confirmer qu’il s’agit de l’une de vos machines. Le code d’appairage que vous collez y est envoyé.",
8830 "30b696434167411f": "Associé",
8831 "80bbda74ee500b82": "Machine",
8832 + "4e7b0a3ced2d0f97": "Associer plusieurs environnements",
8833 + "0f3a6d9b3350d800": "Lier plusieurs machines depuis {source}",
8834 "e5ac7abeaeb78750": "Tout désélectionner",
8835 "ab520df47bca22d2": "Tout sélectionner",
8836 "3a57c9bbcd12529f": "Impossible de vérifier quelles machines sont déjà associées ; aucune ne peut donc être choisie : {error}",
8837 + "4381e144bbeaddb2": "Associée dans les deux sens",
8838 + "692450a6537f52a8": "Associée dans un seul sens",
8839 "78ccf685018ef797": "Associée",
8840 + "956b5c20a1fba7c1": "Impossible d’associer en retour : {reason}",
8841 + "641c3b24cbc7d86b": "{count, plural, one {# machine nécessite un code d’appairage, elle n’est donc pas listée.} other {# machines nécessitent un code d’appairage, elles ne sont donc pas listées.}}",
8842 "87433cf138dc3e2c": "{linked, plural, one {# machine associée.} other {# machines associées.}}",
8843 "d044bb95248da10c": "{linked} sur {total} associées. Celles qui ont échoué restent sélectionnées pour que vous puissiez réessayer.",
8844 + "079237b461191c9a": "{count, plural, one {# machine n’a pas pu s’associer en retour.} other {# machines n’ont pas pu s’associer en retour.}}",
8845 + "86d17c42dae16356": "Associer aussi chaque machine en retour à {source}",
8846 + "23fd4db8faa1a001": "Les agents de ces machines pourront alors aussi travailler sur {source}.",
8847 + "35d59319f62bd505": "{count, plural, one {# machine reste associée dans un seul sens.} other {# machines restent associées dans un seul sens.}}",
8848 "d2fbaffe08b6cf60": "{count, plural, one {Associer # machine} other {Associer # machines}}",
8849 "8e3378b526d615f4": "Associer plusieurs…",
8728 - "7f8d6d1af69829d8": "Associer plusieurs environnements",
8850 "b550d04490078bda": "Les agents d’ici pourront alors lancer des fils sur chaque machine choisie, leur envoyer des messages et les attendre. Chaque association apparaît sous Clients autorisés dans Partage et accès de la machine concernée, où elle peut être révoquée.",
8851 + "e1c2c3bd84d7bcd7": "Cette app n’est connectée à aucune des machines choisies.",
8852 "c2553b323479499a": "Cette app ne connaît aucune autre machine. Ajoutez-les d’abord dans Environnements.",
8853 "18b1d4d42b945b34": "Machines",
8854 "03860d65c4052ab5": "Vérification des machines déjà associées…",
8855 "4cea6be0fe6be16f": "Impossible de charger les environnements associés",
8734 - "58cb9c075da185fb": "Chargement des environnements associés…",
8856 "25b74062dc03079e": "Aucun environnement associé",
8857 "6698127fcc912f23": "Associez une autre machine qui exécute T3 Code, comme un VPS, pour que les agents d’ici puissent y lancer et piloter des fils.",
8737 - "ad5ed0ce61b966eb": "Oublier {label} ? Les agents d’ici cessent d’y travailler. Révoquez « T3 Code · … » dans Partage et accès sur {label} pour y fermer aussi la session.",
8738 - "81c9796bf61b306a": "Impossible d’oublier l’association",
8739 - "33386c89f3b07fea": "Expirée. Associez-la à nouveau avec un nouveau code d’appairage.",
8740 - "13d91e967cd9065c": "Ne répond pas pour le moment.",
8741 - "42e613ac8acac777": "{days, plural, one {Expire dans {days} jour. Associez-la à nouveau pour la renouveler.} other {Expire dans {days} jours. Associez-la à nouveau pour la renouveler.}}",
8742 - "8971602c42718d72": "Joignable",
8743 - "57f38a04b1e5c033": "Oubli en cours…",
8744 - "20ffe8337f8f30ba": "Oublier",
8858 "e1789f863205ad5a": "Impossible d’associer l’environnement",
8859 + "836dde1b729e6f0a": "{source} et {target} associés dans les deux sens",
8860 "40cde51afa218290": "{label} associé",
8747 - "eefe994332120d82": "Associer",
8861 + "ca4e4015b89ed9a8": "Impossible d’associer {target} en retour à {source}",
8862 + "64ac3d1579ca9f5b": "Associer {source} à {target}",
8863 "fb71127e5746a6bc": "Depuis Partage et accès sur cette machine, ou t3 pair",
8864 + "1e3fee7084791773": "Associer aussi {target} en retour à {source}",
8865 + "ea34a190b0bd804c": "Les agents de {target} pourront alors aussi travailler sur {source}.",
8866 + "ad5ed0ce61b966eb": "Oublier {label} ? Les agents d’ici cessent d’y travailler. Révoquez « T3 Code · … » dans Partage et accès sur {label} pour y fermer aussi la session.",
8867 + "81c9796bf61b306a": "Impossible d’oublier l’association",
8868 "130e51beb6cf5aad": "Associer un environnement",
8869 "122c3e355699e69d": "Les agents d’ici pourront alors lancer des fils là-bas, leur envoyer des messages et les attendre. L’association apparaît sous Clients autorisés dans Partage et accès de cet environnement, où elle peut être révoquée.",
8870 "dc9a0b68d101e904": "Déjà associé. Associer à nouveau renouvelle l’association avec l’accès que vous choisissez.",
@@ -9431,7 +9550,6 @@
9550 "e3349eb2353ee27c": "L’approbation des nouveaux appareils est désactivée : un appareil révoqué connecté à votre compte T3 Connect peut donc se reconnecter de lui-même.",
9551 "080160002915c666": "Exiger l’approbation des nouveaux appareils",
9552 "73dd0f86f5363431": "L’appareil doit être approuvé ici avant de pouvoir se reconnecter.",
9434 - "930f9e01fc4591b4": "Éteint",
9553 "6c7762bd72cea808": "Reconnexion : {error}",
9554 "6cced6a88a19f1f2": "Reconnexion",
9555 "8cbb63fdff9fde72": "Échec de la connexion : {error}",
@@ -11700,7 +11818,6 @@
11818 "8ac2984f4e732091": "désactiver activer serveur local agents distant uniquement redémarrer",
11819 "3a54b8d98911331a": "Accès réseau",
11820 "1a31308f0884a68b": "exposer backend distant appairage machine locale interfaces hôte redémarrer",
11703 - "468d32c6b30df608": "Tailscale HTTPS",
11821 "92c2528040ca7442": "serve magicdns point de terminaison distant sécurisé réseau",
11822 "ab23b9c923cc4e80": "windows sous-système linux distribution second serveur projets arrêter backend windows redémarrer wsl uniquement",
11823 "814c6f3ba7c29f7c": "tunnel géré cloud autres appareils tunnels distants limite t3 chat",
apps/web/src/i18n/translations/ja.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "このアプリはこのマシンに接続していません",
79 "95f18b6ad4a409de": "そのマシンでのセッションではペアリングコードを作成できません",
80 "26847ec0357c8600": "他のマシンから到達できるアドレスがありません",
81 + "ec1a698b0821ec66": "{target} からは逆方向にリンクできません: そのマシンではリンクされた環境がオフです。",
82 + "6cf74ace5a766699": "{target} からは逆方向にリンクできません: そのマシンでのセッションではリンクを作成できません。",
83 + "a995255a0f303086": "{target} からは逆方向にリンクできません: {source} でのセッションではペアリングコードを作成できません。",
84 + "a51c8cdfccb5b4ca": "{target} からは逆方向にリンクできません: このアプリには {source} に到達できるアドレスがありません。",
85 "cba6d3e3a22f2efe": "到達不能",
86 "0eb1a18deaf06b76": "ペアリングコードが拒否されました",
87 "7d6fc963ebf9a9c5": "別の環境が応答しました",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "ルートの順序には、保存されたすべてのルートを 1 回ずつ含める必要があります。",
487 "18de69e3b6ac3891": "接続プロファイル {connectionId} はベアラー接続ではありません。",
488 "0a84ce2f4fb90d82": "接続プロファイル {connectionId} は SSH 接続ではありません。",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "リモートリンク",
491 "0b367ce72b45a911": "{host} への接続が予期せず失敗しました。",
492 "91ca7e48f40bfa3c": "{host} は接続のセットアップ中に応答しませんでした。",
@@ -8052,6 +8057,9 @@
8057 "d087da5017f20fa2": "環境が選択されていません",
8058 "cb553d31c9d1b1c7": "設定とアクセスを表示するには、環境を接続してください。",
8059 "9a84dc0e80037e05": "このアプリ",
8060 + "3d96310c2214fe2d": "環境の表示形式",
8061 + "41e0e5e03e07db42": "マップ",
8062 + "3a8adb207fb5e078": "リスト",
8063 "493685e264877b13": "アクセスを表示する対象",
8064 "5b2287f7b10cfa2f": "オフライン",
8065 "03f150efa96ec728": "Windows に切り替え",
@@ -8350,6 +8358,110 @@
8358 "191fa21f1cfda1ef": "ホストがこのデバイスのサインインを拒否しました。「ルートを追加」でこのアドレスを再度ペアリングしてください。",
8359 "219bc3612d646a01": "ルートを削除",
8360 "b2877341429675aa": "{route} 経由",
8361 + "537e7cf4df7a0af1": "このブラウザ",
8362 + "d18ad97175bd2028": "Shift+クリックまたはShift+ドラッグで複数選択",
8363 + "692153ec34a9a7bd": "マップでマシンを検索",
8364 + "288ab5c45a9539a3": "マシンを検索",
8365 + "c263859f8bcc7b1c": "その名前のマシンはありません",
8366 + "ebe6ecf547a0636b": "{count, plural, other {#件一致}}",
8367 + "2bb44d78cb85c097": "{count, plural, other {#件選択中}}",
8368 + "bcf01a26153f6425": "クリア",
8369 + "d9665bd69e7fd4f4": "複数をリンク…",
8370 + "8d5882faf1e5fb96": "{source} から",
8371 + "2b9e6257e6995ada": "マップの使い方",
8372 + "743b93767ec7ebf8": "マシンを選択すると管理できます。",
8373 + "49712bceec027141": "プラスをマシンにドラッグするとリンクできます。",
8374 + "aba23d86b0f4b66b": "リンクは 1 台のマシンに届き、そこで止まります。",
8375 + "601e0c9e6a45a54f": "マップ全体を表示",
8376 + "feec58f6653f5673": "線の見方",
8377 + "46e0a0c6ff391521": "使用中",
8378 + "1151e8a9fb7bdfcf": "待機中",
8379 + "a322337b6655de2a": "未使用",
8380 + "e31c7e76ef900ef4": "サインインが拒否されました",
8381 + "c032d479f9bbb166": "リンク",
8382 + "d4160421f6e651bb": "双方向",
8383 + "d3751f456814b2b2": "{count, plural, other {# 台のマシンそれぞれにペアリングコードが必要}}",
8384 + "e0a8e0b87dca8241": "コードで 1 台をリンク…",
8385 + "ad095a37f818d67e": "リンク先のマシン",
8386 + "afc01d2ee8048b4b": "{label}、選択中",
8387 + "aa34f7bc5aaf6bb0": "マシンのマップ",
8388 + "edb6cb27ff7f446b": "矢印キーでマシン間を移動します。Enterでマシンの詳細(ルートとリンク)を開きます。Spaceで複数を一度にリンクするためにマシンを選択します。環境からTabでリンクボタンに移動します。プラスとマイナスでズーム、ゼロでマップ全体を表示します。",
8389 + "753b4a8ec5521c98": "{source} から {target} へのリンク: {summary}",
8390 + "bb6a74a47a3852c7": "期限切れ",
8391 + "3076117d81a9c1c0": "応答なし",
8392 + "96fdb2fd529b1fbb": "失敗中",
8393 + "8971602c42718d72": "到達可能",
8394 + "1b256867b95ee022": "{days, plural, other {{days} 日後に期限切れ}}",
8395 + "9d02cb328944fb27": "{source} と {target} の双方向リンク、{access}。{source} から {target}: {forward}。{target} から {source}: {back}",
8396 + "aae31cf2017dab5b": "パブリック",
8397 + "b4f6c341033a3c91": "オフ",
8398 + "960255d19109dcd9": "アップデートが必要",
8399 + "19f6a3505837907d": "{access}。{count} 台中 {reachable} 台が到達可能",
8400 + "6f8f71c20ba546af": "{count}台中{reachable}台に到達可能、{sources}個の環境から",
8401 + "0d731c951986fac8": "{group}: リンクのない環境 {count} 個、{range}",
8402 + "5feb96736385be01": "{range}、{sources} からリンクされた {count} 台のマシン。{summary}",
8403 + "706ac721bf99036c": "{machines, plural, other {# 台のマシン}}",
8404 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {到達可能なし} other {#台に到達可能}}",
8405 + "35b783cfc817cb6f": "これらのマシンを折りたたむ",
8406 + "14dcd5c89fd0f67f": "最初の {shown} 台をマップに表示",
8407 + "b8f2d917d3a592df": "各マシンをマップに表示",
8408 + "ddc2106217bbde2d": "ほか {count} 台",
8409 + "b0d81579d80fb94a": "リンク経由でのみ把握",
8410 + "2d3dc930fd1cdd55": "{source} から: {summary}",
8411 + "911bc3bcde1aba3b": "{count, plural, other {内向きのリンク # 件}}",
8412 + "930f9e01fc4591b4": "オフ",
8413 + "0fecb34fd1ae531f": "{label}、T3 Connect アカウントにあり、このアプリには未追加。{status}",
8414 + "4a84ad9b7f8e4909": "リンクを読み込んでいます…",
8415 + "9c88c8e716354091": "リンクを読み込めませんでした",
8416 + "f9733c7b64c6f5d9": "リンクされた環境はオフです",
8417 + "ba30444f6d79cbdd": "ここからはリンクを読み取れません",
8418 + "6a34b35812bb4ad0": "{count, plural, =0 {外向きのリンクなし} other {外向きのリンク # 件}}",
8419 + "5d252c8bbc3b24d0": "{status}。リンクは不明",
8420 + "ec2c609c028d63b4": "{label} を別のマシンにリンク",
8421 + "0a72d33781010657": "これにはリンクできません",
8422 + "e93eaf3bfa0ff76b": "{count, plural, other {#台のマシンにリンク}}",
8423 + "96bd315e3441c52a": "{target} へのリンクを更新",
8424 + "9f752f912897416a": "{target} にリンク",
8425 + "b40f4891ccc7af6d": "ペアリングコードで {target} へのリンクを更新",
8426 + "d51a7a2bb6b8c406": "ペアリングコードで {target} にリンク",
8427 + "f4ca5e62fb54a3a7": "マシンにドロップしてリンク",
8428 + "11e67016507a6daa": "リンク 2 本(各方向に 1 本)。",
8429 + "352169e91766aeb4": "{count, plural, other {# 件に対応が必要}}",
8430 + "d53ada50331e6041": "{machines, plural, other {マシン # 台}}、{links, plural, =0 {リンクなし} other {リンク # 件}}",
8431 + "3e8441af6148878f": "{date} に期限切れ",
8432 + "4daaa2288b63a801": "{count, plural, other {受信リンク #件}}",
8433 + "baf297d0add1d61b": "{count, plural, other {#個の環境}}",
8434 + "ddb9150bfa8ce6f0": "リンクなし",
8435 + "a780bc462b60c3c0": "折りたたむ",
8436 + "059c335b1da34f63": "マップに表示",
8437 + "c7e1635b229d7249": "これらのマシンを名前で絞り込む",
8438 + "52a07016be1bea99": "名前で絞り込む",
8439 + "a7061489aec79ba8": "{count} 件中 {shown} 件",
8440 + "eefe994332120d82": "リンク",
8441 + "c20e4b94dddc33e7": "{total} 件中 {connected} 件に接続",
8442 + "c7a9759d8578279f": "ここから出る線はそれぞれ、環境への保存済みルートです。",
8443 + "398cee23ca4dabec": "{count, plural, =0 {ここにリンクしている既知のマシンはありません} other {# 台のマシンからリンク}}",
8444 + "79e98f4a48d3df43": "接続するには {label} をこのアプリに追加してください。",
8445 + "da2990354cbe0fab": "リンク経由でのみ把握",
8446 + "dfaeed73f86107ea": "未接続のため、リンクは表示されません。",
8447 + "2ff64d143a690a99": "{label} からリンクするには、{label} の「試験的機能」設定でリンクされた環境をオンにしてください。",
8448 + "eb3226bab4946cfa": "このアプリには {label} のリンクを読み取る権限がありません。",
8449 + "59bb2a50641eb2a9": "{label} のリンクを読み込めませんでした: {error}",
8450 + "58cb9c075da185fb": "リンクされた環境を読み込んでいます…",
8451 + "126e2b7a117f01d5": "{count, plural, =0 {リンク先なし} other {リンク先 # 台}}",
8452 + "285d95a8e5ad0ec5": "→",
8453 + "ee2a5f5571bca358": "逆方向もリンク…",
8454 + "57f38a04b1e5c033": "削除中…",
8455 + "20ffe8337f8f30ba": "削除",
8456 + "1f221fe54654ed13": "アクセス権",
8457 + "8b0cd4f77cc74c37": "状態",
8458 + "33386c89f3b07fea": "期限切れです。新しいペアリングコードで再度リンクしてください。",
8459 + "13d91e967cd9065c": "現在応答していません。",
8460 + "42e613ac8acac777": "{days, plural, other {あと {days} 日で期限切れになります。更新するには再度リンクしてください。}}",
8461 + "0990edee7035bcfe": "有効期限",
8462 + "1c161c630d28d225": "アドレス",
8463 + "7ee376c7db73ab57": "リンク日時",
8464 + "e9f7a62ecd609a46": "最終到達",
8465 "70bae47e93a2f207": "エラー全体を表示",
8466 "e4099af6d85770ff": "「{font}」は等幅フォントではありません",
8467 "a8448493d83279e2": "コードとターミナルには固定幅フォントが必要なため、現在のフォントを維持しました。",
@@ -8673,35 +8785,42 @@
8785 "03ce9bea5f88ddbd": "このアプリでは、これがあなたのマシンかどうかを確認できません。貼り付けたペアリングコードはそのアドレスに送信されます。",
8786 "30b696434167411f": "リンク済み",
8787 "80bbda74ee500b82": "マシン",
8788 + "4e7b0a3ced2d0f97": "複数の環境をリンク",
8789 + "0f3a6d9b3350d800": "{source} から複数のマシンをリンク",
8790 "e5ac7abeaeb78750": "選択を解除",
8791 "ab520df47bca22d2": "すべて選択",
8792 "3a57c9bbcd12529f": "どのマシンがリンク済みかを確認できなかったため、選択できません: {error}",
8793 + "4381e144bbeaddb2": "双方向にリンク済み",
8794 + "692450a6537f52a8": "片方向のみリンク済み",
8795 "78ccf685018ef797": "リンク済み",
8796 + "956b5c20a1fba7c1": "逆方向のリンクに失敗しました: {reason}",
8797 + "641c3b24cbc7d86b": "{count, plural, other {# 台のマシンはペアリングコードが必要なため、一覧に表示されません。}}",
8798 "87433cf138dc3e2c": "{linked, plural, other {# 台のマシンをリンクしました。}}",
8799 "d044bb95248da10c": "{total} 台中 {linked} 台をリンクしました。失敗したマシンは選択されたままなので、もう一度試せます。",
8800 + "079237b461191c9a": "{count, plural, other {# 台のマシンは逆方向にリンクできませんでした。}}",
8801 + "86d17c42dae16356": "各マシンから {source} へも逆方向にリンクする",
8802 + "23fd4db8faa1a001": "そのマシンのエージェントも {source} で作業できるようになります。",
8803 + "35d59319f62bd505": "{count, plural, other {# 台のマシンは片方向のままです。}}",
8804 "d2fbaffe08b6cf60": "{count, plural, other {# 台のマシンをリンク}}",
8805 "8e3378b526d615f4": "複数をリンク…",
8684 - "7f8d6d1af69829d8": "複数の環境をリンク",
8806 "b550d04490078bda": "これで、ここのエージェントが選択した各マシンでスレッドを起動し、メッセージを送り、完了を待てるようになります。各リンクはそのマシンの「共有とアクセス」の「承認済みクライアント」に表示され、そこで取り消せます。",
8807 + "e1c2c3bd84d7bcd7": "このアプリは、選択したどのマシンにも接続していません。",
8808 "c2553b323479499a": "このアプリは他のマシンを認識していません。先に「環境」で追加してください。",
8809 "18b1d4d42b945b34": "マシン",
8810 "03860d65c4052ab5": "リンク済みのマシンを確認しています…",
8811 "4cea6be0fe6be16f": "リンクされた環境を読み込めませんでした",
8690 - "58cb9c075da185fb": "リンクされた環境を読み込んでいます…",
8812 "25b74062dc03079e": "リンクされた環境はありません",
8813 "6698127fcc912f23": "VPS など T3 Code を実行している別のマシンをリンクすると、ここのエージェントがそこでスレッドを起動して操作できます。",
8693 - "ad5ed0ce61b966eb": "{label} を削除しますか?ここのエージェントはそこで作業できなくなります。そこでのセッションも終了するには、{label} の「共有とアクセス」で \"T3 Code · …\" を取り消してください。",
8694 - "81c9796bf61b306a": "リンクを削除できませんでした",
8695 - "33386c89f3b07fea": "期限切れです。新しいペアリングコードで再度リンクしてください。",
8696 - "13d91e967cd9065c": "現在応答していません。",
8697 - "42e613ac8acac777": "{days, plural, other {あと {days} 日で期限切れになります。更新するには再度リンクしてください。}}",
8698 - "8971602c42718d72": "到達可能",
8699 - "57f38a04b1e5c033": "削除中…",
8700 - "20ffe8337f8f30ba": "削除",
8814 "e1789f863205ad5a": "環境をリンクできませんでした",
8815 + "836dde1b729e6f0a": "{source} と {target} を双方向にリンクしました",
8816 "40cde51afa218290": "{label} をリンクしました",
8703 - "eefe994332120d82": "リンク",
8817 + "ca4e4015b89ed9a8": "{target} から {source} へ逆方向にリンクできませんでした",
8818 + "64ac3d1579ca9f5b": "{source} を {target} にリンク",
8819 "fb71127e5746a6bc": "リンク先の「共有とアクセス」、または t3 pair から",
8820 + "1e3fee7084791773": "{target} から {source} へも逆方向にリンクする",
8821 + "ea34a190b0bd804c": "{target} のエージェントも {source} で作業できるようになります。",
8822 + "ad5ed0ce61b966eb": "{label} を削除しますか?ここのエージェントはそこで作業できなくなります。そこでのセッションも終了するには、{label} の「共有とアクセス」で \"T3 Code · …\" を取り消してください。",
8823 + "81c9796bf61b306a": "リンクを削除できませんでした",
8824 "130e51beb6cf5aad": "環境をリンク",
8825 "122c3e355699e69d": "これで、ここのエージェントがそこでスレッドを起動し、メッセージを送り、完了を待てるようになります。リンクはその環境の「共有とアクセス」の「承認済みクライアント」に表示され、そこで取り消せます。",
8826 "dc9a0b68d101e904": "すでにリンクされています。再度リンクすると、選択したアクセス権で更新されます。",
@@ -9386,7 +9505,6 @@
9505 "e3349eb2353ee27c": "新しいデバイスの承認がオフになっているため、T3 Connect アカウントにサインインしている取り消し済みのデバイスは自動的に再接続できます。",
9506 "080160002915c666": "新しいデバイスに承認を要求",
9507 "73dd0f86f5363431": "再接続する前に、ここでデバイスを承認する必要があります。",
9389 - "930f9e01fc4591b4": "オフ",
9508 "6c7762bd72cea808": "再接続中: {error}",
9509 "6cced6a88a19f1f2": "再接続中",
9510 "8cbb63fdff9fde72": "接続に失敗しました: {error}",
@@ -11650,7 +11768,6 @@
11768 "8ac2984f4e732091": "オフ オン 無効 有効 ローカルサーバー エージェント リモートのみ 再起動 local server",
11769 "3a54b8d98911331a": "ネットワークアクセス",
11770 "1a31308f0884a68b": "公開 バックエンド リモート ペアリング ローカルマシン インターフェイス ホスト 再起動 expose",
11653 - "468d32c6b30df608": "Tailscale HTTPS",
11771 "92c2528040ca7442": "serve MagicDNS エンドポイント リモート 安全 ネットワーク tailscale",
11772 "ab23b9c923cc4e80": "Windows Subsystem for Linux ディストリビューション 2 つ目のサーバー プロジェクト 停止 Windows バックエンド 再起動 WSL のみ wsl",
11773 "814c6f3ba7c29f7c": "マネージドトンネル クラウド 他のデバイス リモート トンネル 上限 T3 Chat tunnel",
apps/web/src/i18n/translations/ko.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "이 앱이 해당 머신에 연결되어 있지 않습니다",
79 "95f18b6ad4a409de": "그곳의 세션으로는 페어링 코드를 만들 수 없습니다",
80 "26847ec0357c8600": "다른 머신이 접근할 수 있는 주소가 없습니다",
81 + "ec1a698b0821ec66": "{target}에서 반대 방향으로 연결할 수 없습니다. 그곳에서 연결된 환경이 꺼져 있습니다.",
82 + "6cf74ace5a766699": "{target}에서 반대 방향으로 연결할 수 없습니다. 그곳의 세션으로는 링크를 만들 수 없습니다.",
83 + "a995255a0f303086": "{target}에서 반대 방향으로 연결할 수 없습니다. {source}의 세션으로는 페어링 코드를 만들 수 없습니다.",
84 + "a51c8cdfccb5b4ca": "{target}에서 반대 방향으로 연결할 수 없습니다. 이 앱에 {source}에 도달할 수 있는 주소가 없습니다.",
85 "cba6d3e3a22f2efe": "연결할 수 없음",
86 "0eb1a18deaf06b76": "페어링 코드가 거부됨",
87 "7d6fc963ebf9a9c5": "다른 환경이 응답함",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "경로 순서에는 저장된 모든 경로가 한 번씩 있어야 합니다.",
487 "18de69e3b6ac3891": "연결 프로필 {connectionId}은(는) bearer 연결이 아닙니다.",
488 "0a84ce2f4fb90d82": "연결 프로필 {connectionId}은(는) SSH 연결이 아닙니다.",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "원격 링크",
491 "0b367ce72b45a911": "{host} 연결이 예기치 않게 실패했습니다.",
492 "91ca7e48f40bfa3c": "{host}이(가) 연결 설정 중에 응답하지 않았습니다.",
@@ -8054,6 +8059,9 @@
8059 "d087da5017f20fa2": "선택된 환경 없음",
8060 "cb553d31c9d1b1c7": "설정과 액세스를 보려면 환경을 연결하세요.",
8061 "9a84dc0e80037e05": "이 앱",
8062 + "3d96310c2214fe2d": "환경 표시 방식",
8063 + "41e0e5e03e07db42": "지도",
8064 + "3a8adb207fb5e078": "목록",
8065 "493685e264877b13": "액세스 표시 대상",
8066 "5b2287f7b10cfa2f": "오프라인",
8067 "03f150efa96ec728": "Windows로 전환",
@@ -8353,6 +8361,110 @@
8361 "191fa21f1cfda1ef": "호스트가 이 기기의 로그인을 거부했습니다. 경로 추가로 이 주소를 다시 페어링하세요.",
8362 "219bc3612d646a01": "경로 제거",
8363 "b2877341429675aa": "{route} 경유",
8364 + "537e7cf4df7a0af1": "이 브라우저",
8365 + "d18ad97175bd2028": "Shift+클릭 또는 Shift+드래그로 여러 개 선택",
8366 + "692153ec34a9a7bd": "지도에서 머신 찾기",
8367 + "288ab5c45a9539a3": "머신 찾기",
8368 + "c263859f8bcc7b1c": "그 이름의 머신이 없습니다",
8369 + "ebe6ecf547a0636b": "{count, plural, other {#개 일치}}",
8370 + "2bb44d78cb85c097": "{count, plural, other {#개 선택됨}}",
8371 + "bcf01a26153f6425": "지우기",
8372 + "d9665bd69e7fd4f4": "여러 개 연결…",
8373 + "8d5882faf1e5fb96": "{source}에서",
8374 + "2b9e6257e6995ada": "지도 사용법",
8375 + "743b93767ec7ebf8": "머신을 선택해 관리하세요.",
8376 + "49712bceec027141": "더하기를 머신으로 끌어다 놓으면 연결됩니다.",
8377 + "aba23d86b0f4b66b": "링크는 머신 한 대에 닿고 거기서 끝납니다.",
8378 + "601e0c9e6a45a54f": "지도를 화면에 맞추기",
8379 + "feec58f6653f5673": "선 읽는 법",
8380 + "46e0a0c6ff391521": "사용 중",
8381 + "1151e8a9fb7bdfcf": "대기",
8382 + "a322337b6655de2a": "사용 안 함",
8383 + "e31c7e76ef900ef4": "로그인 거부됨",
8384 + "c032d479f9bbb166": "링크",
8385 + "d4160421f6e651bb": "양방향",
8386 + "d3751f456814b2b2": "{count, plural, other {머신 #대에 각각 페어링 코드 필요}}",
8387 + "e0a8e0b87dca8241": "코드로 한 대 연결…",
8388 + "ad095a37f818d67e": "연결된 머신",
8389 + "afc01d2ee8048b4b": "{label}, 선택됨",
8390 + "aa34f7bc5aaf6bb0": "내 머신 지도",
8391 + "edb6cb27ff7f446b": "화살표 키로 머신 사이를 이동합니다. Enter는 머신의 세부 정보(경로와 연결)를 엽니다. Space는 여러 개를 한 번에 연결할 머신을 선택합니다. 환경에서 Tab을 누르면 연결 버튼으로 이동합니다. 더하기와 빼기로 확대/축소하고 0으로 지도를 맞춥니다.",
8392 + "753b4a8ec5521c98": "{source}에서 {target}(으)로의 링크: {summary}",
8393 + "bb6a74a47a3852c7": "만료됨",
8394 + "3076117d81a9c1c0": "응답 없음",
8395 + "96fdb2fd529b1fbb": "실패 중",
8396 + "8971602c42718d72": "연결 가능",
8397 + "1b256867b95ee022": "{days, plural, other {{days}일 후 만료}}",
8398 + "9d02cb328944fb27": "{source}와(과) {target} 사이의 양방향 링크, {access}. {source}에서 {target}: {forward}. {target}에서 {source}: {back}",
8399 + "aae31cf2017dab5b": "공개",
8400 + "b4f6c341033a3c91": "꺼짐",
8401 + "960255d19109dcd9": "업데이트 필요",
8402 + "19f6a3505837907d": "{access}. {count}대 중 {reachable}대 연결 가능",
8403 + "6f8f71c20ba546af": "{count}개 중 {reachable}개 연결 가능, 환경 {sources}개에서",
8404 + "0d731c951986fac8": "{group}: 연결 없는 환경 {count}개, {range}",
8405 + "5feb96736385be01": "{range}, {sources}에서 연결된 머신 {count}개. {summary}",
8406 + "706ac721bf99036c": "{machines, plural, other {머신 #대}}",
8407 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {연결 가능 없음} other {#대 연결 가능}}",
8408 + "35b783cfc817cb6f": "이 머신들 접기",
8409 + "14dcd5c89fd0f67f": "처음 {shown}개 머신을 지도에 표시",
8410 + "b8f2d917d3a592df": "각 머신을 지도에 표시",
8411 + "ddc2106217bbde2d": "외 {count}개",
8412 + "b0d81579d80fb94a": "링크를 통해서만 알려짐",
8413 + "2d3dc930fd1cdd55": "{source}에서: {summary}",
8414 + "911bc3bcde1aba3b": "{count, plural, other {들어오는 링크 #개}}",
8415 + "930f9e01fc4591b4": "꺼짐",
8416 + "0fecb34fd1ae531f": "{label}, T3 Connect 계정에 있으며 이 앱에 추가되지 않음. {status}",
8417 + "4a84ad9b7f8e4909": "링크 불러오는 중…",
8418 + "9c88c8e716354091": "링크를 불러올 수 없습니다",
8419 + "f9733c7b64c6f5d9": "연결된 환경이 꺼져 있음",
8420 + "ba30444f6d79cbdd": "여기서는 링크를 읽을 수 없음",
8421 + "6a34b35812bb4ad0": "{count, plural, =0 {나가는 링크 없음} other {나가는 링크 #개}}",
8422 + "5d252c8bbc3b24d0": "{status}. 링크 알 수 없음",
8423 + "ec2c609c028d63b4": "{label}을(를) 다른 머신에 연결",
8424 + "0a72d33781010657": "여기에는 연결할 수 없음",
8425 + "e93eaf3bfa0ff76b": "{count, plural, other {머신 #대에 연결}}",
8426 + "96bd315e3441c52a": "{target} 링크 갱신",
8427 + "9f752f912897416a": "{target}에 연결",
8428 + "b40f4891ccc7af6d": "페어링 코드로 {target} 링크 갱신",
8429 + "d51a7a2bb6b8c406": "페어링 코드로 {target}에 연결",
8430 + "f4ca5e62fb54a3a7": "머신에 놓아 연결",
8431 + "11e67016507a6daa": "링크 2개, 방향마다 하나.",
8432 + "352169e91766aeb4": "{count, plural, other {#개에 조치 필요}}",
8433 + "d53ada50331e6041": "{machines, plural, other {머신 #대}}, {links, plural, =0 {링크 없음} other {링크 #개}}",
8434 + "3e8441af6148878f": "{date}에 만료",
8435 + "4daaa2288b63a801": "{count, plural, other {들어오는 연결 #개}}",
8436 + "baf297d0add1d61b": "{count, plural, other {환경 #개}}",
8437 + "ddb9150bfa8ce6f0": "링크 없음",
8438 + "a780bc462b60c3c0": "접기",
8439 + "059c335b1da34f63": "지도에 표시",
8440 + "c7e1635b229d7249": "이 머신들을 이름으로 필터링",
8441 + "52a07016be1bea99": "이름으로 필터링",
8442 + "a7061489aec79ba8": "{count}개 중 {shown}개",
8443 + "eefe994332120d82": "연결",
8444 + "c20e4b94dddc33e7": "{total}개 중 {connected}개 연결됨",
8445 + "c7a9759d8578279f": "여기서 나가는 각 선은 환경으로 가는 저장된 경로입니다.",
8446 + "398cee23ca4dabec": "{count, plural, =0 {여기로 링크한 알려진 머신 없음} other {머신 #대에서 링크됨}}",
8447 + "79e98f4a48d3df43": "연결하려면 {label}을(를) 이 앱에 추가하세요.",
8448 + "da2990354cbe0fab": "링크를 통해서만 알려짐",
8449 + "dfaeed73f86107ea": "연결되지 않아 링크가 표시되지 않습니다.",
8450 + "2ff64d143a690a99": "{label}에서 링크하려면 해당 머신의 실험 기능 설정에서 연결된 환경을 켜세요.",
8451 + "eb3226bab4946cfa": "이 앱은 {label}의 링크를 읽을 권한이 없습니다.",
8452 + "59bb2a50641eb2a9": "{label}의 링크를 불러올 수 없습니다: {error}",
8453 + "58cb9c075da185fb": "연결된 환경 불러오는 중…",
8454 + "126e2b7a117f01d5": "{count, plural, =0 {링크한 머신 없음} other {머신 #대에 링크}}",
8455 + "285d95a8e5ad0ec5": "→",
8456 + "ee2a5f5571bca358": "반대 방향도 연결…",
8457 + "57f38a04b1e5c033": "삭제 중…",
8458 + "20ffe8337f8f30ba": "삭제",
8459 + "1f221fe54654ed13": "액세스 권한",
8460 + "8b0cd4f77cc74c37": "상태",
8461 + "33386c89f3b07fea": "만료되었습니다. 새 페어링 코드로 다시 연결하세요.",
8462 + "13d91e967cd9065c": "지금 응답하지 않습니다.",
8463 + "42e613ac8acac777": "{days, plural, other {{days}일 후 만료됩니다. 갱신하려면 다시 연결하세요.}}",
8464 + "0990edee7035bcfe": "만료",
8465 + "1c161c630d28d225": "주소",
8466 + "7ee376c7db73ab57": "링크한 날짜",
8467 + "e9f7a62ecd609a46": "마지막 연결",
8468 "70bae47e93a2f207": "전체 오류 표시",
8469 "e4099af6d85770ff": "\"{font}\"은(는) 고정폭 글꼴이 아닙니다",
8470 "a8448493d83279e2": "코드와 터미널에는 고정폭 글꼴이 필요하므로 현재 글꼴을 유지했습니다.",
@@ -8676,35 +8788,42 @@
8788 "03ce9bea5f88ddbd": "이 앱은 이 머신이 사용자의 머신인지 확인할 수 없습니다. 붙여 넣은 페어링 코드는 해당 주소로 전송됩니다.",
8789 "30b696434167411f": "연결됨",
8790 "80bbda74ee500b82": "머신",
8791 + "4e7b0a3ced2d0f97": "여러 환경 연결",
8792 + "0f3a6d9b3350d800": "{source}에서 여러 머신 연결",
8793 "e5ac7abeaeb78750": "선택 해제",
8794 "ab520df47bca22d2": "모두 선택",
8795 "3a57c9bbcd12529f": "어떤 머신이 이미 연결되어 있는지 확인하지 못해 선택할 수 없습니다: {error}",
8796 + "4381e144bbeaddb2": "양방향으로 연결됨",
8797 + "692450a6537f52a8": "한 방향으로만 연결됨",
8798 "78ccf685018ef797": "연결됨",
8799 + "956b5c20a1fba7c1": "반대 방향으로 연결할 수 없습니다: {reason}",
8800 + "641c3b24cbc7d86b": "{count, plural, other {머신 #대는 페어링 코드가 필요해 목록에 없습니다.}}",
8801 "87433cf138dc3e2c": "{linked, plural, other {머신 #대를 연결했습니다.}}",
8802 "d044bb95248da10c": "{total}대 중 {linked}대를 연결했습니다. 실패한 머신은 선택된 상태로 남아 있어 다시 시도할 수 있습니다.",
8803 + "079237b461191c9a": "{count, plural, other {머신 #대가 반대 방향으로 연결되지 않았습니다.}}",
8804 + "86d17c42dae16356": "각 머신에서 {source}(으)로도 반대 방향 연결",
8805 + "23fd4db8faa1a001": "그러면 그 머신의 에이전트도 {source}에서 작업할 수 있습니다.",
8806 + "35d59319f62bd505": "{count, plural, other {머신 #대는 한 방향으로만 유지됩니다.}}",
8807 "d2fbaffe08b6cf60": "{count, plural, other {머신 #대 연결}}",
8808 "8e3378b526d615f4": "여러 개 연결…",
8687 - "7f8d6d1af69829d8": "여러 환경 연결",
8809 "b550d04490078bda": "그러면 이곳의 에이전트가 선택한 각 머신에서 스레드를 시작하고, 메시지를 보내고, 기다릴 수 있습니다. 각 연결은 해당 머신의 공유 및 액세스에서 승인된 클라이언트에 표시되며 그곳에서 취소할 수 있습니다.",
8810 + "e1c2c3bd84d7bcd7": "이 앱이 선택한 머신 중 어느 것에도 연결되어 있지 않습니다.",
8811 "c2553b323479499a": "이 앱이 아는 다른 머신이 없습니다. 먼저 환경에서 추가하세요.",
8812 "18b1d4d42b945b34": "머신",
8813 "03860d65c4052ab5": "이미 연결된 머신을 확인하는 중…",
8814 "4cea6be0fe6be16f": "연결된 환경을 불러올 수 없습니다",
8693 - "58cb9c075da185fb": "연결된 환경 불러오는 중…",
8815 "25b74062dc03079e": "연결된 환경 없음",
8816 "6698127fcc912f23": "VPS처럼 T3 Code를 실행하는 다른 머신을 연결하면 이곳의 에이전트가 그곳에서 스레드를 시작하고 조작할 수 있습니다.",
8696 - "ad5ed0ce61b966eb": "{label}을(를) 삭제할까요? 이곳의 에이전트가 그곳에서 더 이상 작업하지 않습니다. 그곳의 세션도 끝내려면 {label}의 공유 및 액세스에서 \"T3 Code · …\"를 취소하세요.",
8697 - "81c9796bf61b306a": "링크를 삭제할 수 없습니다",
8698 - "33386c89f3b07fea": "만료되었습니다. 새 페어링 코드로 다시 연결하세요.",
8699 - "13d91e967cd9065c": "지금 응답하지 않습니다.",
8700 - "42e613ac8acac777": "{days, plural, other {{days}일 후 만료됩니다. 갱신하려면 다시 연결하세요.}}",
8701 - "8971602c42718d72": "연결 가능",
8702 - "57f38a04b1e5c033": "삭제 중…",
8703 - "20ffe8337f8f30ba": "삭제",
8817 "e1789f863205ad5a": "환경을 연결할 수 없습니다",
8818 + "836dde1b729e6f0a": "{source}와(과) {target}을(를) 양방향으로 연결함",
8819 "40cde51afa218290": "{label} 연결됨",
8706 - "eefe994332120d82": "연결",
8820 + "ca4e4015b89ed9a8": "{target}에서 {source}(으)로 반대 방향 연결을 할 수 없습니다",
8821 + "64ac3d1579ca9f5b": "{source}을(를) {target}에 연결",
8822 "fb71127e5746a6bc": "그곳의 공유 및 액세스 또는 t3 pair에서",
8823 + "1e3fee7084791773": "{target}에서 {source}(으)로도 반대 방향 연결",
8824 + "ea34a190b0bd804c": "그러면 {target}의 에이전트도 {source}에서 작업할 수 있습니다.",
8825 + "ad5ed0ce61b966eb": "{label}을(를) 삭제할까요? 이곳의 에이전트가 그곳에서 더 이상 작업하지 않습니다. 그곳의 세션도 끝내려면 {label}의 공유 및 액세스에서 \"T3 Code · …\"를 취소하세요.",
8826 + "81c9796bf61b306a": "링크를 삭제할 수 없습니다",
8827 "130e51beb6cf5aad": "환경 연결",
8828 "122c3e355699e69d": "그러면 이곳의 에이전트가 그곳에서 스레드를 시작하고, 메시지를 보내고, 기다릴 수 있습니다. 해당 환경의 공유 및 액세스에서 승인된 클라이언트에 표시되며 그곳에서 취소할 수 있습니다.",
8829 "dc9a0b68d101e904": "이미 연결되어 있습니다. 다시 연결하면 선택한 액세스 권한으로 갱신됩니다.",
@@ -9389,7 +9508,6 @@
9508 "e3349eb2353ee27c": "새 기기 승인이 꺼져 있으므로 T3 Connect 계정에 로그인한 취소된 기기가 스스로 다시 연결할 수 있습니다.",
9509 "080160002915c666": "새 기기 승인 필요",
9510 "73dd0f86f5363431": "기기가 다시 연결하려면 여기에서 승인을 받아야 합니다.",
9392 - "930f9e01fc4591b4": "꺼짐",
9511 "6c7762bd72cea808": "다시 연결 중: {error}",
9512 "6cced6a88a19f1f2": "다시 연결 중",
9513 "8cbb63fdff9fde72": "연결 실패: {error}",
@@ -11647,7 +11765,6 @@
11765 "8ac2984f4e732091": "끄기 켜기 사용 안 함 사용 로컬 서버 에이전트 원격 전용 다시 시작",
11766 "3a54b8d98911331a": "네트워크 액세스",
11767 "1a31308f0884a68b": "노출 백엔드 원격 페어링 로컬 머신 인터페이스 호스트 다시 시작",
11650 - "468d32c6b30df608": "Tailscale HTTPS",
11768 "92c2528040ca7442": "serve magicdns 엔드포인트 원격 보안 네트워크",
11769 "ab23b9c923cc4e80": "windows subsystem linux 배포판 두 번째 서버 프로젝트 중지 windows 백엔드 다시 시작 wsl 전용",
11770 "814c6f3ba7c29f7c": "관리형 터널 클라우드 다른 기기 원격 터널 한도 T3 Chat",
apps/web/src/i18n/translations/pt-BR.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Este app não está conectado a ela",
79 "95f18b6ad4a409de": "Sua sessão lá não pode criar códigos de pareamento",
80 "26847ec0357c8600": "Nenhum endereço que outra máquina consiga acessar",
81 + "ec1a698b0821ec66": "{target} não pode vincular de volta: Ambientes vinculados está desativado lá.",
82 + "6cf74ace5a766699": "{target} não pode vincular de volta: sua sessão lá não pode criar vínculos.",
83 + "a995255a0f303086": "{target} não pode vincular de volta: sua sessão em {source} não pode criar códigos de pareamento.",
84 + "a51c8cdfccb5b4ca": "{target} não pode vincular de volta: este app não tem um endereço em que {source} possa ser alcançado.",
85 "cba6d3e3a22f2efe": "Inacessível",
86 "0eb1a18deaf06b76": "Código de pareamento recusado",
87 "7d6fc963ebf9a9c5": "Outro ambiente respondeu",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "A ordem das rotas precisa listar cada rota salva uma vez.",
487 "18de69e3b6ac3891": "O perfil de conexão {connectionId} não é uma conexão bearer.",
488 "0a84ce2f4fb90d82": "O perfil de conexão {connectionId} não é uma conexão SSH.",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "Link remoto",
491 "0b367ce72b45a911": "A conexão com {host} falhou inesperadamente.",
492 "91ca7e48f40bfa3c": "{host} não respondeu durante a configuração da conexão.",
@@ -8091,6 +8096,9 @@
8096 "d087da5017f20fa2": "Nenhum ambiente selecionado",
8097 "cb553d31c9d1b1c7": "Conecte um ambiente para ver as configurações e o acesso dele.",
8098 "9a84dc0e80037e05": "Este app",
8099 + "3d96310c2214fe2d": "Mostrar ambientes como",
8100 + "41e0e5e03e07db42": "Mapa",
8101 + "3a8adb207fb5e078": "Lista",
8102 "493685e264877b13": "Mostrando o acesso de",
8103 "5b2287f7b10cfa2f": "Offline",
8104 "03f150efa96ec728": "Mudar para o Windows",
@@ -8392,6 +8400,110 @@
8400 "191fa21f1cfda1ef": "O host recusou o login deste dispositivo. Pareie este endereço novamente com Adicionar rota.",
8401 "219bc3612d646a01": "Remover rota",
8402 "b2877341429675aa": "via {route}",
8403 + "537e7cf4df7a0af1": "Este navegador",
8404 + "d18ad97175bd2028": "Shift-clique ou Shift-arraste para selecionar várias",
8405 + "692153ec34a9a7bd": "Encontrar uma máquina no mapa",
8406 + "288ab5c45a9539a3": "Encontrar uma máquina",
8407 + "c263859f8bcc7b1c": "Nenhuma máquina com esse nome",
8408 + "ebe6ecf547a0636b": "{count, plural, one {# resultado} other {# resultados}}",
8409 + "2bb44d78cb85c097": "{count, plural, one {# selecionada} other {# selecionadas}}",
8410 + "bcf01a26153f6425": "Limpar",
8411 + "d9665bd69e7fd4f4": "Vincular várias…",
8412 + "8d5882faf1e5fb96": "A partir de {source}",
8413 + "2b9e6257e6995ada": "Como usar o mapa",
8414 + "743b93767ec7ebf8": "Selecione uma máquina para gerenciá-la.",
8415 + "49712bceec027141": "Arraste um mais sobre uma máquina para vinculá-las.",
8416 + "aba23d86b0f4b66b": "Um vínculo chega a uma máquina e termina ali.",
8417 + "601e0c9e6a45a54f": "Ajustar o mapa à tela",
8418 + "feec58f6653f5673": "Como ler as linhas",
8419 + "46e0a0c6ff391521": "Em uso",
8420 + "1151e8a9fb7bdfcf": "Em espera",
8421 + "a322337b6655de2a": "Sem uso",
8422 + "e31c7e76ef900ef4": "Login recusado",
8423 + "c032d479f9bbb166": "Vínculo",
8424 + "d4160421f6e651bb": "Nos dois sentidos",
8425 + "d3751f456814b2b2": "{count, plural, one {# máquina precisa de um código de pareamento} other {# máquinas precisam cada uma de um código de pareamento}}",
8426 + "e0a8e0b87dca8241": "Vincular uma com um código…",
8427 + "ad095a37f818d67e": "Máquinas vinculadas",
8428 + "afc01d2ee8048b4b": "{label}, selecionada",
8429 + "aa34f7bc5aaf6bb0": "Mapa das suas máquinas",
8430 + "edb6cb27ff7f446b": "As setas movem entre máquinas. Enter abre os detalhes de uma máquina, com suas rotas e vínculos. Espaço seleciona uma máquina para vincular várias de uma vez. Tab a partir de um ambiente chega ao botão de vincular. Mais e menos dão zoom, zero ajusta o mapa.",
8431 + "753b4a8ec5521c98": "Vínculo de {source} para {target}: {summary}",
8432 + "bb6a74a47a3852c7": "Expirado",
8433 + "3076117d81a9c1c0": "Sem resposta",
8434 + "96fdb2fd529b1fbb": "Com falha",
8435 + "8971602c42718d72": "Acessível",
8436 + "1b256867b95ee022": "{days, plural, one {Expira em {days} dia} other {Expira em {days} dias}}",
8437 + "9d02cb328944fb27": "Vínculo nos dois sentidos entre {source} e {target}, {access}. De {source} para {target}: {forward}. De {target} para {source}: {back}",
8438 + "aae31cf2017dab5b": "Pública",
8439 + "b4f6c341033a3c91": "Desligados",
8440 + "960255d19109dcd9": "Precisam de atualização",
8441 + "19f6a3505837907d": "{access}. {reachable} de {count} acessíveis",
8442 + "6f8f71c20ba546af": "{reachable} de {count} acessíveis, a partir de {sources} ambientes",
8443 + "0d731c951986fac8": "{group}: {count} ambientes sem vínculos, {range}",
8444 + "5feb96736385be01": "{range}, {count} máquinas vinculadas a partir de {sources}. {summary}",
8445 + "706ac721bf99036c": "{machines, plural, one {# máquina} other {# máquinas}}",
8446 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {Nenhuma acessível} one {# acessível} other {# acessíveis}}",
8447 + "35b783cfc817cb6f": "Recolher estas máquinas",
8448 + "14dcd5c89fd0f67f": "Mostrar as primeiras {shown} máquinas no mapa",
8449 + "b8f2d917d3a592df": "Mostrar cada máquina no mapa",
8450 + "ddc2106217bbde2d": "e mais {count}",
8451 + "b0d81579d80fb94a": "conhecida apenas por um vínculo",
8452 + "2d3dc930fd1cdd55": "de {source}: {summary}",
8453 + "911bc3bcde1aba3b": "{count, plural, one {# vínculo de entrada} other {# vínculos de entrada}}",
8454 + "930f9e01fc4591b4": "Desligado",
8455 + "0fecb34fd1ae531f": "{label}, na sua conta do T3 Connect, não adicionada a este app. {status}",
8456 + "4a84ad9b7f8e4909": "Carregando vínculos…",
8457 + "9c88c8e716354091": "Não foi possível carregar os vínculos",
8458 + "f9733c7b64c6f5d9": "Ambientes vinculados está desativado",
8459 + "ba30444f6d79cbdd": "Vínculos não legíveis daqui",
8460 + "6a34b35812bb4ad0": "{count, plural, =0 {Sem vínculos de saída} one {# vínculo de saída} other {# vínculos de saída}}",
8461 + "5d252c8bbc3b24d0": "{status}. Vínculos desconhecidos",
8462 + "ec2c609c028d63b4": "Vincular {label} a outra máquina",
8463 + "0a72d33781010657": "Não é possível vincular a isto",
8464 + "e93eaf3bfa0ff76b": "{count, plural, one {Vincular a # máquina} other {Vincular a # máquinas}}",
8465 + "96bd315e3441c52a": "Renovar o vínculo com {target}",
8466 + "9f752f912897416a": "Vincular a {target}",
8467 + "b40f4891ccc7af6d": "Renovar o vínculo com {target} com um código de pareamento",
8468 + "d51a7a2bb6b8c406": "Vincular a {target} com um código de pareamento",
8469 + "f4ca5e62fb54a3a7": "Solte sobre uma máquina para vincular",
8470 + "11e67016507a6daa": "Dois vínculos, um em cada sentido.",
8471 + "352169e91766aeb4": "{count, plural, one {# precisa de atenção} other {# precisam de atenção}}",
8472 + "d53ada50331e6041": "{machines, plural, one {# máquina} other {# máquinas}}, {links, plural, =0 {sem vínculos} one {# vínculo} other {# vínculos}}",
8473 + "3e8441af6148878f": "Expira em {date}",
8474 + "4daaa2288b63a801": "{count, plural, one {# vínculo de entrada} other {# vínculos de entrada}}",
8475 + "baf297d0add1d61b": "{count, plural, one {# ambiente} other {# ambientes}}",
8476 + "ddb9150bfa8ce6f0": "Sem vínculos",
8477 + "a780bc462b60c3c0": "Recolher",
8478 + "059c335b1da34f63": "Mostrar no mapa",
8479 + "c7e1635b229d7249": "Filtrar estas máquinas por nome",
8480 + "52a07016be1bea99": "Filtrar por nome",
8481 + "a7061489aec79ba8": "{shown} de {count}",
8482 + "eefe994332120d82": "Vincular",
8483 + "c20e4b94dddc33e7": "{connected} de {total} conectados",
8484 + "c7a9759d8578279f": "Cada linha que sai daqui é uma rota salva para um ambiente.",
8485 + "398cee23ca4dabec": "{count, plural, =0 {Nenhuma máquina conhecida vincula aqui} one {Vinculada a partir de # máquina} other {Vinculada a partir de # máquinas}}",
8486 + "79e98f4a48d3df43": "Adicione {label} a este app para conectar.",
8487 + "da2990354cbe0fab": "Conhecida apenas por um vínculo",
8488 + "dfaeed73f86107ea": "Não conectada, então seus vínculos não são mostrados.",
8489 + "2ff64d143a690a99": "Para vincular a partir de {label}, ative Ambientes vinculados nos ajustes de Labs dessa máquina.",
8490 + "eb3226bab4946cfa": "Este app não tem permissão para ler os vínculos de {label}.",
8491 + "59bb2a50641eb2a9": "Não foi possível carregar os vínculos de {label}: {error}",
8492 + "58cb9c075da185fb": "Carregando ambientes vinculados…",
8493 + "126e2b7a117f01d5": "{count, plural, =0 {Não vincula a nenhuma máquina} one {Vincula a # máquina} other {Vincula a # máquinas}}",
8494 + "285d95a8e5ad0ec5": "vincula a",
8495 + "ee2a5f5571bca358": "Vincular de volta…",
8496 + "57f38a04b1e5c033": "Esquecendo…",
8497 + "20ffe8337f8f30ba": "Esquecer",
8498 + "1f221fe54654ed13": "Acesso",
8499 + "8b0cd4f77cc74c37": "Status",
8500 + "33386c89f3b07fea": "Expirado. Vincule novamente com um novo código de pareamento.",
8501 + "13d91e967cd9065c": "Sem resposta no momento.",
8502 + "42e613ac8acac777": "{days, plural, one {Expira em {days} dia. Vincule novamente para renovar.} other {Expira em {days} dias. Vincule novamente para renovar.}}",
8503 + "0990edee7035bcfe": "Expira",
8504 + "1c161c630d28d225": "Endereços",
8505 + "7ee376c7db73ab57": "Vinculado",
8506 + "e9f7a62ecd609a46": "Último contato",
8507 "70bae47e93a2f207": "Mostrar erro completo",
8508 "e4099af6d85770ff": "\"{font}\" não é monoespaçada",
8509 "a8448493d83279e2": "O código e o terminal precisam de uma fonte de largura fixa, então a fonte atual foi mantida.",
@@ -8716,35 +8828,42 @@
8828 "03ce9bea5f88ddbd": "Este app não pode confirmar que esta é uma das suas máquinas. O código de pareamento que você colar será enviado para lá.",
8829 "30b696434167411f": "Vinculado",
8830 "80bbda74ee500b82": "Máquina",
8831 + "4e7b0a3ced2d0f97": "Vincular vários ambientes",
8832 + "0f3a6d9b3350d800": "Vincular várias máquinas a partir de {source}",
8833 "e5ac7abeaeb78750": "Desmarcar tudo",
8834 "ab520df47bca22d2": "Selecionar tudo",
8835 "3a57c9bbcd12529f": "Não foi possível verificar quais máquinas já estão vinculadas, então nenhuma pode ser escolhida: {error}",
8836 + "4381e144bbeaddb2": "Vinculada nos dois sentidos",
8837 + "692450a6537f52a8": "Vinculada em um sentido",
8838 "78ccf685018ef797": "Vinculada",
8839 + "956b5c20a1fba7c1": "Não foi possível vincular de volta: {reason}",
8840 + "641c3b24cbc7d86b": "{count, plural, one {# máquina precisa de um código de pareamento, então não está na lista.} other {# máquinas precisam de um código de pareamento, então não estão na lista.}}",
8841 "87433cf138dc3e2c": "{linked, plural, one {# máquina vinculada.} other {# máquinas vinculadas.}}",
8842 "d044bb95248da10c": "{linked} de {total} vinculadas. As que falharam continuam selecionadas para você tentar de novo.",
8843 + "079237b461191c9a": "{count, plural, one {# máquina não pôde vincular de volta.} other {# máquinas não puderam vincular de volta.}}",
8844 + "86d17c42dae16356": "Vincular também cada máquina de volta a {source}",
8845 + "23fd4db8faa1a001": "Os agentes de lá poderão trabalhar também em {source}.",
8846 + "35d59319f62bd505": "{count, plural, one {# máquina continua vinculada em um sentido.} other {# máquinas continuam vinculadas em um sentido.}}",
8847 "d2fbaffe08b6cf60": "{count, plural, one {Vincular # máquina} other {Vincular # máquinas}}",
8848 "8e3378b526d615f4": "Vincular vários…",
8727 - "7f8d6d1af69829d8": "Vincular vários ambientes",
8849 "b550d04490078bda": "Os agentes daqui poderão então iniciar threads em cada máquina escolhida, enviar mensagens e aguardá-las. Cada vínculo aparece em Clientes autorizados em Compartilhamento e acesso da respectiva máquina, onde pode ser revogado.",
8850 + "e1c2c3bd84d7bcd7": "Este app não está conectado a nenhuma das máquinas que você escolheu.",
8851 "c2553b323479499a": "Este app não conhece outras máquinas. Adicione-as primeiro em Ambientes.",
8852 "18b1d4d42b945b34": "Máquinas",
8853 "03860d65c4052ab5": "Verificando quais máquinas já estão vinculadas…",
8854 "4cea6be0fe6be16f": "Não foi possível carregar os ambientes vinculados",
8733 - "58cb9c075da185fb": "Carregando ambientes vinculados…",
8855 "25b74062dc03079e": "Nenhum ambiente vinculado",
8856 "6698127fcc912f23": "Vincule outra máquina que rode o T3 Code, como uma VPS, para que os agentes daqui possam iniciar e conduzir threads lá.",
8736 - "ad5ed0ce61b966eb": "Esquecer {label}? Os agentes daqui deixam de funcionar lá. Revogue \"T3 Code · …\" em Compartilhamento e acesso de {label} para encerrar a sessão lá também.",
8737 - "81c9796bf61b306a": "Não foi possível esquecer o vínculo",
8738 - "33386c89f3b07fea": "Expirado. Vincule novamente com um novo código de pareamento.",
8739 - "13d91e967cd9065c": "Sem resposta no momento.",
8740 - "42e613ac8acac777": "{days, plural, one {Expira em {days} dia. Vincule novamente para renovar.} other {Expira em {days} dias. Vincule novamente para renovar.}}",
8741 - "8971602c42718d72": "Acessível",
8742 - "57f38a04b1e5c033": "Esquecendo…",
8743 - "20ffe8337f8f30ba": "Esquecer",
8857 "e1789f863205ad5a": "Não foi possível vincular o ambiente",
8858 + "836dde1b729e6f0a": "{source} e {target} vinculados nos dois sentidos",
8859 "40cde51afa218290": "{label} vinculado",
8746 - "eefe994332120d82": "Vincular",
8860 + "ca4e4015b89ed9a8": "Não foi possível vincular {target} de volta a {source}",
8861 + "64ac3d1579ca9f5b": "Vincular {source} a {target}",
8862 "fb71127e5746a6bc": "Em Compartilhamento e acesso de lá, ou t3 pair",
8863 + "1e3fee7084791773": "Vincular também {target} de volta a {source}",
8864 + "ea34a190b0bd804c": "Os agentes de {target} poderão trabalhar também em {source}.",
8865 + "ad5ed0ce61b966eb": "Esquecer {label}? Os agentes daqui deixam de funcionar lá. Revogue \"T3 Code · …\" em Compartilhamento e acesso de {label} para encerrar a sessão lá também.",
8866 + "81c9796bf61b306a": "Não foi possível esquecer o vínculo",
8867 "130e51beb6cf5aad": "Vincular um ambiente",
8868 "122c3e355699e69d": "Os agentes daqui poderão então iniciar threads lá, enviar mensagens e aguardá-las. Ele aparece em Clientes autorizados em Compartilhamento e acesso daquele ambiente, onde pode ser revogado.",
8869 "dc9a0b68d101e904": "Já vinculado. Vincular novamente renova o vínculo com o acesso escolhido.",
@@ -9430,7 +9549,6 @@
9549 "e3349eb2353ee27c": "A aprovação de novos dispositivos está desativada, então um dispositivo revogado conectado à sua conta T3 Connect pode se conectar novamente sozinho.",
9550 "080160002915c666": "Exigir aprovação para novos dispositivos",
9551 "73dd0f86f5363431": "O dispositivo precisa ser aprovado aqui antes de poder se conectar novamente.",
9433 - "930f9e01fc4591b4": "Desligado",
9552 "6c7762bd72cea808": "Reconectando: {error}",
9553 "6cced6a88a19f1f2": "Reconectando",
9554 "8cbb63fdff9fde72": "Falha na conexão: {error}",
@@ -11699,7 +11817,6 @@
11817 "8ac2984f4e732091": "desligar ligar desativar ativar servidor local agentes só remoto reiniciar",
11818 "3a54b8d98911331a": "Acesso à rede",
11819 "1a31308f0884a68b": "expor backend remoto pareamento máquina local interfaces host reiniciar",
11702 - "468d32c6b30df608": "Tailscale HTTPS",
11820 "92c2528040ca7442": "serve magicdns endpoint remoto seguro rede",
11821 "ab23b9c923cc4e80": "windows subsystem linux distro segundo servidor projetos parar backend do windows reiniciar só wsl",
11822 "814c6f3ba7c29f7c": "túnel gerenciado nuvem outros dispositivos remoto túneis limite t3 chat",
apps/web/src/i18n/translations/ru.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Это приложение к ней не подключено",
79 "95f18b6ad4a409de": "Ваш сеанс там не может создавать коды сопряжения",
80 "26847ec0357c8600": "Нет адреса, доступного с другой машины",
81 + "ec1a698b0821ec66": "{target} не может привязаться в ответ: привязанные окружения там выключены.",
82 + "6cf74ace5a766699": "{target} не может привязаться в ответ: ваш сеанс там не может создавать привязки.",
83 + "a995255a0f303086": "{target} не может привязаться в ответ: ваш сеанс на {source} не может создавать коды сопряжения.",
84 + "a51c8cdfccb5b4ca": "{target} не может привязаться в ответ: у этого приложения нет адреса, по которому доступна {source}.",
85 "cba6d3e3a22f2efe": "Недоступен",
86 "0eb1a18deaf06b76": "Код сопряжения отклонён",
87 "7d6fc963ebf9a9c5": "Ответило другое окружение",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "Порядок маршрутов должен содержать каждый сохранённый маршрут ровно один раз.",
487 "18de69e3b6ac3891": "Профиль подключения {connectionId} не является bearer-подключением.",
488 "0a84ce2f4fb90d82": "Профиль подключения {connectionId} не является SSH-подключением.",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "Удалённая ссылка",
491 "0b367ce72b45a911": "Неожиданная ошибка подключения к {host}.",
492 "91ca7e48f40bfa3c": "{host} не ответил во время настройки подключения.",
@@ -8091,6 +8096,9 @@
8096 "d087da5017f20fa2": "Окружение не выбрано",
8097 "cb553d31c9d1b1c7": "Подключите окружение, чтобы просматривать его настройки и доступ.",
8098 "9a84dc0e80037e05": "Это приложение",
8099 + "3d96310c2214fe2d": "Показывать окружения как",
8100 + "41e0e5e03e07db42": "Карта",
8101 + "3a8adb207fb5e078": "Список",
8102 "493685e264877b13": "Доступ для",
8103 "5b2287f7b10cfa2f": "Не в сети",
8104 "03f150efa96ec728": "Переключиться на Windows",
@@ -8394,6 +8402,110 @@
8402 "191fa21f1cfda1ef": "Хост отклонил вход с этого устройства. Повторите сопряжение по этому адресу через «Добавить маршрут».",
8403 "219bc3612d646a01": "Удалить маршрут",
8404 "b2877341429675aa": "через {route}",
8405 + "537e7cf4df7a0af1": "Этот браузер",
8406 + "d18ad97175bd2028": "Shift-щелчок или Shift-перетаскивание выбирает несколько",
8407 + "692153ec34a9a7bd": "Найти машину на карте",
8408 + "288ab5c45a9539a3": "Найти машину",
8409 + "c263859f8bcc7b1c": "Нет машины с таким именем",
8410 + "ebe6ecf547a0636b": "{count, plural, one {# совпадение} few {# совпадения} many {# совпадений} other {# совпадения}}",
8411 + "2bb44d78cb85c097": "{count, plural, one {Выбрана #} few {Выбрано #} many {Выбрано #} other {Выбрано #}}",
8412 + "bcf01a26153f6425": "Сбросить",
8413 + "d9665bd69e7fd4f4": "Связать несколько…",
8414 + "8d5882faf1e5fb96": "С {source}",
8415 + "2b9e6257e6995ada": "Как пользоваться картой",
8416 + "743b93767ec7ebf8": "Выберите машину, чтобы управлять ею.",
8417 + "49712bceec027141": "Перетащите плюс на машину, чтобы привязать их.",
8418 + "aba23d86b0f4b66b": "Привязка доходит до одной машины и на ней заканчивается.",
8419 + "601e0c9e6a45a54f": "Вместить карту в окно",
8420 + "feec58f6653f5673": "Как читать линии",
8421 + "46e0a0c6ff391521": "Используется",
8422 + "1151e8a9fb7bdfcf": "В резерве",
8423 + "a322337b6655de2a": "Не используется",
8424 + "e31c7e76ef900ef4": "Вход отклонён",
8425 + "c032d479f9bbb166": "Привязка",
8426 + "d4160421f6e651bb": "В обе стороны",
8427 + "d3751f456814b2b2": "{count, plural, one {# машине нужен код сопряжения} few {# машинам нужен код сопряжения для каждой} many {# машинам нужен код сопряжения для каждой} other {# машины нужен код сопряжения для каждой}}",
8428 + "e0a8e0b87dca8241": "Привязать одну по коду…",
8429 + "ad095a37f818d67e": "Привязанные машины",
8430 + "afc01d2ee8048b4b": "{label}, выбрано",
8431 + "aa34f7bc5aaf6bb0": "Карта ваших машин",
8432 + "edb6cb27ff7f446b": "Стрелки перемещают между машинами. Enter открывает сведения о машине с её маршрутами и связями. Пробел выбирает машину, чтобы связать несколько сразу. Tab из окружения ведёт к его кнопке связывания. Плюс и минус меняют масштаб, ноль вписывает карту.",
8433 + "753b4a8ec5521c98": "Привязка от {source} к {target}: {summary}",
8434 + "bb6a74a47a3852c7": "Срок истёк",
8435 + "3076117d81a9c1c0": "Не отвечает",
8436 + "96fdb2fd529b1fbb": "Сбой",
8437 + "8971602c42718d72": "Доступно",
8438 + "1b256867b95ee022": "{days, plural, one {Истекает через {days} день} few {Истекает через {days} дня} many {Истекает через {days} дней} other {Истекает через {days} дня}}",
8439 + "9d02cb328944fb27": "Двусторонняя привязка между {source} и {target}, {access}. От {source} к {target}: {forward}. От {target} к {source}: {back}",
8440 + "aae31cf2017dab5b": "Публичный",
8441 + "b4f6c341033a3c91": "Выключены",
8442 + "960255d19109dcd9": "Требуют обновления",
8443 + "19f6a3505837907d": "{access}. Доступно {reachable} из {count}",
8444 + "6f8f71c20ba546af": "Доступно {reachable} из {count}, из {sources} окружений",
8445 + "0d731c951986fac8": "{group}: окружений без связей — {count}, {range}",
8446 + "5feb96736385be01": "{range}, машин: {count}, связаны с {sources}. {summary}",
8447 + "706ac721bf99036c": "{machines, plural, one {# машина} few {# машины} many {# машин} other {# машины}}",
8448 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {Ни одна не доступна} one {# доступна} few {# доступны} many {# доступно} other {# доступно}}",
8449 + "35b783cfc817cb6f": "Свернуть эти машины",
8450 + "14dcd5c89fd0f67f": "Показать первые {shown} машин на карте",
8451 + "b8f2d917d3a592df": "Показать каждую машину на карте",
8452 + "ddc2106217bbde2d": "и ещё {count}",
8453 + "b0d81579d80fb94a": "известна только по привязке",
8454 + "2d3dc930fd1cdd55": "от {source}: {summary}",
8455 + "911bc3bcde1aba3b": "{count, plural, one {# входящая привязка} few {# входящие привязки} many {# входящих привязок} other {# входящей привязки}}",
8456 + "930f9e01fc4591b4": "Выкл.",
8457 + "0fecb34fd1ae531f": "{label}, в вашей учётной записи T3 Connect, не добавлена в это приложение. {status}",
8458 + "4a84ad9b7f8e4909": "Загрузка привязок…",
8459 + "9c88c8e716354091": "Не удалось загрузить привязки",
8460 + "f9733c7b64c6f5d9": "Привязанные окружения выключены",
8461 + "ba30444f6d79cbdd": "Привязки отсюда не читаются",
8462 + "6a34b35812bb4ad0": "{count, plural, =0 {Нет исходящих привязок} one {# исходящая привязка} few {# исходящие привязки} many {# исходящих привязок} other {# исходящей привязки}}",
8463 + "5d252c8bbc3b24d0": "{status}. Привязки неизвестны",
8464 + "ec2c609c028d63b4": "Привязать {label} к другой машине",
8465 + "0a72d33781010657": "К этому нельзя привязать",
8466 + "e93eaf3bfa0ff76b": "{count, plural, one {Привязать к # машине} few {Привязать к # машинам} many {Привязать к # машинам} other {Привязать к # машины}}",
8467 + "96bd315e3441c52a": "Обновить привязку к {target}",
8468 + "9f752f912897416a": "Привязать к {target}",
8469 + "b40f4891ccc7af6d": "Обновить привязку к {target} по коду сопряжения",
8470 + "d51a7a2bb6b8c406": "Привязать к {target} по коду сопряжения",
8471 + "f4ca5e62fb54a3a7": "Отпустите на машине, чтобы привязать",
8472 + "11e67016507a6daa": "Две привязки, по одной в каждую сторону.",
8473 + "352169e91766aeb4": "{count, plural, one {# требует внимания} few {# требуют внимания} many {# требуют внимания} other {# требуют внимания}}",
8474 + "d53ada50331e6041": "{machines, plural, one {# машина} few {# машины} many {# машин} other {# машины}}, {links, plural, =0 {нет привязок} one {# привязка} few {# привязки} many {# привязок} other {# привязки}}",
8475 + "3e8441af6148878f": "Истекает {date}",
8476 + "4daaa2288b63a801": "{count, plural, one {# входящая связь} few {# входящие связи} many {# входящих связей} other {# входящей связи}}",
8477 + "baf297d0add1d61b": "{count, plural, one {# окружение} few {# окружения} many {# окружений} other {# окружения}}",
8478 + "ddb9150bfa8ce6f0": "Нет привязок",
8479 + "a780bc462b60c3c0": "Свернуть",
8480 + "059c335b1da34f63": "Показать на карте",
8481 + "c7e1635b229d7249": "Фильтровать эти машины по имени",
8482 + "52a07016be1bea99": "Фильтр по имени",
8483 + "a7061489aec79ba8": "{shown} из {count}",
8484 + "eefe994332120d82": "Привязать",
8485 + "c20e4b94dddc33e7": "Подключено {connected} из {total}",
8486 + "c7a9759d8578279f": "Каждая линия отсюда — сохранённый маршрут к окружению.",
8487 + "398cee23ca4dabec": "{count, plural, =0 {Известные машины сюда не привязаны} one {Привязки от # машины} few {Привязки от # машин} many {Привязки от # машин} other {Привязки от # машины}}",
8488 + "79e98f4a48d3df43": "Добавьте {label} в это приложение, чтобы подключиться.",
8489 + "da2990354cbe0fab": "Известна только по привязке",
8490 + "dfaeed73f86107ea": "Нет подключения, поэтому привязки не показаны.",
8491 + "2ff64d143a690a99": "Чтобы создавать привязки от {label}, включите там «Привязанные окружения» в настройках, в разделе «Эксперименты».",
8492 + "eb3226bab4946cfa": "У этого приложения нет права читать привязки {label}.",
8493 + "59bb2a50641eb2a9": "Не удалось загрузить привязки {label}: {error}",
8494 + "58cb9c075da185fb": "Загрузка привязанных окружений…",
8495 + "126e2b7a117f01d5": "{count, plural, =0 {Нет привязок к другим машинам} one {Привязки к # машине} few {Привязки к # машинам} many {Привязки к # машинам} other {Привязки к # машины}}",
8496 + "285d95a8e5ad0ec5": "привязано к",
8497 + "ee2a5f5571bca358": "Привязать в ответ…",
8498 + "57f38a04b1e5c033": "Удаление привязки…",
8499 + "20ffe8337f8f30ba": "Забыть",
8500 + "1f221fe54654ed13": "Доступ",
8501 + "8b0cd4f77cc74c37": "Состояние",
8502 + "33386c89f3b07fea": "Срок истёк. Свяжите заново с новым кодом сопряжения.",
8503 + "13d91e967cd9065c": "Сейчас не отвечает.",
8504 + "42e613ac8acac777": "{days, plural, one {Истекает через {days} день. Свяжите заново, чтобы продлить.} few {Истекает через {days} дня. Свяжите заново, чтобы продлить.} many {Истекает через {days} дней. Свяжите заново, чтобы продлить.} other {Истекает через {days} дня. Свяжите заново, чтобы продлить.}}",
8505 + "0990edee7035bcfe": "Истекает",
8506 + "1c161c630d28d225": "Адреса",
8507 + "7ee376c7db73ab57": "Привязано",
8508 + "e9f7a62ecd609a46": "Последняя связь",
8509 "70bae47e93a2f207": "Показать ошибку полностью",
8510 "e4099af6d85770ff": "«{font}» не моноширинный",
8511 "a8448493d83279e2": "Коду и терминалу нужен моноширинный шрифт, поэтому текущий шрифт сохранён.",
@@ -8717,35 +8829,42 @@
8829 "03ce9bea5f88ddbd": "Приложение не может подтвердить, что это одна из ваших машин. Вставленный код сопряжения будет отправлен туда.",
8830 "30b696434167411f": "Привязано",
8831 "80bbda74ee500b82": "Машина",
8832 + "4e7b0a3ced2d0f97": "Привязать несколько окружений",
8833 + "0f3a6d9b3350d800": "Связать несколько машин с {source}",
8834 "e5ac7abeaeb78750": "Снять выделение",
8835 "ab520df47bca22d2": "Выбрать все",
8836 "3a57c9bbcd12529f": "Не удалось проверить, какие машины уже привязаны, поэтому выбрать ни одну нельзя: {error}",
8837 + "4381e144bbeaddb2": "Привязана в обе стороны",
8838 + "692450a6537f52a8": "Привязана в одну сторону",
8839 "78ccf685018ef797": "Привязана",
8840 + "956b5c20a1fba7c1": "Не удалось привязать в ответ: {reason}",
8841 + "641c3b24cbc7d86b": "{count, plural, one {# машине нужен код сопряжения, поэтому её нет в списке.} few {# машинам нужен код сопряжения, поэтому их нет в списке.} many {# машинам нужен код сопряжения, поэтому их нет в списке.} other {# машины нужен код сопряжения, поэтому их нет в списке.}}",
8842 "87433cf138dc3e2c": "{linked, plural, one {Привязана # машина.} few {Привязаны # машины.} many {Привязано # машин.} other {Привязано # машины.}}",
8843 "d044bb95248da10c": "Привязано {linked} из {total}. Машины с ошибкой остаются выбранными, чтобы можно было повторить попытку.",
8844 + "079237b461191c9a": "{count, plural, one {# машина не смогла привязаться в ответ.} few {# машины не смогли привязаться в ответ.} many {# машин не смогли привязаться в ответ.} other {# машины не смогли привязаться в ответ.}}",
8845 + "86d17c42dae16356": "Также привязать каждую машину в ответ к {source}",
8846 + "23fd4db8faa1a001": "Тогда агенты оттуда смогут работать и на {source}.",
8847 + "35d59319f62bd505": "{count, plural, one {# машина остаётся привязанной в одну сторону.} few {# машины остаются привязанными в одну сторону.} many {# машин остаются привязанными в одну сторону.} other {# машины остаются привязанными в одну сторону.}}",
8848 "d2fbaffe08b6cf60": "{count, plural, one {Привязать # машину} few {Привязать # машины} many {Привязать # машин} other {Привязать # машины}}",
8849 "8e3378b526d615f4": "Привязать несколько…",
8728 - "7f8d6d1af69829d8": "Привязать несколько окружений",
8850 "b550d04490078bda": "После этого агенты отсюда смогут запускать треды на каждой выбранной машине, писать в них и ждать их. Каждая связь появится в разделе «Авторизованные клиенты» в «Общем доступе» соответствующей машины, где её можно отозвать.",
8851 + "e1c2c3bd84d7bcd7": "Это приложение не подключено ни к одной из выбранных машин.",
8852 "c2553b323479499a": "Это приложение не знает других машин. Сначала добавьте их в разделе «Окружения».",
8853 "18b1d4d42b945b34": "Машины",
8854 "03860d65c4052ab5": "Проверяем, какие машины уже привязаны…",
8855 "4cea6be0fe6be16f": "Не удалось загрузить привязанные окружения",
8734 - "58cb9c075da185fb": "Загрузка привязанных окружений…",
8856 "25b74062dc03079e": "Нет привязанных окружений",
8857 "6698127fcc912f23": "Свяжите другую машину с T3 Code, например VPS, чтобы агенты отсюда могли запускать треды там и управлять ими.",
8737 - "ad5ed0ce61b966eb": "Забыть {label}? Агенты отсюда перестанут там работать. Чтобы завершить сеанс и там, отзовите «T3 Code · …» в разделе «Общий доступ» на {label}.",
8738 - "81c9796bf61b306a": "Не удалось забыть привязку",
8739 - "33386c89f3b07fea": "Срок истёк. Свяжите заново с новым кодом сопряжения.",
8740 - "13d91e967cd9065c": "Сейчас не отвечает.",
8741 - "42e613ac8acac777": "{days, plural, one {Истекает через {days} день. Свяжите заново, чтобы продлить.} few {Истекает через {days} дня. Свяжите заново, чтобы продлить.} many {Истекает через {days} дней. Свяжите заново, чтобы продлить.} other {Истекает через {days} дня. Свяжите заново, чтобы продлить.}}",
8742 - "8971602c42718d72": "Доступно",
8743 - "57f38a04b1e5c033": "Удаление привязки…",
8744 - "20ffe8337f8f30ba": "Забыть",
8858 "e1789f863205ad5a": "Не удалось привязать окружение",
8859 + "836dde1b729e6f0a": "{source} и {target} привязаны в обе стороны",
8860 "40cde51afa218290": "Привязано: {label}",
8747 - "eefe994332120d82": "Привязать",
8861 + "ca4e4015b89ed9a8": "Не удалось привязать {target} в ответ к {source}",
8862 + "64ac3d1579ca9f5b": "Привязать {source} к {target}",
8863 "fb71127e5746a6bc": "Из раздела «Общий доступ» там или через t3 pair",
8864 + "1e3fee7084791773": "Также привязать {target} в ответ к {source}",
8865 + "ea34a190b0bd804c": "Тогда агенты на {target} смогут работать и на {source}.",
8866 + "ad5ed0ce61b966eb": "Забыть {label}? Агенты отсюда перестанут там работать. Чтобы завершить сеанс и там, отзовите «T3 Code · …» в разделе «Общий доступ» на {label}.",
8867 + "81c9796bf61b306a": "Не удалось забыть привязку",
8868 "130e51beb6cf5aad": "Привязать окружение",
8869 "122c3e355699e69d": "После этого агенты отсюда смогут запускать треды там, писать в них и ждать их. Связь появится в разделе «Авторизованные клиенты» в «Общем доступе» того окружения, где её можно отозвать.",
8870 "dc9a0b68d101e904": "Уже привязано. Повторная привязка продлевает её с выбранным уровнем доступа.",
@@ -9433,7 +9552,6 @@
9552 "e3349eb2353ee27c": "Подтверждение новых устройств выключено, поэтому отозванное устройство, вошедшее в ваш аккаунт T3 Connect, может снова подключиться самостоятельно.",
9553 "080160002915c666": "Требовать подтверждения новых устройств",
9554 "73dd0f86f5363431": "Устройство должно быть подтверждено здесь, прежде чем сможет снова подключиться.",
9436 - "930f9e01fc4591b4": "Выкл.",
9555 "6c7762bd72cea808": "Переподключение: {error}",
9556 "6cced6a88a19f1f2": "Переподключение",
9557 "8cbb63fdff9fde72": "Ошибка подключения: {error}",
@@ -11700,7 +11818,6 @@
11818 "8ac2984f4e732091": "выключить включить отключить локальный сервер агенты только удалённо перезапуск",
11819 "3a54b8d98911331a": "Доступ по сети",
11820 "1a31308f0884a68b": "открыть бэкенд удалённый сопряжение локальный компьютер интерфейсы хост перезапуск",
11703 - "468d32c6b30df608": "Tailscale HTTPS",
11821 "92c2528040ca7442": "serve magicdns конечная точка удалённый защищённая сеть",
11822 "ab23b9c923cc4e80": "windows subsystem linux дистрибутив второй сервер проекты остановить бэкенд windows перезапуск только wsl",
11823 "814c6f3ba7c29f7c": "управляемый туннель облако другие устройства удалённые туннели лимит t3 chat",
apps/web/src/i18n/translations/sv.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "Den här appen är inte ansluten till den",
79 "95f18b6ad4a409de": "Din session där kan inte skapa parkopplingskoder",
80 "26847ec0357c8600": "Ingen adress som en annan dator kan nå",
81 + "ec1a698b0821ec66": "{target} kan inte länka tillbaka: Länkade miljöer är avstängt där.",
82 + "6cf74ace5a766699": "{target} kan inte länka tillbaka: din session där kan inte skapa länkar.",
83 + "a995255a0f303086": "{target} kan inte länka tillbaka: din session på {source} kan inte skapa parkopplingskoder.",
84 + "a51c8cdfccb5b4ca": "{target} kan inte länka tillbaka: den här appen har ingen adress där {source} kan nås.",
85 "cba6d3e3a22f2efe": "Inte nåbar",
86 "0eb1a18deaf06b76": "Parkopplingskoden nekades",
87 "7d6fc963ebf9a9c5": "En annan miljö svarade",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "Ruttordningen måste ta med varje sparad rutt en gång.",
487 "18de69e3b6ac3891": "Anslutningsprofilen {connectionId} är ingen bearer-anslutning.",
488 "0a84ce2f4fb90d82": "Anslutningsprofilen {connectionId} är ingen SSH-anslutning.",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "Fjärrlänk",
491 "0b367ce72b45a911": "Anslutningen till {host} misslyckades oväntat.",
492 "91ca7e48f40bfa3c": "{host} svarade inte när anslutningen konfigurerades.",
@@ -8097,6 +8102,9 @@
8102 "d087da5017f20fa2": "Ingen miljö vald",
8103 "cb553d31c9d1b1c7": "Anslut en miljö för att visa dess inställningar och åtkomst.",
8104 "9a84dc0e80037e05": "Den här appen",
8105 + "3d96310c2214fe2d": "Visa miljöer som",
8106 + "41e0e5e03e07db42": "Karta",
8107 + "3a8adb207fb5e078": "Lista",
8108 "493685e264877b13": "Visar åtkomst för",
8109 "5b2287f7b10cfa2f": "Offline",
8110 "03f150efa96ec728": "Byt till Windows",
@@ -8400,6 +8408,110 @@
8408 "191fa21f1cfda1ef": "Värden nekade den här enhetens inloggning. Parkoppla adressen igen med Lägg till rutt.",
8409 "219bc3612d646a01": "Ta bort rutt",
8410 "b2877341429675aa": "via {route}",
8411 + "537e7cf4df7a0af1": "Den här webbläsaren",
8412 + "d18ad97175bd2028": "Skift-klicka eller Skift-dra för att välja flera",
8413 + "692153ec34a9a7bd": "Hitta en maskin på kartan",
8414 + "288ab5c45a9539a3": "Hitta en maskin",
8415 + "c263859f8bcc7b1c": "Ingen maskin med det namnet",
8416 + "ebe6ecf547a0636b": "{count, plural, one {# träff} other {# träffar}}",
8417 + "2bb44d78cb85c097": "{count, plural, one {# vald} other {# valda}}",
8418 + "bcf01a26153f6425": "Rensa",
8419 + "d9665bd69e7fd4f4": "Länka flera…",
8420 + "8d5882faf1e5fb96": "Från {source}",
8421 + "2b9e6257e6995ada": "Så använder du kartan",
8422 + "743b93767ec7ebf8": "Välj en maskin för att hantera den.",
8423 + "49712bceec027141": "Dra ett plus till en maskin för att länka dem.",
8424 + "aba23d86b0f4b66b": "En länk når en maskin och slutar där.",
8425 + "601e0c9e6a45a54f": "Anpassa kartan till vyn",
8426 + "feec58f6653f5673": "Så läser du linjerna",
8427 + "46e0a0c6ff391521": "Används",
8428 + "1151e8a9fb7bdfcf": "Reserv",
8429 + "a322337b6655de2a": "Används inte",
8430 + "e31c7e76ef900ef4": "Inloggning nekad",
8431 + "c032d479f9bbb166": "Länk",
8432 + "d4160421f6e651bb": "Åt båda håll",
8433 + "d3751f456814b2b2": "{count, plural, one {# maskin behöver en parkopplingskod} other {# maskiner behöver varsin parkopplingskod}}",
8434 + "e0a8e0b87dca8241": "Länka en med en kod…",
8435 + "ad095a37f818d67e": "Länkade maskiner",
8436 + "afc01d2ee8048b4b": "{label}, vald",
8437 + "aa34f7bc5aaf6bb0": "Karta över dina maskiner",
8438 + "edb6cb27ff7f446b": "Piltangenterna flyttar mellan maskiner. Enter öppnar en maskins detaljer med dess rutter och länkar. Blanksteg väljer en maskin för att länka flera på en gång. Tabb från en miljö når dess länkknapp. Plus och minus zoomar, noll anpassar kartan.",
8439 + "753b4a8ec5521c98": "Länk från {source} till {target}: {summary}",
8440 + "bb6a74a47a3852c7": "Har gått ut",
8441 + "3076117d81a9c1c0": "Svarar inte",
8442 + "96fdb2fd529b1fbb": "Fungerar inte",
8443 + "8971602c42718d72": "Nåbar",
8444 + "1b256867b95ee022": "{days, plural, one {Går ut om {days} dag} other {Går ut om {days} dagar}}",
8445 + "9d02cb328944fb27": "Länk åt båda håll mellan {source} och {target}, {access}. {source} till {target}: {forward}. {target} till {source}: {back}",
8446 + "aae31cf2017dab5b": "Publik",
8447 + "b4f6c341033a3c91": "Avstängda",
8448 + "960255d19109dcd9": "Behöver uppdateras",
8449 + "19f6a3505837907d": "{access}. {reachable} av {count} nåbara",
8450 + "6f8f71c20ba546af": "{reachable} av {count} nåbara, från {sources} miljöer",
8451 + "0d731c951986fac8": "{group}: {count} miljöer utan länkar, {range}",
8452 + "5feb96736385be01": "{range}, {count} maskiner länkade från {sources}. {summary}",
8453 + "706ac721bf99036c": "{machines, plural, one {# maskin} other {# maskiner}}",
8454 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {Ingen nåbar} one {# nåbar} other {# nåbara}}",
8455 + "35b783cfc817cb6f": "Fäll ihop de här maskinerna",
8456 + "14dcd5c89fd0f67f": "Visa de första {shown} maskinerna på kartan",
8457 + "b8f2d917d3a592df": "Visa varje maskin på kartan",
8458 + "ddc2106217bbde2d": "och {count} till",
8459 + "b0d81579d80fb94a": "känd endast via en länk",
8460 + "2d3dc930fd1cdd55": "från {source}: {summary}",
8461 + "911bc3bcde1aba3b": "{count, plural, one {# inkommande länk} other {# inkommande länkar}}",
8462 + "930f9e01fc4591b4": "Av",
8463 + "0fecb34fd1ae531f": "{label}, på ditt T3 Connect-konto, inte tillagd i den här appen. {status}",
8464 + "4a84ad9b7f8e4909": "Läser in länkar…",
8465 + "9c88c8e716354091": "Länkarna kunde inte läsas in",
8466 + "f9733c7b64c6f5d9": "Länkade miljöer är avstängt",
8467 + "ba30444f6d79cbdd": "Länkarna kan inte läsas härifrån",
8468 + "6a34b35812bb4ad0": "{count, plural, =0 {Inga utgående länkar} one {# utgående länk} other {# utgående länkar}}",
8469 + "5d252c8bbc3b24d0": "{status}. Länkar okända",
8470 + "ec2c609c028d63b4": "Länka {label} till en annan maskin",
8471 + "0a72d33781010657": "Går inte att länka till detta",
8472 + "e93eaf3bfa0ff76b": "{count, plural, one {Länka till # maskin} other {Länka till # maskiner}}",
8473 + "96bd315e3441c52a": "Förnya länken till {target}",
8474 + "9f752f912897416a": "Länka till {target}",
8475 + "b40f4891ccc7af6d": "Förnya länken till {target} med en parkopplingskod",
8476 + "d51a7a2bb6b8c406": "Länka till {target} med en parkopplingskod",
8477 + "f4ca5e62fb54a3a7": "Släpp på en maskin för att länka",
8478 + "11e67016507a6daa": "Två länkar, en åt varje håll.",
8479 + "352169e91766aeb4": "{count, plural, one {# behöver åtgärdas} other {# behöver åtgärdas}}",
8480 + "d53ada50331e6041": "{machines, plural, one {# dator} other {# datorer}}, {links, plural, =0 {inga länkar} one {# länk} other {# länkar}}",
8481 + "3e8441af6148878f": "Går ut {date}",
8482 + "4daaa2288b63a801": "{count, plural, one {# länk in} other {# länkar in}}",
8483 + "baf297d0add1d61b": "{count, plural, one {# miljö} other {# miljöer}}",
8484 + "ddb9150bfa8ce6f0": "Inga länkar",
8485 + "a780bc462b60c3c0": "Fäll ihop",
8486 + "059c335b1da34f63": "Visa på kartan",
8487 + "c7e1635b229d7249": "Filtrera dessa maskiner efter namn",
8488 + "52a07016be1bea99": "Filtrera efter namn",
8489 + "a7061489aec79ba8": "{shown} av {count}",
8490 + "eefe994332120d82": "Länka",
8491 + "c20e4b94dddc33e7": "{connected} av {total} anslutna",
8492 + "c7a9759d8578279f": "Varje linje härifrån är en sparad rutt till en miljö.",
8493 + "398cee23ca4dabec": "{count, plural, =0 {Ingen känd dator länkar hit} one {Länkad från # dator} other {Länkad från # datorer}}",
8494 + "79e98f4a48d3df43": "Lägg till {label} i den här appen för att ansluta.",
8495 + "da2990354cbe0fab": "Känd endast via en länk",
8496 + "dfaeed73f86107ea": "Inte ansluten, så dess länkar visas inte.",
8497 + "2ff64d143a690a99": "Slå på Länkade miljöer i Labs-inställningarna på {label} för att länka därifrån.",
8498 + "eb3226bab4946cfa": "Den här appen får inte läsa länkarna som {label} har.",
8499 + "59bb2a50641eb2a9": "Kunde inte läsa in länkarna som {label} har: {error}",
8500 + "58cb9c075da185fb": "Läser in länkade miljöer…",
8501 + "126e2b7a117f01d5": "{count, plural, =0 {Länkar inte till någon} one {Länkar till # dator} other {Länkar till # datorer}}",
8502 + "285d95a8e5ad0ec5": "länkar till",
8503 + "ee2a5f5571bca358": "Länka tillbaka…",
8504 + "57f38a04b1e5c033": "Glömmer…",
8505 + "20ffe8337f8f30ba": "Glöm",
8506 + "1f221fe54654ed13": "Åtkomst",
8507 + "8b0cd4f77cc74c37": "Status",
8508 + "33386c89f3b07fea": "Har gått ut. Länka den igen med en ny parkopplingskod.",
8509 + "13d91e967cd9065c": "Svarar inte just nu.",
8510 + "42e613ac8acac777": "{days, plural, one {Går ut om {days} dag. Länka den igen för att förnya.} other {Går ut om {days} dagar. Länka den igen för att förnya.}}",
8511 + "0990edee7035bcfe": "Går ut",
8512 + "1c161c630d28d225": "Adresser",
8513 + "7ee376c7db73ab57": "Länkad",
8514 + "e9f7a62ecd609a46": "Senast nådd",
8515 "70bae47e93a2f207": "Visa hela felet",
8516 "e4099af6d85770ff": "”{font}” är inte ett teckensnitt med fast bredd",
8517 "a8448493d83279e2": "Kod och terminal kräver ett teckensnitt med fast bredd, så det aktuella teckensnittet behölls.",
@@ -8723,35 +8835,42 @@
8835 "03ce9bea5f88ddbd": "Appen kan inte bekräfta att det är en av dina datorer. Parkopplingskoden du klistrar in skickas dit.",
8836 "30b696434167411f": "Länkad",
8837 "80bbda74ee500b82": "Dator",
8838 + "4e7b0a3ced2d0f97": "Länka flera miljöer",
8839 + "0f3a6d9b3350d800": "Länka flera maskiner från {source}",
8840 "e5ac7abeaeb78750": "Avmarkera allt",
8841 "ab520df47bca22d2": "Markera allt",
8842 "3a57c9bbcd12529f": "Det gick inte att kontrollera vilka datorer som redan är länkade, så ingen kan väljas: {error}",
8843 + "4381e144bbeaddb2": "Länkad åt båda håll",
8844 + "692450a6537f52a8": "Länkad åt ett håll",
8845 "78ccf685018ef797": "Länkad",
8846 + "956b5c20a1fba7c1": "Kunde inte länka tillbaka: {reason}",
8847 + "641c3b24cbc7d86b": "{count, plural, one {# maskin behöver en parkopplingskod och visas därför inte i listan.} other {# maskiner behöver en parkopplingskod och visas därför inte i listan.}}",
8848 "87433cf138dc3e2c": "{linked, plural, one {Länkade # dator.} other {Länkade # datorer.}}",
8849 "d044bb95248da10c": "Länkade {linked} av {total}. De som misslyckades är fortfarande markerade så att du kan försöka igen.",
8850 + "079237b461191c9a": "{count, plural, one {# maskin kunde inte länka tillbaka.} other {# maskiner kunde inte länka tillbaka.}}",
8851 + "86d17c42dae16356": "Länka även varje dator tillbaka till {source}",
8852 + "23fd4db8faa1a001": "Agenter där kan då också arbeta på {source}.",
8853 + "35d59319f62bd505": "{count, plural, one {# maskin förblir länkad åt ett håll.} other {# maskiner förblir länkade åt ett håll.}}",
8854 "d2fbaffe08b6cf60": "{count, plural, one {Länka # dator} other {Länka # datorer}}",
8855 "8e3378b526d615f4": "Länka flera…",
8734 - "7f8d6d1af69829d8": "Länka flera miljöer",
8856 "b550d04490078bda": "Agenter här kan sedan starta, skicka meddelanden till och vänta på trådar på varje dator du väljer. Varje länk visas under Auktoriserade klienter i den datorns Delning och åtkomst, där den kan återkallas.",
8857 + "e1c2c3bd84d7bcd7": "Den här appen är inte ansluten till någon av datorerna du valde.",
8858 "c2553b323479499a": "Den här appen känner inte till några andra datorer. Lägg först till dem under Miljöer.",
8859 "18b1d4d42b945b34": "Datorer",
8860 "03860d65c4052ab5": "Kontrollerar vilka datorer som redan är länkade…",
8861 "4cea6be0fe6be16f": "Kunde inte läsa in länkade miljöer",
8740 - "58cb9c075da185fb": "Läser in länkade miljöer…",
8862 "25b74062dc03079e": "Inga länkade miljöer",
8863 "6698127fcc912f23": "Länka en annan dator som kör T3 Code, till exempel en VPS, så att agenter här kan starta och styra trådar där.",
8743 - "ad5ed0ce61b966eb": "Glöm {label}? Agenter här slutar arbeta där. Återkalla ”T3 Code · …” under Delning och åtkomst på {label} för att avsluta sessionen där också.",
8744 - "81c9796bf61b306a": "Kunde inte glömma länken",
8745 - "33386c89f3b07fea": "Har gått ut. Länka den igen med en ny parkopplingskod.",
8746 - "13d91e967cd9065c": "Svarar inte just nu.",
8747 - "42e613ac8acac777": "{days, plural, one {Går ut om {days} dag. Länka den igen för att förnya.} other {Går ut om {days} dagar. Länka den igen för att förnya.}}",
8748 - "8971602c42718d72": "Nåbar",
8749 - "57f38a04b1e5c033": "Glömmer…",
8750 - "20ffe8337f8f30ba": "Glöm",
8864 "e1789f863205ad5a": "Kunde inte länka miljön",
8865 + "836dde1b729e6f0a": "Länkade {source} och {target} åt båda håll",
8866 "40cde51afa218290": "Länkade {label}",
8753 - "eefe994332120d82": "Länka",
8867 + "ca4e4015b89ed9a8": "Kunde inte länka {target} tillbaka till {source}",
8868 + "64ac3d1579ca9f5b": "Länka {source} till {target}",
8869 "fb71127e5746a6bc": "Från Delning och åtkomst där, eller t3 pair",
8870 + "1e3fee7084791773": "Länka även {target} tillbaka till {source}",
8871 + "ea34a190b0bd804c": "Agenter på {target} kan då också arbeta på {source}.",
8872 + "ad5ed0ce61b966eb": "Glöm {label}? Agenter här slutar arbeta där. Återkalla ”T3 Code · …” under Delning och åtkomst på {label} för att avsluta sessionen där också.",
8873 + "81c9796bf61b306a": "Kunde inte glömma länken",
8874 "130e51beb6cf5aad": "Länka en miljö",
8875 "122c3e355699e69d": "Agenter här kan sedan starta, skicka meddelanden till och vänta på trådar där. Den visas under Auktoriserade klienter i miljöns Delning och åtkomst, där den kan återkallas.",
8876 "dc9a0b68d101e904": "Redan länkad. Om du länkar igen förnyas den med den åtkomst du väljer.",
@@ -9439,7 +9558,6 @@
9558 "e3349eb2353ee27c": "Godkännande för nya enheter är avstängt, så en återkallad enhet som är inloggad på ditt T3 Connect-konto kan ansluta igen på egen hand.",
9559 "080160002915c666": "Kräv godkännande för nya enheter",
9560 "73dd0f86f5363431": "Enheten måste godkännas här innan den kan ansluta igen.",
9442 - "930f9e01fc4591b4": "Av",
9561 "6c7762bd72cea808": "Återansluter: {error}",
9562 "6cced6a88a19f1f2": "Återansluter",
9563 "8cbb63fdff9fde72": "Anslutningen misslyckades: {error}",
@@ -11708,7 +11826,6 @@
11826 "8ac2984f4e732091": "stäng av slå på inaktivera aktivera lokal server agenter bara fjärr starta om",
11827 "3a54b8d98911331a": "Nätverksåtkomst",
11828 "1a31308f0884a68b": "exponera backend fjärr parkoppling lokal dator gränssnitt värd starta om",
11711 - "468d32c6b30df608": "Tailscale HTTPS",
11829 "92c2528040ca7442": "serve magicdns slutpunkt fjärr säkert nätverk",
11830 "ab23b9c923cc4e80": "windows subsystem linux distro andra server projekt stoppa windows backend starta om bara wsl",
11831 "814c6f3ba7c29f7c": "hanterad tunnel moln andra enheter fjärr tunnlar gräns t3 chat",
apps/web/src/i18n/translations/zh.json
+130 -13
@@ -78,6 +78,10 @@
78 "4f1ab8a69f4a85e5": "此应用未连接到该机器",
79 "95f18b6ad4a409de": "你在该机器上的会话无法创建配对码",
80 "26847ec0357c8600": "没有其他机器可访问的地址",
81 + "ec1a698b0821ec66": "{target} 无法反向关联:该机器上的关联环境已关闭。",
82 + "6cf74ace5a766699": "{target} 无法反向关联:你在该机器上的会话无法创建关联。",
83 + "a995255a0f303086": "{target} 无法反向关联:你在 {source} 上的会话无法创建配对码。",
84 + "a51c8cdfccb5b4ca": "{target} 无法反向关联:此应用没有可访问 {source} 的地址。",
85 "cba6d3e3a22f2efe": "无法访问",
86 "0eb1a18deaf06b76": "配对码被拒绝",
87 "7d6fc963ebf9a9c5": "应答的是另一个环境",
@@ -482,6 +486,7 @@
486 "7eabeed193759388": "路由顺序必须包含每条已保存的路由,且不能重复。",
487 "18de69e3b6ac3891": "连接配置 {connectionId} 不是 Bearer 连接。",
488 "0a84ce2f4fb90d82": "连接配置 {connectionId} 不是 SSH 连接。",
489 + "468d32c6b30df608": "Tailscale HTTPS",
490 "4d022ee84149d47f": "远程连接",
491 "0b367ce72b45a911": "{host} 连接意外失败。",
492 "91ca7e48f40bfa3c": "{host} 在连接设置期间无响应。",
@@ -8110,6 +8115,9 @@
8115 "d087da5017f20fa2": "未选择环境",
8116 "cb553d31c9d1b1c7": "连接一个环境,查看其设置和访问权限。",
8117 "9a84dc0e80037e05": "此应用",
8118 + "3d96310c2214fe2d": "环境显示方式",
8119 + "41e0e5e03e07db42": "地图",
8120 + "3a8adb207fb5e078": "列表",
8121 "493685e264877b13": "权限所属环境",
8122 "5b2287f7b10cfa2f": "离线",
8123 "03f150efa96ec728": "切换到 Windows",
@@ -8410,6 +8418,110 @@
8418 "191fa21f1cfda1ef": "主机拒绝了此设备的登录。请通过“添加线路”重新配对此地址。",
8419 "219bc3612d646a01": "移除线路",
8420 "b2877341429675aa": "通过 {route}",
8421 + "537e7cf4df7a0af1": "此浏览器",
8422 + "d18ad97175bd2028": "按住 Shift 点击或拖动可选择多台",
8423 + "692153ec34a9a7bd": "在地图上查找机器",
8424 + "288ab5c45a9539a3": "查找机器",
8425 + "c263859f8bcc7b1c": "没有该名称的机器",
8426 + "ebe6ecf547a0636b": "{count, plural, other {# 个匹配项}}",
8427 + "2bb44d78cb85c097": "{count, plural, other {已选择 # 台}}",
8428 + "bcf01a26153f6425": "清除",
8429 + "d9665bd69e7fd4f4": "链接多台…",
8430 + "8d5882faf1e5fb96": "从 {source}",
8431 + "2b9e6257e6995ada": "如何使用地图",
8432 + "743b93767ec7ebf8": "选择一台机器进行管理。",
8433 + "49712bceec027141": "把加号拖到一台机器上即可关联。",
8434 + "aba23d86b0f4b66b": "一条关联只到达一台机器,并在那里终止。",
8435 + "601e0c9e6a45a54f": "让地图适应视图",
8436 + "feec58f6653f5673": "如何看这些线",
8437 + "46e0a0c6ff391521": "使用中",
8438 + "1151e8a9fb7bdfcf": "备用",
8439 + "a322337b6655de2a": "未使用",
8440 + "e31c7e76ef900ef4": "登录被拒绝",
8441 + "c032d479f9bbb166": "关联",
8442 + "d4160421f6e651bb": "双向",
8443 + "d3751f456814b2b2": "{count, plural, other {# 台机器各需要一个配对码}}",
8444 + "e0a8e0b87dca8241": "用配对码关联一台…",
8445 + "ad095a37f818d67e": "已关联的机器",
8446 + "afc01d2ee8048b4b": "{label},已选择",
8447 + "aa34f7bc5aaf6bb0": "你的机器地图",
8448 + "edb6cb27ff7f446b": "方向键在机器之间移动。Enter 打开机器的详情,包括其路由和链接。空格键选择机器以便一次链接多台。在环境上按 Tab 可到达其链接按钮。加号和减号缩放,零使地图适应视图。",
8449 + "753b4a8ec5521c98": "从 {source} 到 {target} 的关联:{summary}",
8450 + "bb6a74a47a3852c7": "已过期",
8451 + "3076117d81a9c1c0": "无响应",
8452 + "96fdb2fd529b1fbb": "出错",
8453 + "8971602c42718d72": "可访问",
8454 + "1b256867b95ee022": "{days, plural, other {{days} 天后过期}}",
8455 + "9d02cb328944fb27": "{source} 与 {target} 之间的双向关联,{access}。{source} 到 {target}:{forward}。{target} 到 {source}:{back}",
8456 + "aae31cf2017dab5b": "公网",
8457 + "b4f6c341033a3c91": "已关闭",
8458 + "960255d19109dcd9": "需要更新",
8459 + "19f6a3505837907d": "{access}。{count} 台中 {reachable} 台可访问",
8460 + "6f8f71c20ba546af": "{count} 台中 {reachable} 台可达,来自 {sources} 个环境",
8461 + "0d731c951986fac8": "{group}:{count} 个没有链接的环境,{range}",
8462 + "5feb96736385be01": "{range},{count} 台机器,由 {sources} 链接。{summary}",
8463 + "706ac721bf99036c": "{machines, plural, other {# 台机器}}",
8464 + "98cbcffdfe8b60ea": "{reachable, plural, =0 {均无法访问} other {# 台可访问}}",
8465 + "35b783cfc817cb6f": "折叠这些机器",
8466 + "14dcd5c89fd0f67f": "在地图上显示前 {shown} 台机器",
8467 + "b8f2d917d3a592df": "在地图上显示每台机器",
8468 + "ddc2106217bbde2d": "另有 {count} 台",
8469 + "b0d81579d80fb94a": "仅通过关联得知",
8470 + "2d3dc930fd1cdd55": "来自 {source}:{summary}",
8471 + "911bc3bcde1aba3b": "{count, plural, other {# 个向内的关联}}",
8472 + "930f9e01fc4591b4": "关闭",
8473 + "0fecb34fd1ae531f": "{label},在你的 T3 Connect 账户中,尚未添加到此应用。{status}",
8474 + "4a84ad9b7f8e4909": "正在加载关联…",
8475 + "9c88c8e716354091": "无法加载关联",
8476 + "f9733c7b64c6f5d9": "关联环境已关闭",
8477 + "ba30444f6d79cbdd": "无法从这里读取关联",
8478 + "6a34b35812bb4ad0": "{count, plural, =0 {没有向外的关联} other {# 个向外的关联}}",
8479 + "5d252c8bbc3b24d0": "{status}。关联未知",
8480 + "ec2c609c028d63b4": "将 {label} 关联到另一台机器",
8481 + "0a72d33781010657": "无法关联到这里",
8482 + "e93eaf3bfa0ff76b": "{count, plural, other {关联到 # 台机器}}",
8483 + "96bd315e3441c52a": "续期到 {target} 的关联",
8484 + "9f752f912897416a": "关联到 {target}",
8485 + "b40f4891ccc7af6d": "用配对码续期到 {target} 的关联",
8486 + "d51a7a2bb6b8c406": "用配对码关联到 {target}",
8487 + "f4ca5e62fb54a3a7": "拖放到一台机器上即可关联",
8488 + "11e67016507a6daa": "两条关联,每个方向一条。",
8489 + "352169e91766aeb4": "{count, plural, other {# 个需要处理}}",
8490 + "d53ada50331e6041": "{machines, plural, other {# 台机器}},{links, plural, =0 {没有关联} other {# 个关联}}",
8491 + "3e8441af6148878f": "{date} 到期",
8492 + "4daaa2288b63a801": "{count, plural, other {# 个传入链接}}",
8493 + "baf297d0add1d61b": "{count, plural, other {# 个环境}}",
8494 + "ddb9150bfa8ce6f0": "没有关联",
8495 + "a780bc462b60c3c0": "收起",
8496 + "059c335b1da34f63": "在地图上显示",
8497 + "c7e1635b229d7249": "按名称筛选这些机器",
8498 + "52a07016be1bea99": "按名称筛选",
8499 + "a7061489aec79ba8": "{shown} / {count}",
8500 + "eefe994332120d82": "关联",
8501 + "c20e4b94dddc33e7": "已连接 {connected}/{total}",
8502 + "c7a9759d8578279f": "从这里出发的每条线都是通往某个环境的已保存线路。",
8503 + "398cee23ca4dabec": "{count, plural, =0 {没有已知机器关联到这里} other {被 # 台机器关联}}",
8504 + "79e98f4a48d3df43": "将 {label} 添加到此应用即可连接。",
8505 + "da2990354cbe0fab": "仅通过关联得知",
8506 + "dfaeed73f86107ea": "未连接,因此不显示它的关联。",
8507 + "2ff64d143a690a99": "要从 {label} 发起关联,请在它的“实验功能”设置中开启关联环境。",
8508 + "eb3226bab4946cfa": "此应用无权读取 {label} 的关联。",
8509 + "59bb2a50641eb2a9": "无法加载 {label} 的关联:{error}",
8510 + "58cb9c075da185fb": "正在加载已关联的环境…",
8511 + "126e2b7a117f01d5": "{count, plural, =0 {未关联任何机器} other {关联到 # 台机器}}",
8512 + "285d95a8e5ad0ec5": "关联到",
8513 + "ee2a5f5571bca358": "反向关联…",
8514 + "57f38a04b1e5c033": "正在移除…",
8515 + "20ffe8337f8f30ba": "移除",
8516 + "1f221fe54654ed13": "访问权限",
8517 + "8b0cd4f77cc74c37": "状态",
8518 + "33386c89f3b07fea": "已过期。请使用新的配对码重新关联。",
8519 + "13d91e967cd9065c": "暂时没有响应。",
8520 + "42e613ac8acac777": "{days, plural, other {{days} 天后过期。重新关联以续期。}}",
8521 + "0990edee7035bcfe": "过期时间",
8522 + "1c161c630d28d225": "地址",
8523 + "7ee376c7db73ab57": "关联时间",
8524 + "e9f7a62ecd609a46": "上次连通",
8525 "70bae47e93a2f207": "显示完整错误",
8526 "e4099af6d85770ff": "“{font}”不是等宽字体",
8527 "a8448493d83279e2": "代码和终端需要等宽字体,已保留当前字体。",
@@ -8733,35 +8845,42 @@
8845 "03ce9bea5f88ddbd": "此应用无法确认它是你的机器之一。你粘贴的配对码会发送到那里。",
8846 "30b696434167411f": "已关联",
8847 "80bbda74ee500b82": "机器",
8848 + "4e7b0a3ced2d0f97": "关联多个环境",
8849 + "0f3a6d9b3350d800": "从 {source} 链接多台机器",
8850 "e5ac7abeaeb78750": "取消全选",
8851 "ab520df47bca22d2": "全选",
8852 "3a57c9bbcd12529f": "无法检查哪些机器已关联,因此暂时无法选择:{error}",
8853 + "4381e144bbeaddb2": "已双向关联",
8854 + "692450a6537f52a8": "仅单向关联",
8855 "78ccf685018ef797": "已关联",
8856 + "956b5c20a1fba7c1": "无法反向关联:{reason}",
8857 + "641c3b24cbc7d86b": "{count, plural, other {# 台机器需要配对码,因此未列出。}}",
8858 "87433cf138dc3e2c": "{linked, plural, other {已关联 # 台机器。}}",
8859 "d044bb95248da10c": "已关联 {linked}/{total} 台。失败的机器仍保持选中,你可以重试。",
8860 + "079237b461191c9a": "{count, plural, other {# 台机器无法反向关联。}}",
8861 + "86d17c42dae16356": "同时让每台机器反向关联到 {source}",
8862 + "23fd4db8faa1a001": "之后那里的智能体也能在 {source} 上工作。",
8863 + "35d59319f62bd505": "{count, plural, other {# 台机器保持单向关联。}}",
8864 "d2fbaffe08b6cf60": "{count, plural, other {关联 # 台机器}}",
8865 "8e3378b526d615f4": "关联多个…",
8744 - "7f8d6d1af69829d8": "关联多个环境",
8866 "b550d04490078bda": "这里的智能体随后就能在你选择的每台机器上启动会话、发送消息并等待结果。每个连接将显示在对应机器“共享与访问”的“已授权客户端”中,可在那里撤销。",
8867 + "e1c2c3bd84d7bcd7": "此应用未连接到你选择的任何机器。",
8868 "c2553b323479499a": "此应用不知道其他机器。请先在“环境”中添加。",
8869 "18b1d4d42b945b34": "机器",
8870 "03860d65c4052ab5": "正在检查哪些机器已关联…",
8871 "4cea6be0fe6be16f": "无法加载已关联的环境",
8750 - "58cb9c075da185fb": "正在加载已关联的环境…",
8872 "25b74062dc03079e": "没有已关联的环境",
8873 "6698127fcc912f23": "关联另一台运行 T3 Code 的机器(例如 VPS),让这里的智能体能够在那台机器上启动和操作会话。",
8753 - "ad5ed0ce61b966eb": "忘记 {label}?此处的智能体将停止在那里工作。在 {label} 的“共享与访问”中撤销“T3 Code · …”,以同时结束那里的连接。",
8754 - "81c9796bf61b306a": "无法移除关联",
8755 - "33386c89f3b07fea": "已过期。请使用新的配对码重新关联。",
8756 - "13d91e967cd9065c": "暂时没有响应。",
8757 - "42e613ac8acac777": "{days, plural, other {{days} 天后过期。重新关联以续期。}}",
8758 - "8971602c42718d72": "可访问",
8759 - "57f38a04b1e5c033": "正在移除…",
8760 - "20ffe8337f8f30ba": "移除",
8874 "e1789f863205ad5a": "无法关联环境",
8875 + "836dde1b729e6f0a": "已双向关联 {source} 和 {target}",
8876 "40cde51afa218290": "已关联 {label}",
8763 - "eefe994332120d82": "关联",
8877 + "ca4e4015b89ed9a8": "无法将 {target} 反向关联到 {source}",
8878 + "64ac3d1579ca9f5b": "将 {source} 关联到 {target}",
8879 "fb71127e5746a6bc": "从远端“共享与访问”页面或 t3 pair 获取",
8880 + "1e3fee7084791773": "同时将 {target} 反向关联到 {source}",
8881 + "ea34a190b0bd804c": "之后 {target} 上的智能体也能在 {source} 上工作。",
8882 + "ad5ed0ce61b966eb": "忘记 {label}?此处的智能体将停止在那里工作。在 {label} 的“共享与访问”中撤销“T3 Code · …”,以同时结束那里的连接。",
8883 + "81c9796bf61b306a": "无法移除关联",
8884 "130e51beb6cf5aad": "关联环境",
8885 "122c3e355699e69d": "这里的智能体随后就能在该环境中启动会话、发送消息并等待结果。此连接将显示在该环境“共享与访问”的“已授权客户端”中,可在那里撤销。",
8886 "dc9a0b68d101e904": "已关联。再次关联将使用你选择的访问权限续期。",
@@ -9447,7 +9566,6 @@
9566 "e3349eb2353ee27c": "新设备审批未开启,因此已撤销但仍登录你的 T3 Connect 账号的设备可以自行重新连接。",
9567 "080160002915c666": "新设备连接需要审批",
9568 "73dd0f86f5363431": "设备必须在此获批后才能重新连接。",
9450 - "930f9e01fc4591b4": "关闭",
9569 "6c7762bd72cea808": "正在重新连接:{error}",
9570 "6cced6a88a19f1f2": "正在重新连接",
9571 "8cbb63fdff9fde72": "连接失败:{error}",
@@ -11724,7 +11842,6 @@
11842 "8ac2984f4e732091": "关闭 开启 禁用 启用 本地服务器 智能体 仅远程 重启",
11843 "3a54b8d98911331a": "网络访问",
11844 "1a31308f0884a68b": "公开 后端 远程 配对 本地机器 网络接口 主机 重启",
11727 - "468d32c6b30df608": "Tailscale HTTPS",
11845 "92c2528040ca7442": "serve magicdns 端点 远程 安全 网络",
11846 "ab23b9c923cc4e80": "windows 子系统 linux 发行版 第二服务器 项目 停止 windows 后端 重启 wsl 仅",
11847 "814c6f3ba7c29f7c": "托管隧道 云 其他设备 远程 隧道 限制 t3 chat",
apps/web/src/state/environments.ts
+13
@@ -7,6 +7,7 @@ import {
7 import { Discovery } from "@t3tools/client-runtime/relay";
8 import type { EnvironmentId } from "@t3tools/contracts";
9 import * as Option from "effect/Option";
10 +import { useState } from "react";
11
12 import { environmentCatalog } from "../connection/catalog";
13 import { appAtomRegistry } from "../rpc/atomRegistry";
@@ -105,6 +106,18 @@ export function useRelayEnvironmentDiscovery(): Discovery.RelayEnvironmentDiscov
106 return useAtomValue(relayEnvironmentDiscovery.stateValueAtom);
107 }
108
109 +/**
110 + * The account's T3 Connect machines for a view that keeps one in front of the user. A refresh
111 + * empties the list until it answers; the machines last seen stay meanwhile.
112 + */
113 +export function useRetainedRelayEnvironments() {
114 + const discovery = useRelayEnvironmentDiscovery();
115 + const [seen, setSeen] = useState(discovery.environments);
116 + const emptied = discovery.refreshing && discovery.environments.size === 0;
117 + if (!emptied && seen !== discovery.environments) setSeen(discovery.environments);
118 + return emptied ? seen : discovery.environments;
119 +}
120 +
121 export function useEnvironmentIdentities() {
122 return useAtomValue(environmentSummaries.identitiesAtom);
123 }
apps/web/src/state/peerLinks.ts
+70 -1
@@ -4,12 +4,14 @@ import {
4 linkedEnvironmentNames,
5 offersLinkedEnvironments,
6 } from "@t3tools/client-runtime/link-request";
7 +import { linkBackOffer, type LinkBackOffer } from "@t3tools/client-runtime/link-batch";
8 import { createPeerLinkEnvironmentAtoms } from "@t3tools/client-runtime/state/peerLinks";
8 -import { AuthAccessReadScope, type EnvironmentId } from "@t3tools/contracts";
9 +import { AuthAccessReadScope, AuthAccessWriteScope, type EnvironmentId } from "@t3tools/contracts";
10 import { Atom } from "effect/reactivity";
11 import { useEffect, useEffectEvent } from "react";
12
13 import { connectionAtomRuntime } from "../connection/runtime";
14 +import { environmentAtomList, environmentIdsKey } from "./environmentAtomList";
15 import { useEnvironmentIdentities, useEnvironments } from "./environments";
16 import { environmentPresentations } from "./presentation";
17 import { relayEnvironmentDiscovery } from "./relay";
@@ -19,6 +21,11 @@ import { useAtomCommand } from "./use-atom-command";
21
22 export const peerLinkEnvironment = createPeerLinkEnvironmentAtoms(connectionAtomRuntime);
23
24 +/** Each environment's link list as the settings list loads it, in the order of the ids. */
25 +export const peerLinkListsAtom = environmentAtomList("peer-links:lists", (environmentId) =>
26 + peerLinkEnvironment.list({ environmentId, input: {} }),
27 +);
28 +
29 /** Whether `environmentId` offers links, so its threads may name another machine. */
30 export const offersLinkedEnvironmentsAtom = Atom.family((environmentId: EnvironmentId) =>
31 Atom.make((get) =>
@@ -91,3 +98,65 @@ export function useLinkableMachines(environmentId: EnvironmentId, enabled: boole
98 connect: discovery.environments,
99 });
100 }
101 +
102 +const NOT_OFFERED: LinkBackOffer = { kind: "hidden" };
103 +
104 +/**
105 + * Whether linking `sourceId` to each of `targetIds` can also link that machine back, and the
106 + * source as the reverse link names it. Only machines that could link back are asked for their
107 + * links, and only while `enabled`: listing asks every machine they link to whether it answers.
108 + */
109 +export function useLinkBackOffers(
110 + sourceId: EnvironmentId,
111 + targetIds: ReadonlyArray<EnvironmentId>,
112 + enabled: boolean,
113 +) {
114 + const { environments } = useEnvironments();
115 + const discovery = useAtomValue(relayEnvironmentDiscovery.stateValueAtom);
116 + const writable = useEnvironmentsWithScope(environments, AuthAccessWriteScope);
117 + const source = linkableMachines({
118 + environments,
119 + threadEnvironmentId: null,
120 + links: [],
121 + connect: discovery.environments,
122 + }).find((machine) => machine.environmentId === sourceId);
123 + const wanted = new Set(targetIds);
124 + const targets = environments.filter((environment) => wanted.has(environment.environmentId));
125 + const listed = targets
126 + .filter(
127 + (target) =>
128 + enabled &&
129 + target.connection.phase === "connected" &&
130 + offersLinkedEnvironments(target.serverConfig) &&
131 + writable.has(target.environmentId),
132 + )
133 + .map((target) => target.environmentId);
134 + const lists = useAtomValue(peerLinkListsAtom(environmentIdsKey(listed)));
135 + const offers = new Map<EnvironmentId, LinkBackOffer>();
136 + for (const target of targets) {
137 + if (source === undefined) break;
138 + const list = lists[listed.indexOf(target.environmentId)];
139 + offers.set(
140 + target.environmentId,
141 + linkBackOffer({
142 + source: {
143 + environmentId: sourceId,
144 + connected: source.connected,
145 + writable: writable.has(sourceId),
146 + urls: source.urls,
147 + },
148 + target: {
149 + connected: target.connection.phase === "connected",
150 + offersLinks: offersLinkedEnvironments(target.serverConfig),
151 + writable: writable.has(target.environmentId),
152 + links: list?._tag === "Success" ? list.value.links : null,
153 + },
154 + }),
155 + );
156 + }
157 + return {
158 + source: source ?? null,
159 + offerFor: (targetId: EnvironmentId | null): LinkBackOffer =>
160 + (targetId === null ? undefined : offers.get(targetId)) ?? NOT_OFFERED,
161 + };
162 +}
apps/web/src/state/session.ts
+6
@@ -100,6 +100,12 @@ export function usePreparedConnection(environmentId: EnvironmentId | null) {
100 );
101 }
102
103 +/** Each environment's prepared connection, in the order of the ids. */
104 +export const preparedConnectionsAtom = environmentAtomList(
105 + "web-prepared-connections",
106 + environmentSession.preparedConnectionValueAtom,
107 +);
108 +
109 export function readPreparedConnection(environmentId: EnvironmentId) {
110 return Option.getOrNull(
111 appAtomRegistry.get(environmentSession.preparedConnectionValueAtom(environmentId)),
docs/user/remote-access.md
+37
@@ -470,6 +470,43 @@ an address you trust: the code is sent there.
470 does one to a machine on an older T3 Code after 30 days; link again with a
471 new pairing code.
472
473 +On web and desktop, **Settings → Environments** opens as a map of your machines:
474 +this app, each environment with one line per route (the one in use is
475 +highlighted), and the machines an environment links to. Select a machine to
476 +manage it, or switch to **List** for the same controls as rows. To link from
477 +the map, drag the plus on an environment onto another machine, or press it and
478 +pick one. If this app is connected to both machines, knows an address the first
479 +can reach the other at, and its session on the other one manages access there,
480 +it needs no pairing code.
481 +
482 +A link goes one way. To let the other machine's agents work back, tick **Also
483 +link … back** when you create the link, or select a one-way link and use
484 +**Link back…**. It is offered when this app is connected to both machines and
485 +may manage access on each. Two machines linked to each other at the same access
486 +are drawn as one line with an arrowhead at each end; they are still two links,
487 +and each is forgotten on its own.
488 +
489 +To link one environment to several machines at once, Shift-click the machines
490 +(or Shift-drag a box around them, or press Space on a focused machine), then
491 +drag the environment's plus onto any of them, or use **Link several…** above
492 +the map. Dropping the plus on a stack offers the stack's machines. The dialog
493 +ticks the machines it can link without a pairing code and says why for the
494 +rest. When this app is connected to none of them, each needs a pairing code,
495 +so the map says so and offers to link one at a time instead.
496 +
497 +Large setups fold: machines known only through links that share the same
498 +linking environments and access levels become one stack, and once this app
499 +knows more than 12 environments, the ones that are not connected and have no
500 +links fold by state. Select a stack to list and filter every machine in it.
501 +Opening a stack on the map draws its first 24 below its card: the rest of the
502 +map stays where it is and the map grows taller, so pan or press the fit button
503 +to see all of it. **Find a machine** above the map searches by name, and Enter
504 +goes to the first match. The **?** button above the map lists these gestures.
505 +
506 +The map draws the links of the machines this app is connected to; a machine it
507 +is not connected to may hold links the map cannot show. A link reaches one
508 +machine and does not carry on through that machine's own links.
509 +
510 An agent can also hand a task to a linked machine with `delegate_task`: it runs
511 there as an ordinary thread, in the project with the same repository (or the
512 one `target.projectId` names), and this thread wakes with its result when it
packages/client-runtime/src/connection/routes.test.ts
+6 -1
@@ -75,7 +75,12 @@ describe("connection routes", () => {
75 expect(connectionRouteKind(PUBLIC)).toBe("public");
76 expect(connectionRouteKind(direct("lo", "http://127.0.0.1:3773/"))).toBe("loopback");
77 expect(connectionRouteKind(direct("ts6", "http://[fd7a:115c:a1e0::1]:3773/"))).toBe("tailnet");
78 - expect(connectionRouteLabel(TAILNET)).toBe("Tailscale");
78 + expect(connectionRouteLabel(direct("ts-ip", "http://[fd7a:115c:a1e0::1]:3773/"))).toBe(
79 + "Tailscale",
80 + );
81 + expect(connectionRouteLabel(direct("ts-serve", "https://box.tail1234.ts.net/"))).toBe(
82 + "Tailscale HTTPS",
83 + );
84 expect(connectionRouteLabel(RELAY)).toBe("T3 Connect");
85 });
86
packages/client-runtime/src/connection/routes.ts
+5 -1
@@ -200,7 +200,11 @@ export function connectionRouteLabel(route: ConnectionRoute): string {
200 case "lan":
201 return "LAN";
202 case "tailnet":
203 - return "Tailscale";
203 + // Tailscale Serve answers over HTTPS on the machine's name; the same machine's
204 + // plain address is another route, so the two are told apart.
205 + return routeHttpBaseUrl(route)?.startsWith("https:") === true
206 + ? msg("Tailscale HTTPS")
207 + : "Tailscale";
208 case "vpn":
209 return "VPN";
210 case "ssh": {
packages/client-runtime/src/linkBatch.test.ts
+125 -1
@@ -2,7 +2,13 @@ import { EnvironmentId, PeerLinkError } from "@t3tools/contracts";
2 import * as Result from "effect/Result";
3 import { describe, expect, it } from "vite-plus/test";
4
5 -import { linkBatchCandidates, linkBatchSummary, linkListState, runLinkBatch } from "./linkBatch.ts";
5 +import {
6 + linkBackOffer,
7 + linkBatchCandidates,
8 + linkBatchSummary,
9 + linkListState,
10 + runLinkBatch,
11 +} from "./linkBatch.ts";
12 import type { LinkableMachine } from "./linkRequest.ts";
13
14 const machine = (name: string, overrides: Partial<LinkableMachine> = {}): LinkableMachine => ({
@@ -180,3 +186,121 @@ describe("runLinkBatch", () => {
186 expect(events.filter((event) => event === "refresh").length).toBe(2);
187 });
188 });
189 +
190 +describe("linkBackOffer", () => {
191 + const source = {
192 + environmentId: id("source"),
193 + connected: true,
194 + writable: true,
195 + urls: ["https://source.example.ts.net"],
196 + };
197 + const target = { connected: true, offersLinks: true, writable: true, links: [] };
198 + const offer = (overrides: {
199 + readonly source?: Partial<typeof source>;
200 + readonly target?: Partial<Parameters<typeof linkBackOffer>[0]["target"]> | null;
201 + }) =>
202 + linkBackOffer({
203 + source: { ...source, ...overrides.source },
204 + target: overrides.target === null ? null : { ...target, ...overrides.target },
205 + });
206 +
207 + it("is offered only when the client can make the reverse link with no pasted code", () => {
208 + expect(offer({})).toEqual({ kind: "offered" });
209 + // An expired reverse link no longer counts: linking back renews it.
210 + expect(
211 + offer({ target: { links: [{ environmentId: id("source"), status: "expired" }] } }),
212 + ).toEqual({ kind: "offered" });
213 + expect(
214 + offer({ target: { links: [{ environmentId: id("other"), status: "reachable" }] } }),
215 + ).toEqual({ kind: "offered" });
216 + });
217 +
218 + it("says nothing where the user would not expect it", () => {
219 + for (const hidden of [
220 + offer({ target: null }),
221 + offer({ target: { connected: false } }),
222 + offer({ source: { connected: false } }),
223 + // Not known yet, or already linked back: offering could replace a working token.
224 + offer({ target: { links: null } }),
225 + offer({ target: { links: [{ environmentId: id("source"), status: "reachable" }] } }),
226 + offer({ target: { links: [{ environmentId: id("source"), status: "unreachable" }] } }),
227 + ]) {
228 + expect(hidden).toEqual({ kind: "hidden" });
229 + }
230 + });
231 +
232 + it("names what is in the way between two connected environments", () => {
233 + expect(offer({ target: { offersLinks: false } })).toEqual({
234 + kind: "blocked",
235 + reason: "target_links_off",
236 + });
237 + expect(offer({ target: { writable: false } })).toEqual({
238 + kind: "blocked",
239 + reason: "target_no_access",
240 + });
241 + expect(offer({ source: { writable: false } })).toEqual({
242 + kind: "blocked",
243 + reason: "source_no_access",
244 + });
245 + expect(offer({ source: { urls: [] } })).toEqual({
246 + kind: "blocked",
247 + reason: "source_no_address",
248 + });
249 + });
250 +});
251 +
252 +describe("runLinkBatch link back", () => {
253 + it("links back from each eligible machine, and a reverse failure keeps the forward link", async () => {
254 + const source = machine("source");
255 + const reverse: Array<unknown> = [];
256 + const minted: Array<string> = [];
257 + const outcomes = await runLinkBatch({
258 + machines: [machine("a"), machine("b"), machine("c"), machine("d")],
259 + access: "full-access",
260 + mint: async (environmentId) => {
261 + minted.push(environmentId);
262 + return Result.succeed(`code-for-${environmentId}`);
263 + },
264 + link: async (input) =>
265 + input.expectedLabel === "d" ? Result.fail(new Error("refused")) : Result.succeed(null),
266 + back: {
267 + source,
268 + targets: new Set([id("a"), id("b"), id("d")]),
269 + link: async (environmentId, input) => {
270 + reverse.push([environmentId, input]);
271 + return environmentId === id("b")
272 + ? Result.fail(
273 + new PeerLinkError({ reason: "unreachable", message: "source did not answer." }),
274 + )
275 + : Result.succeed(null);
276 + },
277 + },
278 + refreshLinks: () => {},
279 + });
280 + expect(Object.fromEntries(outcomes)).toEqual({
281 + [id("a")]: { kind: "linked", back: { kind: "linked" } },
282 + [id("b")]: {
283 + kind: "linked",
284 + back: { kind: "failed", failure: "unreachable", detail: "source did not answer." },
285 + },
286 + // Not eligible, so not attempted.
287 + [id("c")]: { kind: "linked" },
288 + // Its own link failed, so nothing links back.
289 + [id("d")]: { kind: "failed", failure: "other", detail: null },
290 + });
291 + // The reverse link is made on the machine, with a code minted on the source for it.
292 + expect(reverse[0]).toEqual([
293 + id("a"),
294 + {
295 + url: "https://source.example.ts.net",
296 + alternateUrls: ["http://100.64.0.1:3773"],
297 + expectedEnvironmentId: id("source"),
298 + expectedLabel: "source",
299 + pairingCode: `code-for-${id("source")}`,
300 + access: "full-access",
301 + },
302 + ]);
303 + expect(minted.filter((environmentId) => environmentId === id("source")).length).toBe(2);
304 + expect(linkBatchSummary(outcomes)).toEqual({ linked: 3, failed: [id("d")] });
305 + });
306 +});
packages/client-runtime/src/linkBatch.ts
+162 -24
@@ -3,6 +3,7 @@ import {
3 type EnvironmentId,
4 type PeerLinkCreateInput,
5 type PeerLinkFailureKind,
6 + type PeerLinkSummary,
7 peerLinkFailureKind,
8 } from "@t3tools/contracts";
9 import * as Result from "effect/Result";
@@ -82,12 +83,110 @@ export const linkBatchBlockLabel = (
83 }
84 };
85
86 +/** Why the link back, from the linked machine to the linking one, is not offered. */
87 +export type LinkBackBlock =
88 + | "target_links_off"
89 + | "target_no_access"
90 + | "source_no_access"
91 + | "source_no_address";
92 +
93 +/**
94 + * `hidden`: the user would not expect it, so nothing is shown. `blocked`: both machines are
95 + * the user's own connected environments, so one line says what is in the way.
96 + */
97 +export type LinkBackOffer =
98 + | { readonly kind: "offered" }
99 + | { readonly kind: "blocked"; readonly reason: LinkBackBlock }
100 + | { readonly kind: "hidden" };
101 +
102 +/**
103 + * Whether linking `source` to `target` can also link `target` back with no pasted code. The
104 + * reverse is an ordinary link made on the target: the client creates it there and mints its
105 + * pairing code on the source, each with its own session, at an address it has for the source.
106 + */
107 +export const linkBackOffer = (input: {
108 + /** Null for a machine the client has not saved, such as a typed address. */
109 + readonly target: {
110 + readonly connected: boolean;
111 + /** Linked environments is supported and switched on there. */
112 + readonly offersLinks: boolean;
113 + /** The client's session there may create links: `access:write`. */
114 + readonly writable: boolean;
115 + /** Its own links: null until they are known. */
116 + readonly links: ReadonlyArray<Pick<PeerLinkSummary, "environmentId" | "status">> | null;
117 + } | null;
118 + readonly source: {
119 + readonly environmentId: EnvironmentId;
120 + readonly connected: boolean;
121 + /** The client's session there may create pairing codes: `access:write`. */
122 + readonly writable: boolean;
123 + readonly urls: ReadonlyArray<string>;
124 + };
125 +}): LinkBackOffer => {
126 + const { target, source } = input;
127 + if (target === null || !target.connected || !source.connected) return { kind: "hidden" };
128 + if (!target.offersLinks) return { kind: "blocked", reason: "target_links_off" };
129 + if (!target.writable) return { kind: "blocked", reason: "target_no_access" };
130 + if (!source.writable) return { kind: "blocked", reason: "source_no_access" };
131 + if (source.urls.length === 0) return { kind: "blocked", reason: "source_no_address" };
132 + // Unknown or already there: offering it could replace a working token.
133 + if (
134 + target.links === null ||
135 + target.links.some(
136 + (link) => link.environmentId === source.environmentId && link.status !== "expired",
137 + )
138 + ) {
139 + return { kind: "hidden" };
140 + }
141 + return { kind: "offered" };
142 +};
143 +
144 +export const linkBackBlockLabel = (
145 + blocked: LinkBackBlock,
146 + names: { readonly source: string; readonly target: string },
147 + resolve: MFunctionType = mFallback,
148 +): string => {
149 + switch (blocked) {
150 + case "target_links_off":
151 + return resolve(
152 + msg("{target} cannot link back: Linked environments is off there.", {
153 + target: names.target,
154 + }),
155 + );
156 + case "target_no_access":
157 + return resolve(
158 + msg("{target} cannot link back: your session there cannot create links.", {
159 + target: names.target,
160 + }),
161 + );
162 + case "source_no_access":
163 + return resolve(
164 + msg("{target} cannot link back: your session on {source} cannot create pairing codes.", {
165 + source: names.source,
166 + target: names.target,
167 + }),
168 + );
169 + case "source_no_address":
170 + return resolve(
171 + msg("{target} cannot link back: this app has no address for {source} it can reach.", {
172 + source: names.source,
173 + target: names.target,
174 + }),
175 + );
176 + }
177 +};
178 +
179 export type LinkBatchFailure = PeerLinkFailureKind | "no_code";
180
87 -export type LinkBatchOutcome =
181 +export type LinkAttemptOutcome =
182 | { readonly kind: "linked" }
183 | { readonly kind: "failed"; readonly failure: LinkBatchFailure; readonly detail: string | null };
184
185 +/** `back` is set when the link back was asked for: it never changes how the link itself went. */
186 +export type LinkBatchOutcome =
187 + | { readonly kind: "linked"; readonly back?: LinkAttemptOutcome }
188 + | { readonly kind: "failed"; readonly failure: LinkBatchFailure; readonly detail: string | null };
189 +
190 export const linkBatchFailureLabel = (
191 failure: LinkBatchFailure,
192 resolve: MFunctionType = mFallback,
@@ -110,7 +209,7 @@ export const linkBatchFailureLabel = (
209 * Only the linking environment's own error passes its message through:
210 * anything else may carry the request, and with it the pairing code.
211 */
113 -const linkFailure = (failure: unknown): LinkBatchOutcome => {
212 +const linkFailure = (failure: unknown): LinkAttemptOutcome & { readonly kind: "failed" } => {
213 if (
214 typeof failure === "object" &&
215 failure !== null &&
@@ -128,6 +227,41 @@ const linkFailure = (failure: unknown): LinkBatchOutcome => {
227
228 type BatchMachine = Pick<LinkableMachine, "environmentId" | "label" | "urls">;
229
230 +type MintPairingCode = (
231 + environmentId: EnvironmentId,
232 + access: AuthMcpClientAccess,
233 +) => Promise<Result.Result<string, unknown>>;
234 +
235 +/**
236 + * One link to `machine`: a one-use code minted there with the client's session, handed to
237 + * `link` with the addresses the client has for it. The code stays in this call.
238 + */
239 +export async function linkWithMintedCode(input: {
240 + readonly machine: BatchMachine;
241 + readonly access: AuthMcpClientAccess;
242 + readonly mint: MintPairingCode;
243 + readonly link: (input: PeerLinkCreateInput) => Promise<Result.Result<unknown, unknown>>;
244 +}): Promise<LinkAttemptOutcome> {
245 + const { machine } = input;
246 + const [url, ...alternateUrls] = machine.urls;
247 + if (url === undefined) return { kind: "failed", failure: "unreachable", detail: null };
248 + try {
249 + const minted = await input.mint(machine.environmentId, input.access);
250 + if (Result.isFailure(minted)) return { kind: "failed", failure: "no_code", detail: null };
251 + const linked = await input.link({
252 + url,
253 + ...(alternateUrls.length > 0 ? { alternateUrls } : {}),
254 + expectedEnvironmentId: machine.environmentId,
255 + expectedLabel: machine.label,
256 + pairingCode: minted.success,
257 + access: input.access,
258 + });
259 + return Result.isSuccess(linked) ? { kind: "linked" } : linkFailure(linked.failure);
260 + } catch {
261 + return { kind: "failed", failure: "other", detail: null };
262 + }
263 +}
264 +
265 /**
266 * Links each machine as a single link is made: a one-use code minted on that
267 * machine with the client's session there, then handed to the linking
@@ -137,39 +271,43 @@ type BatchMachine = Pick<LinkableMachine, "environmentId" | "label" | "urls">;
271 export async function runLinkBatch(input: {
272 readonly machines: ReadonlyArray<BatchMachine>;
273 readonly access: AuthMcpClientAccess;
140 - readonly mint: (
141 - environmentId: EnvironmentId,
142 - access: AuthMcpClientAccess,
143 - ) => Promise<Result.Result<string, unknown>>;
274 + readonly mint: MintPairingCode;
275 readonly link: (input: PeerLinkCreateInput) => Promise<Result.Result<unknown, unknown>>;
276 + /**
277 + * Also links each of `targets` back to `source` once its own link is made. `link` creates
278 + * the link on that machine. A failure here is reported beside the link it follows.
279 + */
280 + readonly back?: {
281 + readonly source: BatchMachine;
282 + readonly targets: ReadonlySet<EnvironmentId>;
283 + readonly link: (
284 + environmentId: EnvironmentId,
285 + input: PeerLinkCreateInput,
286 + ) => Promise<Result.Result<unknown, unknown>>;
287 + };
288 /** Called once, at the end: listing probes every linked machine, so `link` must not refresh. */
289 readonly refreshLinks: () => void;
290 readonly onOutcome?: (environmentId: EnvironmentId, outcome: LinkBatchOutcome) => void;
291 }): Promise<ReadonlyMap<EnvironmentId, LinkBatchOutcome>> {
292 const outcomes = new Map<EnvironmentId, LinkBatchOutcome>();
293 + const { access, mint, back } = input;
294 const linkOne = async (machine: BatchMachine): Promise<LinkBatchOutcome> => {
151 - const [url, ...alternateUrls] = machine.urls;
152 - if (url === undefined) return { kind: "failed", failure: "unreachable", detail: null };
153 - const minted = await input.mint(machine.environmentId, input.access);
154 - if (Result.isFailure(minted)) return { kind: "failed", failure: "no_code", detail: null };
155 - const linked = await input.link({
156 - url,
157 - ...(alternateUrls.length > 0 ? { alternateUrls } : {}),
158 - expectedEnvironmentId: machine.environmentId,
159 - expectedLabel: machine.label,
160 - pairingCode: minted.success,
161 - access: input.access,
162 - });
163 - return Result.isSuccess(linked) ? { kind: "linked" } : linkFailure(linked.failure);
295 + const outcome = await linkWithMintedCode({ machine, access, mint, link: input.link });
296 + if (outcome.kind !== "linked" || !back?.targets.has(machine.environmentId)) return outcome;
297 + return {
298 + kind: "linked",
299 + back: await linkWithMintedCode({
300 + machine: back.source,
301 + access,
302 + mint,
303 + link: (create) => back.link(machine.environmentId, create),
304 + }),
305 + };
306 };
307 const queue = [...input.machines];
308 const worker = async () => {
309 for (let machine = queue.shift(); machine !== undefined; machine = queue.shift()) {
168 - const outcome = await linkOne(machine).catch((): LinkBatchOutcome => ({
169 - kind: "failed",
170 - failure: "other",
171 - detail: null,
172 - }));
310 + const outcome = await linkOne(machine);
311 outcomes.set(machine.environmentId, outcome);
312 input.onOutcome?.(machine.environmentId, outcome);
313 }
packages/client-runtime/src/linkRequest.ts
+2 -1
@@ -111,7 +111,8 @@ export function linkableMachines(input: {
111 readonly environments: ReadonlyArray<
112 EnvironmentPresentation & { readonly environmentId: EnvironmentId }
113 >;
114 - readonly threadEnvironmentId: EnvironmentId;
114 + /** Null lists every machine, for a view that is not about one environment. */
115 + readonly threadEnvironmentId: EnvironmentId | null;
116 readonly links: ReadonlyArray<Pick<PeerLinkSummary, "environmentId" | "status">>;
117 readonly connect: ReadonlyMap<string, RelayDiscoveredEnvironment>;
118 }): ReadonlyArray<LinkableMachine> {