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, 03:37 UTC
feat: read a linked environment's threads from the client (#39406)
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Julius Marminge committed
Nov 20, 2026 at 12:10 UTC
1cb3a8c753047efc4fa00600105f5388de8fd7eb
90 files changed
+3945
-502
apps/mobile/src/Stack.tsx
+5
@@ -69,6 +69,7 @@ import { GitConfirmSheet } from "./features/threads/git/GitConfirmSheet";
69
import { GitOverviewSheet } from "./features/threads/git/GitOverviewSheet";
70
import { ThreadPullRequestsSheet } from "./features/threads/ThreadPullRequestsSheet";
71
import { ThreadAgentsSheet } from "./features/threads/ThreadAgentsSheet";
72
+import { LinkedThreadSheet } from "./features/threads/LinkedThreadSheet";
73
import { ThreadGuestShareSheet } from "./features/threads/ThreadGuestShareSheet";
74
import { ThreadBackgroundWorkSheet } from "./features/threads/ThreadBackgroundWorkSheet";
75
import { ThreadQueueSheet } from "./features/threads/ThreadQueueControl";
@@ -784,6 +785,10 @@ const RootStackConfig = createWorkspaceStackNavigator({
785
screen: ThreadAgentsSheet,
786
options: sheetRoute({ detent: 0.5, androidMaxDetent: 0.9 }),
787
}),
788
+ LinkedThread: createNativeStackScreen({
789
+ screen: LinkedThreadSheet,
790
+ options: sheetRoute({ detent: 0.9, android: "fullScreen" }),
791
+ }),
792
ThreadGuestShare: createNativeStackScreen({
793
screen: ThreadGuestShareSheet,
794
options: sheetRoute({ detent: 0.5 }),
apps/mobile/src/components/ComposerEditor.ios.test.tsx
+1
-1
@@ -117,7 +117,7 @@ vi.mock("./ui/Dialog", () => ({ alert: vi.fn() }));
117
vi.mock("./ui/AppText", () => ({ AppText: ({ children }: { children?: ReactNode }) => children }));
118
vi.mock("./ComposerContextSheet", () => ({ ComposerContextSheet: () => null }));
119
vi.mock("./AssistantCitationSheet", () => ({ AssistantCitationSheet: () => null }));
120
-vi.mock("../features/threads/useOpenLinkedThread", () => ({ useOpenLinkedThread: () => vi.fn() }));
120
+vi.mock("../features/threads/useOpenThreadLink", () => ({ useOpenThreadLink: () => vi.fn() }));
121
vi.mock("../state/peerLinks", () => ({ useLinkedEnvironments: () => [] }));
122
vi.mock("../state/model-mentions", () => ({ useModelMentions: () => [] }));
123
vi.mock("../state/preferences", async () => {
apps/mobile/src/components/ComposerEditor.tsx
+3
-6
@@ -37,7 +37,7 @@ import { appAtomRegistry } from "../state/atom-registry";
37
import { enrichedModelDetails, enrichedModelReference } from "../lib/enrichedLinkPresentation";
38
import { useModelMentions } from "../state/model-mentions";
39
import { mobilePreferencesAtom } from "../state/preferences";
40
-import { useOpenLinkedThread } from "../features/threads/useOpenLinkedThread";
40
+import { useOpenThreadLink } from "../features/threads/useOpenThreadLink";
41
import { useLinkedEnvironments } from "../state/peerLinks";
42
import { ComposerContextSheet } from "./ComposerContextSheet";
43
import { AppText as Text } from "./ui/AppText";
@@ -186,7 +186,7 @@ export function ComposerEditor({
186
}),
187
})
188
: "";
189
- const openLinkedThread = useOpenLinkedThread();
189
+ const openThreadLink = useOpenThreadLink(environmentId ?? null);
190
const selectedReference = selected
191
? collectComposerContextReferences(selected.source)[0]
192
: undefined;
@@ -338,10 +338,7 @@ export function ComposerEditor({
338
: {})}
339
onOpenThread={(thread) => {
340
setSelected(null);
341
- openLinkedThread({
342
- environmentId: String(thread.environmentId),
343
- threadId: String(thread.threadId),
344
- });
341
+ openThreadLink(thread);
342
}}
343
environmentId={environmentId ?? draft.project?.environmentId}
344
projectId={draft.project?.projectId}
apps/mobile/src/features/threads/LinkedThreadSheet.tsx
new
+383
@@ -0,0 +1,383 @@
1
+import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";
2
+import {
3
+ isLinkedThreadWorking,
4
+ linkedThreadFailure,
5
+ type LinkedThreadFailure,
6
+ type LinkedThreadTarget,
7
+} from "@t3tools/client-runtime/linked-thread";
8
+import {
9
+ toolCallLines,
10
+ turnItemDetailRevision,
11
+ turnItemOutputText,
12
+} from "@t3tools/client-runtime/work-log/item-detail";
13
+import { EnvironmentId, ThreadId } from "@t3tools/contracts";
14
+import { T, useGT, useLocale, useMessages } from "gt-react-native";
15
+import { useRef, useState, useSyncExternalStore } from "react";
16
+import type * as React from "react";
17
+import { AppState, Pressable, ScrollView, View } from "react-native";
18
+import { useSafeAreaInsets } from "react-native-safe-area-context";
19
+
20
+import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
21
+import { AppText as Text } from "../../components/ui/AppText";
22
+import { Button } from "../../components/ui/Button";
23
+import { ScreenContent } from "../../components/ui/ScreenContent";
24
+import { SheetHeader } from "../../components/ui/SheetHeader";
25
+import { SelectableMarkdownText } from "../../native/SelectableMarkdownText";
26
+import { useEnvironments } from "../../state/environments";
27
+import {
28
+ buildThreadFeed,
29
+ createThreadFeedCache,
30
+ formatItemFullDetail,
31
+ type ThreadFeedActivity,
32
+ type ThreadFeedEntry,
33
+} from "../../lib/threadActivity";
34
+import { useLinkedThreadView } from "../../state/linkedThread";
35
+import { peerLinkEnvironment } from "../../state/peerLinks";
36
+import { useEnvironmentQuery } from "../../state/query";
37
+import { useMarkdownPreviewStyles } from "../files/FileMarkdownPreview";
38
+import { ReadOnlyComposerBar } from "./ReadOnlyComposerBar";
39
+
40
+type LinkedThreadRouteParams = {
41
+ readonly viaEnvironmentId: string;
42
+ readonly environmentId: string;
43
+ readonly threadId: string;
44
+ readonly label: string;
45
+ readonly title?: string;
46
+};
47
+
48
+/** The route params that open a linked environment's thread read-only. */
49
+export const linkedThreadRouteParams = (
50
+ thread: { readonly environmentId: EnvironmentId; readonly threadId: ThreadId },
51
+ linked: { readonly viaEnvironmentId: EnvironmentId; readonly label: string },
52
+ title: string | null,
53
+): LinkedThreadRouteParams => ({
54
+ viaEnvironmentId: linked.viaEnvironmentId,
55
+ environmentId: thread.environmentId,
56
+ threadId: thread.threadId,
57
+ label: linked.label,
58
+ ...(title === null ? {} : { title }),
59
+});
60
+
61
+function ActivityRow(props: {
62
+ readonly activity: ThreadFeedActivity;
63
+ readonly target: LinkedThreadTarget;
64
+}) {
65
+ const { activity, target } = props;
66
+ const gt = useGT();
67
+ const [open, setOpen] = useState(false);
68
+ const row = activity.projectedItem;
69
+ // The stream leaves long output out; an open row reads its item in full through the link.
70
+ const fetched = useEnvironmentQuery(
71
+ open && activity.fetchesDetail
72
+ ? peerLinkEnvironment.threadItem({
73
+ environmentId: target.viaEnvironmentId,
74
+ input: {
75
+ environmentId: target.environmentId,
76
+ threadId: row.sourceThreadId,
77
+ itemId: row.sourceItemId,
78
+ revision: turnItemDetailRevision(row.item),
79
+ },
80
+ })
81
+ : null,
82
+ );
83
+ const fetchedItem = fetched.data?.item ?? null;
84
+ const shownItem = fetchedItem ?? row.item;
85
+ // A command or tool call reads as what was called, as on the thread screen; only an item with
86
+ // no call to show falls back to its full detail.
87
+ const call = !open
88
+ ? null
89
+ : shownItem.type === "command_execution"
90
+ ? toolCallLines({ command: shownItem.input })
91
+ : shownItem.type === "dynamic_tool"
92
+ ? toolCallLines({ args: shownItem.input })
93
+ : null;
94
+ const callText = call
95
+ ? (call.command ??
96
+ call.args?.map(([key, value]) => `${key}: ${value}`).join("\n") ??
97
+ call.argsText)
98
+ : null;
99
+ const body = !open
100
+ ? null
101
+ : call
102
+ ? callText
103
+ : fetchedItem
104
+ ? formatItemFullDetail(row, fetchedItem)
105
+ : (activity.getFullDetail() ?? activity.detail);
106
+ const output = !open
107
+ ? null
108
+ : !activity.fetchesDetail
109
+ ? turnItemOutputText(row.item)
110
+ : fetchedItem
111
+ ? (turnItemOutputText(fetchedItem) ?? gt("No output."))
112
+ : fetched.error
113
+ ? gt("Couldn't load output: {error}", { error: fetched.error })
114
+ : fetched.data
115
+ ? gt("Output is no longer available.")
116
+ : gt("Loading output…");
117
+ return (
118
+ <Pressable
119
+ accessibilityRole="button"
120
+ accessibilityState={{ expanded: open }}
121
+ disabled={!activity.canExpand}
122
+ onPress={() => setOpen(!open)}
123
+ className="active:opacity-70"
124
+ >
125
+ <Text
126
+ numberOfLines={open ? undefined : 1}
127
+ className={`font-mono text-xs ${activity.status === "failure" ? "text-danger-foreground" : "text-foreground-muted"}`}
128
+ >
129
+ {activity.summary}
130
+ </Text>
131
+ {body ? (
132
+ <View className="mt-1 rounded-lg bg-subtle p-2">
133
+ <Text selectable className="font-mono text-xs text-foreground-muted">
134
+ {body}
135
+ </Text>
136
+ </View>
137
+ ) : null}
138
+ {output ? (
139
+ <View className="mt-1 rounded-lg bg-subtle p-2">
140
+ <Text selectable className="font-mono text-xs text-foreground-muted">
141
+ {output}
142
+ </Text>
143
+ </View>
144
+ ) : null}
145
+ {open && fetched.error ? (
146
+ <View className="mt-1.5 self-start">
147
+ <Button
148
+ size="compact"
149
+ tone="secondary"
150
+ label={gt("Try again")}
151
+ onPress={fetched.refresh}
152
+ />
153
+ </View>
154
+ ) : null}
155
+ </Pressable>
156
+ );
157
+}
158
+
159
+/**
160
+ * One entry of the thread's feed, as the thread screen's own feed model has it. Only reading
161
+ * rows are drawn: what needs the thread's environment (files, visuals, apps) is left out.
162
+ */
163
+function LinkedThreadEntry(props: {
164
+ readonly entry: ThreadFeedEntry;
165
+ readonly target: LinkedThreadTarget;
166
+}) {
167
+ const { entry } = props;
168
+ const styles = useMarkdownPreviewStyles();
169
+ if (entry.type === "activity-group") {
170
+ return (
171
+ <View className="gap-1.5">
172
+ {entry.activities.map((activity) => (
173
+ <ActivityRow key={activity.id} activity={activity} target={props.target} />
174
+ ))}
175
+ </View>
176
+ );
177
+ }
178
+ // A message the agent sent with a tool reads as its own words, as on the thread screen.
179
+ if (entry.type === "sent-message") {
180
+ return <SelectableMarkdownText markdown={entry.text} textStyle={styles.nativeTextStyle} />;
181
+ }
182
+ if (entry.type !== "message" || entry.message.text.trim() === "") return null;
183
+ return entry.message.role === "user" ? (
184
+ <View className="max-w-[88%] self-end rounded-2xl bg-user-bubble px-3.5 py-2.5">
185
+ <Text selectable className="text-sm text-user-bubble-foreground">
186
+ {entry.message.text}
187
+ </Text>
188
+ </View>
189
+ ) : (
190
+ <SelectableMarkdownText markdown={entry.message.text} textStyle={styles.nativeTextStyle} />
191
+ );
192
+}
193
+
194
+function FailureCard(props: {
195
+ readonly failure: LinkedThreadFailure;
196
+ readonly stale: boolean;
197
+ readonly onRetry: () => void;
198
+}) {
199
+ const gt = useGT();
200
+ return (
201
+ <View
202
+ accessibilityLiveRegion="polite"
203
+ className="gap-1 rounded-2xl border border-danger-border bg-danger px-3.5 py-3"
204
+ >
205
+ <Text className="font-t3-medium text-sm text-danger-foreground">{props.failure.title}</Text>
206
+ <Text className="text-sm text-danger-foreground">
207
+ {props.failure.detail}
208
+ {props.stale ? ` ${gt("Showing what was read before.")}` : ""}
209
+ </Text>
210
+ {props.failure.retryable ? (
211
+ <View className="mt-2 self-start">
212
+ <Button size="compact" tone="secondary" label={gt("Try again")} onPress={props.onRetry} />
213
+ </View>
214
+ ) : null}
215
+ </View>
216
+ );
217
+}
218
+
219
+/**
220
+ * Stands where a composer would: the thread takes no messages from here. `action` is the one way
221
+ * forward it offers, and `notice` what came of it.
222
+ */
223
+function LinkedThreadComposer(props: {
224
+ /** The linked environment the thread is on. */
225
+ readonly label: string;
226
+ /** The environment that reads it. */
227
+ readonly via: string;
228
+ readonly working: boolean;
229
+ readonly action?: React.ReactNode;
230
+ readonly notice?: React.ReactNode;
231
+}) {
232
+ const { label, via } = props;
233
+ const gt = useGT();
234
+ return (
235
+ <>
236
+ {props.notice}
237
+ <ReadOnlyComposerBar>
238
+ <View accessible className="min-w-0 flex-1 gap-0.5">
239
+ <Text numberOfLines={1} className="font-t3-bold text-sm text-foreground">
240
+ <T>Read-only</T>
241
+ </Text>
242
+ <Text numberOfLines={1} className="font-sans text-xs text-foreground-secondary">
243
+ {props.working
244
+ ? gt("On {label} via {via} · Working", { label, via })
245
+ : gt("On {label} via {via}", { label, via })}
246
+ </Text>
247
+ </View>
248
+ {props.action}
249
+ </ReadOnlyComposerBar>
250
+ </>
251
+ );
252
+}
253
+
254
+const subscribeAppState = (onChange: () => void) => {
255
+ const subscription = AppState.addEventListener("change", onChange);
256
+ return () => subscription.remove();
257
+};
258
+const appIsActive = () => AppState.currentState === "active";
259
+
260
+function LinkedThreadView(props: { readonly target: LinkedThreadTarget }) {
261
+ const { target } = props;
262
+ const gt = useGT();
263
+ const m = useMessages();
264
+ const locale = useLocale();
265
+ const navigation = useNavigation();
266
+ const insets = useSafeAreaInsets();
267
+ const via =
268
+ useEnvironments().environments.find(
269
+ (environment) => environment.environmentId === target.viaEnvironmentId,
270
+ )?.label ?? gt("this environment");
271
+ // The stream runs only while this screen is the one being looked at.
272
+ const focused = useIsFocused();
273
+ const appActive = useSyncExternalStore(subscribeAppState, appIsActive);
274
+ const { view, error, retry } = useLinkedThreadView(target, focused && appActive);
275
+ const projection = view?.thread.projection ?? null;
276
+ const label = target.label;
277
+ const failure = error === null ? null : linkedThreadFailure(error, { via, label }, m);
278
+ const [feedCache] = useState(() => createThreadFeedCache());
279
+ const feed =
280
+ projection === null
281
+ ? []
282
+ : buildThreadFeed(projection.visibleTurnItems, {
283
+ attempts: projection.attempts,
284
+ nodes: projection.nodes,
285
+ cache: feedCache,
286
+ resolve: m,
287
+ locale,
288
+ });
289
+ const scroll = useRef<React.ComponentRef<typeof ScrollView>>(null);
290
+ // Follows new items only while the reader is already at the end.
291
+ const atEnd = useRef(true);
292
+ const working = projection !== null && isLinkedThreadWorking(projection);
293
+ return (
294
+ <View collapsable={false} className="flex-1 bg-sheet">
295
+ <SheetHeader
296
+ title={projection?.thread.title || target.title || gt("Thread on {label}", { label })}
297
+ onClose={() => navigation.goBack()}
298
+ />
299
+ <ScreenContent>
300
+ <ScrollView
301
+ ref={scroll}
302
+ nestedScrollEnabled
303
+ className="flex-1"
304
+ contentInsetAdjustmentBehavior="automatic"
305
+ contentContainerClassName="gap-3 px-5 pb-3 pt-3"
306
+ // An earlier page lands above what is being read without moving it.
307
+ maintainVisibleContentPosition={{ minIndexForVisible: 0 }}
308
+ scrollEventThrottle={64}
309
+ onScroll={({ nativeEvent }) => {
310
+ const { contentOffset, contentSize, layoutMeasurement } = nativeEvent;
311
+ atEnd.current = contentSize.height - layoutMeasurement.height - contentOffset.y < 80;
312
+ }}
313
+ onContentSizeChange={() => {
314
+ if (atEnd.current) scroll.current?.scrollToEnd({ animated: false });
315
+ }}
316
+ >
317
+ {view === null || projection === null ? (
318
+ failure === null ? (
319
+ <View className="flex-row items-center gap-2 pt-6">
320
+ <AppActivityIndicator size="small" />
321
+ <Text className="text-sm text-foreground-muted">
322
+ {gt("Reading from {label}…", { label })}
323
+ </Text>
324
+ </View>
325
+ ) : (
326
+ <FailureCard failure={failure} stale={false} onRetry={retry} />
327
+ )
328
+ ) : (
329
+ <>
330
+ {view.thread.historyCursor !== null ? (
331
+ <View className="self-center">
332
+ <Button
333
+ size="compact"
334
+ tone="text"
335
+ label={gt("Load earlier")}
336
+ loading={view.history.loading}
337
+ disabled={view.history.loading}
338
+ onPress={view.loadEarlier}
339
+ />
340
+ </View>
341
+ ) : null}
342
+ {feed.length === 0 ? (
343
+ <Text className="text-sm text-foreground-muted">
344
+ <T>Nothing in this thread yet.</T>
345
+ </Text>
346
+ ) : null}
347
+ {feed.map((entry) => (
348
+ <LinkedThreadEntry key={entry.id} entry={entry} target={target} />
349
+ ))}
350
+ {failure === null ? null : <FailureCard failure={failure} stale onRetry={retry} />}
351
+ </>
352
+ )}
353
+ </ScrollView>
354
+ <View
355
+ className="gap-2 px-3 pt-1.5"
356
+ style={{ paddingBottom: Math.max(insets.bottom, 10) + 6 }}
357
+ >
358
+ <LinkedThreadComposer label={label} via={via} working={working} />
359
+ </View>
360
+ </ScreenContent>
361
+ </View>
362
+ );
363
+}
364
+
365
+/**
366
+ * A linked environment's thread, read through the environment this app is connected to. The app
367
+ * never connects to the linked one, so the screen only reads.
368
+ */
369
+export function LinkedThreadSheet({ route }: StaticScreenProps<LinkedThreadRouteParams>) {
370
+ const { viaEnvironmentId, environmentId, threadId, label, title } = route.params;
371
+ return (
372
+ <LinkedThreadView
373
+ key={`${viaEnvironmentId}:${environmentId}:${threadId}`}
374
+ target={{
375
+ viaEnvironmentId: EnvironmentId.make(viaEnvironmentId),
376
+ environmentId: EnvironmentId.make(environmentId),
377
+ threadId: ThreadId.make(threadId),
378
+ label,
379
+ title: title ?? null,
380
+ }}
381
+ />
382
+ );
383
+}
apps/mobile/src/features/threads/ProviderSubagentBar.tsx
+3
-3
@@ -11,6 +11,7 @@ import { AppText as Text } from "../../components/ui/AppText";
11
import { ProviderIcon } from "../../components/ProviderIcon";
12
import { Button } from "../../components/ui/Button";
13
import { NativeChildWorkSheet } from "./NativeChildWorkSheet";
14
+import { ReadOnlyComposerBar } from "./ReadOnlyComposerBar";
15
import { useVisibleSecondClock } from "./use-visible-second-clock";
16
17
export function ProviderSubagentBar(props: {
@@ -32,8 +33,7 @@ export function ProviderSubagentBar(props: {
33
props.effortLabel === null ? props.modelLabel : `${props.modelLabel}, ${props.effortLabel}`;
34
35
return (
35
- <View className="flex-row items-center gap-3 rounded-[20px] border border-border-subtle bg-card-alt py-2 pe-2 ps-4">
36
- {}
36
+ <ReadOnlyComposerBar>
37
<View
38
accessible
39
accessibilityLabel={gt(
@@ -85,6 +85,6 @@ export function ProviderSubagentBar(props: {
85
{props.inspect && inspecting ? (
86
<NativeChildWorkSheet {...props.inspect} onClose={() => setInspecting(false)} />
87
) : null}
88
- </View>
88
+ </ReadOnlyComposerBar>
89
);
90
}
apps/mobile/src/features/threads/ReadOnlyComposerBar.tsx
new
+14
@@ -0,0 +1,14 @@
1
+import type { ReactNode } from "react";
2
+import { View } from "react-native";
3
+
4
+/**
5
+ * What stands where the composer would for a thread that takes no messages. `children` say what
6
+ * the thread is and how it is doing, then any actions.
7
+ */
8
+export function ReadOnlyComposerBar(props: { readonly children: ReactNode }) {
9
+ return (
10
+ <View className="flex-row items-center gap-3 rounded-[20px] border border-border-subtle bg-card-alt py-2 pe-2 ps-4">
11
+ {props.children}
12
+ </View>
13
+ );
14
+}
apps/mobile/src/features/threads/ThreadAgentsSheet.tsx
+26
-16
@@ -24,13 +24,14 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
24
import { SheetHeader } from "../../components/ui/SheetHeader";
25
import { AppText as Text } from "../../components/ui/AppText";
26
import { environmentThreadDetails } from "../../state/threads";
27
-import { useEnvironments } from "../../state/environments";
27
import { SubagentRow } from "./SubagentRow";
28
import { useVisibleSecondClock } from "./use-visible-second-clock";
29
import { SubagentStopButton } from "./SubagentStopButton";
30
import { ThreadWorkflowGroup } from "./ThreadWorkflowGroup";
31
import { ScreenContent } from "../../components/ui/ScreenContent";
33
-import { subagentThreadTarget } from "./threadAgentsPresentation";
32
+import { subagentThreadTarget, type SubagentThreadTarget } from "./threadAgentsPresentation";
33
+import { linkedThreadRouteParams } from "./LinkedThreadSheet";
34
+import { useLinkedThreadReach } from "../../state/linkedThread";
35
36
import { useOpenThreadInspector } from "./thread-inspector-navigation";
37
@@ -69,8 +70,14 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {
70
[messages, subagents],
71
);
72
72
- const openChildThread = (child: { environmentId: EnvironmentId; threadId: ThreadId }) => {
73
+ const openChildThread = (child: SubagentThreadTarget, title: string | null = null) => {
74
void Haptics.selectionAsync();
75
+ if (child.linked !== undefined) {
76
+ navigation.dispatch(
77
+ StackActions.replace("LinkedThread", linkedThreadRouteParams(child, child.linked, title)),
78
+ );
79
+ return;
80
+ }
81
if (
82
openInspector(target, {
83
type: "thread",
@@ -141,13 +148,16 @@ function AgentRow(props: {
148
readonly environmentId: EnvironmentId;
149
readonly subagent: OrchestrationV2Subagent;
150
readonly tickSeconds: boolean;
144
- readonly onOpen: (child: { environmentId: EnvironmentId; threadId: ThreadId }) => void;
151
+ readonly onOpen: (child: SubagentThreadTarget, title: string | null) => void;
152
}) {
153
const { subagent } = props;
154
const gt = useGT();
148
- const { presentationById } = useEnvironments();
149
- const target = subagentThreadTarget(subagent, props.environmentId, (id) =>
150
- presentationById.has(id),
155
+ const reach = useLinkedThreadReach(props.environmentId, [subagent]);
156
+ const target = subagentThreadTarget(
157
+ subagent,
158
+ props.environmentId,
159
+ reach.ownConnection,
160
+ reach.isLinked,
161
);
162
163
const row = (
@@ -166,21 +176,21 @@ function AgentRow(props: {
176
<View
177
accessible
178
className="min-w-0 flex-1"
169
- accessibilityHint={
170
- subagent.remoteChild === undefined
171
- ? gt("Provider-managed agent. Its work appears in the transcript.")
172
- : gt("Runs on {label}. Connect to it to open its thread.", {
173
- label: subagent.remoteChild.label,
174
- })
175
- }
179
+ accessibilityHint={gt("Provider-managed agent. Its work appears in the transcript.")}
180
>
181
{row}
182
</View>
183
) : (
184
<Pressable
185
accessibilityRole="link"
182
- accessibilityHint={gt("Opens this agent's thread")}
183
- onPress={() => props.onOpen(target)}
186
+ accessibilityHint={
187
+ target.linked === undefined
188
+ ? gt("Opens this agent's thread")
189
+ : gt("Opens a read-only view of this agent's thread on {label}", {
190
+ label: target.linked.label,
191
+ })
192
+ }
193
+ onPress={() => props.onOpen(target, subagent.title)}
194
className="min-w-0 flex-1 active:opacity-70"
195
>
196
{row}
apps/mobile/src/features/threads/ThreadFeed.tsx
+17
-15
@@ -85,7 +85,7 @@ import {
85
} from "@t3tools/contracts";
86
import type { ToolCallVisibility } from "@t3tools/contracts/settings";
87
import { encodeComposerContextFragment } from "@t3tools/shared/composerContextClipboard";
88
-import { hostedThreadLink, parseThreadLinkHref } from "@t3tools/shared/threadLinks";
88
+import { hasThreadLinks, hostedThreadLink, parseThreadLinkHref } from "@t3tools/shared/threadLinks";
89
import { PROMPT_LINK_MAX_PROMPT_LENGTH } from "@t3tools/shared/promptLinks";
90
import {
91
parseComposerContextHref,
@@ -297,6 +297,7 @@ import {
297
import { useEnvironmentPresentation } from "../../state/presentation";
298
import { useThreadSelection } from "../../state/use-thread-selection";
299
import { useEnvironmentQuery } from "../../state/query";
300
+import { useLinkedEnvironments } from "../../state/peerLinks";
301
import { serverEnvironment } from "../../state/server";
302
import { useModelMentions } from "../../state/model-mentions";
303
import { composerDocumentAttachmentRecord } from "../../lib/composerContext";
@@ -322,6 +323,7 @@ import { resolveUserMessageIntentBadge } from "./userMessageIntentBadge";
323
import { fileChipClipboardPath, fileChipMenu, resolveFileChipTarget } from "./fileChipMenu";
324
import { useFileChipShare } from "./useFileChipShare";
325
import { useOpenLinkedThread } from "./useOpenLinkedThread";
326
+import { useOpenThreadLink } from "./useOpenThreadLink";
327
import {
328
MarkdownImageAvailableWidthContext,
329
ThreadMarkdownImage,
@@ -1328,7 +1330,11 @@ const AssistantMarkdownContent = memo(function AssistantMarkdownContent(props: {
1330
readonly skills?: ReadonlyArray<SelectableMarkdownSkill> | undefined;
1331
}) {
1332
const gt = useGT();
1331
- const liveMarkdown = useLiveThreadLinkLabels(props.markdown, props.environmentId);
1333
+ const liveMarkdown = useLiveThreadLinkLabels(
1334
+ props.markdown,
1335
+ props.environmentId,
1336
+ useLinkedEnvironments(hasThreadLinks(props.markdown) ? props.environmentId : null),
1337
+ );
1338
const [quoteSelection, setQuoteSelection] = useState<{
1339
markdown: string;
1340
selectors: ReturnType<typeof collectMobileAssistantTextSelectors>;
@@ -2796,9 +2802,13 @@ function UserMessageContent(props: UserMessageContentProps) {
2802
const gt = useGT();
2803
const [selected, setSelected] = useState<{ contextId: string; label: string } | null>(null);
2804
const navigation = useNavigation();
2799
- const openLinkedThread = useOpenLinkedThread();
2805
+ const openThreadLink = useOpenThreadLink(props.environmentId);
2806
const { selectedThread } = useThreadSelection();
2801
- const liveText = useLiveThreadLinkLabels(props.text, props.environmentId);
2807
+ const liveText = useLiveThreadLinkLabels(
2808
+ props.text,
2809
+ props.environmentId,
2810
+ useLinkedEnvironments(hasThreadLinks(props.text) ? props.environmentId : null),
2811
+ );
2812
const threadIcons = useThreadChipIcons(props.environmentId, liveText, props.context?.records);
2813
const text = replaceComposerContextReferences(liveText, (ref) => {
2814
const available = props.context?.records.some((record) => record.contextId === ref.contextId);
@@ -2816,10 +2826,7 @@ function UserMessageContent(props: UserMessageContentProps) {
2826
return;
2827
}
2828
if (record?.kind === "thread" && "threadId" in record) {
2819
- openLinkedThread({
2820
- environmentId: String(record.environmentId),
2821
- threadId: String(record.threadId),
2822
- });
2829
+ openThreadLink(scopeThreadRef(record.environmentId, record.threadId));
2830
return;
2831
}
2832
const document = composerDocumentAttachmentRecord(record);
@@ -3138,7 +3145,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
3145
const duoColumns = useNativeWorkspaceColumnsSupported() && isDuoDevice(deviceType);
3146
const openPullRequest = useOpenPullRequest();
3147
const navigation = useNavigation();
3141
- const openLinkedThread = useOpenLinkedThread();
3148
+ const openThreadLink = useOpenThreadLink(props.environmentId);
3149
const openLocalPreview = useOpenLocalPreview();
3150
const previewTunnelOff = useEnvironmentPreviewTunnelOff(props.environmentId);
3151
// Without the tunnel, loopback links fall through to the system browser like any other link.
@@ -3436,12 +3443,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
3443
}
3444
if (parseThreadLinkHref(href)) {
3445
const target = resolveLinkedThread(href);
3439
- if (target) {
3440
- openLinkedThread({
3441
- environmentId: String(target.environmentId),
3442
- threadId: String(target.threadId),
3443
- });
3444
- }
3446
+ if (target) openThreadLink(target);
3447
return;
3448
}
3449
const media = resolveMarkdownMediaPreview(href, {
apps/mobile/src/features/threads/thread-subagent-group.tsx
+24
-9
@@ -24,11 +24,12 @@ import type { ThreadFeedActivity } from "../../lib/threadActivity";
24
import { serverEnvironment } from "../../state/server";
25
import { environmentThreadDetails } from "../../state/threads";
26
import { subagentCardElapsed } from "./subagent-card-presentation";
27
-import { useEnvironments } from "../../state/environments";
27
import { useServerConfigs } from "../../state/entities";
28
import { SubagentRow } from "./SubagentRow";
29
import { useVisibleSecondClock } from "./use-visible-second-clock";
30
import { subagentThreadTarget } from "./threadAgentsPresentation";
31
+import { linkedThreadRouteParams } from "./LinkedThreadSheet";
32
+import { useLinkedThreadReach } from "../../state/linkedThread";
33
import { WorkLogBlock } from "./work-log-layout";
34
35
import { useOpenThreadInspector } from "./thread-inspector-navigation";
@@ -120,7 +121,6 @@ export function ThreadSubagentGroup(props: {
121
environmentThreadDetails.threadAtom(scopeThreadRef(props.environmentId, members[0]!.threadId)),
122
(thread) => thread?.projection.subagents,
123
);
123
- const { presentationById } = useEnvironments();
124
const agents = members.map((item) => {
125
const live = liveAgents?.find((agent) => agent.id === item.subagentId);
126
return {
@@ -135,6 +135,7 @@ export function ThreadSubagentGroup(props: {
135
modelSelection: live?.modelSelection,
136
};
137
});
138
+ const reach = useLinkedThreadReach(props.environmentId, agents);
139
const grouped = agents.length > 1;
140
const label = gt("{count, plural, one {{count} subagent} other {{count} subagents}}", {
141
count: agents.length,
@@ -199,8 +200,11 @@ export function ThreadSubagentGroup(props: {
200
<View className="mb-1 gap-px rounded-xl border border-border bg-card/30 p-1">
201
{agents.map((agent) => {
202
// A task in a linked environment opens there, if this app is connected to it.
202
- const target = subagentThreadTarget(agent, props.environmentId, (id) =>
203
- presentationById.has(id),
203
+ const target = subagentThreadTarget(
204
+ agent,
205
+ props.environmentId,
206
+ reach.ownConnection,
207
+ reach.isLinked,
208
);
209
return (
210
<Pressable
@@ -208,15 +212,26 @@ export function ThreadSubagentGroup(props: {
212
accessible
213
accessibilityRole={target === null ? undefined : "link"}
214
accessibilityHint={
211
- target !== null
212
- ? gt("Opens this agent's thread")
213
- : agent.remoteChild !== undefined
214
- ? gt("Runs on {label}", { label: agent.remoteChild.label })
215
- : gt("Provider-managed agent")
215
+ target === null
216
+ ? gt("Provider-managed agent")
217
+ : target.linked === undefined
218
+ ? gt("Opens this agent's thread")
219
+ : gt("Opens a read-only view of this agent's thread on {label}", {
220
+ label: target.linked.label,
221
+ })
222
}
223
disabled={target === null}
224
onPress={() => {
225
if (target === null) return;
226
+ if (target.linked !== undefined) {
227
+ navigation.dispatch(
228
+ StackActions.push(
229
+ "LinkedThread",
230
+ linkedThreadRouteParams(target, target.linked, agent.title),
231
+ ),
232
+ );
233
+ return;
234
+ }
235
if (
236
openInspector(
237
{ environmentId: props.environmentId, threadId: members[0]!.threadId },
apps/mobile/src/features/threads/threadAgentsPresentation.ts
+27
-8
@@ -1,3 +1,4 @@
1
+import { resolveLinkedThreadOpen } from "@t3tools/client-runtime/linked-thread";
2
import {
3
formatSubagentDisplayTitle,
4
resolveSubagentMetadata,
@@ -36,23 +37,41 @@ export interface SubagentRowPresentation {
37
readonly runsOn: string | null;
38
}
39
40
+export interface SubagentThreadTarget {
41
+ readonly environmentId: EnvironmentId;
42
+ readonly threadId: ThreadId;
43
+ /** Set when the thread is read through the environment that links to it, not opened there. */
44
+ readonly linked?: { readonly viaEnvironmentId: EnvironmentId; readonly label: string };
45
+}
46
+
47
/**
40
- * Where an agent's thread opens: here, or in the linked environment that runs
41
- * it. Null when there is no thread, or this app is not connected to that
42
- * environment.
48
+ * Where an agent's thread opens: here, in the linked environment that runs it when this app is
49
+ * connected there, or read-only through this environment's link. Once the link is gone a saved
50
+ * environment opens in place, where the app can reconnect to it; with neither, the read-only view
51
+ * says what to link again. Null when there is no thread.
52
*/
53
export function subagentThreadTarget(
54
subagent: Pick<OrchestrationV2Subagent, "childThreadId" | "remoteChild">,
55
environmentId: EnvironmentId,
47
- isKnownEnvironment: (environmentId: EnvironmentId) => boolean,
48
-): { readonly environmentId: EnvironmentId; readonly threadId: ThreadId } | null {
56
+ ownConnection: (environmentId: EnvironmentId) => { readonly connected: boolean } | undefined,
57
+ /** Whether `environmentId` still holds a link to the given environment. */
58
+ isLinked: (environmentId: EnvironmentId) => boolean,
59
+): SubagentThreadTarget | null {
60
if (subagent.childThreadId !== null) {
61
return { environmentId, threadId: subagent.childThreadId };
62
}
63
const remote = subagent.remoteChild;
53
- return remote !== undefined && isKnownEnvironment(remote.environmentId)
54
- ? { environmentId: remote.environmentId, threadId: remote.threadId }
55
- : null;
64
+ if (remote === undefined) return null;
65
+ const target = { environmentId: remote.environmentId, threadId: remote.threadId };
66
+ const open = resolveLinkedThreadOpen({
67
+ environmentId: remote.environmentId,
68
+ viaEnvironmentId: environmentId,
69
+ own: ownConnection(remote.environmentId),
70
+ linked: isLinked(remote.environmentId),
71
+ });
72
+ return open === "direct"
73
+ ? target
74
+ : { ...target, linked: { viaEnvironmentId: environmentId, label: remote.label } };
75
}
76
77
function rowTitle(
apps/mobile/src/features/threads/useOpenThreadLink.ts
new
+45
@@ -0,0 +1,45 @@
1
+import { StackActions, useNavigation } from "@react-navigation/native";
2
+import { resolveLinkedThreadOpen } from "@t3tools/client-runtime/linked-thread";
3
+import type { EnvironmentId, ScopedThreadRef } from "@t3tools/contracts";
4
+
5
+import { useEnvironments } from "../../state/environments";
6
+import { useLinkedEnvironments } from "../../state/peerLinks";
7
+import { linkedThreadRouteParams } from "./LinkedThreadSheet";
8
+import { useOpenLinkedThread } from "./useOpenLinkedThread";
9
+
10
+/**
11
+ * Opens a thread that a link or chip in `viaEnvironmentId` points at: in place when this app is
12
+ * connected to its environment, else read-only through `viaEnvironmentId`'s link to it.
13
+ */
14
+export function useOpenThreadLink(viaEnvironmentId: EnvironmentId | null) {
15
+ const navigation = useNavigation();
16
+ const openThread = useOpenLinkedThread();
17
+ const linkedEnvironments = useLinkedEnvironments(viaEnvironmentId);
18
+ const { presentationById } = useEnvironments();
19
+ return (thread: ScopedThreadRef, title: string | null = null) => {
20
+ const label = linkedEnvironments.get(thread.environmentId);
21
+ const own = presentationById.get(thread.environmentId);
22
+ if (
23
+ viaEnvironmentId !== null &&
24
+ label !== undefined &&
25
+ resolveLinkedThreadOpen({
26
+ environmentId: thread.environmentId,
27
+ viaEnvironmentId,
28
+ own: own && { connected: own.connection.phase === "connected" },
29
+ linked: true,
30
+ }) === "linked"
31
+ ) {
32
+ navigation.dispatch(
33
+ StackActions.push(
34
+ "LinkedThread",
35
+ linkedThreadRouteParams(thread, { viaEnvironmentId, label }, title),
36
+ ),
37
+ );
38
+ return;
39
+ }
40
+ openThread({
41
+ environmentId: String(thread.environmentId),
42
+ threadId: String(thread.threadId),
43
+ });
44
+ };
45
+}
apps/mobile/src/i18n/translations/de.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Verknüpfen fehlgeschlagen: {failure}",
95
"acd01e781e2355cc": "Anfrage beendet",
96
"97e4c50a99272f63": "Die Anfrage konnte nicht beantwortet werden. Versuche es erneut.",
97
+ "605a491783d18b3f": "Dieser Thread konnte nicht über {via} gelesen werden",
98
+ "50f19209548b70d9": "{via} braucht möglicherweise ein Update, bevor es verknüpfte Threads lesen kann.",
99
+ "3d624e57d675358c": "Verknüpfte Umgebungen ist auf {via} deaktiviert",
100
+ "01b2231effdb835f": "Aktiviere es in den Einstellungen → Labs von {via}, um Threads auf den damit verknüpften Rechnern zu lesen.",
101
+ "e767e8901a0a3f35": "{via} ist nicht mehr mit {label} verknüpft",
102
+ "df3cd6ccd77084b4": "Verknüpfe es erneut in den Einstellungen → Verbindungen von {via}, um seine Threads von hier aus zu lesen.",
103
+ "3920637506407ca0": "Die Verknüpfung von {via} zu {label} ist abgelaufen",
104
+ "80fec3c2b4fba678": "Verknüpfe es erneut in den Einstellungen → Verbindungen von {via} mit einem neuen Kopplungscode.",
105
+ "fec50d228dc9aa9b": "{label} hat das Lesen abgelehnt",
106
+ "cd63d78559603b12": "Dieser Thread ist nicht mehr auf {label}",
107
+ "bd29efc163476e72": "Möglicherweise wurde er dort gelöscht.",
108
+ "f7870ef3a4828ab1": "{label} braucht ein Update",
109
+ "eabbf064657519ee": "{label} antwortet {via} nicht",
110
"f71597ae3afaef44": "{first} und {second}",
111
"4047174839a16714": "{first} und {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -1564,6 +1577,7 @@
1577
"698777de597615cd": "Diese Verbindung kann keine Anhänge ändern.",
1578
"cfb0490470fb3ed4": "Entferne Anhänge aus dem Eingabefeld, bevor du diese Nachricht bearbeitest.",
1579
"c62461e347b50dcf": "Thread",
1580
+ "1944f04b75ddf26d": "Thread auf {label}",
1581
"d3cab753cd4b6a6c": "Bild konnte nicht gespeichert werden",
1582
"854ac9752dd178d6": "Vollständigen Pfad kopieren",
1583
"f37e7d36b51c5b28": "Relativen Pfad kopieren",
@@ -4138,6 +4152,14 @@
4152
"e808278a5130dd89": "{term, select, mr {MR kann nicht geöffnet werden} cr {Änderungsanfrage kann nicht geöffnet werden} other {PR kann nicht geöffnet werden}}",
4153
"74cadda2c53aaff6": "{term, select, mr {Der Merge Request konnte nicht geöffnet werden.} cr {Die Änderungsanfrage konnte nicht geöffnet werden.} other {Der Pull Request konnte nicht geöffnet werden.}}",
4154
"50fdb607048e425a": "Warte auf Status des Hosts",
4155
+ "acd9ced01d5bcfb5": "Angezeigt wird, was zuvor gelesen wurde.",
4156
+ "6bb5b1b35b2796ae": "Auf {label} über {via} · Arbeitet",
4157
+ "a73b7ab25d6e9bdf": "Auf {label} über {via}",
4158
+ "009e2ca841fdc1ef": "diese Umgebung",
4159
+ "596842e9e887232b": "Wird von {label} gelesen …",
4160
+ "ff889c17671b40af": "Frühere laden",
4161
+ "0014ce0aaf1bd68a": "Schreibgeschützt",
4162
+ "048b8a737af895ac": "Noch nichts in diesem Thread.",
4163
"1410155e503a917f": "{denial} Wechsle den Modus dieses Threads, um fortzufahren.",
4164
"81ceeceeb521bba6": "Zu {mode} wechseln",
4165
"6ebd73c7bfb58bb7": "App",
@@ -4362,8 +4384,8 @@
4384
"1bd7c7bf63bc77ca": "{label} stoppen?",
4385
"b942430dce2fe881": "Stoppen",
4386
"318f262e7c81966a": "Vom Anbieter verwalteter Agent. Seine Arbeit erscheint im Transkript.",
4365
- "3cdda4bfc05d6bf5": "Läuft auf {label}. Verbinde dich damit, um seinen Thread zu öffnen.",
4387
"8f4c65f679c5c2ae": "Öffnet den Thread dieses Agenten",
4388
+ "bf1748c788d31e19": "Öffnet eine schreibgeschützte Ansicht des Threads dieses Agenten auf {label}",
4389
"4c0433f2ec281a32": "Keine Agenten in dieser Runde.",
4390
"5ac48d6092dee115": "Angeheftet",
4391
"df36626cdb914078": "Aktiv",
@@ -4778,7 +4800,6 @@
4800
"1eed3d794eed6b65": "Vollzugriff",
4801
"7f284f51644bb125": "Befehle und Änderungen ohne Nachfrage erlauben.",
4802
"3bb848279618550f": "{label}, {summary}",
4781
- "0752b8ccc7dfba04": "Läuft auf {label}",
4803
"24ad2c33449a1abf": "Vom Anbieter verwalteter Agent",
4804
"6dd1f458bcd6a2ea": "Wird neu erzeugt…",
4805
"de30fdae5b3fea98": "Titel neu erzeugen",
apps/mobile/src/i18n/translations/en.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Could not link: {failure}",
95
"acd01e781e2355cc": "Request ended",
96
"97e4c50a99272f63": "Could not answer the request. Try again.",
97
+ "605a491783d18b3f": "Could not read this thread through {via}",
98
+ "50f19209548b70d9": "{via} may need an update before it can read linked threads.",
99
+ "3d624e57d675358c": "Linked environments is off on {via}",
100
+ "01b2231effdb835f": "Turn it on in {via}'s Settings → Labs to read threads on the machines it links to.",
101
+ "e767e8901a0a3f35": "{via} is no longer linked to {label}",
102
+ "df3cd6ccd77084b4": "Link it again in {via}'s Settings → Connections to read its threads from here.",
103
+ "3920637506407ca0": "The link from {via} to {label} expired",
104
+ "80fec3c2b4fba678": "Link it again in {via}'s Settings → Connections with a new pairing code.",
105
+ "fec50d228dc9aa9b": "{label} refused the read",
106
+ "cd63d78559603b12": "This thread is no longer on {label}",
107
+ "bd29efc163476e72": "It may have been deleted there.",
108
+ "f7870ef3a4828ab1": "{label} needs an update",
109
+ "eabbf064657519ee": "{label} is not answering {via}",
110
"f71597ae3afaef44": "{first} and {second}",
111
"4047174839a16714": "{first}, and {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -1564,6 +1577,7 @@
1577
"698777de597615cd": "This connection cannot change attachments.",
1578
"cfb0490470fb3ed4": "Remove attachments from the composer before editing this message.",
1579
"c62461e347b50dcf": "Thread",
1580
+ "1944f04b75ddf26d": "Thread on {label}",
1581
"d3cab753cd4b6a6c": "Could not save image",
1582
"854ac9752dd178d6": "Copy full path",
1583
"f37e7d36b51c5b28": "Copy relative path",
@@ -4139,6 +4153,14 @@
4153
"e808278a5130dd89": "{term, select, mr {Unable to open MR} cr {Unable to open change request} other {Unable to open PR}}",
4154
"74cadda2c53aaff6": "{term, select, mr {The merge request could not be opened.} cr {The change request could not be opened.} other {The pull request could not be opened.}}",
4155
"50fdb607048e425a": "Waiting for host state",
4156
+ "acd9ced01d5bcfb5": "Showing what was read before.",
4157
+ "6bb5b1b35b2796ae": "On {label} via {via} · Working",
4158
+ "a73b7ab25d6e9bdf": "On {label} via {via}",
4159
+ "009e2ca841fdc1ef": "this environment",
4160
+ "596842e9e887232b": "Reading from {label}…",
4161
+ "ff889c17671b40af": "Load earlier",
4162
+ "0014ce0aaf1bd68a": "Read-only",
4163
+ "048b8a737af895ac": "Nothing in this thread yet.",
4164
"1410155e503a917f": "{denial} Switch this thread's mode to continue.",
4165
"81ceeceeb521bba6": "Switch to {mode}",
4166
"6ebd73c7bfb58bb7": "App",
@@ -4363,8 +4385,8 @@
4385
"1bd7c7bf63bc77ca": "Stop {label}?",
4386
"b942430dce2fe881": "Stop",
4387
"318f262e7c81966a": "Provider-managed agent. Its work appears in the transcript.",
4366
- "3cdda4bfc05d6bf5": "Runs on {label}. Connect to it to open its thread.",
4388
"8f4c65f679c5c2ae": "Opens this agent's thread",
4389
+ "bf1748c788d31e19": "Opens a read-only view of this agent's thread on {label}",
4390
"4c0433f2ec281a32": "No agents in this turn.",
4391
"5ac48d6092dee115": "Pinned",
4392
"df36626cdb914078": "Active",
@@ -4779,7 +4801,6 @@
4801
"1eed3d794eed6b65": "Full access",
4802
"7f284f51644bb125": "Allow commands and edits without prompts.",
4803
"3bb848279618550f": "{label}, {summary}",
4782
- "0752b8ccc7dfba04": "Runs on {label}",
4804
"24ad2c33449a1abf": "Provider-managed agent",
4805
"6dd1f458bcd6a2ea": "Regenerating…",
4806
"de30fdae5b3fea98": "Regenerate title",
apps/mobile/src/i18n/translations/es.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "No se pudo vincular: {failure}",
95
"acd01e781e2355cc": "Solicitud finalizada",
96
"97e4c50a99272f63": "No se pudo responder a la solicitud. Inténtalo de nuevo.",
97
+ "605a491783d18b3f": "No se pudo leer este hilo a través de {via}",
98
+ "50f19209548b70d9": "Puede que {via} necesite actualizarse para poder leer hilos vinculados.",
99
+ "3d624e57d675358c": "Entornos vinculados está desactivado en {via}",
100
+ "01b2231effdb835f": "Actívalo en Ajustes → Labs de {via} para leer hilos de las máquinas que vincula.",
101
+ "e767e8901a0a3f35": "{via} ya no está vinculado a {label}",
102
+ "df3cd6ccd77084b4": "Vuelve a vincularlo en Ajustes → Conexiones de {via} para leer sus hilos desde aquí.",
103
+ "3920637506407ca0": "El vínculo de {via} a {label} ha caducado",
104
+ "80fec3c2b4fba678": "Vuelve a vincularlo en Ajustes → Conexiones de {via} con un código de emparejamiento nuevo.",
105
+ "fec50d228dc9aa9b": "{label} rechazó la lectura",
106
+ "cd63d78559603b12": "Este hilo ya no está en {label}",
107
+ "bd29efc163476e72": "Puede que se haya eliminado allí.",
108
+ "f7870ef3a4828ab1": "{label} necesita una actualización",
109
+ "eabbf064657519ee": "{label} no responde a {via}",
110
"f71597ae3afaef44": "{first} y {second}",
111
"4047174839a16714": "{first} y {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -1564,6 +1577,7 @@
1577
"698777de597615cd": "Esta conexión no puede cambiar los adjuntos.",
1578
"cfb0490470fb3ed4": "Quita los adjuntos del cuadro de mensaje antes de editar este mensaje.",
1579
"c62461e347b50dcf": "Hilo",
1580
+ "1944f04b75ddf26d": "Hilo en {label}",
1581
"d3cab753cd4b6a6c": "No se pudo guardar la imagen",
1582
"854ac9752dd178d6": "Copiar ruta completa",
1583
"f37e7d36b51c5b28": "Copiar ruta relativa",
@@ -4133,6 +4147,14 @@
4147
"e808278a5130dd89": "{term, select, mr {No se puede abrir la MR} cr {No se puede abrir la solicitud de cambios} other {No se puede abrir la PR}}",
4148
"74cadda2c53aaff6": "{term, select, mr {No se pudo abrir la merge request.} cr {No se pudo abrir la solicitud de cambios.} other {No se pudo abrir la pull request.}}",
4149
"50fdb607048e425a": "Esperando el estado del host",
4150
+ "acd9ced01d5bcfb5": "Se muestra lo que se leyó antes.",
4151
+ "6bb5b1b35b2796ae": "En {label} a través de {via} · Trabajando",
4152
+ "a73b7ab25d6e9bdf": "En {label} a través de {via}",
4153
+ "009e2ca841fdc1ef": "este entorno",
4154
+ "596842e9e887232b": "Leyendo desde {label}…",
4155
+ "ff889c17671b40af": "Cargar anteriores",
4156
+ "0014ce0aaf1bd68a": "Solo lectura",
4157
+ "048b8a737af895ac": "Aún no hay nada en este hilo.",
4158
"1410155e503a917f": "{denial} Cambia el modo de este hilo para continuar.",
4159
"81ceeceeb521bba6": "Cambiar a {mode}",
4160
"6ebd73c7bfb58bb7": "App",
@@ -4355,8 +4377,8 @@
4377
"1bd7c7bf63bc77ca": "¿Detener {label}?",
4378
"b942430dce2fe881": "Detener",
4379
"318f262e7c81966a": "Agente gestionado por el proveedor. Su trabajo aparece en la transcripción.",
4358
- "3cdda4bfc05d6bf5": "Se ejecuta en {label}. Conéctate a él para abrir su hilo.",
4380
"8f4c65f679c5c2ae": "Abre el hilo de este agente",
4381
+ "bf1748c788d31e19": "Abre una vista de solo lectura del hilo de este agente en {label}",
4382
"4c0433f2ec281a32": "No hay agentes en este turno.",
4383
"5ac48d6092dee115": "Fijados",
4384
"df36626cdb914078": "Activos",
@@ -4771,7 +4793,6 @@
4793
"1eed3d794eed6b65": "Acceso completo",
4794
"7f284f51644bb125": "Permite comandos y ediciones sin preguntar.",
4795
"3bb848279618550f": "{label}, {summary}",
4774
- "0752b8ccc7dfba04": "Se ejecuta en {label}",
4796
"24ad2c33449a1abf": "Agente gestionado por el proveedor",
4797
"6dd1f458bcd6a2ea": "Regenerando…",
4798
"de30fdae5b3fea98": "Regenerar título",
apps/mobile/src/i18n/translations/fr.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Association impossible : {failure}",
95
"acd01e781e2355cc": "Demande terminée",
96
"97e4c50a99272f63": "Impossible de répondre à la demande. Réessayez.",
97
+ "605a491783d18b3f": "Impossible de lire ce fil via {via}",
98
+ "50f19209548b70d9": "{via} a peut-être besoin d’une mise à jour pour lire les fils associés.",
99
+ "3d624e57d675358c": "Les environnements associés sont désactivés sur {via}",
100
+ "01b2231effdb835f": "Activez-les dans Paramètres → Labs de {via} pour lire les fils des machines qui lui sont associées.",
101
+ "e767e8901a0a3f35": "{via} n’est plus associé à {label}",
102
+ "df3cd6ccd77084b4": "Associez-le à nouveau dans Paramètres → Connexions de {via} pour lire ses fils d’ici.",
103
+ "3920637506407ca0": "L’association de {via} à {label} a expiré",
104
+ "80fec3c2b4fba678": "Associez-le à nouveau dans Paramètres → Connexions de {via} avec un nouveau code d’appairage.",
105
+ "fec50d228dc9aa9b": "{label} a refusé la lecture",
106
+ "cd63d78559603b12": "Ce fil n’est plus sur {label}",
107
+ "bd29efc163476e72": "Il a peut-être été supprimé là-bas.",
108
+ "f7870ef3a4828ab1": "{label} a besoin d’une mise à jour",
109
+ "eabbf064657519ee": "{label} ne répond pas à {via}",
110
"f71597ae3afaef44": "{first} et {second}",
111
"4047174839a16714": "{first} et {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -1564,6 +1577,7 @@
1577
"698777de597615cd": "Cette connexion ne peut pas modifier les pièces jointes.",
1578
"cfb0490470fb3ed4": "Retirez les pièces jointes de la zone de saisie avant de modifier ce message.",
1579
"c62461e347b50dcf": "Fil",
1580
+ "1944f04b75ddf26d": "Fil sur {label}",
1581
"d3cab753cd4b6a6c": "Impossible d’enregistrer l’image",
1582
"854ac9752dd178d6": "Copier le chemin complet",
1583
"f37e7d36b51c5b28": "Copier le chemin relatif",
@@ -4133,6 +4147,14 @@
4147
"e808278a5130dd89": "{term, select, mr {Impossible d’ouvrir la MR} cr {Impossible d’ouvrir la demande de modification} other {Impossible d’ouvrir la PR}}",
4148
"74cadda2c53aaff6": "{term, select, mr {La merge request n’a pas pu être ouverte.} cr {La demande de modification n’a pas pu être ouverte.} other {La pull request n’a pas pu être ouverte.}}",
4149
"50fdb607048e425a": "En attente de l’état de l’hôte",
4150
+ "acd9ced01d5bcfb5": "Affichage de ce qui a été lu auparavant.",
4151
+ "6bb5b1b35b2796ae": "Sur {label} via {via} · En cours",
4152
+ "a73b7ab25d6e9bdf": "Sur {label} via {via}",
4153
+ "009e2ca841fdc1ef": "cet environnement",
4154
+ "596842e9e887232b": "Lecture depuis {label}…",
4155
+ "ff889c17671b40af": "Charger les précédents",
4156
+ "0014ce0aaf1bd68a": "Lecture seule",
4157
+ "048b8a737af895ac": "Rien dans ce fil pour l’instant.",
4158
"1410155e503a917f": "{denial} Changez le mode de ce fil pour continuer.",
4159
"81ceeceeb521bba6": "Passer en {mode}",
4160
"6ebd73c7bfb58bb7": "App",
@@ -4356,8 +4378,8 @@
4378
"1bd7c7bf63bc77ca": "Arrêter {label} ?",
4379
"b942430dce2fe881": "Arrêter",
4380
"318f262e7c81966a": "Agent géré par le fournisseur. Son travail apparaît dans la transcription.",
4359
- "3cdda4bfc05d6bf5": "S’exécute sur {label}. Connectez-vous-y pour ouvrir son fil.",
4381
"8f4c65f679c5c2ae": "Ouvre le fil de cet agent",
4382
+ "bf1748c788d31e19": "Ouvre une vue en lecture seule du fil de cet agent sur {label}",
4383
"4c0433f2ec281a32": "Aucun agent dans ce tour.",
4384
"5ac48d6092dee115": "Épinglés",
4385
"df36626cdb914078": "Actifs",
@@ -4772,7 +4794,6 @@
4794
"1eed3d794eed6b65": "Accès complet",
4795
"7f284f51644bb125": "Autoriser les commandes et les modifications sans demander.",
4796
"3bb848279618550f": "{label}, {summary}",
4775
- "0752b8ccc7dfba04": "S’exécute sur {label}",
4797
"24ad2c33449a1abf": "Agent géré par le fournisseur",
4798
"6dd1f458bcd6a2ea": "Régénération…",
4799
"de30fdae5b3fea98": "Régénérer le titre",
apps/mobile/src/i18n/translations/ja.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "リンクできませんでした: {failure}",
95
"acd01e781e2355cc": "リクエストが終了しました",
96
"97e4c50a99272f63": "リクエストに応答できませんでした。もう一度お試しください。",
97
+ "605a491783d18b3f": "{via} 経由でこのスレッドを読み取れませんでした",
98
+ "50f19209548b70d9": "リンクされたスレッドを読み取るには、{via} の更新が必要な可能性があります。",
99
+ "3d624e57d675358c": "{via} でリンクされた環境がオフになっています",
100
+ "01b2231effdb835f": "{via} の設定 → Labs でオンにすると、リンク先のマシンのスレッドを読み取れます。",
101
+ "e767e8901a0a3f35": "{via} は {label} にリンクされていません",
102
+ "df3cd6ccd77084b4": "ここからスレッドを読み取るには、{via} の設定 → 接続で再度リンクしてください。",
103
+ "3920637506407ca0": "{via} から {label} へのリンクは期限切れです",
104
+ "80fec3c2b4fba678": "{via} の設定 → 接続で、新しいペアリングコードを使って再度リンクしてください。",
105
+ "fec50d228dc9aa9b": "{label} が読み取りを拒否しました",
106
+ "cd63d78559603b12": "このスレッドはもう {label} にありません",
107
+ "bd29efc163476e72": "そちらで削除された可能性があります。",
108
+ "f7870ef3a4828ab1": "{label} の更新が必要です",
109
+ "eabbf064657519ee": "{label} が {via} に応答していません",
110
"f71597ae3afaef44": "{first} と {second}",
111
"4047174839a16714": "{first}、{last}",
112
"65ca7867c176afbf": "{first}、{rest}",
@@ -1564,6 +1577,7 @@
1577
"698777de597615cd": "この接続では添付ファイルを変更できません。",
1578
"cfb0490470fb3ed4": "このメッセージを編集する前に、入力欄から添付ファイルを削除してください。",
1579
"c62461e347b50dcf": "スレッド",
1580
+ "1944f04b75ddf26d": "{label} のスレッド",
1581
"d3cab753cd4b6a6c": "画像を保存できませんでした",
1582
"854ac9752dd178d6": "フルパスをコピー",
1583
"f37e7d36b51c5b28": "相対パスをコピー",
@@ -4129,6 +4143,14 @@
4143
"e808278a5130dd89": "{term, select, mr {MR を開けません} cr {変更リクエストを開けません} other {PR を開けません}}",
4144
"74cadda2c53aaff6": "{term, select, mr {マージリクエストを開けませんでした。} cr {変更リクエストを開けませんでした。} other {プルリクエストを開けませんでした。}}",
4145
"50fdb607048e425a": "ホストの状態を待っています",
4146
+ "acd9ced01d5bcfb5": "以前に読み取った内容を表示しています。",
4147
+ "6bb5b1b35b2796ae": "{label}({via} 経由) · 作業中",
4148
+ "a73b7ab25d6e9bdf": "{label}({via} 経由)",
4149
+ "009e2ca841fdc1ef": "この環境",
4150
+ "596842e9e887232b": "{label} から読み取り中…",
4151
+ "ff889c17671b40af": "以前のものを読み込む",
4152
+ "0014ce0aaf1bd68a": "読み取り専用",
4153
+ "048b8a737af895ac": "このスレッドにはまだ何もありません。",
4154
"1410155e503a917f": "{denial} 続行するには、このスレッドのモードを切り替えてください。",
4155
"81ceeceeb521bba6": "{mode} に切り替え",
4156
"6ebd73c7bfb58bb7": "アプリ",
@@ -4337,8 +4359,8 @@
4359
"1bd7c7bf63bc77ca": "{label} を停止しますか?",
4360
"b942430dce2fe881": "停止",
4361
"318f262e7c81966a": "プロバイダーが管理するエージェントです。作業内容はトランスクリプトに表示されます。",
4340
- "3cdda4bfc05d6bf5": "{label} で実行中です。スレッドを開くには接続してください。",
4362
"8f4c65f679c5c2ae": "このエージェントのスレッドを開きます",
4363
+ "bf1748c788d31e19": "このエージェントの {label} 上のスレッドを読み取り専用で開きます",
4364
"4c0433f2ec281a32": "このターンにエージェントはいません。",
4365
"5ac48d6092dee115": "ピン留め済み",
4366
"df36626cdb914078": "アクティブ",
@@ -4753,7 +4775,6 @@
4775
"1eed3d794eed6b65": "フルアクセス",
4776
"7f284f51644bb125": "確認なしでコマンドと編集を許可します。",
4777
"3bb848279618550f": "{label}、{summary}",
4756
- "0752b8ccc7dfba04": "{label} で実行",
4778
"24ad2c33449a1abf": "プロバイダーが管理するエージェント",
4779
"6dd1f458bcd6a2ea": "再生成しています…",
4780
"de30fdae5b3fea98": "タイトルを再生成",
apps/mobile/src/i18n/translations/ko.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "연결할 수 없음: {failure}",
95
"acd01e781e2355cc": "요청 종료됨",
96
"97e4c50a99272f63": "요청에 응답할 수 없습니다. 다시 시도하세요.",
97
+ "605a491783d18b3f": "{via}을(를) 통해 이 스레드를 읽지 못했습니다",
98
+ "50f19209548b70d9": "연결된 스레드를 읽으려면 {via}을(를) 업데이트해야 할 수 있습니다.",
99
+ "3d624e57d675358c": "{via}에서 연결된 환경이 꺼져 있습니다",
100
+ "01b2231effdb835f": "{via}의 설정 → Labs에서 켜면 연결된 기기의 스레드를 읽을 수 있습니다.",
101
+ "e767e8901a0a3f35": "{via}이(가) 더 이상 {label}에 연결되어 있지 않습니다",
102
+ "df3cd6ccd77084b4": "여기에서 스레드를 읽으려면 {via}의 설정 → 연결에서 다시 연결하세요.",
103
+ "3920637506407ca0": "{via}에서 {label}(으)로의 연결이 만료되었습니다",
104
+ "80fec3c2b4fba678": "{via}의 설정 → 연결에서 새 페어링 코드로 다시 연결하세요.",
105
+ "fec50d228dc9aa9b": "{label}이(가) 읽기를 거부했습니다",
106
+ "cd63d78559603b12": "이 스레드는 더 이상 {label}에 없습니다",
107
+ "bd29efc163476e72": "그곳에서 삭제되었을 수 있습니다.",
108
+ "f7870ef3a4828ab1": "{label}을(를) 업데이트해야 합니다",
109
+ "eabbf064657519ee": "{label}이(가) {via}에 응답하지 않습니다",
110
"f71597ae3afaef44": "{first} 및 {second}",
111
"4047174839a16714": "{first} 및 {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -1564,6 +1577,7 @@
1577
"698777de597615cd": "이 연결로는 첨부 파일을 변경할 수 없습니다.",
1578
"cfb0490470fb3ed4": "이 메시지를 편집하기 전에 입력창에서 첨부 파일을 제거하세요.",
1579
"c62461e347b50dcf": "스레드",
1580
+ "1944f04b75ddf26d": "{label}의 스레드",
1581
"d3cab753cd4b6a6c": "이미지를 저장할 수 없습니다",
1582
"854ac9752dd178d6": "전체 경로 복사",
1583
"f37e7d36b51c5b28": "상대 경로 복사",
@@ -4133,6 +4147,14 @@
4147
"e808278a5130dd89": "{term, select, mr {MR을 열 수 없음} cr {변경 요청을 열 수 없음} other {PR을 열 수 없음}}",
4148
"74cadda2c53aaff6": "{term, select, mr {병합 요청을 열 수 없습니다.} cr {변경 요청을 열 수 없습니다.} other {풀 리퀘스트를 열 수 없습니다.}}",
4149
"50fdb607048e425a": "호스트 상태 대기 중",
4150
+ "acd9ced01d5bcfb5": "이전에 읽은 내용을 표시하고 있습니다.",
4151
+ "6bb5b1b35b2796ae": "{label} ({via} 경유) · 작업 중",
4152
+ "a73b7ab25d6e9bdf": "{label} ({via} 경유)",
4153
+ "009e2ca841fdc1ef": "이 환경",
4154
+ "596842e9e887232b": "{label}에서 읽는 중…",
4155
+ "ff889c17671b40af": "이전 항목 불러오기",
4156
+ "0014ce0aaf1bd68a": "읽기 전용",
4157
+ "048b8a737af895ac": "이 스레드에는 아직 아무것도 없습니다.",
4158
"1410155e503a917f": "{denial} 계속하려면 이 스레드의 모드를 전환하세요.",
4159
"81ceeceeb521bba6": "{mode}(으)로 전환",
4160
"6ebd73c7bfb58bb7": "앱",
@@ -4342,8 +4364,8 @@
4364
"1bd7c7bf63bc77ca": "{label}을(를) 중지할까요?",
4365
"b942430dce2fe881": "중지",
4366
"318f262e7c81966a": "제공자가 관리하는 에이전트입니다. 작업 내용은 대화 기록에 표시됩니다.",
4345
- "3cdda4bfc05d6bf5": "{label}에서 실행됩니다. 스레드를 열려면 연결하세요.",
4367
"8f4c65f679c5c2ae": "이 에이전트의 스레드를 엽니다",
4368
+ "bf1748c788d31e19": "{label}에 있는 이 에이전트 스레드의 읽기 전용 보기를 엽니다",
4369
"4c0433f2ec281a32": "이 턴에 에이전트가 없습니다.",
4370
"5ac48d6092dee115": "고정됨",
4371
"df36626cdb914078": "활성",
@@ -4758,7 +4780,6 @@
4780
"1eed3d794eed6b65": "전체 액세스",
4781
"7f284f51644bb125": "확인 없이 명령과 편집을 허용합니다.",
4782
"3bb848279618550f": "{label}, {summary}",
4761
- "0752b8ccc7dfba04": "{label}에서 실행",
4783
"24ad2c33449a1abf": "제공자가 관리하는 에이전트",
4784
"6dd1f458bcd6a2ea": "다시 생성하는 중…",
4785
"de30fdae5b3fea98": "제목 다시 생성",
apps/mobile/src/i18n/translations/pt-BR.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Não foi possível vincular: {failure}",
95
"acd01e781e2355cc": "Solicitação encerrada",
96
"97e4c50a99272f63": "Não foi possível responder à solicitação. Tente novamente.",
97
+ "605a491783d18b3f": "Não foi possível ler esta thread por {via}",
98
+ "50f19209548b70d9": "Talvez {via} precise de uma atualização para ler threads vinculadas.",
99
+ "3d624e57d675358c": "Ambientes vinculados está desativado em {via}",
100
+ "01b2231effdb835f": "Ative em Configurações → Labs de {via} para ler threads das máquinas vinculadas a ele.",
101
+ "e767e8901a0a3f35": "{via} não está mais vinculado a {label}",
102
+ "df3cd6ccd77084b4": "Vincule novamente em Configurações → Conexões de {via} para ler as threads dele daqui.",
103
+ "3920637506407ca0": "O vínculo de {via} com {label} expirou",
104
+ "80fec3c2b4fba678": "Vincule novamente em Configurações → Conexões de {via} com um novo código de pareamento.",
105
+ "fec50d228dc9aa9b": "{label} recusou a leitura",
106
+ "cd63d78559603b12": "Esta thread não está mais em {label}",
107
+ "bd29efc163476e72": "Talvez tenha sido excluída lá.",
108
+ "f7870ef3a4828ab1": "{label} precisa de uma atualização",
109
+ "eabbf064657519ee": "{label} não está respondendo a {via}",
110
"f71597ae3afaef44": "{first} e {second}",
111
"4047174839a16714": "{first} e {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -1564,6 +1577,7 @@
1577
"698777de597615cd": "Esta conexão não pode alterar anexos.",
1578
"cfb0490470fb3ed4": "Remova os anexos do editor de mensagens antes de editar esta mensagem.",
1579
"c62461e347b50dcf": "Thread",
1580
+ "1944f04b75ddf26d": "Thread em {label}",
1581
"d3cab753cd4b6a6c": "Não foi possível salvar a imagem",
1582
"854ac9752dd178d6": "Copiar caminho completo",
1583
"f37e7d36b51c5b28": "Copiar caminho relativo",
@@ -4133,6 +4147,14 @@
4147
"e808278a5130dd89": "{term, select, mr {Não foi possível abrir o MR} cr {Não foi possível abrir a solicitação de alteração} other {Não foi possível abrir o PR}}",
4148
"74cadda2c53aaff6": "{term, select, mr {Não foi possível abrir o merge request.} cr {Não foi possível abrir a solicitação de alteração.} other {Não foi possível abrir o pull request.}}",
4149
"50fdb607048e425a": "Aguardando o estado do host",
4150
+ "acd9ced01d5bcfb5": "Mostrando o que foi lido antes.",
4151
+ "6bb5b1b35b2796ae": "Em {label} via {via} · Trabalhando",
4152
+ "a73b7ab25d6e9bdf": "Em {label} via {via}",
4153
+ "009e2ca841fdc1ef": "este ambiente",
4154
+ "596842e9e887232b": "Lendo de {label}…",
4155
+ "ff889c17671b40af": "Carregar anteriores",
4156
+ "0014ce0aaf1bd68a": "Somente leitura",
4157
+ "048b8a737af895ac": "Ainda não há nada nesta thread.",
4158
"1410155e503a917f": "{denial} Mude o modo desta thread para continuar.",
4159
"81ceeceeb521bba6": "Mudar para {mode}",
4160
"6ebd73c7bfb58bb7": "App",
@@ -4356,8 +4378,8 @@
4378
"1bd7c7bf63bc77ca": "Parar {label}?",
4379
"b942430dce2fe881": "Parar",
4380
"318f262e7c81966a": "Agente gerenciado pelo provedor. O trabalho dele aparece na transcrição.",
4359
- "3cdda4bfc05d6bf5": "Roda em {label}. Conecte-se a ele para abrir a thread.",
4381
"8f4c65f679c5c2ae": "Abre a thread deste agente",
4382
+ "bf1748c788d31e19": "Abre uma visualização somente leitura da thread deste agente em {label}",
4383
"4c0433f2ec281a32": "Nenhum agente neste turno.",
4384
"5ac48d6092dee115": "Fixadas",
4385
"df36626cdb914078": "Ativas",
@@ -4772,7 +4794,6 @@
4794
"1eed3d794eed6b65": "Acesso total",
4795
"7f284f51644bb125": "Permite comandos e edições sem perguntar.",
4796
"3bb848279618550f": "{label}, {summary}",
4775
- "0752b8ccc7dfba04": "Roda em {label}",
4797
"24ad2c33449a1abf": "Agente gerenciado pelo provedor",
4798
"6dd1f458bcd6a2ea": "Gerando novamente…",
4799
"de30fdae5b3fea98": "Gerar título novamente",
apps/mobile/src/i18n/translations/ru.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Не удалось привязать: {failure}",
95
"acd01e781e2355cc": "Запрос завершён",
96
"97e4c50a99272f63": "Не удалось ответить на запрос. Повторите попытку.",
97
+ "605a491783d18b3f": "Не удалось прочитать этот тред через {via}",
98
+ "50f19209548b70d9": "Возможно, {via} нужно обновить, чтобы читать привязанные треды.",
99
+ "3d624e57d675358c": "Привязанные окружения отключены на {via}",
100
+ "01b2231effdb835f": "Включите их в разделе «Настройки → Labs» на {via}, чтобы читать треды на привязанных к нему машинах.",
101
+ "e767e8901a0a3f35": "{via} больше не связан с {label}",
102
+ "df3cd6ccd77084b4": "Свяжите заново в разделе «Настройки → Подключения» на {via}, чтобы читать его треды отсюда.",
103
+ "3920637506407ca0": "Срок связи {via} с {label} истёк",
104
+ "80fec3c2b4fba678": "Свяжите заново в разделе «Настройки → Подключения» на {via} с новым кодом сопряжения.",
105
+ "fec50d228dc9aa9b": "{label} отклонил чтение",
106
+ "cd63d78559603b12": "Этого треда больше нет на {label}",
107
+ "bd29efc163476e72": "Возможно, его там удалили.",
108
+ "f7870ef3a4828ab1": "{label} нужно обновить",
109
+ "eabbf064657519ee": "{label} не отвечает {via}",
110
"f71597ae3afaef44": "{first} и {second}",
111
"4047174839a16714": "{first} и {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -1564,6 +1577,7 @@
1577
"698777de597615cd": "Это подключение не может менять вложения.",
1578
"cfb0490470fb3ed4": "Удалите вложения из поля ввода, прежде чем редактировать это сообщение.",
1579
"c62461e347b50dcf": "Тред",
1580
+ "1944f04b75ddf26d": "Тред на {label}",
1581
"d3cab753cd4b6a6c": "Не удалось сохранить изображение",
1582
"854ac9752dd178d6": "Копировать полный путь",
1583
"f37e7d36b51c5b28": "Копировать относительный путь",
@@ -4187,6 +4201,14 @@
4201
"e808278a5130dd89": "{term, select, mr {Не удалось открыть MR} cr {Не удалось открыть запрос на изменение} other {Не удалось открыть PR}}",
4202
"74cadda2c53aaff6": "{term, select, mr {Не удалось открыть мерж-реквест.} cr {Не удалось открыть запрос на изменение.} other {Не удалось открыть пул-реквест.}}",
4203
"50fdb607048e425a": "Ожидание состояния хоста",
4204
+ "acd9ced01d5bcfb5": "Показано то, что было прочитано раньше.",
4205
+ "6bb5b1b35b2796ae": "На {label} через {via} · Работает",
4206
+ "a73b7ab25d6e9bdf": "На {label} через {via}",
4207
+ "009e2ca841fdc1ef": "это окружение",
4208
+ "596842e9e887232b": "Чтение с {label}…",
4209
+ "ff889c17671b40af": "Загрузить более ранние",
4210
+ "0014ce0aaf1bd68a": "Только чтение",
4211
+ "048b8a737af895ac": "В этом треде пока ничего нет.",
4212
"1410155e503a917f": "{denial} Чтобы продолжить, переключите режим этого треда.",
4213
"81ceeceeb521bba6": "Переключиться на {mode}",
4214
"6ebd73c7bfb58bb7": "Приложение",
@@ -4434,8 +4456,8 @@
4456
"1bd7c7bf63bc77ca": "Остановить {label}?",
4457
"b942430dce2fe881": "Остановить",
4458
"318f262e7c81966a": "Агент под управлением провайдера. Его работа отображается в расшифровке.",
4437
- "3cdda4bfc05d6bf5": "Работает в {label}. Подключитесь к нему, чтобы открыть его тред.",
4459
"8f4c65f679c5c2ae": "Открывает тред этого агента",
4460
+ "bf1748c788d31e19": "Открывает тред этого агента на {label} только для чтения",
4461
"4c0433f2ec281a32": "В этом ходе нет агентов.",
4462
"5ac48d6092dee115": "Закреплённые",
4463
"df36626cdb914078": "Активные",
@@ -4850,7 +4872,6 @@
4872
"1eed3d794eed6b65": "Полный доступ",
4873
"7f284f51644bb125": "Разрешать команды и правки без запросов.",
4874
"3bb848279618550f": "{label}, {summary}",
4853
- "0752b8ccc7dfba04": "Работает в {label}",
4875
"24ad2c33449a1abf": "Агент под управлением провайдера",
4876
"6dd1f458bcd6a2ea": "Генерация…",
4877
"de30fdae5b3fea98": "Сгенерировать название заново",
apps/mobile/src/i18n/translations/sv.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Kunde inte länka: {failure}",
95
"acd01e781e2355cc": "Begäran avslutades",
96
"97e4c50a99272f63": "Kunde inte svara på begäran. Försök igen.",
97
+ "605a491783d18b3f": "Det gick inte att läsa den här tråden via {via}",
98
+ "50f19209548b70d9": "{via} kan behöva uppdateras innan den kan läsa länkade trådar.",
99
+ "3d624e57d675358c": "Länkade miljöer är avstängt på {via}",
100
+ "01b2231effdb835f": "Slå på det i Inställningar → Labs på {via} för att läsa trådar på maskinerna den länkar till.",
101
+ "e767e8901a0a3f35": "{via} är inte längre länkad till {label}",
102
+ "df3cd6ccd77084b4": "Länka den igen i Inställningar → Anslutningar på {via} för att läsa dess trådar härifrån.",
103
+ "3920637506407ca0": "Länken från {via} till {label} har gått ut",
104
+ "80fec3c2b4fba678": "Länka den igen i Inställningar → Anslutningar på {via} med en ny parkopplingskod.",
105
+ "fec50d228dc9aa9b": "{label} nekade läsningen",
106
+ "cd63d78559603b12": "Den här tråden finns inte längre på {label}",
107
+ "bd29efc163476e72": "Den kan ha raderats där.",
108
+ "f7870ef3a4828ab1": "{label} behöver uppdateras",
109
+ "eabbf064657519ee": "{label} svarar inte {via}",
110
"f71597ae3afaef44": "{first} och {second}",
111
"4047174839a16714": "{first} och {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -1564,6 +1577,7 @@
1577
"698777de597615cd": "Den här anslutningen kan inte ändra bilagor.",
1578
"cfb0490470fb3ed4": "Ta bort bilagor från inmatningsfältet innan du redigerar meddelandet.",
1579
"c62461e347b50dcf": "Tråd",
1580
+ "1944f04b75ddf26d": "Tråd på {label}",
1581
"d3cab753cd4b6a6c": "Kunde inte spara bilden",
1582
"854ac9752dd178d6": "Kopiera fullständig sökväg",
1583
"f37e7d36b51c5b28": "Kopiera relativ sökväg",
@@ -4139,6 +4153,14 @@
4153
"e808278a5130dd89": "{term, select, mr {Det gick inte att öppna MR:en} cr {Det gick inte att öppna ändringsbegäran} other {Det gick inte att öppna PR:en}}",
4154
"74cadda2c53aaff6": "{term, select, mr {Merge requesten kunde inte öppnas.} cr {Ändringsbegäran kunde inte öppnas.} other {Pull requesten kunde inte öppnas.}}",
4155
"50fdb607048e425a": "Väntar på värdens status",
4156
+ "acd9ced01d5bcfb5": "Visar det som lästes tidigare.",
4157
+ "6bb5b1b35b2796ae": "På {label} via {via} · Arbetar",
4158
+ "a73b7ab25d6e9bdf": "På {label} via {via}",
4159
+ "009e2ca841fdc1ef": "den här miljön",
4160
+ "596842e9e887232b": "Läser från {label}…",
4161
+ "ff889c17671b40af": "Läs in tidigare",
4162
+ "0014ce0aaf1bd68a": "Skrivskyddad",
4163
+ "048b8a737af895ac": "Inget i den här tråden ännu.",
4164
"1410155e503a917f": "{denial} Byt trådens läge för att fortsätta.",
4165
"81ceeceeb521bba6": "Byt till {mode}",
4166
"6ebd73c7bfb58bb7": "App",
@@ -4362,8 +4384,8 @@
4384
"1bd7c7bf63bc77ca": "Stoppa {label}?",
4385
"b942430dce2fe881": "Stoppa",
4386
"318f262e7c81966a": "Leverantörshanterad agent. Dess arbete visas i transkriptet.",
4365
- "3cdda4bfc05d6bf5": "Körs på {label}. Anslut till den för att öppna dess tråd.",
4387
"8f4c65f679c5c2ae": "Öppnar agentens tråd",
4388
+ "bf1748c788d31e19": "Öppnar en skrivskyddad vy av den här agentens tråd på {label}",
4389
"4c0433f2ec281a32": "Inga agenter i den här omgången.",
4390
"5ac48d6092dee115": "Fästa",
4391
"df36626cdb914078": "Aktiva",
@@ -4778,7 +4800,6 @@
4800
"1eed3d794eed6b65": "Full åtkomst",
4801
"7f284f51644bb125": "Tillåt kommandon och ändringar utan att fråga.",
4802
"3bb848279618550f": "{label}, {summary}",
4781
- "0752b8ccc7dfba04": "Körs på {label}",
4803
"24ad2c33449a1abf": "Leverantörshanterad agent",
4804
"6dd1f458bcd6a2ea": "Genererar om…",
4805
"de30fdae5b3fea98": "Generera om titel",
apps/mobile/src/i18n/translations/zh.json
+23
-2
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "无法关联:{failure}",
95
"acd01e781e2355cc": "请求已结束",
96
"97e4c50a99272f63": "无法回复此请求。请重试。",
97
+ "605a491783d18b3f": "无法通过 {via} 读取此会话",
98
+ "50f19209548b70d9": "{via} 可能需要更新后才能读取关联的会话。",
99
+ "3d624e57d675358c": "{via} 上的关联环境已关闭",
100
+ "01b2231effdb835f": "在 {via} 的设置 → Labs 中开启,即可读取其关联机器上的会话。",
101
+ "e767e8901a0a3f35": "{via} 已不再关联 {label}",
102
+ "df3cd6ccd77084b4": "在 {via} 的设置 → 连接中重新关联,即可从这里读取其会话。",
103
+ "3920637506407ca0": "{via} 到 {label} 的关联已过期",
104
+ "80fec3c2b4fba678": "在 {via} 的设置 → 连接中使用新的配对码重新关联。",
105
+ "fec50d228dc9aa9b": "{label} 拒绝了读取",
106
+ "cd63d78559603b12": "此会话已不在 {label} 上",
107
+ "bd29efc163476e72": "它可能已在那里被删除。",
108
+ "f7870ef3a4828ab1": "{label} 需要更新",
109
+ "eabbf064657519ee": "{label} 没有响应 {via}",
110
"f71597ae3afaef44": "{first} 和 {second}",
111
"4047174839a16714": "{first} 和 {last}",
112
"65ca7867c176afbf": "{first}、{rest}",
@@ -1565,6 +1578,7 @@
1578
"698777de597615cd": "此连接无法更改附件。",
1579
"cfb0490470fb3ed4": "编辑此消息前,请先从输入框中移除附件。",
1580
"c62461e347b50dcf": "会话",
1581
+ "1944f04b75ddf26d": "{label} 上的会话",
1582
"d3cab753cd4b6a6c": "无法保存图片",
1583
"854ac9752dd178d6": "复制完整路径",
1584
"f37e7d36b51c5b28": "复制相对路径",
@@ -4136,6 +4150,14 @@
4150
"e808278a5130dd89": "{term, select, mr {无法打开 MR} cr {无法打开 change request} other {无法打开 PR}}",
4151
"74cadda2c53aaff6": "{term, select, mr {无法打开该 merge request。} cr {无法打开该 change request。} other {无法打开该 pull request。}}",
4152
"50fdb607048e425a": "等待托管平台状态",
4153
+ "acd9ced01d5bcfb5": "正在显示之前读取的内容。",
4154
+ "6bb5b1b35b2796ae": "位于 {label},经由 {via} · 运行中",
4155
+ "a73b7ab25d6e9bdf": "位于 {label},经由 {via}",
4156
+ "009e2ca841fdc1ef": "此环境",
4157
+ "596842e9e887232b": "正在从 {label} 读取…",
4158
+ "ff889c17671b40af": "加载更早的内容",
4159
+ "0014ce0aaf1bd68a": "只读",
4160
+ "048b8a737af895ac": "此会话中还没有内容。",
4161
"1410155e503a917f": "{denial} 切换此会话的模式以继续。",
4162
"81ceeceeb521bba6": "切换到 {mode}",
4163
"6ebd73c7bfb58bb7": "应用",
@@ -4345,8 +4367,8 @@
4367
"1bd7c7bf63bc77ca": "停止 {label}?",
4368
"b942430dce2fe881": "停止",
4369
"318f262e7c81966a": "由提供方管理的智能体。其工作会显示在对话记录中。",
4348
- "3cdda4bfc05d6bf5": "在 {label} 上运行。连接到它以打开其会话。",
4370
"8f4c65f679c5c2ae": "打开此智能体的会话",
4371
+ "bf1748c788d31e19": "以只读方式打开此代理在 {label} 上的会话",
4372
"4c0433f2ec281a32": "此轮次中没有智能体。",
4373
"5ac48d6092dee115": "已置顶",
4374
"df36626cdb914078": "活跃",
@@ -4761,7 +4783,6 @@
4783
"1eed3d794eed6b65": "完全访问",
4784
"7f284f51644bb125": "允许执行命令和编辑,无需确认。",
4785
"3bb848279618550f": "{label},{summary}",
4764
- "0752b8ccc7dfba04": "在 {label} 上运行",
4786
"24ad2c33449a1abf": "由提供方管理的智能体",
4787
"6dd1f458bcd6a2ea": "正在重新生成…",
4788
"de30fdae5b3fea98": "重新生成标题",
apps/mobile/src/lib/filePreview.test.ts
+2
@@ -186,6 +186,8 @@ vi.mock("../state/entities", () => ({
186
useThreadChipIcons: () => new Map(),
187
useEnvironmentPreviewTunnelOff: () => false,
188
}));
189
+vi.mock("../state/peerLinks", () => ({ useLinkedEnvironments: () => new Map() }));
190
+vi.mock("../features/threads/useOpenThreadLink", () => ({ useOpenThreadLink: () => vi.fn() }));
191
vi.mock("../state/use-thread-selection", () => ({
192
useThreadSelection: () => ({ selectedThread: null }),
193
}));
apps/mobile/src/state/entities.ts
+18
-6
@@ -28,7 +28,7 @@ import {
28
import { relabelThreadLinks } from "@t3tools/shared/threadLinksCopy";
29
import * as Schema from "effect/Schema";
30
import { AsyncResult, Atom } from "effect/reactivity";
31
-import { msg, useMessages } from "gt-react-native";
31
+import { msg, useGT, useMessages } from "gt-react-native";
32
33
import { threadChipTargets } from "../lib/enrichedLinkPresentation";
34
import { resolveProjectChipIcon } from "../lib/projectIcon";
@@ -240,8 +240,16 @@ export function useSideChats(ref: ScopedThreadRef) {
240
return useAtomValue(environmentThreadShells.sideChatsAtom(ref));
241
}
242
243
-export function useLiveThreadLinkLabels(markdown: string, environmentId: EnvironmentId): string {
243
+const NO_LINKED_ENVIRONMENTS: ReadonlyMap<EnvironmentId, string> = new Map();
244
+
245
+/** `linked` names the machines `environmentId` links to, whose threads open read-only. */
246
+export function useLiveThreadLinkLabels(
247
+ markdown: string,
248
+ environmentId: EnvironmentId,
249
+ linked = NO_LINKED_ENVIRONMENTS,
250
+): string {
251
const resolve = useMessages();
252
+ const gt = useGT();
253
const titles = useAtomValue(
254
hasThreadLinks(markdown)
255
? threadLinkTitlesAtom(JSON.stringify(threadLinkRefs(markdown, environmentId).map(threadKey)))
@@ -250,11 +258,15 @@ export function useLiveThreadLinkLabels(markdown: string, environmentId: Environ
258
return relabelThreadLinks(
259
markdown,
260
environmentId,
253
- (ref) => {
261
+ (ref, label) => {
262
const title = titles.get(threadKey(ref));
255
- return title === FALLBACK_THREAD_TITLE
256
- ? resolve(msg("Thread", { $context: "fallback title of a linked thread" }))
257
- : title;
263
+ if (typeof title === "string") return title;
264
+ // A thread only the message's environment can reach keeps its written name.
265
+ const machine = linked.get(ref.environmentId);
266
+ if (machine !== undefined) {
267
+ return label?.trim() || gt("Thread on {label}", { label: machine });
268
+ }
269
+ return title && resolve(msg("Thread", { $context: "fallback title of a linked thread" }));
270
},
271
resolve,
272
);
apps/mobile/src/state/linkedThread.ts
new
+53
@@ -0,0 +1,53 @@
1
+import { useAtomValue } from "@effect/atom-react";
2
+import type { LinkedThreadTarget } from "@t3tools/client-runtime/linked-thread";
3
+import type { EnvironmentId, OrchestrationV2Subagent } from "@t3tools/contracts";
4
+
5
+import { useEnvironments } from "./environments";
6
+import { peerLinkEnvironment, useLinkedEnvironments } from "./peerLinks";
7
+import { useEnvironmentQuery } from "./query";
8
+
9
+/**
10
+ * What places a delegated task's thread: this app's own connections, and the links `environmentId`
11
+ * holds. Links are listed only while a task runs somewhere this app is not connected to.
12
+ */
13
+export function useLinkedThreadReach(
14
+ environmentId: EnvironmentId,
15
+ subagents: ReadonlyArray<Pick<OrchestrationV2Subagent, "childThreadId" | "remoteChild">>,
16
+) {
17
+ const { presentationById } = useEnvironments();
18
+ const ownConnection = (id: EnvironmentId) => {
19
+ const own = presentationById.get(id);
20
+ return own && { connected: own.connection.phase === "connected" };
21
+ };
22
+ const links = useLinkedEnvironments(
23
+ subagents.some(
24
+ (subagent) =>
25
+ subagent.childThreadId === null &&
26
+ subagent.remoteChild !== undefined &&
27
+ ownConnection(subagent.remoteChild.environmentId)?.connected !== true,
28
+ )
29
+ ? environmentId
30
+ : null,
31
+ );
32
+ return { ownConnection, isLinked: (id: EnvironmentId) => links.has(id) };
33
+}
34
+
35
+/**
36
+ * The thread of `target`, streamed through the environment that links to it. The stream runs only
37
+ * while `active`; what it last showed stays, so coming back to the screen shows it at once.
38
+ */
39
+export function useLinkedThreadView(target: LinkedThreadTarget, active: boolean) {
40
+ const viewTarget = {
41
+ environmentId: target.viaEnvironmentId,
42
+ input: { environmentId: target.environmentId, threadId: target.threadId },
43
+ };
44
+ const live = useEnvironmentQuery(active ? peerLinkEnvironment.threadView(viewTarget) : null);
45
+ const view = useAtomValue(peerLinkEnvironment.lastThreadView(viewTarget));
46
+ return {
47
+ view,
48
+ /** Why the stream is not running: it ended, or it waits to ask again. */
49
+ error: live.failure ?? view?.error ?? null,
50
+ /** Asks again now. */
51
+ retry: live.refresh,
52
+ };
53
+}
apps/mobile/src/state/peerLinks.ts
+2
-3
@@ -18,8 +18,7 @@ export const peerLinkEnvironment = createPeerLinkEnvironmentAtoms(connectionAtom
18
19
/**
20
* The machines `environmentId` links to, by name, while it offers links, and none otherwise.
21
- * Its agents can read threads there. Listing asks each linked machine whether it answers, so
22
- * every caller shares one briefly cached list.
21
+ * Its agents can read threads there, and so can a client allowed to read threads on it.
22
*/
23
export function useLinkedEnvironments(
24
environmentId: EnvironmentId | null,
@@ -30,7 +29,7 @@ export function useLinkedEnvironments(
29
);
30
const links = useEnvironmentQuery(
31
offered && environmentId !== null
33
- ? peerLinkEnvironment.list({ environmentId, input: {} })
32
+ ? peerLinkEnvironment.names({ environmentId, input: {} })
33
: null,
34
);
35
return useMemo(
apps/server/src/auth/RpcAuthorization.test.ts
+87
@@ -6,12 +6,14 @@ import {
6
AuthSettingsWriteScope,
7
AuthAccessWriteScope,
8
DEFAULT_SERVER_SETTINGS,
9
+ EnvironmentId,
10
ProviderDriverKind,
11
ProviderInstanceId,
12
ProjectId,
13
IssueTrackerKind,
14
SecretProviderId,
15
ThreadId,
16
+ TurnItemId,
17
AuthOrchestrationOperateScope,
18
AuthOrchestrationReadScope,
19
AuthSourceControlWriteScope,
@@ -201,6 +203,91 @@ it.effect("allows issue reads but requires a source-control grant before comment
203
}).pipe(Effect.scoped),
204
);
205
206
+it.effect("reads a linked environment's thread only for a client that may read threads here", () =>
207
+ Effect.gen(function* () {
208
+ const linkedThreadTags = [
209
+ WS_METHODS.peerLinksSubscribeThread,
210
+ WS_METHODS.peerLinksThreadHistoryPage,
211
+ WS_METHODS.peerLinksThreadItem,
212
+ WS_METHODS.peerLinksNames,
213
+ ] as const;
214
+ const group = WsRpcGroup.omit(
215
+ ...[...WsRpcGroup.requests.keys()].filter(
216
+ (
217
+ tag,
218
+ ): tag is Exclude<keyof typeof RPC_REQUIRED_SCOPES, (typeof linkedThreadTags)[number]> =>
219
+ !(linkedThreadTags as ReadonlyArray<string>).includes(tag),
220
+ ),
221
+ );
222
+ const read: string[] = [];
223
+ const input = {
224
+ environmentId: EnvironmentId.make("environment-box"),
225
+ threadId: ThreadId.make("thread:box"),
226
+ };
227
+ const handlers = group.toLayer({
228
+ [WS_METHODS.peerLinksSubscribeThread]: ({ threadId }) =>
229
+ Stream.sync(() => {
230
+ read.push(threadId);
231
+ return { kind: "synchronized" as const };
232
+ }),
233
+ [WS_METHODS.peerLinksThreadHistoryPage]: () => Effect.die("unused"),
234
+ [WS_METHODS.peerLinksThreadItem]: ({ threadId }) =>
235
+ Effect.sync(() => {
236
+ read.push(threadId);
237
+ return { item: null };
238
+ }),
239
+ // A thread link resolves to the linked environment by its name.
240
+ [WS_METHODS.peerLinksNames]: () =>
241
+ Effect.succeed({ links: [{ environmentId: input.environmentId, label: "Box" }] }),
242
+ });
243
+ // Managing links and writing settings here say nothing about reading threads.
244
+ const outsider = yield* RpcTest.makeClient(group).pipe(
245
+ Effect.provide(
246
+ Layer.merge(
247
+ handlers,
248
+ RpcAuthorization.layer([AuthAccessWriteScope, AuthSettingsWriteScope]),
249
+ ),
250
+ ),
251
+ );
252
+ const refused = {
253
+ _tag: "EnvironmentAuthorizationError",
254
+ requiredPermission: AuthOrchestrationReadScope,
255
+ };
256
+ expect(
257
+ yield* outsider[WS_METHODS.peerLinksSubscribeThread](input).pipe(
258
+ Stream.runCollect,
259
+ Effect.flip,
260
+ ),
261
+ ).toMatchObject(refused);
262
+ expect(
263
+ yield* outsider[WS_METHODS.peerLinksThreadItem]({
264
+ ...input,
265
+ itemId: TurnItemId.make("item:1"),
266
+ }).pipe(Effect.flip),
267
+ ).toMatchObject(refused);
268
+ expect(
269
+ yield* outsider[WS_METHODS.peerLinksThreadHistoryPage]({ ...input, cursor: "c" }).pipe(
270
+ Effect.flip,
271
+ ),
272
+ ).toMatchObject(refused);
273
+ expect(read).toEqual([]);
274
+ expect(yield* outsider[WS_METHODS.peerLinksNames]({}).pipe(Effect.flip)).toMatchObject({
275
+ requiredPermission: AuthOrchestrationReadScope,
276
+ });
277
+
278
+ const reader = yield* RpcTest.makeClient(group).pipe(
279
+ Effect.provide(Layer.merge(handlers, RpcAuthorization.layer([AuthOrchestrationReadScope]))),
280
+ );
281
+ expect(
282
+ Array.from(yield* reader[WS_METHODS.peerLinksSubscribeThread](input).pipe(Stream.runCollect)),
283
+ ).toEqual([{ kind: "synchronized" }]);
284
+ expect(read).toEqual([input.threadId]);
285
+ expect((yield* reader[WS_METHODS.peerLinksNames]({})).links).toEqual([
286
+ { environmentId: input.environmentId, label: "Box" },
287
+ ]);
288
+ }).pipe(Effect.scoped),
289
+);
290
+
291
it.effect.each([WS_METHODS.subscribeVcsBranch, WS_METHODS.subscribeVcsStatus] as const)(
292
"enforces read permission on stream %s",
293
(method) =>
apps/server/src/auth/RpcAuthorization.ts
+6
@@ -96,6 +96,12 @@ export const RPC_REQUIRED_SCOPES = {
96
[WS_METHODS.serverGetDatabaseStorage]: AuthOrchestrationReadScope,
97
[WS_METHODS.serverGetSettings]: AuthOrchestrationReadScope,
98
[WS_METHODS.peerLinksList]: AuthAccessReadScope,
99
+ // Names only, so a client that reads threads can open a linked environment's.
100
+ [WS_METHODS.peerLinksNames]: AuthOrchestrationReadScope,
101
+ // A linked environment's thread is read as this one's own are.
102
+ [WS_METHODS.peerLinksSubscribeThread]: AuthOrchestrationReadScope,
103
+ [WS_METHODS.peerLinksThreadHistoryPage]: AuthOrchestrationReadScope,
104
+ [WS_METHODS.peerLinksThreadItem]: AuthOrchestrationReadScope,
105
[WS_METHODS.serverUpdateSettings]: AuthSettingsWriteScope,
106
[WS_METHODS.serverSearchAcpRegistry]: AuthOrchestrationReadScope,
107
[WS_METHODS.serverPrepareAcpRegistryAgent]: AuthProvidersManageScope,
apps/server/src/environment/ServerEnvironment.ts
+1
@@ -297,6 +297,7 @@ export const make = Effect.gen(function* () {
297
peerLinks: true,
298
mcpModeLimitHeader: true,
299
linkFence: true,
300
+ linkThreadStream: true,
301
mcpApprovalCodes: true,
302
peerLinkPairingCodes: true,
303
mcpHostedApproval: true,
apps/server/src/eventStreamResponse.ts
new
+36
@@ -0,0 +1,36 @@
1
+import * as Duration from "effect/Duration";
2
+import * as Effect from "effect/Effect";
3
+import type * as Schema from "effect/Schema";
4
+import * as Stream from "effect/Stream";
5
+import { HttpServerResponse } from "effect/http";
6
+
7
+// Cloudflare closes idle streams after about 100 seconds.
8
+const HEARTBEAT_INTERVAL = Duration.seconds(20);
9
+
10
+/** Server-sent events with a heartbeat, never cached or buffered on the way. */
11
+export const eventStreamResponse = <A>(
12
+ events: Stream.Stream<A>,
13
+ encode: (event: A) => Effect.Effect<string, Schema.SchemaError>,
14
+) => {
15
+ const data = events.pipe(
16
+ Stream.mapEffect((event) =>
17
+ encode(event).pipe(
18
+ Effect.map((json) => [`data: ${json}\n\n`]),
19
+ // The reader misses one update instead of the whole stream.
20
+ Effect.catch(() =>
21
+ Effect.logWarning("Dropped a stream event that failed to encode.").pipe(Effect.as([])),
22
+ ),
23
+ ),
24
+ ),
25
+ Stream.flattenIterable,
26
+ );
27
+ const heartbeat = Stream.tick(HEARTBEAT_INTERVAL).pipe(Stream.map(() => ": ping\n\n"));
28
+ return HttpServerResponse.stream(
29
+ data.pipe(Stream.merge(heartbeat, { haltStrategy: "left" }), Stream.encodeText),
30
+ {
31
+ contentType: "text/event-stream",
32
+ // no-transform keeps the compression middleware from buffering the stream.
33
+ headers: { "cache-control": "no-store, no-transform", "x-accel-buffering": "no" },
34
+ },
35
+ );
36
+};
apps/server/src/guest/http.ts
+1
-33
@@ -24,18 +24,16 @@ import * as Duration from "effect/Duration";
24
import * as Effect from "effect/Effect";
25
import * as Layer from "effect/Layer";
26
import * as Schema from "effect/Schema";
27
-import * as Stream from "effect/Stream";
27
import { HttpRouter, HttpServerRequest, HttpServerResponse, Multipart } from "effect/http";
28
import * as HttpIncomingMessage from "effect/http/HttpIncomingMessage";
29
30
import { htmlRenderFileName } from "@t3tools/shared/htmlRender";
31
32
+import { eventStreamResponse } from "../eventStreamResponse.ts";
33
import { assetFileResponse, downloadContentDisposition } from "../http.ts";
34
import type { GuestUpload } from "./guestAttachments.ts";
35
import { GuestShareAccessError, GuestShareService } from "./GuestShareService.ts";
36
37
-// Cloudflare closes idle streams after about 100 seconds.
38
-const HEARTBEAT_INTERVAL = Duration.seconds(20);
37
const NO_STORE = { "cache-control": "no-store" };
38
// A file never runs as a page on this origin, whatever its bytes.
39
const FILE_HEADERS = {
@@ -94,36 +92,6 @@ const itemParam = Effect.map(HttpServerRequest.HttpServerRequest, (request) =>
92
new URLSearchParams(request.url.split("?", 2)[1] ?? "").get("item"),
93
);
94
97
-/** Server-sent events with a heartbeat, never cached or buffered on the way. */
98
-const eventStreamResponse = <A>(
99
- events: Stream.Stream<A>,
100
- encode: (event: A) => Effect.Effect<string, Schema.SchemaError>,
101
-) => {
102
- const data = events.pipe(
103
- Stream.mapEffect((event) =>
104
- encode(event).pipe(
105
- Effect.map((json) => [`data: ${json}\n\n`]),
106
- // The guest misses one update instead of the whole stream.
107
- Effect.catch(() =>
108
- Effect.logWarning("Dropped a guest stream event that failed to encode.").pipe(
109
- Effect.as([]),
110
- ),
111
- ),
112
- ),
113
- ),
114
- Stream.flattenIterable,
115
- );
116
- const heartbeat = Stream.tick(HEARTBEAT_INTERVAL).pipe(Stream.map(() => ": ping\n\n"));
117
- return HttpServerResponse.stream(
118
- data.pipe(Stream.merge(heartbeat, { haltStrategy: "left" }), Stream.encodeText),
119
- {
120
- contentType: "text/event-stream",
121
- // no-transform keeps the compression middleware from buffering the stream.
122
- headers: { "cache-control": "no-store, no-transform", "x-accel-buffering": "no" },
123
- },
124
- );
125
-};
126
-
95
// Guest JSON bodies are a name or one message; anyone who can reach the tunnel can post them.
96
const JSON_MAX_BODY_BYTES = 64 * 1024;
97
const readJson = Effect.gen(function* () {
apps/server/src/observability/RpcInstrumentation.ts
+4
@@ -66,9 +66,13 @@ const RPC_AGGREGATES = {
66
[WS_METHODS.serverGetDatabaseStorage]: "server",
67
[WS_METHODS.serverReclaimDatabaseSpace]: "server",
68
[WS_METHODS.peerLinksList]: "peerLinks",
69
+ [WS_METHODS.peerLinksNames]: "peerLinks",
70
[WS_METHODS.peerLinksLink]: "peerLinks",
71
[WS_METHODS.peerLinksUnlink]: "peerLinks",
72
[WS_METHODS.peerLinksAnswerRequest]: "peerLinks",
73
+ [WS_METHODS.peerLinksSubscribeThread]: "peerLinks",
74
+ [WS_METHODS.peerLinksThreadHistoryPage]: "peerLinks",
75
+ [WS_METHODS.peerLinksThreadItem]: "peerLinks",
76
[WS_METHODS.serverGetSettings]: "server",
77
[WS_METHODS.serverUpdateSettings]: "server",
78
[WS_METHODS.serverSearchAcpRegistry]: "server",
apps/server/src/peer/PeerLinks.test.ts
+2
@@ -575,6 +575,7 @@ it.effect("reads one stored link without asking the peer", () =>
575
const stored = yield* a.links.get(box.environmentId);
576
expect(Option.map(stored, (link) => link.label)).toEqual(Option.some("Box"));
577
expect(Option.isNone(yield* a.links.get(laptop.environmentId))).toBe(true);
578
+ expect(yield* a.links.names).toEqual([{ environmentId: box.environmentId, label: "Box" }]);
579
expect(yield* Ref.get(b.probes)).toBe(0);
580
581
// An older answer that lands after a newer one never moves the expiry back.
@@ -691,6 +692,7 @@ it.effect("tells the agent to link again once the peer revokes the link or it ex
692
693
yield* TestClock.adjust(Duration.days(31));
694
expect((yield* a.links.list).map((link) => link.status)).toEqual(["expired"]);
695
+ expect(yield* a.links.names).toEqual([]);
696
yield* Ref.set(b.bearers, []);
697
const expired = yield* probe(a).pipe(Effect.flip);
698
expect(expired.code).toBe("capability_denied");
apps/server/src/peer/PeerLinks.testkit.ts
+5
-1
@@ -64,9 +64,11 @@ export const descriptorOf = (
64
* socket. The descriptor can be swapped, as when its address comes to answer
65
* as another environment, and every bearer it receives is recorded.
66
*/
67
-export const servePeer = <E, R>(
67
+export const servePeer = <E, R, E2 = never, R2 = never>(
68
initial: ExecutionEnvironmentDescriptor,
69
tools: Layer.Layer<never, E, R>,
70
+ /** More of its HTTP routes, whose handlers get the same auth and settings. */
71
+ routes: Layer.Layer<never, E2, R2> = Layer.empty,
72
) =>
73
Effect.gen(function* () {
74
const descriptor = yield* Ref.make(initial);
@@ -140,6 +142,7 @@ export const servePeer = <E, R>(
142
),
143
Layer.provide(McpOAuth.layerMcpClientAuthenticator),
144
),
145
+ routes,
146
).pipe(
147
Layer.provide(layerRecordBearers),
148
Layer.provide(layerEnvironment),
@@ -148,6 +151,7 @@ export const servePeer = <E, R>(
151
// Fresh, so the peer never shares a toolkit or MCP server with the
152
// environment that links to it in the same test.
153
yield* HttpRouter.serve(layerRoutes, { disableListenLog: true, disableLogger: true }).pipe(
154
+ Layer.provide(Layer.succeedContext(authContext)),
155
Layer.fresh,
156
Layer.build,
157
);
apps/server/src/peer/PeerLinks.ts
+17
@@ -9,6 +9,7 @@ import {
9
type PeerLink,
10
type PeerLinkCreateInput,
11
PeerLinkError,
12
+ type PeerLinkName,
13
type PeerLinkSummary,
14
} from "@t3tools/contracts";
15
import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient";
@@ -79,6 +80,8 @@ export interface ResolvedPeerLink {
80
/** The first address that answered as this peer. */
81
readonly url: string;
82
readonly token: string;
83
+ /** What the peer said it can do when it answered. */
84
+ readonly capabilities: ExecutionEnvironmentCapabilities;
85
}
86
87
export const LINKED_ENVIRONMENTS_OFF =
@@ -104,6 +107,8 @@ export class PeerLinks extends Context.Service<
107
input: PeerLinkCreateInput,
108
) => Effect.Effect<{ readonly link: PeerLink; readonly alreadyLinked: boolean }, PeerLinkError>;
109
readonly list: Effect.Effect<ReadonlyArray<PeerLinkSummary>, PeerLinkError>;
110
+ /** The unexpired links' names, from what is stored, without asking any peer. */
111
+ readonly names: Effect.Effect<ReadonlyArray<PeerLinkName>, PeerLinkError>;
112
/** The stored link, without asking the peer whether it answers. */
113
readonly get: (
114
environmentId: EnvironmentId,
@@ -637,6 +642,16 @@ const make = Effect.gen(function* () {
642
});
643
});
644
645
+ const names: PeerLinks["Service"]["names"] = Effect.gen(function* () {
646
+ const links = yield* Effect.forEach(yield* readRows, toLink);
647
+ const now = yield* DateTime.now;
648
+ return links.flatMap((link) =>
649
+ DateTime.isGreaterThan(link.expiresAt, now)
650
+ ? [{ environmentId: link.environmentId, label: link.label }]
651
+ : [],
652
+ );
653
+ });
654
+
655
const get: PeerLinks["Service"]["get"] = (environmentId) =>
656
readRow(environmentId).pipe(
657
Effect.flatMap(
@@ -717,6 +732,7 @@ const make = Effect.gen(function* () {
732
link: yield* withLabel(link, peer.label),
733
url,
734
token: new TextDecoder().decode(stored.value),
735
+ capabilities: peer.capabilities,
736
};
737
},
738
);
@@ -750,6 +766,7 @@ const make = Effect.gen(function* () {
766
link,
767
linkUnlessLinked,
768
list,
769
+ names,
770
get,
771
unlink,
772
resolve,
apps/server/src/peer/PeerMcpClient.test.ts
+2
@@ -71,6 +71,7 @@ const probeThrough = Effect.fn(function* (http: HttpClient.HttpClient) {
71
},
72
url: "https://peer.example",
73
token: "fixture",
74
+ capabilities: box.capabilities,
75
}),
76
recordOutcome: () => Effect.void,
77
}),
@@ -357,6 +358,7 @@ it.effect("renews a missing peer session once and reuses its replacement", () =>
358
},
359
url: "https://peer.example",
360
token: "fixture",
361
+ capabilities: box.capabilities,
362
}),
363
recordOutcome: (_, outcome) => Effect.sync(() => outcomes.push(outcome.error)),
364
recordExpiry: (_, expiresAt) =>
apps/server/src/peer/PeerThreadRelay.test.ts
new
+330
@@ -0,0 +1,330 @@
1
+import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
2
+import {
3
+ EnvironmentId,
4
+ EventId,
5
+ type OrchestrationV2StoredEvent,
6
+ OrchestrationV2ThreadStreamItem,
7
+ type PeerLinkThreadReadError,
8
+ PEER_LINK_THREAD_HISTORY_ROUTE,
9
+ PEER_LINK_THREAD_ITEM_ROUTE,
10
+ PEER_LINK_THREAD_STREAM_ROUTE,
11
+ ThreadId,
12
+ TurnItemId,
13
+} from "@t3tools/contracts";
14
+import { expect, it } from "@effect/vitest";
15
+import type * as Cause from "effect/Cause";
16
+import * as Context from "effect/Context";
17
+import * as DateTime from "effect/DateTime";
18
+import * as Deferred from "effect/Deferred";
19
+import * as Duration from "effect/Duration";
20
+import * as Effect from "effect/Effect";
21
+import * as Fiber from "effect/Fiber";
22
+import * as Layer from "effect/Layer";
23
+import * as Queue from "effect/Queue";
24
+import * as Ref from "effect/Ref";
25
+import * as Schema from "effect/Schema";
26
+import * as Stream from "effect/Stream";
27
+import { HttpRouter, HttpServerResponse } from "effect/http";
28
+import * as FetchHttpClient from "effect/http/FetchHttpClient";
29
+import * as HttpClient from "effect/http/HttpClient";
30
+import * as HttpClientRequest from "effect/http/HttpClientRequest";
31
+import { TestClock } from "effect/testing";
32
+
33
+import { idleThreadProjection, liveThreadShell } from "../mcp/McpToolAccess.testkit.ts";
34
+import * as OrchestrationEventStore from "../persistence/OrchestrationEventStore.ts";
35
+import * as ThreadManagement from "../orchestration-v2/ThreadManagementService.ts";
36
+import * as ServerSettings from "../serverSettings.ts";
37
+import * as LinkThreadHttp from "./linkThreadHttp.ts";
38
+import * as PeerLinks from "./PeerLinks.ts";
39
+import { descriptorOf, layerLinkingEnvironment, linkTo, servePeer } from "./PeerLinks.testkit.ts";
40
+import * as PeerThreadRelay from "./PeerThreadRelay.ts";
41
+
42
+const laptop = descriptorOf("environment-laptop", "Laptop");
43
+const box = descriptorOf("environment-box", "Box", { linkThreadStream: true });
44
+const boxThread = ThreadId.make("thread:box");
45
+const boxItem = TurnItemId.make("item:box");
46
+const input = { environmentId: box.environmentId, threadId: boxThread };
47
+
48
+const boxShell = { ...liveThreadShell(boxThread, { activeRunId: null }), title: "On the box" };
49
+const boxProjection = idleThreadProjection(boxShell);
50
+
51
+const archived = (sequence: number): OrchestrationV2StoredEvent => ({
52
+ sequence,
53
+ commandId: null,
54
+ event: {
55
+ id: EventId.make(`event:${sequence}`),
56
+ type: "thread.archived",
57
+ threadId: boxThread,
58
+ occurredAt: DateTime.makeUnsafe(0),
59
+ payload: boxProjection.thread,
60
+ },
61
+});
62
+
63
+/**
64
+ * B, serving one thread to its links: `live` feeds the thread's live events, and `closed`
65
+ * completes when B's stream of them is torn down.
66
+ */
67
+const serveBox = Effect.gen(function* () {
68
+ const live = yield* Queue.unbounded<OrchestrationV2StoredEvent, Cause.Done>();
69
+ const closed = yield* Deferred.make<void>();
70
+ const threads = Layer.mock(ThreadManagement.ThreadManagementService)({
71
+ getThreadShell: (threadId) => Effect.succeed(threadId === boxThread ? boxShell : null),
72
+ ensureLegacyTranscript: () => Effect.void,
73
+ getThreadSnapshotWindow: () =>
74
+ Effect.succeed({ snapshotSequence: 7, projection: boxProjection } as never),
75
+ streamStoredEventsFrom: () =>
76
+ Stream.fromQueue(live).pipe(Stream.ensuring(Deferred.succeed(closed, undefined))),
77
+ getThreadHistoryPage: (_threadId, cursor) =>
78
+ Effect.succeed({ snapshotSequence: 7, items: [], hasMoreHistory: false, nextCursor: cursor }),
79
+ getTurnItem: () => Effect.succeed({ item: null }),
80
+ });
81
+ const peer = yield* servePeer(box, Layer.empty, LinkThreadHttp.layer).pipe(
82
+ Effect.provide(
83
+ Layer.merge(threads, Layer.mock(OrchestrationEventStore.OrchestrationEventStore)({})),
84
+ ),
85
+ );
86
+ return { ...peer, live, closed };
87
+});
88
+
89
+/** A, holding the link and relaying B's threads to its own clients. */
90
+const makeLaptop = Effect.gen(function* () {
91
+ const linking = yield* layerLinkingEnvironment(laptop).pipe(Layer.build);
92
+ const answered = yield* Queue.unbounded<number>();
93
+ const relay = yield* PeerThreadRelay.layer.pipe(
94
+ Layer.provide(Layer.succeedContext(linking)),
95
+ Layer.provide(
96
+ Layer.effect(
97
+ HttpClient.HttpClient,
98
+ Effect.map(
99
+ HttpClient.HttpClient,
100
+ HttpClient.tap((response) => Queue.offer(answered, response.status)),
101
+ ),
102
+ ).pipe(Layer.provide(FetchHttpClient.layer)),
103
+ ),
104
+ Layer.build,
105
+ );
106
+ return {
107
+ links: Context.get(linking, PeerLinks.PeerLinks),
108
+ settings: Context.get(linking, ServerSettings.ServerSettingsService),
109
+ relay: Context.get(relay, PeerThreadRelay.PeerThreadRelay),
110
+ /** The status of each answer the relay got, once its headers arrived. */
111
+ answered,
112
+ };
113
+});
114
+
115
+const encodeStreamItem = Schema.encodeSync(
116
+ Schema.fromJsonString(Schema.toCodecJson(OrchestrationV2ThreadStreamItem)),
117
+);
118
+
119
+it.effect("relays a linked thread's snapshot and live items, and stops when the client does", () =>
120
+ Effect.scoped(
121
+ Effect.gen(function* () {
122
+ const b = yield* serveBox;
123
+ const a = yield* makeLaptop;
124
+ yield* linkTo(a.links, b, "read-only");
125
+
126
+ const received = yield* Queue.unbounded<unknown>();
127
+ const subscription = yield* a.relay.subscribe(input).pipe(
128
+ Stream.runForEach((item) => Queue.offer(received, item)),
129
+ Effect.forkScoped,
130
+ );
131
+ expect(yield* Queue.take(received)).toMatchObject({
132
+ kind: "snapshot",
133
+ snapshotSequence: 7,
134
+ projection: { thread: { id: boxThread, title: "On the box" } },
135
+ });
136
+ yield* Queue.offer(b.live, archived(8));
137
+ expect(yield* Queue.take(received)).toMatchObject({
138
+ kind: "event",
139
+ sequence: 8,
140
+ event: { type: "thread.archived", threadId: boxThread },
141
+ });
142
+
143
+ // The client unsubscribing ends B's stream, not only A's relay of it.
144
+ yield* Fiber.interrupt(subscription);
145
+ yield* Deferred.await(b.closed);
146
+
147
+ expect(yield* a.relay.historyPage({ ...input, cursor: "cursor-1" })).toMatchObject({
148
+ hasMoreHistory: false,
149
+ nextCursor: "cursor-1",
150
+ });
151
+ expect(yield* a.relay.item({ ...input, itemId: boxItem })).toEqual({ item: null });
152
+ }),
153
+ ).pipe(Effect.provide(NodeHttpServer.layerTest)),
154
+);
155
+
156
+it.effect("tells the client when the linked environment closes the stream", () =>
157
+ Effect.scoped(
158
+ Effect.gen(function* () {
159
+ const b = yield* serveBox;
160
+ const a = yield* makeLaptop;
161
+ yield* linkTo(a.links, b);
162
+ const ended = yield* a.relay
163
+ .subscribe(input)
164
+ .pipe(Stream.runDrain, Effect.flip, Effect.forkScoped);
165
+ yield* Queue.end(b.live);
166
+ expect(yield* Fiber.join(ended)).toMatchObject({ reason: "unreachable", label: "Box" });
167
+ }),
168
+ ).pipe(Effect.provide(NodeHttpServer.layerTest)),
169
+);
170
+
171
+it.effect("serves a thread only to a link's own session", () =>
172
+ Effect.scoped(
173
+ Effect.gen(function* () {
174
+ const b = yield* serveBox;
175
+ const a = yield* makeLaptop;
176
+ yield* linkTo(a.links, b);
177
+ const linkBearer = `Bearer ${(yield* a.links.resolve(box.environmentId)).token}`;
178
+ const agent = yield* b.auth.issueMcpClientSession({
179
+ label: "ChatGPT",
180
+ access: "full-access",
181
+ peerLink: false,
182
+ client: { deviceType: "bot" },
183
+ });
184
+ const http = yield* HttpClient.HttpClient;
185
+ const statusOf = (headers: Record<string, string>) =>
186
+ http
187
+ .execute(
188
+ HttpClientRequest.get(
189
+ `${b.url}${PEER_LINK_THREAD_STREAM_ROUTE}?thread=${encodeURIComponent(boxThread)}`,
190
+ ).pipe(HttpClientRequest.setHeaders(headers)),
191
+ )
192
+ .pipe(Effect.map((response) => response.status));
193
+
194
+ expect(yield* statusOf({})).toBe(401);
195
+ // An outside agent's session reads through `/mcp`, never here.
196
+ expect(yield* statusOf({ authorization: `Bearer ${agent.token}` })).toBe(403);
197
+ // A browser page never holds a link's token, so no page's request is served.
198
+ expect(yield* statusOf({ authorization: linkBearer, origin: "https://app.t3.codes" })).toBe(
199
+ 403,
200
+ );
201
+ yield* b.settings.updateSettings({ linkedEnvironmentsEnabled: false });
202
+ expect(yield* statusOf({ authorization: linkBearer })).toBe(403);
203
+ }),
204
+ ).pipe(Effect.provide(Layer.merge(NodeHttpServer.layerTest, FetchHttpClient.layer))),
205
+);
206
+
207
+it.effect("tells a client why a linked environment's thread cannot be read", () =>
208
+ Effect.scoped(
209
+ Effect.gen(function* () {
210
+ const b = yield* serveBox;
211
+ const a = yield* makeLaptop;
212
+ yield* linkTo(a.links, b);
213
+ const session = (yield* b.linkedSessions)[0]!.sessionId;
214
+ const reasonOf = (target: Partial<typeof input> = {}) =>
215
+ a.relay.subscribe({ ...input, ...target }).pipe(
216
+ Stream.runHead,
217
+ Effect.flip,
218
+ Effect.map(({ reason, label }: PeerLinkThreadReadError) => ({ reason, label })),
219
+ );
220
+
221
+ expect(yield* reasonOf({ threadId: ThreadId.make("thread:box-gone") })).toEqual({
222
+ reason: "thread_not_found",
223
+ label: "Box",
224
+ });
225
+
226
+ yield* Ref.set(b.bearers, []);
227
+ expect(
228
+ yield* reasonOf({ environmentId: EnvironmentId.make("environment-elsewhere") }),
229
+ ).toEqual({ reason: "unknown_link", label: null });
230
+ yield* a.settings.updateSettings({ linkedEnvironmentsEnabled: false });
231
+ expect(yield* reasonOf()).toEqual({ reason: "disabled", label: null });
232
+ yield* a.settings.updateSettings({ linkedEnvironmentsEnabled: true });
233
+ // A box from before it served threads to links is never asked for one.
234
+ yield* Ref.set(b.descriptor, descriptorOf("environment-box", "Box"));
235
+ expect(yield* reasonOf()).toEqual({ reason: "incompatible", label: "Box" });
236
+ expect(yield* Ref.get(b.bearers)).toEqual([]);
237
+ yield* Ref.set(b.descriptor, box);
238
+
239
+ yield* b.auth.revokeSession(session);
240
+ expect(yield* reasonOf()).toEqual({ reason: "rejected", label: "Box" });
241
+
242
+ yield* Ref.set(b.bearers, []);
243
+ yield* TestClock.adjust(Duration.days(31));
244
+ expect(yield* reasonOf()).toEqual({ reason: "expired", label: "Box" });
245
+ expect(yield* Ref.get(b.bearers)).toEqual([]);
246
+ }),
247
+ ).pipe(Effect.provide(NodeHttpServer.layerTest)),
248
+);
249
+
250
+it.effect("leaves out what a newer linked environment sends that this one cannot pass on", () =>
251
+ Effect.scoped(
252
+ Effect.gen(function* () {
253
+ const frames = [
254
+ encodeStreamItem({ kind: "snapshot", snapshotSequence: 7, projection: boxProjection }),
255
+ // An event type added after this version, which its schema reads but never writes.
256
+ JSON.stringify({ kind: "event", sequence: 8, event: { type: "thread.teleported" } }),
257
+ encodeStreamItem({ kind: "event", ...archived(9) }),
258
+ ];
259
+ const b = yield* servePeer(
260
+ box,
261
+ Layer.empty,
262
+ HttpRouter.add(
263
+ "GET",
264
+ PEER_LINK_THREAD_STREAM_ROUTE,
265
+ Effect.succeed(
266
+ HttpServerResponse.stream(
267
+ Stream.fromIterable(frames).pipe(
268
+ Stream.map((frame) => `data: ${frame}\n\n`),
269
+ Stream.concat(Stream.never),
270
+ Stream.encodeText,
271
+ ),
272
+ { contentType: "text/event-stream" },
273
+ ),
274
+ ),
275
+ ),
276
+ );
277
+ const a = yield* makeLaptop;
278
+ yield* linkTo(a.links, b);
279
+
280
+ const relayed = yield* a.relay.subscribe(input).pipe(Stream.take(2), Stream.runCollect);
281
+ expect(relayed.map((item) => [item.kind, "sequence" in item ? item.sequence : null])).toEqual(
282
+ [
283
+ ["snapshot", null],
284
+ ["event", 9],
285
+ ],
286
+ );
287
+ // Each one goes on to this environment's client in the same encoding.
288
+ expect(relayed.map((item) => encodeStreamItem(item))).toHaveLength(2);
289
+ }),
290
+ ).pipe(Effect.provide(NodeHttpServer.layerTest)),
291
+);
292
+
293
+it.effect("gives up on an answer whose body never arrives", () =>
294
+ Effect.scoped(
295
+ Effect.gen(function* () {
296
+ const stalled = (status: number) =>
297
+ Effect.succeed(
298
+ HttpServerResponse.stream(
299
+ Stream.make("{").pipe(Stream.concat(Stream.never), Stream.encodeText),
300
+ { status, contentType: "application/json" },
301
+ ),
302
+ );
303
+ const b = yield* servePeer(
304
+ box,
305
+ Layer.empty,
306
+ Layer.mergeAll(
307
+ HttpRouter.add("GET", PEER_LINK_THREAD_ITEM_ROUTE, stalled(200)),
308
+ HttpRouter.add("GET", PEER_LINK_THREAD_HISTORY_ROUTE, stalled(403)),
309
+ ),
310
+ );
311
+ const a = yield* makeLaptop;
312
+ yield* linkTo(a.links, b);
313
+
314
+ const item = yield* a.relay
315
+ .item({ ...input, itemId: boxItem })
316
+ .pipe(Effect.flip, Effect.forkScoped);
317
+ expect(yield* Queue.take(a.answered)).toBe(200);
318
+ yield* TestClock.adjust(Duration.seconds(10));
319
+ expect(yield* Fiber.join(item)).toMatchObject({ reason: "unreachable", label: "Box" });
320
+
321
+ // A refusal is known by its status, so its body is not waited for either.
322
+ const page = yield* a.relay
323
+ .historyPage({ ...input, cursor: "cursor-1" })
324
+ .pipe(Effect.flip, Effect.forkScoped);
325
+ expect(yield* Queue.take(a.answered)).toBe(403);
326
+ yield* TestClock.adjust(Duration.seconds(10));
327
+ expect(yield* Fiber.join(page)).toMatchObject({ reason: "rejected", label: "Box" });
328
+ }),
329
+ ).pipe(Effect.provide(NodeHttpServer.layerTest)),
330
+);
apps/server/src/peer/PeerThreadRelay.ts
new
+275
@@ -0,0 +1,275 @@
1
+import {
2
+ OrchestrationV2GetTurnItemResult,
3
+ OrchestrationV2ThreadHistoryPage,
4
+ OrchestrationV2ThreadStreamItem,
5
+ PEER_LINK_THREAD_HISTORY_ROUTE,
6
+ PEER_LINK_THREAD_ITEM_ROUTE,
7
+ PEER_LINK_THREAD_STREAM_ROUTE,
8
+ type PeerLinkError,
9
+ type PeerLinkThreadHistoryInput,
10
+ type PeerLinkThreadInput,
11
+ type PeerLinkThreadItemInput,
12
+ PeerLinkThreadReadError,
13
+} from "@t3tools/contracts";
14
+import * as Context from "effect/Context";
15
+import * as DateTime from "effect/DateTime";
16
+import * as Duration from "effect/Duration";
17
+import * as Effect from "effect/Effect";
18
+import * as Layer from "effect/Layer";
19
+import * as Option from "effect/Option";
20
+import * as Result from "effect/Result";
21
+import * as Schema from "effect/Schema";
22
+import type * as Scope from "effect/Scope";
23
+import * as Stream from "effect/Stream";
24
+import * as Sse from "effect/encoding/Sse";
25
+import * as HttpClient from "effect/http/HttpClient";
26
+import * as HttpClientRequest from "effect/http/HttpClientRequest";
27
+import type * as HttpClientResponse from "effect/http/HttpClientResponse";
28
+
29
+import * as McpInvocationContext from "../mcp/McpInvocationContext.ts";
30
+import * as PeerLinks from "./PeerLinks.ts";
31
+
32
+/**
33
+ * The linked environment sends a heartbeat every 20 seconds, so a stream this quiet has lost its
34
+ * connection without closing it.
35
+ */
36
+const SILENT_STREAM_TIMEOUT = Duration.seconds(75);
37
+
38
+/**
39
+ * Relays a linked environment's thread to a client of this environment, over the link this
40
+ * environment already holds. The stream is the linked environment's own thread subscription,
41
+ * passed on item by item; nothing is held here once the client stops listening.
42
+ */
43
+export class PeerThreadRelay extends Context.Service<
44
+ PeerThreadRelay,
45
+ {
46
+ /** A snapshot of the thread, then its live items, until the client or the peer ends it. */
47
+ readonly subscribe: (
48
+ input: PeerLinkThreadInput,
49
+ ) => Stream.Stream<OrchestrationV2ThreadStreamItem, PeerLinkThreadReadError>;
50
+ /** The turns before a snapshot's window, as the owner's client pages them. */
51
+ readonly historyPage: (
52
+ input: PeerLinkThreadHistoryInput,
53
+ ) => Effect.Effect<OrchestrationV2ThreadHistoryPage, PeerLinkThreadReadError>;
54
+ /** One item in full, for a row the reader opens. */
55
+ readonly item: (
56
+ input: PeerLinkThreadItemInput,
57
+ ) => Effect.Effect<OrchestrationV2GetTurnItemResult, PeerLinkThreadReadError>;
58
+ }
59
+>()("t3/peer/PeerThreadRelay") {}
60
+
61
+const decodeStreamItem = Schema.decodeUnknownOption(
62
+ Schema.fromJsonString(Schema.toCodecJson(OrchestrationV2ThreadStreamItem)),
63
+);
64
+const decodeHistoryPage = Schema.decodeUnknownEffect(
65
+ Schema.toCodecJson(OrchestrationV2ThreadHistoryPage),
66
+);
67
+const decodeItem = Schema.decodeUnknownEffect(Schema.toCodecJson(OrchestrationV2GetTurnItemResult));
68
+const decodeRefusal = Schema.decodeUnknownOption(Schema.Struct({ error: Schema.String }));
69
+
70
+const unreachable = (label: string, cause?: unknown) =>
71
+ new PeerLinkThreadReadError({
72
+ reason: "unreachable",
73
+ label,
74
+ message: `${label} did not answer.`,
75
+ ...(cause === undefined ? {} : { cause }),
76
+ });
77
+
78
+/** A link that cannot be used, as the client that asked hears it. */
79
+const fromLinkError = (error: PeerLinkError, label: string) =>
80
+ new PeerLinkThreadReadError({
81
+ reason:
82
+ error.reason === "unknown_link" ||
83
+ error.reason === "expired" ||
84
+ error.reason === "incompatible"
85
+ ? error.reason
86
+ : "unreachable",
87
+ label,
88
+ message: error.message,
89
+ cause: error,
90
+ });
91
+
92
+/** The linked environment's refusal, as the client that asked hears it. */
93
+const fromStatus = (status: number, code: string | undefined, label: string) => {
94
+ if (status === 404 && code === "thread_not_found") {
95
+ return new PeerLinkThreadReadError({
96
+ reason: "thread_not_found",
97
+ label,
98
+ message: `That thread is no longer on ${label}.`,
99
+ });
100
+ }
101
+ // An address that stopped serving the route, as after a downgrade there.
102
+ if (status === 404) {
103
+ return new PeerLinkThreadReadError({
104
+ reason: "incompatible",
105
+ label,
106
+ message: `${label} runs a T3 Code version that does not share its threads over a link. Update it to read its threads from here.`,
107
+ });
108
+ }
109
+ if (status === 401 || status === 403) {
110
+ return new PeerLinkThreadReadError({
111
+ reason: "rejected",
112
+ label,
113
+ message:
114
+ code === "linked_environments_off"
115
+ ? `${label} has Linked environments turned off. Turn it on in its Settings → Labs.`
116
+ : `${label} refused the read. Its link may have been revoked there; link it again.`,
117
+ });
118
+ }
119
+ return unreachable(label, `HTTP ${status}`);
120
+};
121
+
122
+const make = Effect.gen(function* () {
123
+ const links = yield* PeerLinks.PeerLinks;
124
+ const httpClient = yield* HttpClient.HttpClient;
125
+
126
+ /**
127
+ * Asks the linked environment for `route` of the thread. The response stays open until the
128
+ * scope closes, which is what ends a stream the client stopped listening to.
129
+ */
130
+ const open = Effect.fn("PeerThreadRelay.open")(function* (
131
+ input: PeerLinkThreadInput,
132
+ route: string,
133
+ params: Record<string, string>,
134
+ ): Effect.fn.Return<
135
+ {
136
+ readonly label: string;
137
+ readonly response: HttpClientResponse.HttpClientResponse;
138
+ /** How long the peer may take over the rest of an answer that is not a stream. */
139
+ readonly timeout: Duration.Duration;
140
+ },
141
+ PeerLinkThreadReadError,
142
+ Scope.Scope
143
+ > {
144
+ if (!(yield* links.enabled)) {
145
+ return yield* new PeerLinkThreadReadError({
146
+ reason: "disabled",
147
+ label: null,
148
+ message: PeerLinks.LINKED_ENVIRONMENTS_OFF,
149
+ });
150
+ }
151
+ const link = yield* links.get(input.environmentId).pipe(
152
+ Effect.mapError(
153
+ (error) =>
154
+ new PeerLinkThreadReadError({
155
+ reason: "unreachable",
156
+ label: null,
157
+ message: "This environment could not read its links.",
158
+ cause: error,
159
+ }),
160
+ ),
161
+ );
162
+ if (Option.isNone(link)) {
163
+ return yield* new PeerLinkThreadReadError({
164
+ reason: "unknown_link",
165
+ label: null,
166
+ message: "This environment is no longer linked to the one this thread is on.",
167
+ });
168
+ }
169
+ const { label } = link.value;
170
+ const resolved = yield* links
171
+ .resolve(input.environmentId)
172
+ .pipe(Effect.mapError((error) => fromLinkError(error, label)));
173
+ if (resolved.capabilities.linkThreadStream !== true) {
174
+ return yield* fromStatus(404, undefined, label);
175
+ }
176
+ const timeout = PeerLinks.probeTimeout(resolved.url);
177
+ const query = new URLSearchParams({ thread: input.threadId, ...params });
178
+ const response = yield* HttpClient.withScope(httpClient)
179
+ .execute(
180
+ HttpClientRequest.get(`${resolved.url}${route}?${query}`).pipe(
181
+ HttpClientRequest.setHeaders({ authorization: `Bearer ${resolved.token}` }),
182
+ ),
183
+ )
184
+ .pipe(
185
+ // Bounds the headers only: an open stream stays quiet for as long as the thread does.
186
+ Effect.timeout(timeout),
187
+ Effect.mapError((error) => unreachable(label, error)),
188
+ Effect.tapError((error) =>
189
+ links.recordOutcome(input.environmentId, { error: error.message }),
190
+ ),
191
+ );
192
+ if (response.status !== 200) {
193
+ // A refusal whose body never arrives is still the refusal its status names.
194
+ const refusal = yield* response.json.pipe(
195
+ Effect.timeout(timeout),
196
+ Effect.map(decodeRefusal),
197
+ Effect.orElseSucceed(() => Option.none()),
198
+ );
199
+ const failure = fromStatus(response.status, Option.getOrUndefined(refusal)?.error, label);
200
+ // A refusal is still an answer: the link reached the peer, except where it was turned away.
201
+ yield* links.recordOutcome(input.environmentId, {
202
+ error: failure.reason === "thread_not_found" ? null : failure.message,
203
+ });
204
+ return yield* failure;
205
+ }
206
+ yield* links.recordOutcome(input.environmentId, { error: null });
207
+ // A peer renews a link each time it is used, and says when it now ends.
208
+ const renewed = Option.flatMap(
209
+ Option.fromNullishOr(response.headers[McpInvocationContext.LINK_EXPIRES_AT_HEADER]),
210
+ DateTime.make,
211
+ );
212
+ if (Option.isSome(renewed)) yield* links.recordExpiry(input.environmentId, renewed.value);
213
+ return { label, response, timeout };
214
+ });
215
+
216
+ const readJson = <A>(
217
+ opened: ReturnType<typeof open>,
218
+ decode: (body: unknown) => Effect.Effect<A, Schema.SchemaError>,
219
+ ) =>
220
+ opened.pipe(
221
+ Effect.flatMap(({ label, response, timeout }) =>
222
+ response.json.pipe(
223
+ // A peer that sends headers and then stalls must not leave the read waiting.
224
+ Effect.timeout(timeout),
225
+ Effect.flatMap(decode),
226
+ Effect.mapError((error) => unreachable(label, error)),
227
+ ),
228
+ ),
229
+ Effect.scoped,
230
+ );
231
+
232
+ const subscribe: PeerThreadRelay["Service"]["subscribe"] = (input) =>
233
+ Stream.unwrap(
234
+ open(input, PEER_LINK_THREAD_STREAM_ROUTE, {}).pipe(
235
+ Effect.map(({ label, response }) =>
236
+ response.stream.pipe(
237
+ Stream.timeoutOrElse({
238
+ duration: SILENT_STREAM_TIMEOUT,
239
+ orElse: () => Stream.fail(unreachable(label)),
240
+ }),
241
+ Stream.decodeText,
242
+ Stream.pipeThroughChannel(Sse.decode()),
243
+ // An item this version cannot read is skipped, as the owner's own client skips it.
244
+ // That includes an event type from a newer peer, which cannot be encoded again.
245
+ Stream.filterMap((event) => {
246
+ const item = decodeStreamItem(event.data);
247
+ return Option.isSome(item) && item.value.kind !== "unknown-event"
248
+ ? Result.succeed(item.value)
249
+ : Result.failVoid;
250
+ }),
251
+ Stream.mapError((error) =>
252
+ error._tag === "PeerLinkThreadReadError" ? error : unreachable(label, error),
253
+ ),
254
+ // The peer closed the stream: the client hears it and asks again.
255
+ Stream.concat(Stream.fail(unreachable(label))),
256
+ ),
257
+ ),
258
+ ),
259
+ ).pipe(Stream.withSpan("PeerThreadRelay.subscribe"));
260
+
261
+ return PeerThreadRelay.of({
262
+ subscribe,
263
+ historyPage: Effect.fn("PeerThreadRelay.historyPage")((input) =>
264
+ readJson(
265
+ open(input, PEER_LINK_THREAD_HISTORY_ROUTE, { cursor: input.cursor }),
266
+ decodeHistoryPage,
267
+ ),
268
+ ),
269
+ item: Effect.fn("PeerThreadRelay.item")((input) =>
270
+ readJson(open(input, PEER_LINK_THREAD_ITEM_ROUTE, { item: input.itemId }), decodeItem),
271
+ ),
272
+ });
273
+});
274
+
275
+export const layer = Layer.effect(PeerThreadRelay, make);
apps/server/src/peer/linkThreadHttp.ts
new
+162
@@ -0,0 +1,162 @@
1
+import {
2
+ OrchestrationV2GetTurnItemResult,
3
+ OrchestrationV2ThreadHistoryPage,
4
+ OrchestrationV2ThreadStreamItem,
5
+ PEER_LINK_THREAD_HISTORY_ROUTE,
6
+ PEER_LINK_THREAD_ITEM_ROUTE,
7
+ PEER_LINK_THREAD_STREAM_ROUTE,
8
+ ThreadId,
9
+ TurnItemId,
10
+} from "@t3tools/contracts";
11
+import * as DateTime from "effect/DateTime";
12
+import * as Duration from "effect/Duration";
13
+import * as Effect from "effect/Effect";
14
+import * as Layer from "effect/Layer";
15
+import * as Schedule from "effect/Schedule";
16
+import * as Schema from "effect/Schema";
17
+import * as Stream from "effect/Stream";
18
+import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
19
+
20
+import * as EnvironmentAuth from "../auth/EnvironmentAuth.ts";
21
+import { eventStreamResponse } from "../eventStreamResponse.ts";
22
+import * as McpInvocationContext from "../mcp/McpInvocationContext.ts";
23
+import * as ThreadManagement from "../orchestration-v2/ThreadManagementService.ts";
24
+import * as ServerSettings from "../serverSettings.ts";
25
+import { subscribeOrchestrationV2Thread } from "../ws.ts";
26
+
27
+/** How soon an open stream ends after its link is revoked here or the beta is turned off. */
28
+const ACCESS_RECHECK_INTERVAL = Duration.seconds(30);
29
+const NO_STORE = { "cache-control": "no-store" };
30
+
31
+// The owner's thread types hold DateTime values; the JSON codec writes them as strings.
32
+const encodeStreamItem = Schema.encodeEffect(
33
+ Schema.fromJsonString(Schema.toCodecJson(OrchestrationV2ThreadStreamItem)),
34
+);
35
+const encodeHistoryPage = Schema.encodeEffect(Schema.toCodecJson(OrchestrationV2ThreadHistoryPage));
36
+const encodeItem = Schema.encodeEffect(Schema.toCodecJson(OrchestrationV2GetTurnItemResult));
37
+
38
+const refusal = (status: number, error: string) =>
39
+ HttpServerResponse.jsonUnsafe({ error }, { status, headers: NO_STORE });
40
+
41
+/**
42
+ * Admits a peer link's session, as `/mcp` does: no browser origin, the link's own bearer, and the
43
+ * Linked environments beta on here. Every access level may read, as each reads through `/mcp`.
44
+ */
45
+const admitLink = Effect.gen(function* () {
46
+ const request = yield* HttpServerRequest.HttpServerRequest;
47
+ if (request.headers.origin !== undefined) return refusal(403, "origin_not_allowed");
48
+ const auth = yield* EnvironmentAuth.EnvironmentAuth;
49
+ const settings = yield* ServerSettings.ServerSettingsService;
50
+ const linksEnabled = settings.getSettings.pipe(
51
+ Effect.map((current) => current.linkedEnvironmentsEnabled),
52
+ Effect.orElseSucceed(() => false),
53
+ );
54
+ // Verifying renews the link's session, as each `/mcp` call does.
55
+ const verify = auth.authenticateMcpClient(request).pipe(Effect.option);
56
+ const client = yield* verify;
57
+ if (client._tag === "None") return refusal(401, "unauthorized");
58
+ if (!client.value.peerLink) return refusal(403, "not_a_link_session");
59
+ if (!(yield* linksEnabled)) return refusal(403, "linked_environments_off");
60
+ const params = new URLSearchParams(request.url.split("?", 2)[1] ?? "");
61
+ const threadId = params.get("thread");
62
+ if (!threadId) return refusal(400, "invalid_request");
63
+ const threads = yield* ThreadManagement.ThreadManagementService;
64
+ const shell = yield* threads.getThreadShell(ThreadId.make(threadId)).pipe(Effect.option);
65
+ if (shell._tag === "None") return refusal(500, "thread_read_failed");
66
+ if (shell.value === null || shell.value.deletedAt !== null) {
67
+ return refusal(404, "thread_not_found");
68
+ }
69
+ return {
70
+ threadId: shell.value.id,
71
+ params,
72
+ linkExpiresAt: client.value.linkExpiresAt,
73
+ /** Completes once the link's session or the beta no longer admits it. */
74
+ revoked: Effect.all([verify, linksEnabled]).pipe(
75
+ Effect.repeat({
76
+ schedule: Schedule.spaced(ACCESS_RECHECK_INTERVAL),
77
+ until: ([current, enabled]) => current._tag === "None" || !enabled,
78
+ }),
79
+ ),
80
+ };
81
+});
82
+
83
+const withLinkExpiry = (
84
+ response: HttpServerResponse.HttpServerResponse,
85
+ linkExpiresAt: DateTime.Utc | undefined,
86
+) =>
87
+ linkExpiresAt === undefined
88
+ ? response
89
+ : HttpServerResponse.setHeader(
90
+ response,
91
+ McpInvocationContext.LINK_EXPIRES_AT_HEADER,
92
+ DateTime.formatIso(linkExpiresAt),
93
+ );
94
+
95
+// The owner's thread subscription with a bounded snapshot: the same items, in the same order.
96
+const streamRoute = HttpRouter.add(
97
+ "GET",
98
+ PEER_LINK_THREAD_STREAM_ROUTE,
99
+ Effect.gen(function* () {
100
+ const admitted = yield* admitLink;
101
+ if (HttpServerResponse.isHttpServerResponse(admitted)) return admitted;
102
+ const items = yield* subscribeOrchestrationV2Thread({
103
+ threadId: admitted.threadId,
104
+ acceptBoundedSnapshot: true,
105
+ }).pipe(Effect.option);
106
+ if (items._tag === "None") return refusal(500, "thread_read_failed");
107
+ return withLinkExpiry(
108
+ eventStreamResponse(
109
+ items.value.pipe(
110
+ // A failed read closes the response; the linking environment reports it and reconnects.
111
+ Stream.catchCause(() => Stream.empty),
112
+ Stream.interruptWhen(admitted.revoked),
113
+ ),
114
+ encodeStreamItem,
115
+ ),
116
+ admitted.linkExpiresAt,
117
+ );
118
+ }),
119
+);
120
+
121
+const historyRoute = HttpRouter.add(
122
+ "GET",
123
+ PEER_LINK_THREAD_HISTORY_ROUTE,
124
+ Effect.gen(function* () {
125
+ const admitted = yield* admitLink;
126
+ if (HttpServerResponse.isHttpServerResponse(admitted)) return admitted;
127
+ const cursor = admitted.params.get("cursor");
128
+ if (!cursor) return refusal(400, "invalid_request");
129
+ const threads = yield* ThreadManagement.ThreadManagementService;
130
+ const body = yield* threads
131
+ .getThreadHistoryPage(admitted.threadId, cursor)
132
+ .pipe(Effect.flatMap(encodeHistoryPage), Effect.option);
133
+ if (body._tag === "None") return refusal(500, "thread_read_failed");
134
+ return withLinkExpiry(
135
+ HttpServerResponse.jsonUnsafe(body.value, { headers: NO_STORE }),
136
+ admitted.linkExpiresAt,
137
+ );
138
+ }),
139
+);
140
+
141
+const itemRoute = HttpRouter.add(
142
+ "GET",
143
+ PEER_LINK_THREAD_ITEM_ROUTE,
144
+ Effect.gen(function* () {
145
+ const admitted = yield* admitLink;
146
+ if (HttpServerResponse.isHttpServerResponse(admitted)) return admitted;
147
+ const itemId = admitted.params.get("item");
148
+ if (!itemId) return refusal(400, "invalid_request");
149
+ const threads = yield* ThreadManagement.ThreadManagementService;
150
+ const body = yield* threads
151
+ .getTurnItem({ threadId: admitted.threadId, itemId: TurnItemId.make(itemId) })
152
+ .pipe(Effect.flatMap(encodeItem), Effect.option);
153
+ if (body._tag === "None") return refusal(500, "thread_read_failed");
154
+ return withLinkExpiry(
155
+ HttpServerResponse.jsonUnsafe(body.value, { headers: NO_STORE }),
156
+ admitted.linkExpiresAt,
157
+ );
158
+ }),
159
+);
160
+
161
+/** What an environment serves of its threads to the environments linked to it. */
162
+export const layer = Layer.mergeAll(streamRoute, historyRoute, itemRoute);
apps/server/src/server.ts
+5
-2
@@ -95,6 +95,7 @@ import * as RemoteDelegation from "./peer/RemoteDelegation.ts";
95
import * as PeerLinkRequests from "./peer/PeerLinkRequests.ts";
96
import * as PeerLinks from "./peer/PeerLinks.ts";
97
import * as PeerMcpClient from "./peer/PeerMcpClient.ts";
98
+import * as PeerThreadRelay from "./peer/PeerThreadRelay.ts";
99
import * as McpSessionRegistry from "./mcp/McpSessionRegistry.ts";
100
import * as PreviewAutomationBroker from "./mcp/PreviewAutomationBroker.ts";
101
import * as DeviceService from "./device/DeviceService.ts";
@@ -179,6 +180,7 @@ import * as EnvironmentAuth from "./auth/EnvironmentAuth.ts";
180
import * as EnvironmentAuthPolicy from "./auth/EnvironmentAuthPolicy.ts";
181
import * as CloudHttp from "./cloud/http.ts";
182
import * as GuestHttp from "./guest/http.ts";
183
+import * as LinkThreadHttp from "./peer/linkThreadHttp.ts";
184
import * as CloudLink from "./cloud/CloudLink.ts";
185
import * as ConnectReachability from "./cloud/ConnectReachability.ts";
186
import { pendingServiceUpdateExists } from "./cloud/updateHandoff.ts";
@@ -861,6 +863,7 @@ const layerMakeRoutes = Layer.mergeAll(
863
ServerHttp.layerAssetRoute,
864
ServerHttp.layerAttachmentUploadRoute,
865
GuestHttp.layer,
866
+ LinkThreadHttp.layer,
867
DeviceHubProxy.layer,
868
ServerBrowserStream.routeLayer,
869
PreviewTunnel.routeLayer,
@@ -896,9 +899,9 @@ const layerMakeRoutes = Layer.mergeAll(
899
),
900
),
901
Layer.provide(PreviewBrowser.layer),
899
- // Links to other environments, shared by Settings (WebSocket) and agents (/mcp).
902
+ // Links to other environments, shared by clients (WebSocket) and agents (/mcp).
903
Layer.provide(
901
- PeerForwarding.layer.pipe(
904
+ Layer.merge(PeerForwarding.layer, PeerThreadRelay.layer).pipe(
905
Layer.provideMerge(PeerMcpClient.layer),
906
Layer.provideMerge(PeerLinks.layer),
907
),
apps/server/src/ws.test.ts
+2
@@ -101,6 +101,7 @@ import * as OtlpEndpointCheck from "./observability/OtlpEndpointCheck.ts";
101
import * as PairingGrantStore from "./auth/PairingGrantStore.ts";
102
import * as RpcAuthorization from "./auth/RpcAuthorization.ts";
103
import * as PeerLinkRequests from "./peer/PeerLinkRequests.ts";
104
+import * as PeerThreadRelay from "./peer/PeerThreadRelay.ts";
105
import * as PeerLinks from "./peer/PeerLinks.ts";
106
import * as PortScanner from "./preview/PortScanner.ts";
107
import * as PreviewManager from "./preview/Manager.ts";
@@ -848,6 +849,7 @@ const layerUnusedConfigRpcServices = Layer.mergeAll(
849
Layer.mock(PairingGrantStore.PairingGrantStore)({}),
850
Layer.mock(PeerLinks.PeerLinks)({}),
851
Layer.mock(PeerLinkRequests.PeerLinkRequests)({}),
852
+ Layer.mock(PeerThreadRelay.PeerThreadRelay)({}),
853
Layer.mock(PortScanner.PortDiscovery)({ trackAgent: () => () => undefined }),
854
Layer.mock(PreviewManager.PreviewManager)({}),
855
Layer.mock(ProcessDiagnostics.ProcessDiagnostics)({}),
apps/server/src/ws.ts
+15
@@ -8,6 +8,7 @@ import * as SecureRandom from "effect/crypto/SecureRandom";
8
import * as Orchestrator from "./orchestration-v2/Orchestrator.ts";
9
import * as PeerLinkRequests from "./peer/PeerLinkRequests.ts";
10
import * as PeerLinks from "./peer/PeerLinks.ts";
11
+import * as PeerThreadRelay from "./peer/PeerThreadRelay.ts";
12
13
import * as DateTime from "effect/DateTime";
14
import * as Duration from "effect/Duration";
@@ -1560,6 +1561,7 @@ export const layerWsRpc = (
1561
const secretResolver = yield* SecretResolver.SecretResolver;
1562
const peerLinks = yield* PeerLinks.PeerLinks;
1563
const peerLinkRequests = yield* PeerLinkRequests.PeerLinkRequests;
1564
+ const peerThreadRelay = yield* PeerThreadRelay.PeerThreadRelay;
1565
const startup = yield* ServerRuntimeStartup.ServerRuntimeStartup;
1566
const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
1567
const workspaceFileSystem = yield* WorkspaceFileSystem.WorkspaceFileSystem;
@@ -2704,9 +2706,20 @@ export const layerWsRpc = (
2706
[WS_METHODS.serverReclaimDatabaseSpace]: () => databaseStorage.requestReclaim,
2707
[WS_METHODS.peerLinksList]: (_input) =>
2708
peerLinks.list.pipe(Effect.map((links) => ({ links }))),
2709
+ [WS_METHODS.peerLinksNames]: (_input) =>
2710
+ peerLinks.names.pipe(Effect.map((links) => ({ links }))),
2711
[WS_METHODS.peerLinksLink]: (input) => peerLinks.link(input),
2712
[WS_METHODS.peerLinksUnlink]: ({ environmentId }) =>
2713
peerLinks.unlink(environmentId).pipe(Effect.map((removed) => ({ removed }))),
2714
+ [WS_METHODS.peerLinksSubscribeThread]: (input) => peerThreadRelay.subscribe(input),
2715
+ [WS_METHODS.peerLinksThreadHistoryPage]: (input) =>
2716
+ Effect.annotateCurrentSpan({ "orchestration_v2.thread_id": input.threadId }).pipe(
2717
+ Effect.andThen(peerThreadRelay.historyPage(input)),
2718
+ ),
2719
+ [WS_METHODS.peerLinksThreadItem]: (input) =>
2720
+ Effect.annotateCurrentSpan({ "orchestration_v2.thread_id": input.threadId }).pipe(
2721
+ Effect.andThen(peerThreadRelay.item(input)),
2722
+ ),
2723
[WS_METHODS.peerLinksAnswerRequest]: (input) =>
2724
Effect.annotateCurrentSpan({ "orchestration_v2.thread_id": input.threadId }).pipe(
2725
Effect.andThen(peerLinkRequests.answer(input)),
@@ -3618,6 +3631,7 @@ export const layer = Layer.unwrap(
3631
const reviewGuides = yield* PullRequestReviewGuideService.PullRequestReviewGuideService;
3632
const peerLinks = yield* PeerLinks.PeerLinks;
3633
const peerLinkRequests = yield* PeerLinkRequests.PeerLinkRequests;
3634
+ const peerThreadRelay = yield* PeerThreadRelay.PeerThreadRelay;
3635
const sql = yield* SqlClient.SqlClient;
3636
return HttpRouter.add(
3637
"GET",
@@ -3718,6 +3732,7 @@ export const layer = Layer.unwrap(
3732
),
3733
Layer.provide(Layer.succeed(PeerLinks.PeerLinks, peerLinks)),
3734
Layer.provide(Layer.succeed(PeerLinkRequests.PeerLinkRequests, peerLinkRequests)),
3735
+ Layer.provide(Layer.succeed(PeerThreadRelay.PeerThreadRelay, peerThreadRelay)),
3736
Layer.provide(
3737
SourceControlDiscovery.layer.pipe(
3738
Layer.provide(
apps/web/src/closedViewStore.test.ts
+6
@@ -60,6 +60,12 @@ describe("closedViewStore", () => {
60
threadRef: refA,
61
surface: { kind: "side-chat", id: "side-chat:x" },
62
},
63
+ {
64
+ id: "bad",
65
+ kind: "panel-tab",
66
+ threadRef: refA,
67
+ surface: { kind: "linked-thread", id: "linked-thread:x", viaEnvironmentId: "env-1" },
68
+ },
69
])("discards incomplete saved views %j while retaining valid history", async (entry) => {
70
const id = useClosedViewStore.getState().remember(diff(refA));
71
const { storage, name } = useClosedViewStore.persist.getOptions();
apps/web/src/closedViewStore.ts
+6
@@ -9,6 +9,7 @@ import * as Schema from "effect/Schema";
9
import { create } from "zustand";
10
import { createJSONStorage, persist } from "zustand/middleware";
11
12
+import { decodeLinkedThreadSurface } from "./linkedThreadSurface";
13
import { resolveStorage } from "./lib/storage";
14
import { randomUUID } from "./lib/utils";
15
import { type RightPanelSurface } from "./rightPanelStore";
@@ -85,6 +86,11 @@ const isClosedViewEntry = (entry: unknown): entry is ClosedViewEntry => {
86
);
87
case "side-chat":
88
return typeof surface.threadId === "string" && surface.id === `side-chat:${surface.threadId}`;
89
+ case "linked-thread":
90
+ return (
91
+ (surface.title === null || typeof surface.title === "string") &&
92
+ decodeLinkedThreadSurface(surface)?.id === surface.id
93
+ );
94
case "pull-request":
95
return (
96
typeof surface.projectId === "string" &&
apps/web/src/components/ChatMarkdown.tsx
+6
-1
@@ -1243,7 +1243,12 @@ const CHAT_MARKDOWN_COMPONENTS = {
1243
// An autolink's text is its own URL, which is no label.
1244
const label = written && parseThreadLinkHref(written) === null ? written : null;
1245
return environmentId ? (
1246
- <MarkdownThreadLink environmentId={environmentId} link={threadLink} label={label} />
1246
+ <MarkdownThreadLink
1247
+ environmentId={environmentId}
1248
+ threadRef={threadRef}
1249
+ link={threadLink}
1250
+ label={label}
1251
+ />
1252
) : (
1253
<span>{label ?? gt("Thread")}</span>
1254
);
apps/web/src/components/RightPanelTabs.tsx
+8
@@ -66,6 +66,7 @@ import {
66
67
import { isElectron } from "~/env";
68
import type { DesktopPreviewOverlay } from "~/previewStateStore";
69
+import { linkedThreadTitle } from "~/linkedThreadSurface";
70
import type { RightPanelSurface } from "~/rightPanelStore";
71
import { cn } from "~/lib/utils";
72
import { issueStatePresentation } from "~/components/issue/issuePresentation";
@@ -614,6 +615,11 @@ function surfaceTitle(
615
return surface.title ?? surface.target?.name ?? resolve(msg("Device"));
616
case "side-chat":
617
return resolve(msg("Side chat"));
618
+ case "linked-thread":
619
+ return linkedThreadTitle(
620
+ surface,
621
+ resolve(msg("Thread on {label}", { label: surface.label })),
622
+ );
623
case "preview": {
624
const snapshot = surface.resourceId ? sessions[surface.resourceId] : null;
625
if (!snapshot || snapshot.navStatus._tag === "Idle") return resolve(msg("Browser"));
@@ -706,6 +712,8 @@ function SurfaceIcon({
712
return <IssueSurfaceIcon surface={surface} environmentId={environmentId} />;
713
case "side-chat":
714
return <SideChatTabIcon environmentId={environmentId} threadId={surface.threadId} />;
715
+ case "linked-thread":
716
+ return <MessagesSquare className="size-3 shrink-0" />;
717
case "device":
718
return surface.target?.platform === "ios" ? (
719
<AppleIcon className="size-3 shrink-0" />
apps/web/src/components/chat/LinkedThreadPane.tsx
new
+173
@@ -0,0 +1,173 @@
1
+import { isLinkedThreadWorking, linkedThreadFailure } from "@t3tools/client-runtime/linked-thread";
2
+import type { ScopedThreadRef } from "@t3tools/contracts";
3
+import { T, useGT, useMessages, Var } from "gt-react";
4
+import { EyeIcon } from "lucide-react";
5
+import { useState, type ReactNode } from "react";
6
+
7
+import { useStableCallback } from "../../hooks/useStableCallback";
8
+import { type LinkedThreadSurface, linkedThreadTitle } from "../../linkedThreadSurface";
9
+import { useEnvironment } from "../../state/environments";
10
+import { linkedThreadItemSource, useLinkedThreadView } from "../../state/linkedThreadView";
11
+import { Alert, AlertAction, AlertDescription, AlertTitle } from "../ui/alert";
12
+import { Button } from "../ui/button";
13
+import { ComposerBannerStack, type ComposerBannerStackItem } from "./ComposerBannerStack";
14
+import { ComposerSurface } from "./ComposerSurface";
15
+import {
16
+ ReadOnlyComposerBar,
17
+ ReadOnlyComposerLead,
18
+ ReadOnlyComposerStatus,
19
+} from "./ReadOnlyComposerBar";
20
+import { Spinner } from "../ui/spinner";
21
+import type { MessagesTimelineHistoryControls } from "./MessagesTimeline";
22
+import { ReadOnlyThreadTimeline } from "./ReadOnlyThreadTimeline";
23
+
24
+/**
25
+ * Stands where a composer would: the thread takes no messages from here. `action` is the one way
26
+ * forward it offers, and `notice` what came of it.
27
+ */
28
+function LinkedThreadComposer(props: {
29
+ /** The linked environment the thread is on. */
30
+ readonly label: string;
31
+ /** The environment that reads it. */
32
+ readonly via: string;
33
+ readonly working: boolean;
34
+ readonly action?: ReactNode;
35
+ readonly notice?: ComposerBannerStackItem | null;
36
+}) {
37
+ const { label, via } = props;
38
+ const gt = useGT();
39
+ return (
40
+ <div className="flex shrink-0 flex-col gap-1 px-3 pb-3">
41
+ {props.notice ? <ComposerBannerStack items={[props.notice]} detached /> : null}
42
+ <ComposerSurface.Shell>
43
+ <ComposerSurface.Host>
44
+ <div className="relative z-10">
45
+ <ReadOnlyComposerBar actions={props.action}>
46
+ <ReadOnlyComposerLead>
47
+ <EyeIcon aria-hidden className="size-4 shrink-0 text-muted-foreground" />
48
+ <span className="min-w-0 truncate font-medium text-foreground">
49
+ <T>Read-only</T>
50
+ </span>
51
+ </ReadOnlyComposerLead>
52
+ <ReadOnlyComposerStatus role="status">
53
+ {props.working
54
+ ? gt("On {label} via {via} · Working", { label, via })
55
+ : gt("On {label} via {via}", { label, via })}
56
+ </ReadOnlyComposerStatus>
57
+ </ReadOnlyComposerBar>
58
+ </div>
59
+ </ComposerSurface.Host>
60
+ </ComposerSurface.Shell>
61
+ </div>
62
+ );
63
+}
64
+
65
+const NO_ATTACHMENT_URLS: ReadonlyMap<string, string> = new Map();
66
+const noAttachmentUrls = () => NO_ATTACHMENT_URLS;
67
+const ignore = () => {};
68
+
69
+/**
70
+ * A linked environment's thread, streamed through the environment this client is connected to
71
+ * and drawn by the timeline every thread uses. The client never connects to the linked one, so
72
+ * the view only reads: what would need that connection is absent. Key it by its surface id.
73
+ */
74
+export function LinkedThreadPane(props: {
75
+ /** The thread whose panel shows the tab. */
76
+ readonly panelRef: ScopedThreadRef;
77
+ readonly surface: LinkedThreadSurface;
78
+ /** Whether the tab is showing; the stream runs only while it is. */
79
+ readonly visible: boolean;
80
+}) {
81
+ const { surface, panelRef } = props;
82
+ const gt = useGT();
83
+ const m = useMessages();
84
+ const via = useEnvironment(surface.viaEnvironmentId)?.label ?? gt("this environment");
85
+ const { view, error, retry } = useLinkedThreadView(panelRef, surface, props.visible);
86
+ const [turnItemSource] = useState(() => linkedThreadItemSource(surface));
87
+ const label = surface.label;
88
+ const projection = view?.thread.projection ?? null;
89
+ const failure = error === null ? null : linkedThreadFailure(error, { via, label }, m);
90
+ const retryAction = failure?.retryable ? (
91
+ <AlertAction>
92
+ <Button size="sm" variant="outline" onClick={retry}>
93
+ <T>Try again</T>
94
+ </Button>
95
+ </AlertAction>
96
+ ) : null;
97
+ // A file or visual lives on the linked environment, which this client has no way to ask.
98
+ const renderHtmlRender = useStableCallback(() => (
99
+ <p className="chat-content-lane text-xs text-muted-foreground">
100
+ {gt("Open this thread on {label} to see this visual.", { label })}
101
+ </p>
102
+ ));
103
+ const working = projection !== null && isLinkedThreadWorking(projection);
104
+ const historyControls: MessagesTimelineHistoryControls | undefined =
105
+ view === null || view.thread.historyCursor === null
106
+ ? undefined
107
+ : {
108
+ hasMoreHistory: true,
109
+ loading: view.history.loading,
110
+ error: view.history.failed ? gt("Could not load earlier turns. Try again.") : null,
111
+ onLoadEarlier: view.loadEarlier,
112
+ };
113
+ return (
114
+ <div className="flex h-full min-h-0 flex-col">
115
+ <h2 className="shrink-0 truncate border-b border-border px-3 py-2 text-sm font-medium">
116
+ {linkedThreadTitle(
117
+ { title: projection?.thread.title || surface.title },
118
+ gt("Thread on {label}", { label }),
119
+ )}
120
+ </h2>
121
+ {projection === null ? (
122
+ <>
123
+ <div className="min-h-0 flex-1 overflow-y-auto p-3">
124
+ {failure === null ? (
125
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
126
+ <Spinner size="sm" />
127
+ <T>
128
+ Reading from <Var>{label}</Var>…
129
+ </T>
130
+ </div>
131
+ ) : (
132
+ <Alert variant="error">
133
+ <AlertTitle>{failure.title}</AlertTitle>
134
+ <AlertDescription>{failure.detail}</AlertDescription>
135
+ {retryAction}
136
+ </Alert>
137
+ )}
138
+ </div>
139
+ <LinkedThreadComposer label={label} via={via} working={false} />
140
+ </>
141
+ ) : (
142
+ <ReadOnlyThreadTimeline
143
+ // No ":" so the timeline finds no environment thread behind the key.
144
+ threadKey={`linked-${encodeURIComponent(surface.id)}`}
145
+ projection={projection}
146
+ historyControls={historyControls}
147
+ turnItemSource={turnItemSource}
148
+ attachmentUrls={noAttachmentUrls}
149
+ onImageExpand={ignore}
150
+ onFileOpen={ignore}
151
+ renderHtmlRender={renderHtmlRender}
152
+ >
153
+ {() => (
154
+ <>
155
+ {failure === null ? null : (
156
+ <div className="shrink-0 px-3 pb-2">
157
+ <Alert variant="warning">
158
+ <AlertTitle>{failure.title}</AlertTitle>
159
+ <AlertDescription>
160
+ {failure.detail} <T>Showing what was read before.</T>
161
+ </AlertDescription>
162
+ {retryAction}
163
+ </Alert>
164
+ </div>
165
+ )}
166
+ <LinkedThreadComposer label={label} via={via} working={working} />
167
+ </>
168
+ )}
169
+ </ReadOnlyThreadTimeline>
170
+ )}
171
+ </div>
172
+ );
173
+}
apps/web/src/components/chat/MarkdownThreadLink.browser.test.tsx
+95
-1
@@ -1,19 +1,32 @@
1
import { RegistryContext } from "@effect/atom-react";
2
+import { scopeThreadRef } from "@t3tools/client-runtime/environment";
3
import { EnvironmentId, ProjectId, ThreadId } from "@t3tools/contracts";
4
import * as Cause from "effect/Cause";
5
import { AsyncResult, Atom, AtomRegistry } from "effect/reactivity";
6
import { expect, it, vi } from "vite-plus/test";
7
8
import { act, render } from "../../../test/render";
9
+import { linkedThreadSurface } from "../../linkedThreadSurface";
10
+import { selectThreadRightPanelState, useRightPanelStore } from "../../rightPanelStore";
11
import { MarkdownThreadLink } from "./MarkdownThreadLink";
12
13
+const HERE = scopeThreadRef(EnvironmentId.make("environment"), ThreadId.make("here"));
14
+const panel = () => selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, HERE);
15
+
16
const state = vi.hoisted(() => ({
17
reply: null as unknown,
18
remote: null as unknown,
19
+ cached: null as unknown,
20
+ linked: new Map<string, string>(),
21
+ connected: [] as Array<string>,
22
}));
23
vi.mock(import("../../state/entities"), () => ({
24
useThreadShell: ((ref: { environmentId: string } | null) =>
16
- ref?.environmentId === "remote" ? state.remote : null) as never,
25
+ ref?.environmentId === "remote"
26
+ ? state.remote
27
+ : ref?.environmentId === "saved-vm"
28
+ ? state.cached
29
+ : null) as never,
30
useThreadRefs: (enabled = true) =>
31
enabled
32
? [{ environmentId: EnvironmentId.make("remote"), threadId: ThreadId.make("older-thread") }]
@@ -25,7 +38,13 @@ vi.mock(import("../../state/environments"), () => ({
38
useEnvironmentIdentities: () => [
39
{ environmentId: EnvironmentId.make("environment"), label: "Here" },
40
{ environmentId: EnvironmentId.make("remote"), label: "Remote" },
41
+ { environmentId: EnvironmentId.make("saved-vm"), label: "Saved VM" },
42
],
43
+ useConnectedEnvironmentIds: () => state.connected as never,
44
+}));
45
+vi.mock(import("../../state/peerLinks"), () => ({
46
+ useLinkedEnvironments: ((environmentId: string | null) =>
47
+ environmentId === null ? new Map() : state.linked) as never,
48
}));
49
vi.mock(import("../ProjectFavicon"), () => ({
50
ProjectFavicon: () => (
@@ -46,6 +65,10 @@ function setup() {
65
AsyncResult.AsyncResult<Record<string, { title: string; projectId: ProjectId | null }>, string>
66
>(AsyncResult.initial());
67
state.reply = reply;
68
+ state.linked = new Map();
69
+ state.cached = null;
70
+ state.connected = ["environment", "remote"];
71
+ useRightPanelStore.setState({ byThreadKey: {} });
72
state.remote = {
73
environmentId: EnvironmentId.make("remote"),
74
id: ThreadId.make("older-thread"),
@@ -161,3 +184,74 @@ it("names a thread on a machine this client has no connection to, without waitin
184
.toBeVisible();
185
await expect.element(screen.getByRole("link")).not.toBeInTheDocument();
186
});
187
+
188
+it.for([
189
+ { name: "a machine only this environment links to", linkedId: "linked-vm" },
190
+ { name: "a saved machine this client is not connected to", linkedId: "saved-vm" },
191
+])("opens a thread on $name as a read through the link", async ({ linkedId }) => {
192
+ const { registry } = setup();
193
+ using _registry = { [Symbol.dispose]: () => registry.dispose() };
194
+ state.linked = new Map([[linkedId, "fs-17"]]);
195
+ const environmentId = EnvironmentId.make("environment");
196
+ const link = { environmentId: EnvironmentId.make(linkedId), threadId: ThreadId.make("there") };
197
+ await using screen = await render(
198
+ <RegistryContext value={registry}>
199
+ <MarkdownThreadLink environmentId={environmentId} threadRef={HERE} link={link} label={null} />
200
+ </RegistryContext>,
201
+ );
202
+ const chip = screen.getByRole("button", { name: "Thread, Thread on fs-17" });
203
+ await chip.click();
204
+ const surface = linkedThreadSurface({
205
+ viaEnvironmentId: environmentId,
206
+ ...link,
207
+ label: "fs-17",
208
+ title: null,
209
+ });
210
+ expect(panel()).toMatchObject({ isOpen: true, activeSurfaceId: surface.id, surfaces: [surface] });
211
+ await chip.click();
212
+ expect(panel().surfaces).toHaveLength(1);
213
+ expect(screen.router?.state.location.pathname).toBe("/");
214
+});
215
+
216
+it("reads through the link when a disconnected machine's thread is only cached here", async () => {
217
+ const { registry } = setup();
218
+ using _registry = { [Symbol.dispose]: () => registry.dispose() };
219
+ state.linked = new Map([["saved-vm", "fs-17"]]);
220
+ state.cached = { id: ThreadId.make("there"), title: "Cached title", projectId: null };
221
+ const environmentId = EnvironmentId.make("environment");
222
+ const link = { environmentId: EnvironmentId.make("saved-vm"), threadId: ThreadId.make("there") };
223
+ await using screen = await render(
224
+ <RegistryContext value={registry}>
225
+ <MarkdownThreadLink environmentId={environmentId} threadRef={HERE} link={link} label={null} />
226
+ </RegistryContext>,
227
+ );
228
+ await screen.getByRole("button", { name: "Thread, Cached title" }).click();
229
+ expect(panel().surfaces).toEqual([
230
+ linkedThreadSurface({
231
+ viaEnvironmentId: environmentId,
232
+ ...link,
233
+ label: "fs-17",
234
+ title: "Cached title",
235
+ }),
236
+ ]);
237
+});
238
+
239
+it("opens a linked machine's thread directly once this client is connected to it", async () => {
240
+ const { registry, reply } = setup();
241
+ using _registry = { [Symbol.dispose]: () => registry.dispose() };
242
+ state.linked = new Map([["saved-vm", "fs-17"]]);
243
+ state.connected = ["environment", "saved-vm"];
244
+ registry.set(reply, AsyncResult.success({ there: { title: "Fix the build", projectId: null } }));
245
+ await using screen = await render(
246
+ <RegistryContext value={registry}>
247
+ <MarkdownThreadLink
248
+ environmentId={EnvironmentId.make("environment")}
249
+ threadRef={HERE}
250
+ link={{ environmentId: EnvironmentId.make("saved-vm"), threadId: ThreadId.make("there") }}
251
+ label={null}
252
+ />
253
+ </RegistryContext>,
254
+ );
255
+ await expect.element(screen.getByText("Fix the build")).toBeVisible();
256
+ await expect.element(screen.getByRole("button")).not.toBeInTheDocument();
257
+});
apps/web/src/components/chat/MarkdownThreadLink.tsx
+63
-4
@@ -1,5 +1,6 @@
1
-import type { EnvironmentId } from "@t3tools/contracts";
1
+import type { EnvironmentId, ScopedThreadRef } from "@t3tools/contracts";
2
import { useGT, useMessages } from "gt-react";
3
+import { MessagesSquareIcon } from "lucide-react";
4
import {
5
formatHostedThreadLink,
6
guessThreadLinkRef,
@@ -7,30 +8,53 @@ import {
8
type ThreadLink,
9
} from "@t3tools/shared/threadLinks";
10
import { unknownThreadLinkLabel } from "@t3tools/shared/threadLinksCopy";
11
+import { resolveLinkedThreadOpen } from "@t3tools/client-runtime/linked-thread";
12
13
import { configuredHostedAppUrl } from "../../hostedPairing";
14
import { useThreadRefs, useThreadShell } from "../../state/entities";
13
-import { useEnvironmentIdentities } from "../../state/environments";
15
+import { useConnectedEnvironmentIds, useEnvironmentIdentities } from "../../state/environments";
16
+import { useRightPanelStore } from "../../rightPanelStore";
17
+import { useLinkedEnvironments } from "../../state/peerLinks";
18
import { orchestrationEnvironment } from "../../state/orchestration";
19
import { useEnvironmentQuery } from "../../state/query";
20
+import { ContextChip, ContextChipLabel } from "../ContextChip";
21
import { UnresolvedChip } from "../contextChipParts";
22
import { ThreadContextChip } from "../ThreadContextChip";
23
+import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
24
25
/** `label` is the link's written text; an autolink has none. */
26
export function MarkdownThreadLink(props: {
27
readonly environmentId: EnvironmentId;
28
+ /** The thread the link is written in; a linked environment's thread opens in its right panel. */
29
+ readonly threadRef?: ScopedThreadRef | undefined;
30
readonly link: ThreadLink;
31
readonly label: string | null;
32
}) {
33
const gt = useGT();
34
const messages = useMessages();
35
+ const panelRef = props.threadRef;
36
const candidates = threadLinkCandidates(props.link, props.environmentId);
37
const writtenRef = candidates[0]!;
38
const written = useThreadShell(writtenRef);
30
- // A linked machine's threads are reachable only through its server, not from this client.
31
- const reachable = useEnvironmentIdentities().some(
39
+ const saved = useEnvironmentIdentities().some(
40
(environment) => environment.environmentId === writtenRef.environmentId,
41
);
42
+ const connected = useConnectedEnvironmentIds().includes(writtenRef.environmentId);
43
+ // A thread on a machine this client is not connected to still reads through the one that links to it.
44
+ const linkedLabel = useLinkedEnvironments(
45
+ connected || writtenRef.environmentId === props.environmentId ? null : props.environmentId,
46
+ ).get(writtenRef.environmentId);
47
+ // A shell cached from an earlier connection does not make the thread open there now. Outside a
48
+ // thread there is no panel to read it in, so the link behaves as it does without one.
49
+ const linked =
50
+ panelRef !== undefined &&
51
+ resolveLinkedThreadOpen({
52
+ environmentId: writtenRef.environmentId,
53
+ viaEnvironmentId: props.environmentId,
54
+ own: saved ? { connected } : undefined,
55
+ linked: linkedLabel !== undefined,
56
+ }) === "linked";
57
+ const reachable = saved && !linked;
58
const lookup = useEnvironmentQuery(
59
written === null && reachable
60
? orchestrationEnvironment.threadLinkMetadata({
@@ -58,6 +82,41 @@ export function MarkdownThreadLink(props: {
82
: null;
83
const remote = useThreadShell(remoteRef);
84
const resolved = target ?? (remoteRef && remote ? { ref: remoteRef, metadata: remote } : null);
85
+ if (linked && linkedLabel !== undefined) {
86
+ const knownTitle = props.label ?? written?.title ?? null;
87
+ const title = knownTitle ?? gt("Thread on {label}", { label: linkedLabel });
88
+ return (
89
+ <Tooltip>
90
+ <TooltipTrigger
91
+ render={
92
+ <ContextChip
93
+ kind="thread"
94
+ render={
95
+ <button
96
+ type="button"
97
+ onClick={() =>
98
+ useRightPanelStore.getState().openLinkedThread(panelRef, {
99
+ viaEnvironmentId: props.environmentId,
100
+ ...writtenRef,
101
+ label: linkedLabel,
102
+ title: knownTitle,
103
+ })
104
+ }
105
+ />
106
+ }
107
+ aria-label={gt("Thread, {title}", { title })}
108
+ >
109
+ <MessagesSquareIcon />
110
+ <ContextChipLabel>{title}</ContextChipLabel>
111
+ </ContextChip>
112
+ }
113
+ />
114
+ <TooltipPopup side="top">
115
+ {gt("Read the thread on {label}", { label: linkedLabel })}
116
+ </TooltipPopup>
117
+ </Tooltip>
118
+ );
119
+ }
120
if (missing && resolved === null) {
121
const unknown = unknownThreadLinkLabel(props.link, props.environmentId, messages);
122
return <UnresolvedChip label={props.label ?? unknown} tooltip={unknown} />;
apps/web/src/components/chat/ProviderSubagentBar.tsx
+52
-48
@@ -11,6 +11,11 @@ import { tickTextContent } from "~/lib/tickTextContent";
11
import type { ProviderInstanceEntry } from "../../providerInstances";
12
import { Button } from "../ui/button";
13
import { ProviderInstanceIcon } from "./ProviderInstanceIcon";
14
+import {
15
+ ReadOnlyComposerBar,
16
+ ReadOnlyComposerLead,
17
+ ReadOnlyComposerStatus,
18
+} from "./ReadOnlyComposerBar";
19
20
export function ProviderSubagentBar(props: {
21
readonly provider: ProviderInstanceEntry | null;
@@ -33,55 +38,54 @@ export function ProviderSubagentBar(props: {
38
messages,
39
);
40
36
- // Sized by the composer, not the viewport: a docked side panel narrows the
37
- // chat column on a wide window, and one row there squeezes out the model
38
- // and status, so the status drops to its own line instead.
41
return (
40
- <div className="flex min-h-12 items-center gap-3 rounded-2xl py-2 ps-5 pe-2 text-sm">
41
- <div className="flex min-w-0 flex-1 items-center gap-3 @max-[560px]/composer-surface:flex-col @max-[560px]/composer-surface:items-start @max-[560px]/composer-surface:gap-0.5">
42
- <span className="flex min-w-0 max-w-full items-center gap-2">
43
- {props.provider ? (
44
- <ProviderInstanceIcon
45
- driverKind={props.provider.driverKind}
46
- displayName={props.provider.displayName}
47
- accentColor={props.provider.accentColor}
48
- acpRegistryAgentId={props.provider.acpRegistryAgentId}
49
- acpRegistryIconUrl={props.provider.acpRegistryIconUrl}
50
- showBadge={props.showInstanceBadge}
51
- className="size-4 shrink-0"
52
- iconClassName="size-4"
53
- badgeClassName="right-[-0.125rem] bottom-[-0.125rem] h-3 min-w-3 px-0.5 text-5xs"
54
- />
55
- ) : null}
56
- <span className="min-w-0 truncate font-medium text-foreground">{props.modelLabel}</span>
57
- {props.effortLabel === null ? null : (
58
- <span className="shrink-0 text-muted-foreground">{props.effortLabel}</span>
59
- )}
60
- </span>
61
- <span
62
- ref={tickTextContent(
63
- (nowMs) => formatProviderSubagentStatus(status, nowMs, messages),
64
- live,
65
- )}
66
- aria-hidden
67
- className="min-w-0 max-w-full truncate text-muted-foreground tabular-nums @max-[560px]/composer-surface:text-xs"
68
- />
69
- </div>
70
- <span role="status" className="sr-only">
71
- {gt("{model} subagent: {status}", { model: modelDescription, status: announcement })}
72
- </span>
73
- <span className="shrink-0 text-muted-foreground @max-[640px]/composer-surface:sr-only">
74
- <T>Runs on its own</T>
75
- </span>
76
- {props.actions}
77
- {props.onOpenParent ? (
78
- <Button size="sm" variant="ghost" onClick={props.onOpenParent}>
79
- <ArrowUpLeftIcon />
80
- <span className="@max-[320px]/composer-surface:sr-only">
81
- <T>Open parent</T>
42
+ <ReadOnlyComposerBar
43
+ actions={
44
+ <>
45
+ <span role="status" className="sr-only">
46
+ {gt("{model} subagent: {status}", { model: modelDescription, status: announcement })}
47
</span>
83
- </Button>
84
- ) : null}
85
- </div>
48
+ <span className="shrink-0 text-muted-foreground @max-[640px]/composer-surface:sr-only">
49
+ <T>Runs on its own</T>
50
+ </span>
51
+ {props.actions}
52
+ {props.onOpenParent ? (
53
+ <Button size="sm" variant="ghost" onClick={props.onOpenParent}>
54
+ <ArrowUpLeftIcon />
55
+ <span className="@max-[320px]/composer-surface:sr-only">
56
+ <T>Open parent</T>
57
+ </span>
58
+ </Button>
59
+ ) : null}
60
+ </>
61
+ }
62
+ >
63
+ <ReadOnlyComposerLead>
64
+ {props.provider ? (
65
+ <ProviderInstanceIcon
66
+ driverKind={props.provider.driverKind}
67
+ displayName={props.provider.displayName}
68
+ accentColor={props.provider.accentColor}
69
+ acpRegistryAgentId={props.provider.acpRegistryAgentId}
70
+ acpRegistryIconUrl={props.provider.acpRegistryIconUrl}
71
+ showBadge={props.showInstanceBadge}
72
+ className="size-4 shrink-0"
73
+ iconClassName="size-4"
74
+ badgeClassName="right-[-0.125rem] bottom-[-0.125rem] h-3 min-w-3 px-0.5 text-5xs"
75
+ />
76
+ ) : null}
77
+ <span className="min-w-0 truncate font-medium text-foreground">{props.modelLabel}</span>
78
+ {props.effortLabel === null ? null : (
79
+ <span className="shrink-0 text-muted-foreground">{props.effortLabel}</span>
80
+ )}
81
+ </ReadOnlyComposerLead>
82
+ <ReadOnlyComposerStatus
83
+ ref={tickTextContent(
84
+ (nowMs) => formatProviderSubagentStatus(status, nowMs, messages),
85
+ live,
86
+ )}
87
+ aria-hidden
88
+ />
89
+ </ReadOnlyComposerBar>
90
);
91
}
apps/web/src/components/chat/ReadOnlyComposerBar.tsx
new
+37
@@ -0,0 +1,37 @@
1
+import type { ComponentProps, ReactNode } from "react";
2
+
3
+/**
4
+ * What stands where the composer would for a thread that takes no messages. `children` say what
5
+ * the thread is and how it is doing; `actions` sit at the trailing edge.
6
+ */
7
+export function ReadOnlyComposerBar(props: {
8
+ readonly children: ReactNode;
9
+ readonly actions?: ReactNode;
10
+}) {
11
+ // Sized by the composer, not the viewport: a docked side panel narrows the
12
+ // chat column on a wide window, and one row there squeezes out the lead
13
+ // and status, so the status drops to its own line instead.
14
+ return (
15
+ <div className="flex min-h-12 items-center gap-3 rounded-2xl py-2 ps-5 pe-2 text-sm">
16
+ <div className="flex min-w-0 flex-1 items-center gap-3 @max-[560px]/composer-surface:flex-col @max-[560px]/composer-surface:items-start @max-[560px]/composer-surface:gap-0.5">
17
+ {props.children}
18
+ </div>
19
+ {props.actions}
20
+ </div>
21
+ );
22
+}
23
+
24
+/** The bar's first line: an icon and what the thread is. */
25
+export function ReadOnlyComposerLead(props: { readonly children: ReactNode }) {
26
+ return <span className="flex min-w-0 max-w-full items-center gap-2">{props.children}</span>;
27
+}
28
+
29
+/** The bar's second line, which drops under the lead in a narrow composer. */
30
+export function ReadOnlyComposerStatus(props: Omit<ComponentProps<"span">, "className">) {
31
+ return (
32
+ <span
33
+ className="min-w-0 max-w-full truncate text-muted-foreground tabular-nums @max-[560px]/composer-surface:text-xs"
34
+ {...props}
35
+ />
36
+ );
37
+}
apps/web/src/components/chat/ReadOnlyThreadTimeline.tsx
new
+143
@@ -0,0 +1,143 @@
1
+import type { LegendListRef } from "@legendapp/list/react";
2
+import {
3
+ deriveRunlessWorkStartedAt,
4
+ deriveThreadActivityRun,
5
+ deriveThreadStructureRuntime,
6
+} from "@t3tools/client-runtime/state/thread-execution";
7
+import { createQuestionHistoryProjector } from "@t3tools/client-runtime/state/thread-requests";
8
+import {
9
+ EnvironmentId,
10
+ type OrchestrationV2ProjectedTurnItem,
11
+ type OrchestrationV2ThreadProjection,
12
+} from "@t3tools/contracts";
13
+import { useRef, useState, type ReactNode } from "react";
14
+
15
+import { useIncrementalTimelineEntries } from "~/hooks/useIncrementalTimelineEntries";
16
+import { useTheme } from "~/hooks/useTheme";
17
+import { deriveActiveWorkStartedAt, derivePhase } from "~/session-logic";
18
+import type { ChatFileAttachment } from "~/types";
19
+
20
+import type { ExpandedImagePreview } from "./ExpandedImagePreview";
21
+import { MessagesTimeline, type MessagesTimelineHistoryControls } from "./MessagesTimeline";
22
+import { ScrollToEndButton } from "./TimelineOverlays";
23
+import type { TimelineRow, TurnItemSource } from "./timelineRowContext";
24
+import { useTimelineFollow } from "./useTimelineFollow";
25
+
26
+// The timeline needs an environment id to key its rows. No environment answers to this one, so a
27
+// row that would ask the thread's environment for something gets nothing.
28
+const NO_ENVIRONMENT_ID = EnvironmentId.make("guest");
29
+const NO_TURN_DIFFS: ReadonlyArray<never> = [];
30
+const NO_OPTIMISTIC_MESSAGES: ReadonlyArray<never> = [];
31
+const ignore = () => {};
32
+
33
+/**
34
+ * A thread's own timeline, built from its projection alone and read-only: every action that would
35
+ * reach the thread's environment (fork, revert, reply, diffs, files, other threads, shell,
36
+ * approvals) is left out, so its control does not render. The guest page and a linked
37
+ * environment's thread both show a thread this way.
38
+ */
39
+export function ReadOnlyThreadTimeline(props: {
40
+ /** Keys the list. It holds no ":" so the timeline finds no environment thread behind it. */
41
+ readonly threadKey: string;
42
+ readonly projection: OrchestrationV2ThreadProjection;
43
+ readonly historyControls: MessagesTimelineHistoryControls | undefined;
44
+ /** Where expanded rows read an item's detail. */
45
+ readonly turnItemSource: TurnItemSource;
46
+ /** Preview URLs for the messages' attachments, keyed by attachment id. */
47
+ readonly attachmentUrls: (
48
+ items: ReadonlyArray<OrchestrationV2ProjectedTurnItem>,
49
+ ) => ReadonlyMap<string, string>;
50
+ readonly onImageExpand: (preview: ExpandedImagePreview) => void;
51
+ readonly onFileOpen: (file: ChatFileAttachment) => void;
52
+ readonly renderHtmlRender: (row: Extract<TimelineRow, { kind: "html-render" }>) => ReactNode;
53
+ readonly renderFooter?: (items: ReadonlyArray<OrchestrationV2ProjectedTurnItem>) => ReactNode;
54
+ /** What stands below the timeline, where the composer would. */
55
+ readonly children: (controls: { readonly scrollToEnd: () => void }) => ReactNode;
56
+}) {
57
+ const { threadKey, projection } = props;
58
+ const listRef = useRef<LegendListRef | null>(null);
59
+ const { resolvedTheme } = useTheme();
60
+ // The rest is what ChatView derives from the same projection.
61
+ const [projectQuestionHistory] = useState(() => createQuestionHistoryProjector());
62
+ const items = projectQuestionHistory(projection);
63
+ const entries = useIncrementalTimelineEntries(threadKey, {
64
+ visibleTurnItems: items,
65
+ optimisticMessages: NO_OPTIMISTIC_MESSAGES,
66
+ attachmentUrlById: props.attachmentUrls(items),
67
+ attempts: projection.attempts,
68
+ nodes: projection.nodes,
69
+ plans: projection.plans,
70
+ });
71
+ const activityRun = deriveThreadActivityRun(projection);
72
+ const runtime = deriveThreadStructureRuntime(projection);
73
+ const runlessWorkStartedAt = deriveRunlessWorkStartedAt(projection);
74
+ const isWorking = derivePhase(runtime) === "running" || runlessWorkStartedAt !== null;
75
+ const workStartedAt =
76
+ deriveActiveWorkStartedAt(activityRun, runtime, null) ?? runlessWorkStartedAt;
77
+ const runningRunId = runtime?.activeRunId ?? null;
78
+ const follow = useTimelineFollow({
79
+ legendListRef: listRef,
80
+ composerTimelineInset: 0,
81
+ routeThreadKey: threadKey,
82
+ activeThreadKey: threadKey,
83
+ // Not a server thread: new turns follow the end instead of anchoring near the top.
84
+ isServerThread: false,
85
+ serverProjection: null,
86
+ threadStatus: "live",
87
+ activeActivityRun: activityRun,
88
+ activeRunningTurnId: runningRunId,
89
+ timelineEntries: entries,
90
+ timelineAnchorMessageId: null,
91
+ setTimelineAnchor: ignore,
92
+ });
93
+ return (
94
+ <>
95
+ <div className="relative min-h-0 flex-1">
96
+ <MessagesTimeline
97
+ listRef={listRef}
98
+ timelineEntries={entries}
99
+ isWorking={isWorking}
100
+ activeTurnStartedAt={workStartedAt}
101
+ latestRun={activityRun}
102
+ runningRunId={runningRunId}
103
+ turnDiffSummaries={NO_TURN_DIFFS}
104
+ runs={projection.runs}
105
+ routeThreadKey={threadKey}
106
+ onOpenThread={ignore}
107
+ supportsConversationRollback={false}
108
+ onRevertToTurnCount={ignore}
109
+ isRevertingCheckpoint={false}
110
+ onImageExpand={props.onImageExpand}
111
+ onFileOpen={props.onFileOpen}
112
+ onFileDownload={props.onFileOpen}
113
+ renderHtmlRender={props.renderHtmlRender}
114
+ turnItemSource={props.turnItemSource}
115
+ historyControls={props.historyControls}
116
+ activeThreadEnvironmentId={NO_ENVIRONMENT_ID}
117
+ markdownCwd={undefined}
118
+ resolvedTheme={resolvedTheme}
119
+ timestampFormat="locale"
120
+ workspaceRoot={undefined}
121
+ anchorMessageId={null}
122
+ onAnchorReady={ignore}
123
+ onAnchorSizeChanged={ignore}
124
+ contentInsetEndAdjustment={0}
125
+ emptyPlaceholderInset={0}
126
+ liveFollowEnabled={follow.timelineLiveFollowEnabled}
127
+ onIsAtEndChange={follow.onIsAtEndChangeStable}
128
+ onViewportAttach={follow.attachTimelineViewport}
129
+ onFooterGrow={follow.onTimelineFooterGrowStable}
130
+ footer={props.renderFooter?.(items) ?? null}
131
+ />
132
+ {follow.showScrollToBottom ? (
133
+ <ScrollToEndButton
134
+ summary={null}
135
+ bottom={4}
136
+ onScrollToEnd={() => follow.scrollToEnd(true)}
137
+ />
138
+ ) : null}
139
+ </div>
140
+ {props.children({ scrollToEnd: () => follow.scrollToEnd(true) })}
141
+ </>
142
+ );
143
+}
apps/web/src/components/chat/RightPanelSurfaceContent.tsx
+10
@@ -12,6 +12,7 @@ import type {
12
} from "@t3tools/contracts";
13
import { scopedThreadKey } from "@t3tools/client-runtime/environment";
14
import { lazy, Suspense } from "react";
15
+import { LinkedThreadPane } from "./LinkedThreadPane";
16
import SideChatPane from "./SideChatPane";
17
import type { ComposerImageAttachment, DraftId } from "../../composerDraftStore";
18
import type { ShortcutMatchContext } from "../../keybindings";
@@ -223,6 +224,15 @@ export function RightPanelSurfaceContent(props: {
224
onClose={() => onCloseSurface(surface)}
225
/>
226
);
227
+ case "linked-thread":
228
+ return (
229
+ <LinkedThreadPane
230
+ key={surface.id}
231
+ panelRef={threadRef}
232
+ surface={surface}
233
+ visible={visible && props.activeSurfaceId === surface.id}
234
+ />
235
+ );
236
case "device":
237
return (
238
<Suspense fallback={null}>
apps/web/src/components/chat/ThreadRelationshipsControl.browser.test.tsx
+6
-1
@@ -45,6 +45,10 @@ vi.mock(import("../../state/environments"), () => ({
45
useEnvironment: (() => null) as never,
46
useEnvironmentProviders: (() => new Map()) as never,
47
}));
48
+vi.mock(import("../../state/peerLinks"), () => ({
49
+ peerLinkEnvironment: { readThread: {} } as never,
50
+ useLinkedEnvironments: (() => new Map()) as never,
51
+}));
52
vi.mock(import("../../lib/archivedThreadsState"), () => ({
53
useArchivedThreadSnapshots: (() => ({
54
snapshots: [{ environmentId: "environment", snapshot: { threads: state.archivedThreads } }],
@@ -330,8 +334,9 @@ it("shows a remote subagent's full title in its tooltip even when its environmen
334
await vi.waitFor(() =>
335
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),
336
);
337
+ // This client is not connected there, so the row reads the thread through this environment.
338
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(
334
- "Runs on Remote VM with a long machine name in the office. Connect to it to open the thread there.",
339
+ "Read the thread on Remote VM with a long machine name in the office",
340
);
341
342
await row.click({ force: true });
apps/web/src/components/chat/ThreadRelationshipsControl.tsx
+11
-23
@@ -37,6 +37,7 @@ import {
37
type OrchestrationV2RemoteTaskChild,
38
type OrchestrationV2Subagent,
39
type OrchestrationV2ThreadShell,
40
+ type ScopedThreadRef,
41
type ServerProvider,
42
type ThreadId,
43
} from "@t3tools/contracts";
@@ -62,6 +63,7 @@ import type { MessageResolver } from "~/i18n/messages";
63
64
import { useArchivedThreadSnapshots } from "../../lib/archivedThreadsState";
65
import { buildThreadRouteParams } from "../../threadRoutes";
66
+import { useLinkedThreadOpener } from "../../state/linkedThreadView";
67
import {
68
useProjects,
69
useQuietThreadProjection,
@@ -279,18 +281,18 @@ function currentSubagent<Agent extends RuntimeSubagent>(
281
}
282
283
/**
282
- * A task delegated to a linked environment. It has no thread here, so it opens
283
- * the thread there, when this client is connected to that environment.
284
+ * A task delegated to a linked environment. It has no thread here, so it opens the thread there:
285
+ * in place when this client is connected to that environment, else read-only through this one.
286
*/
287
function RemoteSubagentRow(props: {
288
readonly agent: RemoteSubagent;
289
+ /** The thread that delegated the task; its environment holds the link and its panel shows the read. */
290
+ readonly parentRef: ScopedThreadRef;
291
readonly provider: ServerProvider | undefined;
292
readonly anyInstanceBadge: boolean;
293
}) {
294
const gt = useGT();
295
const m = useMessages();
292
- const navigate = useNavigate();
293
- const environment = useEnvironment(props.agent.remoteChild.environmentId);
296
const { remoteChild } = props.agent;
297
const status = props.agent.status;
298
const failed = status === "failed";
@@ -298,27 +300,14 @@ function RemoteSubagentRow(props: {
300
title: props.agent.title ?? gt("Subagent"),
301
isSubagent: true,
302
});
303
+ const opener = useLinkedThreadOpener(props.parentRef, remoteChild, title);
304
return (
305
<li className="group relative flex h-8 items-center rounded-lg">
306
<Tooltip>
307
<TooltipTrigger
308
delay={200}
309
render={
307
- <ThreadDetailsControl
308
- size="sm"
309
- variant="ghost"
310
- part="row"
311
- aria-disabled={environment === null || undefined}
312
- onClick={() => {
313
- if (environment === null) return;
314
- void navigate({
315
- to: "/$environmentId/$threadId",
316
- params: buildThreadRouteParams(
317
- scopeThreadRef(remoteChild.environmentId, remoteChild.threadId),
318
- ),
319
- });
320
- }}
321
- />
310
+ <ThreadDetailsControl size="sm" variant="ghost" part="row" onClick={opener?.open} />
311
}
312
>
313
<ThreadRelationshipIcon
@@ -349,10 +338,8 @@ function RemoteSubagentRow(props: {
338
<LineageTooltipContent
339
title={title}
340
hint={
352
- environment === null
353
- ? gt("Runs on {label}. Connect to it to open the thread there.", {
354
- label: remoteChild.label,
355
- })
341
+ opener?.mode === "linked"
342
+ ? gt("Read the thread on {label}", { label: remoteChild.label })
343
: gt("Open on {label}", { label: remoteChild.label })
344
}
345
/>
@@ -1086,6 +1073,7 @@ export function ThreadRelationshipsPanel(props: {
1073
<RemoteSubagentRow
1074
key={row.remote.id}
1075
agent={row.remote}
1076
+ parentRef={ref}
1077
// Its provider instance belongs to the environment it runs in.
1078
provider={providersByEnvironment
1079
.get(row.remote.remoteChild.environmentId)
apps/web/src/components/chat/V2ItemInspector.tsx
+3
-1
@@ -246,7 +246,9 @@ export const V2ItemInspector = memo(function V2ItemInspector(props: V2ItemInspec
246
// Command rows stream their output, including the final output, from the server.
247
const environmentStreamsOutput = useCommandOutputStreaming(props.environmentId);
248
const streamsOutput =
249
- (props.source !== undefined || environmentStreamsOutput) &&
249
+ (props.source === undefined
250
+ ? environmentStreamsOutput
251
+ : props.source.commandOutput !== undefined) &&
252
props.projectedItem.item.type === "command_execution";
253
const fetched = useFetchedTurnItem(
254
props.projectedItem,
apps/web/src/components/chat/V2LifecycleRow.tsx
+4
-15
@@ -4,9 +4,7 @@ import { AgentElapsed } from "./AgentElapsed";
4
import { projectedSubagentsToRuntime } from "@t3tools/client-runtime/state/subagentRuntime";
5
import type { ReactNode } from "react";
6
import { useThreadShell, useProject } from "../../state/entities";
7
-import { useEnvironment } from "../../state/environments";
8
-import { buildThreadRouteParams } from "../../threadRoutes";
9
-import { useNavigate } from "@tanstack/react-router";
7
+import { useLinkedThreadOpener } from "../../state/linkedThreadView";
8
import { SubagentTooltipContent } from "./SubagentTooltipContent";
9
import { useAtomValue } from "@effect/atom-react";
10
import { scopeThreadRef, scopeProjectRef } from "@t3tools/client-runtime/environment";
@@ -451,22 +449,13 @@ function SubagentTimelineLink(props: {
449
(thread) => thread?.projection.subagents.find((agent) => agent.id === props.subagentId) ?? null,
450
);
451
const remote = props.remote ?? agent?.remoteChild;
454
- const remoteEnvironment = useEnvironment(remote?.environmentId ?? null);
452
const gt = useGT();
453
const m = useMessages();
457
- const navigate = useNavigate();
454
const threadId = props.threadId;
459
- // A task in a linked environment opens there, if this client is connected to it.
455
+ // A task in a linked environment opens there, or read-only through this one.
456
+ const remoteOpener = useLinkedThreadOpener(props.parentRef, remote, props.title);
457
const open =
461
- threadId !== null
462
- ? () => props.onOpenThread(threadId)
463
- : remote !== undefined && remoteEnvironment !== null
464
- ? () =>
465
- void navigate({
466
- to: "/$environmentId/$threadId",
467
- params: buildThreadRouteParams(scopeThreadRef(remote.environmentId, remote.threadId)),
468
- })
469
- : null;
458
+ threadId !== null ? () => props.onOpenThread(threadId) : (remoteOpener?.open ?? null);
459
const liveStatus = agent?.status ?? props.status;
460
const status = props.event ? props.event.status : liveStatus;
461
const statusLabel = props.event?.label ?? m(subagentStatusVisual(liveStatus).label);
apps/web/src/components/chat/timelineRowContext.ts
+2
-1
@@ -37,7 +37,8 @@ import { type HandoffTimelineRun } from "./V2LifecycleRow";
37
*/
38
export interface TurnItemSource {
39
readonly detail: TurnItemDetailSource;
40
- readonly commandOutput: (target: {
40
+ /** Unset where output does not stream: a command row then shows the output its detail holds. */
41
+ readonly commandOutput?: (target: {
42
readonly threadId: ThreadId;
43
readonly itemId: TurnItemId;
44
}) => Atom.Atom<AsyncResult.AsyncResult<CommandOutputView, unknown>>;
apps/web/src/components/guest/GuestPage.tsx
+34
-123
@@ -1,5 +1,4 @@
1
import {
2
- EnvironmentId,
2
GUEST_MESSAGE_MAX_LENGTH,
3
GUEST_HISTORY_ROUTE,
4
GUEST_NAME_MAX_LENGTH,
@@ -14,16 +13,9 @@ import {
13
type ThreadGuestMessage,
14
type ThreadGuestMessageStatus,
15
} from "@t3tools/contracts";
17
-import type { LegendListRef } from "@legendapp/list/react";
16
import * as Option from "effect/Option";
17
import * as Schema from "effect/Schema";
18
import { formatAttachmentSize } from "@t3tools/client-runtime/state/attachments";
21
-import {
22
- deriveRunlessWorkStartedAt,
23
- deriveThreadActivityRun,
24
- deriveThreadStructureRuntime,
25
-} from "@t3tools/client-runtime/state/thread-execution";
26
-import { createQuestionHistoryProjector } from "@t3tools/client-runtime/state/thread-requests";
19
import { ArrowUpIcon, PaperclipIcon, XIcon } from "lucide-react";
20
import {
21
useEffect,
@@ -38,24 +30,21 @@ import { msg, T, useGT, useMessages } from "gt-react";
30
31
import { m } from "~/i18n/messages";
32
41
-import { useIncrementalTimelineEntries } from "~/hooks/useIncrementalTimelineEntries";
33
import { useNowMinute } from "~/hooks/useNowMinute";
34
import { useStableCallback } from "~/hooks/useStableCallback";
35
import { useTheme } from "~/hooks/useTheme";
36
import { cn } from "~/lib/utils";
46
-import { deriveActiveWorkStartedAt, derivePhase } from "~/session-logic";
37
import { ComposerControl, ComposerControlIcon } from "../chat/ComposerControl";
38
import type { ExpandedImagePreview } from "../chat/ExpandedImagePreview";
39
import { GuestMessageAttachments } from "../chat/GuestMessageAttachments";
40
import { HostImageUrlContext } from "../chat/hostImageUrl";
41
import { PierreEntryIcon } from "../chat/PierreEntryIcon";
42
import { GuestMessageName, guestBubbleClassName } from "../chat/guestMessageStyle";
53
-import { MessagesTimeline, type MessagesTimelineHistoryControls } from "../chat/MessagesTimeline";
43
+import type { MessagesTimelineHistoryControls } from "../chat/MessagesTimeline";
44
+import { ReadOnlyThreadTimeline } from "../chat/ReadOnlyThreadTimeline";
45
import { ProviderInstanceIcon } from "../chat/ProviderInstanceIcon";
46
import { getDisplayModelName, getTriggerDisplayModelName } from "../chat/providerIconUtils";
56
-import { ScrollToEndButton } from "../chat/TimelineOverlays";
47
import type { TimelineRow } from "../chat/timelineRowContext";
58
-import { useTimelineFollow } from "../chat/useTimelineFollow";
48
import { GuestHtmlRender } from "./GuestHtmlRender";
49
import { Button } from "../ui/button";
50
import { Input } from "../ui/input";
@@ -410,17 +399,7 @@ function NameForm({
399
);
400
}
401
413
-// The timeline needs an environment id to key its rows. Nothing behind it loads on this page;
414
-// see isGuestPage.
415
-const GUEST_ENVIRONMENT_ID = EnvironmentId.make("guest");
416
-const NO_TURN_DIFFS: ReadonlyArray<never> = [];
417
-const NO_OPTIMISTIC_MESSAGES: ReadonlyArray<never> = [];
418
-const ignore = () => {};
419
-
420
-/**
421
- * The owner's timeline, read-only: every action that would reach the owner's machine (fork,
422
- * revert, diffs, files, other threads, shell) is left out, so its control does not render.
423
- */
402
+/** The owner's timeline, read-only, with the guest's own messages and composer below it. */
403
function GuestThread({
404
view: { shareId, title, expiresAt, messages, model },
405
projection,
@@ -432,124 +411,56 @@ function GuestThread({
411
readonly awaitingRowIds: GuestStreamState["awaitingRowIds"];
412
readonly historyControls: MessagesTimelineHistoryControls | undefined;
413
}) {
435
- // No ":" so the timeline finds no environment thread behind the key.
436
- const threadKey = `guest-${shareId}`;
437
- const listRef = useRef<LegendListRef | null>(null);
438
- const { resolvedTheme } = useTheme();
439
- // The rest is what ChatView derives from the same projection.
440
- const [projectQuestionHistory] = useState(() => createQuestionHistoryProjector());
441
- const items = projectQuestionHistory(projection);
414
// Files load through the guest route.
415
const [attachmentUrls] = useState(() => createGuestAttachmentUrls(shareId));
416
// Expanded rows read detail and command output through the guest routes.
417
const [turnItemSource] = useState(() => guestTurnItemSource(shareId));
446
- const attachmentUrlById = attachmentUrls(items);
447
- const entries = useIncrementalTimelineEntries(threadKey, {
448
- visibleTurnItems: items,
449
- optimisticMessages: NO_OPTIMISTIC_MESSAGES,
450
- attachmentUrlById,
451
- attempts: projection.attempts,
452
- nodes: projection.nodes,
453
- plans: projection.plans,
454
- });
418
const openFile = useStableCallback((file: { readonly id: string }) =>
419
openInNewTab(guestAttachmentUrl(shareId, file.id)),
420
);
421
const hostImageUrl = useStableCallback((path: string) => guestMediaUrl(shareId, path));
459
- const activityRun = deriveThreadActivityRun(projection);
460
- const runtime = deriveThreadStructureRuntime(projection);
461
- const runlessWorkStartedAt = deriveRunlessWorkStartedAt(projection);
462
- const isWorking = derivePhase(runtime) === "running" || runlessWorkStartedAt !== null;
463
- const workStartedAt =
464
- deriveActiveWorkStartedAt(activityRun, runtime, null) ?? runlessWorkStartedAt;
465
- const runningRunId = runtime?.activeRunId ?? null;
466
- const follow = useTimelineFollow({
467
- legendListRef: listRef,
468
- composerTimelineInset: 0,
469
- routeThreadKey: threadKey,
470
- activeThreadKey: threadKey,
471
- // Not a server thread: new turns follow the end instead of anchoring near the top.
472
- isServerThread: false,
473
- serverProjection: null,
474
- threadStatus: "live",
475
- activeActivityRun: activityRun,
476
- activeRunningTurnId: runningRunId,
477
- timelineEntries: entries,
478
- timelineAnchorMessageId: null,
479
- setTimelineAnchor: ignore,
480
- });
422
const renderHtmlRender = useStableCallback(
423
(row: Extract<TimelineRow, { kind: "html-render" }>) => (
424
<GuestHtmlRender itemId={row.id} reference={row.htmlRender} shareId={shareId} />
425
),
426
);
486
- const unplaced = unplacedGuestMessages(messages, items, awaitingRowIds);
427
return (
428
<>
429
<header className="flex shrink-0 items-center gap-3 border-b border-border px-4 py-2.5">
430
<h1 className="min-w-0 flex-1 truncate text-sm font-medium">{title}</h1>
431
<ExpiryLabel expiresAt={expiresAt} />
432
</header>
493
- <div className="relative min-h-0 flex-1">
494
- <HostImageUrlContext value={hostImageUrl}>
495
- <MessagesTimeline
496
- listRef={listRef}
497
- timelineEntries={entries}
498
- isWorking={isWorking}
499
- activeTurnStartedAt={workStartedAt}
500
- latestRun={activityRun}
501
- runningRunId={runningRunId}
502
- turnDiffSummaries={NO_TURN_DIFFS}
503
- runs={projection.runs}
504
- routeThreadKey={threadKey}
505
- onOpenThread={ignore}
506
- supportsConversationRollback={false}
507
- onRevertToTurnCount={ignore}
508
- isRevertingCheckpoint={false}
509
- onImageExpand={openExpandedImage}
510
- onFileOpen={openFile}
511
- onFileDownload={openFile}
512
- renderHtmlRender={renderHtmlRender}
513
- turnItemSource={turnItemSource}
514
- historyControls={historyControls}
515
- activeThreadEnvironmentId={GUEST_ENVIRONMENT_ID}
516
- markdownCwd={undefined}
517
- resolvedTheme={resolvedTheme}
518
- timestampFormat="locale"
519
- workspaceRoot={undefined}
520
- anchorMessageId={null}
521
- onAnchorReady={ignore}
522
- onAnchorSizeChanged={ignore}
523
- contentInsetEndAdjustment={0}
524
- emptyPlaceholderInset={0}
525
- liveFollowEnabled={follow.timelineLiveFollowEnabled}
526
- onIsAtEndChange={follow.onIsAtEndChangeStable}
527
- onViewportAttach={follow.attachTimelineViewport}
528
- onFooterGrow={follow.onTimelineFooterGrowStable}
529
- footer={
530
- unplaced.length === 0 ? null : (
531
- <ol className="chat-content-lane flex flex-col gap-4 pb-4">
532
- {unplaced.map((message) => (
533
- <li key={message.id}>
534
- <UnplacedGuestMessage shareId={shareId} message={message} />
535
- </li>
536
- ))}
537
- </ol>
538
- )
539
- }
540
- />
541
- </HostImageUrlContext>
542
- {follow.showScrollToBottom ? (
543
- <ScrollToEndButton
544
- summary={null}
545
- bottom={4}
546
- onScrollToEnd={() => follow.scrollToEnd(true)}
547
- />
548
- ) : null}
549
- </div>
550
- <div className={cn(LANE, "shrink-0 pb-4")}>
551
- <GuestComposer shareId={shareId} model={model} onSent={() => follow.scrollToEnd(true)} />
552
- </div>
433
+ <HostImageUrlContext value={hostImageUrl}>
434
+ <ReadOnlyThreadTimeline
435
+ // No ":" so the timeline finds no environment thread behind the key.
436
+ threadKey={`guest-${shareId}`}
437
+ projection={projection}
438
+ historyControls={historyControls}
439
+ turnItemSource={turnItemSource}
440
+ attachmentUrls={attachmentUrls}
441
+ onImageExpand={openExpandedImage}
442
+ onFileOpen={openFile}
443
+ renderHtmlRender={renderHtmlRender}
444
+ renderFooter={(items) => {
445
+ const unplaced = unplacedGuestMessages(messages, items, awaitingRowIds);
446
+ return unplaced.length === 0 ? null : (
447
+ <ol className="chat-content-lane flex flex-col gap-4 pb-4">
448
+ {unplaced.map((message) => (
449
+ <li key={message.id}>
450
+ <UnplacedGuestMessage shareId={shareId} message={message} />
451
+ </li>
452
+ ))}
453
+ </ol>
454
+ );
455
+ }}
456
+ >
457
+ {({ scrollToEnd }) => (
458
+ <div className={cn(LANE, "shrink-0 pb-4")}>
459
+ <GuestComposer shareId={shareId} model={model} onSent={scrollToEnd} />
460
+ </div>
461
+ )}
462
+ </ReadOnlyThreadTimeline>
463
+ </HostImageUrlContext>
464
</>
465
);
466
}
apps/web/src/components/guest/guestStream.logic.ts
+22
-69
@@ -10,31 +10,23 @@ import {
10
type GuestShareView,
11
type OrchestrationV2ProjectedTurnItem,
12
type OrchestrationV2ThreadHistoryPage,
13
- type OrchestrationV2ThreadProjection,
13
type OrchestrationV2TurnItem,
14
type ThreadGuestMessage,
15
} from "@t3tools/contracts";
16
import { msg } from "gt-react";
17
18
import { m, type MessageResolver } from "~/i18n/messages";
20
-import { applyOrchestrationV2ProjectionEvent } from "@t3tools/client-runtime/state/orchestration-v2-projection";
19
import {
22
- mergeOlderHistoryIntoProjection,
23
- mergeOlderSubagentsIntoProjection,
24
-} from "@t3tools/client-runtime/state/thread-history-merge";
25
-import { boundedSnapshotProjection } from "@t3tools/shared/orchestrationV2BoundedSnapshot";
20
+ applyThreadHistoryPage,
21
+ applyThreadStreamItem,
22
+ initialThreadStreamState,
23
+ type ThreadStreamState,
24
+} from "@t3tools/client-runtime/state/thread-stream";
25
import * as Option from "effect/Option";
26
import * as Schema from "effect/Schema";
27
29
-export interface GuestStreamState {
28
+export interface GuestStreamState extends ThreadStreamState {
29
readonly view: GuestShareView | null;
31
- /** The thread as the owner's client holds it, built with the same reducer. */
32
- readonly projection: OrchestrationV2ThreadProjection | null;
33
- readonly sequence: number;
34
- /** Set while the snapshot is a window of a longer history, as the owner's client tracks it. */
35
- readonly partial: { readonly latestLocalTurnOrdinal: number | null } | null;
36
- /** Where "Load earlier turns" continues, or null once the whole thread is loaded. */
37
- readonly historyCursor: string | null;
30
readonly ended: boolean;
31
/**
32
* Messages this page saw waiting that have no transcript row yet. Survives reconnects, and a
@@ -44,11 +36,8 @@ export interface GuestStreamState {
36
}
37
38
export const initialGuestStreamState: GuestStreamState = {
39
+ ...initialThreadStreamState,
40
view: null,
48
- projection: null,
49
- sequence: 0,
50
- partial: null,
51
- historyCursor: null,
41
ended: false,
42
awaitingRowIds: new Set(),
43
};
@@ -95,10 +84,8 @@ export type GuestHistoryPageLoaded = {
84
};
85
86
/**
98
- * Applies the owner's thread stream the way the owner's client does (see
99
- * EnvironmentThreadState in client-runtime): a snapshot replaces the thread, and later events
100
- * pass through the same projection reducer, once each. Older pages merge in front, as they do in
101
- * the owner's view.
87
+ * Applies the share's stream: its thread items go through the reducer every stream-only view of a
88
+ * thread shares, and the share's own state is tracked beside it.
89
*/
90
export function applyGuestStreamEvent(
91
state: GuestStreamState,
@@ -106,19 +93,15 @@ export function applyGuestStreamEvent(
93
): GuestStreamState {
94
switch (event.type) {
95
case "history-page": {
109
- // A snapshot since the request replaced the thread and its cursor.
110
- if (state.projection === null || state.historyCursor !== event.cursor) return state;
96
+ const next = applyThreadHistoryPage(state, event.cursor, event.page);
97
+ if (next === state) return state;
98
return {
99
...state,
113
- projection: mergeOlderSubagentsIntoProjection(
114
- mergeOlderHistoryIntoProjection(state.projection, event.page.items),
115
- event.page.subagents,
116
- ),
100
+ ...next,
101
awaitingRowIds: withoutPlaced(
102
state.awaitingRowIds,
103
event.page.items.map((row) => row.item),
104
),
121
- historyCursor: event.page.hasMoreHistory ? event.page.nextCursor : null,
105
};
106
}
107
case "view":
@@ -132,48 +115,18 @@ export function applyGuestStreamEvent(
115
awaitingRowIds: withPendingFrom(state.awaitingRowIds, event.view),
116
};
117
case "thread": {
135
- const item = event.item;
136
- if (item.kind === "snapshot") {
137
- const projection = boundedSnapshotProjection(item);
138
- return {
139
- ...state,
140
- projection,
141
- sequence: item.snapshotSequence,
142
- partial:
143
- item.hasMoreHistory === true || (item.historyCursor ?? null) !== null
144
- ? { latestLocalTurnOrdinal: item.latestLocalTurnOrdinal ?? null }
145
- : null,
146
- historyCursor: item.hasMoreHistory === true ? (item.historyCursor ?? null) : null,
147
- awaitingRowIds: withoutPlaced(
148
- state.awaitingRowIds,
149
- projection.visibleTurnItems.map((row) => row.item),
150
- ),
151
- };
152
- }
153
- if (item.kind === "synchronized" || item.sequence <= state.sequence) return state;
154
- if (item.kind === "unknown-event") return { ...state, sequence: item.sequence };
155
- const projection =
156
- applyOrchestrationV2ProjectionEvent(
157
- state.projection,
158
- item.event,
159
- state.partial === null ? undefined : { partialTimeline: true, ...state.partial },
160
- ) ?? state.projection;
161
- const turnItem = item.event.type === "turn-item.updated" ? item.event.payload : null;
162
- const watermark = state.partial?.latestLocalTurnOrdinal ?? null;
118
+ const next = applyThreadStreamItem(state, event.item);
119
+ if (next === state) return state;
120
+ const placed =
121
+ event.item.kind === "snapshot"
122
+ ? (next.projection?.visibleTurnItems.map((row) => row.item) ?? [])
123
+ : event.item.kind === "event" && event.item.event.type === "turn-item.updated"
124
+ ? [event.item.event.payload]
125
+ : [];
126
return {
127
...state,
165
- projection,
166
- sequence: item.sequence,
167
- partial:
168
- state.partial !== null &&
169
- turnItem !== null &&
170
- (watermark === null || turnItem.ordinal > watermark)
171
- ? { latestLocalTurnOrdinal: turnItem.ordinal }
172
- : state.partial,
173
- awaitingRowIds:
174
- turnItem === null
175
- ? state.awaitingRowIds
176
- : withoutPlaced(state.awaitingRowIds, [turnItem]),
128
+ ...next,
129
+ awaitingRowIds: withoutPlaced(state.awaitingRowIds, placed),
130
};
131
}
132
case "ended":
apps/web/src/i18n/translations/de.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Verknüpfen fehlgeschlagen: {failure}",
95
"acd01e781e2355cc": "Anfrage beendet",
96
"97e4c50a99272f63": "Die Anfrage konnte nicht beantwortet werden. Versuche es erneut.",
97
+ "605a491783d18b3f": "Dieser Thread konnte nicht über {via} gelesen werden",
98
+ "50f19209548b70d9": "{via} braucht möglicherweise ein Update, bevor es verknüpfte Threads lesen kann.",
99
+ "3d624e57d675358c": "Verknüpfte Umgebungen ist auf {via} deaktiviert",
100
+ "01b2231effdb835f": "Aktiviere es in den Einstellungen → Labs von {via}, um Threads auf den damit verknüpften Rechnern zu lesen.",
101
+ "e767e8901a0a3f35": "{via} ist nicht mehr mit {label} verknüpft",
102
+ "df3cd6ccd77084b4": "Verknüpfe es erneut in den Einstellungen → Verbindungen von {via}, um seine Threads von hier aus zu lesen.",
103
+ "3920637506407ca0": "Die Verknüpfung von {via} zu {label} ist abgelaufen",
104
+ "80fec3c2b4fba678": "Verknüpfe es erneut in den Einstellungen → Verbindungen von {via} mit einem neuen Kopplungscode.",
105
+ "fec50d228dc9aa9b": "{label} hat das Lesen abgelehnt",
106
+ "cd63d78559603b12": "Dieser Thread ist nicht mehr auf {label}",
107
+ "bd29efc163476e72": "Möglicherweise wurde er dort gelöscht.",
108
+ "f7870ef3a4828ab1": "{label} braucht ein Update",
109
+ "eabbf064657519ee": "{label} antwortet {via} nicht",
110
"f71597ae3afaef44": "{first} und {second}",
111
"4047174839a16714": "{first} und {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -2343,6 +2356,7 @@
2356
"ac0de2a59d9c8860": "Gerät",
2357
"1354df9fb7278843": "Einen iOS-Simulator oder Android-Emulator ansehen.",
2358
"fdcd9643e2e63b15": "Stelle eine Nebenfrage, während dieser Thread weiterarbeitet.",
2359
+ "1944f04b75ddf26d": "Thread auf {label}",
2360
"314cfeebf191ba0d": "Genehmigung nötig",
2361
"4e5b7363441a3831": "Eingabe nötig",
2362
"97af4e74a5f95e5e": "läuft",
@@ -3604,6 +3618,22 @@
3618
" verknüpft. Der Agent kann diese Verknüpfung so verwenden; ändere den Zugriff unter Einstellungen → Umgebungen."
3619
],
3620
"000b0df227182d39": "Andere Adresse…",
3621
+ "6bb5b1b35b2796ae": "Auf {label} über {via} · Arbeitet",
3622
+ "a73b7ab25d6e9bdf": "Auf {label} über {via}",
3623
+ "009e2ca841fdc1ef": "diese Umgebung",
3624
+ "8cb2e5692c4f05ab": "Öffne diesen Thread auf {label}, um diese Darstellung zu sehen.",
3625
+ "745a0b899008618c": "Frühere Runden konnten nicht geladen werden. Versuche es erneut.",
3626
+ "0014ce0aaf1bd68a": "Schreibgeschützt",
3627
+ "d0bda35aeec66684": [
3628
+ "Wird von ",
3629
+ {
3630
+ "i": 1,
3631
+ "k": "_gt_value_1",
3632
+ "v": "v"
3633
+ },
3634
+ " gelesen …"
3635
+ ],
3636
+ "c3e8cd9bf44e2f43": "Angezeigt wird, was zuvor gelesen wurde.",
3637
"eb6e0584cf4a2a1d": "Sprache: {language}",
3638
"d76c606a3c519b78": "Zeilenumbruch deaktivieren",
3639
"2b683498cee8c8a7": "Zeilen umbrechen",
@@ -3631,6 +3661,7 @@
3661
"6d329f7d3a50c7e7": "Tabelle kopieren",
3662
"6c71d251d9917587": "Als Markdown kopieren",
3663
"d510b122f84051a0": "Als CSV kopieren",
3664
+ "2912e4ac3697686b": "Thread auf {label} lesen",
3665
"ced684880c2e1961": "{server} erlauben, {tool} auszuführen?",
3666
"b66fa23b5647b62d": "Diese Nachricht von {server} senden?",
3667
"bae7f74153fa8a05": "{names} von {server} speichern?",
@@ -4163,7 +4194,6 @@
4194
"309b160785f6c473": "Fork in diesem Chat öffnen",
4195
"6676cd4b8299663f": "Übergeordneten Thread in diesem Chat öffnen",
4196
"63e8c7a0ef0513b5": "Verwandte Threads",
4166
- "68060b380fe53942": "Läuft auf {label}. Verbinde dich damit, um den Thread dort zu öffnen.",
4197
"9996d9dac573001a": "Auf {label} öffnen",
4198
"15a601a94893277f": "Der übergeordnete Thread konnte nicht geöffnet werden",
4199
"5eb43f554a5b7a58": "Der übergeordnete Thread wurde gelöscht",
@@ -5688,7 +5718,6 @@
5718
"4333d220c55ba5e4": "Abfrage des Arbeitsbereichs fehlgeschlagen.",
5719
"422c1671dfcfe474": "''{path}'' existiert nicht.",
5720
"20194b81e50497ad": "Ordner kann nicht geladen werden.",
5691
- "745a0b899008618c": "Frühere Runden konnten nicht geladen werden. Versuche es erneut.",
5721
"0061fff77e36bd4f": "Der Server ist nicht erreichbar.",
5722
"04dfdd46e3dd4a2e": "Etwas ist schiefgelaufen. Versuche es erneut.",
5723
"084bb2d8127a508d": "Gesendet",
@@ -5778,19 +5807,17 @@
5807
"56ca98b79cc9ce49": "Aktivität ({count})",
5808
"ddc5e5413923c471": "Du kannst hier nicht kommentieren.",
5809
"516def6f5a881e00": "Schließt dieses Issue",
5781
- "0014ce0aaf1bd68a": "Schreibgeschützt",
5810
"fd93f4720ff70aaf": "Keine",
5811
"b6a29fff7c7c0808": "Niemand",
5812
"54420465784bb1bd": "Ältere Kommentare laden",
5813
"9d82ebf35bfb4043": "Hier ist noch nichts passiert.",
5786
- "1cf216566c1ee064": "Projekt nicht verfügbar",
5814
"b5ddadeb0810688c": "Status",
5815
"93c1fc19d9bf1db0": "Beteiligung",
5816
"d5a8b335d88b65bc": "{hidden} ausgeblendet",
5817
"2160067266a61dd8": "Beliebig",
5818
"cd4ec4acf33c65b9": "{count, plural, one {{count} Label} other {{count} Labels}}",
5819
"bfd20acb8b7dee6b": "Beliebig",
5793
- "ad208e3e32c85029": "Alle ausblenden",
5820
+ "aead644e2cf1233f": "Alle anzeigen",
5821
"77ce79d865716719": "Keine passenden Projekte.",
5822
"af7eb4f9c7f0f575": "Filter",
5823
"08247dd39b0c85ff": "Zugewiesene Person",
@@ -6465,7 +6492,6 @@
6492
"64d0189be492147c": "Check-Details können nicht geöffnet werden",
6493
"600347ca50400a54": "Checks werden geladen…",
6494
"1b381201aba745c2": "Keine Checks gemeldet",
6468
- "aead644e2cf1233f": "Alle anzeigen",
6495
"a6d75a4380173c60": "Checks öffnen: {summary}",
6496
"be3d1766bad18693": "Checks: {summary}",
6497
"425e4a3d6c5c2867": "{count, plural, one {{count} fehlgeschlagen} other {{count} fehlgeschlagen}}",
@@ -9747,6 +9773,7 @@
9773
"51497bd401292062": "Gedrückt halten",
9774
"9d6cc6ac23312071": "Doppelt drücken",
9775
"f001fa7b329c8fbf": "Erfolgreiche ausblenden",
9776
+ "ad208e3e32c85029": "Alle ausblenden",
9777
"c80e4bb3201efd71": "Zen",
9778
"0cb9ffcd1fb46b0c": "Nur Status",
9779
"cf0f7fc3df26fa75": "Status und Nachrichten",
@@ -9956,6 +9983,7 @@
9983
"573ea5fdf293a9d6": "Alle Checkouts",
9984
"470ad8c54049d1e1": "Checkouts durchsuchen",
9985
"7e2dfdd9f97fc027": "Projektbereich",
9986
+ "1cf216566c1ee064": "Projekt nicht verfügbar",
9987
"c1b8c351aa90f319": [
9988
{
9989
"t": "span",
apps/web/src/i18n/translations/en.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Could not link: {failure}",
95
"acd01e781e2355cc": "Request ended",
96
"97e4c50a99272f63": "Could not answer the request. Try again.",
97
+ "605a491783d18b3f": "Could not read this thread through {via}",
98
+ "50f19209548b70d9": "{via} may need an update before it can read linked threads.",
99
+ "3d624e57d675358c": "Linked environments is off on {via}",
100
+ "01b2231effdb835f": "Turn it on in {via}'s Settings → Labs to read threads on the machines it links to.",
101
+ "e767e8901a0a3f35": "{via} is no longer linked to {label}",
102
+ "df3cd6ccd77084b4": "Link it again in {via}'s Settings → Connections to read its threads from here.",
103
+ "3920637506407ca0": "The link from {via} to {label} expired",
104
+ "80fec3c2b4fba678": "Link it again in {via}'s Settings → Connections with a new pairing code.",
105
+ "fec50d228dc9aa9b": "{label} refused the read",
106
+ "cd63d78559603b12": "This thread is no longer on {label}",
107
+ "bd29efc163476e72": "It may have been deleted there.",
108
+ "f7870ef3a4828ab1": "{label} needs an update",
109
+ "eabbf064657519ee": "{label} is not answering {via}",
110
"f71597ae3afaef44": "{first} and {second}",
111
"4047174839a16714": "{first}, and {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -2343,6 +2356,7 @@
2356
"ac0de2a59d9c8860": "Device",
2357
"1354df9fb7278843": "Watch an iOS Simulator or Android Emulator.",
2358
"fdcd9643e2e63b15": "Ask a side question while this thread keeps working.",
2359
+ "1944f04b75ddf26d": "Thread on {label}",
2360
"314cfeebf191ba0d": "needs approval",
2361
"4e5b7363441a3831": "needs input",
2362
"97af4e74a5f95e5e": "running",
@@ -3603,6 +3617,22 @@
3617
". The agent can use that link as it is; change its access in Settings → Environments."
3618
],
3619
"000b0df227182d39": "Another address…",
3620
+ "6bb5b1b35b2796ae": "On {label} via {via} · Working",
3621
+ "a73b7ab25d6e9bdf": "On {label} via {via}",
3622
+ "009e2ca841fdc1ef": "this environment",
3623
+ "8cb2e5692c4f05ab": "Open this thread on {label} to see this visual.",
3624
+ "745a0b899008618c": "Could not load earlier turns. Try again.",
3625
+ "0014ce0aaf1bd68a": "Read-only",
3626
+ "d0bda35aeec66684": [
3627
+ "Reading from ",
3628
+ {
3629
+ "i": 1,
3630
+ "k": "_gt_value_1",
3631
+ "v": "v"
3632
+ },
3633
+ "…"
3634
+ ],
3635
+ "c3e8cd9bf44e2f43": "Showing what was read before.",
3636
"eb6e0584cf4a2a1d": "Language: {language}",
3637
"d76c606a3c519b78": "Disable line wrap",
3638
"2b683498cee8c8a7": "Wrap lines",
@@ -3630,6 +3660,7 @@
3660
"6d329f7d3a50c7e7": "Copy table",
3661
"6c71d251d9917587": "Copy as Markdown",
3662
"d510b122f84051a0": "Copy as CSV",
3663
+ "2912e4ac3697686b": "Read the thread on {label}",
3664
"ced684880c2e1961": "Allow {server} to run {tool}?",
3665
"b66fa23b5647b62d": "Send this message from {server}?",
3666
"bae7f74153fa8a05": "Save {names} from {server}?",
@@ -4162,7 +4193,6 @@
4193
"309b160785f6c473": "Open fork in this chat",
4194
"6676cd4b8299663f": "Open parent thread in this chat",
4195
"63e8c7a0ef0513b5": "Related threads",
4165
- "68060b380fe53942": "Runs on {label}. Connect to it to open the thread there.",
4196
"9996d9dac573001a": "Open on {label}",
4197
"15a601a94893277f": "Could not open the parent thread",
4198
"5eb43f554a5b7a58": "The parent thread was deleted",
@@ -5689,7 +5719,6 @@
5719
"4333d220c55ba5e4": "Workspace query failed.",
5720
"422c1671dfcfe474": "''{path}'' does not exist.",
5721
"20194b81e50497ad": "Unable to load folder.",
5692
- "745a0b899008618c": "Could not load earlier turns. Try again.",
5722
"0061fff77e36bd4f": "Could not reach the server.",
5723
"04dfdd46e3dd4a2e": "Something went wrong. Try again.",
5724
"084bb2d8127a508d": "Sent",
@@ -5779,19 +5808,17 @@
5808
"56ca98b79cc9ce49": "Activity ({count})",
5809
"ddc5e5413923c471": "You cannot comment here.",
5810
"516def6f5a881e00": "Closes this issue",
5782
- "0014ce0aaf1bd68a": "Read-only",
5811
"fd93f4720ff70aaf": "None",
5812
"b6a29fff7c7c0808": "None",
5813
"54420465784bb1bd": "Load older comments",
5814
"9d82ebf35bfb4043": "Nothing has happened here yet.",
5787
- "1cf216566c1ee064": "Unavailable project",
5815
"b5ddadeb0810688c": "State",
5816
"93c1fc19d9bf1db0": "Involvement",
5817
"d5a8b335d88b65bc": "{hidden} hidden",
5818
"2160067266a61dd8": "Any",
5819
"cd4ec4acf33c65b9": "{count, plural, one {{count} label} other {{count} labels}}",
5820
"bfd20acb8b7dee6b": "Anyone",
5794
- "ad208e3e32c85029": "Hide all",
5821
+ "aead644e2cf1233f": "Show all",
5822
"77ce79d865716719": "No matching projects.",
5823
"af7eb4f9c7f0f575": "Filters",
5824
"08247dd39b0c85ff": "Assignee",
@@ -6472,7 +6499,6 @@
6499
"64d0189be492147c": "Unable to open check details",
6500
"600347ca50400a54": "Loading checks…",
6501
"1b381201aba745c2": "No checks reported",
6475
- "aead644e2cf1233f": "Show all",
6502
"a6d75a4380173c60": "Open checks: {summary}",
6503
"be3d1766bad18693": "Checks: {summary}",
6504
"425e4a3d6c5c2867": "{count, plural, one {{count} failed} other {{count} failed}}",
@@ -9756,6 +9782,7 @@
9782
"51497bd401292062": "Hold",
9783
"9d6cc6ac23312071": "Double press",
9784
"f001fa7b329c8fbf": "Hide successful",
9785
+ "ad208e3e32c85029": "Hide all",
9786
"c80e4bb3201efd71": "Zen",
9787
"0cb9ffcd1fb46b0c": "Status only",
9788
"cf0f7fc3df26fa75": "Status and messages",
@@ -9965,6 +9992,7 @@
9992
"573ea5fdf293a9d6": "All checkouts",
9993
"470ad8c54049d1e1": "Search checkouts",
9994
"7e2dfdd9f97fc027": "Project scope",
9995
+ "1cf216566c1ee064": "Unavailable project",
9996
"c1b8c351aa90f319": [
9997
{
9998
"t": "span",
apps/web/src/i18n/translations/es.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "No se pudo vincular: {failure}",
95
"acd01e781e2355cc": "Solicitud finalizada",
96
"97e4c50a99272f63": "No se pudo responder a la solicitud. Inténtalo de nuevo.",
97
+ "605a491783d18b3f": "No se pudo leer este hilo a través de {via}",
98
+ "50f19209548b70d9": "Puede que {via} necesite actualizarse para poder leer hilos vinculados.",
99
+ "3d624e57d675358c": "Entornos vinculados está desactivado en {via}",
100
+ "01b2231effdb835f": "Actívalo en Ajustes → Labs de {via} para leer hilos de las máquinas que vincula.",
101
+ "e767e8901a0a3f35": "{via} ya no está vinculado a {label}",
102
+ "df3cd6ccd77084b4": "Vuelve a vincularlo en Ajustes → Conexiones de {via} para leer sus hilos desde aquí.",
103
+ "3920637506407ca0": "El vínculo de {via} a {label} ha caducado",
104
+ "80fec3c2b4fba678": "Vuelve a vincularlo en Ajustes → Conexiones de {via} con un código de emparejamiento nuevo.",
105
+ "fec50d228dc9aa9b": "{label} rechazó la lectura",
106
+ "cd63d78559603b12": "Este hilo ya no está en {label}",
107
+ "bd29efc163476e72": "Puede que se haya eliminado allí.",
108
+ "f7870ef3a4828ab1": "{label} necesita una actualización",
109
+ "eabbf064657519ee": "{label} no responde a {via}",
110
"f71597ae3afaef44": "{first} y {second}",
111
"4047174839a16714": "{first} y {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -2343,6 +2356,7 @@
2356
"ac0de2a59d9c8860": "Dispositivo",
2357
"1354df9fb7278843": "Mira un simulador de iOS o un emulador de Android.",
2358
"fdcd9643e2e63b15": "Haz una pregunta aparte mientras este hilo sigue trabajando.",
2359
+ "1944f04b75ddf26d": "Hilo en {label}",
2360
"314cfeebf191ba0d": "necesita aprobación",
2361
"4e5b7363441a3831": "necesita respuesta",
2362
"97af4e74a5f95e5e": "en curso",
@@ -3603,6 +3617,22 @@
3617
". El agente puede usar ese vínculo tal cual; cambia su acceso en Ajustes → Entornos."
3618
],
3619
"000b0df227182d39": "Otra dirección…",
3620
+ "6bb5b1b35b2796ae": "En {label} a través de {via} · Trabajando",
3621
+ "a73b7ab25d6e9bdf": "En {label} a través de {via}",
3622
+ "009e2ca841fdc1ef": "este entorno",
3623
+ "8cb2e5692c4f05ab": "Abre este hilo en {label} para ver este elemento visual.",
3624
+ "745a0b899008618c": "No se pudieron cargar los turnos anteriores. Vuelve a intentarlo.",
3625
+ "0014ce0aaf1bd68a": "Solo lectura",
3626
+ "d0bda35aeec66684": [
3627
+ "Leyendo desde ",
3628
+ {
3629
+ "i": 1,
3630
+ "k": "_gt_value_1",
3631
+ "v": "v"
3632
+ },
3633
+ "…"
3634
+ ],
3635
+ "c3e8cd9bf44e2f43": "Se muestra lo que se leyó antes.",
3636
"eb6e0584cf4a2a1d": "Lenguaje: {language}",
3637
"d76c606a3c519b78": "Desactivar ajuste de línea",
3638
"2b683498cee8c8a7": "Ajustar líneas",
@@ -3630,6 +3660,7 @@
3660
"6d329f7d3a50c7e7": "Copiar tabla",
3661
"6c71d251d9917587": "Copiar como Markdown",
3662
"d510b122f84051a0": "Copiar como CSV",
3663
+ "2912e4ac3697686b": "Leer el hilo en {label}",
3664
"ced684880c2e1961": "¿Permitir que {server} ejecute {tool}?",
3665
"b66fa23b5647b62d": "¿Enviar este mensaje desde {server}?",
3666
"bae7f74153fa8a05": "¿Guardar {names} desde {server}?",
@@ -4160,7 +4191,6 @@
4191
"309b160785f6c473": "Abrir la bifurcación en este chat",
4192
"6676cd4b8299663f": "Abrir el hilo principal en este chat",
4193
"63e8c7a0ef0513b5": "Hilos relacionados",
4163
- "68060b380fe53942": "Se ejecuta en {label}. Conéctate para abrir el hilo allí.",
4194
"9996d9dac573001a": "Abrir en {label}",
4195
"15a601a94893277f": "No se pudo abrir el hilo principal",
4196
"5eb43f554a5b7a58": "El hilo principal se eliminó",
@@ -5687,7 +5717,6 @@
5717
"4333d220c55ba5e4": "Falló la consulta al espacio de trabajo.",
5718
"422c1671dfcfe474": "''{path}'' no existe.",
5719
"20194b81e50497ad": "No se puede cargar la carpeta.",
5690
- "745a0b899008618c": "No se pudieron cargar los turnos anteriores. Vuelve a intentarlo.",
5720
"0061fff77e36bd4f": "No se pudo acceder al servidor.",
5721
"04dfdd46e3dd4a2e": "Algo salió mal. Vuelve a intentarlo.",
5722
"084bb2d8127a508d": "Enviado",
@@ -5777,19 +5806,17 @@
5806
"56ca98b79cc9ce49": "Actividad ({count})",
5807
"ddc5e5413923c471": "No puedes comentar aquí.",
5808
"516def6f5a881e00": "Cierra esta issue",
5780
- "0014ce0aaf1bd68a": "Solo lectura",
5809
"fd93f4720ff70aaf": "Ninguna",
5810
"b6a29fff7c7c0808": "Nadie",
5811
"54420465784bb1bd": "Cargar comentarios anteriores",
5812
"9d82ebf35bfb4043": "Aquí no ha pasado nada todavía.",
5785
- "1cf216566c1ee064": "Proyecto no disponible",
5813
"b5ddadeb0810688c": "Estado",
5814
"93c1fc19d9bf1db0": "Participación",
5815
"d5a8b335d88b65bc": "{hidden} ocultos",
5816
"2160067266a61dd8": "Cualquiera",
5817
"cd4ec4acf33c65b9": "{count, plural, one {{count} etiqueta} other {{count} etiquetas}}",
5818
"bfd20acb8b7dee6b": "Cualquiera",
5792
- "ad208e3e32c85029": "Ocultar todo",
5819
+ "aead644e2cf1233f": "Mostrar todo",
5820
"77ce79d865716719": "No hay proyectos que coincidan.",
5821
"af7eb4f9c7f0f575": "Filtros",
5822
"08247dd39b0c85ff": "Asignado",
@@ -6465,7 +6492,6 @@
6492
"64d0189be492147c": "No se pueden abrir los detalles de la comprobación",
6493
"600347ca50400a54": "Cargando comprobaciones…",
6494
"1b381201aba745c2": "No se informó de ninguna comprobación",
6468
- "aead644e2cf1233f": "Mostrar todo",
6495
"a6d75a4380173c60": "Abrir comprobaciones: {summary}",
6496
"be3d1766bad18693": "Comprobaciones: {summary}",
6497
"425e4a3d6c5c2867": "{count, plural, one {{count} con errores} other {{count} con errores}}",
@@ -9744,6 +9770,7 @@
9770
"51497bd401292062": "Mantener pulsado",
9771
"9d6cc6ac23312071": "Doble pulsación",
9772
"f001fa7b329c8fbf": "Ocultar las correctas",
9773
+ "ad208e3e32c85029": "Ocultar todo",
9774
"c80e4bb3201efd71": "Zen",
9775
"0cb9ffcd1fb46b0c": "Solo el estado",
9776
"cf0f7fc3df26fa75": "Estado y mensajes",
@@ -9953,6 +9980,7 @@
9980
"573ea5fdf293a9d6": "Todos los checkouts",
9981
"470ad8c54049d1e1": "Buscar checkouts",
9982
"7e2dfdd9f97fc027": "Ámbito de proyectos",
9983
+ "1cf216566c1ee064": "Proyecto no disponible",
9984
"c1b8c351aa90f319": [
9985
{
9986
"t": "span",
apps/web/src/i18n/translations/fr.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Association impossible : {failure}",
95
"acd01e781e2355cc": "Demande terminée",
96
"97e4c50a99272f63": "Impossible de répondre à la demande. Réessayez.",
97
+ "605a491783d18b3f": "Impossible de lire ce fil via {via}",
98
+ "50f19209548b70d9": "{via} a peut-être besoin d’une mise à jour pour lire les fils associés.",
99
+ "3d624e57d675358c": "Les environnements associés sont désactivés sur {via}",
100
+ "01b2231effdb835f": "Activez-les dans Paramètres → Labs de {via} pour lire les fils des machines qui lui sont associées.",
101
+ "e767e8901a0a3f35": "{via} n’est plus associé à {label}",
102
+ "df3cd6ccd77084b4": "Associez-le à nouveau dans Paramètres → Connexions de {via} pour lire ses fils d’ici.",
103
+ "3920637506407ca0": "L’association de {via} à {label} a expiré",
104
+ "80fec3c2b4fba678": "Associez-le à nouveau dans Paramètres → Connexions de {via} avec un nouveau code d’appairage.",
105
+ "fec50d228dc9aa9b": "{label} a refusé la lecture",
106
+ "cd63d78559603b12": "Ce fil n’est plus sur {label}",
107
+ "bd29efc163476e72": "Il a peut-être été supprimé là-bas.",
108
+ "f7870ef3a4828ab1": "{label} a besoin d’une mise à jour",
109
+ "eabbf064657519ee": "{label} ne répond pas à {via}",
110
"f71597ae3afaef44": "{first} et {second}",
111
"4047174839a16714": "{first} et {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -2343,6 +2356,7 @@
2356
"ac0de2a59d9c8860": "Appareil",
2357
"1354df9fb7278843": "Regardez un simulateur iOS ou un émulateur Android.",
2358
"fdcd9643e2e63b15": "Posez une question annexe pendant que ce fil continue de travailler.",
2359
+ "1944f04b75ddf26d": "Fil sur {label}",
2360
"314cfeebf191ba0d": "approbation requise",
2361
"4e5b7363441a3831": "réponse requise",
2362
"97af4e74a5f95e5e": "en cours",
@@ -3603,6 +3617,22 @@
3617
". L’agent peut utiliser cette association telle quelle ; modifiez son accès dans Paramètres → Environnements."
3618
],
3619
"000b0df227182d39": "Autre adresse…",
3620
+ "6bb5b1b35b2796ae": "Sur {label} via {via} · En cours",
3621
+ "a73b7ab25d6e9bdf": "Sur {label} via {via}",
3622
+ "009e2ca841fdc1ef": "cet environnement",
3623
+ "8cb2e5692c4f05ab": "Ouvrez ce fil sur {label} pour voir ce visuel.",
3624
+ "745a0b899008618c": "Impossible de charger les tours précédents. Réessayez.",
3625
+ "0014ce0aaf1bd68a": "Lecture seule",
3626
+ "d0bda35aeec66684": [
3627
+ "Lecture depuis ",
3628
+ {
3629
+ "i": 1,
3630
+ "k": "_gt_value_1",
3631
+ "v": "v"
3632
+ },
3633
+ "…"
3634
+ ],
3635
+ "c3e8cd9bf44e2f43": "Affichage de ce qui a été lu auparavant.",
3636
"eb6e0584cf4a2a1d": "Langage : {language}",
3637
"d76c606a3c519b78": "Désactiver le retour à la ligne",
3638
"2b683498cee8c8a7": "Retour à la ligne",
@@ -3630,6 +3660,7 @@
3660
"6d329f7d3a50c7e7": "Copier le tableau",
3661
"6c71d251d9917587": "Copier en Markdown",
3662
"d510b122f84051a0": "Copier en CSV",
3663
+ "2912e4ac3697686b": "Lire le fil sur {label}",
3664
"ced684880c2e1961": "Autoriser {server} à exécuter {tool} ?",
3665
"b66fa23b5647b62d": "Envoyer ce message depuis {server} ?",
3666
"bae7f74153fa8a05": "Enregistrer {names} depuis {server} ?",
@@ -4161,7 +4192,6 @@
4192
"309b160785f6c473": "Ouvrir le fork dans cette discussion",
4193
"6676cd4b8299663f": "Ouvrir le fil parent dans cette discussion",
4194
"63e8c7a0ef0513b5": "Fils liés",
4164
- "68060b380fe53942": "S’exécute sur {label}. Connectez-vous-y pour y ouvrir le fil.",
4195
"9996d9dac573001a": "Ouvrir sur {label}",
4196
"15a601a94893277f": "Impossible d’ouvrir le fil parent",
4197
"5eb43f554a5b7a58": "Le fil parent a été supprimé",
@@ -5688,7 +5718,6 @@
5718
"4333d220c55ba5e4": "Échec de la requête sur l’espace de travail.",
5719
"422c1671dfcfe474": "''{path}'' n’existe pas.",
5720
"20194b81e50497ad": "Impossible de charger le dossier.",
5691
- "745a0b899008618c": "Impossible de charger les tours précédents. Réessayez.",
5721
"0061fff77e36bd4f": "Impossible de joindre le serveur.",
5722
"04dfdd46e3dd4a2e": "Une erreur s’est produite. Réessayez.",
5723
"084bb2d8127a508d": "Envoyé",
@@ -5778,19 +5807,17 @@
5807
"56ca98b79cc9ce49": "Activité ({count})",
5808
"ddc5e5413923c471": "Vous ne pouvez pas commenter ici.",
5809
"516def6f5a881e00": "Ferme ce ticket",
5781
- "0014ce0aaf1bd68a": "Lecture seule",
5810
"fd93f4720ff70aaf": "Aucun",
5811
"b6a29fff7c7c0808": "Personne",
5812
"54420465784bb1bd": "Charger les commentaires plus anciens",
5813
"9d82ebf35bfb4043": "Rien ne s’est encore passé ici.",
5786
- "1cf216566c1ee064": "Projet indisponible",
5814
"b5ddadeb0810688c": "État",
5815
"93c1fc19d9bf1db0": "Participation",
5816
"d5a8b335d88b65bc": "{hidden} masqués",
5817
"2160067266a61dd8": "Tous",
5818
"cd4ec4acf33c65b9": "{count, plural, one {{count} libellé} other {{count} libellés}}",
5819
"bfd20acb8b7dee6b": "N’importe qui",
5793
- "ad208e3e32c85029": "Tout masquer",
5820
+ "aead644e2cf1233f": "Tout afficher",
5821
"77ce79d865716719": "Aucun projet correspondant.",
5822
"af7eb4f9c7f0f575": "Filtres",
5823
"08247dd39b0c85ff": "Assigné",
@@ -6466,7 +6493,6 @@
6493
"64d0189be492147c": "Impossible d’ouvrir les détails du check",
6494
"600347ca50400a54": "Chargement des checks…",
6495
"1b381201aba745c2": "Aucun check signalé",
6469
- "aead644e2cf1233f": "Tout afficher",
6496
"a6d75a4380173c60": "Ouvrir les checks : {summary}",
6497
"be3d1766bad18693": "Checks : {summary}",
6498
"425e4a3d6c5c2867": "{count, plural, one {{count} en échec} other {{count} en échec}}",
@@ -9746,6 +9772,7 @@
9772
"51497bd401292062": "Appui long",
9773
"9d6cc6ac23312071": "Double appui",
9774
"f001fa7b329c8fbf": "Masquer les réussis",
9775
+ "ad208e3e32c85029": "Tout masquer",
9776
"c80e4bb3201efd71": "Zen",
9777
"0cb9ffcd1fb46b0c": "Statut uniquement",
9778
"cf0f7fc3df26fa75": "Statut et messages",
@@ -9955,6 +9982,7 @@
9982
"573ea5fdf293a9d6": "Tous les checkouts",
9983
"470ad8c54049d1e1": "Rechercher des checkouts",
9984
"7e2dfdd9f97fc027": "Portée des projets",
9985
+ "1cf216566c1ee064": "Projet indisponible",
9986
"c1b8c351aa90f319": [
9987
{
9988
"t": "span",
apps/web/src/i18n/translations/ja.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "リンクできませんでした: {failure}",
95
"acd01e781e2355cc": "リクエストが終了しました",
96
"97e4c50a99272f63": "リクエストに応答できませんでした。もう一度お試しください。",
97
+ "605a491783d18b3f": "{via} 経由でこのスレッドを読み取れませんでした",
98
+ "50f19209548b70d9": "リンクされたスレッドを読み取るには、{via} の更新が必要な可能性があります。",
99
+ "3d624e57d675358c": "{via} でリンクされた環境がオフになっています",
100
+ "01b2231effdb835f": "{via} の設定 → Labs でオンにすると、リンク先のマシンのスレッドを読み取れます。",
101
+ "e767e8901a0a3f35": "{via} は {label} にリンクされていません",
102
+ "df3cd6ccd77084b4": "ここからスレッドを読み取るには、{via} の設定 → 接続で再度リンクしてください。",
103
+ "3920637506407ca0": "{via} から {label} へのリンクは期限切れです",
104
+ "80fec3c2b4fba678": "{via} の設定 → 接続で、新しいペアリングコードを使って再度リンクしてください。",
105
+ "fec50d228dc9aa9b": "{label} が読み取りを拒否しました",
106
+ "cd63d78559603b12": "このスレッドはもう {label} にありません",
107
+ "bd29efc163476e72": "そちらで削除された可能性があります。",
108
+ "f7870ef3a4828ab1": "{label} の更新が必要です",
109
+ "eabbf064657519ee": "{label} が {via} に応答していません",
110
"f71597ae3afaef44": "{first} と {second}",
111
"4047174839a16714": "{first}、{last}",
112
"65ca7867c176afbf": "{first}、{rest}",
@@ -2341,6 +2354,7 @@
2354
"ac0de2a59d9c8860": "デバイス",
2355
"1354df9fb7278843": "iOS シミュレーターまたは Android エミュレーターを表示します。",
2356
"fdcd9643e2e63b15": "このスレッドの作業を続けたまま、別の質問をします。",
2357
+ "1944f04b75ddf26d": "{label} のスレッド",
2358
"314cfeebf191ba0d": "承認が必要",
2359
"4e5b7363441a3831": "入力が必要",
2360
"97af4e74a5f95e5e": "実行中",
@@ -3598,6 +3612,22 @@
3612
" にリンクされています。エージェントはそのリンクをそのまま使用できます。アクセス権は [設定] → [環境] で変更してください。"
3613
],
3614
"000b0df227182d39": "別のアドレス…",
3615
+ "6bb5b1b35b2796ae": "{label}({via} 経由) · 作業中",
3616
+ "a73b7ab25d6e9bdf": "{label}({via} 経由)",
3617
+ "009e2ca841fdc1ef": "この環境",
3618
+ "8cb2e5692c4f05ab": "このビジュアルを見るには、{label} でこのスレッドを開いてください。",
3619
+ "745a0b899008618c": "以前のターンを読み込めませんでした。もう一度お試しください。",
3620
+ "0014ce0aaf1bd68a": "読み取り専用",
3621
+ "d0bda35aeec66684": [
3622
+ "読み取り中: ",
3623
+ {
3624
+ "i": 1,
3625
+ "k": "_gt_value_1",
3626
+ "v": "v"
3627
+ },
3628
+ "…"
3629
+ ],
3630
+ "c3e8cd9bf44e2f43": "以前に読み取った内容を表示しています。",
3631
"eb6e0584cf4a2a1d": "言語: {language}",
3632
"d76c606a3c519b78": "行の折り返しを無効にする",
3633
"2b683498cee8c8a7": "行を折り返す",
@@ -3625,6 +3655,7 @@
3655
"6d329f7d3a50c7e7": "表をコピー",
3656
"6c71d251d9917587": "Markdown としてコピー",
3657
"d510b122f84051a0": "CSV としてコピー",
3658
+ "2912e4ac3697686b": "{label} のスレッドを読む",
3659
"ced684880c2e1961": "{server} に {tool} の実行を許可しますか?",
3660
"b66fa23b5647b62d": "{server} からこのメッセージを送信しますか?",
3661
"bae7f74153fa8a05": "{server} からの {names} を保存しますか?",
@@ -4151,7 +4182,6 @@
4182
"309b160785f6c473": "このチャットでフォークを開く",
4183
"6676cd4b8299663f": "このチャットで親スレッドを開く",
4184
"63e8c7a0ef0513b5": "関連するスレッド",
4154
- "68060b380fe53942": "{label} で実行されています。そこでスレッドを開くには接続してください。",
4185
"9996d9dac573001a": "{label} で開く",
4186
"15a601a94893277f": "親スレッドを開けませんでした",
4187
"5eb43f554a5b7a58": "親スレッドは削除されました",
@@ -5670,7 +5700,6 @@
5700
"4333d220c55ba5e4": "ワークスペースのクエリに失敗しました。",
5701
"422c1671dfcfe474": "''{path}'' は存在しません。",
5702
"20194b81e50497ad": "フォルダーを読み込めません。",
5673
- "745a0b899008618c": "以前のターンを読み込めませんでした。もう一度お試しください。",
5703
"0061fff77e36bd4f": "サーバーに接続できませんでした。",
5704
"04dfdd46e3dd4a2e": "問題が発生しました。もう一度お試しください。",
5705
"084bb2d8127a508d": "送信済み",
@@ -5760,19 +5789,17 @@
5789
"56ca98b79cc9ce49": "アクティビティ ({count})",
5790
"ddc5e5413923c471": "ここではコメントできません。",
5791
"516def6f5a881e00": "この Issue をクローズします",
5763
- "0014ce0aaf1bd68a": "読み取り専用",
5792
"fd93f4720ff70aaf": "なし",
5793
"b6a29fff7c7c0808": "なし",
5794
"54420465784bb1bd": "以前のコメントを読み込む",
5795
"9d82ebf35bfb4043": "まだアクティビティはありません。",
5768
- "1cf216566c1ee064": "利用できないプロジェクト",
5796
"b5ddadeb0810688c": "状態",
5797
"93c1fc19d9bf1db0": "関与",
5798
"d5a8b335d88b65bc": "{hidden} 件非表示",
5799
"2160067266a61dd8": "すべて",
5800
"cd4ec4acf33c65b9": "{count, plural, other {{count} 個のラベル}}",
5801
"bfd20acb8b7dee6b": "すべてのユーザー",
5775
- "ad208e3e32c85029": "すべて非表示",
5802
+ "aead644e2cf1233f": "すべて表示",
5803
"77ce79d865716719": "一致するプロジェクトはありません。",
5804
"af7eb4f9c7f0f575": "フィルター",
5805
"08247dd39b0c85ff": "担当者",
@@ -6435,7 +6462,6 @@
6462
"64d0189be492147c": "チェックの詳細を開けません",
6463
"600347ca50400a54": "チェックを読み込んでいます…",
6464
"1b381201aba745c2": "報告されたチェックはありません",
6438
- "aead644e2cf1233f": "すべて表示",
6465
"a6d75a4380173c60": "チェックを開く: {summary}",
6466
"be3d1766bad18693": "チェック: {summary}",
6467
"425e4a3d6c5c2867": "{count, plural, other {{count} 件失敗}}",
@@ -9698,6 +9724,7 @@
9724
"51497bd401292062": "長押し",
9725
"9d6cc6ac23312071": "2 回押し",
9726
"f001fa7b329c8fbf": "成功したものを非表示",
9727
+ "ad208e3e32c85029": "すべて非表示",
9728
"c80e4bb3201efd71": "Zen",
9729
"0cb9ffcd1fb46b0c": "ステータスのみ",
9730
"cf0f7fc3df26fa75": "ステータスとメッセージ",
@@ -9907,6 +9934,7 @@
9934
"573ea5fdf293a9d6": "すべてのチェックアウト",
9935
"470ad8c54049d1e1": "チェックアウトを検索",
9936
"7e2dfdd9f97fc027": "プロジェクトの範囲",
9937
+ "1cf216566c1ee064": "利用できないプロジェクト",
9938
"c1b8c351aa90f319": [
9939
{
9940
"t": "span",
apps/web/src/i18n/translations/ko.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "연결할 수 없음: {failure}",
95
"acd01e781e2355cc": "요청 종료됨",
96
"97e4c50a99272f63": "요청에 응답할 수 없습니다. 다시 시도하세요.",
97
+ "605a491783d18b3f": "{via}을(를) 통해 이 스레드를 읽지 못했습니다",
98
+ "50f19209548b70d9": "연결된 스레드를 읽으려면 {via}을(를) 업데이트해야 할 수 있습니다.",
99
+ "3d624e57d675358c": "{via}에서 연결된 환경이 꺼져 있습니다",
100
+ "01b2231effdb835f": "{via}의 설정 → Labs에서 켜면 연결된 기기의 스레드를 읽을 수 있습니다.",
101
+ "e767e8901a0a3f35": "{via}이(가) 더 이상 {label}에 연결되어 있지 않습니다",
102
+ "df3cd6ccd77084b4": "여기에서 스레드를 읽으려면 {via}의 설정 → 연결에서 다시 연결하세요.",
103
+ "3920637506407ca0": "{via}에서 {label}(으)로의 연결이 만료되었습니다",
104
+ "80fec3c2b4fba678": "{via}의 설정 → 연결에서 새 페어링 코드로 다시 연결하세요.",
105
+ "fec50d228dc9aa9b": "{label}이(가) 읽기를 거부했습니다",
106
+ "cd63d78559603b12": "이 스레드는 더 이상 {label}에 없습니다",
107
+ "bd29efc163476e72": "그곳에서 삭제되었을 수 있습니다.",
108
+ "f7870ef3a4828ab1": "{label}을(를) 업데이트해야 합니다",
109
+ "eabbf064657519ee": "{label}이(가) {via}에 응답하지 않습니다",
110
"f71597ae3afaef44": "{first} 및 {second}",
111
"4047174839a16714": "{first} 및 {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -2342,6 +2355,7 @@
2355
"ac0de2a59d9c8860": "기기",
2356
"1354df9fb7278843": "iOS 시뮬레이터나 Android 에뮬레이터를 봅니다.",
2357
"fdcd9643e2e63b15": "이 스레드가 계속 작업하는 동안 곁가지 질문을 하세요.",
2358
+ "1944f04b75ddf26d": "{label}의 스레드",
2359
"314cfeebf191ba0d": "승인 필요",
2360
"4e5b7363441a3831": "입력 필요",
2361
"97af4e74a5f95e5e": "실행 중",
@@ -3598,6 +3612,22 @@
3612
"에 연결되어 있습니다. 에이전트는 이 연결을 그대로 사용할 수 있으며, 액세스는 설정 → 환경에서 변경하세요."
3613
],
3614
"000b0df227182d39": "다른 주소…",
3615
+ "6bb5b1b35b2796ae": "{label} ({via} 경유) · 작업 중",
3616
+ "a73b7ab25d6e9bdf": "{label} ({via} 경유)",
3617
+ "009e2ca841fdc1ef": "이 환경",
3618
+ "8cb2e5692c4f05ab": "이 시각 자료를 보려면 {label}에서 이 스레드를 여세요.",
3619
+ "745a0b899008618c": "이전 턴을 불러올 수 없습니다. 다시 시도하세요.",
3620
+ "0014ce0aaf1bd68a": "읽기 전용",
3621
+ "d0bda35aeec66684": [
3622
+ "읽는 중: ",
3623
+ {
3624
+ "i": 1,
3625
+ "k": "_gt_value_1",
3626
+ "v": "v"
3627
+ },
3628
+ "…"
3629
+ ],
3630
+ "c3e8cd9bf44e2f43": "이전에 읽은 내용을 표시하고 있습니다.",
3631
"eb6e0584cf4a2a1d": "언어: {language}",
3632
"d76c606a3c519b78": "줄 바꿈 끄기",
3633
"2b683498cee8c8a7": "줄 바꿈",
@@ -3625,6 +3655,7 @@
3655
"6d329f7d3a50c7e7": "표 복사",
3656
"6c71d251d9917587": "Markdown으로 복사",
3657
"d510b122f84051a0": "CSV로 복사",
3658
+ "2912e4ac3697686b": "{label}의 스레드 읽기",
3659
"ced684880c2e1961": "{server}이(가) {tool}을(를) 실행하도록 허용할까요?",
3660
"b66fa23b5647b62d": "{server}에서 이 메시지를 보낼까요?",
3661
"bae7f74153fa8a05": "{server}에서 {names}을(를) 저장할까요?",
@@ -4148,7 +4179,6 @@
4179
"309b160785f6c473": "이 채팅에서 포크 열기",
4180
"6676cd4b8299663f": "이 채팅에서 상위 스레드 열기",
4181
"63e8c7a0ef0513b5": "관련 스레드",
4151
- "68060b380fe53942": "{label}에서 실행됩니다. 그곳에서 스레드를 열려면 연결하세요.",
4182
"9996d9dac573001a": "{label}에서 열기",
4183
"15a601a94893277f": "상위 스레드를 열 수 없습니다",
4184
"5eb43f554a5b7a58": "상위 스레드가 삭제되었습니다",
@@ -5668,7 +5698,6 @@
5698
"4333d220c55ba5e4": "작업 영역 쿼리에 실패했습니다.",
5699
"422c1671dfcfe474": "''{path}''이(가) 없습니다.",
5700
"20194b81e50497ad": "폴더를 불러올 수 없습니다.",
5671
- "745a0b899008618c": "이전 턴을 불러올 수 없습니다. 다시 시도하세요.",
5701
"0061fff77e36bd4f": "서버에 연결할 수 없습니다.",
5702
"04dfdd46e3dd4a2e": "문제가 발생했습니다. 다시 시도하세요.",
5703
"084bb2d8127a508d": "보냄",
@@ -5758,19 +5787,17 @@
5787
"56ca98b79cc9ce49": "활동({count})",
5788
"ddc5e5413923c471": "여기에는 댓글을 달 수 없습니다.",
5789
"516def6f5a881e00": "이 이슈를 닫음",
5761
- "0014ce0aaf1bd68a": "읽기 전용",
5790
"fd93f4720ff70aaf": "없음",
5791
"b6a29fff7c7c0808": "없음",
5792
"54420465784bb1bd": "이전 댓글 불러오기",
5793
"9d82ebf35bfb4043": "아직 활동이 없습니다.",
5766
- "1cf216566c1ee064": "사용할 수 없는 프로젝트",
5794
"b5ddadeb0810688c": "상태",
5795
"93c1fc19d9bf1db0": "참여",
5796
"d5a8b335d88b65bc": "{hidden}개 숨김",
5797
"2160067266a61dd8": "전체",
5798
"cd4ec4acf33c65b9": "{count, plural, other {레이블 {count}개}}",
5799
"bfd20acb8b7dee6b": "모든 사람",
5773
- "ad208e3e32c85029": "모두 숨기기",
5800
+ "aead644e2cf1233f": "모두 표시",
5801
"77ce79d865716719": "일치하는 프로젝트가 없습니다.",
5802
"af7eb4f9c7f0f575": "필터",
5803
"08247dd39b0c85ff": "담당자",
@@ -6437,7 +6464,6 @@
6464
"64d0189be492147c": "검사 세부 정보를 열 수 없습니다",
6465
"600347ca50400a54": "검사를 불러오는 중…",
6466
"1b381201aba745c2": "보고된 검사 없음",
6440
- "aead644e2cf1233f": "모두 표시",
6467
"a6d75a4380173c60": "검사 열기: {summary}",
6468
"be3d1766bad18693": "검사: {summary}",
6469
"425e4a3d6c5c2867": "{count, plural, other {{count}개 실패}}",
@@ -9701,6 +9727,7 @@
9727
"51497bd401292062": "길게 누르기",
9728
"9d6cc6ac23312071": "두 번 누르기",
9729
"f001fa7b329c8fbf": "성공한 항목 숨기기",
9730
+ "ad208e3e32c85029": "모두 숨기기",
9731
"c80e4bb3201efd71": "Zen",
9732
"0cb9ffcd1fb46b0c": "상태만",
9733
"cf0f7fc3df26fa75": "상태 및 메시지",
@@ -9910,6 +9937,7 @@
9937
"573ea5fdf293a9d6": "모든 체크아웃",
9938
"470ad8c54049d1e1": "체크아웃 검색",
9939
"7e2dfdd9f97fc027": "프로젝트 범위",
9940
+ "1cf216566c1ee064": "사용할 수 없는 프로젝트",
9941
"c1b8c351aa90f319": [
9942
{
9943
"t": "span",
apps/web/src/i18n/translations/pt-BR.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Não foi possível vincular: {failure}",
95
"acd01e781e2355cc": "Solicitação encerrada",
96
"97e4c50a99272f63": "Não foi possível responder à solicitação. Tente novamente.",
97
+ "605a491783d18b3f": "Não foi possível ler esta thread por {via}",
98
+ "50f19209548b70d9": "Talvez {via} precise de uma atualização para ler threads vinculadas.",
99
+ "3d624e57d675358c": "Ambientes vinculados está desativado em {via}",
100
+ "01b2231effdb835f": "Ative em Configurações → Labs de {via} para ler threads das máquinas vinculadas a ele.",
101
+ "e767e8901a0a3f35": "{via} não está mais vinculado a {label}",
102
+ "df3cd6ccd77084b4": "Vincule novamente em Configurações → Conexões de {via} para ler as threads dele daqui.",
103
+ "3920637506407ca0": "O vínculo de {via} com {label} expirou",
104
+ "80fec3c2b4fba678": "Vincule novamente em Configurações → Conexões de {via} com um novo código de pareamento.",
105
+ "fec50d228dc9aa9b": "{label} recusou a leitura",
106
+ "cd63d78559603b12": "Esta thread não está mais em {label}",
107
+ "bd29efc163476e72": "Talvez tenha sido excluída lá.",
108
+ "f7870ef3a4828ab1": "{label} precisa de uma atualização",
109
+ "eabbf064657519ee": "{label} não está respondendo a {via}",
110
"f71597ae3afaef44": "{first} e {second}",
111
"4047174839a16714": "{first} e {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -2343,6 +2356,7 @@
2356
"ac0de2a59d9c8860": "Dispositivo",
2357
"1354df9fb7278843": "Acompanhe um iOS Simulator ou Android Emulator.",
2358
"fdcd9643e2e63b15": "Faça uma pergunta paralela enquanto esta thread continua trabalhando.",
2359
+ "1944f04b75ddf26d": "Thread em {label}",
2360
"314cfeebf191ba0d": "precisa de aprovação",
2361
"4e5b7363441a3831": "precisa de resposta",
2362
"97af4e74a5f95e5e": "em execução",
@@ -3603,6 +3617,22 @@
3617
". O agente pode usar esse vínculo como está; altere o acesso em Configurações → Ambientes."
3618
],
3619
"000b0df227182d39": "Outro endereço…",
3620
+ "6bb5b1b35b2796ae": "Em {label} via {via} · Trabalhando",
3621
+ "a73b7ab25d6e9bdf": "Em {label} via {via}",
3622
+ "009e2ca841fdc1ef": "este ambiente",
3623
+ "8cb2e5692c4f05ab": "Abra este thread em {label} para ver este visual.",
3624
+ "745a0b899008618c": "Não foi possível carregar os turnos anteriores. Tente novamente.",
3625
+ "0014ce0aaf1bd68a": "Somente leitura",
3626
+ "d0bda35aeec66684": [
3627
+ "Lendo de ",
3628
+ {
3629
+ "i": 1,
3630
+ "k": "_gt_value_1",
3631
+ "v": "v"
3632
+ },
3633
+ "…"
3634
+ ],
3635
+ "c3e8cd9bf44e2f43": "Mostrando o que foi lido antes.",
3636
"eb6e0584cf4a2a1d": "Linguagem: {language}",
3637
"d76c606a3c519b78": "Desativar quebra de linha",
3638
"2b683498cee8c8a7": "Quebrar linhas",
@@ -3630,6 +3660,7 @@
3660
"6d329f7d3a50c7e7": "Copiar tabela",
3661
"6c71d251d9917587": "Copiar como Markdown",
3662
"d510b122f84051a0": "Copiar como CSV",
3663
+ "2912e4ac3697686b": "Ler a thread em {label}",
3664
"ced684880c2e1961": "Permitir que {server} execute {tool}?",
3665
"b66fa23b5647b62d": "Enviar esta mensagem de {server}?",
3666
"bae7f74153fa8a05": "Salvar {names} de {server}?",
@@ -4160,7 +4191,6 @@
4191
"309b160785f6c473": "Abrir o fork neste chat",
4192
"6676cd4b8299663f": "Abrir a thread principal neste chat",
4193
"63e8c7a0ef0513b5": "Threads relacionadas",
4163
- "68060b380fe53942": "Roda em {label}. Conecte-se a ele para abrir a thread lá.",
4194
"9996d9dac573001a": "Abrir em {label}",
4195
"15a601a94893277f": "Não foi possível abrir a thread principal",
4196
"5eb43f554a5b7a58": "A thread principal foi excluída",
@@ -5687,7 +5717,6 @@
5717
"4333d220c55ba5e4": "Falha na consulta ao workspace.",
5718
"422c1671dfcfe474": "''{path}'' não existe.",
5719
"20194b81e50497ad": "Não foi possível carregar a pasta.",
5690
- "745a0b899008618c": "Não foi possível carregar os turnos anteriores. Tente novamente.",
5720
"0061fff77e36bd4f": "Não foi possível acessar o servidor.",
5721
"04dfdd46e3dd4a2e": "Algo deu errado. Tente novamente.",
5722
"084bb2d8127a508d": "Enviada",
@@ -5777,19 +5806,17 @@
5806
"56ca98b79cc9ce49": "Atividade ({count})",
5807
"ddc5e5413923c471": "Você não pode comentar aqui.",
5808
"516def6f5a881e00": "Fecha esta issue",
5780
- "0014ce0aaf1bd68a": "Somente leitura",
5809
"fd93f4720ff70aaf": "Nenhuma",
5810
"b6a29fff7c7c0808": "Ninguém",
5811
"54420465784bb1bd": "Carregar comentários mais antigos",
5812
"9d82ebf35bfb4043": "Nada aconteceu aqui ainda.",
5785
- "1cf216566c1ee064": "Projeto indisponível",
5813
"b5ddadeb0810688c": "Estado",
5814
"93c1fc19d9bf1db0": "Envolvimento",
5815
"d5a8b335d88b65bc": "{hidden} ocultos",
5816
"2160067266a61dd8": "Qualquer",
5817
"cd4ec4acf33c65b9": "{count, plural, one {{count} rótulo} other {{count} rótulos}}",
5818
"bfd20acb8b7dee6b": "Qualquer pessoa",
5792
- "ad208e3e32c85029": "Ocultar todas",
5819
+ "aead644e2cf1233f": "Mostrar tudo",
5820
"77ce79d865716719": "Nenhum projeto correspondente.",
5821
"af7eb4f9c7f0f575": "Filtros",
5822
"08247dd39b0c85ff": "Responsável",
@@ -6465,7 +6492,6 @@
6492
"64d0189be492147c": "Não foi possível abrir os detalhes da verificação",
6493
"600347ca50400a54": "Carregando as verificações…",
6494
"1b381201aba745c2": "Nenhuma verificação informada",
6468
- "aead644e2cf1233f": "Mostrar tudo",
6495
"a6d75a4380173c60": "Abrir verificações: {summary}",
6496
"be3d1766bad18693": "Verificações: {summary}",
6497
"425e4a3d6c5c2867": "{count, plural, one {{count} com falha} other {{count} com falha}}",
@@ -9745,6 +9771,7 @@
9771
"51497bd401292062": "Manter pressionado",
9772
"9d6cc6ac23312071": "Pressionar duas vezes",
9773
"f001fa7b329c8fbf": "Ocultar bem-sucedidas",
9774
+ "ad208e3e32c85029": "Ocultar todas",
9775
"c80e4bb3201efd71": "Zen",
9776
"0cb9ffcd1fb46b0c": "Só status",
9777
"cf0f7fc3df26fa75": "Status e mensagens",
@@ -9954,6 +9981,7 @@
9981
"573ea5fdf293a9d6": "Todos os checkouts",
9982
"470ad8c54049d1e1": "Pesquisar checkouts",
9983
"7e2dfdd9f97fc027": "Escopo de projeto",
9984
+ "1cf216566c1ee064": "Projeto indisponível",
9985
"c1b8c351aa90f319": [
9986
{
9987
"t": "span",
apps/web/src/i18n/translations/ru.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Не удалось привязать: {failure}",
95
"acd01e781e2355cc": "Запрос завершён",
96
"97e4c50a99272f63": "Не удалось ответить на запрос. Повторите попытку.",
97
+ "605a491783d18b3f": "Не удалось прочитать этот тред через {via}",
98
+ "50f19209548b70d9": "Возможно, {via} нужно обновить, чтобы читать привязанные треды.",
99
+ "3d624e57d675358c": "Привязанные окружения отключены на {via}",
100
+ "01b2231effdb835f": "Включите их в разделе «Настройки → Labs» на {via}, чтобы читать треды на привязанных к нему машинах.",
101
+ "e767e8901a0a3f35": "{via} больше не связан с {label}",
102
+ "df3cd6ccd77084b4": "Свяжите заново в разделе «Настройки → Подключения» на {via}, чтобы читать его треды отсюда.",
103
+ "3920637506407ca0": "Срок связи {via} с {label} истёк",
104
+ "80fec3c2b4fba678": "Свяжите заново в разделе «Настройки → Подключения» на {via} с новым кодом сопряжения.",
105
+ "fec50d228dc9aa9b": "{label} отклонил чтение",
106
+ "cd63d78559603b12": "Этого треда больше нет на {label}",
107
+ "bd29efc163476e72": "Возможно, его там удалили.",
108
+ "f7870ef3a4828ab1": "{label} нужно обновить",
109
+ "eabbf064657519ee": "{label} не отвечает {via}",
110
"f71597ae3afaef44": "{first} и {second}",
111
"4047174839a16714": "{first} и {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -2343,6 +2356,7 @@
2356
"ac0de2a59d9c8860": "Устройство",
2357
"1354df9fb7278843": "Смотрите на iOS Simulator или Android Emulator.",
2358
"fdcd9643e2e63b15": "Задайте побочный вопрос, пока тред продолжает работу.",
2359
+ "1944f04b75ddf26d": "Тред на {label}",
2360
"314cfeebf191ba0d": "нужно подтверждение",
2361
"4e5b7363441a3831": "нужен ввод",
2362
"97af4e74a5f95e5e": "выполняется",
@@ -3603,6 +3617,22 @@
3617
". Агент может использовать эту привязку как есть; изменить её доступ можно в «Настройки → Окружения»."
3618
],
3619
"000b0df227182d39": "Другой адрес…",
3620
+ "6bb5b1b35b2796ae": "На {label} через {via} · Работает",
3621
+ "a73b7ab25d6e9bdf": "На {label} через {via}",
3622
+ "009e2ca841fdc1ef": "это окружение",
3623
+ "8cb2e5692c4f05ab": "Откройте этот тред на {label}, чтобы увидеть это визуальное представление.",
3624
+ "745a0b899008618c": "Не удалось загрузить более ранние ходы. Повторите попытку.",
3625
+ "0014ce0aaf1bd68a": "Только чтение",
3626
+ "d0bda35aeec66684": [
3627
+ "Чтение с ",
3628
+ {
3629
+ "i": 1,
3630
+ "k": "_gt_value_1",
3631
+ "v": "v"
3632
+ },
3633
+ "…"
3634
+ ],
3635
+ "c3e8cd9bf44e2f43": "Показано то, что было прочитано раньше.",
3636
"eb6e0584cf4a2a1d": "Язык: {language}",
3637
"d76c606a3c519b78": "Отключить перенос строк",
3638
"2b683498cee8c8a7": "Переносить строки",
@@ -3630,6 +3660,7 @@
3660
"6d329f7d3a50c7e7": "Копировать таблицу",
3661
"6c71d251d9917587": "Копировать как Markdown",
3662
"d510b122f84051a0": "Копировать как CSV",
3663
+ "2912e4ac3697686b": "Читать тред на {label}",
3664
"ced684880c2e1961": "Разрешить {server} запустить {tool}?",
3665
"b66fa23b5647b62d": "Отправить это сообщение от {server}?",
3666
"bae7f74153fa8a05": "Сохранить {names} от {server}?",
@@ -4160,7 +4191,6 @@
4191
"309b160785f6c473": "Открыть ответвление в этом чате",
4192
"6676cd4b8299663f": "Открыть родительский тред в этом чате",
4193
"63e8c7a0ef0513b5": "Связанные треды",
4163
- "68060b380fe53942": "Работает на {label}. Подключитесь к нему, чтобы открыть тред там.",
4194
"9996d9dac573001a": "Открыть на {label}",
4195
"15a601a94893277f": "Не удалось открыть родительский тред",
4196
"5eb43f554a5b7a58": "Родительский тред удалён",
@@ -5687,7 +5717,6 @@
5717
"4333d220c55ba5e4": "Ошибка запроса к рабочей области.",
5718
"422c1671dfcfe474": "''{path}'' не существует.",
5719
"20194b81e50497ad": "Не удалось загрузить папку.",
5690
- "745a0b899008618c": "Не удалось загрузить более ранние ходы. Повторите попытку.",
5720
"0061fff77e36bd4f": "Не удалось связаться с сервером.",
5721
"04dfdd46e3dd4a2e": "Что-то пошло не так. Повторите попытку.",
5722
"084bb2d8127a508d": "Отправлено",
@@ -5777,19 +5806,17 @@
5806
"56ca98b79cc9ce49": "Активность ({count})",
5807
"ddc5e5413923c471": "Здесь нельзя комментировать.",
5808
"516def6f5a881e00": "Закроет этот issue",
5780
- "0014ce0aaf1bd68a": "Только чтение",
5809
"fd93f4720ff70aaf": "Нет",
5810
"b6a29fff7c7c0808": "Нет",
5811
"54420465784bb1bd": "Загрузить старые комментарии",
5812
"9d82ebf35bfb4043": "Здесь пока ничего не происходило.",
5785
- "1cf216566c1ee064": "Проект недоступен",
5813
"b5ddadeb0810688c": "Состояние",
5814
"93c1fc19d9bf1db0": "Участие",
5815
"d5a8b335d88b65bc": "Скрыто: {hidden}",
5816
"2160067266a61dd8": "Любая",
5817
"cd4ec4acf33c65b9": "{count, plural, one {{count} метка} few {{count} метки} many {{count} меток} other {{count} метки}}",
5818
"bfd20acb8b7dee6b": "Любой",
5792
- "ad208e3e32c85029": "Скрывать все",
5819
+ "aead644e2cf1233f": "Показать все",
5820
"77ce79d865716719": "Нет подходящих проектов.",
5821
"af7eb4f9c7f0f575": "Фильтры",
5822
"08247dd39b0c85ff": "Исполнитель",
@@ -6465,7 +6492,6 @@
6492
"64d0189be492147c": "Не удалось открыть подробности проверки",
6493
"600347ca50400a54": "Загрузка проверок…",
6494
"1b381201aba745c2": "Нет проверок",
6468
- "aead644e2cf1233f": "Показать все",
6495
"a6d75a4380173c60": "Открыть проверки: {summary}",
6496
"be3d1766bad18693": "Проверки: {summary}",
6497
"425e4a3d6c5c2867": "{count, plural, one {Ошибок: {count}} few {Ошибок: {count}} many {Ошибок: {count}} other {Ошибок: {count}}}",
@@ -9748,6 +9774,7 @@
9774
"51497bd401292062": "Удержание",
9775
"9d6cc6ac23312071": "Двойное нажатие",
9776
"f001fa7b329c8fbf": "Скрывать успешные",
9777
+ "ad208e3e32c85029": "Скрывать все",
9778
"c80e4bb3201efd71": "Дзен",
9779
"0cb9ffcd1fb46b0c": "Только статус",
9780
"cf0f7fc3df26fa75": "Статус и сообщения",
@@ -9957,6 +9984,7 @@
9984
"573ea5fdf293a9d6": "Все копии",
9985
"470ad8c54049d1e1": "Поиск копий",
9986
"7e2dfdd9f97fc027": "Область проектов",
9987
+ "1cf216566c1ee064": "Проект недоступен",
9988
"c1b8c351aa90f319": [
9989
{
9990
"t": "span",
apps/web/src/i18n/translations/sv.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "Kunde inte länka: {failure}",
95
"acd01e781e2355cc": "Begäran avslutades",
96
"97e4c50a99272f63": "Kunde inte svara på begäran. Försök igen.",
97
+ "605a491783d18b3f": "Det gick inte att läsa den här tråden via {via}",
98
+ "50f19209548b70d9": "{via} kan behöva uppdateras innan den kan läsa länkade trådar.",
99
+ "3d624e57d675358c": "Länkade miljöer är avstängt på {via}",
100
+ "01b2231effdb835f": "Slå på det i Inställningar → Labs på {via} för att läsa trådar på maskinerna den länkar till.",
101
+ "e767e8901a0a3f35": "{via} är inte längre länkad till {label}",
102
+ "df3cd6ccd77084b4": "Länka den igen i Inställningar → Anslutningar på {via} för att läsa dess trådar härifrån.",
103
+ "3920637506407ca0": "Länken från {via} till {label} har gått ut",
104
+ "80fec3c2b4fba678": "Länka den igen i Inställningar → Anslutningar på {via} med en ny parkopplingskod.",
105
+ "fec50d228dc9aa9b": "{label} nekade läsningen",
106
+ "cd63d78559603b12": "Den här tråden finns inte längre på {label}",
107
+ "bd29efc163476e72": "Den kan ha raderats där.",
108
+ "f7870ef3a4828ab1": "{label} behöver uppdateras",
109
+ "eabbf064657519ee": "{label} svarar inte {via}",
110
"f71597ae3afaef44": "{first} och {second}",
111
"4047174839a16714": "{first} och {last}",
112
"65ca7867c176afbf": "{first}, {rest}",
@@ -2343,6 +2356,7 @@
2356
"ac0de2a59d9c8860": "Enhet",
2357
"1354df9fb7278843": "Titta på en iOS-simulator eller Android-emulator.",
2358
"fdcd9643e2e63b15": "Ställ en sidofråga medan tråden fortsätter arbeta.",
2359
+ "1944f04b75ddf26d": "Tråd på {label}",
2360
"314cfeebf191ba0d": "behöver godkännande",
2361
"4e5b7363441a3831": "behöver input",
2362
"97af4e74a5f95e5e": "körs",
@@ -3603,6 +3617,22 @@
3617
". Agenten kan använda den länken som den är; ändra dess åtkomst under Inställningar → Miljöer."
3618
],
3619
"000b0df227182d39": "En annan adress…",
3620
+ "6bb5b1b35b2796ae": "På {label} via {via} · Arbetar",
3621
+ "a73b7ab25d6e9bdf": "På {label} via {via}",
3622
+ "009e2ca841fdc1ef": "den här miljön",
3623
+ "8cb2e5692c4f05ab": "Öppna den här tråden på {label} för att se den här visualiseringen.",
3624
+ "745a0b899008618c": "Kunde inte läsa in tidigare omgångar. Försök igen.",
3625
+ "0014ce0aaf1bd68a": "Skrivskyddad",
3626
+ "d0bda35aeec66684": [
3627
+ "Läser från ",
3628
+ {
3629
+ "i": 1,
3630
+ "k": "_gt_value_1",
3631
+ "v": "v"
3632
+ },
3633
+ "…"
3634
+ ],
3635
+ "c3e8cd9bf44e2f43": "Visar det som lästes tidigare.",
3636
"eb6e0584cf4a2a1d": "Språk: {language}",
3637
"d76c606a3c519b78": "Inaktivera radbrytning",
3638
"2b683498cee8c8a7": "Bryt rader",
@@ -3630,6 +3660,7 @@
3660
"6d329f7d3a50c7e7": "Kopiera tabell",
3661
"6c71d251d9917587": "Kopiera som Markdown",
3662
"d510b122f84051a0": "Kopiera som CSV",
3663
+ "2912e4ac3697686b": "Läs tråden på {label}",
3664
"ced684880c2e1961": "Tillåta {server} att köra {tool}?",
3665
"b66fa23b5647b62d": "Skicka det här meddelandet från {server}?",
3666
"bae7f74153fa8a05": "Spara {names} från {server}?",
@@ -4161,7 +4192,6 @@
4192
"309b160785f6c473": "Öppna forken i den här chatten",
4193
"6676cd4b8299663f": "Öppna den överordnade tråden i den här chatten",
4194
"63e8c7a0ef0513b5": "Relaterade trådar",
4164
- "68060b380fe53942": "Körs på {label}. Anslut till den för att öppna tråden där.",
4195
"9996d9dac573001a": "Öppna på {label}",
4196
"15a601a94893277f": "Kunde inte öppna den överordnade tråden",
4197
"5eb43f554a5b7a58": "Den överordnade tråden togs bort",
@@ -5688,7 +5718,6 @@
5718
"4333d220c55ba5e4": "Frågan mot arbetsytan misslyckades.",
5719
"422c1671dfcfe474": "''{path}'' finns inte.",
5720
"20194b81e50497ad": "Det gick inte att läsa in mappen.",
5691
- "745a0b899008618c": "Kunde inte läsa in tidigare omgångar. Försök igen.",
5721
"0061fff77e36bd4f": "Kunde inte nå servern.",
5722
"04dfdd46e3dd4a2e": "Något gick fel. Försök igen.",
5723
"084bb2d8127a508d": "Skickat",
@@ -5778,19 +5807,17 @@
5807
"56ca98b79cc9ce49": "Aktivitet ({count})",
5808
"ddc5e5413923c471": "Du kan inte kommentera här.",
5809
"516def6f5a881e00": "Stänger det här ärendet",
5781
- "0014ce0aaf1bd68a": "Skrivskyddad",
5810
"fd93f4720ff70aaf": "Inga",
5811
"b6a29fff7c7c0808": "Ingen",
5812
"54420465784bb1bd": "Läs in äldre kommentarer",
5813
"9d82ebf35bfb4043": "Inget har hänt här än.",
5786
- "1cf216566c1ee064": "Projektet är inte tillgängligt",
5814
"b5ddadeb0810688c": "Status",
5815
"93c1fc19d9bf1db0": "Inblandning",
5816
"d5a8b335d88b65bc": "{hidden} dolda",
5817
"2160067266a61dd8": "Alla",
5818
"cd4ec4acf33c65b9": "{count, plural, one {{count} etikett} other {{count} etiketter}}",
5819
"bfd20acb8b7dee6b": "Vem som helst",
5793
- "ad208e3e32c85029": "Dölj alla",
5820
+ "aead644e2cf1233f": "Visa alla",
5821
"77ce79d865716719": "Inga matchande projekt.",
5822
"af7eb4f9c7f0f575": "Filter",
5823
"08247dd39b0c85ff": "Tilldelad",
@@ -6471,7 +6498,6 @@
6498
"64d0189be492147c": "Det gick inte att öppna kontrolldetaljer",
6499
"600347ca50400a54": "Läser in kontroller…",
6500
"1b381201aba745c2": "Inga kontroller rapporterade",
6474
- "aead644e2cf1233f": "Visa alla",
6501
"a6d75a4380173c60": "Öppna kontroller: {summary}",
6502
"be3d1766bad18693": "Kontroller: {summary}",
6503
"425e4a3d6c5c2867": "{count, plural, one {{count} misslyckades} other {{count} misslyckades}}",
@@ -9754,6 +9780,7 @@
9780
"51497bd401292062": "Håll ned",
9781
"9d6cc6ac23312071": "Dubbeltryck",
9782
"f001fa7b329c8fbf": "Dölj lyckade",
9783
+ "ad208e3e32c85029": "Dölj alla",
9784
"c80e4bb3201efd71": "Zen",
9785
"0cb9ffcd1fb46b0c": "Endast status",
9786
"cf0f7fc3df26fa75": "Status och meddelanden",
@@ -9963,6 +9990,7 @@
9990
"573ea5fdf293a9d6": "Alla utcheckningar",
9991
"470ad8c54049d1e1": "Sök utcheckningar",
9992
"7e2dfdd9f97fc027": "Projektomfång",
9993
+ "1cf216566c1ee064": "Projektet är inte tillgängligt",
9994
"c1b8c351aa90f319": [
9995
{
9996
"t": "span",
apps/web/src/i18n/translations/zh.json
+34
-6
@@ -94,6 +94,19 @@
94
"21be308917bd450e": "无法关联:{failure}",
95
"acd01e781e2355cc": "请求已结束",
96
"97e4c50a99272f63": "无法回复此请求。请重试。",
97
+ "605a491783d18b3f": "无法通过 {via} 读取此会话",
98
+ "50f19209548b70d9": "{via} 可能需要更新后才能读取关联的会话。",
99
+ "3d624e57d675358c": "{via} 上的关联环境已关闭",
100
+ "01b2231effdb835f": "在 {via} 的设置 → Labs 中开启,即可读取其关联机器上的会话。",
101
+ "e767e8901a0a3f35": "{via} 已不再关联 {label}",
102
+ "df3cd6ccd77084b4": "在 {via} 的设置 → 连接中重新关联,即可从这里读取其会话。",
103
+ "3920637506407ca0": "{via} 到 {label} 的关联已过期",
104
+ "80fec3c2b4fba678": "在 {via} 的设置 → 连接中使用新的配对码重新关联。",
105
+ "fec50d228dc9aa9b": "{label} 拒绝了读取",
106
+ "cd63d78559603b12": "此会话已不在 {label} 上",
107
+ "bd29efc163476e72": "它可能已在那里被删除。",
108
+ "f7870ef3a4828ab1": "{label} 需要更新",
109
+ "eabbf064657519ee": "{label} 没有响应 {via}",
110
"f71597ae3afaef44": "{first} 和 {second}",
111
"4047174839a16714": "{first} 和 {last}",
112
"65ca7867c176afbf": "{first}、{rest}",
@@ -2347,6 +2360,7 @@
2360
"ac0de2a59d9c8860": "设备",
2361
"1354df9fb7278843": "查看 iOS 模拟器或 Android 模拟器。",
2362
"fdcd9643e2e63b15": "在会话继续运行的同时追问一个旁支问题。",
2363
+ "1944f04b75ddf26d": "{label} 上的会话",
2364
"314cfeebf191ba0d": "待批准",
2365
"4e5b7363441a3831": "待输入",
2366
"97af4e74a5f95e5e": "运行中",
@@ -3608,6 +3622,22 @@
3622
"。智能体可以直接使用该关联;请在“设置 → 环境”中更改其访问权限。"
3623
],
3624
"000b0df227182d39": "其他地址…",
3625
+ "6bb5b1b35b2796ae": "位于 {label},经由 {via} · 运行中",
3626
+ "a73b7ab25d6e9bdf": "位于 {label},经由 {via}",
3627
+ "009e2ca841fdc1ef": "此环境",
3628
+ "8cb2e5692c4f05ab": "在 {label} 上打开此会话即可查看此可视内容。",
3629
+ "745a0b899008618c": "无法加载更早的对话。请重试。",
3630
+ "0014ce0aaf1bd68a": "只读",
3631
+ "d0bda35aeec66684": [
3632
+ "正在从 ",
3633
+ {
3634
+ "i": 1,
3635
+ "k": "_gt_value_1",
3636
+ "v": "v"
3637
+ },
3638
+ " 读取…"
3639
+ ],
3640
+ "c3e8cd9bf44e2f43": "正在显示之前读取的内容。",
3641
"eb6e0584cf4a2a1d": "语言:{language}",
3642
"d76c606a3c519b78": "取消自动换行",
3643
"2b683498cee8c8a7": "自动换行",
@@ -3635,6 +3665,7 @@
3665
"6d329f7d3a50c7e7": "复制表格",
3666
"6c71d251d9917587": "复制为 Markdown",
3667
"d510b122f84051a0": "复制为 CSV",
3668
+ "2912e4ac3697686b": "读取 {label} 上的会话",
3669
"ced684880c2e1961": "允许 {server} 运行 {tool} 吗?",
3670
"b66fa23b5647b62d": "要发送这条来自 {server} 的消息吗?",
3671
"bae7f74153fa8a05": "要保存来自 {server} 的 {names} 吗?",
@@ -4167,7 +4198,6 @@
4198
"309b160785f6c473": "在此对话中打开分叉",
4199
"6676cd4b8299663f": "在此对话中打开父会话",
4200
"63e8c7a0ef0513b5": "相关会话",
4170
- "68060b380fe53942": "运行于 {label}。连接到它以在那里打开会话。",
4201
"9996d9dac573001a": "在 {label} 上打开",
4202
"15a601a94893277f": "无法打开父会话",
4203
"5eb43f554a5b7a58": "父会话已被删除",
@@ -5694,7 +5724,6 @@
5724
"4333d220c55ba5e4": "工作区查询失败。",
5725
"422c1671dfcfe474": "''{path}'' 不存在。",
5726
"20194b81e50497ad": "无法加载文件夹。",
5697
- "745a0b899008618c": "无法加载更早的对话。请重试。",
5727
"0061fff77e36bd4f": "无法连接到服务器。",
5728
"04dfdd46e3dd4a2e": "出了点问题。请重试。",
5729
"084bb2d8127a508d": "已发送",
@@ -5784,19 +5813,17 @@
5813
"56ca98b79cc9ce49": "活动({count})",
5814
"ddc5e5413923c471": "你无法在此评论。",
5815
"516def6f5a881e00": "将关闭此 issue",
5787
- "0014ce0aaf1bd68a": "只读",
5816
"fd93f4720ff70aaf": "无",
5817
"b6a29fff7c7c0808": "无",
5818
"54420465784bb1bd": "加载较早的评论",
5819
"9d82ebf35bfb4043": "这里还没有任何动态。",
5792
- "1cf216566c1ee064": "不可用的项目",
5820
"b5ddadeb0810688c": "状态",
5821
"93c1fc19d9bf1db0": "参与方式",
5822
"d5a8b335d88b65bc": "已隐藏 {hidden} 个",
5823
"2160067266a61dd8": "任意",
5824
"cd4ec4acf33c65b9": "{count, plural, other {{count} 个标签}}",
5825
"bfd20acb8b7dee6b": "任何人",
5799
- "ad208e3e32c85029": "全部隐藏",
5826
+ "aead644e2cf1233f": "全部显示",
5827
"77ce79d865716719": "没有匹配的项目。",
5828
"af7eb4f9c7f0f575": "筛选条件",
5829
"08247dd39b0c85ff": "受理人",
@@ -6477,7 +6504,6 @@
6504
"64d0189be492147c": "无法打开检查详情",
6505
"600347ca50400a54": "正在加载检查…",
6506
"1b381201aba745c2": "未报告任何检查",
6480
- "aead644e2cf1233f": "全部显示",
6507
"a6d75a4380173c60": "打开检查:{summary}",
6508
"be3d1766bad18693": "检查:{summary}",
6509
"425e4a3d6c5c2867": "{count, plural, other {{count} 个失败}}",
@@ -9761,6 +9787,7 @@
9787
"51497bd401292062": "长按",
9788
"9d6cc6ac23312071": "连按两次",
9789
"f001fa7b329c8fbf": "隐藏成功的调用",
9790
+ "ad208e3e32c85029": "全部隐藏",
9791
"c80e4bb3201efd71": "专注模式",
9792
"0cb9ffcd1fb46b0c": "仅状态",
9793
"cf0f7fc3df26fa75": "状态和消息",
@@ -9970,6 +9997,7 @@
9997
"573ea5fdf293a9d6": "所有工作副本",
9998
"470ad8c54049d1e1": "搜索工作副本",
9999
"7e2dfdd9f97fc027": "项目范围",
10000
+ "1cf216566c1ee064": "不可用的项目",
10001
"c1b8c351aa90f319": [
10002
{
10003
"t": "span",
apps/web/src/linkedThreadSurface.ts
new
+55
@@ -0,0 +1,55 @@
1
+import type { LinkedThreadTarget } from "@t3tools/client-runtime/linked-thread";
2
+import { EnvironmentId, ThreadId } from "@t3tools/contracts";
3
+
4
+/** A linked environment's thread as a right panel tab, read through `viaEnvironmentId`. */
5
+export type LinkedThreadSurface = {
6
+ id: `linked-thread:${string}`;
7
+ kind: "linked-thread";
8
+} & LinkedThreadTarget;
9
+
10
+/** One tab per thread and the environment it is read through, so opening it again focuses it. */
11
+export function linkedThreadSurface(target: LinkedThreadTarget): LinkedThreadSurface {
12
+ return {
13
+ id: `linked-thread:${encodeURIComponent(target.viaEnvironmentId)}:${encodeURIComponent(target.environmentId)}:${encodeURIComponent(target.threadId)}`,
14
+ kind: "linked-thread",
15
+ viaEnvironmentId: target.viaEnvironmentId,
16
+ environmentId: target.environmentId,
17
+ threadId: target.threadId,
18
+ label: target.label,
19
+ title: target.title,
20
+ };
21
+}
22
+
23
+/** A saved linked-thread surface with its id rebuilt, or null when its fields are not usable. */
24
+export function decodeLinkedThreadSurface(surface: object): LinkedThreadSurface | null {
25
+ const { viaEnvironmentId, environmentId, threadId, label, title } = surface as Record<
26
+ string,
27
+ unknown
28
+ >;
29
+ if (
30
+ typeof viaEnvironmentId !== "string" ||
31
+ typeof environmentId !== "string" ||
32
+ typeof threadId !== "string" ||
33
+ typeof label !== "string" ||
34
+ viaEnvironmentId === "" ||
35
+ environmentId === "" ||
36
+ threadId === ""
37
+ ) {
38
+ return null;
39
+ }
40
+ return linkedThreadSurface({
41
+ viaEnvironmentId: EnvironmentId.make(viaEnvironmentId),
42
+ environmentId: EnvironmentId.make(environmentId),
43
+ threadId: ThreadId.make(threadId),
44
+ label,
45
+ title: typeof title === "string" && title !== "" ? title : null,
46
+ });
47
+}
48
+
49
+/** A tab's title: the thread's own once known, else where the thread is. */
50
+export function linkedThreadTitle(
51
+ surface: Pick<LinkedThreadTarget, "title">,
52
+ fallback: string,
53
+): string {
54
+ return surface.title?.trim() || fallback;
55
+}
apps/web/src/reopenClosedView.ts
+3
@@ -164,6 +164,9 @@ export async function reopenClosedView(
164
case "side-chat":
165
panels.openSideChat(ref, surface.threadId);
166
break;
167
+ case "linked-thread":
168
+ panels.openLinkedThread(ref, surface);
169
+ break;
170
default:
171
panels.open(ref, surface.kind);
172
}
apps/web/src/rightPanelStore.test.ts
+79
-1
@@ -1,8 +1,9 @@
1
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
2
-import { type EnvironmentId, RunId, ThreadId } from "@t3tools/contracts";
2
+import { EnvironmentId, RunId, ThreadId } from "@t3tools/contracts";
3
import { beforeEach, describe, expect, it } from "vite-plus/test";
4
5
import { useClosedViewStore } from "./closedViewStore";
6
+import { linkedThreadTitle } from "./linkedThreadSurface";
7
import { reopenClosedView } from "./reopenClosedView";
8
import {
9
hostRightPanel,
@@ -517,6 +518,83 @@ describe("rightPanelStore", () => {
518
expect(selectThreadRightPanelState(migrated.byThreadKey, refA).maximized).toBe(true);
519
});
520
521
+ it("opens a linked thread once per thread and environment it is read through", () => {
522
+ const store = useRightPanelStore.getState();
523
+ const target = {
524
+ viaEnvironmentId: EnvironmentId.make("env-1"),
525
+ environmentId: EnvironmentId.make("env:b"),
526
+ threadId: ThreadId.make("there"),
527
+ label: "fs-17",
528
+ title: null,
529
+ };
530
+ store.openLinkedThread(refA, target);
531
+ store.open(refA, "diff");
532
+ store.openLinkedThread(refA, { ...target, label: "renamed", title: "Fix the build" });
533
+ store.openLinkedThread(refA, { ...target, title: null });
534
+ store.openLinkedThread(refA, { ...target, viaEnvironmentId: EnvironmentId.make("env-2") });
535
+ const panel = selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA);
536
+ expect(panel.surfaces.map((surface) => surface.id)).toEqual([
537
+ "linked-thread:env-1:env%3Ab:there",
538
+ "diff",
539
+ "linked-thread:env-2:env%3Ab:there",
540
+ ]);
541
+ // A click that knows no title keeps the one an earlier click or read gave.
542
+ expect(panel.surfaces[0]).toMatchObject({ label: "fs-17", title: "Fix the build" });
543
+ store.setLinkedThreadTitle(refA, "linked-thread:env-1:env%3Ab:there", "Fix flaky test");
544
+ expect(
545
+ selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA).surfaces[0],
546
+ ).toMatchObject({ title: "Fix flaky test" });
547
+ // The tab is named for the thread once its title is known, else for where it is.
548
+ expect(linkedThreadTitle({ title: "Fix flaky test" }, "Thread on fs-17")).toBe(
549
+ "Fix flaky test",
550
+ );
551
+ expect(linkedThreadTitle({ title: " " }, "Thread on fs-17")).toBe("Thread on fs-17");
552
+ expect(linkedThreadTitle({ title: null }, "Thread on fs-17")).toBe("Thread on fs-17");
553
+ });
554
+
555
+ it("keeps saved linked threads it can show and drops surfaces it cannot", () => {
556
+ const linked = {
557
+ id: "linked-thread:stale-id",
558
+ kind: "linked-thread",
559
+ viaEnvironmentId: "env-1",
560
+ environmentId: "env-b",
561
+ threadId: "there",
562
+ label: "fs-17",
563
+ };
564
+ const migrated = migratePersistedRightPanelState({
565
+ byThreadKey: {
566
+ "env-1:thread-A": {
567
+ isOpen: true,
568
+ activeSurfaceId: "linked-thread:stale-id",
569
+ surfaces: [
570
+ linked,
571
+ { ...linked, id: "linked-thread:no-thread", threadId: undefined },
572
+ { id: "hologram:1", kind: "hologram" },
573
+ null,
574
+ { id: "diff", kind: "diff" },
575
+ ],
576
+ },
577
+ },
578
+ });
579
+ expect(selectThreadRightPanelState(migrated.byThreadKey, refA)).toEqual({
580
+ isOpen: true,
581
+ // The saved id no longer names a surface, so the first one left is shown.
582
+ activeSurfaceId: "linked-thread:env-1:env-b:there",
583
+ surfaces: [
584
+ {
585
+ id: "linked-thread:env-1:env-b:there",
586
+ kind: "linked-thread",
587
+ viaEnvironmentId: "env-1",
588
+ environmentId: "env-b",
589
+ threadId: "there",
590
+ label: "fs-17",
591
+ title: null,
592
+ },
593
+ { id: "diff", kind: "diff" },
594
+ ],
595
+ });
596
+ });
597
+
598
it("drops the legacy singleton terminal surface during migration", () => {
599
expect(
600
migratePersistedRightPanelState({
apps/web/src/rightPanelStore.ts
+61
-5
@@ -11,6 +11,12 @@ import { createJSONStorage, persist } from "zustand/middleware";
11
import { useClosedViewStore } from "./closedViewStore";
12
import { m } from "./i18n/messages";
13
import { resolveStorage } from "./lib/storage";
14
+import type { LinkedThreadTarget } from "@t3tools/client-runtime/linked-thread";
15
+import {
16
+ decodeLinkedThreadSurface,
17
+ linkedThreadSurface,
18
+ type LinkedThreadSurface,
19
+} from "./linkedThreadSurface";
20
import type { ThreadPanelPresentation } from "./rightPanelLayout";
21
import type { ChatFileAttachment } from "./types";
22
@@ -25,6 +31,7 @@ const RIGHT_PANEL_KINDS = [
31
"pull-requests",
32
"issue",
33
"side-chat",
34
+ "linked-thread",
35
] as const;
36
export type RightPanelKind = (typeof RIGHT_PANEL_KINDS)[number];
37
@@ -96,7 +103,9 @@ export type RightPanelSurface =
103
key: string;
104
url?: string;
105
}
99
- | { id: `side-chat:${string}`; kind: "side-chat"; threadId: ThreadId };
106
+ | { id: `side-chat:${string}`; kind: "side-chat"; threadId: ThreadId }
107
+ /** A linked environment's thread, read through `viaEnvironmentId`; it has no thread here. */
108
+ | LinkedThreadSurface;
109
110
const RIGHT_PANEL_STORAGE_KEY = "t3code:right-panel-state:v2";
111
const RIGHT_PANEL_STORAGE_VERSION = 15;
@@ -154,9 +163,15 @@ interface RightPanelStoreState {
163
) => boolean;
164
open: (
165
ref: ScopedThreadRef,
157
- kind: Exclude<RightPanelKind, "file" | "terminal" | "pull-request" | "issue" | "side-chat">,
166
+ kind: Exclude<
167
+ RightPanelKind,
168
+ "file" | "terminal" | "pull-request" | "issue" | "side-chat" | "linked-thread"
169
+ >,
170
) => void;
171
openSideChat: (ref: ScopedThreadRef, threadId: ThreadId) => void;
172
+ openLinkedThread: (ref: ScopedThreadRef, target: LinkedThreadTarget) => void;
173
+ /** Records the title the linked environment gave, so the tab and a reopened one show it. */
174
+ setLinkedThreadTitle: (ref: ScopedThreadRef, surfaceId: string, title: string) => void;
175
openDevice: (ref: ScopedThreadRef, target: DeviceTabTarget, automatic?: boolean) => void;
176
renameDevice: (ref: ScopedThreadRef, surfaceId: string, title: string) => void;
177
openBrowser: (ref: ScopedThreadRef, tabId: string | null) => void;
@@ -221,7 +236,10 @@ interface RightPanelStoreState {
236
toggleVisibility: (ref: ScopedThreadRef) => void;
237
toggle: (
238
ref: ScopedThreadRef,
224
- kind: Exclude<RightPanelKind, "file" | "terminal" | "pull-request" | "issue" | "side-chat">,
239
+ kind: Exclude<
240
+ RightPanelKind,
241
+ "file" | "terminal" | "pull-request" | "issue" | "side-chat" | "linked-thread"
242
+ >,
243
) => void;
244
setThreadPanelOpen: (
245
ref: ScopedThreadRef,
@@ -246,7 +264,7 @@ const DEFAULT_THREAD_PANEL_VISIBILITY: ThreadPanelVisibility = {
264
const singletonSurface = (
265
kind: Exclude<
266
RightPanelKind,
249
- "file" | "preview" | "terminal" | "pull-request" | "issue" | "side-chat"
267
+ "file" | "preview" | "terminal" | "pull-request" | "issue" | "side-chat" | "linked-thread"
268
>,
269
): RightPanelSurface => {
270
switch (kind) {
@@ -567,8 +585,14 @@ export function migratePersistedRightPanelState(persistedState: unknown): {
585
threadState && typeof threadState === "object" ? threadState : null;
586
const surfaces = Array.isArray(validThreadState?.surfaces)
587
? validThreadState.surfaces.flatMap<RightPanelSurface>((surface) => {
588
+ if (!surface || typeof surface !== "object") return [];
589
const kind = (surface as { kind?: string }).kind;
571
- if (kind === "plan" || kind === "agents") return [];
590
+ // Also drops kinds this build does not know, such as one a newer build saved.
591
+ if (!(RIGHT_PANEL_KINDS as ReadonlyArray<unknown>).includes(kind)) return [];
592
+ if (surface.kind === "linked-thread") {
593
+ const decoded = decodeLinkedThreadSurface(surface);
594
+ return decoded === null ? [] : [decoded];
595
+ }
596
if (
597
(surface.kind === "file" || surface.kind === "files") &&
598
"folderTrail" in surface &&
@@ -822,6 +846,38 @@ export const useRightPanelStore = create<RightPanelStoreState>()(
846
upsertSurface(current, { id: `side-chat:${threadId}`, kind: "side-chat", threadId }),
847
),
848
),
849
+ openLinkedThread: (ref, target) =>
850
+ set((state) =>
851
+ userAction(state, scopedThreadKey(ref), (current) => {
852
+ const surface = linkedThreadSurface(target);
853
+ const next = upsertSurface(current, surface);
854
+ return {
855
+ ...next,
856
+ // A later click may know the title or label an earlier one did not.
857
+ surfaces: next.surfaces.map((entry) =>
858
+ entry.id === surface.id && entry.kind === "linked-thread"
859
+ ? { ...surface, title: surface.title ?? entry.title }
860
+ : entry,
861
+ ),
862
+ };
863
+ }),
864
+ ),
865
+ setLinkedThreadTitle: (ref, surfaceId, title) =>
866
+ set((state) => {
867
+ const threadKey = scopedThreadKey(rightPanelHostRef(ref));
868
+ const existing = state.byThreadKey[threadKey]?.surfaces.find(
869
+ (surface) => surface.id === surfaceId,
870
+ );
871
+ if (existing?.kind !== "linked-thread" || existing.title === title) return state;
872
+ return automaticUpdate(state, threadKey, (current) => ({
873
+ ...current,
874
+ surfaces: current.surfaces.map((surface) =>
875
+ surface.id === surfaceId && surface.kind === "linked-thread"
876
+ ? { ...surface, title }
877
+ : surface,
878
+ ),
879
+ }));
880
+ }),
881
renameDevice: (ref, surfaceId, title) =>
882
set((state) =>
883
userAction(state, scopedThreadKey(ref), (current) => ({
apps/web/src/state/linkedThreadView.ts
new
+139
@@ -0,0 +1,139 @@
1
+import { useAtomValue } from "@effect/atom-react";
2
+import { scopeThreadRef } from "@t3tools/client-runtime/environment";
3
+import {
4
+ type LinkedThreadOpen,
5
+ resolveLinkedThreadOpen,
6
+} from "@t3tools/client-runtime/linked-thread";
7
+import type { EnvironmentId, ScopedThreadRef, ThreadId } from "@t3tools/contracts";
8
+import { useNavigate } from "@tanstack/react-router";
9
+import { AsyncResult, Atom } from "effect/reactivity";
10
+
11
+import type { TurnItemSource } from "../components/chat/timelineRowContext";
12
+import { useRightPanelStore } from "../rightPanelStore";
13
+import type { LinkedThreadSurface } from "../linkedThreadSurface";
14
+import { buildThreadRouteParams } from "../threadRoutes";
15
+import { useEnvironment } from "./environments";
16
+import { peerLinkEnvironment, useLinkedEnvironments } from "./peerLinks";
17
+import { useEnvironmentQuery } from "./query";
18
+
19
+/**
20
+ * How a click opens a thread that the thread `panelRef` says is on a linked environment: in place
21
+ * when this client is connected there itself, else as a read-only tab in that thread's right
22
+ * panel, read through its environment. Once the link is gone a saved environment opens in place,
23
+ * where the client can reconnect to it; with neither, the tab says what to link again.
24
+ */
25
+export function useLinkedThreadOpener(
26
+ panelRef: ScopedThreadRef,
27
+ thread:
28
+ | {
29
+ readonly environmentId: EnvironmentId;
30
+ readonly threadId: ThreadId;
31
+ readonly label: string;
32
+ }
33
+ | undefined,
34
+ title: string | null,
35
+): { readonly mode: Exclude<LinkedThreadOpen, "unavailable">; readonly open: () => void } | null {
36
+ const navigate = useNavigate();
37
+ const viaEnvironmentId = panelRef.environmentId;
38
+ const own = useEnvironment(thread?.environmentId ?? null);
39
+ const connected = own?.connection.phase === "connected";
40
+ const links = useLinkedEnvironments(thread === undefined || connected ? null : viaEnvironmentId);
41
+ if (thread === undefined) return null;
42
+ const resolved = resolveLinkedThreadOpen({
43
+ environmentId: thread.environmentId,
44
+ viaEnvironmentId,
45
+ own: own === null ? undefined : { connected },
46
+ linked: links.has(thread.environmentId),
47
+ });
48
+ const mode = resolved === "direct" ? "direct" : "linked";
49
+ return {
50
+ mode,
51
+ open: () => {
52
+ if (mode === "linked") {
53
+ useRightPanelStore.getState().openLinkedThread(panelRef, {
54
+ viaEnvironmentId,
55
+ environmentId: thread.environmentId,
56
+ threadId: thread.threadId,
57
+ label: own?.label ?? thread.label,
58
+ title,
59
+ });
60
+ return;
61
+ }
62
+ void navigate({
63
+ to: "/$environmentId/$threadId",
64
+ params: buildThreadRouteParams(scopeThreadRef(thread.environmentId, thread.threadId)),
65
+ });
66
+ },
67
+ };
68
+}
69
+
70
+type TabKey = readonly [
71
+ panelEnvironmentId: EnvironmentId,
72
+ panelThreadId: ThreadId,
73
+ surfaceId: string,
74
+ viaEnvironmentId: EnvironmentId,
75
+ environmentId: EnvironmentId,
76
+ threadId: ThreadId,
77
+];
78
+
79
+const targetOf = (
80
+ surface: Pick<LinkedThreadSurface, "viaEnvironmentId" | "environmentId" | "threadId">,
81
+) => ({
82
+ environmentId: surface.viaEnvironmentId,
83
+ input: { environmentId: surface.environmentId, threadId: surface.threadId },
84
+});
85
+
86
+/** One tab's subscription, which also keeps the tab's title to the thread's own. */
87
+const tabViewAtom = Atom.family((key: string) => {
88
+ const [panelEnvironmentId, panelThreadId, surfaceId, viaEnvironmentId, environmentId, threadId] =
89
+ JSON.parse(key) as TabKey;
90
+ const panelRef = scopeThreadRef(panelEnvironmentId, panelThreadId);
91
+ const view = peerLinkEnvironment.threadView(
92
+ targetOf({ viaEnvironmentId, environmentId, threadId }),
93
+ );
94
+ return Atom.make((get) => {
95
+ const live = get(view);
96
+ const title = AsyncResult.getOrElse(live, () => null)?.thread.projection?.thread.title;
97
+ if (title) useRightPanelStore.getState().setLinkedThreadTitle(panelRef, surfaceId, title);
98
+ return live;
99
+ }).pipe(Atom.setIdleTTL(0), Atom.withLabel(`linked-thread-tab-view:${key}`));
100
+});
101
+
102
+/**
103
+ * The thread of `surface`, streamed through the environment that links to it for the tab in
104
+ * `panelRef`'s panel. The stream runs only while `visible`; what it last showed stays.
105
+ */
106
+export function useLinkedThreadView(
107
+ panelRef: ScopedThreadRef,
108
+ surface: Pick<LinkedThreadSurface, "id" | "viaEnvironmentId" | "environmentId" | "threadId">,
109
+ visible: boolean,
110
+) {
111
+ const key: TabKey = [
112
+ panelRef.environmentId,
113
+ panelRef.threadId,
114
+ surface.id,
115
+ surface.viaEnvironmentId,
116
+ surface.environmentId,
117
+ surface.threadId,
118
+ ];
119
+ const live = useEnvironmentQuery(visible ? tabViewAtom(JSON.stringify(key)) : null);
120
+ const view = useAtomValue(peerLinkEnvironment.lastThreadView(targetOf(surface)));
121
+ return {
122
+ view,
123
+ /** Why the stream is not running: it ended, or it waits to ask again. */
124
+ error: live.failure ?? view?.error ?? null,
125
+ /** Asks again now. */
126
+ retry: live.refresh,
127
+ };
128
+}
129
+
130
+/** Where a linked thread's expanded rows read an item in full: through the linking environment. */
131
+export const linkedThreadItemSource = (
132
+ target: Pick<LinkedThreadSurface, "viaEnvironmentId" | "environmentId">,
133
+): TurnItemSource => ({
134
+ detail: (input) =>
135
+ peerLinkEnvironment.threadItem({
136
+ environmentId: target.viaEnvironmentId,
137
+ input: { environmentId: target.environmentId, ...input },
138
+ }),
139
+});
apps/web/src/state/peerLinks.ts
+2
-3
@@ -30,8 +30,7 @@ const offersNoLinksAtom = Atom.make(false).pipe(Atom.withLabel("peer-links:offer
30
31
/**
32
* The machines `environmentId` links to, by name, while it offers links, and none otherwise.
33
- * Its agents can read threads there. Listing asks each linked machine whether it answers, so
34
- * every caller shares one briefly cached list.
33
+ * Its agents can read threads there, and so can a client allowed to read threads on it.
34
*/
35
export function useLinkedEnvironments(
36
environmentId: EnvironmentId | null,
@@ -42,7 +41,7 @@ export function useLinkedEnvironments(
41
const identities = useEnvironmentIdentities();
42
const links = useEnvironmentQuery(
43
offered && environmentId !== null
45
- ? peerLinkEnvironment.list({ environmentId, input: {} })
44
+ ? peerLinkEnvironment.names({ environmentId, input: {} })
45
: null,
46
);
47
return linkedEnvironmentNames({
docs/internals/environment-auth.md
+3
-1
@@ -77,7 +77,9 @@ The result is an ordinary session with subject `mcp-client`. A read-only
77
grant holds `orchestration:read` alone. On `/mcp` it passes only tools
78
declared as reads in [McpToolAccess](../../apps/server/src/mcp/McpToolAccess.ts),
79
where every tool must declare who may call it to compile. Any other grant adds
80
-`orchestration:operate` and a signed ceiling. Only `/mcp` accepts these sessions. Every other HTTP and WebSocket
80
+`orchestration:operate` and a signed ceiling. Only `/mcp` accepts these sessions, and for a
81
+[peer link](remote.md#peer-links)'s session alone the thread routes in
82
+[linkThreadHttp](../../apps/server/src/peer/linkThreadHttp.ts), which only read. Every other HTTP and WebSocket
83
path rejects that subject, because the RPC surface would let the agent act
84
above its ceiling. Inside MCP the credential sets the limits and tool
85
parameters only pick targets; see
docs/internals/remote.md
+12
@@ -115,6 +115,18 @@ Unlinking on the linking side only forgets the token.
115
receiving `/mcp` sends nothing while a wait is open and T3 Connect's edge
116
drops idle requests after about 100 s.
117
118
+**A client reads a linked thread as the thread's own stream.** A client connected
119
+only to the linking environment subscribes to `peerLinks.subscribeThread`;
120
+[`PeerThreadRelay`](../../apps/server/src/peer/PeerThreadRelay.ts) opens the
121
+receiving environment's
122
+[link thread routes](../../apps/server/src/peer/linkThreadHttp.ts) with the
123
+link's token and passes on the same stream items, history pages and item detail
124
+the owner's client gets. Clients reduce and draw it like any thread, read-only,
125
+so there is no second transcript format to keep in step. The relay holds one
126
+upstream per subscription and nothing once the client stops listening. The
127
+routes accept only a peer link's session, refuse browser origins as `/mcp` does,
128
+and serve any access level, since each already reads threads through `/mcp`.
129
+
130
**Work a link paired below full access starts stays within that link.** The
131
receiving environment knows a session is a peer link because the linking side
132
registers its OAuth client with the `t3code-peer-link` software id, and the
docs/user/remote-access.md
+19
@@ -477,6 +477,25 @@ ends, as for any delegated task. It keeps following the task across restarts.
477
If the other machine revokes the link, or the link is removed here, the task
478
fails with that reason.
479
480
+### Read a linked machine's threads
481
+
482
+You can read a thread on a linked machine without connecting this app to it. Open
483
+a task that was delegated there from the thread's agents, or a thread link that
484
+points there, and the thread opens read-only, streamed through the machine you
485
+are connected to over its link. It follows the thread live. On web and desktop
486
+it opens as a tab in the right panel, beside the thread you are in, and shows
487
+the same timeline as any other thread.
488
+
489
+- The view is marked **Read-only** with both machines' names. To reply, approve
490
+ or stop the thread, connect this app to that machine.
491
+- Files, images and published visuals stay on that machine and do not load
492
+ here. A command's output shows as of when you open its row.
493
+- If this app is already connected to that machine, the thread opens there as
494
+ usual instead.
495
+- You need permission to read threads on the machine you are connected to, and
496
+ Linked environments must be on there. Both machines need a version of T3 Code
497
+ that has this view.
498
+
499
## Manage or revoke access
500
501
On the host, **Settings → Sharing & access** lets authorized administrators create
packages/client-runtime/package.json
+8
@@ -111,6 +111,10 @@
111
"types": "./src/linkRequest.ts",
112
"default": "./src/linkRequest.ts"
113
},
114
+ "./linked-thread": {
115
+ "types": "./src/linkedThread.ts",
116
+ "default": "./src/linkedThread.ts"
117
+ },
118
"./scheduled-task-webhook": {
119
"types": "./src/scheduledTaskWebhook.ts",
120
"default": "./src/scheduledTaskWebhook.ts"
@@ -263,6 +267,10 @@
267
"types": "./src/state/orchestration.ts",
268
"default": "./src/state/orchestration.ts"
269
},
270
+ "./state/thread-stream": {
271
+ "types": "./src/state/threadStream.ts",
272
+ "default": "./src/state/threadStream.ts"
273
+ },
274
"./state/thread-history-merge": {
275
"types": "./src/state/threadHistoryMerge.ts",
276
"default": "./src/state/threadHistoryMerge.ts"
packages/client-runtime/src/linkRequest.test.ts
+3
-4
@@ -339,16 +339,15 @@ describe("linkableMachines", () => {
339
});
340
341
describe("linkedEnvironmentNames", () => {
342
- it("names the unexpired links as this client does, else as the link does", () => {
342
+ it("names the links as this client does, else as the link does", () => {
343
const vps = EnvironmentId.make("environment-vps");
344
const mini = EnvironmentId.make("environment-mini");
345
const unsaved = EnvironmentId.make("environment-unsaved");
346
expect(
347
linkedEnvironmentNames({
348
links: [
349
- { environmentId: vps, label: "vps-01", status: "unreachable" },
350
- { environmentId: mini, label: "mini", status: "expired" },
351
- { environmentId: unsaved, label: "Office box", status: "reachable" },
349
+ { environmentId: vps, label: "vps-01" },
350
+ { environmentId: unsaved, label: "Office box" },
351
],
352
environments: [
353
{ environmentId: vps, label: "Hetzner VPS" },
packages/client-runtime/src/linkRequest.ts
+6
-7
@@ -5,6 +5,7 @@ import {
5
type EnvironmentMachineKind,
6
type OrchestrationV2TurnItem,
7
type PeerLinkRequestAnswerInput,
8
+ type PeerLinkName,
9
type PeerLinkSummary,
10
resolveEnvironmentMachineKind,
11
type ServerConfig,
@@ -27,11 +28,11 @@ export const offersLinkedEnvironments = (
28
config?.environment.capabilities.peerLinks === true && config.settings.linkedEnvironmentsEnabled;
29
30
/**
30
- * The machines an environment's agents can work on, by name: its links that have not
31
- * expired, named as this client names them, else as the link does.
31
+ * The machines an environment's agents can work on, by name: its unexpired links (the server
32
+ * leaves out expired ones), named as this client names them, else as the link does.
33
*/
34
export function linkedEnvironmentNames(input: {
34
- readonly links: ReadonlyArray<Pick<PeerLinkSummary, "environmentId" | "label" | "status">>;
35
+ readonly links: ReadonlyArray<PeerLinkName>;
36
readonly environments: ReadonlyArray<{
37
readonly environmentId: EnvironmentId;
38
readonly label: string;
@@ -41,10 +42,8 @@ export function linkedEnvironmentNames(input: {
42
input.environments.map((environment) => [environment.environmentId, environment.label]),
43
);
44
return new Map(
44
- input.links.flatMap((link) =>
45
- link.status === "expired"
46
- ? []
47
- : [[link.environmentId, names.get(link.environmentId) ?? link.label] as const],
45
+ input.links.map(
46
+ (link) => [link.environmentId, names.get(link.environmentId) ?? link.label] as const,
47
),
48
);
49
}
packages/client-runtime/src/linkedThread.test.ts
new
+160
@@ -0,0 +1,160 @@
1
+import {
2
+ EventId,
3
+ type OrchestrationV2ThreadHistoryPage,
4
+ type OrchestrationV2ThreadStreamItem,
5
+} from "@t3tools/contracts";
6
+import { expect, it } from "@effect/vitest";
7
+import * as Effect from "effect/Effect";
8
+import * as Fiber from "effect/Fiber";
9
+import * as Queue from "effect/Queue";
10
+import * as Stream from "effect/Stream";
11
+import { TestClock } from "effect/testing";
12
+
13
+import {
14
+ followLinkedThread,
15
+ keepLinkedThreadView,
16
+ LINKED_THREAD_RETRY_MS,
17
+ type LinkedThreadView,
18
+} from "./linkedThread.ts";
19
+import { v2Now, v2Projection } from "./state/orchestrationV2TestFixtures.ts";
20
+
21
+const snapshot = (
22
+ snapshotSequence: number,
23
+ historyCursor: string | null = null,
24
+): OrchestrationV2ThreadStreamItem => ({
25
+ kind: "snapshot",
26
+ snapshotSequence,
27
+ projection: v2Projection,
28
+ historyCursor,
29
+ hasMoreHistory: historyCursor !== null,
30
+});
31
+
32
+const retitled = (sequence: number, title: string): OrchestrationV2ThreadStreamItem => ({
33
+ kind: "event",
34
+ sequence,
35
+ event: {
36
+ id: EventId.make(`event:${sequence}`),
37
+ type: "thread.metadata-updated",
38
+ threadId: v2Projection.thread.id,
39
+ occurredAt: v2Now,
40
+ payload: { ...v2Projection.thread, title },
41
+ },
42
+});
43
+
44
+const failure = (reason: string) => ({ _tag: "PeerLinkThreadReadError", reason });
45
+const titleOf = (view: LinkedThreadView) => view.thread.projection?.thread.title ?? null;
46
+
47
+it.effect("keeps what it read while a linked environment is out of reach, and asks it again", () =>
48
+ Effect.gen(function* () {
49
+ const attempts = [
50
+ Stream.make(snapshot(1), retitled(2, "Renamed")).pipe(
51
+ Stream.concat(Stream.fail(failure("unreachable"))),
52
+ ),
53
+ Stream.make(snapshot(5)).pipe(Stream.concat(Stream.fail(failure("expired")))),
54
+ ];
55
+ let opened = 0;
56
+ const views = yield* Queue.unbounded<LinkedThreadView>();
57
+ const following = yield* followLinkedThread({
58
+ items: Stream.suspend(() => attempts[opened++]!),
59
+ historyPage: () => Effect.die("unused"),
60
+ }).pipe(
61
+ Stream.runForEach((view) => Queue.offer(views, view)),
62
+ Effect.flip,
63
+ Effect.forkChild,
64
+ );
65
+
66
+ expect(titleOf(yield* Queue.take(views))).toBe(v2Projection.thread.title);
67
+ expect(titleOf(yield* Queue.take(views))).toBe("Renamed");
68
+ // Out of reach: the thread stays as read, with the reason beside it.
69
+ const waiting = yield* Queue.take(views);
70
+ expect([titleOf(waiting), waiting.error]).toEqual(["Renamed", failure("unreachable")]);
71
+ expect(opened).toBe(1);
72
+
73
+ yield* TestClock.adjust(LINKED_THREAD_RETRY_MS);
74
+ // It answers again: its snapshot replaces the thread and clears the reason.
75
+ const back = yield* Queue.take(views);
76
+ expect([titleOf(back), back.error, back.thread.sequence]).toEqual([
77
+ v2Projection.thread.title,
78
+ null,
79
+ 5,
80
+ ]);
81
+ // A link that expired cannot come back by waiting, so the stream ends with it.
82
+ expect(yield* Fiber.join(following)).toEqual(failure("expired"));
83
+ expect(opened).toBe(2);
84
+ }),
85
+);
86
+
87
+it.effect("keeps the thread a view showed while its reopened stream has read nothing", () =>
88
+ Effect.gen(function* () {
89
+ const attempts = [
90
+ Stream.make(snapshot(1, "cursor-1"), retitled(2, "Renamed")),
91
+ // The view closed and opened again while the linked environment was out of reach.
92
+ Stream.fail(failure("unreachable")),
93
+ Stream.make(snapshot(5)).pipe(Stream.concat(Stream.never)),
94
+ ];
95
+ let opened = 0;
96
+ const follow = () =>
97
+ followLinkedThread({
98
+ items: Stream.suspend(() => attempts[opened++]!),
99
+ historyPage: () => Effect.die("unused"),
100
+ });
101
+ let kept: LinkedThreadView | null = null;
102
+ yield* follow().pipe(
103
+ Stream.runForEach((view) => Effect.sync(() => (kept = keepLinkedThreadView(kept, view)))),
104
+ );
105
+
106
+ const views = yield* Queue.unbounded<LinkedThreadView>();
107
+ yield* follow().pipe(
108
+ Stream.runForEach((view) => Queue.offer(views, keepLinkedThreadView(kept, view))),
109
+ Effect.forkScoped,
110
+ );
111
+ const waiting = yield* Queue.take(views);
112
+ expect([titleOf(waiting), waiting.error]).toEqual(["Renamed", failure("unreachable")]);
113
+ // Earlier turns belong to a stream that is gone, so none are offered until one is back.
114
+ expect(waiting.thread.historyCursor).toBeNull();
115
+
116
+ yield* TestClock.adjust(LINKED_THREAD_RETRY_MS);
117
+ const back = yield* Queue.take(views);
118
+ expect([titleOf(back), back.error, back.thread.sequence]).toEqual([
119
+ v2Projection.thread.title,
120
+ null,
121
+ 5,
122
+ ]);
123
+ }).pipe(Effect.scoped),
124
+);
125
+
126
+it.effect("loads the turns before a snapshot's window once per request", () =>
127
+ Effect.gen(function* () {
128
+ const asked: string[] = [];
129
+ const page: OrchestrationV2ThreadHistoryPage = {
130
+ snapshotSequence: 1,
131
+ items: [],
132
+ nextCursor: null,
133
+ hasMoreHistory: false,
134
+ };
135
+ const views = yield* Queue.unbounded<LinkedThreadView>();
136
+ yield* followLinkedThread({
137
+ items: Stream.make(snapshot(1, "cursor-1")).pipe(Stream.concat(Stream.never)),
138
+ historyPage: (cursor) =>
139
+ Effect.sync(() => {
140
+ asked.push(cursor);
141
+ return page;
142
+ }),
143
+ }).pipe(
144
+ Stream.runForEach((view) => Queue.offer(views, view)),
145
+ Effect.forkScoped,
146
+ );
147
+
148
+ const shown = yield* Queue.take(views);
149
+ expect(shown.thread.historyCursor).toBe("cursor-1");
150
+ shown.loadEarlier();
151
+ // A second tap while the page loads asks for nothing more.
152
+ shown.loadEarlier();
153
+ expect((yield* Queue.take(views)).history).toEqual({ loading: true, failed: false });
154
+ const loaded = yield* Queue.take(views);
155
+ expect([loaded.history.loading, loaded.thread.historyCursor]).toEqual([false, null]);
156
+ // Nothing is left to load.
157
+ loaded.loadEarlier();
158
+ expect(asked).toEqual(["cursor-1"]);
159
+ }).pipe(Effect.scoped),
160
+);
packages/client-runtime/src/linkedThread.ts
new
+275
@@ -0,0 +1,275 @@
1
+import type {
2
+ EnvironmentId,
3
+ OrchestrationV2ThreadHistoryPage,
4
+ OrchestrationV2ThreadProjection,
5
+ OrchestrationV2ThreadStreamItem,
6
+ ThreadId,
7
+} from "@t3tools/contracts";
8
+import * as Effect from "effect/Effect";
9
+import * as Queue from "effect/Queue";
10
+import * as Stream from "effect/Stream";
11
+import { mFallback, msg } from "gt-i18n";
12
+import type { MFunctionType } from "gt-i18n/types";
13
+
14
+import {
15
+ deriveRunlessWorkStartedAt,
16
+ deriveThreadStructureRuntime,
17
+} from "./state/threadExecution.ts";
18
+import {
19
+ applyThreadHistoryPage,
20
+ applyThreadStreamItem,
21
+ initialThreadStreamState,
22
+ type ThreadStreamState,
23
+} from "./state/threadStream.ts";
24
+
25
+/** A thread on a linked environment, read through the environment that holds the link. */
26
+export interface LinkedThreadTarget {
27
+ /** The environment this client is connected to, which reads the thread over its link. */
28
+ readonly viaEnvironmentId: EnvironmentId;
29
+ /** The linked environment the thread lives in. */
30
+ readonly environmentId: EnvironmentId;
31
+ readonly threadId: ThreadId;
32
+ /** What to call the linked environment and the thread until the first page names them. */
33
+ readonly label: string;
34
+ readonly title: string | null;
35
+}
36
+
37
+export type LinkedThreadOpen = "direct" | "linked" | "unavailable";
38
+
39
+/**
40
+ * How a client opens a thread on `environmentId` that a thread or link in `viaEnvironmentId`
41
+ * points at. A connection of the client's own always wins, since it can do more than read. Without
42
+ * one, the environment holding the link reads it. A saved environment that neither answers nor is
43
+ * linked still opens directly, where the client says it is offline.
44
+ */
45
+export function resolveLinkedThreadOpen(input: {
46
+ readonly environmentId: EnvironmentId;
47
+ readonly viaEnvironmentId: EnvironmentId;
48
+ /** The client's own saved connection to `environmentId`, when it has one. */
49
+ readonly own: { readonly connected: boolean } | undefined;
50
+ /** Whether `viaEnvironmentId` holds a link to `environmentId`. */
51
+ readonly linked: boolean;
52
+}): LinkedThreadOpen {
53
+ if (input.environmentId === input.viaEnvironmentId) return "direct";
54
+ if (input.own?.connected === true) return "direct";
55
+ if (input.linked) return "linked";
56
+ return input.own === undefined ? "unavailable" : "direct";
57
+}
58
+
59
+const hasStringField = <K extends string>(value: unknown, key: K): value is Record<K, string> =>
60
+ typeof value === "object" &&
61
+ value !== null &&
62
+ typeof (value as Record<string, unknown>)[key] === "string";
63
+
64
+/** Whether a failed read can succeed later with nothing changed: the linked environment was only out of reach. */
65
+const isLinkedThreadUnreachable = (error: unknown): boolean =>
66
+ hasStringField(error, "_tag") &&
67
+ error._tag === "PeerLinkThreadReadError" &&
68
+ hasStringField(error, "reason") &&
69
+ error.reason === "unreachable";
70
+
71
+export interface LinkedThreadFailure {
72
+ readonly title: string;
73
+ readonly detail: string;
74
+ /** Whether reading again can succeed without the user changing something first. */
75
+ readonly retryable: boolean;
76
+}
77
+
78
+/**
79
+ * A failed read in the user's words. `via` and `label` name the two environments as the client
80
+ * knows them; the server's own label wins once it has answered with one.
81
+ */
82
+export function linkedThreadFailure(
83
+ error: unknown,
84
+ names: { readonly via: string; readonly label: string },
85
+ resolve: MFunctionType = mFallback,
86
+): LinkedThreadFailure {
87
+ const via = names.via;
88
+ const serverMessage = hasStringField(error, "message") ? error.message : "";
89
+ if (!hasStringField(error, "_tag") || error._tag !== "PeerLinkThreadReadError") {
90
+ // An environment from before this read answers with an unknown method.
91
+ return {
92
+ title: resolve(msg("Could not read this thread through {via}", { via })),
93
+ detail:
94
+ serverMessage ||
95
+ resolve(msg("{via} may need an update before it can read linked threads.", { via })),
96
+ retryable: true,
97
+ };
98
+ }
99
+ const retryable = isLinkedThreadUnreachable(error);
100
+ const label = hasStringField(error, "label") ? error.label : names.label;
101
+ const reason = hasStringField(error, "reason") ? error.reason : "";
102
+ switch (reason) {
103
+ case "disabled":
104
+ return {
105
+ title: resolve(msg("Linked environments is off on {via}", { via })),
106
+ detail: resolve(
107
+ msg(
108
+ "Turn it on in {via}'s Settings → Labs to read threads on the machines it links to.",
109
+ {
110
+ via,
111
+ },
112
+ ),
113
+ ),
114
+ retryable,
115
+ };
116
+ case "unknown_link":
117
+ return {
118
+ title: resolve(msg("{via} is no longer linked to {label}", { via, label })),
119
+ detail: resolve(
120
+ msg("Link it again in {via}'s Settings → Connections to read its threads from here.", {
121
+ via,
122
+ }),
123
+ ),
124
+ retryable,
125
+ };
126
+ case "expired":
127
+ return {
128
+ title: resolve(msg("The link from {via} to {label} expired", { via, label })),
129
+ detail: resolve(
130
+ msg("Link it again in {via}'s Settings → Connections with a new pairing code.", { via }),
131
+ ),
132
+ retryable,
133
+ };
134
+ case "rejected":
135
+ return {
136
+ title: resolve(msg("{label} refused the read", { label })),
137
+ detail: serverMessage,
138
+ retryable,
139
+ };
140
+ case "thread_not_found":
141
+ return {
142
+ title: resolve(msg("This thread is no longer on {label}", { label })),
143
+ detail: resolve(msg("It may have been deleted there.")),
144
+ retryable,
145
+ };
146
+ case "incompatible":
147
+ return {
148
+ title: resolve(msg("{label} needs an update", { label })),
149
+ detail: serverMessage,
150
+ retryable,
151
+ };
152
+ default:
153
+ return {
154
+ title: resolve(msg("{label} is not answering {via}", { label, via })),
155
+ detail: serverMessage,
156
+ retryable,
157
+ };
158
+ }
159
+}
160
+
161
+const WORKING_STATUSES = new Set(["preparing", "queued", "starting", "running", "waiting"]);
162
+
163
+/** Whether the thread has work under way, for the note that stands where its composer would. */
164
+export function isLinkedThreadWorking(projection: OrchestrationV2ThreadProjection): boolean {
165
+ return (
166
+ WORKING_STATUSES.has(deriveThreadStructureRuntime(projection)?.status ?? "") ||
167
+ deriveRunlessWorkStartedAt(projection) !== null
168
+ );
169
+}
170
+
171
+/** How long a view waits before asking again for a thread whose environment did not answer. */
172
+export const LINKED_THREAD_RETRY_MS = 15_000;
173
+
174
+/** A linked thread as its view holds it: the thread's own stream, reduced as any thread's is. */
175
+export interface LinkedThreadView {
176
+ readonly thread: ThreadStreamState;
177
+ /** Why the stream stopped, while the view waits to ask again; the next item clears it. */
178
+ readonly error: unknown;
179
+ readonly history: { readonly loading: boolean; readonly failed: boolean };
180
+ /** Loads the turns before the ones shown. Does nothing while a page loads or none is left. */
181
+ readonly loadEarlier: () => void;
182
+}
183
+
184
+/**
185
+ * What a view keeps once its stream shows `next`. A stream that was opened again has read nothing
186
+ * until its snapshot arrives, so the thread read before stays, with the new stream's state beside
187
+ * it. Its earlier turns load again only once that stream has a thread of its own to add them to.
188
+ */
189
+export const keepLinkedThreadView = (
190
+ kept: LinkedThreadView | null,
191
+ next: LinkedThreadView,
192
+): LinkedThreadView =>
193
+ next.thread.projection !== null || kept === null || kept.thread.projection === null
194
+ ? next
195
+ : { ...next, thread: { ...kept.thread, historyCursor: null } };
196
+
197
+/**
198
+ * Follows a linked environment's thread for as long as something consumes the result. The thread
199
+ * is built from the same stream items and with the same reducer as a guest page's, and older
200
+ * turns load through the same cursor. A linked environment that stops answering is asked again
201
+ * after a wait, with what was read kept; any other failure ends the stream.
202
+ */
203
+export const followLinkedThread = <E, R, E2, R2>(source: {
204
+ readonly items: Stream.Stream<OrchestrationV2ThreadStreamItem, E, R>;
205
+ readonly historyPage: (cursor: string) => Effect.Effect<OrchestrationV2ThreadHistoryPage, E2, R2>;
206
+}): Stream.Stream<LinkedThreadView, E, R | R2> =>
207
+ Stream.unwrap(
208
+ Effect.gen(function* () {
209
+ const requests = yield* Queue.unbounded<void>();
210
+ let requested = false;
211
+ // Both halves below run one step at a time, so each reads the view the other left.
212
+ let view: LinkedThreadView = {
213
+ thread: initialThreadStreamState,
214
+ error: null,
215
+ history: { loading: false, failed: false },
216
+ loadEarlier: () => {
217
+ if (requested || view.thread.historyCursor === null) return;
218
+ requested = true;
219
+ Queue.offerUnsafe(requests, undefined);
220
+ },
221
+ };
222
+ const show = (patch: Partial<LinkedThreadView>) => {
223
+ view = { ...view, ...patch };
224
+ return view;
225
+ };
226
+ const attempt = (): Stream.Stream<LinkedThreadView, E, R> =>
227
+ source.items.pipe(
228
+ Stream.map((item) =>
229
+ show({ thread: applyThreadStreamItem(view.thread, item), error: null }),
230
+ ),
231
+ Stream.catch((error) =>
232
+ isLinkedThreadUnreachable(error)
233
+ ? Stream.make(show({ error })).pipe(
234
+ Stream.concat(
235
+ Stream.unwrap(Effect.sleep(LINKED_THREAD_RETRY_MS).pipe(Effect.map(attempt))),
236
+ ),
237
+ )
238
+ : Stream.fail(error),
239
+ ),
240
+ );
241
+ const earlier = Stream.fromQueue(requests).pipe(
242
+ Stream.flatMap(() =>
243
+ Stream.suspend(() => {
244
+ const cursor = view.thread.historyCursor;
245
+ if (cursor === null) {
246
+ requested = false;
247
+ return Stream.empty;
248
+ }
249
+ return Stream.make(show({ history: { loading: true, failed: false } })).pipe(
250
+ Stream.concat(
251
+ Stream.fromEffect(
252
+ source.historyPage(cursor).pipe(
253
+ Effect.match({
254
+ onSuccess: (page) =>
255
+ show({
256
+ thread: applyThreadHistoryPage(view.thread, cursor, page),
257
+ history: { loading: false, failed: false },
258
+ }),
259
+ onFailure: () => show({ history: { loading: false, failed: true } }),
260
+ }),
261
+ Effect.ensuring(
262
+ Effect.sync(() => {
263
+ requested = false;
264
+ }),
265
+ ),
266
+ ),
267
+ ),
268
+ ),
269
+ );
270
+ }),
271
+ ),
272
+ );
273
+ return Stream.merge(attempt(), earlier, { haltStrategy: "left" });
274
+ }),
275
+ );
packages/client-runtime/src/rpc/client.ts
+1
@@ -63,6 +63,7 @@ export type EnvironmentSubscriptionRpcTag =
63
| typeof WS_METHODS.providerInstallSubscribe
64
| typeof ORCHESTRATION_V2_WS_METHODS.subscribeShell
65
| typeof ORCHESTRATION_V2_WS_METHODS.subscribeThread
66
+ | typeof WS_METHODS.peerLinksSubscribeThread
67
| typeof ORCHESTRATION_V2_WS_METHODS.subscribeCommandOutput
68
| typeof ORCHESTRATION_V2_WS_METHODS.subscribePromptSuggestion
69
| typeof ORCHESTRATION_V2_WS_METHODS.searchThreadStream
packages/client-runtime/src/state/peerLinks.ts
+88
-9
@@ -1,11 +1,38 @@
1
-import { type PeerLinkSummary, WS_METHODS } from "@t3tools/contracts";
1
+import {
2
+ type EnvironmentId,
3
+ type PeerLinkSummary,
4
+ type PeerLinkThreadInput,
5
+ WS_METHODS,
6
+} from "@t3tools/contracts";
7
import * as DateTime from "effect/DateTime";
8
import * as Duration from "effect/Duration";
9
import * as Effect from "effect/Effect";
5
-import { Atom } from "effect/reactivity";
10
+import { AsyncResult, Atom, type AtomRegistry } from "effect/reactivity";
11
12
import type { EnvironmentRegistry } from "../connection/registry.ts";
8
-import { createEnvironmentRpcCommand, createEnvironmentRpcQueryAtomFamily } from "./runtime.ts";
13
+import {
14
+ followLinkedThread,
15
+ keepLinkedThreadView,
16
+ type LinkedThreadView,
17
+} from "../linkedThread.ts";
18
+import { request, subscribe } from "../rpc/client.ts";
19
+import {
20
+ createEnvironmentRpcCommand,
21
+ createEnvironmentRpcQueryAtomFamily,
22
+ createEnvironmentSubscriptionAtomFamily,
23
+} from "./runtime.ts";
24
+
25
+/** The environment a client reads through, and the linked environment's thread it reads. */
26
+export interface LinkedThreadViewTarget {
27
+ readonly environmentId: EnvironmentId;
28
+ readonly input: PeerLinkThreadInput;
29
+}
30
+
31
+const threadViewKey = ({ environmentId, input }: LinkedThreadViewTarget) =>
32
+ JSON.stringify({
33
+ environmentId,
34
+ input: { environmentId: input.environmentId, threadId: input.threadId },
35
+ });
36
37
export function createPeerLinkEnvironmentAtoms<R, E>(
38
runtime: Atom.AtomRuntime<EnvironmentRegistry | R, E>,
@@ -16,13 +43,59 @@ export function createPeerLinkEnvironmentAtoms<R, E>(
43
// Listing probes every linked environment, so a list stays fresh briefly.
44
staleTimeMs: 10_000,
45
});
46
+ // Names only, for opening linked threads with thread read access; it probes nothing.
47
+ const names = createEnvironmentRpcQueryAtomFamily(runtime, {
48
+ label: "environment-data:peer-links:names",
49
+ tag: WS_METHODS.peerLinksNames,
50
+ staleTimeMs: 10_000,
51
+ });
52
+ const refreshLinks = (registry: AtomRegistry.AtomRegistry, environmentId: EnvironmentId) =>
53
+ Effect.sync(() => {
54
+ registry.refresh(list({ environmentId, input: {} }));
55
+ registry.refresh(names({ environmentId, input: {} }));
56
+ });
57
+ const threadStream = createEnvironmentSubscriptionAtomFamily(runtime, {
58
+ label: "environment-data:peer-links:thread-stream",
59
+ idleTtlMs: 0,
60
+ subscribe: (input: PeerLinkThreadInput) =>
61
+ followLinkedThread({
62
+ items: subscribe(WS_METHODS.peerLinksSubscribeThread, input),
63
+ historyPage: (cursor) =>
64
+ request(WS_METHODS.peerLinksThreadHistoryPage, { ...input, cursor }),
65
+ }),
66
+ });
67
+ /**
68
+ * What a view of the thread last showed. It outlives the subscription for a while, so coming
69
+ * back to the view shows the thread at once while the stream starts again.
70
+ */
71
+ const lastThreadView = Atom.family((key: string) =>
72
+ Atom.make<LinkedThreadView | null>(null).pipe(
73
+ Atom.setIdleTTL(5 * 60_000),
74
+ Atom.withLabel(`environment-data:peer-links:last-thread-view:${key}`),
75
+ ),
76
+ );
77
+ /**
78
+ * A linked environment's thread, streamed while a view reads it. The subscription ends with its
79
+ * last reader, which closes the stream at the linked environment too.
80
+ */
81
+ const threadView = Atom.family((key: string) => {
82
+ const stream = threadStream(JSON.parse(key) as LinkedThreadViewTarget);
83
+ return Atom.make((get) => {
84
+ const live = get(stream);
85
+ if (AsyncResult.isSuccess(live)) {
86
+ const kept = lastThreadView(key);
87
+ get.set(kept, keepLinkedThreadView(get.once(kept), live.value));
88
+ }
89
+ return live;
90
+ }).pipe(Atom.setIdleTTL(0), Atom.withLabel(`environment-data:peer-links:thread-view:${key}`));
91
+ });
92
return {
93
list,
94
+ names,
95
link: createEnvironmentRpcCommand(runtime, {
96
label: "environment-data:peer-links:link",
97
tag: WS_METHODS.peerLinksLink,
24
- onSuccess: ({ environmentId }, registry) =>
25
- Effect.sync(() => registry.refresh(list({ environmentId, input: {} }))),
98
+ onSuccess: ({ environmentId }, registry) => refreshLinks(registry, environmentId),
99
}),
100
// Leaves the list alone: a batch refreshes it once, when it ends (`runLinkBatch`).
101
linkInBatch: createEnvironmentRpcCommand(runtime, {
@@ -32,8 +105,15 @@ export function createPeerLinkEnvironmentAtoms<R, E>(
105
unlink: createEnvironmentRpcCommand(runtime, {
106
label: "environment-data:peer-links:unlink",
107
tag: WS_METHODS.peerLinksUnlink,
35
- onSuccess: ({ environmentId }, registry) =>
36
- Effect.sync(() => registry.refresh(list({ environmentId, input: {} }))),
108
+ onSuccess: ({ environmentId }, registry) => refreshLinks(registry, environmentId),
109
+ }),
110
+ threadView: (target: LinkedThreadViewTarget) => threadView(threadViewKey(target)),
111
+ lastThreadView: (target: LinkedThreadViewTarget) => lastThreadView(threadViewKey(target)),
112
+ /** One item of a linked environment's thread in full, for a row the reader opened. */
113
+ threadItem: createEnvironmentRpcQueryAtomFamily(runtime, {
114
+ label: "environment-data:peer-links:thread-item",
115
+ tag: WS_METHODS.peerLinksThreadItem,
116
+ idleTtlMs: 0,
117
}),
118
// An agent's link card. One answer per card at a time.
119
answerRequest: createEnvironmentRpcCommand(runtime, {
@@ -44,8 +124,7 @@ export function createPeerLinkEnvironmentAtoms<R, E>(
124
key: ({ environmentId, input }) =>
125
JSON.stringify([environmentId, input.threadId, input.turnItemId]),
126
},
47
- onSuccess: ({ environmentId }, registry) =>
48
- Effect.sync(() => registry.refresh(list({ environmentId, input: {} }))),
127
+ onSuccess: ({ environmentId }, registry) => refreshLinks(registry, environmentId),
128
}),
129
};
130
}
packages/client-runtime/src/state/threadStream.ts
new
+94
@@ -0,0 +1,94 @@
1
+import type {
2
+ OrchestrationV2ThreadHistoryPage,
3
+ OrchestrationV2ThreadProjection,
4
+ OrchestrationV2ThreadStreamItem,
5
+} from "@t3tools/contracts";
6
+import { boundedSnapshotProjection } from "@t3tools/shared/orchestrationV2BoundedSnapshot";
7
+
8
+import { applyOrchestrationV2ProjectionEvent } from "./orchestrationV2Projection.ts";
9
+import {
10
+ mergeOlderHistoryIntoProjection,
11
+ mergeOlderSubagentsIntoProjection,
12
+} from "./threadHistoryMerge.ts";
13
+
14
+/**
15
+ * A thread built from its stream alone, for a view with no environment connection of its own to
16
+ * the thread: a guest page, or a linked environment's thread read through the link.
17
+ */
18
+export interface ThreadStreamState {
19
+ /** The thread as the owner's client holds it, built with the same reducer. */
20
+ readonly projection: OrchestrationV2ThreadProjection | null;
21
+ readonly sequence: number;
22
+ /** Set while the snapshot is a window of a longer history, as the owner's client tracks it. */
23
+ readonly partial: { readonly latestLocalTurnOrdinal: number | null } | null;
24
+ /** Where "Load earlier turns" continues, or null once the whole thread is loaded. */
25
+ readonly historyCursor: string | null;
26
+}
27
+
28
+export const initialThreadStreamState: ThreadStreamState = {
29
+ projection: null,
30
+ sequence: 0,
31
+ partial: null,
32
+ historyCursor: null,
33
+};
34
+
35
+/**
36
+ * Applies the owner's thread stream the way the owner's client does (see EnvironmentThreadState):
37
+ * a snapshot replaces the thread, and later events pass through the same projection reducer, once
38
+ * each.
39
+ */
40
+export function applyThreadStreamItem(
41
+ state: ThreadStreamState,
42
+ item: OrchestrationV2ThreadStreamItem,
43
+): ThreadStreamState {
44
+ if (item.kind === "snapshot") {
45
+ return {
46
+ projection: boundedSnapshotProjection(item),
47
+ sequence: item.snapshotSequence,
48
+ partial:
49
+ item.hasMoreHistory === true || (item.historyCursor ?? null) !== null
50
+ ? { latestLocalTurnOrdinal: item.latestLocalTurnOrdinal ?? null }
51
+ : null,
52
+ historyCursor: item.hasMoreHistory === true ? (item.historyCursor ?? null) : null,
53
+ };
54
+ }
55
+ if (item.kind === "synchronized" || item.sequence <= state.sequence) return state;
56
+ if (item.kind === "unknown-event") return { ...state, sequence: item.sequence };
57
+ const projection =
58
+ applyOrchestrationV2ProjectionEvent(
59
+ state.projection,
60
+ item.event,
61
+ state.partial === null ? undefined : { partialTimeline: true, ...state.partial },
62
+ ) ?? state.projection;
63
+ const turnItem = item.event.type === "turn-item.updated" ? item.event.payload : null;
64
+ const watermark = state.partial?.latestLocalTurnOrdinal ?? null;
65
+ return {
66
+ ...state,
67
+ projection,
68
+ sequence: item.sequence,
69
+ partial:
70
+ state.partial !== null &&
71
+ turnItem !== null &&
72
+ (watermark === null || turnItem.ordinal > watermark)
73
+ ? { latestLocalTurnOrdinal: turnItem.ordinal }
74
+ : state.partial,
75
+ };
76
+}
77
+
78
+/** Merges a page of older turns, fetched from `cursor`, in front, as in the owner's view. */
79
+export function applyThreadHistoryPage(
80
+ state: ThreadStreamState,
81
+ cursor: string,
82
+ page: OrchestrationV2ThreadHistoryPage,
83
+): ThreadStreamState {
84
+ // A snapshot since the request replaced the thread and its cursor.
85
+ if (state.projection === null || state.historyCursor !== cursor) return state;
86
+ return {
87
+ ...state,
88
+ projection: mergeOlderSubagentsIntoProjection(
89
+ mergeOlderHistoryIntoProjection(state.projection, page.items),
90
+ page.subagents,
91
+ ),
92
+ historyCursor: page.hasMoreHistory ? page.nextCursor : null,
93
+ };
94
+}
packages/contracts/src/environment.ts
+3
@@ -188,6 +188,9 @@ export const ExecutionEnvironmentCapabilities = Schema.Struct({
188
(`linkOrigin`). Another environment links to this one only when it is
189
set, since without it that work could change the user's own threads. */
190
linkFence: Schema.optionalKey(Schema.Boolean),
191
+ /** Serves a thread's stream, history pages and item detail to a link's session
192
+ (`PEER_LINK_THREAD_STREAM_ROUTE`), so a client of the linking environment can read it. */
193
+ linkThreadStream: Schema.optionalKey(Schema.Boolean),
194
/** Mints pairing codes that approve one agent sign-in at a set level (`AUTO-…`). */
195
mcpApprovalCodes: Schema.optionalKey(Schema.Boolean),
196
peerLinkPairingCodes: Schema.optionalKey(Schema.Boolean),
packages/contracts/src/peerLink.ts
+67
@@ -32,6 +32,16 @@ export const PeerLinkSummary = Schema.Struct({
32
});
33
export type PeerLinkSummary = typeof PeerLinkSummary.Type;
34
35
+/**
36
+ * A link's name only, for a client that may read threads here but not manage access: enough to
37
+ * name and open a linked environment's threads, without its addresses, access or health.
38
+ */
39
+export const PeerLinkName = Schema.Struct({
40
+ environmentId: EnvironmentId,
41
+ label: Schema.String,
42
+});
43
+export type PeerLinkName = typeof PeerLinkName.Type;
44
+
45
export const PeerLinkCreateInput = Schema.Struct({
46
/** Where the peer answers: an https, Tailscale, LAN or loopback base URL. */
47
url: TrimmedNonEmptyString,
@@ -89,6 +99,63 @@ export const peerLinkFailureKind = (
99
? "code_refused"
100
: "other";
101
102
+/**
103
+ * Where an environment serves one of its threads to an environment linked to it, signed in with
104
+ * the link's own session as on `/mcp`. The stream carries the same items the owner's thread
105
+ * subscription does; history pages and item detail are the owner's too.
106
+ */
107
+const PEER_LINK_THREAD_ROUTE_PREFIX = "/api/links/thread";
108
+export const PEER_LINK_THREAD_STREAM_ROUTE = `${PEER_LINK_THREAD_ROUTE_PREFIX}/stream`;
109
+export const PEER_LINK_THREAD_HISTORY_ROUTE = `${PEER_LINK_THREAD_ROUTE_PREFIX}/history`;
110
+export const PEER_LINK_THREAD_ITEM_ROUTE = `${PEER_LINK_THREAD_ROUTE_PREFIX}/item`;
111
+
112
+/** A thread on a linked environment, as a client of this environment names it. */
113
+export const PeerLinkThreadInput = Schema.Struct({
114
+ /** The linked environment the thread lives in. */
115
+ environmentId: EnvironmentId,
116
+ threadId: ThreadId,
117
+});
118
+export type PeerLinkThreadInput = typeof PeerLinkThreadInput.Type;
119
+
120
+export const PeerLinkThreadHistoryInput = Schema.Struct({
121
+ ...PeerLinkThreadInput.fields,
122
+ /** The `historyCursor` of the snapshot or of the page before. */
123
+ cursor: TrimmedNonEmptyString,
124
+});
125
+export type PeerLinkThreadHistoryInput = typeof PeerLinkThreadHistoryInput.Type;
126
+
127
+export const PeerLinkThreadItemInput = Schema.Struct({
128
+ ...PeerLinkThreadInput.fields,
129
+ itemId: TurnItemId,
130
+ /** Unused by the server; a client keys its cache on it, as for its own threads' items. */
131
+ revision: Schema.optional(Schema.String),
132
+});
133
+export type PeerLinkThreadItemInput = typeof PeerLinkThreadItemInput.Type;
134
+
135
+/** Why a linked environment's thread could not be read, with the reason in words. */
136
+export class PeerLinkThreadReadError extends Schema.TaggedError<PeerLinkThreadReadError>()(
137
+ "PeerLinkThreadReadError",
138
+ {
139
+ reason: Schema.Literals([
140
+ /** Linked environments is off here. */
141
+ "disabled",
142
+ "unknown_link",
143
+ "expired",
144
+ /** The linked environment no longer accepts the link, or refuses the read. */
145
+ "rejected",
146
+ "unreachable",
147
+ "thread_not_found",
148
+ /** The linked environment runs a version that does not serve its threads to a link. */
149
+ "incompatible",
150
+ ]),
151
+ /** What this environment calls the linked one, when it still has the link. */
152
+ label: Schema.NullOr(Schema.String),
153
+ message: Schema.String,
154
+ /** The failure underneath, when the read got as far as the link or the linked environment. */
155
+ cause: Schema.optionalKey(Schema.Defect()),
156
+ },
157
+) {}
158
+
159
/**
160
* The user's answer to an agent asking to link an environment. The pairing
161
* code is used once to link and is never recorded; the thread learns only the
packages/contracts/src/rpc.ts
+41
@@ -20,11 +20,16 @@ import {
20
PeerLink,
21
PeerLinkCreateInput,
22
PeerLinkError,
23
+ PeerLinkName,
24
PeerLinkRemoveInput,
25
PeerLinkRemoveResult,
26
PeerLinkRequestAnswerInput,
27
PeerLinkRequestError,
28
PeerLinkSummary,
29
+ PeerLinkThreadHistoryInput,
30
+ PeerLinkThreadInput,
31
+ PeerLinkThreadItemInput,
32
+ PeerLinkThreadReadError,
33
} from "./peerLink.ts";
34
import {
35
ChatGptReconnectProfileInput,
@@ -260,6 +265,7 @@ import {
265
OrchestrationV2CommandOutputError,
266
OrchestrationV2GetThreadProjectionError,
267
OrchestrationV2RpcSchemas,
268
+ OrchestrationV2ThreadHistoryPage,
269
OrchestrationV2ThreadLaunchError,
270
} from "./orchestrationV2.ts";
271
import {
@@ -546,9 +552,13 @@ export const WS_METHODS = {
552
serverGetDatabaseStorage: "server.getDatabaseStorage",
553
serverReclaimDatabaseSpace: "server.reclaimDatabaseSpace",
554
peerLinksList: "peerLinks.list",
555
+ peerLinksNames: "peerLinks.names",
556
peerLinksLink: "peerLinks.link",
557
peerLinksUnlink: "peerLinks.unlink",
558
peerLinksAnswerRequest: "peerLinks.answerRequest",
559
+ peerLinksSubscribeThread: "peerLinks.subscribeThread",
560
+ peerLinksThreadHistoryPage: "peerLinks.threadHistoryPage",
561
+ peerLinksThreadItem: "peerLinks.threadItem",
562
serverGetSettings: "server.getSettings",
563
serverUpdateSettings: "server.updateSettings",
564
serverDiscoverSourceControl: "server.discoverSourceControl",
@@ -890,6 +900,13 @@ const WsPeerLinksListRpc = Rpc.make(WS_METHODS.peerLinksList, {
900
error: Schema.Union([PeerLinkError, EnvironmentAuthorizationError]),
901
});
902
903
+/** The unexpired links' names, readable with thread read access. */
904
+const WsPeerLinksNamesRpc = Rpc.make(WS_METHODS.peerLinksNames, {
905
+ payload: Schema.Struct({}),
906
+ success: Schema.Struct({ links: Schema.Array(PeerLinkName) }),
907
+ error: Schema.Union([PeerLinkError, EnvironmentAuthorizationError]),
908
+});
909
+
910
const WsPeerLinksLinkRpc = Rpc.make(WS_METHODS.peerLinksLink, {
911
payload: PeerLinkCreateInput,
912
success: PeerLink,
@@ -902,6 +919,26 @@ const WsPeerLinksUnlinkRpc = Rpc.make(WS_METHODS.peerLinksUnlink, {
919
error: Schema.Union([PeerLinkError, EnvironmentAuthorizationError]),
920
});
921
922
+/** A linked environment's thread, as its own thread subscription streams it. */
923
+const WsPeerLinksSubscribeThreadRpc = Rpc.make(WS_METHODS.peerLinksSubscribeThread, {
924
+ payload: PeerLinkThreadInput,
925
+ success: OrchestrationV2RpcSchemas.subscribeThread.output,
926
+ error: Schema.Union([PeerLinkThreadReadError, EnvironmentAuthorizationError]),
927
+ stream: true,
928
+});
929
+
930
+const WsPeerLinksThreadHistoryPageRpc = Rpc.make(WS_METHODS.peerLinksThreadHistoryPage, {
931
+ payload: PeerLinkThreadHistoryInput,
932
+ success: OrchestrationV2ThreadHistoryPage,
933
+ error: Schema.Union([PeerLinkThreadReadError, EnvironmentAuthorizationError]),
934
+});
935
+
936
+const WsPeerLinksThreadItemRpc = Rpc.make(WS_METHODS.peerLinksThreadItem, {
937
+ payload: PeerLinkThreadItemInput,
938
+ success: OrchestrationV2RpcSchemas.getTurnItem.output,
939
+ error: Schema.Union([PeerLinkThreadReadError, EnvironmentAuthorizationError]),
940
+});
941
+
942
const WsPeerLinksAnswerRequestRpc = Rpc.make(WS_METHODS.peerLinksAnswerRequest, {
943
payload: PeerLinkRequestAnswerInput,
944
error: Schema.Union([PeerLinkRequestError, EnvironmentAuthorizationError]),
@@ -2302,9 +2339,13 @@ export const WsRpcGroup = RpcGroup.make(
2339
WsServerReclaimDatabaseSpaceRpc,
2340
WsServerUpdateSettingsRpc,
2341
WsPeerLinksListRpc,
2342
+ WsPeerLinksNamesRpc,
2343
WsPeerLinksLinkRpc,
2344
WsPeerLinksUnlinkRpc,
2345
WsPeerLinksAnswerRequestRpc,
2346
+ WsPeerLinksSubscribeThreadRpc,
2347
+ WsPeerLinksThreadHistoryPageRpc,
2348
+ WsPeerLinksThreadItemRpc,
2349
WsServerDiscoverSourceControlRpc,
2350
WsServerCheckSecretSourceRpc,
2351
WsServerSearchAcpRegistryRpc,
packages/shared/src/threadLinksCopy.ts
+2
-2
@@ -28,12 +28,12 @@ export function unknownThreadLinkLabel(
28
export function relabelThreadLinks(
29
markdown: string,
30
messageEnvironmentId: EnvironmentId,
31
- title: (ref: ScopedThreadRef) => string | undefined,
31
+ title: (ref: ScopedThreadRef, label: string | undefined) => string | undefined,
32
resolve: MFunctionType = mFallback,
33
): string {
34
return replaceThreadLinks(markdown, (written, label) => {
35
for (const ref of threadLinkCandidates(written, messageEnvironmentId)) {
36
- const current = title(ref);
36
+ const current = title(ref, label);
37
if (current === undefined) continue;
38
return formatThreadLink(
39
{ environmentId: written.environmentId, threadId: ref.threadId },