@devries-cameron20 / t3code Mirror · read-only / commits / 8e8ff9b243
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

feat: link several environments at once (#39426)

Julius Marminge committed Nov 19, 2026 at 18:47 UTC 8e8ff9b243e5a4c3a837c9033a134b62aac7dade
35 files changed +1894 -73
apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx
+12 -6
@@ -3,7 +3,7 @@ import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScroll
3
4 import { useNavigation } from "@react-navigation/native";
5 import type { EnvironmentId } from "@t3tools/contracts";
6 -import { useState } from "react";
6 +import { Fragment, useState } from "react";
7 import { View } from "react-native";
8 import { useSafeAreaInsets } from "react-native-safe-area-context";
9
@@ -12,6 +12,7 @@ import { useRemoteConnections } from "../../state/use-remote-environment-registr
12 import { LocalEnvironmentList } from "./LocalEnvironmentList";
13 import { PullRequestRoutingSettings } from "./PullRequestRoutingSettings";
14 import { LinkedEnvironmentsSection } from "./LinkedEnvironmentsSection";
15 +import { LinkSeveralEnvironmentsAction } from "./LinkSeveralEnvironments";
16
17 export function ConnectionsRouteScreen() {
18 const gt = useGT();
@@ -65,11 +66,16 @@ export function ConnectionsRouteScreen() {
66 {connectedEnvironments
67 .filter((environment) => environment.connectionState === "connected")
68 .map((environment) => (
68 - <LinkedEnvironmentsSection
69 - key={environment.environmentId}
70 - environmentId={environment.environmentId}
71 - environmentLabel={environment.environmentLabel}
72 - />
69 + <Fragment key={environment.environmentId}>
70 + <LinkedEnvironmentsSection
71 + environmentId={environment.environmentId}
72 + environmentLabel={environment.environmentLabel}
73 + />
74 + <LinkSeveralEnvironmentsAction
75 + environmentId={environment.environmentId}
76 + environmentLabel={environment.environmentLabel}
77 + />
78 + </Fragment>
79 ))}
80 <PullRequestRoutingSettings />
81 </ScrollView>
apps/mobile/src/features/connection/LinkSeveralEnvironments.tsx new
+344
@@ -0,0 +1,344 @@
1 +import { useAtomValue } from "@effect/atom-react";
2 +import {
3 + linkBatchBlockLabel,
4 + linkBatchCandidates,
5 + linkBatchFailureLabel,
6 + type LinkBatchOutcome,
7 + linkBatchSummary,
8 + linkListState,
9 + runLinkBatch,
10 +} from "@t3tools/client-runtime/link-batch";
11 +import { offersLinkedEnvironments } from "@t3tools/client-runtime/link-request";
12 +import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
13 +import {
14 + AuthAccessWriteScope,
15 + type AuthMcpClientAccess,
16 + type EnvironmentId,
17 +} from "@t3tools/contracts";
18 +import * as Result from "effect/Result";
19 +import { T, useGT, useMessages } from "gt-react-native";
20 +import { useMemo, useRef, useState } from "react";
21 +import { Pressable, ScrollView, View } from "react-native";
22 +import { useSafeAreaInsets } from "react-native-safe-area-context";
23 +
24 +import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
25 +import { SymbolView } from "../../components/ui/AppSymbol";
26 +import { AppText as Text } from "../../components/ui/AppText";
27 +import { Button } from "../../components/ui/Button";
28 +import { ListChoiceRow } from "../../components/ui/ListChoiceRow";
29 +import { Sheet } from "../../components/ui/Sheet";
30 +import { useEnvironmentServerConfig } from "../../state/entities";
31 +import { useEnvironments } from "../../state/environments";
32 +import { peerLinkEnvironment, useLinkableMachines } from "../../state/peerLinks";
33 +import { mintPairingCodeOn } from "../../state/peerPairingCode";
34 +import { useEnvironmentQuery } from "../../state/query";
35 +import { useEnvironmentsWithScope } from "../../state/session";
36 +import { useAtomCommand } from "../../state/use-atom-command";
37 +import { SettingsSection } from "../settings/components/SettingsSection";
38 +import { LINK_ACCESS_CHOICES } from "../threads/LinkRequestCard";
39 +
40 +const NO_MACHINES: ReadonlySet<EnvironmentId> = new Set();
41 +const NO_OUTCOMES: ReadonlyMap<EnvironmentId, LinkBatchOutcome> = new Map();
42 +
43 +/** Offers a batch link from `environmentId` once this app has two other machines saved. */
44 +export function LinkSeveralEnvironmentsAction(props: {
45 + readonly environmentId: EnvironmentId;
46 + readonly environmentLabel: string;
47 +}) {
48 + const gt = useGT();
49 + const [open, setOpen] = useState(false);
50 + const config = useEnvironmentServerConfig(props.environmentId);
51 + const canLink = useAtomValue(peerLinkEnvironment.link.permissionAtom(props.environmentId));
52 + const otherMachines = useEnvironments().environments.length - 1;
53 + if (!canLink || !offersLinkedEnvironments(config) || otherMachines < 2) return null;
54 + return (
55 + <View className="mt-3">
56 + <Button
57 + label={gt("Link several machines to {environment}…", {
58 + environment: props.environmentLabel,
59 + })}
60 + onPress={() => setOpen(true)}
61 + fullWidth
62 + />
63 + {open ? (
64 + <LinkSeveralSheet environmentId={props.environmentId} onClose={() => setOpen(false)} />
65 + ) : null}
66 + </View>
67 + );
68 +}
69 +
70 +/**
71 + * Each pairing code is minted on its machine and passed straight to the linking
72 + * environment; none is ever held in state, shown, or logged.
73 + */
74 +function LinkSeveralSheet(props: {
75 + readonly environmentId: EnvironmentId;
76 + readonly onClose: () => void;
77 +}) {
78 + const gt = useGT();
79 + const m = useMessages();
80 + const insets = useSafeAreaInsets();
81 + const machines = useLinkableMachines(props.environmentId, true);
82 + // The same shared list `useLinkableMachines` reads `linked` from.
83 + const links = useEnvironmentQuery(
84 + peerLinkEnvironment.list({ environmentId: props.environmentId, input: {} }),
85 + );
86 + const linksState = linkListState(links);
87 + const machineIds = machines.map((machine) => machine.environmentId).join("\n");
88 + const scoped = useMemo(
89 + () =>
90 + machineIds
91 + .split("\n")
92 + .filter((id) => id.length > 0)
93 + .map((id) => ({ environmentId: id as EnvironmentId })),
94 + [machineIds],
95 + );
96 + const writable = useEnvironmentsWithScope(scoped, AuthAccessWriteScope);
97 + const [selected, setSelected] = useState(NO_MACHINES);
98 + const [access, setAccess] = useState<AuthMcpClientAccess>("approval-required");
99 + const [outcomes, setOutcomes] = useState(NO_OUTCOMES);
100 + const [linking, setLinking] = useState(NO_MACHINES);
101 + // Two taps can both run before a re-render; this guard is synchronous.
102 + const inFlight = useRef(false);
103 + const link = useAtomCommand(peerLinkEnvironment.linkInBatch, {
104 + label: "link several environments",
105 + // The failure cause holds the request, and with it the code; keep it out of the console.
106 + reportFailure: false,
107 + reportDefect: false,
108 + });
109 + const candidates = linkBatchCandidates(machines, writable, linksState);
110 + const selectable = candidates.flatMap(({ machine, blocked }) =>
111 + blocked === null && outcomes.get(machine.environmentId)?.kind !== "linked" ? [machine] : [],
112 + );
113 + const chosen = selectable.filter((machine) => selected.has(machine.environmentId));
114 + const busy = linking.size > 0;
115 + const summary = linkBatchSummary(outcomes);
116 + const allChosen = selectable.length > 0 && chosen.length === selectable.length;
117 +
118 + const toggle = (id: EnvironmentId) =>
119 + setSelected((current) => {
120 + const next = new Set(current);
121 + if (!next.delete(id)) next.add(id);
122 + return next;
123 + });
124 + const submit = async () => {
125 + if (inFlight.current || chosen.length === 0) return;
126 + inFlight.current = true;
127 + setLinking(new Set(chosen.map((machine) => machine.environmentId)));
128 + const results = await runLinkBatch({
129 + machines: chosen,
130 + access,
131 + mint: mintPairingCodeOn,
132 + link: async (input) => {
133 + const result = await link({ environmentId: props.environmentId, input });
134 + return result._tag === "Success"
135 + ? Result.succeed(result.value)
136 + : Result.fail(squashAtomCommandFailure(result));
137 + },
138 + refreshLinks: links.refresh,
139 + onOutcome: (id, outcome) => {
140 + setOutcomes((current) => new Map(current).set(id, outcome));
141 + setLinking((current) => {
142 + const next = new Set(current);
143 + next.delete(id);
144 + return next;
145 + });
146 + },
147 + });
148 + inFlight.current = false;
149 + setLinking(NO_MACHINES);
150 + // What failed stays picked, so linking again retries only those.
151 + setSelected(new Set(linkBatchSummary(results).failed));
152 + };
153 +
154 + return (
155 + <Sheet
156 + title={gt("Link several environments")}
157 + onClose={props.onClose}
158 + // A batch that lands after a close would still link.
159 + dismissDisabled={busy}
160 + >
161 + <ScrollView
162 + nestedScrollEnabled
163 + className="flex-1 bg-sheet-solid"
164 + contentInsetAdjustmentBehavior="automatic"
165 + contentContainerClassName="gap-5 p-5"
166 + contentContainerStyle={{ paddingBottom: insets.bottom + 20 }}
167 + >
168 + <Text className="font-sans text-sm leading-5 text-foreground-muted">
169 + <T>
170 + Agents here can then launch, message and wait on threads on each machine you pick. Each
171 + appears under Authorized clients in that machine's Sharing & access, where it can be
172 + revoked.
173 + </T>
174 + </Text>
175 + {candidates.length === 0 ? (
176 + <Text className="font-sans text-sm leading-5 text-foreground-muted">
177 + <T>This app knows no other machines. Add them under Environments first.</T>
178 + </Text>
179 + ) : (
180 + <>
181 + {linksState === "loading" ? (
182 + <Text
183 + accessibilityLiveRegion="polite"
184 + className="font-sans text-sm leading-5 text-foreground-muted"
185 + >
186 + <T>Checking which machines are already linked…</T>
187 + </Text>
188 + ) : linksState === "failed" ? (
189 + <View className="gap-2">
190 + <Text
191 + accessibilityLiveRegion="polite"
192 + className="font-sans text-sm leading-5 text-danger-foreground"
193 + >
194 + {gt(
195 + "Could not check which machines are already linked, so none can be picked: {error}",
196 + { error: links.error ?? "" },
197 + )}
198 + </Text>
199 + <Button
200 + label={gt("Retry")}
201 + size="compact"
202 + disabled={links.isPending}
203 + onPress={links.refresh}
204 + />
205 + </View>
206 + ) : null}
207 + <SettingsSection title={gt("Machines")}>
208 + {candidates.map(({ machine, blocked }, index) => {
209 + const id = machine.environmentId;
210 + const outcome = outcomes.get(id);
211 + const available = blocked === null && outcome?.kind !== "linked";
212 + const checked = available && selected.has(id);
213 + const status = linking.has(id)
214 + ? gt("Linking…")
215 + : outcome?.kind === "linked"
216 + ? gt("Linked", { $context: "status of a machine that was just linked" })
217 + : outcome?.kind === "failed"
218 + ? `${linkBatchFailureLabel(outcome.failure, m)}${outcome.detail === null ? "" : `: ${outcome.detail}`}`
219 + : blocked === null
220 + ? null
221 + : linkBatchBlockLabel(blocked, m);
222 + return (
223 + <Pressable
224 + key={id}
225 + accessibilityRole="checkbox"
226 + accessibilityLabel={machine.label}
227 + accessibilityHint={status ?? undefined}
228 + accessibilityState={{ checked, disabled: busy || !available }}
229 + className={
230 + index > 0
231 + ? "flex-row items-center gap-3 border-t border-border-subtle p-4 active:opacity-70"
232 + : "flex-row items-center gap-3 p-4 active:opacity-70"
233 + }
234 + disabled={busy || !available}
235 + onPress={() => toggle(id)}
236 + >
237 + <EnvironmentMachineSymbol
238 + kind={machine.machine}
239 + size={18}
240 + tintColorClassName="accent-foreground-muted"
241 + />
242 + <View className="min-w-0 flex-1 gap-0.5">
243 + <Text
244 + className={
245 + available
246 + ? "text-lg text-foreground android:text-base"
247 + : "text-lg text-foreground-muted android:text-base"
248 + }
249 + numberOfLines={1}
250 + >
251 + {machine.label}
252 + </Text>
253 + {status === null ? null : (
254 + <Text
255 + className={
256 + outcome?.kind === "failed"
257 + ? "text-sm text-danger-foreground"
258 + : "text-sm text-foreground-muted"
259 + }
260 + >
261 + {status}
262 + </Text>
263 + )}
264 + </View>
265 + {checked ? (
266 + <SymbolView
267 + name="checkmark"
268 + size={18}
269 + tintColorClassName="accent-icon"
270 + type="monochrome"
271 + weight="semibold"
272 + />
273 + ) : null}
274 + </Pressable>
275 + );
276 + })}
277 + </SettingsSection>
278 + <Button
279 + label={allChosen ? gt("Select none") : gt("Select all")}
280 + tone="text"
281 + size="compact"
282 + disabled={busy || selectable.length === 0}
283 + onPress={() =>
284 + setSelected(
285 + allChosen
286 + ? NO_MACHINES
287 + : new Set(selectable.map((machine) => machine.environmentId)),
288 + )
289 + }
290 + />
291 + </>
292 + )}
293 + <SettingsSection title={gt("What agents here may do there")}>
294 + {LINK_ACCESS_CHOICES.map((choice, index) => (
295 + <ListChoiceRow
296 + key={choice.access}
297 + label={m(choice.label)}
298 + description={m(choice.description)}
299 + selected={choice.access === access}
300 + separated={index > 0}
301 + disabled={busy}
302 + onPress={() => setAccess(choice.access)}
303 + />
304 + ))}
305 + </SettingsSection>
306 + {outcomes.size > 0 && !busy ? (
307 + <Text
308 + accessibilityLiveRegion="polite"
309 + className="font-sans text-sm leading-5 text-foreground-muted"
310 + >
311 + {summary.failed.length === 0
312 + ? gt("{linked, plural, one {Linked # machine.} other {Linked # machines.}}", {
313 + linked: summary.linked,
314 + })
315 + : gt(
316 + "Linked {linked} of {total}. The ones that failed stay selected, so you can try them again.",
317 + { linked: summary.linked, total: outcomes.size },
318 + )}
319 + </Text>
320 + ) : null}
321 + <Button
322 + label={
323 + busy
324 + ? gt("Linking…")
325 + : gt("{count, plural, one {Link # machine} other {Link # machines}}", {
326 + count: chosen.length,
327 + })
328 + }
329 + disabled={busy || chosen.length === 0}
330 + onPress={() => void submit()}
331 + tone="primary"
332 + fullWidth
333 + />
334 + <Button
335 + label={outcomes.size > 0 ? gt("Done") : gt("Cancel")}
336 + tone="secondary"
337 + disabled={busy}
338 + onPress={props.onClose}
339 + fullWidth
340 + />
341 + </ScrollView>
342 + </Sheet>
343 + );
344 +}
apps/mobile/src/features/threads/LinkRequestCard.tsx
+3 -3
@@ -44,7 +44,7 @@ import { Sheet } from "../../components/ui/Sheet";
44 import { RUNTIME_MODE_CHOICES } from "./thread-settings-options";
45
46 /** The same five levels as web's access picker: read-only, then the runtime modes. */
47 -const ACCESS_CHOICES: ReadonlyArray<{
47 +export const LINK_ACCESS_CHOICES: ReadonlyArray<{
48 readonly access: AuthMcpClientAccess;
49 readonly label: string;
50 readonly description: string;
@@ -57,7 +57,7 @@ const ACCESS_CHOICES: ReadonlyArray<{
57 ...RUNTIME_MODE_CHOICES.map((choice) => ({ ...choice, access: choice.mode })),
58 ];
59 const accessLabel = (access: AuthMcpClientAccess, resolve: MessageResolver) => {
60 - const label = ACCESS_CHOICES.find((choice) => choice.access === access)?.label;
60 + const label = LINK_ACCESS_CHOICES.find((choice) => choice.access === access)?.label;
61 return label === undefined ? access : resolve(label);
62 };
63
@@ -437,7 +437,7 @@ function LinkRequestSheet(props: {
437 </View>
438 )}
439 <SettingsSection title={gt("What agents here may do there")}>
440 - {ACCESS_CHOICES.map((choice, index) => (
440 + {LINK_ACCESS_CHOICES.map((choice, index) => (
441 <SettingsChoiceRow
442 key={choice.access}
443 label={m(choice.label)}
apps/mobile/src/i18n/translations/de.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "hat den Status geändert",
74 "bd672d0adf5e6d9a": "Zum Schreiben in diesen Tracker ist die Schreibberechtigung für die Versionskontrolle nötig.",
75 "bfe81d615f5f8f75": "Dieses Issue liegt außerhalb des Bereichs aller Projekte und ist hier daher schreibgeschützt.",
76 + "8b876f2953338661": "Noch nicht bekannt, ob er verknüpft ist",
77 + "b8c2bbba2243b429": "Bereits verknüpft",
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 + "cba6d3e3a22f2efe": "Nicht erreichbar",
82 + "0eb1a18deaf06b76": "Kopplungscode abgelehnt",
83 + "7d6fc963ebf9a9c5": "Eine andere Umgebung hat geantwortet",
84 + "85b2c80d3832bd14": "Dort konnte kein Kopplungscode erstellt werden",
85 + "c7b1524d9b492428": "Verknüpfen fehlgeschlagen",
86 "b455e8f32a9d4c40": "einen Rechner",
87 "4cded869dea19ab2": "Wartet auf eine Antwort im ursprünglichen Thread",
88 "2b94dca2d528688f": "Rechner verknüpft",
@@ -1974,6 +1984,21 @@
1984 "90ac69c4c63db96a": "Die App versucht es automatisch weiter. {error}",
1985 "c08eec50972ec67c": "Verwende kompatible Versionen von App und Server, um dich zu verbinden.",
1986 "206281759a765d0a": "Jetzt erneut versuchen",
1987 + "1e2fc5b4723ab831": "Mehrere Rechner mit {environment} verknüpfen…",
1988 + "4e7b0a3ced2d0f97": "Mehrere Umgebungen verknüpfen",
1989 + "3a57c9bbcd12529f": "Es konnte nicht geprüft werden, welche Rechner bereits verknüpft sind, daher kann keiner ausgewählt werden: {error}",
1990 + "7f99aaba0befc867": "Rechner",
1991 + "5ffc8460ffc939db": "Wird verknüpft…",
1992 + "78ccf685018ef797": "Verknüpft",
1993 + "e5ac7abeaeb78750": "Nichts auswählen",
1994 + "ab520df47bca22d2": "Alles auswählen",
1995 + "5bcbf210d2a21be3": "Was Agenten von hier dort tun dürfen",
1996 + "87433cf138dc3e2c": "{linked, plural, one {# Rechner verknüpft.} other {# Rechner verknüpft.}}",
1997 + "d044bb95248da10c": "{linked} von {total} verknüpft. Die fehlgeschlagenen bleiben ausgewählt, damit du es erneut versuchen kannst.",
1998 + "d2fbaffe08b6cf60": "{count, plural, one {# Rechner verknüpfen} other {# Rechner verknüpfen}}",
1999 + "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.",
2000 + "c2553b323479499a": "Diese App kennt keine anderen Rechner. Füge sie zuerst unter „Umgebungen“ hinzu.",
2001 + "03860d65c4052ab5": "Es wird geprüft, welche Rechner bereits verknüpft sind…",
2002 "a81dc81a4cea9a24": "Verknüpft von {environment}",
2003 "33386c89f3b07fea": "Abgelaufen. Verknüpfe es erneut mit einem neuen Kopplungscode.",
2004 "13d91e967cd9065c": "Antwortet gerade nicht.",
@@ -4064,8 +4089,6 @@
4089 "4474db19bf5700c9": "Andere Adresse…",
4090 "5f94f772730a004b": "Verknüpfe einen Rechner, den diese App nicht kennt, über seine https- oder Tailscale-Adresse.",
4091 "57a631f659db8c6b": "Code einfügen",
4067 - "5bcbf210d2a21be3": "Was Agenten von hier dort tun dürfen",
4068 - "5ffc8460ffc939db": "Wird verknüpft…",
4092 "8b61f3e4b14d099b": "Diesen Link verwenden",
4093 "b2a0c42daed47c36": "Verknüpfen",
4094 "58b7b0e79013a091": "Verknüpft",
apps/mobile/src/i18n/translations/en.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "changed the state",
74 "bd672d0adf5e6d9a": "Writing to this tracker needs the source-control write scope.",
75 "bfe81d615f5f8f75": "This issue is outside every project's own scope, so it is read-only here.",
76 + "8b876f2953338661": "Not known yet whether it is linked",
77 + "b8c2bbba2243b429": "Already linked",
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 + "cba6d3e3a22f2efe": "Unreachable",
82 + "0eb1a18deaf06b76": "Pairing code refused",
83 + "7d6fc963ebf9a9c5": "Another environment answered",
84 + "85b2c80d3832bd14": "Could not get a pairing code there",
85 + "c7b1524d9b492428": "Could not link",
86 "b455e8f32a9d4c40": "a machine",
87 "4cded869dea19ab2": "Waiting for an answer in the original thread",
88 "2b94dca2d528688f": "Linked a machine",
@@ -1974,6 +1984,21 @@
1984 "90ac69c4c63db96a": "The app will keep retrying automatically. {error}",
1985 "c08eec50972ec67c": "Use compatible versions of the app and server to connect.",
1986 "206281759a765d0a": "Retry now",
1987 + "1e2fc5b4723ab831": "Link several machines to {environment}…",
1988 + "4e7b0a3ced2d0f97": "Link several environments",
1989 + "3a57c9bbcd12529f": "Could not check which machines are already linked, so none can be picked: {error}",
1990 + "7f99aaba0befc867": "Machines",
1991 + "5ffc8460ffc939db": "Linking…",
1992 + "78ccf685018ef797": "Linked",
1993 + "e5ac7abeaeb78750": "Select none",
1994 + "ab520df47bca22d2": "Select all",
1995 + "5bcbf210d2a21be3": "What agents here may do there",
1996 + "87433cf138dc3e2c": "{linked, plural, one {Linked # machine.} other {Linked # machines.}}",
1997 + "d044bb95248da10c": "Linked {linked} of {total}. The ones that failed stay selected, so you can try them again.",
1998 + "d2fbaffe08b6cf60": "{count, plural, one {Link # machine} other {Link # machines}}",
1999 + "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.",
2000 + "c2553b323479499a": "This app knows no other machines. Add them under Environments first.",
2001 + "03860d65c4052ab5": "Checking which machines are already linked…",
2002 "a81dc81a4cea9a24": "Linked from {environment}",
2003 "33386c89f3b07fea": "Expired. Link it again with a new pairing code.",
2004 "13d91e967cd9065c": "Not answering right now.",
@@ -4065,8 +4090,6 @@
4090 "4474db19bf5700c9": "Another address…",
4091 "5f94f772730a004b": "Link a machine this app does not know, by its https or Tailscale address.",
4092 "57a631f659db8c6b": "Paste the code",
4068 - "5bcbf210d2a21be3": "What agents here may do there",
4069 - "5ffc8460ffc939db": "Linking…",
4093 "8b61f3e4b14d099b": "Use this link",
4094 "b2a0c42daed47c36": "Link",
4095 "58b7b0e79013a091": "Linked",
apps/mobile/src/i18n/translations/es.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "cambió el estado",
74 "bd672d0adf5e6d9a": "Para escribir en este gestor de issues se necesita el permiso de escritura de control de versiones.",
75 "bfe81d615f5f8f75": "Esta issue está fuera del ámbito de todos los proyectos, así que aquí es de solo lectura.",
76 + "8b876f2953338661": "Aún no se sabe si está vinculada",
77 + "b8c2bbba2243b429": "Ya vinculada",
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 + "cba6d3e3a22f2efe": "Inaccesible",
82 + "0eb1a18deaf06b76": "Código de emparejamiento rechazado",
83 + "7d6fc963ebf9a9c5": "Respondió otro entorno",
84 + "85b2c80d3832bd14": "No se pudo obtener un código de emparejamiento allí",
85 + "c7b1524d9b492428": "No se pudo vincular",
86 "b455e8f32a9d4c40": "una máquina",
87 "4cded869dea19ab2": "Esperando una respuesta en el hilo original",
88 "2b94dca2d528688f": "Se vinculó una máquina",
@@ -1974,6 +1984,21 @@
1984 "90ac69c4c63db96a": "La app seguirá reintentándolo automáticamente. {error}",
1985 "c08eec50972ec67c": "Usa versiones compatibles de la app y el servidor para conectarte.",
1986 "206281759a765d0a": "Reintentar ahora",
1987 + "1e2fc5b4723ab831": "Vincular varias máquinas a {environment}…",
1988 + "4e7b0a3ced2d0f97": "Vincular varios entornos",
1989 + "3a57c9bbcd12529f": "No se pudo comprobar qué máquinas ya están vinculadas, así que no se puede elegir ninguna: {error}",
1990 + "7f99aaba0befc867": "Máquinas",
1991 + "5ffc8460ffc939db": "Vinculando…",
1992 + "78ccf685018ef797": "Vinculada",
1993 + "e5ac7abeaeb78750": "No seleccionar nada",
1994 + "ab520df47bca22d2": "Seleccionar todo",
1995 + "5bcbf210d2a21be3": "Qué pueden hacer allí los agentes de aquí",
1996 + "87433cf138dc3e2c": "{linked, plural, one {Se vinculó # máquina.} other {Se vincularon # máquinas.}}",
1997 + "d044bb95248da10c": "Se vincularon {linked} de {total}. Las que fallaron siguen seleccionadas para que puedas reintentarlas.",
1998 + "d2fbaffe08b6cf60": "{count, plural, one {Vincular # máquina} other {Vincular # máquinas}}",
1999 + "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.",
2000 + "c2553b323479499a": "Esta app no conoce otras máquinas. Añádelas primero en Entornos.",
2001 + "03860d65c4052ab5": "Comprobando qué máquinas ya están vinculadas…",
2002 "a81dc81a4cea9a24": "Vinculado desde {environment}",
2003 "33386c89f3b07fea": "Caducado. Vuelve a vincularlo con un código de emparejamiento nuevo.",
2004 "13d91e967cd9065c": "No responde en este momento.",
@@ -4059,8 +4084,6 @@
4084 "4474db19bf5700c9": "Otra dirección…",
4085 "5f94f772730a004b": "Vincula una máquina que esta app no conoce mediante su dirección https o de Tailscale.",
4086 "57a631f659db8c6b": "Pega el código",
4062 - "5bcbf210d2a21be3": "Qué pueden hacer allí los agentes de aquí",
4063 - "5ffc8460ffc939db": "Vinculando…",
4087 "8b61f3e4b14d099b": "Usar este vínculo",
4088 "b2a0c42daed47c36": "Vincular",
4089 "58b7b0e79013a091": "Vinculado",
apps/mobile/src/i18n/translations/fr.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "a modifié l’état",
74 "bd672d0adf5e6d9a": "L’écriture dans ce gestionnaire de tickets nécessite l’autorisation d’écriture sur la gestion de versions.",
75 "bfe81d615f5f8f75": "Ce ticket est hors du périmètre de chaque projet ; il est donc en lecture seule ici.",
76 + "8b876f2953338661": "On ne sait pas encore si elle est associée",
77 + "b8c2bbba2243b429": "Déjà associée",
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 + "cba6d3e3a22f2efe": "Injoignable",
82 + "0eb1a18deaf06b76": "Code d’appairage refusé",
83 + "7d6fc963ebf9a9c5": "Un autre environnement a répondu",
84 + "85b2c80d3832bd14": "Impossible d’obtenir un code d’appairage là-bas",
85 + "c7b1524d9b492428": "Association impossible",
86 "b455e8f32a9d4c40": "une machine",
87 "4cded869dea19ab2": "En attente d’une réponse dans le fil d’origine",
88 "2b94dca2d528688f": "Machine associée",
@@ -1974,6 +1984,21 @@
1984 "90ac69c4c63db96a": "L’app continue de réessayer automatiquement. {error}",
1985 "c08eec50972ec67c": "Utilisez des versions compatibles de l’app et du serveur pour vous connecter.",
1986 "206281759a765d0a": "Réessayer maintenant",
1987 + "1e2fc5b4723ab831": "Associer plusieurs machines à {environment}…",
1988 + "4e7b0a3ced2d0f97": "Associer plusieurs environnements",
1989 + "3a57c9bbcd12529f": "Impossible de vérifier quelles machines sont déjà associées ; aucune ne peut donc être choisie : {error}",
1990 + "7f99aaba0befc867": "Machines",
1991 + "5ffc8460ffc939db": "Association…",
1992 + "78ccf685018ef797": "Associée",
1993 + "e5ac7abeaeb78750": "Tout désélectionner",
1994 + "ab520df47bca22d2": "Tout sélectionner",
1995 + "5bcbf210d2a21be3": "Ce que les agents d’ici peuvent faire là-bas",
1996 + "87433cf138dc3e2c": "{linked, plural, one {# machine associée.} other {# machines associées.}}",
1997 + "d044bb95248da10c": "{linked} sur {total} associées. Celles qui ont échoué restent sélectionnées pour que vous puissiez réessayer.",
1998 + "d2fbaffe08b6cf60": "{count, plural, one {Associer # machine} other {Associer # machines}}",
1999 + "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.",
2000 + "c2553b323479499a": "Cette app ne connaît aucune autre machine. Ajoutez-les d’abord dans Environnements.",
2001 + "03860d65c4052ab5": "Vérification des machines déjà associées…",
2002 "a81dc81a4cea9a24": "Associé depuis {environment}",
2003 "33386c89f3b07fea": "Expirée. Associez-la à nouveau avec un nouveau code d’appairage.",
2004 "13d91e967cd9065c": "Ne répond pas pour le moment.",
@@ -4059,8 +4084,6 @@
4084 "4474db19bf5700c9": "Autre adresse…",
4085 "5f94f772730a004b": "Associez une machine que cette app ne connaît pas, par son adresse https ou Tailscale.",
4086 "57a631f659db8c6b": "Collez le code",
4062 - "5bcbf210d2a21be3": "Ce que les agents d’ici peuvent faire là-bas",
4063 - "5ffc8460ffc939db": "Association…",
4087 "8b61f3e4b14d099b": "Utiliser ce lien",
4088 "b2a0c42daed47c36": "Associer",
4089 "58b7b0e79013a091": "Associé",
apps/mobile/src/i18n/translations/ja.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "状態を変更しました",
74 "bd672d0adf5e6d9a": "このトラッカーに書き込むには、ソース管理の書き込みスコープが必要です。",
75 "bfe81d615f5f8f75": "この Issue はどのプロジェクトのスコープにも含まれないため、ここでは読み取り専用です。",
76 + "8b876f2953338661": "リンク済みかどうかはまだ不明です",
77 + "b8c2bbba2243b429": "リンク済み",
78 + "4f1ab8a69f4a85e5": "このアプリはこのマシンに接続していません",
79 + "95f18b6ad4a409de": "そのマシンでのセッションではペアリングコードを作成できません",
80 + "26847ec0357c8600": "他のマシンから到達できるアドレスがありません",
81 + "cba6d3e3a22f2efe": "到達不能",
82 + "0eb1a18deaf06b76": "ペアリングコードが拒否されました",
83 + "7d6fc963ebf9a9c5": "別の環境が応答しました",
84 + "85b2c80d3832bd14": "そのマシンでペアリングコードを取得できませんでした",
85 + "c7b1524d9b492428": "リンクできませんでした",
86 "b455e8f32a9d4c40": "マシン",
87 "4cded869dea19ab2": "元のスレッドで回答を待っています",
88 "2b94dca2d528688f": "マシンをリンクしました",
@@ -1974,6 +1984,21 @@
1984 "90ac69c4c63db96a": "アプリは自動的に再試行を続けます。{error}",
1985 "c08eec50972ec67c": "接続するには、互換性のあるバージョンのアプリとサーバーを使用してください。",
1986 "206281759a765d0a": "今すぐ再試行",
1987 + "1e2fc5b4723ab831": "複数のマシンを {environment} にリンク…",
1988 + "4e7b0a3ced2d0f97": "複数の環境をリンク",
1989 + "3a57c9bbcd12529f": "どのマシンがリンク済みかを確認できなかったため、選択できません: {error}",
1990 + "7f99aaba0befc867": "マシン",
1991 + "5ffc8460ffc939db": "リンクしています…",
1992 + "78ccf685018ef797": "リンク済み",
1993 + "e5ac7abeaeb78750": "選択を解除",
1994 + "ab520df47bca22d2": "すべて選択",
1995 + "5bcbf210d2a21be3": "ここのエージェントがリンク先でできること",
1996 + "87433cf138dc3e2c": "{linked, plural, other {# 台のマシンをリンクしました。}}",
1997 + "d044bb95248da10c": "{total} 台中 {linked} 台をリンクしました。失敗したマシンは選択されたままなので、もう一度試せます。",
1998 + "d2fbaffe08b6cf60": "{count, plural, other {# 台のマシンをリンク}}",
1999 + "b550d04490078bda": "これで、ここのエージェントが選択した各マシンでスレッドを起動し、メッセージを送り、完了を待てるようになります。各リンクはそのマシンの「共有とアクセス」の「承認済みクライアント」に表示され、そこで取り消せます。",
2000 + "c2553b323479499a": "このアプリは他のマシンを認識していません。先に「環境」で追加してください。",
2001 + "03860d65c4052ab5": "リンク済みのマシンを確認しています…",
2002 "a81dc81a4cea9a24": "{environment} からリンク",
2003 "33386c89f3b07fea": "期限切れです。新しいペアリングコードで再度リンクしてください。",
2004 "13d91e967cd9065c": "現在応答していません。",
@@ -4056,8 +4081,6 @@
4081 "4474db19bf5700c9": "別のアドレス…",
4082 "5f94f772730a004b": "このアプリが認識していないマシンを、https または Tailscale のアドレスでリンクします。",
4083 "57a631f659db8c6b": "コードを貼り付け",
4059 - "5bcbf210d2a21be3": "ここのエージェントがリンク先でできること",
4060 - "5ffc8460ffc939db": "リンクしています…",
4084 "8b61f3e4b14d099b": "このリンクを使用",
4085 "b2a0c42daed47c36": "リンク",
4086 "58b7b0e79013a091": "リンク済み",
apps/mobile/src/i18n/translations/ko.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "상태 변경함",
74 "bd672d0adf5e6d9a": "이 트래커에 쓰려면 소스 제어 쓰기 범위가 필요합니다.",
75 "bfe81d615f5f8f75": "이 이슈는 어떤 프로젝트의 범위에도 속하지 않으므로 여기서는 읽기 전용입니다.",
76 + "8b876f2953338661": "연결되어 있는지 아직 알 수 없습니다",
77 + "b8c2bbba2243b429": "이미 연결됨",
78 + "4f1ab8a69f4a85e5": "이 앱이 해당 머신에 연결되어 있지 않습니다",
79 + "95f18b6ad4a409de": "그곳의 세션으로는 페어링 코드를 만들 수 없습니다",
80 + "26847ec0357c8600": "다른 머신이 접근할 수 있는 주소가 없습니다",
81 + "cba6d3e3a22f2efe": "연결할 수 없음",
82 + "0eb1a18deaf06b76": "페어링 코드가 거부됨",
83 + "7d6fc963ebf9a9c5": "다른 환경이 응답함",
84 + "85b2c80d3832bd14": "그곳에서 페어링 코드를 받지 못했습니다",
85 + "c7b1524d9b492428": "연결하지 못했습니다",
86 "b455e8f32a9d4c40": "머신",
87 "4cded869dea19ab2": "원래 스레드에서 답변을 기다리는 중",
88 "2b94dca2d528688f": "머신 연결됨",
@@ -1975,6 +1985,21 @@
1985 "90ac69c4c63db96a": "앱이 자동으로 계속 다시 시도합니다. {error}",
1986 "c08eec50972ec67c": "연결하려면 호환되는 버전의 앱과 서버를 사용하세요.",
1987 "206281759a765d0a": "지금 다시 시도",
1988 + "1e2fc5b4723ab831": "여러 머신을 {environment}에 연결…",
1989 + "4e7b0a3ced2d0f97": "여러 환경 연결",
1990 + "3a57c9bbcd12529f": "어떤 머신이 이미 연결되어 있는지 확인하지 못해 선택할 수 없습니다: {error}",
1991 + "7f99aaba0befc867": "머신",
1992 + "5ffc8460ffc939db": "연결하는 중…",
1993 + "78ccf685018ef797": "연결됨",
1994 + "e5ac7abeaeb78750": "선택 해제",
1995 + "ab520df47bca22d2": "모두 선택",
1996 + "5bcbf210d2a21be3": "이곳의 에이전트가 그곳에서 할 수 있는 작업",
1997 + "87433cf138dc3e2c": "{linked, plural, other {머신 #대를 연결했습니다.}}",
1998 + "d044bb95248da10c": "{total}대 중 {linked}대를 연결했습니다. 실패한 머신은 선택된 상태로 남아 있어 다시 시도할 수 있습니다.",
1999 + "d2fbaffe08b6cf60": "{count, plural, other {머신 #대 연결}}",
2000 + "b550d04490078bda": "그러면 이곳의 에이전트가 선택한 각 머신에서 스레드를 시작하고, 메시지를 보내고, 기다릴 수 있습니다. 각 연결은 해당 머신의 공유 및 액세스에서 승인된 클라이언트에 표시되며 그곳에서 취소할 수 있습니다.",
2001 + "c2553b323479499a": "이 앱이 아는 다른 머신이 없습니다. 먼저 환경에서 추가하세요.",
2002 + "03860d65c4052ab5": "이미 연결된 머신을 확인하는 중…",
2003 "a81dc81a4cea9a24": "{environment}에서 연결됨",
2004 "33386c89f3b07fea": "만료되었습니다. 새 페어링 코드로 다시 연결하세요.",
2005 "13d91e967cd9065c": "지금 응답하지 않습니다.",
@@ -4060,8 +4085,6 @@
4085 "4474db19bf5700c9": "다른 주소…",
4086 "5f94f772730a004b": "이 앱이 모르는 머신을 https 또는 Tailscale 주소로 연결합니다.",
4087 "57a631f659db8c6b": "코드 붙여 넣기",
4063 - "5bcbf210d2a21be3": "이곳의 에이전트가 그곳에서 할 수 있는 작업",
4064 - "5ffc8460ffc939db": "연결하는 중…",
4088 "8b61f3e4b14d099b": "이 링크 사용",
4089 "b2a0c42daed47c36": "연결",
4090 "58b7b0e79013a091": "연결됨",
apps/mobile/src/i18n/translations/pt-BR.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "alterou o estado",
74 "bd672d0adf5e6d9a": "Escrever neste rastreador exige a permissão de escrita no controle de versão.",
75 "bfe81d615f5f8f75": "Esta issue está fora do escopo de todos os projetos, então aqui ela é somente leitura.",
76 + "8b876f2953338661": "Ainda não se sabe se está vinculada",
77 + "b8c2bbba2243b429": "Já vinculada",
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 + "cba6d3e3a22f2efe": "Inacessível",
82 + "0eb1a18deaf06b76": "Código de pareamento recusado",
83 + "7d6fc963ebf9a9c5": "Outro ambiente respondeu",
84 + "85b2c80d3832bd14": "Não foi possível obter um código de pareamento lá",
85 + "c7b1524d9b492428": "Não foi possível vincular",
86 "b455e8f32a9d4c40": "uma máquina",
87 "4cded869dea19ab2": "Aguardando uma resposta na thread original",
88 "2b94dca2d528688f": "Máquina vinculada",
@@ -1974,6 +1984,21 @@
1984 "90ac69c4c63db96a": "O app continuará tentando automaticamente. {error}",
1985 "c08eec50972ec67c": "Use versões compatíveis do app e do servidor para conectar.",
1986 "206281759a765d0a": "Tentar agora",
1987 + "1e2fc5b4723ab831": "Vincular várias máquinas a {environment}…",
1988 + "4e7b0a3ced2d0f97": "Vincular vários ambientes",
1989 + "3a57c9bbcd12529f": "Não foi possível verificar quais máquinas já estão vinculadas, então nenhuma pode ser escolhida: {error}",
1990 + "7f99aaba0befc867": "Máquinas",
1991 + "5ffc8460ffc939db": "Vinculando…",
1992 + "78ccf685018ef797": "Vinculada",
1993 + "e5ac7abeaeb78750": "Desmarcar tudo",
1994 + "ab520df47bca22d2": "Selecionar tudo",
1995 + "5bcbf210d2a21be3": "O que os agentes daqui podem fazer lá",
1996 + "87433cf138dc3e2c": "{linked, plural, one {# máquina vinculada.} other {# máquinas vinculadas.}}",
1997 + "d044bb95248da10c": "{linked} de {total} vinculadas. As que falharam continuam selecionadas para você tentar de novo.",
1998 + "d2fbaffe08b6cf60": "{count, plural, one {Vincular # máquina} other {Vincular # máquinas}}",
1999 + "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.",
2000 + "c2553b323479499a": "Este app não conhece outras máquinas. Adicione-as primeiro em Ambientes.",
2001 + "03860d65c4052ab5": "Verificando quais máquinas já estão vinculadas…",
2002 "a81dc81a4cea9a24": "Vinculado a partir de {environment}",
2003 "33386c89f3b07fea": "Expirado. Vincule novamente com um novo código de pareamento.",
2004 "13d91e967cd9065c": "Sem resposta no momento.",
@@ -4059,8 +4084,6 @@
4084 "4474db19bf5700c9": "Outro endereço…",
4085 "5f94f772730a004b": "Vincule uma máquina que este app não conhece pelo endereço https ou Tailscale dela.",
4086 "57a631f659db8c6b": "Cole o código",
4062 - "5bcbf210d2a21be3": "O que os agentes daqui podem fazer lá",
4063 - "5ffc8460ffc939db": "Vinculando…",
4087 "8b61f3e4b14d099b": "Usar este vínculo",
4088 "b2a0c42daed47c36": "Vincular",
4089 "58b7b0e79013a091": "Vinculado",
apps/mobile/src/i18n/translations/ru.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "изменил(а) состояние",
74 "bd672d0adf5e6d9a": "Для записи в этот трекер нужна область записи в контроль версий.",
75 "bfe81d615f5f8f75": "Этот issue вне области всех проектов, поэтому здесь он доступен только для чтения.",
76 + "8b876f2953338661": "Пока неизвестно, привязана ли она",
77 + "b8c2bbba2243b429": "Уже привязана",
78 + "4f1ab8a69f4a85e5": "Это приложение к ней не подключено",
79 + "95f18b6ad4a409de": "Ваш сеанс там не может создавать коды сопряжения",
80 + "26847ec0357c8600": "Нет адреса, доступного с другой машины",
81 + "cba6d3e3a22f2efe": "Недоступна",
82 + "0eb1a18deaf06b76": "Код сопряжения отклонён",
83 + "7d6fc963ebf9a9c5": "Ответило другое окружение",
84 + "85b2c80d3832bd14": "Не удалось получить там код сопряжения",
85 + "c7b1524d9b492428": "Не удалось привязать",
86 "b455e8f32a9d4c40": "машина",
87 "4cded869dea19ab2": "Ожидание ответа в исходном треде",
88 "2b94dca2d528688f": "Машина привязана",
@@ -1998,6 +2008,21 @@
2008 "90ac69c4c63db96a": "Приложение будет автоматически повторять попытки. {error}",
2009 "c08eec50972ec67c": "Для подключения используйте совместимые версии приложения и сервера.",
2010 "206281759a765d0a": "Повторить сейчас",
2011 + "1e2fc5b4723ab831": "Привязать несколько машин к {environment}…",
2012 + "4e7b0a3ced2d0f97": "Привязать несколько окружений",
2013 + "3a57c9bbcd12529f": "Не удалось проверить, какие машины уже привязаны, поэтому выбрать ни одну нельзя: {error}",
2014 + "7f99aaba0befc867": "Машины",
2015 + "5ffc8460ffc939db": "Привязка…",
2016 + "78ccf685018ef797": "Привязана",
2017 + "e5ac7abeaeb78750": "Снять выделение",
2018 + "ab520df47bca22d2": "Выбрать все",
2019 + "5bcbf210d2a21be3": "Что агенты отсюда могут делать там",
2020 + "87433cf138dc3e2c": "{linked, plural, one {Привязана # машина.} few {Привязаны # машины.} many {Привязано # машин.} other {Привязано # машины.}}",
2021 + "d044bb95248da10c": "Привязано {linked} из {total}. Машины с ошибкой остаются выбранными, чтобы можно было повторить попытку.",
2022 + "d2fbaffe08b6cf60": "{count, plural, one {Привязать # машину} few {Привязать # машины} many {Привязать # машин} other {Привязать # машины}}",
2023 + "b550d04490078bda": "После этого агенты отсюда смогут запускать треды на каждой выбранной машине, писать в них и ждать их. Каждая связь появится в разделе «Авторизованные клиенты» в «Общем доступе» соответствующей машины, где её можно отозвать.",
2024 + "c2553b323479499a": "Это приложение не знает других машин. Сначала добавьте их в разделе «Окружения».",
2025 + "03860d65c4052ab5": "Проверяем, какие машины уже привязаны…",
2026 "a81dc81a4cea9a24": "Привязано из {environment}",
2027 "33386c89f3b07fea": "Срок истёк. Свяжите заново с новым кодом сопряжения.",
2028 "13d91e967cd9065c": "Сейчас не отвечает.",
@@ -4113,8 +4138,6 @@
4138 "4474db19bf5700c9": "Другой адрес…",
4139 "5f94f772730a004b": "Свяжите машину, которую это приложение не знает, по её адресу https или Tailscale.",
4140 "57a631f659db8c6b": "Вставьте код",
4116 - "5bcbf210d2a21be3": "Что агенты отсюда могут делать там",
4117 - "5ffc8460ffc939db": "Привязка…",
4141 "8b61f3e4b14d099b": "Использовать эту ссылку",
4142 "b2a0c42daed47c36": "Привязать",
4143 "58b7b0e79013a091": "Привязано",
apps/mobile/src/i18n/translations/sv.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "ändrade status",
74 "bd672d0adf5e6d9a": "Att skriva till den här ärendehanteraren kräver skrivomfånget för versionshantering.",
75 "bfe81d615f5f8f75": "Det här ärendet ligger utanför alla projekts eget omfång, så det är skrivskyddat här.",
76 + "8b876f2953338661": "Det är ännu inte känt om den är länkad",
77 + "b8c2bbba2243b429": "Redan länkad",
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 + "cba6d3e3a22f2efe": "Inte nåbar",
82 + "0eb1a18deaf06b76": "Parkopplingskoden nekades",
83 + "7d6fc963ebf9a9c5": "En annan miljö svarade",
84 + "85b2c80d3832bd14": "Kunde inte hämta en parkopplingskod där",
85 + "c7b1524d9b492428": "Kunde inte länka",
86 "b455e8f32a9d4c40": "en dator",
87 "4cded869dea19ab2": "Väntar på svar i den ursprungliga tråden",
88 "2b94dca2d528688f": "Länkade en dator",
@@ -1974,6 +1984,21 @@
1984 "90ac69c4c63db96a": "Appen fortsätter att försöka automatiskt. {error}",
1985 "c08eec50972ec67c": "Använd kompatibla versioner av appen och servern för att ansluta.",
1986 "206281759a765d0a": "Försök igen nu",
1987 + "1e2fc5b4723ab831": "Länka flera datorer till {environment}…",
1988 + "4e7b0a3ced2d0f97": "Länka flera miljöer",
1989 + "3a57c9bbcd12529f": "Det gick inte att kontrollera vilka datorer som redan är länkade, så ingen kan väljas: {error}",
1990 + "7f99aaba0befc867": "Datorer",
1991 + "5ffc8460ffc939db": "Länkar…",
1992 + "78ccf685018ef797": "Länkad",
1993 + "e5ac7abeaeb78750": "Avmarkera allt",
1994 + "ab520df47bca22d2": "Markera allt",
1995 + "5bcbf210d2a21be3": "Vad agenter här får göra där",
1996 + "87433cf138dc3e2c": "{linked, plural, one {Länkade # dator.} other {Länkade # datorer.}}",
1997 + "d044bb95248da10c": "Länkade {linked} av {total}. De som misslyckades är fortfarande markerade så att du kan försöka igen.",
1998 + "d2fbaffe08b6cf60": "{count, plural, one {Länka # dator} other {Länka # datorer}}",
1999 + "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.",
2000 + "c2553b323479499a": "Den här appen känner inte till några andra datorer. Lägg först till dem under Miljöer.",
2001 + "03860d65c4052ab5": "Kontrollerar vilka datorer som redan är länkade…",
2002 "a81dc81a4cea9a24": "Länkad från {environment}",
2003 "33386c89f3b07fea": "Har gått ut. Länka den igen med en ny parkopplingskod.",
2004 "13d91e967cd9065c": "Svarar inte just nu.",
@@ -4065,8 +4090,6 @@
4090 "4474db19bf5700c9": "En annan adress…",
4091 "5f94f772730a004b": "Länka en dator som appen inte känner till, via dess https- eller Tailscale-adress.",
4092 "57a631f659db8c6b": "Klistra in koden",
4068 - "5bcbf210d2a21be3": "Vad agenter här får göra där",
4069 - "5ffc8460ffc939db": "Länkar…",
4093 "8b61f3e4b14d099b": "Använd den här länken",
4094 "b2a0c42daed47c36": "Länka",
4095 "58b7b0e79013a091": "Länkad",
apps/mobile/src/i18n/translations/zh.json
+25 -2
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "更改了状态",
74 "bd672d0adf5e6d9a": "写入此跟踪器需要版本控制写入权限范围。",
75 "bfe81d615f5f8f75": "此 issue 不在任何项目自身的范围内,因此在这里为只读。",
76 + "8b876f2953338661": "尚不清楚是否已关联",
77 + "b8c2bbba2243b429": "已关联",
78 + "4f1ab8a69f4a85e5": "此应用未连接到该机器",
79 + "95f18b6ad4a409de": "你在该机器上的会话无法创建配对码",
80 + "26847ec0357c8600": "没有其他机器可访问的地址",
81 + "cba6d3e3a22f2efe": "无法访问",
82 + "0eb1a18deaf06b76": "配对码被拒绝",
83 + "7d6fc963ebf9a9c5": "应答的是另一个环境",
84 + "85b2c80d3832bd14": "无法在该机器上获取配对码",
85 + "c7b1524d9b492428": "无法关联",
86 "b455e8f32a9d4c40": "一台机器",
87 "4cded869dea19ab2": "正在等待原会话中的回答",
88 "2b94dca2d528688f": "已关联一台机器",
@@ -1976,6 +1986,21 @@
1986 "90ac69c4c63db96a": "应用会自动持续重试。{error}",
1987 "c08eec50972ec67c": "请使用兼容版本的应用和服务器进行连接。",
1988 "206281759a765d0a": "立即重试",
1989 + "1e2fc5b4723ab831": "将多台机器关联到 {environment}…",
1990 + "4e7b0a3ced2d0f97": "关联多个环境",
1991 + "3a57c9bbcd12529f": "无法检查哪些机器已关联,因此暂时无法选择:{error}",
1992 + "7f99aaba0befc867": "机器",
1993 + "5ffc8460ffc939db": "正在关联…",
1994 + "78ccf685018ef797": "已关联",
1995 + "e5ac7abeaeb78750": "取消全选",
1996 + "ab520df47bca22d2": "全选",
1997 + "5bcbf210d2a21be3": "这里的智能体在另一环境中的权限",
1998 + "87433cf138dc3e2c": "{linked, plural, other {已关联 # 台机器。}}",
1999 + "d044bb95248da10c": "已关联 {linked}/{total} 台。失败的机器仍保持选中,你可以重试。",
2000 + "d2fbaffe08b6cf60": "{count, plural, other {关联 # 台机器}}",
2001 + "b550d04490078bda": "这里的智能体随后就能在你选择的每台机器上启动会话、发送消息并等待结果。每个连接将显示在对应机器“共享与访问”的“已授权客户端”中,可在那里撤销。",
2002 + "c2553b323479499a": "此应用不知道其他机器。请先在“环境”中添加。",
2003 + "03860d65c4052ab5": "正在检查哪些机器已关联…",
2004 "a81dc81a4cea9a24": "关联自 {environment}",
2005 "33386c89f3b07fea": "已过期。请使用新的配对码重新关联。",
2006 "13d91e967cd9065c": "暂时没有响应。",
@@ -4062,8 +4087,6 @@
4087 "4474db19bf5700c9": "其他地址…",
4088 "5f94f772730a004b": "通过 https 或 Tailscale 地址关联此应用不认识的机器。",
4089 "57a631f659db8c6b": "粘贴配对码",
4065 - "5bcbf210d2a21be3": "这里的智能体在另一环境中的权限",
4066 - "5ffc8460ffc939db": "正在关联…",
4090 "8b61f3e4b14d099b": "使用此关联",
4091 "b2a0c42daed47c36": "关联",
4092 "58b7b0e79013a091": "已关联",
apps/server/src/cli/environment.test.ts new
+125
@@ -0,0 +1,125 @@
1 +// @effect-diagnostics nodeBuiltinImport:off - CLI integration exercises the filesystem boundary.
2 +import * as NodePath from "node:path";
3 +
4 +import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
5 +import { NodeHttpServer } from "@effect/platform-node";
6 +import * as NodeServices from "@effect/platform-node/NodeServices";
7 +import type { ExecutionEnvironmentDescriptor } from "@t3tools/contracts";
8 +import * as NetService from "@t3tools/shared/Net";
9 +import { expect, it } from "@effect/vitest";
10 +import * as Effect from "effect/Effect";
11 +import * as FileSystem from "effect/FileSystem";
12 +import * as Layer from "effect/Layer";
13 +import * as TestConsole from "effect/testing/TestConsole";
14 +import { Command } from "effect/cli";
15 +
16 +import { cli } from "../binCli.ts";
17 +import * as ServerConfig from "../config.ts";
18 +import { descriptorOf, servePeer } from "../peer/PeerLinks.testkit.ts";
19 +
20 +const layerCliRuntime = Layer.mergeAll(NodeServices.layer, NodeCrypto.layer, NetService.layer);
21 +
22 +const runCli = (args: ReadonlyArray<string>) => Command.runWith(cli, { version: "0.0.0" })(args);
23 +
24 +/** The batch reports printed so far; the logger writes to the same console. */
25 +const reports = TestConsole.logLines.pipe(
26 + Effect.map((lines) =>
27 + lines.filter((line): line is string => typeof line === "string" && line.includes(" linked.")),
28 + ),
29 +);
30 +
31 +/** A machine of the fleet, on a socket of its own. */
32 +const serveMachine = (descriptor: ExecutionEnvironmentDescriptor) =>
33 + Layer.build(Layer.fresh(NodeHttpServer.layerTest)).pipe(
34 + Effect.flatMap((server) =>
35 + servePeer(descriptor, Layer.empty).pipe(Effect.provideContext(server)),
36 + ),
37 + );
38 +
39 +it.effect("links a file of environments, reports each line, and fails when one did not link", () =>
40 + Effect.scoped(
41 + Effect.gen(function* () {
42 + const fs = yield* FileSystem.FileSystem;
43 + const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-environment-cli-" });
44 + const { settingsPath } = yield* ServerConfig.deriveServerPaths(baseDir, undefined);
45 + yield* fs.makeDirectory(NodePath.dirname(settingsPath), { recursive: true });
46 + yield* fs.writeFileString(settingsPath, JSON.stringify({ linkedEnvironmentsEnabled: true }));
47 +
48 + const one = yield* serveMachine(descriptorOf("environment-vm-1", "VM 1"));
49 + const two = yield* serveMachine(descriptorOf("environment-vm-2", "VM 2"));
50 + const three = yield* serveMachine(descriptorOf("environment-vm-3", "VM 3"));
51 + const codeFor = (machine: typeof one) =>
52 + machine.auth
53 + .issuePairingCredential({ access: "auto", purpose: "peer-link" })
54 + .pipe(Effect.map((pairing) => pairing.credential));
55 + const firstCode = yield* codeFor(one);
56 + const thirdCode = yield* codeFor(three);
57 +
58 + const file = NodePath.join(baseDir, "fleet.txt");
59 + yield* fs.writeFileString(
60 + file,
61 + `# fleet\n${one.url} ${firstCode}\n\n${two.url} not-a-code\n${three.url} ${thirdCode}\n`,
62 + );
63 + const link = (from: string) =>
64 + runCli(["environment", "link", "--from", from, "--access", "auto", "--base-dir", baseDir]);
65 +
66 + const failed = yield* link(file).pipe(Effect.flip);
67 + expect(failed).toMatchObject({ _tag: "EnvironmentLinkBatchError", failed: 1, total: 3 });
68 + const report = (yield* reports).at(-1) ?? "";
69 + expect(report).toContain(`${one.url}: linked VM 1 (environment-vm-1) with auto access`);
70 + expect(report).toContain(`${two.url}: code refused: `);
71 + expect(report).toContain(`${three.url}: linked VM 3 (environment-vm-3) with auto access`);
72 + expect(report).toContain("2 of 3 linked.");
73 + // A pairing code is never printed, whether it worked or not.
74 + expect(report).not.toContain(firstCode);
75 + expect(report).not.toContain("not-a-code");
76 + expect((yield* one.linkedSessions).length).toBe(1);
77 + expect(yield* two.linkedSessions).toEqual([]);
78 + expect((yield* three.linkedSessions).length).toBe(1);
79 +
80 + // Retrying the whole file links the failure and leaves the linked ones alone,
81 + // their codes unused: the first is spent and the third was never valid.
82 + const retry = NodePath.join(baseDir, "retry.txt");
83 + yield* fs.writeFileString(
84 + retry,
85 + `${one.url} ${firstCode}\n${two.url} ${yield* codeFor(two)}\n${three.url} never-valid\n`,
86 + );
87 + yield* link(retry);
88 + const retried = (yield* reports).at(-1) ?? "";
89 + expect(retried).toContain(
90 + `${one.url}: already linked as VM 1 (environment-vm-1), left as it is`,
91 + );
92 + expect(retried).toContain(`${two.url}: linked VM 2 (environment-vm-2) with auto access`);
93 + expect(retried).toContain(
94 + `${three.url}: already linked as VM 3 (environment-vm-3), left as it is`,
95 + );
96 + expect(retried).toContain("3 of 3 linked.");
97 + expect((yield* one.linkedSessions).length).toBe(1);
98 + expect((yield* two.linkedSessions).length).toBe(1);
99 + expect((yield* three.linkedSessions).length).toBe(1);
100 +
101 + // An address may carry credentials; a result line names only its origin.
102 + const withSecrets = (url: string) =>
103 + Object.assign(new URL(url), {
104 + username: "alice",
105 + password: "hunter2",
106 + search: "?token=s3cret",
107 + }).href;
108 + const secrets = NodePath.join(baseDir, "secrets.txt");
109 + yield* fs.writeFileString(
110 + secrets,
111 + [
112 + `${withSecrets(one.url)} ${firstCode}`,
113 + `${withSecrets("http://192.168.1.20:3773")} some-code`,
114 + `ftp://alice:hunter2@files.example/?token=s3cret some-code`,
115 + ].join("\n"),
116 + );
117 + yield* link(secrets).pipe(Effect.flip);
118 + const redacted = (yield* reports).at(-1) ?? "";
119 + expect(redacted).toContain(`${new URL(one.url).origin}: already linked as VM 1`);
120 + expect(redacted).toContain("http://192.168.1.20:3773: unreachable: ");
121 + expect(redacted).toContain("line 3: unreachable: ");
122 + expect(redacted).not.toMatch(/alice|hunter2|s3cret/);
123 + }),
124 + ).pipe(Effect.provide(Layer.mergeAll(layerCliRuntime, TestConsole.layer))),
125 +);
apps/server/src/cli/environment.ts
+155 -13
@@ -1,10 +1,19 @@
1 -import { AuthMcpClientAccess, EnvironmentId, type PeerLinkSummary } from "@t3tools/contracts";
1 +import {
2 + AuthMcpClientAccess,
3 + EnvironmentId,
4 + peerLinkFailureKind,
5 + type PeerLinkSummary,
6 +} from "@t3tools/contracts";
7 import * as Console from "effect/Console";
8 import * as DateTime from "effect/DateTime";
9 import * as Effect from "effect/Effect";
10 +import * as FileSystem from "effect/FileSystem";
11 import * as Layer from "effect/Layer";
12 import * as References from "effect/References";
13 +import * as Option from "effect/Option";
14 import * as Schema from "effect/Schema";
15 +import * as Stdio from "effect/Stdio";
16 +import * as Stream from "effect/Stream";
17 import * as Argument from "effect/cli/Argument";
18 import * as Command from "effect/cli/Command";
19 import * as Flag from "effect/cli/Flag";
@@ -82,12 +91,120 @@ const formatLinks = (links: ReadonlyArray<PeerLinkSummary>) =>
91 )
92 .join("\n\n")}\n`;
93
94 +export class EnvironmentLinkUsageError extends Schema.TaggedError<EnvironmentLinkUsageError>()(
95 + "EnvironmentLinkUsageError",
96 + { detail: Schema.String },
97 +) {
98 + override get message(): string {
99 + return this.detail;
100 + }
101 +}
102 +
103 +export class EnvironmentLinkBatchError extends Schema.TaggedError<EnvironmentLinkBatchError>()(
104 + "EnvironmentLinkBatchError",
105 + { failed: Schema.Number, total: Schema.Number },
106 +) {
107 + override get message(): string {
108 + return `${this.failed} of ${this.total} environments were not linked.`;
109 + }
110 +}
111 +
112 +/** Pairings a batch opens at once, so a fleet is not signed in to all at the same moment. */
113 +const LINK_BATCH_CONCURRENCY = 4;
114 +
115 +const FAILURE_KIND_LABELS = {
116 + unreachable: "unreachable",
117 + code_refused: "code refused",
118 + wrong_environment: "wrong environment answered",
119 + other: "failed",
120 +} as const;
121 +
122 +/**
123 + * How a result line names its entry: the address's origin, since a username,
124 + * password, path or query in it may be a credential and stdout is kept in logs.
125 + */
126 +const linkBatchEntryName = (entry: { readonly line: number; readonly url: string }) => {
127 + const parsed = URL.parse(entry.url);
128 + return parsed !== null && (parsed.protocol === "https:" || parsed.protocol === "http:")
129 + ? parsed.origin
130 + : `line ${entry.line}`;
131 +};
132 +
133 +/** One `<url> <pairing-code>` per line; blank lines and `#` comments are skipped. */
134 +const parseLinkBatch = (text: string) =>
135 + text.split(/\r?\n/).flatMap((raw, index) => {
136 + const fields = raw.trim().split(/\s+/);
137 + if (raw.trim().length === 0 || raw.trim().startsWith("#")) return [];
138 + const [url, pairingCode] = fields;
139 + return [
140 + url !== undefined && pairingCode !== undefined && fields.length === 2
141 + ? { line: index + 1, url, pairingCode }
142 + : { line: index + 1, url: url ?? "", pairingCode: null },
143 + ];
144 + });
145 +
146 +const linkBatch = Effect.fn("environment.linkBatch")(function* (
147 + links: PeerLinks.PeerLinks["Service"],
148 + text: string,
149 + access: AuthMcpClientAccess,
150 +) {
151 + const entries = parseLinkBatch(text);
152 + if (entries.length === 0) {
153 + return yield* new EnvironmentLinkUsageError({
154 + detail: "Nothing to link: expected lines of `<url> <pairing-code>`.",
155 + });
156 + }
157 + // Results never include a pairing code, only where it was sent.
158 + const outcomes = yield* Effect.forEach(
159 + entries,
160 + (entry) =>
161 + entry.pairingCode === null
162 + ? Effect.succeed({
163 + linked: false,
164 + text: `line ${entry.line}: failed: expected \`<url> <pairing-code>\``,
165 + })
166 + : links.linkUnlessLinked({ url: entry.url, pairingCode: entry.pairingCode, access }).pipe(
167 + Effect.map(({ link, alreadyLinked }) => ({
168 + linked: true,
169 + text: alreadyLinked
170 + ? `${linkBatchEntryName(entry)}: already linked as ${link.label} (${link.environmentId}), left as it is`
171 + : `${linkBatchEntryName(entry)}: linked ${link.label} (${link.environmentId}) with ${link.access} access`,
172 + })),
173 + Effect.catch((error) =>
174 + Effect.succeed({
175 + linked: false,
176 + text: `${linkBatchEntryName(entry)}: ${FAILURE_KIND_LABELS[peerLinkFailureKind(error)]}: ${error.message}`,
177 + }),
178 + ),
179 + ),
180 + { concurrency: LINK_BATCH_CONCURRENCY },
181 + );
182 + const failed = outcomes.filter((outcome) => !outcome.linked).length;
183 + yield* Console.log(
184 + `${outcomes.map((outcome) => outcome.text).join("\n")}\n\n${outcomes.length - failed} of ${outcomes.length} linked.\n`,
185 + );
186 + if (failed > 0) {
187 + return yield* new EnvironmentLinkBatchError({ failed, total: outcomes.length });
188 + }
189 +});
190 +
191 +const readLinkBatch = Effect.fn("environment.readLinkBatch")(function* (from: string) {
192 + if (from === "-") {
193 + return yield* Stdio.Stdio.pipe(
194 + Effect.flatMap((stdio) => stdio.stdin.pipe(Stream.decodeText(), Stream.mkString)),
195 + );
196 + }
197 + const fs = yield* FileSystem.FileSystem;
198 + return yield* fs.readFileString(from);
199 +});
200 +
201 const environmentLinkCommand = Command.make("link", {
202 ...authLocationFlags,
203 url: Argument.String("url").pipe(
204 Argument.withDescription(
205 "Where the other environment answers: its T3 Connect, Tailscale, LAN or loopback address.",
206 ),
207 + Argument.optional,
208 ),
209 alternateUrl: Flag.String("url").pipe(
210 Flag.withDescription("Another address for the same environment, tried after the first."),
@@ -95,6 +212,13 @@ const environmentLinkCommand = Command.make("link", {
212 ),
213 pairingCode: Flag.String("pairing-code").pipe(
214 Flag.withDescription("A pairing code from the other environment (`t3 pair` there)."),
215 + Flag.optional,
216 + ),
217 + from: Flag.String("from").pipe(
218 + Flag.withDescription(
219 + "Link several environments: a file with one `<url> <pairing-code>` per line, or - for stdin. Environments already linked are left as they are.",
220 + ),
221 + Flag.optional,
222 ),
223 access: Flag.Literals("access", AuthMcpClientAccess.literals).pipe(
224 Flag.withDescription(
@@ -107,19 +231,37 @@ const environmentLinkCommand = Command.make("link", {
231 "Link another T3 Code environment, so agents here can work there. It shows up there under Authorized clients in Settings → Sharing & access, where it can be revoked.",
232 ),
233 Command.withHandler((flags) =>
110 - runWithPeerLinks(flags, (links) =>
111 - Effect.gen(function* () {
112 - const linked = yield* links.link({
113 - url: flags.url,
114 - alternateUrls: flags.alternateUrl,
115 - pairingCode: flags.pairingCode,
116 - access: flags.access,
234 + Effect.gen(function* () {
235 + if (Option.isSome(flags.from)) {
236 + if (Option.isSome(flags.url) || Option.isSome(flags.pairingCode)) {
237 + return yield* new EnvironmentLinkUsageError({
238 + detail: "--from takes its addresses and pairing codes from the file.",
239 + });
240 + }
241 + const text = yield* readLinkBatch(flags.from.value);
242 + return yield* runWithPeerLinks(flags, (links) => linkBatch(links, text, flags.access));
243 + }
244 + if (Option.isNone(flags.url) || Option.isNone(flags.pairingCode)) {
245 + return yield* new EnvironmentLinkUsageError({
246 + detail: "Give an address and --pairing-code, or --from <file>.",
247 });
118 - yield* Console.log(
119 - `Linked ${linked.label} (${linked.environmentId}) with ${linked.access} access, until ${DateTime.formatIso(linked.expiresAt)}.\n`,
120 - );
121 - }),
122 - ),
248 + }
249 + const url = flags.url.value;
250 + const pairingCode = flags.pairingCode.value;
251 + return yield* runWithPeerLinks(flags, (links) =>
252 + Effect.gen(function* () {
253 + const linked = yield* links.link({
254 + url,
255 + alternateUrls: flags.alternateUrl,
256 + pairingCode,
257 + access: flags.access,
258 + });
259 + yield* Console.log(
260 + `Linked ${linked.label} (${linked.environmentId}) with ${linked.access} access, until ${DateTime.formatIso(linked.expiresAt)}.\n`,
261 + );
262 + }),
263 + );
264 + }),
265 ),
266 );
267
apps/server/src/peer/PeerLinks.test.ts
+1
@@ -817,6 +817,7 @@ it.effect("linking a picked machine that answers nowhere names it and links noth
817 })
818 .pipe(Effect.flip);
819 expect(failed.reason).toBe("unreachable");
820 + expect(failed.answeredAs).toBe("Impostor");
821 expect(failed.message).toBe(
822 `This environment could not reach Box: ${new URL(impostor.url).origin} answered as another environment, Impostor. http://192.168.1.20:3773 is plain http, which would send the link's credentials unencrypted. Use its https address, or its Tailscale address.`,
823 );
apps/server/src/peer/PeerLinks.ts
+43 -20
@@ -96,6 +96,13 @@ export class PeerLinks extends Context.Service<
96 /** Whether the Linked environments beta (Settings → Labs) is on here. */
97 readonly enabled: Effect.Effect<boolean>;
98 readonly link: (input: PeerLinkCreateInput) => Effect.Effect<PeerLink, PeerLinkError>;
99 + /**
100 + * Links like `link`, except that a machine whose link has not expired is
101 + * left as it is, with its pairing code unused.
102 + */
103 + readonly linkUnlessLinked: (
104 + input: PeerLinkCreateInput,
105 + ) => Effect.Effect<{ readonly link: PeerLink; readonly alreadyLinked: boolean }, PeerLinkError>;
106 readonly list: Effect.Effect<ReadonlyArray<PeerLinkSummary>, PeerLinkError>;
107 /** The stored link, without asking the peer whether it answers. */
108 readonly get: (
@@ -163,7 +170,8 @@ const peerOrigin = (url: string) => {
170 return Effect.fail(
171 new PeerLinkError({
172 reason: "unreachable",
166 - message: `${url} is not an http or https address.`,
173 + // Never the address as given: it may hold a username, password or query.
174 + message: "That address is not an http or https address.",
175 }),
176 );
177 }
@@ -175,7 +183,7 @@ const peerOrigin = (url: string) => {
183 return Effect.fail(
184 new PeerLinkError({
185 reason: "unreachable",
178 - message: `${url} is plain http, which would send the link's credentials unencrypted. Use its https address, or its Tailscale address.`,
186 + message: `${parsed.origin} is plain http, which would send the link's credentials unencrypted. Use its https address, or its Tailscale address.`,
187 }),
188 );
189 }
@@ -455,6 +463,7 @@ const make = Effect.gen(function* () {
463 return yield* new PeerLinkError({
464 reason: "unreachable",
465 message: `${origin} answered as another environment, ${descriptor.label}.`,
466 + answeredAs: descriptor.label,
467 });
468 }
469 return { origin, descriptor };
@@ -466,12 +475,14 @@ const make = Effect.gen(function* () {
475 );
476 const first = matching[0];
477 if (first === undefined) {
469 - const reasons = checked.flatMap((result) =>
470 - Result.isFailure(result) ? [result.failure.message] : [],
478 + const failures = checked.flatMap((result) =>
479 + Result.isFailure(result) ? [result.failure] : [],
480 );
481 + const answeredAs = failures.find((failure) => failure.answeredAs !== undefined)?.answeredAs;
482 return yield* new PeerLinkError({
483 reason: "unreachable",
474 - message: `This environment could not reach ${name}: ${reasons.join(" ")}`,
484 + message: `This environment could not reach ${name}: ${failures.map((failure) => failure.message).join(" ")}`,
485 + ...(answeredAs === undefined ? {} : { answeredAs }),
486 });
487 }
488 // Each address is kept once, even when two spellings share an origin.
@@ -486,7 +497,10 @@ const make = Effect.gen(function* () {
497 return { primary, peer: yield* probe(primary), origins };
498 });
499
489 - const link: PeerLinks["Service"]["link"] = Effect.fn("PeerLinks.link")(function* (input) {
500 + const linkWith = Effect.fn("PeerLinks.link")(function* (
501 + input: PeerLinkCreateInput,
502 + keepLinked: boolean,
503 + ) {
504 if (!(yield* enabled)) {
505 return yield* new PeerLinkError({ reason: "disabled", message: LINKED_ENVIRONMENTS_OFF });
506 }
@@ -501,21 +515,24 @@ const make = Effect.gen(function* () {
515 input.expectedEnvironmentId,
516 input.expectedLabel ?? input.expectedEnvironmentId,
517 );
518 + const row = yield* readRow(peer.environmentId);
519 + const stored = Option.isSome(row) ? yield* toLink(row.value) : undefined;
520 + const current =
521 + stored !== undefined && DateTime.isGreaterThan(stored.expiresAt, yield* DateTime.now)
522 + ? stored
523 + : undefined;
524 + if (keepLinked && current !== undefined) return { link: current, alreadyLinked: true };
525 // Anything can answer as a linked machine, so an address alone renews its
526 // link only where the link already reaches it, and never moves it.
506 - if (input.expectedEnvironmentId === undefined) {
507 - const row = yield* readRow(peer.environmentId);
508 - const existing = Option.isSome(row) ? yield* toLink(row.value) : undefined;
509 - if (
510 - existing !== undefined &&
511 - DateTime.isGreaterThan(existing.expiresAt, yield* DateTime.now) &&
512 - !existing.urls.includes(primary)
513 - ) {
514 - return yield* new PeerLinkError({
515 - reason: "pairing_rejected",
516 - message: `${primary} answers as ${existing.label}, which is already linked at another address. If ${existing.label} moved, forget that link first.`,
517 - });
518 - }
527 + if (
528 + input.expectedEnvironmentId === undefined &&
529 + current !== undefined &&
530 + !current.urls.includes(primary)
531 + ) {
532 + return yield* new PeerLinkError({
533 + reason: "pairing_rejected",
534 + message: `${primary} answers as ${current.label}, which is already linked at another address. If ${current.label} moved, forget that link first.`,
535 + });
536 }
537 const self = yield* environment.getDescriptor;
538 if (peer.environmentId === self.environmentId) {
@@ -579,9 +596,14 @@ const make = Effect.gen(function* () {
596 if (Option.isSome(previous) && previous.value.secret_name !== secretName) {
597 yield* secrets.remove(previous.value.secret_name).pipe(Effect.ignore);
598 }
582 - return linked;
599 + return { link: linked, alreadyLinked: false };
600 });
601
602 + const link: PeerLinks["Service"]["link"] = (input) =>
603 + linkWith(input, false).pipe(Effect.map((result) => result.link));
604 + const linkUnlessLinked: PeerLinks["Service"]["linkUnlessLinked"] = (input) =>
605 + linkWith(input, true);
606 +
607 /** A peer's label follows its machine name, so the link takes the one its own address answers with. */
608 const withLabel = (link: PeerLink, label: string) =>
609 label === link.label
@@ -726,6 +748,7 @@ const make = Effect.gen(function* () {
748 return PeerLinks.of({
749 enabled,
750 link,
751 + linkUnlessLinked,
752 list,
753 get,
754 unlink,
apps/web/src/components/settings/LinkSeveralEnvironments.tsx new
+307
@@ -0,0 +1,307 @@
1 +import {
2 + linkBatchBlockLabel,
3 + linkBatchCandidates,
4 + linkBatchFailureLabel,
5 + type LinkBatchOutcome,
6 + linkBatchSummary,
7 + linkListState,
8 + runLinkBatch,
9 +} from "@t3tools/client-runtime/link-batch";
10 +import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
11 +import {
12 + AuthAccessWriteScope,
13 + type AuthMcpClientAccess,
14 + type EnvironmentId,
15 +} from "@t3tools/contracts";
16 +import * as Result from "effect/Result";
17 +import { T, useGT, useMessages } from "gt-react";
18 +import { useId, useRef, useState } from "react";
19 +
20 +import { mintPairingCodeOn } from "~/state/peerPairingCode";
21 +import { peerLinkEnvironment, useLinkableMachines } from "~/state/peerLinks";
22 +import { useEnvironmentQuery } from "~/state/query";
23 +import { useEnvironmentsWithScope } from "~/state/session";
24 +import { useAtomCommand } from "~/state/use-atom-command";
25 +import { EnvironmentMachineIcon } from "../EnvironmentMachineIcon";
26 +import { Button } from "../ui/button";
27 +import { Checkbox } from "../ui/checkbox";
28 +import {
29 + Dialog,
30 + DialogClose,
31 + DialogDescription,
32 + DialogFooter,
33 + DialogHeader,
34 + DialogPanel,
35 + DialogPopup,
36 + 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 +/**
45 + * Links the machines this app already reaches in one go. Each pairing code is
46 + * minted on its machine and passed straight to the linking environment; none
47 + * is ever held in state, shown, or logged.
48 + */
49 +export function LinkSeveralEnvironmentsAction({
50 + environmentId,
51 +}: {
52 + readonly environmentId: EnvironmentId;
53 +}) {
54 + const gt = useGT();
55 + const m = useMessages();
56 + const formId = useId();
57 + const [open, setOpen] = useState(false);
58 + const machines = useLinkableMachines(environmentId, open);
59 + // The same shared list `useLinkableMachines` reads `linked` from.
60 + const links = useEnvironmentQuery(
61 + open ? peerLinkEnvironment.list({ environmentId, input: {} }) : null,
62 + );
63 + const linksState = linkListState(links);
64 + const writable = useEnvironmentsWithScope(machines, AuthAccessWriteScope);
65 + const [selected, setSelected] = useState(NO_MACHINES);
66 + const [access, setAccess] = useState<AuthMcpClientAccess>("approval-required");
67 + const [outcomes, setOutcomes] = useState(NO_OUTCOMES);
68 + const [linking, setLinking] = useState(NO_MACHINES);
69 + // Enter then a click can both run before a re-render; this guard is synchronous.
70 + const inFlight = useRef(false);
71 + const link = useAtomCommand(peerLinkEnvironment.linkInBatch, {
72 + 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,
76 + });
77 + const candidates = linkBatchCandidates(machines, writable, linksState);
78 + const selectable = candidates.flatMap(({ machine, blocked }) =>
79 + blocked === null && outcomes.get(machine.environmentId)?.kind !== "linked" ? [machine] : [],
80 + );
81 + const chosen = selectable.filter((machine) => selected.has(machine.environmentId));
82 + const busy = linking.size > 0;
83 + const summary = linkBatchSummary(outcomes);
84 +
85 + const handleOpenChange = (next: boolean) => {
86 + setOpen(next);
87 + if (!next) {
88 + setSelected(NO_MACHINES);
89 + setOutcomes(NO_OUTCOMES);
90 + setAccess("approval-required");
91 + }
92 + };
93 + const toggle = (id: EnvironmentId, checked: boolean) =>
94 + setSelected((current) => {
95 + const next = new Set(current);
96 + if (checked) next.add(id);
97 + else next.delete(id);
98 + return next;
99 + });
100 + const submit = async () => {
101 + if (inFlight.current || chosen.length === 0) return;
102 + inFlight.current = true;
103 + setLinking(new Set(chosen.map((machine) => machine.environmentId)));
104 + const results = await runLinkBatch({
105 + machines: chosen,
106 + access,
107 + mint: mintPairingCodeOn,
108 + link: async (input) => {
109 + const result = await link({ environmentId, input });
110 + return result._tag === "Success"
111 + ? Result.succeed(result.value)
112 + : Result.fail(squashAtomCommandFailure(result));
113 + },
114 + refreshLinks: links.refresh,
115 + onOutcome: (id, outcome) => {
116 + setOutcomes((current) => new Map(current).set(id, outcome));
117 + setLinking((current) => {
118 + const next = new Set(current);
119 + next.delete(id);
120 + return next;
121 + });
122 + },
123 + });
124 + inFlight.current = false;
125 + setLinking(NO_MACHINES);
126 + // What failed stays picked, so linking again retries only those.
127 + setSelected(new Set(linkBatchSummary(results).failed));
128 + };
129 +
130 + return (
131 + <Dialog
132 + open={open}
133 + onOpenChange={(next) => {
134 + if (!next && busy) return;
135 + handleOpenChange(next);
136 + }}
137 + >
138 + <DialogTrigger
139 + render={
140 + <Button size="xs" variant="outline">
141 + <T>Link several…</T>
142 + </Button>
143 + }
144 + />
145 + <DialogPopup className="max-w-md">
146 + <DialogHeader>
147 + <DialogTitle>
148 + <T>Link several environments</T>
149 + </DialogTitle>
150 + <DialogDescription>
151 + <T>
152 + Agents here can then launch, message and wait on threads on each machine you pick.
153 + Each appears under Authorized clients in that machine's Sharing & access, where it can
154 + be revoked.
155 + </T>
156 + </DialogDescription>
157 + </DialogHeader>
158 + <DialogPanel>
159 + <form
160 + id={formId}
161 + className="space-y-4"
162 + onSubmit={(event) => {
163 + event.preventDefault();
164 + void submit();
165 + }}
166 + >
167 + {candidates.length === 0 ? (
168 + <p className="text-sm text-muted-foreground">
169 + <T>This app knows no other machines. Add them under Environments first.</T>
170 + </p>
171 + ) : (
172 + <div className="space-y-1.5">
173 + <div className="flex items-center justify-between gap-2">
174 + <span className="text-xs font-medium text-foreground">
175 + <T>Machines</T>
176 + </span>
177 + <Button
178 + type="button"
179 + size="xs"
180 + variant="ghost-muted"
181 + disabled={busy || selectable.length === 0}
182 + onClick={() =>
183 + setSelected(
184 + chosen.length === selectable.length
185 + ? NO_MACHINES
186 + : new Set(selectable.map((machine) => machine.environmentId)),
187 + )
188 + }
189 + >
190 + {chosen.length === selectable.length && selectable.length > 0
191 + ? gt("Select none")
192 + : gt("Select all")}
193 + </Button>
194 + </div>
195 + {linksState === "loaded" ? null : (
196 + <div
197 + role="status"
198 + className="flex items-center justify-between gap-2 text-xs text-muted-foreground"
199 + >
200 + {linksState === "loading" ? (
201 + <T>Checking which machines are already linked…</T>
202 + ) : (
203 + <>
204 + <span className="text-destructive">
205 + {gt(
206 + "Could not check which machines are already linked, so none can be picked: {error}",
207 + { error: links.error ?? "" },
208 + )}
209 + </span>
210 + <Button
211 + type="button"
212 + size="xs"
213 + variant="outline"
214 + disabled={links.isPending}
215 + onClick={links.refresh}
216 + >
217 + <T>Retry</T>
218 + </Button>
219 + </>
220 + )}
221 + </div>
222 + )}
223 + <ul className="max-h-72 divide-y overflow-y-auto rounded-lg border">
224 + {candidates.map(({ machine, blocked }) => {
225 + const id = machine.environmentId;
226 + const outcome = outcomes.get(id);
227 + const available = blocked === null && outcome?.kind !== "linked";
228 + const status = linking.has(id)
229 + ? gt("Linking…")
230 + : outcome?.kind === "linked"
231 + ? gt("Linked", { $context: "status of a machine that was just linked" })
232 + : outcome?.kind === "failed"
233 + ? linkBatchFailureLabel(outcome.failure, m)
234 + : blocked === null
235 + ? null
236 + : linkBatchBlockLabel(blocked, m);
237 + return (
238 + <li key={id}>
239 + <label className="flex cursor-pointer items-center gap-2.5 px-3 py-2 text-sm has-data-disabled:cursor-default">
240 + <Checkbox
241 + checked={available && selected.has(id)}
242 + disabled={busy || !available}
243 + onCheckedChange={(checked) => toggle(id, checked)}
244 + />
245 + <EnvironmentMachineIcon
246 + kind={machine.machine}
247 + className="size-4 shrink-0 text-muted-foreground"
248 + />
249 + <span className="min-w-0 flex-1">
250 + <span className="block truncate font-medium">{machine.label}</span>
251 + {outcome?.kind === "failed" && outcome.detail !== null ? (
252 + <span className="block text-xs text-destructive">
253 + {outcome.detail}
254 + </span>
255 + ) : null}
256 + </span>
257 + {status === null ? null : (
258 + <span
259 + className={
260 + outcome?.kind === "failed"
261 + ? "shrink-0 text-xs text-destructive"
262 + : "shrink-0 text-xs text-muted-foreground"
263 + }
264 + >
265 + {status}
266 + </span>
267 + )}
268 + </label>
269 + </li>
270 + );
271 + })}
272 + </ul>
273 + </div>
274 + )}
275 + {outcomes.size > 0 && !busy ? (
276 + <p role="status" className="text-xs text-muted-foreground">
277 + {summary.failed.length === 0
278 + ? gt("{linked, plural, one {Linked # machine.} other {Linked # machines.}}", {
279 + linked: summary.linked,
280 + })
281 + : gt(
282 + "Linked {linked} of {total}. The ones that failed stay selected, so you can try them again.",
283 + { linked: summary.linked, total: outcomes.size },
284 + )}
285 + </p>
286 + ) : null}
287 + <LinkAccessPicker value={access} onChange={setAccess} disabled={busy} />
288 + </form>
289 + </DialogPanel>
290 + <DialogFooter variant="bare">
291 + <DialogClose disabled={busy} render={<Button variant="outline" type="button" />}>
292 + {outcomes.size > 0 ? gt("Done") : gt("Cancel")}
293 + </DialogClose>
294 + {outcomes.size > 0 && !busy && chosen.length === 0 ? null : (
295 + <Button form={formId} type="submit" disabled={busy || chosen.length === 0}>
296 + {busy
297 + ? gt("Linking…")
298 + : gt("{count, plural, one {Link # machine} other {Link # machines}}", {
299 + count: chosen.length,
300 + })}
301 + </Button>
302 + )}
303 + </DialogFooter>
304 + </DialogPopup>
305 + </Dialog>
306 + );
307 +}
apps/web/src/components/settings/LinkedEnvironmentsSettings.tsx
+14 -1
@@ -21,6 +21,7 @@ import { useId, useRef, useState } from "react";
21 import { requestConfirmDialog } from "~/confirmDialog";
22 import { mintPairingCodeOn } from "~/state/peerPairingCode";
23 import { peerLinkEnvironment, useLinkableMachines } from "~/state/peerLinks";
24 +import { useEnvironments } from "~/state/environments";
25 import { useEnvironmentQuery } from "~/state/query";
26 import { useEnvironmentScope, usePreparedConnection } from "~/state/session";
27 import { useAtomCommand } from "~/state/use-atom-command";
@@ -43,6 +44,7 @@ import { stackedThreadToast, toastManager } from "../ui/toast";
44 import { ITEM_ROW_CLASSNAME, ITEM_ROW_INNER_CLASSNAME } from "./itemRows";
45 import { LinkAccessPicker } from "./LinkAccessPicker";
46 import { LinkAddressWarning, LinkMachineSelect } from "./LinkMachineSelect";
47 +import { LinkSeveralEnvironmentsAction } from "./LinkSeveralEnvironments";
48 import { SettingsRow, SettingsSection } from "./settingsLayout";
49 import { useLiveRefresh } from "../../hooks/useLiveRefresh";
50 import { m as resolveMessage } from "../../i18n/messages";
@@ -86,11 +88,22 @@ export function LinkedEnvironmentsSettings({
88 );
89 const canLink = useAtomValue(peerLinkEnvironment.link.permissionAtom(environmentId));
90 const search = searchableSetting("linked-environments");
91 + // A batch needs at least two other machines this app has saved.
92 + const otherMachines = useEnvironments().environments.length - 1;
93 return (
94 <SettingsSection
95 {...(isSearchTarget ? { id: search.id } : {})}
96 title={environmentLabel === null ? search.title : `${search.title} · ${environmentLabel}`}
93 - headerAction={canLink ? <LinkEnvironmentAction environmentId={environmentId} /> : null}
97 + headerAction={
98 + canLink ? (
99 + <div className="flex items-center gap-2">
100 + {otherMachines > 1 ? (
101 + <LinkSeveralEnvironmentsAction environmentId={environmentId} />
102 + ) : null}
103 + <LinkEnvironmentAction environmentId={environmentId} />
104 + </div>
105 + ) : null
106 + }
107 >
108 {links.error ? (
109 <SettingsRow title={gt("Could not load linked environments")} description={links.error} />
apps/web/src/i18n/translations/de.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "hat den Status geändert",
74 "bd672d0adf5e6d9a": "Zum Schreiben in diesen Tracker ist die Schreibberechtigung für die Versionskontrolle nötig.",
75 "bfe81d615f5f8f75": "Dieses Issue liegt außerhalb des Bereichs aller Projekte und ist hier daher schreibgeschützt.",
76 + "8b876f2953338661": "Noch nicht bekannt, ob er verknüpft ist",
77 + "b8c2bbba2243b429": "Bereits verknüpft",
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 + "cba6d3e3a22f2efe": "Nicht erreichbar",
82 + "0eb1a18deaf06b76": "Kopplungscode abgelehnt",
83 + "7d6fc963ebf9a9c5": "Eine andere Umgebung hat geantwortet",
84 + "85b2c80d3832bd14": "Dort konnte kein Kopplungscode erstellt werden",
85 + "c7b1524d9b492428": "Verknüpfen fehlgeschlagen",
86 "b455e8f32a9d4c40": "einen Rechner",
87 "4cded869dea19ab2": "Wartet auf eine Antwort im ursprünglichen Thread",
88 "2b94dca2d528688f": "Rechner verknüpft",
@@ -8662,6 +8672,19 @@
8672 "03ce9bea5f88ddbd": "Diese App kann nicht bestätigen, dass es einer deiner Rechner ist. Der eingefügte Kopplungscode wird dorthin gesendet.",
8673 "30b696434167411f": "Verknüpft",
8674 "80bbda74ee500b82": "Rechner",
8675 + "e5ac7abeaeb78750": "Nichts auswählen",
8676 + "ab520df47bca22d2": "Alles auswählen",
8677 + "3a57c9bbcd12529f": "Es konnte nicht geprüft werden, welche Rechner bereits verknüpft sind, daher kann keiner ausgewählt werden: {error}",
8678 + "78ccf685018ef797": "Verknüpft",
8679 + "87433cf138dc3e2c": "{linked, plural, one {# Rechner verknüpft.} other {# Rechner verknüpft.}}",
8680 + "d044bb95248da10c": "{linked} von {total} verknüpft. Die fehlgeschlagenen bleiben ausgewählt, damit du es erneut versuchen kannst.",
8681 + "d2fbaffe08b6cf60": "{count, plural, one {# Rechner verknüpfen} other {# Rechner verknüpfen}}",
8682 + "8e3378b526d615f4": "Mehrere verknüpfen…",
8683 + "7f8d6d1af69829d8": "Mehrere Umgebungen verknüpfen",
8684 + "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.",
8685 + "c2553b323479499a": "Diese App kennt keine anderen Rechner. Füge sie zuerst unter „Umgebungen“ hinzu.",
8686 + "18b1d4d42b945b34": "Rechner",
8687 + "03860d65c4052ab5": "Es wird geprüft, welche Rechner bereits verknüpft sind…",
8688 "4cea6be0fe6be16f": "Verknüpfte Umgebungen konnten nicht geladen werden",
8689 "58cb9c075da185fb": "Verknüpfte Umgebungen werden geladen…",
8690 "25b74062dc03079e": "Keine verknüpften Umgebungen",
@@ -10799,7 +10822,6 @@
10822 "dc827550691bafd1": "Verbunden · {ms} ms",
10823 "11b77b0add59d7b4": "Abgelehnt · HTTP {status}",
10824 "10cf4b8e7ecc020b": "Zeitüberschreitung",
10802 - "cba6d3e3a22f2efe": "Nicht erreichbar",
10825 "523b72ed9d712100": "OpenTelemetry-Export",
10826 "ecaa5a9da2c44a47": "Wähle eine Umgebung, um ihre Telemetrie-Exporte zu konfigurieren.",
10827 "5548e6d2e9b8cc64": "Gespeichert. Starte den Server neu, um es anzuwenden.",
apps/web/src/i18n/translations/en.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "changed the state",
74 "bd672d0adf5e6d9a": "Writing to this tracker needs the source-control write scope.",
75 "bfe81d615f5f8f75": "This issue is outside every project's own scope, so it is read-only here.",
76 + "8b876f2953338661": "Not known yet whether it is linked",
77 + "b8c2bbba2243b429": "Already linked",
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 + "cba6d3e3a22f2efe": "Unreachable",
82 + "0eb1a18deaf06b76": "Pairing code refused",
83 + "7d6fc963ebf9a9c5": "Another environment answered",
84 + "85b2c80d3832bd14": "Could not get a pairing code there",
85 + "c7b1524d9b492428": "Could not link",
86 "b455e8f32a9d4c40": "a machine",
87 "4cded869dea19ab2": "Waiting for an answer in the original thread",
88 "2b94dca2d528688f": "Linked a machine",
@@ -8670,6 +8680,19 @@
8680 "03ce9bea5f88ddbd": "This app cannot confirm it is one of your machines. The pairing code you paste is sent there.",
8681 "30b696434167411f": "Linked",
8682 "80bbda74ee500b82": "Machine",
8683 + "e5ac7abeaeb78750": "Select none",
8684 + "ab520df47bca22d2": "Select all",
8685 + "3a57c9bbcd12529f": "Could not check which machines are already linked, so none can be picked: {error}",
8686 + "78ccf685018ef797": "Linked",
8687 + "87433cf138dc3e2c": "{linked, plural, one {Linked # machine.} other {Linked # machines.}}",
8688 + "d044bb95248da10c": "Linked {linked} of {total}. The ones that failed stay selected, so you can try them again.",
8689 + "d2fbaffe08b6cf60": "{count, plural, one {Link # machine} other {Link # machines}}",
8690 + "8e3378b526d615f4": "Link several…",
8691 + "7f8d6d1af69829d8": "Link several environments",
8692 + "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.",
8693 + "c2553b323479499a": "This app knows no other machines. Add them under Environments first.",
8694 + "18b1d4d42b945b34": "Machines",
8695 + "03860d65c4052ab5": "Checking which machines are already linked…",
8696 "4cea6be0fe6be16f": "Could not load linked environments",
8697 "58cb9c075da185fb": "Loading linked environments…",
8698 "25b74062dc03079e": "No linked environments",
@@ -10808,7 +10831,6 @@
10831 "dc827550691bafd1": "Connected · {ms} ms",
10832 "11b77b0add59d7b4": "Rejected · HTTP {status}",
10833 "10cf4b8e7ecc020b": "Timed out",
10811 - "cba6d3e3a22f2efe": "Unreachable",
10834 "523b72ed9d712100": "OpenTelemetry export",
10835 "ecaa5a9da2c44a47": "Choose one environment to configure its telemetry exports.",
10836 "5548e6d2e9b8cc64": "Saved. Restart the server to apply.",
apps/web/src/i18n/translations/es.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "cambió el estado",
74 "bd672d0adf5e6d9a": "Para escribir en este gestor de issues se necesita el permiso de escritura de control de versiones.",
75 "bfe81d615f5f8f75": "Esta issue está fuera del ámbito de todos los proyectos, así que aquí es de solo lectura.",
76 + "8b876f2953338661": "Aún no se sabe si está vinculada",
77 + "b8c2bbba2243b429": "Ya vinculada",
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 + "cba6d3e3a22f2efe": "Inaccesible",
82 + "0eb1a18deaf06b76": "Código de emparejamiento rechazado",
83 + "7d6fc963ebf9a9c5": "Respondió otro entorno",
84 + "85b2c80d3832bd14": "No se pudo obtener un código de emparejamiento allí",
85 + "c7b1524d9b492428": "No se pudo vincular",
86 "b455e8f32a9d4c40": "una máquina",
87 "4cded869dea19ab2": "Esperando una respuesta en el hilo original",
88 "2b94dca2d528688f": "Se vinculó una máquina",
@@ -8660,6 +8670,19 @@
8670 "03ce9bea5f88ddbd": "Esta app no puede confirmar que sea una de tus máquinas. El código de emparejamiento que pegues se envía allí.",
8671 "30b696434167411f": "Vinculado",
8672 "80bbda74ee500b82": "Máquina",
8673 + "e5ac7abeaeb78750": "No seleccionar nada",
8674 + "ab520df47bca22d2": "Seleccionar todo",
8675 + "3a57c9bbcd12529f": "No se pudo comprobar qué máquinas ya están vinculadas, así que no se puede elegir ninguna: {error}",
8676 + "78ccf685018ef797": "Vinculada",
8677 + "87433cf138dc3e2c": "{linked, plural, one {Se vinculó # máquina.} other {Se vincularon # máquinas.}}",
8678 + "d044bb95248da10c": "Se vincularon {linked} de {total}. Las que fallaron siguen seleccionadas para que puedas reintentarlas.",
8679 + "d2fbaffe08b6cf60": "{count, plural, one {Vincular # máquina} other {Vincular # máquinas}}",
8680 + "8e3378b526d615f4": "Vincular varios…",
8681 + "7f8d6d1af69829d8": "Vincular varios entornos",
8682 + "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.",
8683 + "c2553b323479499a": "Esta app no conoce otras máquinas. Añádelas primero en Entornos.",
8684 + "18b1d4d42b945b34": "Máquinas",
8685 + "03860d65c4052ab5": "Comprobando qué máquinas ya están vinculadas…",
8686 "4cea6be0fe6be16f": "No se pudieron cargar los entornos vinculados",
8687 "58cb9c075da185fb": "Cargando entornos vinculados…",
8688 "25b74062dc03079e": "No hay entornos vinculados",
@@ -10793,7 +10816,6 @@
10816 "dc827550691bafd1": "Conectado · {ms} ms",
10817 "11b77b0add59d7b4": "Rechazado · HTTP {status}",
10818 "10cf4b8e7ecc020b": "Tiempo de espera agotado",
10796 - "cba6d3e3a22f2efe": "Inaccesible",
10819 "523b72ed9d712100": "Exportación de OpenTelemetry",
10820 "ecaa5a9da2c44a47": "Elige un entorno para configurar sus exportaciones de telemetría.",
10821 "5548e6d2e9b8cc64": "Guardado. Reinicia el servidor para aplicarlo.",
apps/web/src/i18n/translations/fr.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "a modifié l’état",
74 "bd672d0adf5e6d9a": "L’écriture dans ce gestionnaire de tickets nécessite l’autorisation d’écriture sur la gestion de versions.",
75 "bfe81d615f5f8f75": "Ce ticket est hors du périmètre de chaque projet ; il est donc en lecture seule ici.",
76 + "8b876f2953338661": "On ne sait pas encore si elle est associée",
77 + "b8c2bbba2243b429": "Déjà associée",
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 + "cba6d3e3a22f2efe": "Injoignable",
82 + "0eb1a18deaf06b76": "Code d’appairage refusé",
83 + "7d6fc963ebf9a9c5": "Un autre environnement a répondu",
84 + "85b2c80d3832bd14": "Impossible d’obtenir un code d’appairage là-bas",
85 + "c7b1524d9b492428": "Association impossible",
86 "b455e8f32a9d4c40": "une machine",
87 "4cded869dea19ab2": "En attente d’une réponse dans le fil d’origine",
88 "2b94dca2d528688f": "Machine associée",
@@ -8662,6 +8672,19 @@
8672 "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é.",
8673 "30b696434167411f": "Associé",
8674 "80bbda74ee500b82": "Machine",
8675 + "e5ac7abeaeb78750": "Tout désélectionner",
8676 + "ab520df47bca22d2": "Tout sélectionner",
8677 + "3a57c9bbcd12529f": "Impossible de vérifier quelles machines sont déjà associées ; aucune ne peut donc être choisie : {error}",
8678 + "78ccf685018ef797": "Associée",
8679 + "87433cf138dc3e2c": "{linked, plural, one {# machine associée.} other {# machines associées.}}",
8680 + "d044bb95248da10c": "{linked} sur {total} associées. Celles qui ont échoué restent sélectionnées pour que vous puissiez réessayer.",
8681 + "d2fbaffe08b6cf60": "{count, plural, one {Associer # machine} other {Associer # machines}}",
8682 + "8e3378b526d615f4": "Associer plusieurs…",
8683 + "7f8d6d1af69829d8": "Associer plusieurs environnements",
8684 + "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.",
8685 + "c2553b323479499a": "Cette app ne connaît aucune autre machine. Ajoutez-les d’abord dans Environnements.",
8686 + "18b1d4d42b945b34": "Machines",
8687 + "03860d65c4052ab5": "Vérification des machines déjà associées…",
8688 "4cea6be0fe6be16f": "Impossible de charger les environnements associés",
8689 "58cb9c075da185fb": "Chargement des environnements associés…",
8690 "25b74062dc03079e": "Aucun environnement associé",
@@ -10798,7 +10821,6 @@
10821 "dc827550691bafd1": "Connecté · {ms} ms",
10822 "11b77b0add59d7b4": "Refusé · HTTP {status}",
10823 "10cf4b8e7ecc020b": "Délai dépassé",
10801 - "cba6d3e3a22f2efe": "Injoignable",
10824 "523b72ed9d712100": "Export OpenTelemetry",
10825 "ecaa5a9da2c44a47": "Choisissez un environnement pour configurer ses exports de télémétrie.",
10826 "5548e6d2e9b8cc64": "Enregistré. Redémarrez le serveur pour appliquer.",
apps/web/src/i18n/translations/ja.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "状態を変更しました",
74 "bd672d0adf5e6d9a": "このトラッカーに書き込むには、ソース管理の書き込みスコープが必要です。",
75 "bfe81d615f5f8f75": "この Issue はどのプロジェクトのスコープにも含まれないため、ここでは読み取り専用です。",
76 + "8b876f2953338661": "リンク済みかどうかはまだ不明です",
77 + "b8c2bbba2243b429": "リンク済み",
78 + "4f1ab8a69f4a85e5": "このアプリはこのマシンに接続していません",
79 + "95f18b6ad4a409de": "そのマシンでのセッションではペアリングコードを作成できません",
80 + "26847ec0357c8600": "他のマシンから到達できるアドレスがありません",
81 + "cba6d3e3a22f2efe": "到達不能",
82 + "0eb1a18deaf06b76": "ペアリングコードが拒否されました",
83 + "7d6fc963ebf9a9c5": "別の環境が応答しました",
84 + "85b2c80d3832bd14": "そのマシンでペアリングコードを取得できませんでした",
85 + "c7b1524d9b492428": "リンクできませんでした",
86 "b455e8f32a9d4c40": "マシン",
87 "4cded869dea19ab2": "元のスレッドで回答を待っています",
88 "2b94dca2d528688f": "マシンをリンクしました",
@@ -8618,6 +8628,19 @@
8628 "03ce9bea5f88ddbd": "このアプリでは、これがあなたのマシンかどうかを確認できません。貼り付けたペアリングコードはそのアドレスに送信されます。",
8629 "30b696434167411f": "リンク済み",
8630 "80bbda74ee500b82": "マシン",
8631 + "e5ac7abeaeb78750": "選択を解除",
8632 + "ab520df47bca22d2": "すべて選択",
8633 + "3a57c9bbcd12529f": "どのマシンがリンク済みかを確認できなかったため、選択できません: {error}",
8634 + "78ccf685018ef797": "リンク済み",
8635 + "87433cf138dc3e2c": "{linked, plural, other {# 台のマシンをリンクしました。}}",
8636 + "d044bb95248da10c": "{total} 台中 {linked} 台をリンクしました。失敗したマシンは選択されたままなので、もう一度試せます。",
8637 + "d2fbaffe08b6cf60": "{count, plural, other {# 台のマシンをリンク}}",
8638 + "8e3378b526d615f4": "複数をリンク…",
8639 + "7f8d6d1af69829d8": "複数の環境をリンク",
8640 + "b550d04490078bda": "これで、ここのエージェントが選択した各マシンでスレッドを起動し、メッセージを送り、完了を待てるようになります。各リンクはそのマシンの「共有とアクセス」の「承認済みクライアント」に表示され、そこで取り消せます。",
8641 + "c2553b323479499a": "このアプリは他のマシンを認識していません。先に「環境」で追加してください。",
8642 + "18b1d4d42b945b34": "マシン",
8643 + "03860d65c4052ab5": "リンク済みのマシンを確認しています…",
8644 "4cea6be0fe6be16f": "リンクされた環境を読み込めませんでした",
8645 "58cb9c075da185fb": "リンクされた環境を読み込んでいます…",
8646 "25b74062dc03079e": "リンクされた環境はありません",
@@ -10748,7 +10771,6 @@
10771 "dc827550691bafd1": "接続済み · {ms} ms",
10772 "11b77b0add59d7b4": "拒否 · HTTP {status}",
10773 "10cf4b8e7ecc020b": "タイムアウト",
10751 - "cba6d3e3a22f2efe": "到達不能",
10774 "523b72ed9d712100": "OpenTelemetry エクスポート",
10775 "ecaa5a9da2c44a47": "テレメトリのエクスポートを設定する環境を 1 つ選択してください。",
10776 "5548e6d2e9b8cc64": "保存しました。適用するにはサーバーを再起動してください。",
apps/web/src/i18n/translations/ko.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "상태 변경함",
74 "bd672d0adf5e6d9a": "이 트래커에 쓰려면 소스 제어 쓰기 범위가 필요합니다.",
75 "bfe81d615f5f8f75": "이 이슈는 어떤 프로젝트의 범위에도 속하지 않으므로 여기서는 읽기 전용입니다.",
76 + "8b876f2953338661": "연결되어 있는지 아직 알 수 없습니다",
77 + "b8c2bbba2243b429": "이미 연결됨",
78 + "4f1ab8a69f4a85e5": "이 앱이 해당 머신에 연결되어 있지 않습니다",
79 + "95f18b6ad4a409de": "그곳의 세션으로는 페어링 코드를 만들 수 없습니다",
80 + "26847ec0357c8600": "다른 머신이 접근할 수 있는 주소가 없습니다",
81 + "cba6d3e3a22f2efe": "연결할 수 없음",
82 + "0eb1a18deaf06b76": "페어링 코드가 거부됨",
83 + "7d6fc963ebf9a9c5": "다른 환경이 응답함",
84 + "85b2c80d3832bd14": "그곳에서 페어링 코드를 받지 못했습니다",
85 + "c7b1524d9b492428": "연결하지 못했습니다",
86 "b455e8f32a9d4c40": "머신",
87 "4cded869dea19ab2": "원래 스레드에서 답변을 기다리는 중",
88 "2b94dca2d528688f": "머신 연결됨",
@@ -8621,6 +8631,19 @@
8631 "03ce9bea5f88ddbd": "이 앱은 이 머신이 사용자의 머신인지 확인할 수 없습니다. 붙여 넣은 페어링 코드는 해당 주소로 전송됩니다.",
8632 "30b696434167411f": "연결됨",
8633 "80bbda74ee500b82": "머신",
8634 + "e5ac7abeaeb78750": "선택 해제",
8635 + "ab520df47bca22d2": "모두 선택",
8636 + "3a57c9bbcd12529f": "어떤 머신이 이미 연결되어 있는지 확인하지 못해 선택할 수 없습니다: {error}",
8637 + "78ccf685018ef797": "연결됨",
8638 + "87433cf138dc3e2c": "{linked, plural, other {머신 #대를 연결했습니다.}}",
8639 + "d044bb95248da10c": "{total}대 중 {linked}대를 연결했습니다. 실패한 머신은 선택된 상태로 남아 있어 다시 시도할 수 있습니다.",
8640 + "d2fbaffe08b6cf60": "{count, plural, other {머신 #대 연결}}",
8641 + "8e3378b526d615f4": "여러 개 연결…",
8642 + "7f8d6d1af69829d8": "여러 환경 연결",
8643 + "b550d04490078bda": "그러면 이곳의 에이전트가 선택한 각 머신에서 스레드를 시작하고, 메시지를 보내고, 기다릴 수 있습니다. 각 연결은 해당 머신의 공유 및 액세스에서 승인된 클라이언트에 표시되며 그곳에서 취소할 수 있습니다.",
8644 + "c2553b323479499a": "이 앱이 아는 다른 머신이 없습니다. 먼저 환경에서 추가하세요.",
8645 + "18b1d4d42b945b34": "머신",
8646 + "03860d65c4052ab5": "이미 연결된 머신을 확인하는 중…",
8647 "4cea6be0fe6be16f": "연결된 환경을 불러올 수 없습니다",
8648 "58cb9c075da185fb": "연결된 환경 불러오는 중…",
8649 "25b74062dc03079e": "연결된 환경 없음",
@@ -10749,7 +10772,6 @@
10772 "dc827550691bafd1": "연결됨 · {ms}ms",
10773 "11b77b0add59d7b4": "거부됨 · HTTP {status}",
10774 "10cf4b8e7ecc020b": "시간 초과",
10752 - "cba6d3e3a22f2efe": "연결할 수 없음",
10775 "523b72ed9d712100": "OpenTelemetry 내보내기",
10776 "ecaa5a9da2c44a47": "원격 분석 내보내기를 구성할 환경을 하나 선택하세요.",
10777 "5548e6d2e9b8cc64": "저장되었습니다. 적용하려면 서버를 다시 시작하세요.",
apps/web/src/i18n/translations/pt-BR.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "alterou o estado",
74 "bd672d0adf5e6d9a": "Escrever neste rastreador exige a permissão de escrita no controle de versão.",
75 "bfe81d615f5f8f75": "Esta issue está fora do escopo de todos os projetos, então aqui ela é somente leitura.",
76 + "8b876f2953338661": "Ainda não se sabe se está vinculada",
77 + "b8c2bbba2243b429": "Já vinculada",
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 + "cba6d3e3a22f2efe": "Inacessível",
82 + "0eb1a18deaf06b76": "Código de pareamento recusado",
83 + "7d6fc963ebf9a9c5": "Outro ambiente respondeu",
84 + "85b2c80d3832bd14": "Não foi possível obter um código de pareamento lá",
85 + "c7b1524d9b492428": "Não foi possível vincular",
86 "b455e8f32a9d4c40": "uma máquina",
87 "4cded869dea19ab2": "Aguardando uma resposta na thread original",
88 "2b94dca2d528688f": "Máquina vinculada",
@@ -8661,6 +8671,19 @@
8671 "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á.",
8672 "30b696434167411f": "Vinculado",
8673 "80bbda74ee500b82": "Máquina",
8674 + "e5ac7abeaeb78750": "Desmarcar tudo",
8675 + "ab520df47bca22d2": "Selecionar tudo",
8676 + "3a57c9bbcd12529f": "Não foi possível verificar quais máquinas já estão vinculadas, então nenhuma pode ser escolhida: {error}",
8677 + "78ccf685018ef797": "Vinculada",
8678 + "87433cf138dc3e2c": "{linked, plural, one {# máquina vinculada.} other {# máquinas vinculadas.}}",
8679 + "d044bb95248da10c": "{linked} de {total} vinculadas. As que falharam continuam selecionadas para você tentar de novo.",
8680 + "d2fbaffe08b6cf60": "{count, plural, one {Vincular # máquina} other {Vincular # máquinas}}",
8681 + "8e3378b526d615f4": "Vincular vários…",
8682 + "7f8d6d1af69829d8": "Vincular vários ambientes",
8683 + "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.",
8684 + "c2553b323479499a": "Este app não conhece outras máquinas. Adicione-as primeiro em Ambientes.",
8685 + "18b1d4d42b945b34": "Máquinas",
8686 + "03860d65c4052ab5": "Verificando quais máquinas já estão vinculadas…",
8687 "4cea6be0fe6be16f": "Não foi possível carregar os ambientes vinculados",
8688 "58cb9c075da185fb": "Carregando ambientes vinculados…",
8689 "25b74062dc03079e": "Nenhum ambiente vinculado",
@@ -10797,7 +10820,6 @@
10820 "dc827550691bafd1": "Conectado · {ms} ms",
10821 "11b77b0add59d7b4": "Rejeitado · HTTP {status}",
10822 "10cf4b8e7ecc020b": "Tempo esgotado",
10800 - "cba6d3e3a22f2efe": "Inacessível",
10823 "523b72ed9d712100": "Exportação OpenTelemetry",
10824 "ecaa5a9da2c44a47": "Escolha um ambiente para configurar as exportações de telemetria dele.",
10825 "5548e6d2e9b8cc64": "Salvo. Reinicie o servidor para aplicar.",
apps/web/src/i18n/translations/ru.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "изменил(а) состояние",
74 "bd672d0adf5e6d9a": "Для записи в этот трекер нужна область записи в контроль версий.",
75 "bfe81d615f5f8f75": "Этот issue вне области всех проектов, поэтому здесь он доступен только для чтения.",
76 + "8b876f2953338661": "Пока неизвестно, привязана ли она",
77 + "b8c2bbba2243b429": "Уже привязана",
78 + "4f1ab8a69f4a85e5": "Это приложение к ней не подключено",
79 + "95f18b6ad4a409de": "Ваш сеанс там не может создавать коды сопряжения",
80 + "26847ec0357c8600": "Нет адреса, доступного с другой машины",
81 + "cba6d3e3a22f2efe": "Недоступен",
82 + "0eb1a18deaf06b76": "Код сопряжения отклонён",
83 + "7d6fc963ebf9a9c5": "Ответило другое окружение",
84 + "85b2c80d3832bd14": "Не удалось получить там код сопряжения",
85 + "c7b1524d9b492428": "Не удалось привязать",
86 "b455e8f32a9d4c40": "машина",
87 "4cded869dea19ab2": "Ожидание ответа в исходном треде",
88 "2b94dca2d528688f": "Машина привязана",
@@ -8662,6 +8672,19 @@
8672 "03ce9bea5f88ddbd": "Приложение не может подтвердить, что это одна из ваших машин. Вставленный код сопряжения будет отправлен туда.",
8673 "30b696434167411f": "Привязано",
8674 "80bbda74ee500b82": "Машина",
8675 + "e5ac7abeaeb78750": "Снять выделение",
8676 + "ab520df47bca22d2": "Выбрать все",
8677 + "3a57c9bbcd12529f": "Не удалось проверить, какие машины уже привязаны, поэтому выбрать ни одну нельзя: {error}",
8678 + "78ccf685018ef797": "Привязана",
8679 + "87433cf138dc3e2c": "{linked, plural, one {Привязана # машина.} few {Привязаны # машины.} many {Привязано # машин.} other {Привязано # машины.}}",
8680 + "d044bb95248da10c": "Привязано {linked} из {total}. Машины с ошибкой остаются выбранными, чтобы можно было повторить попытку.",
8681 + "d2fbaffe08b6cf60": "{count, plural, one {Привязать # машину} few {Привязать # машины} many {Привязать # машин} other {Привязать # машины}}",
8682 + "8e3378b526d615f4": "Привязать несколько…",
8683 + "7f8d6d1af69829d8": "Привязать несколько окружений",
8684 + "b550d04490078bda": "После этого агенты отсюда смогут запускать треды на каждой выбранной машине, писать в них и ждать их. Каждая связь появится в разделе «Авторизованные клиенты» в «Общем доступе» соответствующей машины, где её можно отозвать.",
8685 + "c2553b323479499a": "Это приложение не знает других машин. Сначала добавьте их в разделе «Окружения».",
8686 + "18b1d4d42b945b34": "Машины",
8687 + "03860d65c4052ab5": "Проверяем, какие машины уже привязаны…",
8688 "4cea6be0fe6be16f": "Не удалось загрузить привязанные окружения",
8689 "58cb9c075da185fb": "Загрузка привязанных окружений…",
8690 "25b74062dc03079e": "Нет привязанных окружений",
@@ -10798,7 +10821,6 @@
10821 "dc827550691bafd1": "Подключено · {ms} мс",
10822 "11b77b0add59d7b4": "Отклонено · HTTP {status}",
10823 "10cf4b8e7ecc020b": "Превышено время ожидания",
10801 - "cba6d3e3a22f2efe": "Недоступен",
10824 "523b72ed9d712100": "Экспорт OpenTelemetry",
10825 "ecaa5a9da2c44a47": "Выберите одно окружение, чтобы настроить экспорт его телеметрии.",
10826 "5548e6d2e9b8cc64": "Сохранено. Перезапустите сервер, чтобы применить.",
apps/web/src/i18n/translations/sv.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "ändrade status",
74 "bd672d0adf5e6d9a": "Att skriva till den här ärendehanteraren kräver skrivomfånget för versionshantering.",
75 "bfe81d615f5f8f75": "Det här ärendet ligger utanför alla projekts eget omfång, så det är skrivskyddat här.",
76 + "8b876f2953338661": "Det är ännu inte känt om den är länkad",
77 + "b8c2bbba2243b429": "Redan länkad",
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 + "cba6d3e3a22f2efe": "Inte nåbar",
82 + "0eb1a18deaf06b76": "Parkopplingskoden nekades",
83 + "7d6fc963ebf9a9c5": "En annan miljö svarade",
84 + "85b2c80d3832bd14": "Kunde inte hämta en parkopplingskod där",
85 + "c7b1524d9b492428": "Kunde inte länka",
86 "b455e8f32a9d4c40": "en dator",
87 "4cded869dea19ab2": "Väntar på svar i den ursprungliga tråden",
88 "2b94dca2d528688f": "Länkade en dator",
@@ -8668,6 +8678,19 @@
8678 "03ce9bea5f88ddbd": "Appen kan inte bekräfta att det är en av dina datorer. Parkopplingskoden du klistrar in skickas dit.",
8679 "30b696434167411f": "Länkad",
8680 "80bbda74ee500b82": "Dator",
8681 + "e5ac7abeaeb78750": "Avmarkera allt",
8682 + "ab520df47bca22d2": "Markera allt",
8683 + "3a57c9bbcd12529f": "Det gick inte att kontrollera vilka datorer som redan är länkade, så ingen kan väljas: {error}",
8684 + "78ccf685018ef797": "Länkad",
8685 + "87433cf138dc3e2c": "{linked, plural, one {Länkade # dator.} other {Länkade # datorer.}}",
8686 + "d044bb95248da10c": "Länkade {linked} av {total}. De som misslyckades är fortfarande markerade så att du kan försöka igen.",
8687 + "d2fbaffe08b6cf60": "{count, plural, one {Länka # dator} other {Länka # datorer}}",
8688 + "8e3378b526d615f4": "Länka flera…",
8689 + "7f8d6d1af69829d8": "Länka flera miljöer",
8690 + "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.",
8691 + "c2553b323479499a": "Den här appen känner inte till några andra datorer. Lägg först till dem under Miljöer.",
8692 + "18b1d4d42b945b34": "Datorer",
8693 + "03860d65c4052ab5": "Kontrollerar vilka datorer som redan är länkade…",
8694 "4cea6be0fe6be16f": "Kunde inte läsa in länkade miljöer",
8695 "58cb9c075da185fb": "Läser in länkade miljöer…",
8696 "25b74062dc03079e": "Inga länkade miljöer",
@@ -10806,7 +10829,6 @@
10829 "dc827550691bafd1": "Ansluten · {ms} ms",
10830 "11b77b0add59d7b4": "Avvisad · HTTP {status}",
10831 "10cf4b8e7ecc020b": "Tidsgränsen överskreds",
10809 - "cba6d3e3a22f2efe": "Inte nåbar",
10832 "523b72ed9d712100": "OpenTelemetry-export",
10833 "ecaa5a9da2c44a47": "Välj en miljö för att konfigurera dess telemetriexport.",
10834 "5548e6d2e9b8cc64": "Sparat. Starta om servern för att tillämpa.",
apps/web/src/i18n/translations/zh.json
+23 -1
@@ -73,6 +73,16 @@
73 "1861f909464425a6": "更改了状态",
74 "bd672d0adf5e6d9a": "写入此跟踪器需要版本控制写入权限范围。",
75 "bfe81d615f5f8f75": "此 issue 不在任何项目自身的范围内,因此在这里为只读。",
76 + "8b876f2953338661": "尚不清楚是否已关联",
77 + "b8c2bbba2243b429": "已关联",
78 + "4f1ab8a69f4a85e5": "此应用未连接到该机器",
79 + "95f18b6ad4a409de": "你在该机器上的会话无法创建配对码",
80 + "26847ec0357c8600": "没有其他机器可访问的地址",
81 + "cba6d3e3a22f2efe": "无法访问",
82 + "0eb1a18deaf06b76": "配对码被拒绝",
83 + "7d6fc963ebf9a9c5": "应答的是另一个环境",
84 + "85b2c80d3832bd14": "无法在该机器上获取配对码",
85 + "c7b1524d9b492428": "无法关联",
86 "b455e8f32a9d4c40": "一台机器",
87 "4cded869dea19ab2": "正在等待原会话中的回答",
88 "2b94dca2d528688f": "已关联一台机器",
@@ -8678,6 +8688,19 @@
8688 "03ce9bea5f88ddbd": "此应用无法确认它是你的机器之一。你粘贴的配对码会发送到那里。",
8689 "30b696434167411f": "已关联",
8690 "80bbda74ee500b82": "机器",
8691 + "e5ac7abeaeb78750": "取消全选",
8692 + "ab520df47bca22d2": "全选",
8693 + "3a57c9bbcd12529f": "无法检查哪些机器已关联,因此暂时无法选择:{error}",
8694 + "78ccf685018ef797": "已关联",
8695 + "87433cf138dc3e2c": "{linked, plural, other {已关联 # 台机器。}}",
8696 + "d044bb95248da10c": "已关联 {linked}/{total} 台。失败的机器仍保持选中,你可以重试。",
8697 + "d2fbaffe08b6cf60": "{count, plural, other {关联 # 台机器}}",
8698 + "8e3378b526d615f4": "关联多个…",
8699 + "7f8d6d1af69829d8": "关联多个环境",
8700 + "b550d04490078bda": "这里的智能体随后就能在你选择的每台机器上启动会话、发送消息并等待结果。每个连接将显示在对应机器“共享与访问”的“已授权客户端”中,可在那里撤销。",
8701 + "c2553b323479499a": "此应用不知道其他机器。请先在“环境”中添加。",
8702 + "18b1d4d42b945b34": "机器",
8703 + "03860d65c4052ab5": "正在检查哪些机器已关联…",
8704 "4cea6be0fe6be16f": "无法加载已关联的环境",
8705 "58cb9c075da185fb": "正在加载已关联的环境…",
8706 "25b74062dc03079e": "没有已关联的环境",
@@ -10819,7 +10842,6 @@
10842 "dc827550691bafd1": "已连接 · {ms} 毫秒",
10843 "11b77b0add59d7b4": "已拒绝 · HTTP {status}",
10844 "10cf4b8e7ecc020b": "已超时",
10822 - "cba6d3e3a22f2efe": "无法访问",
10845 "523b72ed9d712100": "OpenTelemetry 导出",
10846 "ecaa5a9da2c44a47": "选择一个环境来配置遥测导出。",
10847 "5548e6d2e9b8cc64": "已保存。重启服务器后生效。",
docs/user/remote-access.md
+15
@@ -435,6 +435,21 @@ from that machine's **Settings → Sharing & access**. An address you type alway
435 needs a pasted code. From a terminal, use
436 `t3 environment link <address> --pairing-code <code> --access <mode>`.
437
438 +To link many machines at once, choose **Link several…** (it appears once this
439 +app has two other machines saved). Tick the machines, pick one access level for
440 +all of them, and confirm once. A machine can be ticked when this app is
441 +connected to it with a session that manages access there and has an address
442 +another machine can reach; the list says why when it cannot. Each machine
443 +reports its own result, and the ones that failed stay ticked so you can try
444 +only those again. Machines already linked are left as they are.
445 +
446 +For machines no app is connected to, put one `<address> <pairing-code>` per
447 +line in a file (make each code with `t3 pair` on that machine) and run
448 +`t3 environment link --from <file> --access <mode>`, or `--from -` to read
449 +standard input. It prints a result per line, leaves machines already linked as
450 +they are, and exits non-zero if any line failed, so the same file can be run
451 +again with fresh codes for the failures.
452 +
453 You can also ask an agent to link a machine by name, such as "delegate this to
454 my vps". It shows a card in the thread where you pick the machine the same way
455 and the access, then approve. An address the agent gives that this app does
packages/client-runtime/package.json
+4
@@ -103,6 +103,10 @@
103 "types": "./src/secretRequest.ts",
104 "default": "./src/secretRequest.ts"
105 },
106 + "./link-batch": {
107 + "types": "./src/linkBatch.ts",
108 + "default": "./src/linkBatch.ts"
109 + },
110 "./link-request": {
111 "types": "./src/linkRequest.ts",
112 "default": "./src/linkRequest.ts"
packages/client-runtime/src/linkBatch.test.ts new
+182
@@ -0,0 +1,182 @@
1 +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";
6 +import type { LinkableMachine } from "./linkRequest.ts";
7 +
8 +const machine = (name: string, overrides: Partial<LinkableMachine> = {}): LinkableMachine => ({
9 + environmentId: EnvironmentId.make(`environment-${name}`),
10 + label: name,
11 + machine: "server",
12 + connected: true,
13 + connectOnly: false,
14 + linked: false,
15 + urls: [`https://${name}.example.ts.net`, `http://100.64.0.1:3773`],
16 + ...overrides,
17 +});
18 +const id = (name: string) => EnvironmentId.make(`environment-${name}`);
19 +
20 +describe("linkBatchCandidates", () => {
21 + it("offers only machines the client can mint a code on and has an address for", () => {
22 + const machines = [
23 + machine("ready"),
24 + machine("linked", { linked: true, connected: false }),
25 + machine("offline", { connected: false }),
26 + machine("connect", { connected: false, connectOnly: true }),
27 + machine("viewer"),
28 + machine("loopback", { urls: [] }),
29 + ];
30 + const writable = new Set([id("ready"), id("linked"), id("offline"), id("loopback")]);
31 + expect(
32 + linkBatchCandidates(machines, writable, "loaded").map(({ machine, blocked }) => [
33 + machine.label,
34 + blocked,
35 + ]),
36 + ).toEqual([
37 + ["ready", null],
38 + ["linked", "linked"],
39 + ["offline", "not_connected"],
40 + ["connect", "not_connected"],
41 + ["viewer", "no_access"],
42 + ["loopback", "no_address"],
43 + ]);
44 + });
45 +
46 + it("offers no machine until the linking environment's links have loaded", () => {
47 + // With no list, a linked machine reads as unlinked.
48 + const machines = [machine("ready"), machine("linked-but-unlisted")];
49 + const writable = new Set(machines.map((entry) => entry.environmentId));
50 + const blockedWhen = (query: Parameters<typeof linkListState>[0]) =>
51 + linkBatchCandidates(machines, writable, linkListState(query)).map(({ blocked }) => blocked);
52 + expect(linkListState({ data: null, error: null })).toBe("loading");
53 + expect(linkListState({ data: null, error: "The environment request failed." })).toBe("failed");
54 + expect(blockedWhen({ data: null, error: null })).toEqual(["links_unknown", "links_unknown"]);
55 + expect(blockedWhen({ data: null, error: "failed" })).toEqual([
56 + "links_unknown",
57 + "links_unknown",
58 + ]);
59 + expect(blockedWhen({ data: { links: [] }, error: null })).toEqual([null, null]);
60 + });
61 +});
62 +
63 +describe("runLinkBatch", () => {
64 + it("links each machine with its own code, reports each failure, and retries only those", async () => {
65 + const machines = ["a", "b", "c", "d", "e"].map((name) => machine(name));
66 + const linked: Array<unknown> = [];
67 + const failures: Record<string, unknown> = {
68 + b: new PeerLinkError({
69 + reason: "pairing_rejected",
70 + message: "The peer refused the sign-in.",
71 + }),
72 + c: new PeerLinkError({ reason: "unreachable", message: "c did not answer." }),
73 + d: new PeerLinkError({
74 + reason: "unreachable",
75 + message: "d answered as another environment, Impostor.",
76 + answeredAs: "Impostor",
77 + }),
78 + };
79 + const seen: Array<string> = [];
80 + const outcomes = await runLinkBatch({
81 + machines,
82 + access: "auto",
83 + mint: async (environmentId) =>
84 + environmentId === id("e")
85 + ? Result.fail(new Error("no session"))
86 + : Result.succeed(`code-for-${environmentId}`),
87 + link: async (input) => {
88 + linked.push(input);
89 + const failure = failures[input.expectedLabel ?? ""];
90 + return failure === undefined ? Result.succeed(null) : Result.fail(failure);
91 + },
92 + refreshLinks: () => {},
93 + onOutcome: (environmentId) => seen.push(environmentId),
94 + });
95 +
96 + expect(linked[0]).toEqual({
97 + url: "https://a.example.ts.net",
98 + alternateUrls: ["http://100.64.0.1:3773"],
99 + expectedEnvironmentId: id("a"),
100 + expectedLabel: "a",
101 + pairingCode: `code-for-${id("a")}`,
102 + access: "auto",
103 + });
104 + // A machine with no code is never linked.
105 + expect(linked.length).toBe(4);
106 + expect(Object.fromEntries(outcomes)).toEqual({
107 + [id("a")]: { kind: "linked" },
108 + [id("b")]: {
109 + kind: "failed",
110 + failure: "code_refused",
111 + detail: "The peer refused the sign-in.",
112 + },
113 + [id("c")]: { kind: "failed", failure: "unreachable", detail: "c did not answer." },
114 + [id("d")]: {
115 + kind: "failed",
116 + failure: "wrong_environment",
117 + detail: "d answered as another environment, Impostor.",
118 + },
119 + [id("e")]: { kind: "failed", failure: "no_code", detail: null },
120 + });
121 + expect(seen.toSorted()).toEqual(machines.map((entry) => entry.environmentId));
122 + expect(linkBatchSummary(outcomes)).toEqual({
123 + linked: 1,
124 + failed: [id("b"), id("c"), id("d"), id("e")],
125 + });
126 + });
127 +
128 + it("never shows a failure that may carry the request and its pairing code", async () => {
129 + const outcomes = await runLinkBatch({
130 + machines: [machine("a")],
131 + access: "auto",
132 + mint: async () => Result.succeed("secret-code"),
133 + link: async (input) => Result.fail(new Error(`request failed: ${JSON.stringify(input)}`)),
134 + refreshLinks: () => {},
135 + });
136 + expect(outcomes.get(id("a"))).toEqual({ kind: "failed", failure: "other", detail: null });
137 + });
138 +
139 + it("opens at most four pairings at once", async () => {
140 + let open = 0;
141 + let most = 0;
142 + await runLinkBatch({
143 + machines: Array.from({ length: 10 }, (_, index) => machine(`vm-${index}`)),
144 + access: "auto",
145 + mint: async () => {
146 + open += 1;
147 + most = Math.max(most, open);
148 + return Result.succeed("code");
149 + },
150 + link: async () => {
151 + await Promise.resolve();
152 + open -= 1;
153 + return Result.succeed(null);
154 + },
155 + refreshLinks: () => {},
156 + });
157 + expect(most).toBe(4);
158 + });
159 +
160 + it("refreshes the links list once for the whole batch, after its last link", async () => {
161 + const events: Array<string> = [];
162 + const run = (names: ReadonlyArray<string>, fails: boolean) =>
163 + runLinkBatch({
164 + machines: names.map((name) => machine(name)),
165 + access: "auto",
166 + mint: async () => Result.succeed("code"),
167 + link: async () => {
168 + await Promise.resolve();
169 + events.push("link");
170 + return fails ? Result.fail(new Error("refused")) : Result.succeed(null);
171 + },
172 + refreshLinks: () => events.push("refresh"),
173 + });
174 + const names = Array.from({ length: 12 }, (_, index) => `vm-${index}`);
175 + await run(names, false);
176 + expect(events).toEqual([...names.map(() => "link"), "refresh"]);
177 + // A retry batch is one more refresh; a batch that linked nothing changed no list.
178 + await run(names.slice(0, 3), false);
179 + await run(names.slice(0, 3), true);
180 + expect(events.filter((event) => event === "refresh").length).toBe(2);
181 + });
182 +});
packages/client-runtime/src/linkBatch.ts new
+188
@@ -0,0 +1,188 @@
1 +import {
2 + type AuthMcpClientAccess,
3 + type EnvironmentId,
4 + type PeerLinkCreateInput,
5 + type PeerLinkFailureKind,
6 + peerLinkFailureKind,
7 +} from "@t3tools/contracts";
8 +import * as Result from "effect/Result";
9 +import { mFallback, msg } from "gt-i18n";
10 +import type { MFunctionType } from "gt-i18n/types";
11 +
12 +import type { LinkableMachine } from "./linkRequest.ts";
13 +
14 +/** Pairings a batch opens at once, so a fleet is not signed in to all at the same moment. */
15 +const LINK_BATCH_CONCURRENCY = 4;
16 +
17 +/**
18 + * Why a batch cannot link a machine: the client mints each pairing code there
19 + * with its own session, and sends it only to addresses it already has for it.
20 + */
21 +export type LinkBatchBlock =
22 + | "links_unknown"
23 + | "linked"
24 + | "not_connected"
25 + | "no_access"
26 + | "no_address";
27 +
28 +/** Whether the linking environment's own links are known yet. */
29 +export type LinkListState = "loading" | "failed" | "loaded";
30 +
31 +export const linkListState = (query: {
32 + readonly data: unknown;
33 + readonly error: unknown;
34 +}): LinkListState => (query.data !== null ? "loaded" : query.error !== null ? "failed" : "loading");
35 +
36 +export interface LinkBatchCandidate {
37 + readonly machine: LinkableMachine;
38 + readonly blocked: LinkBatchBlock | null;
39 +}
40 +
41 +/**
42 + * `writable` holds the machines where this client's session may create pairing codes.
43 + * Until `links` has loaded, no machine's `linked` is known, and linking one that is
44 + * already linked would replace its working token, so none is offered.
45 + */
46 +export const linkBatchCandidates = (
47 + machines: ReadonlyArray<LinkableMachine>,
48 + writable: ReadonlySet<EnvironmentId>,
49 + links: LinkListState,
50 +): ReadonlyArray<LinkBatchCandidate> =>
51 + machines.map((machine) => ({
52 + machine,
53 + blocked:
54 + links !== "loaded"
55 + ? "links_unknown"
56 + : machine.linked
57 + ? "linked"
58 + : !machine.connected
59 + ? "not_connected"
60 + : !writable.has(machine.environmentId)
61 + ? "no_access"
62 + : machine.urls.length === 0
63 + ? "no_address"
64 + : null,
65 + }));
66 +
67 +export const linkBatchBlockLabel = (
68 + blocked: LinkBatchBlock,
69 + resolve: MFunctionType = mFallback,
70 +): string => {
71 + switch (blocked) {
72 + case "links_unknown":
73 + return resolve(msg("Not known yet whether it is linked"));
74 + case "linked":
75 + return resolve(msg("Already linked"));
76 + case "not_connected":
77 + return resolve(msg("This app is not connected to it"));
78 + case "no_access":
79 + return resolve(msg("Your session there cannot create pairing codes"));
80 + case "no_address":
81 + return resolve(msg("No address another machine can reach"));
82 + }
83 +};
84 +
85 +export type LinkBatchFailure = PeerLinkFailureKind | "no_code";
86 +
87 +export type LinkBatchOutcome =
88 + | { readonly kind: "linked" }
89 + | { readonly kind: "failed"; readonly failure: LinkBatchFailure; readonly detail: string | null };
90 +
91 +export const linkBatchFailureLabel = (
92 + failure: LinkBatchFailure,
93 + resolve: MFunctionType = mFallback,
94 +): string => {
95 + switch (failure) {
96 + case "unreachable":
97 + return resolve(msg("Unreachable"));
98 + case "code_refused":
99 + return resolve(msg("Pairing code refused"));
100 + case "wrong_environment":
101 + return resolve(msg("Another environment answered"));
102 + case "no_code":
103 + return resolve(msg("Could not get a pairing code there"));
104 + case "other":
105 + return resolve(msg("Could not link"));
106 + }
107 +};
108 +
109 +/**
110 + * Only the linking environment's own error passes its message through:
111 + * anything else may carry the request, and with it the pairing code.
112 + */
113 +const linkFailure = (failure: unknown): LinkBatchOutcome => {
114 + if (
115 + typeof failure === "object" &&
116 + failure !== null &&
117 + "_tag" in failure &&
118 + failure._tag === "PeerLinkError" &&
119 + "reason" in failure &&
120 + "message" in failure &&
121 + typeof failure.message === "string"
122 + ) {
123 + const error = failure as unknown as Parameters<typeof peerLinkFailureKind>[0];
124 + return { kind: "failed", failure: peerLinkFailureKind(error), detail: failure.message };
125 + }
126 + return { kind: "failed", failure: "other", detail: null };
127 +};
128 +
129 +type BatchMachine = Pick<LinkableMachine, "environmentId" | "label" | "urls">;
130 +
131 +/**
132 + * Links each machine as a single link is made: a one-use code minted on that
133 + * machine with the client's session there, then handed to the linking
134 + * environment with the addresses the client has for it. A failure stops only
135 + * its own machine. Codes stay in this call and are never reported.
136 + */
137 +export async function runLinkBatch(input: {
138 + readonly machines: ReadonlyArray<BatchMachine>;
139 + readonly access: AuthMcpClientAccess;
140 + readonly mint: (
141 + environmentId: EnvironmentId,
142 + access: AuthMcpClientAccess,
143 + ) => Promise<Result.Result<string, unknown>>;
144 + readonly link: (input: PeerLinkCreateInput) => Promise<Result.Result<unknown, unknown>>;
145 + /** Called once, at the end: listing probes every linked machine, so `link` must not refresh. */
146 + readonly refreshLinks: () => void;
147 + readonly onOutcome?: (environmentId: EnvironmentId, outcome: LinkBatchOutcome) => void;
148 +}): Promise<ReadonlyMap<EnvironmentId, LinkBatchOutcome>> {
149 + const outcomes = new Map<EnvironmentId, LinkBatchOutcome>();
150 + 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);
164 + };
165 + const queue = [...input.machines];
166 + const worker = async () => {
167 + 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 + }));
173 + outcomes.set(machine.environmentId, outcome);
174 + input.onOutcome?.(machine.environmentId, outcome);
175 + }
176 + };
177 + await Promise.all(Array.from({ length: LINK_BATCH_CONCURRENCY }, worker));
178 + if ([...outcomes.values()].some((outcome) => outcome.kind === "linked")) input.refreshLinks();
179 + return outcomes;
180 +}
181 +
182 +/** How a batch went, and the machines a retry would run again. */
183 +export const linkBatchSummary = (outcomes: ReadonlyMap<EnvironmentId, LinkBatchOutcome>) => {
184 + const failed = [...outcomes].flatMap(([environmentId, outcome]) =>
185 + outcome.kind === "failed" ? [environmentId] : [],
186 + );
187 + return { linked: outcomes.size - failed.length, failed };
188 +};
packages/client-runtime/src/state/peerLinks.ts
+5
@@ -24,6 +24,11 @@ export function createPeerLinkEnvironmentAtoms<R, E>(
24 onSuccess: ({ environmentId }, registry) =>
25 Effect.sync(() => registry.refresh(list({ environmentId, input: {} }))),
26 }),
27 + // Leaves the list alone: a batch refreshes it once, when it ends (`runLinkBatch`).
28 + linkInBatch: createEnvironmentRpcCommand(runtime, {
29 + label: "environment-data:peer-links:link-in-batch",
30 + tag: WS_METHODS.peerLinksLink,
31 + }),
32 unlink: createEnvironmentRpcCommand(runtime, {
33 label: "environment-data:peer-links:unlink",
34 tag: WS_METHODS.peerLinksUnlink,
packages/contracts/src/peerLink.ts
+16
@@ -70,9 +70,25 @@ export class PeerLinkError extends Schema.TaggedError<PeerLinkError>()("PeerLink
70 "disabled",
71 ]),
72 message: Schema.String,
73 + /** The environment that answered at the addresses of the one the user picked, when one did. */
74 + answeredAs: Schema.optionalKey(Schema.String),
75 cause: Schema.optionalKey(Schema.Defect()),
76 }) {}
77
78 +/** What went wrong with one link, as a batch reports it per machine. */
79 +export type PeerLinkFailureKind = "unreachable" | "code_refused" | "wrong_environment" | "other";
80 +
81 +export const peerLinkFailureKind = (
82 + error: Pick<PeerLinkError, "reason" | "answeredAs">,
83 +): PeerLinkFailureKind =>
84 + error.answeredAs !== undefined
85 + ? "wrong_environment"
86 + : error.reason === "unreachable" || error.reason === "not_a_t3_environment"
87 + ? "unreachable"
88 + : error.reason === "pairing_rejected"
89 + ? "code_refused"
90 + : "other";
91 +
92 /**
93 * The user's answer to an agent asking to link an environment. The pairing
94 * code is used once to link and is never recorded; the thread learns only the