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

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

fix(web): hosted app skips setup and recommends signing in (#19680)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Theo Browne committed Oct 19, 2026 at 18:34 UTC e37a7a4f71cb20c483e101e13d57ccf3598ab832
15 files changed +407 -187
apps/web/src/branding.ts
+1
@@ -25,3 +25,4 @@ export const APP_DISPLAY_NAME =
25 injectedDesktopAppBranding?.displayName ??
26 formatAppDisplayName({ baseName: APP_BASE_NAME, stageLabel: APP_STAGE_LABEL });
27 export const APP_VERSION = import.meta.env.APP_VERSION || "0.0.0";
28 +export const DESKTOP_DOWNLOAD_URL = "https://t3.codes/download";
apps/web/src/components/HostedEmptyState.browser.test.tsx new
+121
@@ -0,0 +1,121 @@
1 +import type { Discovery } from "@t3tools/client-runtime/relay";
2 +import { EnvironmentId } from "@t3tools/contracts";
3 +import * as Option from "effect/Option";
4 +import { AsyncResult } from "effect/reactivity";
5 +import { act } from "react";
6 +import { createRoot, type Root } from "react-dom/client";
7 +import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
8 +
9 +type DiscoveredEnvironments = Discovery.RelayEnvironmentDiscoveryState["environments"];
10 +type Availability = "checking" | "online";
11 +
12 +const discovery = vi.hoisted(() => ({
13 + state: null as Discovery.RelayEnvironmentDiscoveryState | null,
14 + listeners: new Set<() => void>(),
15 + register: vi.fn(),
16 +}));
17 +
18 +vi.mock(import("@clerk/react"), async (original) => ({
19 + ...(await original()),
20 + useAuth: (() => ({ isLoaded: true, isSignedIn: true })) as never,
21 +}));
22 +vi.mock(import("./clerk/useT3ConnectAuthPrompt"), () => ({
23 + useT3ConnectAuthPrompt: () => ({ authPrompt: null, openAuthPrompt: vi.fn() }),
24 +}));
25 +vi.mock(import("~/state/use-atom-command"), async (original) => {
26 + const { relayEnvironmentDiscovery } = await import("~/state/relay");
27 + return {
28 + ...(await original()),
29 + useAtomCommand: ((command: unknown) =>
30 + command === relayEnvironmentDiscovery.refresh
31 + ? async () => AsyncResult.success(undefined)
32 + : discovery.register) as never,
33 + };
34 +});
35 +vi.mock(import("~/state/environments"), async (original) => {
36 + const { useSyncExternalStore } = await import("react");
37 + const subscribe = (listener: () => void) => {
38 + discovery.listeners.add(listener);
39 + return () => discovery.listeners.delete(listener);
40 + };
41 + const read = () => discovery.state!;
42 + return {
43 + ...(await original()),
44 + useRelayEnvironmentDiscovery: () => useSyncExternalStore(subscribe, read, read),
45 + };
46 +});
47 +
48 +import { T3ConnectSteps } from "./HostedEmptyState";
49 +
50 +const laptopId = EnvironmentId.make("laptop");
51 +const desktopId = EnvironmentId.make("desktop");
52 +
53 +function linked(availability: Record<string, Availability>): DiscoveredEnvironments {
54 + return new Map(
55 + [laptopId, desktopId].map((environmentId) => [
56 + environmentId,
57 + {
58 + environment: {
59 + environmentId,
60 + label: environmentId,
61 + endpoint: {
62 + httpBaseUrl: "https://relay.example.test",
63 + wsBaseUrl: "wss://relay.example.test/ws",
64 + providerKind: "manual",
65 + },
66 + linkedAt: "2026-10-19T12:00:00.000Z",
67 + },
68 + availability: availability[environmentId]!,
69 + status: Option.none(),
70 + error: Option.none(),
71 + },
72 + ]),
73 + );
74 +}
75 +
76 +async function publish(environments: DiscoveredEnvironments) {
77 + discovery.state = { environments, refreshing: false, offline: false, error: Option.none() };
78 + await act(async () => {
79 + for (const listener of discovery.listeners) listener();
80 + });
81 +}
82 +
83 +const registeredIds = () =>
84 + discovery.register.mock.calls.map(([registration]) => registration.target.environmentId);
85 +
86 +let root: Root;
87 +let container: HTMLDivElement;
88 +
89 +beforeEach(() => {
90 + vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
91 + discovery.listeners.clear();
92 + discovery.state = {
93 + environments: new Map(),
94 + refreshing: false,
95 + offline: false,
96 + error: Option.none(),
97 + };
98 + discovery.register.mockReset().mockResolvedValue(AsyncResult.success(undefined));
99 + container = document.createElement("div");
100 + document.body.append(container);
101 + root = createRoot(container);
102 +});
103 +
104 +afterEach(async () => {
105 + await act(async () => root.unmount());
106 + container.remove();
107 + vi.unstubAllGlobals();
108 +});
109 +
110 +// The first added computer replaces this screen with the app, so every
111 +// registration has to start in the same pass, after all health checks finish.
112 +it("adds every linked computer only after discovery finishes checking them", async () => {
113 + await act(async () => root.render(<T3ConnectSteps />));
114 +
115 + await publish(linked({ [laptopId]: "checking", [desktopId]: "checking" }));
116 + await publish(linked({ [laptopId]: "online", [desktopId]: "checking" }));
117 + expect(discovery.register).not.toHaveBeenCalled();
118 +
119 + await publish(linked({ [laptopId]: "online", [desktopId]: "online" }));
120 + expect(registeredIds().toSorted()).toEqual([desktopId, laptopId]);
121 +});
apps/web/src/components/HostedEmptyState.tsx new
+163
@@ -0,0 +1,163 @@
1 +import { useAuth } from "@clerk/react";
2 +import type { EnvironmentId } from "@t3tools/contracts";
3 +import { Link } from "@tanstack/react-router";
4 +import { CheckIcon } from "lucide-react";
5 +import { type ReactNode, useState } from "react";
6 +
7 +import { APP_DISPLAY_NAME, DESKTOP_DOWNLOAD_URL } from "~/branding";
8 +import { hasCloudPublicConfig } from "~/cloud/publicConfig";
9 +import { isElectron } from "../env";
10 +import { isLocalEnvironmentDisabled } from "../localEnvironment";
11 +import { useRelayEnvironmentDiscovery } from "../state/environments";
12 +import { CommandBlock } from "./CommandBlock";
13 +import { useT3ConnectAuthPrompt } from "./clerk/useT3ConnectAuthPrompt";
14 +import { CloudEnvironmentConnectRows } from "./cloud/CloudEnvironmentConnectList";
15 +import { Button } from "./ui/button";
16 +import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyTitle } from "./ui/empty";
17 +import { SidebarInset } from "./ui/sidebar";
18 +import { WorkspacePageHeader } from "./WorkspacePageHeader";
19 +
20 +/** Home screen for the hosted app before any computer is added. */
21 +export function HostedEmptyState() {
22 + const cloudEnabled = hasCloudPublicConfig();
23 + const localEnvironmentOff = isLocalEnvironmentDisabled();
24 +
25 + return (
26 + <SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none">
27 + <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-background">
28 + <WorkspacePageHeader electron={isElectron} className="border-b border-border">
29 + <div className="flex items-center gap-2">
30 + <span className="text-sm font-medium text-foreground md:text-muted-foreground/60">
31 + {APP_DISPLAY_NAME}
32 + </span>
33 + </div>
34 + </WorkspacePageHeader>
35 +
36 + <Empty className="flex-1">
37 + <EmptyHeader>
38 + <EmptyTitle>
39 + {localEnvironmentOff ? "This computer is off" : "No computer connected"}
40 + </EmptyTitle>
41 + <EmptyDescription>
42 + {localEnvironmentOff
43 + ? "Turn it back on, or connect a different computer."
44 + : cloudEnabled
45 + ? "Your agents run on your computer."
46 + : "Your agents run on your computer. Start T3 Code there first."}
47 + </EmptyDescription>
48 + </EmptyHeader>
49 + <EmptyContent>
50 + {localEnvironmentOff ? (
51 + <Button render={<Link to="/settings/connections" />} size="sm">
52 + Open Connections
53 + </Button>
54 + ) : (
55 + <ol className="w-full space-y-4 text-left">
56 + {cloudEnabled ? <T3ConnectSteps /> : <PairingSteps />}
57 + </ol>
58 + )}
59 + </EmptyContent>
60 + </Empty>
61 + </div>
62 + </SidebarInset>
63 + );
64 +}
65 +
66 +export function T3ConnectSteps() {
67 + const { isLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false });
68 + const { openAuthPrompt } = useT3ConnectAuthPrompt();
69 + // Adding the first computer unmounts this screen. Wait for all health checks
70 + // so every compatible registration is queued before that happens.
71 + const [autoAddedComputers] = useState(() => new Set<EnvironmentId>());
72 + const [selectedIds, setSelectedIds] = useState<ReadonlySet<EnvironmentId>>(() => new Set());
73 + const discovered = [...useRelayEnvironmentDiscovery().environments.values()];
74 + const discoverySettled =
75 + discovered.length > 0 && discovered.every(({ availability }) => availability !== "checking");
76 + return (
77 + <>
78 + <SetupStep number={1}>
79 + {isSignedIn ? (
80 + <p className="flex items-center gap-1.5 text-muted-foreground">
81 + <CheckIcon className="size-4" />
82 + Signed in
83 + </p>
84 + ) : (
85 + <Button size="sm" disabled={!isLoaded} onClick={openAuthPrompt}>
86 + Sign in
87 + </Button>
88 + )}
89 + </SetupStep>
90 + <SetupStep number={2}>
91 + <RunOnComputer command="npx t3 connect" />
92 + {isSignedIn ? (
93 + <div className="mt-4 space-y-1.5">
94 + <CloudEnvironmentConnectRows
95 + primaryEnvironmentId={null}
96 + savedEnvironments={[]}
97 + refreshWhileEmpty
98 + selection={{
99 + ...(discoverySettled ? { autoSelectedComputers: autoAddedComputers } : {}),
100 + selectedIds,
101 + onChange: (environmentId, selected) =>
102 + setSelectedIds((current) => {
103 + const next = new Set(current);
104 + if (selected) next.add(environmentId);
105 + else next.delete(environmentId);
106 + return next;
107 + }),
108 + }}
109 + empty={<p className="text-xs text-muted-foreground">Waiting for your computer…</p>}
110 + />
111 + </div>
112 + ) : null}
113 + </SetupStep>
114 + </>
115 + );
116 +}
117 +
118 +function PairingSteps() {
119 + return (
120 + <>
121 + <SetupStep number={1}>
122 + <RunOnComputer command="npx t3 pair" />
123 + </SetupStep>
124 + <SetupStep number={2}>
125 + <Button render={<Link to="/settings/connections" />} size="sm">
126 + Add pairing link
127 + </Button>
128 + </SetupStep>
129 + </>
130 + );
131 +}
132 +
133 +function SetupStep({
134 + number,
135 + children,
136 +}: {
137 + readonly number: number;
138 + readonly children: ReactNode;
139 +}) {
140 + return (
141 + <li className="flex gap-3">
142 + <span className="w-2 shrink-0 pt-1 text-muted-foreground">{number}</span>
143 + <div className="min-w-0 flex-1">{children}</div>
144 + </li>
145 + );
146 +}
147 +
148 +function RunOnComputer({ command }: { readonly command: string }) {
149 + return (
150 + <>
151 + <p>Run on your computer:</p>
152 + <CommandBlock command={command} className="mt-2" />
153 + <a
154 + className="mt-2 inline-block text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground"
155 + href={DESKTOP_DOWNLOAD_URL}
156 + target="_blank"
157 + rel="noreferrer noopener"
158 + >
159 + Or download the desktop app
160 + </a>
161 + </>
162 + );
163 +}
apps/web/src/components/cloud/CloudEnvironmentConnectList.browser.test.tsx
+1
@@ -254,6 +254,7 @@ describe("cloud onboarding discovery", () => {
254 expect(checked()).toBe(false);
255 expect(checkbox().hasAttribute("data-disabled")).toBe(true);
256 expect(text()).toContain("Client not supported");
257 + expect(text()).toContain("Update your app");
258 await toggle();
259 expect(discovery.register).not.toHaveBeenCalled();
260 await act(async () =>
apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx
+8 -1
@@ -387,7 +387,14 @@ export function CloudEnvironmentConnectRows({
387 kind={machineKind}
388 className="size-4 shrink-0 text-muted-foreground"
389 />
390 - <span className="min-w-0 flex-1 truncate text-sm font-medium">{environment.label}</span>
390 + <span className="min-w-0 flex-1">
391 + <span className="block truncate text-sm font-medium">{environment.label}</span>
392 + {unsupportedDetail !== null ? (
393 + <span className="mt-0.5 block text-xs text-muted-foreground">
394 + {unsupportedDetail}
395 + </span>
396 + ) : null}
397 + </span>
398 <Tooltip>
399 <TooltipTrigger
400 render={<span tabIndex={0} />}
apps/web/src/components/cloud/ConnectOnboardingDialog.tsx
+6 -2
@@ -12,6 +12,7 @@ import {
12 import { hasCloudPublicConfig } from "~/cloud/publicConfig";
13 import { useCloudLinkController } from "~/cloud/useCloudLinkController";
14 import { useLocalStorage } from "~/hooks/useLocalStorage";
15 +import { isHostedStaticApp } from "~/hostedPairing";
16 import {
17 useEnvironments,
18 usePrimaryEnvironment,
@@ -46,7 +47,10 @@ function ConfiguredConnectOnboardingDialog() {
47 ConnectOnboardingOptOutSchema,
48 );
49
49 - const { isReady: environmentsReady } = useEnvironments();
50 + const { environments, isReady: environmentsReady } = useEnvironments();
51 + // The empty hosted home already adds account computers after sign-in.
52 + const homeScreenAddsComputers =
53 + isHostedStaticApp() && environmentsReady && environments.length === 0;
54 const primaryEnvironmentId = usePrimaryEnvironmentId();
55 const primarySessionState = useAtomValue(
56 primaryEnvironmentId === null
@@ -110,7 +114,7 @@ function ConfiguredConnectOnboardingDialog() {
114 const publishStepDecided = !canManageRelay || controller.linkState.target !== null;
115
116 if (requestedAccount !== null && openForAccount === null) {
113 - if (optOutAccounts.includes(requestedAccount)) {
117 + if (homeScreenAddsComputers || optOutAccounts.includes(requestedAccount)) {
118 setRequestedAccount(null);
119 } else if (sessionScopesKnown && publishStepDecided) {
120 setRequestedAccount(null);
apps/web/src/components/onboarding/FirstRunGate.tsx
+11 -12
@@ -9,7 +9,6 @@ import {
9 useClientSettings,
10 useClientSettingsHydrationStatus,
11 } from "../../hooks/useSettings";
12 -import { isLocalEnvironmentDisabled } from "../../localEnvironment";
12 import { completeOnboarding } from "../../onboarding/firstRun";
13 import {
14 isFirstRunWorkspaceProvenanceAuthoritative,
@@ -84,7 +83,7 @@ export function FirstRunGate({
83 const hydrated = hydrationStatus === "ready";
84 const onboardingCompletedAt = useClientSettings((settings) => settings.onboardingCompletedAt);
85 const bootstrapped = useAllEnvironmentShellsBootstrapped();
87 - const { environments, isReady: environmentCatalogReady } = useEnvironments();
86 + const { isReady: environmentCatalogReady } = useEnvironments();
87 const projects = useProjects();
88 const threadCount = useAtomValue(threadCountAtom);
89 const soleThread = useAtomValue(soleThreadAtom);
@@ -121,13 +120,7 @@ export function FirstRunGate({
120 });
121
122 const { decision: nextDecision, persistCompletion } = hostedStatic
124 - ? resolveHostedFirstRunDecision({
125 - localEnvironmentDisabled: isLocalEnvironmentDisabled(),
126 - hydrated,
127 - completed: onboardingCompletedAt !== null,
128 - catalogReady: environmentCatalogReady,
129 - environmentCount: environments.length,
130 - })
123 + ? resolveHostedFirstRunDecision(hydrated)
124 : resolveFirstRunDecision({
125 enabled,
126 hydrated,
@@ -146,7 +139,7 @@ export function FirstRunGate({
139 threadCount,
140 });
141
149 - if (decision !== "wizard" && hydrated) {
142 + if (hydrated) {
143 const transitioned = transitionFirstRunGateState(gateState, {
144 type: "evidence",
145 decision: nextDecision,
@@ -170,15 +163,21 @@ export function FirstRunGate({
163 return () => window.clearTimeout(timer);
164 }, [decision, enabled, hydrated]);
165
166 + // Setup opens by itself only from the home route. A direct link, such as
167 + // Settings, opens as asked so setup can never lock a user out of the app.
168 + const wizardOwnsRoute = pathname === "/";
169 useEffect(() => {
174 - if (decision === "wizard" && pathname !== "/welcome") {
170 + if (decision === "wizard" && wizardOwnsRoute) {
171 void navigate({ to: "/welcome", replace: true });
172 }
177 - }, [decision, navigate, pathname]);
173 + }, [decision, navigate, wizardOwnsRoute]);
174
175 if (settingsReadFailed) {
176 return <FirstRunRecovery reason="settings" retrying={hydrationStatus === "retrying"} />;
177 }
178 + if (decision === "wizard" && !wizardOwnsRoute) {
179 + return children;
180 + }
181 if (decision !== "app") {
182 return stalled ? <FirstRunRecovery reason="connection" /> : null;
183 }
apps/web/src/components/onboarding/WelcomeWizard.browser.test.tsx
+26
@@ -221,3 +221,29 @@ it("keeps setup open when saving completion fails and preserves the import warni
221 }),
222 );
223 });
224 +
225 +it("requires explicit Close to complete local setup", async () => {
226 + const onDone = vi.fn();
227 + await act(async () => root.render(<WelcomeWizard localAvailable onDone={onDone} />));
228 + await act(async () => {
229 + document.activeElement?.dispatchEvent(
230 + new KeyboardEvent("keydown", { key: "Escape", bubbles: true }),
231 + );
232 + const backdrop = document.querySelector<HTMLElement>('[data-slot="dialog-backdrop"]')!;
233 + backdrop.dispatchEvent(
234 + new PointerEvent("pointerdown", { bubbles: true, pointerType: "mouse" }),
235 + );
236 + backdrop.dispatchEvent(new MouseEvent("mousedown", { bubbles: true }));
237 + backdrop.dispatchEvent(new MouseEvent("mouseup", { bubbles: true }));
238 + backdrop.click();
239 + });
240 + expect(document.querySelector('[role="dialog"]')).not.toBeNull();
241 + expect(mocks.complete).not.toHaveBeenCalled();
242 + expect(onDone).not.toHaveBeenCalled();
243 +
244 + const close = document.querySelector<HTMLButtonElement>('button[aria-label="Close"]');
245 + expect(close).not.toBeNull();
246 + await act(async () => close!.click());
247 + expect(mocks.complete).toHaveBeenCalledOnce();
248 + expect(onDone).toHaveBeenCalledWith(undefined);
249 +});
apps/web/src/components/onboarding/WelcomeWizard.tsx
+13 -2
@@ -217,11 +217,17 @@ export function WelcomeWizard({
217 };
218
219 return (
220 - <Dialog open disablePointerDismissal onOpenChange={(_, event) => event.cancel()}>
220 + <Dialog
221 + open
222 + disablePointerDismissal
223 + onOpenChange={(_, event) => {
224 + event.cancel();
225 + if (event.reason === "close-press" && !isImporting) void finish();
226 + }}
227 + >
228 <WizardPopup
229 size="wide"
230 bottomStickOnMobile={false}
224 - showCloseButton={false}
231 initialFocus={() => document.getElementById("onboarding-pairing-url") ?? true}
232 >
233 <WizardHeader
@@ -365,6 +371,11 @@ function ConnectionStep({
371 {environment.displayUrl}
372 </span>
373 ) : null}
374 + {environment.connection.phase === "unsupported" && environment.connection.error ? (
375 + <span className="mt-0.5 block text-xs text-muted-foreground">
376 + {environment.connection.error}
377 + </span>
378 + ) : null}
379 </span>
380 </label>
381 ))}
apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx
+2 -3
@@ -9,7 +9,7 @@ import { useLocation } from "@tanstack/react-router";
9 import * as Schema from "effect/Schema";
10 import { type ReactNode, useEffect, useRef, useState } from "react";
11
12 -import { APP_DISPLAY_NAME } from "~/branding";
12 +import { APP_DISPLAY_NAME, DESKTOP_DOWNLOAD_URL } from "~/branding";
13 import { useLocalStorage } from "~/hooks/useLocalStorage";
14 import { isHostedStaticApp } from "~/hostedPairing";
15 import { useEnvironments } from "~/state/environments";
@@ -21,7 +21,6 @@ import { StandalonePage, StandalonePageHeader } from "../ui/standalone-page";
21
22 const OPENER_STORAGE_KEY = "t3code:prompt-link-opener";
23 const Opener = Schema.NullOr(Schema.Literals(["app", "browser"]));
24 -const DOWNLOAD_URL = "https://t3.codes/download";
24
25 interface LinkSummary {
26 readonly prompt: LinkedPrompt | null;
@@ -155,7 +154,7 @@ function HostedPromptLinkLanding({
154 Continue here
155 </Button>
156 ) : null}
158 - <Button variant="ghost" render={<a href={DOWNLOAD_URL} />}>
157 + <Button variant="ghost" render={<a href={DESKTOP_DOWNLOAD_URL} />}>
158 Get T3 Code
159 </Button>
160 </div>
apps/web/src/onboarding/firstRun.logic.test.ts
+30 -81
@@ -256,101 +256,50 @@ describe("transitionFirstRunGateState", () => {
256 },
257 );
258
259 - it("keeps recovery visible while evidence remains pending", () => {
260 - const state = { decision: "pending", stalled: true } as const;
259 + it.each([
260 + { decision: "pending", stalled: true },
261 + { decision: "wizard", stalled: false },
262 + ] as const)("retains $decision while evidence remains pending", (state) => {
263 expect(transitionFirstRunGateState(state, { type: "evidence", decision: "pending" })).toBe(
264 state,
265 );
266 });
267
266 - it("allows authoritative wizard evidence to replace an app decision", () => {
267 - expect(
268 - transitionFirstRunGateState(
269 - { decision: "app", stalled: false },
270 - { type: "evidence", decision: "wizard" },
271 - ),
272 - ).toEqual({ decision: "wizard", stalled: false });
273 - });
268 + it.each([
269 + { previous: "app", workspaceFresh: true, decision: "wizard" },
270 + { previous: "wizard", workspaceFresh: false, decision: "app" },
271 + ] as const)(
272 + "updates $previous to $decision when authoritative workspace evidence changes",
273 + ({ previous, workspaceFresh, decision }) => {
274 + const evidence = resolveFirstRunDecision({ ...freshWorkspace, workspaceFresh });
275 + expect(
276 + transitionFirstRunGateState(
277 + { decision: previous, stalled: false },
278 + { type: "evidence", decision: evidence.decision },
279 + ),
280 + ).toEqual({ decision, stalled: false });
281 + },
282 + );
283 +
284 + it.each(["pending", "app", "wizard"] as const)(
285 + "preserves state identity for unchanged %s evidence",
286 + (decision) => {
287 + const state = { decision, stalled: false };
288 + expect(transitionFirstRunGateState(state, { type: "evidence", decision })).toBe(state);
289 + },
290 + );
291 });
292
293 describe("resolveHostedFirstRunDecision", () => {
294 it("keeps the shell hidden until client settings are hydrated", () => {
278 - expect(
279 - resolveHostedFirstRunDecision({
280 - hydrated: false,
281 - completed: false,
282 - catalogReady: true,
283 - environmentCount: 0,
284 - }),
285 - ).toEqual({
286 - decision: "pending",
287 - persistCompletion: false,
288 - });
289 - });
290 -
291 - it("waits for the saved environment catalog before judging a hosted install", () => {
292 - expect(
293 - resolveHostedFirstRunDecision({
294 - hydrated: true,
295 - completed: false,
296 - catalogReady: false,
297 - environmentCount: 0,
298 - }),
299 - ).toEqual({
295 + expect(resolveHostedFirstRunDecision(false)).toEqual({
296 decision: "pending",
297 persistCompletion: false,
298 });
299 });
300
305 - it("opens onboarding when a hosted install has no saved environments", () => {
306 - expect(
307 - resolveHostedFirstRunDecision({
308 - hydrated: true,
309 - completed: false,
310 - catalogReady: true,
311 - environmentCount: 0,
312 - }),
313 - ).toEqual({
314 - decision: "wizard",
315 - persistCompletion: false,
316 - });
317 - });
318 -
319 - it("keeps Connections reachable for a remote-only desktop predating onboarding", () => {
320 - expect(
321 - resolveHostedFirstRunDecision({
322 - hydrated: true,
323 - completed: false,
324 - catalogReady: true,
325 - environmentCount: 0,
326 - localEnvironmentDisabled: true,
327 - }),
328 - ).toEqual({ decision: "app", persistCompletion: true });
329 - });
330 -
331 - it("backfills onboarding for a hosted install with saved environments", () => {
332 - expect(
333 - resolveHostedFirstRunDecision({
334 - hydrated: true,
335 - completed: false,
336 - catalogReady: true,
337 - environmentCount: 1,
338 - }),
339 - ).toEqual({
340 - decision: "app",
341 - persistCompletion: true,
342 - });
343 - });
344 -
345 - it("opens the app immediately after hosted onboarding is complete", () => {
346 - expect(
347 - resolveHostedFirstRunDecision({
348 - hydrated: true,
349 - completed: true,
350 - catalogReady: false,
351 - environmentCount: 0,
352 - }),
353 - ).toEqual({
301 + it("opens the app without setup, even with no saved computers", () => {
302 + expect(resolveHostedFirstRunDecision(true)).toEqual({
303 decision: "app",
304 persistCompletion: false,
305 });
apps/web/src/onboarding/firstRun.logic.ts
+3 -29
@@ -48,14 +48,6 @@ interface FirstRunDecisionInput {
48 readonly threadCount: number;
49 }
50
51 -interface HostedFirstRunDecisionInput {
52 - readonly localEnvironmentDisabled?: boolean;
53 - readonly hydrated: boolean;
54 - readonly completed: boolean;
55 - readonly catalogReady: boolean;
56 - readonly environmentCount: number;
57 -}
58 -
51 export function isFirstRunWorkspaceProvenanceAuthoritative(input: {
52 readonly welcomeReceived: boolean;
53 readonly bootstrapStatus: "pending" | "complete" | null;
@@ -71,11 +63,7 @@ export function transitionFirstRunGateState(
63 return state.decision === "pending" && !state.stalled ? { ...state, stalled: true } : state;
64 }
65
74 - if (
75 - state.decision === "wizard" ||
76 - event.decision === "pending" ||
77 - (state.decision === "app" && event.decision !== "wizard")
78 - ) {
66 + if (event.decision === "pending" || state.decision === event.decision) {
67 return state;
68 }
69
@@ -157,23 +145,9 @@ export function resolveFirstRunDecision(input: FirstRunDecisionInput): {
145 : { decision: "app", persistCompletion: input.workspaceAuthoritative };
146 }
147
160 -export function resolveHostedFirstRunDecision(input: HostedFirstRunDecisionInput): {
148 +export function resolveHostedFirstRunDecision(hydrated: boolean): {
149 readonly decision: FirstRunDecision;
150 readonly persistCompletion: boolean;
151 } {
164 - if (!input.hydrated) {
165 - return { decision: "pending", persistCompletion: false };
166 - }
167 -
168 - if (input.completed) {
169 - return { decision: "app", persistCompletion: false };
170 - }
171 -
172 - if (!input.catalogReady) {
173 - return { decision: "pending", persistCompletion: false };
174 - }
175 -
176 - return input.environmentCount === 0 && !input.localEnvironmentDisabled
177 - ? { decision: "wizard", persistCompletion: false }
178 - : { decision: "app", persistCompletion: true };
152 + return { decision: hydrated ? "app" : "pending", persistCompletion: false };
153 }
apps/web/src/routes/_chat.index.tsx
+3 -52
@@ -1,14 +1,13 @@
1 import { RefreshIcon } from "~/components/ui/refresh-icon";
2 import { scopeProjectRef } from "@t3tools/client-runtime/environment";
3 -import { createFileRoute, Link, useRouter } from "@tanstack/react-router";
4 -import { LinkIcon, PlusIcon } from "lucide-react";
3 +import { createFileRoute, useRouter } from "@tanstack/react-router";
4 import { useEffect, useEffectEvent, useRef, useState } from "react";
5
7 -import { isLocalEnvironmentDisabled } from "../localEnvironment";
6 import { isElectron } from "../env";
7 import { NoProjectsHero } from "../components/NoProjectsHero";
8 import { sortScopedProjectsForSidebar } from "../components/Sidebar.logic";
9 import { Button } from "../components/ui/button";
10 +import { HostedEmptyState } from "../components/HostedEmptyState";
11 import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "../components/ui/empty";
12 import { SidebarInset } from "../components/ui/sidebar";
13 import { WorkspacePageHeader } from "../components/WorkspacePageHeader";
@@ -20,8 +19,6 @@ import {
19 useThreadShells,
20 } from "../state/entities";
21 import { useEnvironments } from "../state/environments";
23 -import { APP_DISPLAY_NAME } from "~/branding";
24 -import { hasCloudPublicConfig } from "~/cloud/publicConfig";
22
23 function ChatIndexRouteView() {
24 const { authGateState } = Route.useRouteContext();
@@ -29,7 +26,7 @@ function ChatIndexRouteView() {
26
27 if (authGateState.status === "hosted-static") {
28 if (!isReady) return null;
32 - if (environments.length === 0) return <HostedStaticOnboardingState />;
29 + if (environments.length === 0) return <HostedEmptyState />;
30 }
31
32 return <IndexDraftLanding />;
@@ -117,49 +114,3 @@ function DraftStartError({ onRetry }: { readonly onRetry: () => void }) {
114 export const Route = createFileRoute("/_chat/")({
115 component: ChatIndexRouteView,
116 });
120 -
121 -function HostedStaticOnboardingState() {
122 - const cloudEnabled = hasCloudPublicConfig();
123 - const localEnvironmentOff = isLocalEnvironmentDisabled();
124 - const description = localEnvironmentOff
125 - ? "The local environment is turned off. Connect a remote environment, or turn the local environment back on in Connections."
126 - : cloudEnabled
127 - ? "Enable T3 Connect on that machine, then open Connections here to sign in with the same account. You can also add the machine using a pairing link."
128 - : "Open Connections and add that machine using its pairing link. This app must be able to reach it.";
129 -
130 - return (
131 - <SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none">
132 - <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-background">
133 - <WorkspacePageHeader electron={isElectron} className="border-b border-border">
134 - <div className="flex items-center gap-2">
135 - <span className="text-sm font-medium text-foreground md:text-muted-foreground/60">
136 - {APP_DISPLAY_NAME}
137 - </span>
138 - </div>
139 - </WorkspacePageHeader>
140 -
141 - <Empty className="flex-1">
142 - <div className="w-full max-w-xl rounded-3xl border border-border/55 bg-card/20 px-8 py-12 shadow-sm/5">
143 - <EmptyHeader className="max-w-none">
144 - <div className="mx-auto mb-5 flex size-11 items-center justify-center rounded-xl border border-border/70 bg-background/70 text-muted-foreground">
145 - <LinkIcon className="size-5" />
146 - </div>
147 - <EmptyTitle>Connect to a computer running T3 Code</EmptyTitle>
148 - <EmptyDescription>
149 - This app connects to T3 Code running on your computer or a server. Start the T3 Code
150 - desktop app or command-line server on that machine and keep it running.
151 - </EmptyDescription>
152 - <EmptyDescription>{description}</EmptyDescription>
153 - <div className="mt-6 flex justify-center">
154 - <Button render={<Link to="/settings/connections" />} size="sm">
155 - <PlusIcon className="size-4" />
156 - Open Connections
157 - </Button>
158 - </div>
159 - </EmptyHeader>
160 - </div>
161 - </Empty>
162 - </div>
163 - </SidebarInset>
164 - );
165 -}
docs/user/remote-access.md
+5 -3
@@ -21,9 +21,11 @@ server with `t3 serve`. Saving your sign-in alone does not make the machine
21 reachable.
22
23 On your other device, sign in to the same T3 Connect account and choose the
24 -environment. Over SSH, the CLI prints a browser link and a short code. Open the
25 -link on any device, confirm the code matches, and approve. The CLI continues on
26 -its own, so you do not need to forward an OAuth callback port.
24 +environment. On the app.t3.codes home page with no computer added yet, signing
25 +in adds compatible computers linked to your account. Over SSH, the CLI prints a
26 +browser link and a short code. Open the link on any device, confirm the code
27 +matches, and approve. The CLI continues on its own, so you do not need to forward
28 +an OAuth callback port.
29
30 T3 Connect renews access credentials when needed without disconnecting a healthy
31 connection. Pull request diffs and provider settings keep working after the
docs/user/welcome-wizard.md
+14 -2
@@ -1,7 +1,16 @@
1 # Welcome wizard
2
3 -T3 Code shows a setup flow when you open a new installation or connect to the
4 -hosted app for the first time. Existing workspaces skip this flow.
3 +T3 Code shows a setup flow when you open a new installation. Existing
4 +workspaces skip this flow.
5 +
6 +The hosted app at app.t3.codes does not open setup. With no computer connected,
7 +it asks you to sign in to T3 Connect, then to run `npx t3 connect` on your
8 +computer. From home, it adds compatible computers linked to your account and
9 +opens the app.
10 +
11 +Close setup while no import is running to go straight to the app. You can connect
12 +computers and agents later from Settings, or open `/welcome` to run setup again.
13 +Direct links, such as Settings, open normally before setup is done.
14
15 ## Connect your computers
16
@@ -21,6 +30,9 @@ You can add more computers before continuing:
30 the pairing link. You can also run `t3 serve --host <address>` and use
31 `t3 pair` when the server is already reachable on your network.
32
33 +A computer marked **Client not supported** runs a T3 Code version that cannot
34 +talk to this app. The message under its name says which side to update.
35 +
36 Saved computers and computers discovered through T3 Connect are selected by
37 default. Uncheck any you do not want to set up; this does not disconnect them.
38 Continue when your selected computers are connected. Setup checks