From 22f9f3058b7e2da973fec5b65597a778390c4790 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 9 Jun 2026 12:25:02 -0700 Subject: [PATCH 01/24] [codex] Rebrand T3 Cloud as T3 Connect (#3011) Co-authored-by: codex --- .env.example | 4 +- .github/workflows/deploy-relay.yml | 2 +- .github/workflows/release.yml | 2 +- apps/desktop/src/window/DesktopWindow.test.ts | 2 +- apps/mobile/README.md | 2 +- .../features/cloud/linkEnvironment.test.ts | 8 +- .../src/features/cloud/linkEnvironment.ts | 4 +- apps/server/src/bin.test.ts | 50 ++--- apps/server/src/bin.ts | 20 +- .../cli/{cloud.test.ts => connect.test.ts} | 2 +- apps/server/src/cli/{cloud.ts => connect.ts} | 60 +++--- apps/server/src/cloud/CliTokenManager.ts | 16 +- apps/server/src/cloud/http.test.ts | 2 +- apps/server/src/cloud/http.ts | 12 +- apps/server/src/relay/AgentAwarenessRelay.ts | 6 +- apps/server/src/server.test.ts | 100 ++++----- apps/server/src/server.ts | 8 +- apps/web/src/cloud/linkEnvironment.test.ts | 10 +- apps/web/src/cloud/linkEnvironment.ts | 14 +- apps/web/src/cloud/primaryCloudLinkState.ts | 2 +- .../clerk/T3ConnectSidebarSignIn.tsx | 60 ++++++ .../clerk/useT3ConnectAuthPrompt.tsx | 29 +++ .../cloud/RelayClientInstallDialog.tsx | 4 +- .../src/components/settings/CloudSettings.tsx | 197 ------------------ .../settings/ConnectionsSettings.tsx | 158 ++++++++++---- .../settings/SettingsSidebarNav.tsx | 44 ++-- apps/web/src/environments/runtime/service.ts | 2 +- apps/web/src/main.tsx | 3 +- apps/web/src/routeTree.gen.ts | 21 -- apps/web/src/routes/_chat.index.tsx | 11 +- apps/web/src/routes/settings.cloud.tsx | 13 -- docs/README.md | 2 +- ...ow.html => t3-code-connect-auth-flow.html} | 46 ++-- ...{t3-cloud-clerk.md => t3-connect-clerk.md} | 36 ++-- docs/operations/release.md | 4 +- infra/relay/README.md | 12 +- .../environments/EnvironmentConnector.test.ts | 4 +- .../src/environments/EnvironmentConnector.ts | 50 ++--- .../client-runtime/src/managedRelayState.ts | 8 +- packages/contracts/src/environmentHttp.ts | 20 +- packages/contracts/src/relay.ts | 2 +- 41 files changed, 494 insertions(+), 558 deletions(-) rename apps/server/src/cli/{cloud.test.ts => connect.test.ts} (98%) rename apps/server/src/cli/{cloud.ts => connect.ts} (87%) create mode 100644 apps/web/src/components/clerk/T3ConnectSidebarSignIn.tsx create mode 100644 apps/web/src/components/clerk/useT3ConnectAuthPrompt.tsx delete mode 100644 apps/web/src/components/settings/CloudSettings.tsx delete mode 100644 apps/web/src/routes/settings.cloud.tsx rename docs/cloud/{t3-code-cloud-auth-flow.html => t3-code-connect-auth-flow.html} (96%) rename docs/cloud/{t3-cloud-clerk.md => t3-connect-clerk.md} (85%) diff --git a/.env.example b/.env.example index c80886a8bf..067aad9cc6 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ -# Optional: T3 Cloud source builds -# Leave these unset to disable optional T3 Cloud features in local source builds. +# Optional: T3 Connect source builds +# Leave these unset to disable optional T3 Connect features in local source builds. # Release builds inject their public values at build time. Do not add server-side # secrets to this file. diff --git a/.github/workflows/deploy-relay.yml b/.github/workflows/deploy-relay.yml index 1f777ed291..94d4af17e4 100644 --- a/.github/workflows/deploy-relay.yml +++ b/.github/workflows/deploy-relay.yml @@ -1,4 +1,4 @@ -name: Deploy T3 Cloud relay +name: Deploy T3 Connect relay on: push: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67e6aeb51a..e1fb92163b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -167,7 +167,7 @@ jobs: --github-output relay_public_config: - name: Resolve T3 Cloud public config + name: Resolve T3 Connect public config needs: preflight if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }} runs-on: blacksmith-8vcpu-ubuntu-2404 diff --git a/apps/desktop/src/window/DesktopWindow.test.ts b/apps/desktop/src/window/DesktopWindow.test.ts index 271b35095e..5e977de2de 100644 --- a/apps/desktop/src/window/DesktopWindow.test.ts +++ b/apps/desktop/src/window/DesktopWindow.test.ts @@ -165,7 +165,7 @@ describe("DesktopWindow", () => { assert.isTrue( DesktopWindow.isSameOriginRendererNavigation({ applicationUrl: "http://127.0.0.1:3773/", - navigationUrl: "http://127.0.0.1:3773/settings/cloud", + navigationUrl: "http://127.0.0.1:3773/settings/connections", }), ); assert.isFalse( diff --git a/apps/mobile/README.md b/apps/mobile/README.md index f5be27c6c3..ad0242c271 100644 --- a/apps/mobile/README.md +++ b/apps/mobile/README.md @@ -16,7 +16,7 @@ This app has three variants: Run commands from `apps/mobile`. -T3 Cloud is optional and disabled in a fresh clone. Public configuration belongs in the +T3 Connect is optional and disabled in a fresh clone. Public configuration belongs in the repository-root `.env` or `.env.local`, not an `apps/mobile/.env` file. See [`../../.env.example`](../../.env.example). diff --git a/apps/mobile/src/features/cloud/linkEnvironment.test.ts b/apps/mobile/src/features/cloud/linkEnvironment.test.ts index 16a7a74539..36544cf46c 100644 --- a/apps/mobile/src/features/cloud/linkEnvironment.test.ts +++ b/apps/mobile/src/features/cloud/linkEnvironment.test.ts @@ -572,7 +572,7 @@ describe("mobile cloud link environment client", () => { if (String(url).endsWith("/v1/client/environment-link-challenges")) { return Promise.resolve(Response.json(validLinkChallengeResponse())); } - if (String(url).endsWith("/api/cloud/link-proof")) { + if (String(url).endsWith("/api/connect/link-proof")) { return Promise.resolve(Response.json(validLinkProof())); } return Promise.resolve(Response.json(validLinkResponse("env-other"))); @@ -631,7 +631,7 @@ describe("mobile cloud link environment client", () => { if (String(url).endsWith("/v1/client/environment-link-challenges")) { return Promise.resolve(Response.json(validLinkChallengeResponse())); } - if (String(url).endsWith("/api/cloud/link-proof")) { + if (String(url).endsWith("/api/connect/link-proof")) { return Promise.resolve(Response.json(validLinkProof())); } return Promise.resolve( @@ -669,7 +669,7 @@ describe("mobile cloud link environment client", () => { if (String(url).endsWith("/v1/client/environment-link-challenges")) { return Promise.resolve(Response.json(validLinkChallengeResponse())); } - if (String(url).endsWith("/api/cloud/link-proof")) { + if (String(url).endsWith("/api/connect/link-proof")) { return Promise.resolve(Response.json(validLinkProof())); } return Promise.resolve( @@ -713,7 +713,7 @@ describe("mobile cloud link environment client", () => { if (String(url).endsWith("/v1/client/environment-link-challenges")) { return Promise.resolve(Response.json(validLinkChallengeResponse())); } - if (String(url).endsWith("/api/cloud/link-proof")) { + if (String(url).endsWith("/api/connect/link-proof")) { return Promise.resolve(Response.json(validLinkProof())); } if (String(url).endsWith("/v1/client/environment-links")) { diff --git a/apps/mobile/src/features/cloud/linkEnvironment.ts b/apps/mobile/src/features/cloud/linkEnvironment.ts index f72b35d175..bca1ac21bc 100644 --- a/apps/mobile/src/features/cloud/linkEnvironment.ts +++ b/apps/mobile/src/features/cloud/linkEnvironment.ts @@ -301,7 +301,7 @@ export function linkEnvironmentToCloud(input: { ), ); const environmentClient = yield* makeEnvironmentHttpApiClient(input.connection.httpBaseUrl); - const proof = yield* environmentClient.cloud + const proof = yield* environmentClient.connect .linkProof({ headers: { authorization: `Bearer ${localBearerToken}` }, payload: { @@ -336,7 +336,7 @@ export function linkEnvironmentToCloud(input: { link, }); - yield* environmentClient.cloud + yield* environmentClient.connect .relayConfig({ headers: { authorization: `Bearer ${localBearerToken}` }, payload: { diff --git a/apps/server/src/bin.test.ts b/apps/server/src/bin.test.ts index 5911bfd987..27a1d55e90 100644 --- a/apps/server/src/bin.test.ts +++ b/apps/server/src/bin.test.ts @@ -38,11 +38,11 @@ import { environmentAuthenticatedAuthLayer } from "./auth/http.ts"; const CliRuntimeLayer = Layer.mergeAll(NodeServices.layer, NetService.layer); class ProjectCliHttpApi extends HttpApi.make("environment").add(EnvironmentOrchestrationHttpApi) {} -const cloudCli = makeCli({ cloudEnabled: true }); -const noCloudCli = makeCli({ cloudEnabled: false }); +const connectCli = makeCli({ cloudEnabled: true }); +const noConnectCli = makeCli({ cloudEnabled: false }); const runCli = (args: ReadonlyArray, command = cli) => Command.runWith(command, { version: "0.0.0" })(args); -const runCloudCli = (args: ReadonlyArray) => runCli(args, cloudCli); +const runConnectCli = (args: ReadonlyArray) => runCli(args, connectCli); const runCliWithRuntime = (args: ReadonlyArray) => runCli(args).pipe(Effect.provide(CliRuntimeLayer)); @@ -179,9 +179,9 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => { }), ); - it.effect("rejects cloud commands when public cloud configuration is missing", () => + it.effect("rejects connect commands when public configuration is missing", () => Effect.gen(function* () { - const error = yield* runCli(["cloud", "status"], noCloudCli).pipe(Effect.flip); + const error = yield* runCli(["connect", "status"], noConnectCli).pipe(Effect.flip); if (!CliError.isCliError(error)) { assert.fail(`Expected CliError, got ${String(error)}`); @@ -189,20 +189,20 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => { if (error._tag !== "ShowHelp") { assert.fail(`Expected ShowHelp, got ${error._tag}`); } - assert.deepEqual(error.commandPath, ["t3", "cloud"]); - assert.include(error.errors[0]?.message ?? "", "missing T3 Cloud public configuration"); + assert.deepEqual(error.commandPath, ["t3", "connect"]); + assert.include(error.errors[0]?.message ?? "", "missing T3 Connect public configuration"); const output = (yield* TestConsole.errorLines).join("\n"); assert.include(output, "ERROR"); - assert.include(output, "missing T3 Cloud public configuration"); + assert.include(output, "missing T3 Connect public configuration"); }).pipe(Effect.provide(Layer.mergeAll(CliRuntimeLayer, TestConsole.layer))), ); - it.effect("reports fresh headless cloud state without requiring local configuration", () => + it.effect("reports fresh headless connect state without requiring local configuration", () => Effect.gen(function* () { const baseDir = mkdtempSync(join(tmpdir(), "t3-cli-cloud-status-test-")); const { output } = yield* captureStdout( - runCloudCli(["cloud", "status", "--base-dir", baseDir, "--json"]), + runConnectCli(["connect", "status", "--base-dir", baseDir, "--json"]), ); // @effect-diagnostics-next-line preferSchemaOverJson:off - CLI JSON output is decoded as a presentation DTO. const status = JSON.parse(output) as { @@ -221,21 +221,21 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => { }), ); - it.effect("reports actionable human-readable headless cloud state", () => + it.effect("reports actionable human-readable headless connect state", () => Effect.gen(function* () { const baseDir = mkdtempSync(join(tmpdir(), "t3-cli-cloud-status-human-test-")); const { output } = yield* captureStdout( - runCloudCli(["cloud", "status", "--base-dir", baseDir]), + runConnectCli(["connect", "status", "--base-dir", baseDir]), ); - assert.include(output, "T3 Cloud\n Exposure: disabled"); + assert.include(output, "T3 Connect\n Exposure: disabled"); assert.include(output, " Authorization: missing"); assert.include(output, " Environment link: not provisioned"); - assert.include(output, "Next: Run `t3 cloud link` to authorize and enable cloud exposure."); + assert.include(output, "Next: Run `t3 connect link` to authorize and enable T3 Connect."); }), ); - it.effect("logs in to headless cloud without enabling exposure", () => + it.effect("logs in to headless connect without enabling access", () => Effect.gen(function* () { const baseDir = mkdtempSync(join(tmpdir(), "t3-cli-cloud-login-test-")); const { secretsDir } = yield* deriveServerPaths(baseDir, undefined); @@ -250,9 +250,11 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => { }), ); - const login = yield* captureStdout(runCloudCli(["cloud", "login", "--base-dir", baseDir])); + const login = yield* captureStdout( + runConnectCli(["connect", "login", "--base-dir", baseDir]), + ); const status = yield* captureStdout( - runCloudCli(["cloud", "status", "--base-dir", baseDir, "--json"]), + runConnectCli(["connect", "status", "--base-dir", baseDir, "--json"]), ); // @effect-diagnostics-next-line preferSchemaOverJson:off - CLI JSON output is decoded as a presentation DTO. const decoded = JSON.parse(status.output) as { @@ -260,24 +262,24 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => { readonly authenticated: boolean; }; - assert.equal(login.output, "Signed in to T3 Cloud."); + assert.equal(login.output, "Signed in to T3 Connect."); assert.isFalse(decoded.desired); assert.isTrue(decoded.authenticated); }), ); - it.effect("disables headless cloud exposure without a running server", () => + it.effect("disables headless connect without a running server", () => Effect.gen(function* () { const baseDir = mkdtempSync(join(tmpdir(), "t3-cli-cloud-unlink-test-")); const { output } = yield* captureStdout( - runCloudCli(["cloud", "unlink", "--base-dir", baseDir]), + runConnectCli(["connect", "unlink", "--base-dir", baseDir]), ); - assert.equal(output, "T3 Cloud exposure is disabled locally."); + assert.equal(output, "T3 Connect is disabled locally."); }), ); - it.effect("logs out of headless cloud and removes the stored CLI authorization", () => + it.effect("logs out of headless connect and removes the stored CLI authorization", () => Effect.gen(function* () { const baseDir = mkdtempSync(join(tmpdir(), "t3-cli-cloud-logout-test-")); const { secretsDir } = yield* deriveServerPaths(baseDir, undefined); @@ -286,10 +288,10 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => { writeFileSync(tokenPath, "invalid persisted token"); const { output } = yield* captureStdout( - runCloudCli(["cloud", "logout", "--base-dir", baseDir]), + runConnectCli(["connect", "logout", "--base-dir", baseDir]), ); - assert.equal(output, "Signed out of T3 Cloud locally."); + assert.equal(output, "Signed out of T3 Connect locally."); assert.isFalse(existsSync(tokenPath)); }), ); diff --git a/apps/server/src/bin.ts b/apps/server/src/bin.ts index 04d5bdfada..ddfbf5e3ec 100644 --- a/apps/server/src/bin.ts +++ b/apps/server/src/bin.ts @@ -8,7 +8,7 @@ import * as CliError from "effect/unstable/cli/CliError"; import * as NetService from "@t3tools/shared/Net"; import packageJson from "../package.json" with { type: "json" }; import { authCommand } from "./cli/auth.ts"; -import { cloudCommand } from "./cli/cloud.ts"; +import { connectCommand } from "./cli/connect.ts"; import { hasCloudPublicConfig } from "./cloud/publicConfig.ts"; import { sharedServerCommandFlags } from "./cli/config.ts"; import { projectCommand } from "./cli/project.ts"; @@ -16,23 +16,23 @@ import { runServerCommand, serveCommand, startCommand } from "./cli/server.ts"; const CliRuntimeLayer = Layer.mergeAll(NodeServices.layer, NetService.layer); -const cloudPublicConfigMissingMessage = - "T3 Cloud commands are unavailable: this build is missing T3 Cloud public configuration."; +const connectPublicConfigMissingMessage = + "T3 Connect commands are unavailable: this build is missing T3 Connect public configuration."; -class CloudPublicConfigMissingError extends CliError.UserError { +class ConnectPublicConfigMissingError extends CliError.UserError { override get message() { - return cloudPublicConfigMissingMessage; + return connectPublicConfigMissingMessage; } } -const cloudUnavailableCommand = Command.make("cloud").pipe( - Command.withDescription("T3 Cloud is unavailable in builds without public cloud configuration."), +const connectUnavailableCommand = Command.make("connect").pipe( + Command.withDescription("T3 Connect is unavailable in builds without public configuration."), Command.withHidden, Command.withHandler(() => Effect.fail( new CliError.ShowHelp({ - commandPath: ["t3", "cloud"], - errors: [new CloudPublicConfigMissingError({ cause: cloudPublicConfigMissingMessage })], + commandPath: ["t3", "connect"], + errors: [new ConnectPublicConfigMissingError({ cause: connectPublicConfigMissingMessage })], }), ), ), @@ -47,7 +47,7 @@ export const makeCli = ({ cloudEnabled = hasCloudPublicConfig } = {}) => serveCommand, authCommand, projectCommand, - cloudEnabled ? cloudCommand : cloudUnavailableCommand, + cloudEnabled ? connectCommand : connectUnavailableCommand, ]), ); diff --git a/apps/server/src/cli/cloud.test.ts b/apps/server/src/cli/connect.test.ts similarity index 98% rename from apps/server/src/cli/cloud.test.ts rename to apps/server/src/cli/connect.test.ts index 4dda50c0ce..5fce3bc1cd 100644 --- a/apps/server/src/cli/cloud.test.ts +++ b/apps/server/src/cli/connect.test.ts @@ -3,7 +3,7 @@ import { assert, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; import * as Option from "effect/Option"; -import { acquireRelayClientForLink } from "./cloud.ts"; +import { acquireRelayClientForLink } from "./connect.ts"; const managedExecutable = { status: "available", diff --git a/apps/server/src/cli/cloud.ts b/apps/server/src/cli/connect.ts similarity index 87% rename from apps/server/src/cli/cloud.ts rename to apps/server/src/cli/connect.ts index 78027d1e80..167fb75a37 100644 --- a/apps/server/src/cli/cloud.ts +++ b/apps/server/src/cli/connect.ts @@ -89,15 +89,15 @@ function formatCloudStatus(status: CloudCliStatus, options?: { readonly json?: b ? "pending server startup" : "not provisioned"; const nextStep = !status.authenticated - ? "Run `t3 cloud link` to authorize and enable cloud exposure." + ? "Run `t3 connect link` to authorize and enable T3 Connect." : !status.desired - ? "Run `t3 cloud link` to enable cloud exposure." + ? "Run `t3 connect link` to enable T3 Connect." : !status.linked ? "Start T3 to provision the environment link and launch its managed tunnel." : undefined; return [ - "T3 Cloud", + "T3 Connect", ` Exposure: ${status.desired ? "enabled" : "disabled"}`, ` Authorization: ${status.authenticated ? "stored credential" : "missing"}`, ` Environment link: ${provisioned}`, @@ -112,7 +112,7 @@ const CLOUD_CLI_LIVE_SERVER_TIMEOUT = Duration.seconds(5); const confirmRelayClientInstall = (version: string) => Prompt.run( Prompt.confirm({ - message: `The T3 relay client is required for T3 Cloud exposure. Download and install version ${version}?`, + message: `The T3 relay client is required for T3 Connect. Download and install version ${version}?`, initial: false, }), ); @@ -169,7 +169,7 @@ const withCloudCliSessionToken = ( environmentAuth.issueSession({ scopes: [AuthRelayWriteScope], subject: "cloud-cli", - label: "t3 cloud cli", + label: "t3 connect cli", }), (issued) => run(issued.token), (issued) => environmentAuth.revokeSession(issued.sessionId).pipe(Effect.ignore({ log: true })), @@ -194,7 +194,7 @@ const runLiveCloudUnlink = Effect.fn("cloud.cli.run_live_unlink")(function* () { baseUrl: runtimeState.value.origin, }).pipe( Effect.flatMap((client) => - client.cloud.unlink({ headers: { authorization: `Bearer ${token}` } }), + client.connect.unlink({ headers: { authorization: `Bearer ${token}` } }), ), Effect.timeout(CLOUD_CLI_LIVE_SERVER_TIMEOUT), ), @@ -249,24 +249,24 @@ const disconnectCloud = Effect.fn("cloud.cli.disconnect")(function* (options: { if (liveResult.status === "failed") { yield* Console.warn( - `T3 Cloud exposure is disabled, but the running server could not stop its tunnel: ${String(liveResult.cause)}\nRestart that server to stop the connector.`, + `T3 Connect is disabled, but the running server could not stop its tunnel: ${String(liveResult.cause)}\nRestart that server to stop the connector.`, ); } else { - yield* Console.log("T3 Cloud exposure is disabled locally."); + yield* Console.log("T3 Connect is disabled locally."); } if (Exit.isFailure(relayResult)) { yield* Console.warn( options.clearAuthorization ? `Could not revoke the relay-side environment record before signing out: ${String(relayResult.cause)}\nThe stored CLI authorization was still removed locally.` - : `Could not revoke the relay-side environment record yet: ${String(relayResult.cause)}\nRun \`t3 cloud unlink\` again when the relay is reachable.`, + : `Could not revoke the relay-side environment record yet: ${String(relayResult.cause)}\nRun \`t3 connect unlink\` again when the relay is reachable.`, ); } else if (relayResult.value.status === "revoked") { yield* Console.log("Revoked the relay-side environment record."); } if (options.clearAuthorization) { - yield* Console.log("Signed out of T3 Cloud locally."); + yield* Console.log("Signed out of T3 Connect locally."); } }); @@ -307,26 +307,26 @@ const runCloudCommand = ( return yield* run.pipe(Effect.provide(runtimeLayer)); }); -const cloudLoginCommand = Command.make("login", { +const connectLoginCommand = Command.make("login", { ...projectLocationFlags, }).pipe( - Command.withDescription("Authorize the T3 Cloud CLI without enabling cloud exposure."), + Command.withDescription("Authorize the T3 Connect CLI without enabling remote access."), Command.withHandler((flags) => runCloudCommand( flags, Effect.gen(function* () { const tokens = yield* CliTokenManager.CloudCliTokenManager; yield* tokens.get; - yield* Console.log("Signed in to T3 Cloud."); + yield* Console.log("Signed in to T3 Connect."); }), ), ), ); -const cloudLinkCommand = Command.make("link", { +const connectLinkCommand = Command.make("link", { ...projectLocationFlags, }).pipe( - Command.withDescription("Authorize this environment for T3 Cloud and expose it on next start."), + Command.withDescription("Authorize this environment for T3 Connect on next start."), Command.withHandler((flags) => runCloudCommand( flags, @@ -338,7 +338,7 @@ const cloudLinkCommand = Command.make("link", { reportRelayClientInstallProgress, ); if (Option.isNone(installed)) { - yield* Console.log("T3 Cloud link cancelled. The relay client was not installed."); + yield* Console.log("T3 Connect setup cancelled. The relay client was not installed."); return; } yield* Console.log( @@ -349,18 +349,18 @@ const cloudLinkCommand = Command.make("link", { yield* tokens.get; yield* CliState.setCliDesiredCloudLink(true); yield* Console.log( - "This T3 environment will be available over T3 Cloud the next time T3 starts.", + "This T3 environment will be available through T3 Connect the next time T3 starts.", ); }), ), ), ); -const cloudStatusCommand = Command.make("status", { +const connectStatusCommand = Command.make("status", { ...projectLocationFlags, json: jsonFlag, }).pipe( - Command.withDescription("Show persisted T3 Cloud and relay client state."), + Command.withDescription("Show persisted T3 Connect and relay client state."), Command.withHandler((flags) => runCloudCommand( flags, @@ -395,31 +395,31 @@ const cloudStatusCommand = Command.make("status", { ), ); -const cloudUnlinkCommand = Command.make("unlink", { +const connectUnlinkCommand = Command.make("unlink", { ...projectLocationFlags, }).pipe( - Command.withDescription("Disable T3 Cloud exposure while retaining the stored authorization."), + Command.withDescription("Disable T3 Connect while retaining the stored authorization."), Command.withHandler((flags) => runCloudCommand(flags, disconnectCloud({ clearAuthorization: false })), ), ); -const cloudLogoutCommand = Command.make("logout", { +const connectLogoutCommand = Command.make("logout", { ...projectLocationFlags, }).pipe( - Command.withDescription("Disable T3 Cloud exposure and clear the stored CLI authorization."), + Command.withDescription("Disable T3 Connect and clear the stored CLI authorization."), Command.withHandler((flags) => runCloudCommand(flags, disconnectCloud({ clearAuthorization: true })), ), ); -export const cloudCommand = Command.make("cloud").pipe( - Command.withDescription("Manage headless T3 Cloud exposure."), +export const connectCommand = Command.make("connect").pipe( + Command.withDescription("Manage headless T3 Connect access."), Command.withSubcommands([ - cloudLoginCommand, - cloudLinkCommand, - cloudStatusCommand, - cloudUnlinkCommand, - cloudLogoutCommand, + connectLoginCommand, + connectLinkCommand, + connectStatusCommand, + connectUnlinkCommand, + connectLogoutCommand, ]), ); diff --git a/apps/server/src/cloud/CliTokenManager.ts b/apps/server/src/cloud/CliTokenManager.ts index c10b892293..765ef05833 100644 --- a/apps/server/src/cloud/CliTokenManager.ts +++ b/apps/server/src/cloud/CliTokenManager.ts @@ -96,7 +96,7 @@ const make = Effect.gen(function* () { const clear = secrets .remove(CLOUD_CLI_OAUTH_TOKEN_SECRET) - .pipe(wrapError("Could not remove the stored T3 Cloud CLI credential.")); + .pipe(wrapError("Could not remove the stored T3 Connect CLI credential.")); const read = Effect.fn("cloud.cli_token.read")(function* () { const encoded = yield* secrets.get(CLOUD_CLI_OAUTH_TOKEN_SECRET); @@ -146,7 +146,7 @@ const make = Effect.gen(function* () { const url = new URL(request.originalUrl, metadata.redirectUri); const code = url.searchParams.get("code"); if (url.searchParams.get("state") !== state || !code) { - return HttpServerResponse.text("Invalid T3 Cloud authorization callback.", { + return HttpServerResponse.text("Invalid T3 Connect authorization callback.", { status: 400, }); } @@ -154,7 +154,7 @@ const make = Effect.gen(function* () { return yield* HttpServerResponse.html` -

T3 Cloud authorization complete

+

T3 Connect authorization complete

You can close this window and return to your terminal.

@@ -182,13 +182,13 @@ const make = Effect.gen(function* () { authorizationUrl.searchParams.set("state", state); authorizationUrl.searchParams.set("code_challenge", challenge); authorizationUrl.searchParams.set("code_challenge_method", "S256"); - yield* Console.log(`Open this URL to authorize T3 Cloud:\n${authorizationUrl.toString()}\n`); + yield* Console.log(`Open this URL to authorize T3 Connect:\n${authorizationUrl.toString()}\n`); const code = yield* Deferred.await(callback).pipe( Effect.timeout(CLOUD_CLI_OAUTH_CALLBACK_TIMEOUT), Effect.catchTag("TimeoutError", () => Effect.fail( new CloudCliTokenManagerError({ - message: "Timed out waiting for T3 Cloud authorization.", + message: "Timed out waiting for T3 Connect authorization.", }), ), ), @@ -213,12 +213,12 @@ const make = Effect.gen(function* () { }); const getExisting = semaphore.withPermits(1)( - getExistingNoLock().pipe(wrapError("Could not refresh the T3 Cloud CLI credential.")), + getExistingNoLock().pipe(wrapError("Could not refresh the T3 Connect CLI credential.")), ); const hasCredential = semaphore.withPermits(1)( read().pipe( Effect.map(Option.isSome), - wrapError("Could not read the stored T3 Cloud CLI credential."), + wrapError("Could not read the stored T3 Connect CLI credential."), ), ); const get = semaphore.withPermits(1)( @@ -227,7 +227,7 @@ const make = Effect.gen(function* () { return Option.isSome(token) ? token.value : yield* Effect.scoped(login()).pipe(Effect.flatMap(persist)); - }).pipe(wrapError("Could not authorize the T3 Cloud CLI.")), + }).pipe(wrapError("Could not authorize the T3 Connect CLI.")), ); return CloudCliTokenManager.of({ get, getExisting, hasCredential, clear }); diff --git a/apps/server/src/cloud/http.test.ts b/apps/server/src/cloud/http.test.ts index 2b7e7d249e..799ab609f4 100644 --- a/apps/server/src/cloud/http.test.ts +++ b/apps/server/src/cloud/http.test.ts @@ -76,7 +76,7 @@ describe("reconcileDesiredCloudLink", () => { expect(error).toMatchObject({ _tag: "EnvironmentHttpUnauthorizedError", - message: "Run `t3 cloud link` to authorize this environment.", + message: "Run `t3 connect link` to authorize this environment.", }); }).pipe( Effect.provideService( diff --git a/apps/server/src/cloud/http.ts b/apps/server/src/cloud/http.ts index 38203dae37..896990849b 100644 --- a/apps/server/src/cloud/http.ts +++ b/apps/server/src/cloud/http.ts @@ -509,7 +509,7 @@ const relayClientRequest = ( Effect.mapError( (cause) => new EnvironmentHttpInternalServerError({ - message: `T3 Cloud relay request failed: ${String(cause)}`, + message: `T3 Connect relay request failed: ${String(cause)}`, }), ), ); @@ -535,7 +535,7 @@ const reconcileDesiredCloudLinkWith = Effect.fn("environment.cloud.reconcileDesi onNone: () => Effect.fail( new EnvironmentHttpUnauthorizedError({ - message: "Run `t3 cloud link` to authorize this environment.", + message: "Run `t3 connect link` to authorize this environment.", }), ), onSome: Effect.succeed, @@ -595,7 +595,7 @@ const reconcileDesiredCloudLinkWith = Effect.fn("environment.cloud.reconcileDesi CloudCliTokenManagerError: (error) => failEnvironmentCloudInternalError(error.message)(error.cause), SecretStoreError: failEnvironmentCloudInternalError( - "Could not persist desired T3 Cloud link state.", + "Could not persist desired T3 Connect link state.", ), }), ); @@ -874,7 +874,7 @@ const cloudMintCredentialHandler = Effect.fn("environment.cloud.mintCredential") scopes: AuthStandardClientScopes, subject: "cloud-connect", ttl: Duration.minutes(2), - label: "T3 Cloud connect", + label: "T3 Connect connect", proofKeyThumbprint: proof.clientProofKeyThumbprint, }); const responsePayload = { @@ -924,9 +924,9 @@ const cloudMintCredentialHandler = Effect.fn("environment.cloud.mintCredential") }), ); -export const cloudHttpApiLayer = HttpApiBuilder.group( +export const connectHttpApiLayer = HttpApiBuilder.group( EnvironmentHttpApi, - "cloud", + "connect", Effect.fnUntraced(function* (handlers) { const dependencies = yield* cloudHttpDependencies; return handlers diff --git a/apps/server/src/relay/AgentAwarenessRelay.ts b/apps/server/src/relay/AgentAwarenessRelay.ts index 6266a39b79..960f27e752 100644 --- a/apps/server/src/relay/AgentAwarenessRelay.ts +++ b/apps/server/src/relay/AgentAwarenessRelay.ts @@ -303,7 +303,7 @@ const make = Effect.gen(function* () { } const relayConfig = yield* readRelayConfig.pipe(Effect.orElseSucceed(() => null)); if (!relayConfig) { - yield* Effect.logDebug("agent activity publish skipped; T3 Cloud config missing", { + yield* Effect.logDebug("agent activity publish skipped; T3 Connect config missing", { threadId, }); return; @@ -421,7 +421,7 @@ const make = Effect.gen(function* () { } const relayConfig = yield* readRelayConfig.pipe(Effect.orElseSucceed(() => null)); if (!relayConfig) { - yield* Effect.logDebug("agent activity snapshot skipped; T3 Cloud config missing"); + yield* Effect.logDebug("agent activity snapshot skipped; T3 Connect config missing"); return false; } const environmentId = yield* serverEnvironment.getEnvironmentId; @@ -459,7 +459,7 @@ const make = Effect.gen(function* () { function* () { const relayConfig = yield* readRelayConfig.pipe(Effect.orElseSucceed(() => null)); if (!relayConfig) { - yield* Effect.logInfo("agent activity publishing standby; T3 Cloud config missing"); + yield* Effect.logInfo("agent activity publishing standby; T3 Connect config missing"); } else { yield* Effect.logInfo("agent activity publishing enabled", { relayUrl: relayConfig.url, diff --git a/apps/server/src/server.test.ts b/apps/server/src/server.test.ts index d061578ca6..0bf2f6589f 100644 --- a/apps/server/src/server.test.ts +++ b/apps/server/src/server.test.ts @@ -782,7 +782,7 @@ const buildAppUnderTest = (options?: { ), Layer.provide( Layer.mock(CloudCliTokenManager.CloudCliTokenManager)({ - get: Effect.die(new Error("Unexpected T3 Cloud CLI authorization request.")), + get: Effect.die(new Error("Unexpected T3 Connect CLI authorization request.")), getExisting: Effect.succeed(Option.none()), hasCredential: Effect.succeed(false), clear: Effect.void, @@ -1713,7 +1713,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { yield* buildAppUnderTest(); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const linkProofUrl = yield* getHttpServerUrl("/api/cloud/link-proof"); + const linkProofUrl = yield* getHttpServerUrl("/api/connect/link-proof"); const linkProofResponse = yield* fetchEffect(linkProofUrl, { method: "POST", headers: { @@ -1750,7 +1750,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { yield* buildAppUnderTest(); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const linkProofUrl = yield* getHttpServerUrl("/api/cloud/link-proof"); + const linkProofUrl = yield* getHttpServerUrl("/api/connect/link-proof"); const serverPort = Number(new URL(linkProofUrl).port); const linkProofResponse = yield* fetchEffect(linkProofUrl, { method: "POST", @@ -1762,10 +1762,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => { challenge: "relay-link-challenge", relayIssuer: "https://relay.example.test", endpoint: { - httpBaseUrl: linkProofUrl.replace("/api/cloud/link-proof", ""), + httpBaseUrl: linkProofUrl.replace("/api/connect/link-proof", ""), wsBaseUrl: linkProofUrl .replace("http://", "ws://") - .replace("/api/cloud/link-proof", "/ws"), + .replace("/api/connect/link-proof", "/ws"), providerKind: "manual", }, origin: { @@ -1789,9 +1789,9 @@ it.layer(NodeServices.layer)("server router seam", (it) => { Effect.gen(function* () { yield* buildAppUnderTest(); - const linkProofUrl = yield* getHttpServerUrl("/api/cloud/link-proof"); + const linkProofUrl = yield* getHttpServerUrl("/api/connect/link-proof"); const serverPort = Number(new URL(linkProofUrl).port); - const linkProofResponse = yield* HttpClient.post("/api/cloud/link-proof", { + const linkProofResponse = yield* HttpClient.post("/api/connect/link-proof", { headers: { cookie: yield* getAuthenticatedSessionCookieHeader(), "content-type": "application/json", @@ -1833,9 +1833,9 @@ it.layer(NodeServices.layer)("server router seam", (it) => { Effect.gen(function* () { yield* buildAppUnderTest(); - const linkProofUrl = yield* getHttpServerUrl("/api/cloud/link-proof"); + const linkProofUrl = yield* getHttpServerUrl("/api/connect/link-proof"); const serverPort = Number(new URL(linkProofUrl).port); - const linkProofResponse = yield* HttpClient.post("/api/cloud/link-proof", { + const linkProofResponse = yield* HttpClient.post("/api/connect/link-proof", { headers: { cookie: yield* getAuthenticatedSessionCookieHeader(), "content-type": "application/json", @@ -1875,9 +1875,9 @@ it.layer(NodeServices.layer)("server router seam", (it) => { Effect.gen(function* () { yield* buildAppUnderTest(); - const linkProofUrl = yield* getHttpServerUrl("/api/cloud/link-proof"); + const linkProofUrl = yield* getHttpServerUrl("/api/connect/link-proof"); const serverPort = Number(new URL(linkProofUrl).port); - const linkProofResponse = yield* HttpClient.post("/api/cloud/link-proof", { + const linkProofResponse = yield* HttpClient.post("/api/connect/link-proof", { headers: { cookie: yield* getAuthenticatedSessionCookieHeader(), "content-type": "application/json", @@ -1918,7 +1918,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { yield* buildAppUnderTest(); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const linkProofUrl = yield* getHttpServerUrl("/api/cloud/link-proof"); + const linkProofUrl = yield* getHttpServerUrl("/api/connect/link-proof"); const serverPort = Number(new URL(linkProofUrl).port); const linkProofResponse = yield* fetchEffect(linkProofUrl, { method: "POST", @@ -1962,7 +1962,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { }); const credential = (yield* credentialResponse.json) as { readonly credential: string }; const pairedCookie = yield* getAuthenticatedSessionCookieHeader(credential.credential); - const linkStateUrl = yield* getHttpServerUrl("/api/cloud/link-state"); + const linkStateUrl = yield* getHttpServerUrl("/api/connect/link-state"); const response = yield* fetchEffect(linkStateUrl, { headers: { cookie: pairedCookie }, }); @@ -2028,7 +2028,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { yield* buildAppUnderTest(); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const preferencesUrl = yield* getHttpServerUrl("/api/cloud/preferences"); + const preferencesUrl = yield* getHttpServerUrl("/api/connect/preferences"); const ownerResponse = yield* fetchEffect(preferencesUrl, { method: "POST", headers: { @@ -2072,7 +2072,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { yield* buildAppUnderTest(); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2107,7 +2107,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const postRelayConfig = (body: { readonly relayUrl: string; readonly relayIssuer?: string; @@ -2184,7 +2184,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const postRelayConfig = (cloudUserId: string, environmentCredential: string) => fetchEffect(relayConfigUrl, { method: "POST", @@ -2227,8 +2227,8 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const linkStateUrl = yield* getHttpServerUrl("/api/cloud/link-state"); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const linkStateUrl = yield* getHttpServerUrl("/api/connect/link-state"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const initialResponse = yield* fetchEffect(linkStateUrl, { headers: { @@ -2284,7 +2284,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { Effect.gen(function* () { yield* buildAppUnderTest(); - const reconcileUrl = yield* getHttpServerUrl("/api/cloud/reconcile"); + const reconcileUrl = yield* getHttpServerUrl("/api/connect/reconcile"); const response = yield* fetchEffect(reconcileUrl, { method: "POST", }); @@ -2321,9 +2321,9 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); - const unlinkUrl = yield* getHttpServerUrl("/api/cloud/unlink"); - const linkStateUrl = yield* getHttpServerUrl("/api/cloud/link-state"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); + const unlinkUrl = yield* getHttpServerUrl("/api/connect/unlink"); + const linkStateUrl = yield* getHttpServerUrl("/api/connect/link-state"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", @@ -2398,7 +2398,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2424,7 +2424,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { issuedAt: DateTime.formatIso(now), expiresAt: DateTime.formatIso(DateTime.add(now, { minutes: 5 })), }); - const mintUrl = yield* getHttpServerUrl("/api/cloud/mint-credential"); + const mintUrl = yield* getHttpServerUrl("/api/connect/mint-credential"); const postMint = () => fetchEffect(mintUrl, { method: "POST", @@ -2448,7 +2448,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { }).pipe(Effect.provide(NodeHttpServer.layerTest)), ); - it.effect("serves the documented T3 Cloud mint credential endpoint", () => + it.effect("serves the documented T3 Connect mint credential endpoint", () => Effect.gen(function* () { yield* buildAppUnderTest(); @@ -2457,7 +2457,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2484,7 +2484,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { issuedAt: DateTime.formatIso(now), expiresAt: DateTime.formatIso(DateTime.add(now, { minutes: 5 })), }); - const mintUrl = yield* getHttpServerUrl("/api/t3-cloud/mint-credential"); + const mintUrl = yield* getHttpServerUrl("/api/t3-connect/mint-credential"); const response = yield* fetchEffect(mintUrl, { method: "POST", headers: { @@ -2507,7 +2507,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { }).pipe(Effect.provide(NodeHttpServer.layerTest)), ); - it.effect("serves signed T3 Cloud environment health checks", () => + it.effect("serves signed T3 Connect environment health checks", () => Effect.gen(function* () { yield* buildAppUnderTest(); @@ -2516,7 +2516,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2542,7 +2542,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { issuedAt: DateTime.formatIso(now), expiresAt: DateTime.formatIso(DateTime.add(now, { minutes: 5 })), }); - const healthUrl = yield* getHttpServerUrl("/api/t3-cloud/health"); + const healthUrl = yield* getHttpServerUrl("/api/t3-connect/health"); const response = yield* fetchEffect(healthUrl, { method: "POST", headers: { @@ -2576,7 +2576,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2602,7 +2602,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { issuedAt: DateTime.formatIso(now), expiresAt: DateTime.formatIso(DateTime.add(now, { minutes: 5 })), }); - const healthUrl = yield* getHttpServerUrl("/api/t3-cloud/health"); + const healthUrl = yield* getHttpServerUrl("/api/t3-connect/health"); const postHealth = () => fetchEffect(healthUrl, { method: "POST", @@ -2637,7 +2637,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2656,7 +2656,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { assert.equal(relayConfigResponse.status, 200); const now = yield* DateTime.now; - const mintUrl = yield* getHttpServerUrl("/api/t3-cloud/mint-credential"); + const mintUrl = yield* getHttpServerUrl("/api/t3-connect/mint-credential"); const postMint = (request: ReturnType) => fetchEffect(mintUrl, { method: "POST", @@ -2717,7 +2717,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2756,7 +2756,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { issuedAt: DateTime.formatIso(now), expiresAt: DateTime.formatIso(DateTime.add(now, { minutes: 5 })), }); - const healthUrl = yield* getHttpServerUrl("/api/t3-cloud/health"); + const healthUrl = yield* getHttpServerUrl("/api/t3-connect/health"); const healthResponse = yield* fetchEffect(healthUrl, { method: "POST", headers: { @@ -2786,7 +2786,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2804,7 +2804,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { assert.equal(relayConfigResponse.status, 200); const now = yield* DateTime.now; - const mintUrl = yield* getHttpServerUrl("/api/cloud/mint-credential"); + const mintUrl = yield* getHttpServerUrl("/api/connect/mint-credential"); const postMint = (request: ReturnType) => fetchEffect(mintUrl, { method: "POST", @@ -2853,7 +2853,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2871,7 +2871,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { assert.equal(relayConfigResponse.status, 200); const now = yield* DateTime.now; - const mintUrl = yield* getHttpServerUrl("/api/t3-cloud/mint-credential"); + const mintUrl = yield* getHttpServerUrl("/api/t3-connect/mint-credential"); const response = yield* fetchEffect(mintUrl, { method: "POST", headers: { @@ -2904,7 +2904,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2922,7 +2922,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { assert.equal(relayConfigResponse.status, 200); const now = yield* DateTime.now; - const mintUrl = yield* getHttpServerUrl("/api/t3-cloud/mint-credential"); + const mintUrl = yield* getHttpServerUrl("/api/t3-connect/mint-credential"); const response = yield* fetchEffect(mintUrl, { method: "POST", headers: { @@ -2955,7 +2955,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -2973,7 +2973,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { assert.equal(relayConfigResponse.status, 200); const now = yield* DateTime.now; - const healthUrl = yield* getHttpServerUrl("/api/t3-cloud/health"); + const healthUrl = yield* getHttpServerUrl("/api/t3-connect/health"); const postHealth = (request: ReturnType) => fetchEffect(healthUrl, { method: "POST", @@ -3020,7 +3020,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -3038,7 +3038,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { assert.equal(relayConfigResponse.status, 200); const now = yield* DateTime.now; - const healthUrl = yield* getHttpServerUrl("/api/t3-cloud/health"); + const healthUrl = yield* getHttpServerUrl("/api/t3-connect/health"); const response = yield* fetchEffect(healthUrl, { method: "POST", headers: { @@ -3070,7 +3070,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { publicKeyEncoding: { format: "pem", type: "spki" }, }); const ownerCookie = yield* getAuthenticatedSessionCookieHeader(); - const relayConfigUrl = yield* getHttpServerUrl("/api/cloud/relay-config"); + const relayConfigUrl = yield* getHttpServerUrl("/api/connect/relay-config"); const relayConfigResponse = yield* fetchEffect(relayConfigUrl, { method: "POST", headers: { @@ -3088,7 +3088,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { assert.equal(relayConfigResponse.status, 200); const now = yield* DateTime.now; - const healthUrl = yield* getHttpServerUrl("/api/t3-cloud/health"); + const healthUrl = yield* getHttpServerUrl("/api/t3-connect/health"); const response = yield* fetchEffect(healthUrl, { method: "POST", headers: { @@ -3280,7 +3280,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { config: { devUrl: new URL(crossOriginClientOrigin) }, }); - const linkProofUrl = yield* getHttpServerUrl("/api/cloud/link-proof"); + const linkProofUrl = yield* getHttpServerUrl("/api/connect/link-proof"); const response = yield* fetchEffect(linkProofUrl, { method: "OPTIONS", headers: { diff --git a/apps/server/src/server.ts b/apps/server/src/server.ts index 98bef90bb2..94b6cb753a 100644 --- a/apps/server/src/server.ts +++ b/apps/server/src/server.ts @@ -69,7 +69,7 @@ import { ServerEnvironmentLive } from "./environment/Layers/ServerEnvironment.ts import { authHttpApiLayer, environmentAuthenticatedAuthLayer } from "./auth/http.ts"; import * as ServerSecretStore from "./auth/ServerSecretStore.ts"; import * as EnvironmentAuth from "./auth/EnvironmentAuth.ts"; -import { cloudHttpApiLayer, reconcileDesiredCloudLink } from "./cloud/http.ts"; +import { connectHttpApiLayer, reconcileDesiredCloudLink } from "./cloud/http.ts"; import * as CloudManagedEndpointRuntime from "./cloud/ManagedEndpointRuntime.ts"; import * as CloudCliTokenManager from "./cloud/CliTokenManager.ts"; import * as CloudCliState from "./cloud/CliState.ts"; @@ -321,7 +321,7 @@ const RuntimeServicesLive = ServerRuntimeStartupLive.pipe( export const makeRoutesLayer = Layer.mergeAll( HttpApiBuilder.layer(EnvironmentHttpApi).pipe( Layer.provide(authHttpApiLayer), - Layer.provide(cloudHttpApiLayer), + Layer.provide(connectHttpApiLayer), Layer.provide(orchestrationHttpApiLayer), Layer.provide(serverEnvironmentHttpApiLayer), Layer.provide(environmentAuthenticatedAuthLayer), @@ -429,9 +429,9 @@ export const makeServerLayer = Layer.unwrap( Effect.sleep("250 millis").pipe( Effect.andThen(reconcileDesiredCloudLink(`http://127.0.0.1:${address.port}`)), Effect.retry({ times: 4 }), - Effect.tap(() => Effect.logInfo("T3 Cloud desired link reconciled on startup")), + Effect.tap(() => Effect.logInfo("T3 Connect desired link reconciled on startup")), Effect.catch((cause) => - Effect.logWarning("Failed to reconcile T3 Cloud desired link on startup", { + Effect.logWarning("Failed to reconcile T3 Connect desired link on startup", { cause, }), ), diff --git a/apps/web/src/cloud/linkEnvironment.test.ts b/apps/web/src/cloud/linkEnvironment.test.ts index 9baae20a68..dc09a7fa04 100644 --- a/apps/web/src/cloud/linkEnvironment.test.ts +++ b/apps/web/src/cloud/linkEnvironment.test.ts @@ -514,7 +514,7 @@ describe("web cloud link environment client", () => { expect(fetchMock.mock.calls[0]?.[1]?.credentials).not.toBe("include"); expect(String(fetchMock.mock.calls[1]?.[0])).toBe( - "http://127.0.0.1:3000/api/cloud/link-proof", + "http://127.0.0.1:3000/api/connect/link-proof", ); expect(fetchMock.mock.calls[1]?.[1]).toMatchObject({ method: "POST", @@ -553,7 +553,7 @@ describe("web cloud link environment client", () => { }); expect(String(fetchMock.mock.calls[3]?.[0])).toBe( - "http://127.0.0.1:3000/api/cloud/relay-config", + "http://127.0.0.1:3000/api/connect/relay-config", ); expect(fetchMock.mock.calls[3]?.[1]).toMatchObject({ method: "POST", @@ -615,7 +615,7 @@ describe("web cloud link environment client", () => { publishAgentActivity: false, }); expect(String(fetchMock.mock.calls[0]?.[0])).toBe( - "http://127.0.0.1:3000/api/cloud/link-state", + "http://127.0.0.1:3000/api/connect/link-state", ); expect(fetchMock.mock.calls[0]?.[1]).toMatchObject({ method: "GET", @@ -654,7 +654,7 @@ describe("web cloud link environment client", () => { }), ); - expect(String(fetchMock.mock.calls[0]?.[0])).toBe("http://127.0.0.1:3000/api/cloud/unlink"); + expect(String(fetchMock.mock.calls[0]?.[0])).toBe("http://127.0.0.1:3000/api/connect/unlink"); expect(fetchMock.mock.calls[0]?.[1]).toMatchObject({ method: "POST", credentials: "include", @@ -698,7 +698,7 @@ describe("web cloud link environment client", () => { ); expect(fetchMock).toHaveBeenCalledTimes(2); - expect(String(fetchMock.mock.calls[0]?.[0])).toBe("http://127.0.0.1:3000/api/cloud/unlink"); + expect(String(fetchMock.mock.calls[0]?.[0])).toBe("http://127.0.0.1:3000/api/connect/unlink"); expect(fetchMock.mock.calls[0]?.[1]).toMatchObject({ method: "POST", credentials: "include", diff --git a/apps/web/src/cloud/linkEnvironment.ts b/apps/web/src/cloud/linkEnvironment.ts index f68849e276..b13b324a41 100644 --- a/apps/web/src/cloud/linkEnvironment.ts +++ b/apps/web/src/cloud/linkEnvironment.ts @@ -451,7 +451,7 @@ export function readPrimaryCloudLinkState(): Effect.Effect< return null; } const client = yield* makeEnvironmentHttpApiClient(resolvePrimaryEnvironmentHttpUrl("/")); - return yield* client.cloud + return yield* client.connect .linkState({ headers: {} }) .pipe( withPrimaryEnvironmentRequestInit, @@ -465,7 +465,7 @@ export function updatePrimaryCloudPreferences(input: { }): Effect.Effect { return Effect.gen(function* () { const client = yield* makeEnvironmentHttpApiClient(resolvePrimaryEnvironmentHttpUrl("/")); - return yield* client.cloud + return yield* client.connect .preferences({ headers: {}, payload: input, @@ -488,7 +488,7 @@ export function unlinkPrimaryEnvironmentFromCloud(input: { }); } const client = yield* makeEnvironmentHttpApiClient(resolvePrimaryEnvironmentHttpUrl("/")); - yield* client.cloud + yield* client.connect .unlink({ headers: {} }) .pipe( withPrimaryEnvironmentRequestInit, @@ -568,7 +568,7 @@ export function linkEnvironmentToCloud(input: { ), ), ); - const proof = yield* environmentClient.cloud + const proof = yield* environmentClient.connect .linkProof({ headers, payload: { @@ -604,7 +604,7 @@ export function linkEnvironmentToCloud(input: { link, }); - yield* environmentClient.cloud + yield* environmentClient.connect .relayConfig({ headers, payload: { @@ -656,7 +656,7 @@ export function linkPrimaryEnvironmentToCloud(input: { ), ), ); - const proof = yield* environmentClient.cloud + const proof = yield* environmentClient.connect .linkProof({ headers: {}, payload: { @@ -695,7 +695,7 @@ export function linkPrimaryEnvironmentToCloud(input: { link, }); - yield* environmentClient.cloud + yield* environmentClient.connect .relayConfig({ headers: {}, payload: { diff --git a/apps/web/src/cloud/primaryCloudLinkState.ts b/apps/web/src/cloud/primaryCloudLinkState.ts index ecc2297595..095ca84228 100644 --- a/apps/web/src/cloud/primaryCloudLinkState.ts +++ b/apps/web/src/cloud/primaryCloudLinkState.ts @@ -55,7 +55,7 @@ export function usePrimaryCloudLinkState() { let error: string | null = null; if (result._tag === "Failure") { const cause = Cause.squash(result.cause); - error = cause instanceof Error ? cause.message : "Could not read T3 Cloud link state."; + error = cause instanceof Error ? cause.message : "Could not read T3 Connect link state."; } return { diff --git a/apps/web/src/components/clerk/T3ConnectSidebarSignIn.tsx b/apps/web/src/components/clerk/T3ConnectSidebarSignIn.tsx new file mode 100644 index 0000000000..d3f906ef41 --- /dev/null +++ b/apps/web/src/components/clerk/T3ConnectSidebarSignIn.tsx @@ -0,0 +1,60 @@ +import { UserButton, useAuth } from "@clerk/react"; +import { LogInIcon } from "lucide-react"; + +import { hasCloudPublicConfig } from "../../cloud/publicConfig"; +import { SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "../ui/sidebar"; +import { useT3ConnectAuthPrompt } from "./useT3ConnectAuthPrompt"; + +export function T3ConnectSidebarSignIn() { + if (!hasCloudPublicConfig()) return null; + + return ; +} + +export function T3ConnectSidebarAvatar() { + if (!hasCloudPublicConfig()) return null; + + return ; +} + +function ConfiguredT3ConnectSidebarAvatar() { + const { isLoaded, isSignedIn } = useAuth(); + + if (!isLoaded || !isSignedIn) return null; + + return ( + + ); +} + +function ConfiguredT3ConnectSidebarSignIn() { + const { isLoaded, isSignedIn } = useAuth(); + const { authPrompt, openAuthPrompt } = useT3ConnectAuthPrompt(); + + if (!isLoaded || isSignedIn) return null; + + return ( + <> + + + + + Sign in to T3 Connect + + + + {authPrompt} + + ); +} diff --git a/apps/web/src/components/clerk/useT3ConnectAuthPrompt.tsx b/apps/web/src/components/clerk/useT3ConnectAuthPrompt.tsx new file mode 100644 index 0000000000..b38d630dfa --- /dev/null +++ b/apps/web/src/components/clerk/useT3ConnectAuthPrompt.tsx @@ -0,0 +1,29 @@ +import { useClerk } from "@clerk/react"; +import { useState } from "react"; + +import { isElectron } from "../../env"; +import { Dialog, DialogPopup } from "../ui/dialog"; +import { DesktopClerkWaitlist } from "./DesktopClerkWaitlist"; + +export function useT3ConnectAuthPrompt() { + const clerk = useClerk(); + const [desktopAuthOpen, setDesktopAuthOpen] = useState(false); + + const openAuthPrompt = () => { + if (isElectron) { + setDesktopAuthOpen(true); + return; + } + clerk.openWaitlist(); + }; + + const authPrompt = isElectron ? ( + + + + + + ) : null; + + return { authPrompt, openAuthPrompt }; +} diff --git a/apps/web/src/components/cloud/RelayClientInstallDialog.tsx b/apps/web/src/components/cloud/RelayClientInstallDialog.tsx index 1ccdf4b10c..78282f6591 100644 --- a/apps/web/src/components/cloud/RelayClientInstallDialog.tsx +++ b/apps/web/src/components/cloud/RelayClientInstallDialog.tsx @@ -69,8 +69,8 @@ export function RelayClientInstallDialog() { {isInstalling - ? "T3 Code is preparing this environment for secure access through T3 Cloud." - : "T3 Code needs the relay client to make this environment available through T3 Cloud."} + ? "T3 Code is preparing this environment for secure access through T3 Connect." + : "T3 Code needs the relay client to make this environment available through T3 Connect."} diff --git a/apps/web/src/components/settings/CloudSettings.tsx b/apps/web/src/components/settings/CloudSettings.tsx deleted file mode 100644 index c2a1541b12..0000000000 --- a/apps/web/src/components/settings/CloudSettings.tsx +++ /dev/null @@ -1,197 +0,0 @@ -import { UserButton, Waitlist, useAuth } from "@clerk/react"; -import { AuthRelayWriteScope } from "@t3tools/contracts"; -import { CloudIcon, RefreshCwIcon, SmartphoneIcon } from "lucide-react"; -import { useEffect, useState } from "react"; - -import { updatePrimaryCloudPreferences } from "../../cloud/linkEnvironment"; -import { hasCloudPublicConfig } from "../../cloud/publicConfig"; -import { useManagedRelayDevices } from "../../cloud/managedRelayState"; -import { usePrimaryCloudLinkState } from "../../cloud/primaryCloudLinkState"; -import { isElectron } from "../../env"; -import { usePrimarySessionState } from "../../environments/primary"; -import { webRuntime } from "../../lib/runtime"; -import { cn } from "../../lib/utils"; -import { DesktopClerkWaitlist } from "../clerk/DesktopClerkWaitlist"; -import { Button } from "../ui/button"; -import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../ui/empty"; -import { Skeleton } from "../ui/skeleton"; -import { Switch } from "../ui/switch"; -import { toastManager } from "../ui/toast"; -import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; -import { SettingsPageContainer, SettingsRow, SettingsSection } from "./settingsLayout"; - -const NOTIFICATION_DEVICE_SKELETON_ROWS = ["primary", "secondary"] as const; - -function NotificationDevicesSkeleton() { - return NOTIFICATION_DEVICE_SKELETON_ROWS.map((row) => ( -
-
- - - -
-
- )); -} - -function EmptyNotificationDevices() { - return ( - - - - - - No notification devices - - Sign in on the mobile app to register a device for account-level notifications. - - - - ); -} - -function cloudErrorMessage(error: unknown, fallback: string): string { - return error instanceof Error ? error.message : fallback; -} - -export function CloudSettingsPanel() { - if (!hasCloudPublicConfig()) return null; - - return ; -} - -function ConfiguredCloudSettingsPanel() { - const { isLoaded, isSignedIn } = useAuth(); - - if (!isLoaded) { - return null; - } - - return isSignedIn ? : ; -} - -function CloudWaitlistPanel() { - return ( - - {isElectron ? : } - - ); -} - -function CloudSettingsPanelInner() { - const primaryLinkState = usePrimaryCloudLinkState(); - const primarySessionState = usePrimarySessionState(); - const devicesState = useManagedRelayDevices(); - const [isUpdatingPreference, setIsUpdatingPreference] = useState(false); - const devices = devicesState.data ?? []; - const canManageRelay = - primarySessionState.data?.authenticated === true && - Boolean(primarySessionState.data.scopes?.includes(AuthRelayWriteScope)); - - useEffect(() => { - if (devicesState.error) { - toastManager.add({ - type: "error", - title: "Cloud devices unavailable", - description: devicesState.error, - }); - } - }, [devicesState.error]); - - const updatePublishAgentActivity = async (enabled: boolean) => { - setIsUpdatingPreference(true); - try { - await webRuntime.runPromise(updatePrimaryCloudPreferences({ publishAgentActivity: enabled })); - primaryLinkState.refresh(); - toastManager.add({ - type: "success", - title: enabled ? "Agent activity enabled" : "Agent activity disabled", - description: enabled - ? "This environment can publish agent activity to your notification devices." - : "This environment will stop publishing agent activity.", - }); - } catch (error) { - toastManager.add({ - type: "error", - title: "Cloud preference update failed", - description: cloudErrorMessage(error, "Could not update cloud preferences."), - }); - } finally { - setIsUpdatingPreference(false); - } - }; - - return ( - - }> - } - /> - - - void updatePublishAgentActivity(enabled)} - /> - } - /> - - - - - - } - /> - Refresh notification devices - - } - > - {devicesState.data === null ? ( - - ) : devices.length > 0 ? ( - devices.map((device) => ( - - )) - ) : ( - - )} - - - ); -} diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx index 9dab7b61fa..bbffddebfb 100644 --- a/apps/web/src/components/settings/ConnectionsSettings.tsx +++ b/apps/web/src/components/settings/ConnectionsSettings.tsx @@ -76,6 +76,7 @@ import { stackedThreadToast, toastManager } from "../ui/toast"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { Button } from "../ui/button"; import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../ui/empty"; +import { useT3ConnectAuthPrompt } from "../clerk/useT3ConnectAuthPrompt"; import { Group, GroupSeparator } from "../ui/group"; import { AnimatedHeight } from "../AnimatedHeight"; import { @@ -121,6 +122,7 @@ import { connectManagedCloudEnvironment, linkPrimaryEnvironmentToCloud, unlinkPrimaryEnvironmentFromCloud, + updatePrimaryCloudPreferences, } from "~/cloud/linkEnvironment"; import { refreshManagedRelayEnvironments, @@ -1614,7 +1616,7 @@ function CloudLinkSwitch({ }) { const control = ( (null); const [isUpdating, setIsUpdating] = useState(false); + const [isUpdatingPreference, setIsUpdatingPreference] = useState(false); const updateLink = async (enabled: boolean) => { setIsUpdating(true); @@ -1643,7 +1647,7 @@ function ConfiguredCloudLinkRow({ canManageRelay }: { readonly canManageRelay: b const clerkToken = await getToken(resolveRelayClerkTokenOptions()); if (enabled) { if (!clerkToken) { - throw new Error("Sign in from T3 Cloud settings before linking this environment."); + throw new Error("Sign in to T3 Connect before linking this environment."); } await webRuntime.runPromise(linkPrimaryEnvironmentToCloud({ clerkToken })); } else { @@ -1655,48 +1659,103 @@ function ConfiguredCloudLinkRow({ canManageRelay }: { readonly canManageRelay: b refreshManagedRelayEnvironments(); toastManager.add({ type: "success", - title: enabled ? "T3 Cloud linked" : "T3 Cloud unlinked", + title: enabled ? "T3 Connect linked" : "T3 Connect unlinked", description: enabled - ? "This environment is available through T3 Cloud." - : "This environment is no longer available through T3 Cloud.", + ? "This environment is available through T3 Connect." + : "This environment is no longer available through T3 Connect.", }); } catch (cause) { - const message = cause instanceof Error ? cause.message : "Could not update T3 Cloud access."; + const message = + cause instanceof Error ? cause.message : "Could not update T3 Connect access."; setOperationError(message); toastManager.add({ type: "error", - title: "Could not update T3 Cloud", + title: "Could not update T3 Connect", description: message, }); } finally { setIsUpdating(false); } }; + const updatePublishAgentActivity = async (enabled: boolean) => { + setIsUpdatingPreference(true); + try { + await webRuntime.runPromise(updatePrimaryCloudPreferences({ publishAgentActivity: enabled })); + primaryCloudLinkState.refresh(); + toastManager.add({ + type: "success", + title: enabled ? "Agent activity enabled" : "Agent activity disabled", + description: enabled + ? "This environment can publish agent activity to your notification devices." + : "This environment will stop publishing agent activity.", + }); + } catch (cause) { + toastManager.add({ + type: "error", + title: "Could not update T3 Connect preferences", + description: + cause instanceof Error ? cause.message : "Could not update agent activity publishing.", + }); + } finally { + setIsUpdatingPreference(false); + } + }; const disabledReason = !isSignedIn - ? "Sign in from T3 Cloud settings to manage this environment." + ? "Sign in to T3 Connect" : !canManageRelay - ? "Your session does not have permission to manage T3 Cloud access." + ? "Your session does not have permission to manage T3 Connect access." : null; const linked = primaryCloudLinkState.data?.linked ?? false; return ( - void updateLink(enabled)} + <> + { + if (!isSignedIn) { + openAuthPrompt(); + return; + } + void updateLink(enabled); + }} + /> + } + /> + {linked ? ( + void updatePublishAgentActivity(enabled)} + /> + } /> - } - /> + ) : null} + {authPrompt} + ); } @@ -1704,7 +1763,13 @@ function CloudLinkRow({ canManageRelay }: { readonly canManageRelay: boolean }) return hasCloudPublicConfig() ? : null; } -function EmptyRemoteEnvironments({ cloudEnabled = true }: { readonly cloudEnabled?: boolean }) { +function EmptyRemoteEnvironments({ + cloudEnabled = true, + onConnectFromCloud, +}: { + readonly cloudEnabled?: boolean; + readonly onConnectFromCloud?: () => void; +}) { return ( @@ -1713,9 +1778,24 @@ function EmptyRemoteEnvironments({ cloudEnabled = true }: { readonly cloudEnable No saved remote environments - {cloudEnabled - ? "Click “Add environment” to pair another environment, or connect one from T3 Cloud." - : "Click “Add environment” to pair another environment."} + Click “Add environment” to pair another environment + {cloudEnabled ? ( + <> + , or connect one from{" "} + {onConnectFromCloud ? ( + + ) : ( + "T3 Connect" + )} + + ) : null} + . @@ -1743,7 +1823,8 @@ function ConfiguredCloudRemoteEnvironmentRows({ readonly primaryEnvironmentId: EnvironmentId | null; readonly savedEnvironmentIds: ReadonlyArray; }) { - const { getToken } = useAuth(); + const { getToken, isSignedIn } = useAuth(); + const { authPrompt, openAuthPrompt } = useT3ConnectAuthPrompt(); const environmentsState = useManagedRelayEnvironments(); const [connectingEnvironmentId, setConnectingEnvironmentId] = useState( null, @@ -1755,7 +1836,7 @@ function ConfiguredCloudRemoteEnvironmentRows({ try { const clerkToken = await getToken(resolveRelayClerkTokenOptions()); if (!clerkToken) { - throw new Error("Sign in from T3 Cloud settings before connecting this environment."); + throw new Error("Sign in to T3 Connect before connecting this environment."); } const connection = await webRuntime.runPromise( connectManagedCloudEnvironment({ clerkToken, environment }), @@ -1764,14 +1845,14 @@ function ConfiguredCloudRemoteEnvironmentRows({ toastManager.add({ type: "success", title: "Environment connected", - description: `${connection.label} is available through T3 Cloud.`, + description: `${connection.label} is available through T3 Connect.`, }); } catch (cause) { toastManager.add({ type: "error", title: "Could not connect environment", description: - cause instanceof Error ? cause.message : "Could not connect the T3 Cloud environment.", + cause instanceof Error ? cause.message : "Could not connect the T3 Connect environment.", }); } finally { setConnectingEnvironmentId(null); @@ -1789,7 +1870,12 @@ function ConfiguredCloudRemoteEnvironmentRows({ } if (savedEnvironmentIds.length === 0 && connectableEnvironments.length === 0) { - return ; + return ( + <> + + {authPrompt} + + ); } return connectableEnvironments.map((environment) => ( @@ -1799,11 +1885,11 @@ function ConfiguredCloudRemoteEnvironmentRows({

{environment.label}

-

T3 Cloud

+

T3 Connect

diff --git a/apps/web/src/routes/settings.cloud.tsx b/apps/web/src/routes/settings.cloud.tsx deleted file mode 100644 index a2854e9719..0000000000 --- a/apps/web/src/routes/settings.cloud.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute, redirect } from "@tanstack/react-router"; - -import { CloudSettingsPanel } from "../components/settings/CloudSettings"; -import { hasCloudPublicConfig } from "../cloud/publicConfig"; - -export const Route = createFileRoute("/settings/cloud")({ - beforeLoad: () => { - if (!hasCloudPublicConfig()) { - throw redirect({ to: "/settings/general", replace: true }); - } - }, - component: CloudSettingsPanel, -}); diff --git a/docs/README.md b/docs/README.md index f1b7f94fd7..db32ff8468 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,7 +2,7 @@ - [Getting started](./getting-started/quick-start.md) - [Architecture](./architecture/overview.md) -- [Cloud](./cloud/t3-cloud-clerk.md) +- [T3 Connect](./cloud/t3-connect-clerk.md) - [Integrations](./integrations/source-control-providers.md) - [Mobile](./mobile/app.md) - [Operations](./operations/ci.md) diff --git a/docs/cloud/t3-code-cloud-auth-flow.html b/docs/cloud/t3-code-connect-auth-flow.html similarity index 96% rename from docs/cloud/t3-code-cloud-auth-flow.html rename to docs/cloud/t3-code-connect-auth-flow.html index 030a9c15db..038132ee5c 100644 --- a/docs/cloud/t3-code-cloud-auth-flow.html +++ b/docs/cloud/t3-code-connect-auth-flow.html @@ -3,7 +3,7 @@ - T3 Code Cloud Architecture + T3 Connect Architecture - - - T3 Code (Alpha) diff --git a/apps/web/package.json b/apps/web/package.json index 5ca171639b..3af8e8aad7 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -21,6 +21,8 @@ "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", "@effect/atom-react": "catalog:", + "@fontsource-variable/dm-sans": "^5.2.8", + "@fontsource/jetbrains-mono": "^5.2.8", "@formkit/auto-animate": "^0.9.0", "@legendapp/list": "3.0.0-beta.44", "@lexical/react": "^0.41.0", diff --git a/apps/web/src/components/ThreadTerminalDrawer.tsx b/apps/web/src/components/ThreadTerminalDrawer.tsx index 9e57cbe60e..b740a9ed7c 100644 --- a/apps/web/src/components/ThreadTerminalDrawer.tsx +++ b/apps/web/src/components/ThreadTerminalDrawer.tsx @@ -329,7 +329,8 @@ export function TerminalViewport({ lineHeight: 1.2, fontSize: 12, scrollback: 5_000, - fontFamily: '"SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace', + fontFamily: + '"SF Mono", "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace', theme: terminalThemeFromApp(mount), }); terminal.loadAddon(fitAddon); diff --git a/apps/web/src/index.css b/apps/web/src/index.css index 0f0417d438..666512f577 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -6,6 +6,11 @@ @theme inline { --animate-skeleton: skeleton 2s -1s infinite linear; + --font-sans: + "DM Sans Variable", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, + sans-serif; + --font-mono: + "SF Mono", "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace; --color-warning-foreground: var(--warning-foreground); --color-warning: var(--warning); --color-success-foreground: var(--success-foreground); @@ -146,6 +151,7 @@ body { font-family: + "DM Sans Variable", "DM Sans", -apple-system, BlinkMacSystemFont, @@ -191,7 +197,8 @@ body::after { pre, code { - font-family: "SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; + font-family: + "SF Mono", "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace; } /* Window drag region (frameless titlebar) */ diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx index 320eaa30e8..e92cad9aa3 100644 --- a/apps/web/src/main.tsx +++ b/apps/web/src/main.tsx @@ -4,6 +4,9 @@ import { ClerkProvider } from "@clerk/react"; import { RouterProvider } from "@tanstack/react-router"; import { createHashHistory, createBrowserHistory } from "@tanstack/react-router"; +import "@fontsource-variable/dm-sans/index.css"; +import "@fontsource/jetbrains-mono/400.css"; +import "@fontsource/jetbrains-mono/500.css"; import "@xterm/xterm/css/xterm.css"; import "./index.css"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 686a725883..a9a7bd17d1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -455,6 +455,12 @@ importers: '@effect/atom-react': specifier: 4.0.0-beta.78 version: 4.0.0-beta.78(effect@4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))(react@19.2.6)(scheduler@0.27.0) + '@fontsource-variable/dm-sans': + specifier: ^5.2.8 + version: 5.2.8 + '@fontsource/jetbrains-mono': + specifier: ^5.2.8 + version: 5.2.8 '@formkit/auto-animate': specifier: ^0.9.0 version: 0.9.0 @@ -2364,6 +2370,12 @@ packages: '@floating-ui/utils@0.2.11': resolution: {integrity: sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg==} + '@fontsource-variable/dm-sans@5.2.8': + resolution: {integrity: sha512-AxkvMTvNWgfrmlyjiV05vlHYJa+nRQCf1EfvIrQAPBpFJW0O9VTz7oAFr9S3lvbWdmnFoBk7yFqQL86u64nl2g==} + + '@fontsource/jetbrains-mono@5.2.8': + resolution: {integrity: sha512-6w8/SG4kqvIMu7xd7wt6x3idn1Qux3p9N62s6G3rfldOUYHpWcc2FKrqf+Vo44jRvqWj2oAtTHrZXEP23oSKwQ==} + '@formkit/auto-animate@0.9.0': resolution: {integrity: sha512-VhP4zEAacXS3dfTpJpJ88QdLqMTcabMg0jwpOSxZ/VzfQVfl3GkZSCZThhGC5uhq/TxPHPzW0dzr4H9Bb1OgKA==} @@ -11567,6 +11579,10 @@ snapshots: '@floating-ui/utils@0.2.11': {} + '@fontsource-variable/dm-sans@5.2.8': {} + + '@fontsource/jetbrains-mono@5.2.8': {} + '@formkit/auto-animate@0.9.0': {} '@hono/node-server@1.19.14(hono@4.12.23)': From b03bc4b52d184c5f2367d702e043586a0e9fcdaa Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 9 Jun 2026 17:15:09 -0700 Subject: [PATCH 05/24] Mute icons in labeled controls and suppress popup focus rings (#3015) Co-authored-by: ss Co-authored-by: Claude Opus 4.8 --- apps/web/src/components/ui/autocomplete.tsx | 2 +- apps/web/src/components/ui/button.tsx | 4 ++-- apps/web/src/components/ui/combobox.tsx | 2 ++ apps/web/src/components/ui/menu.tsx | 4 ++-- apps/web/src/components/ui/select.tsx | 13 ++++++++----- apps/web/src/index.css | 8 ++++++++ 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/apps/web/src/components/ui/autocomplete.tsx b/apps/web/src/components/ui/autocomplete.tsx index d6db87d48c..2d099762f2 100644 --- a/apps/web/src/components/ui/autocomplete.tsx +++ b/apps/web/src/components/ui/autocomplete.tsx @@ -125,7 +125,7 @@ function AutocompleteItem({ className, children, ...props }: AutocompletePrimiti return (
{children}
diff --git a/apps/web/src/components/ui/menu.tsx b/apps/web/src/components/ui/menu.tsx index 8f2833e41b..07e27d23f4 100644 --- a/apps/web/src/components/ui/menu.tsx +++ b/apps/web/src/components/ui/menu.tsx @@ -78,7 +78,7 @@ function MenuItem({ return ( svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:shrink-0", + "[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&>svg:not([class*='text-'])]:text-current [&>svg]:pointer-events-none [&>svg]:shrink-0", className, )} data-inset={inset} @@ -235,7 +235,7 @@ function MenuSubTrigger({ return ( {variant === "ghost" ? ( - + ) : ( )} @@ -87,7 +87,7 @@ function SelectTrigger({ > {children} - + ); @@ -138,7 +138,7 @@ function SelectPopup({ sideOffset={sideOffset} > @@ -210,7 +210,10 @@ function SelectItem({ )} {children} diff --git a/apps/web/src/index.css b/apps/web/src/index.css index 666512f577..9770f56742 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -54,6 +54,14 @@ * { @apply border-border outline-ring/50; } + :where([data-slot="menu-popup"], [data-slot="select-popup"], [data-slot="popover-popup"]):focus, + :where( + [data-slot="menu-popup"], + [data-slot="select-popup"], + [data-slot="popover-popup"] + ):focus-visible { + @apply outline-none ring-0; + } html { background-color: var(--app-chrome-background); } From 238715fd6fb1e5106db1e310eed7c389304b4840 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 9 Jun 2026 17:52:16 -0700 Subject: [PATCH 06/24] Polish dialog/alert surfaces and unauthenticated provider banner (#3016) Co-authored-by: ss Co-authored-by: Claude Opus 4.8 --- apps/web/src/components/ChatView.tsx | 4 + .../components/chat/ProviderStatusBanner.tsx | 47 +++++--- .../src/components/chat/ThreadErrorBanner.tsx | 12 +- apps/web/src/components/ui/alert-dialog.tsx | 5 +- apps/web/src/components/ui/alert.tsx | 109 ++++++++++++------ apps/web/src/components/ui/command.tsx | 2 +- apps/web/src/components/ui/dialog.tsx | 5 +- apps/web/src/components/ui/sheet.tsx | 2 +- 8 files changed, 122 insertions(+), 64 deletions(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index df5d5e4a2f..0214f7fe89 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -1843,7 +1843,11 @@ export default function ChatView(props: ChatViewProps) { // `codex_personal`) surfaces its own status/message in the banner rather // than the default Codex's. Falls back to first-match-by-kind when no // saved instance id is available or the instance no longer exists. + const selectedProviderInstanceId = + providerStatuses.find((status) => status.instanceId === selectedProviderByThreadId) + ?.instanceId ?? null; const activeProviderInstanceId = + selectedProviderInstanceId ?? activeThread?.session?.providerInstanceId ?? activeThread?.modelSelection.instanceId ?? activeProject?.defaultModelSelection?.instanceId ?? diff --git a/apps/web/src/components/chat/ProviderStatusBanner.tsx b/apps/web/src/components/chat/ProviderStatusBanner.tsx index a882942585..546c48661e 100644 --- a/apps/web/src/components/chat/ProviderStatusBanner.tsx +++ b/apps/web/src/components/chat/ProviderStatusBanner.tsx @@ -1,7 +1,7 @@ import { type ServerProvider } from "@t3tools/contracts"; import { memo } from "react"; -import { Alert, AlertDescription, AlertTitle } from "../ui/alert"; -import { CircleAlertIcon } from "lucide-react"; +import { InfoIcon } from "lucide-react"; +import { cn } from "~/lib/utils"; import { formatProviderDriverKindLabel } from "../../providerModels"; export const ProviderStatusBanner = memo(function ProviderStatusBanner({ @@ -13,22 +13,37 @@ export const ProviderStatusBanner = memo(function ProviderStatusBanner({ return null; } - const providerLabel = status.displayName?.trim() || formatProviderDriverKindLabel(status.driver); - const defaultMessage = - status.status === "error" - ? `${providerLabel} provider is unavailable.` - : `${providerLabel} provider has limited availability.`; - const title = `${providerLabel} provider status`; + const providerName = status.displayName?.trim() || formatProviderDriverKindLabel(status.driver); + const isUnauthenticated = status.status === "error" && status.auth.status === "unauthenticated"; + const title = isUnauthenticated + ? `${providerName} is unauthenticated` + : `${providerName} provider status`; + const message = isUnauthenticated + ? "Sign in via the CLI to authenticate again." + : (status.message ?? + (status.status === "error" + ? `${providerName} provider is unavailable.` + : `${providerName} provider has limited availability.`)); return ( -
- - - {title} - - {status.message ?? defaultMessage} - - +
+
+ +
+
{title}
+
+ {message} +
+
+
); }); diff --git a/apps/web/src/components/chat/ThreadErrorBanner.tsx b/apps/web/src/components/chat/ThreadErrorBanner.tsx index b48412453c..fbd1620a0b 100644 --- a/apps/web/src/components/chat/ThreadErrorBanner.tsx +++ b/apps/web/src/components/chat/ThreadErrorBanner.tsx @@ -1,5 +1,6 @@ import { memo } from "react"; import { Alert, AlertAction, AlertDescription } from "../ui/alert"; +import { Button } from "../ui/button"; import { CircleAlertIcon, XIcon } from "lucide-react"; export const ThreadErrorBanner = memo(function ThreadErrorBanner({ @@ -19,14 +20,9 @@ export const ThreadErrorBanner = memo(function ThreadErrorBanner({ {onDismiss && ( - + )} diff --git a/apps/web/src/components/ui/alert-dialog.tsx b/apps/web/src/components/ui/alert-dialog.tsx index 84bcff9631..c92f1b8082 100644 --- a/apps/web/src/components/ui/alert-dialog.tsx +++ b/apps/web/src/components/ui/alert-dialog.tsx @@ -17,8 +17,9 @@ function AlertDialogTrigger(props: AlertDialogPrimitive.Trigger.Props) { function AlertDialogBackdrop({ className, ...props }: AlertDialogPrimitive.Backdrop.Props) { return ( svg]:has-data-[slot=alert-action]:grid-cols-[calc(var(--spacing)*4)_1fr_auto] has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-data-[slot=alert-action]:grid-cols-[1fr_auto] has-[>svg]:gap-x-2 [&>svg]:h-lh [&>svg]:w-4", - { - defaultVariants: { - variant: "default", - }, - variants: { - variant: { - default: "bg-transparent dark:bg-input/32 [&>svg]:text-muted-foreground", - error: "border-destructive/32 bg-destructive/4 [&>svg]:text-destructive", - info: "border-info/32 bg-info/4 [&>svg]:text-info", - success: "border-success/32 bg-success/4 [&>svg]:text-success", - warning: "border-warning/32 bg-warning/4 [&>svg]:text-warning", - }, +const alertVariants = cva("relative rounded-xl border px-3.5 py-3 text-card-foreground text-sm", { + defaultVariants: { + variant: "default", + }, + variants: { + variant: { + default: "bg-transparent dark:bg-input/32 [&_svg]:text-muted-foreground", + error: + "border-destructive/32 bg-destructive/4 text-destructive-foreground [&_[data-slot=alert-description]]:text-destructive-foreground/80 [&_svg]:text-destructive", + info: "border-info/32 bg-info/4 [&_svg]:text-info", + success: "border-success/32 bg-success/4 [&_svg]:text-success", + warning: "border-warning/32 bg-warning/4 [&_svg]:text-warning", }, }, -); +}); + +function alertChildSlot(child: React.ReactElement): string | undefined { + const propsSlot = (child.props as Record)["data-slot"]; + if (propsSlot) { + return propsSlot; + } + + const type = child.type as { displayName?: string; name?: string }; + switch (type.displayName ?? type.name) { + case "AlertAction": + return "alert-action"; + case "AlertTitle": + return "alert-title"; + case "AlertDescription": + return "alert-description"; + default: + return undefined; + } +} function Alert({ className, variant, + children, ...props }: React.ComponentProps<"div"> & VariantProps) { + const icon: React.ReactNode[] = []; + const content: React.ReactNode[] = []; + const action: React.ReactNode[] = []; + + Children.forEach(children, (child) => { + if (!isValidElement(child)) { + content.push(child); + return; + } + const slot = alertChildSlot(child); + if (slot === "alert-action") { + action.push(child); + } else if (slot === "alert-title" || slot === "alert-description") { + content.push(child); + } else { + icon.push(child); + } + }); + return (
+ > +
+ {icon.length > 0 && ( +
+ {icon} +
+ )} + {content.length > 0 && ( +
{content}
+ )} + {action.length > 0 && ( +
{action}
+ )} +
+
); } function AlertTitle({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); + return
; } function AlertDescription({ className, ...props }: React.ComponentProps<"div">) { return (
@@ -57,16 +103,11 @@ function AlertDescription({ className, ...props }: React.ComponentProps<"div">) } function AlertAction({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); + return
; } +AlertTitle.displayName = "AlertTitle"; +AlertDescription.displayName = "AlertDescription"; +AlertAction.displayName = "AlertAction"; + export { Alert, AlertTitle, AlertDescription, AlertAction }; diff --git a/apps/web/src/components/ui/command.tsx b/apps/web/src/components/ui/command.tsx index 9a9a57ef0f..ad05bc2a63 100644 --- a/apps/web/src/components/ui/command.tsx +++ b/apps/web/src/components/ui/command.tsx @@ -30,7 +30,7 @@ function CommandDialogBackdrop({ className, ...props }: CommandDialogPrimitive.B return ( Date: Wed, 10 Jun 2026 05:04:36 +0200 Subject: [PATCH 07/24] fix(marketing) : marketing showing wrong icons on linux (#2696) Co-authored-by: Julius Marminge --- apps/marketing/src/components/TuxIcon.astro | 53 --------------------- apps/marketing/src/pages/download.astro | 2 +- apps/marketing/src/pages/index.astro | 8 ++-- 3 files changed, 5 insertions(+), 58 deletions(-) delete mode 100644 apps/marketing/src/components/TuxIcon.astro diff --git a/apps/marketing/src/components/TuxIcon.astro b/apps/marketing/src/components/TuxIcon.astro deleted file mode 100644 index a6f1b4902c..0000000000 --- a/apps/marketing/src/components/TuxIcon.astro +++ /dev/null @@ -1,53 +0,0 @@ ---- -interface Props { - class?: string; - idPrefix: string; -} - -const { class: className, idPrefix } = Astro.props; ---- - - diff --git a/apps/marketing/src/pages/download.astro b/apps/marketing/src/pages/download.astro index b9e0e0181e..76977ad4ce 100644 --- a/apps/marketing/src/pages/download.astro +++ b/apps/marketing/src/pages/download.astro @@ -47,7 +47,7 @@ import { RELEASES_URL } from "../lib/releases";
- +

Linux

diff --git a/apps/marketing/src/pages/index.astro b/apps/marketing/src/pages/index.astro index dd2ba30a71..0b76f35089 100644 --- a/apps/marketing/src/pages/index.astro +++ b/apps/marketing/src/pages/index.astro @@ -1,6 +1,5 @@ --- import Layout from "../layouts/Layout.astro"; -import TuxIcon from "../components/TuxIcon.astro"; import { tweets } from "../lib/tweets"; const desktopEndorsementRows = [ @@ -53,7 +52,7 @@ const mobileEndorsementRows = [ > - + Download for macOS @@ -360,7 +359,8 @@ const mobileEndorsementRows = [ - + + Download for macOS Windows · Linux · other @@ -548,7 +548,7 @@ const mobileEndorsementRows = [ :global([data-platform="mac"]) .dl-icon--apple { display: block; } :global([data-platform="win"]) .dl-icon--windows { display: block; } :global([data-platform="linux"]) .dl-icon--linux { display: block; } - :global(:not([data-platform])) .dl-icon--apple { display: block; } + :global(html:not([data-platform])) .dl-icon--apple { display: block; } /* Floating harness marks */ .hero-float { From 7f741a56d176617d7f97865de24dbdf11ea3fd7e Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 9 Jun 2026 21:21:58 -0700 Subject: [PATCH 08/24] Misc markdown styling improvements (#3017) Co-authored-by: ss Co-authored-by: Claude Opus 4.8 Co-authored-by: codex Co-authored-by: Cursor Agent Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com> --- .../src/features/threads/ThreadComposer.tsx | 4 +- apps/web/package.json | 3 + .../src/components/ChatMarkdown.browser.tsx | 543 ++++++++++++++ apps/web/src/components/ChatMarkdown.tsx | 706 +++++++++++++++++- apps/web/src/components/ChatView.browser.tsx | 62 +- apps/web/src/components/CommandPalette.tsx | 123 +-- .../src/components/ComposerPromptEditor.tsx | 22 +- apps/web/src/components/DiffPanel.tsx | 179 +++-- .../src/components/ProjectScriptsControl.tsx | 49 +- apps/web/src/components/Sidebar.tsx | 75 +- .../src/components/ThreadStatusIndicators.tsx | 79 +- apps/web/src/components/chat/ChatComposer.tsx | 163 ++-- apps/web/src/components/chat/ChatHeader.tsx | 19 +- apps/web/src/components/chat/FileTagChip.tsx | 39 + .../chat/MessagesTimeline.browser.tsx | 125 ++++ .../components/chat/MessagesTimeline.test.tsx | 3 +- .../src/components/chat/MessagesTimeline.tsx | 194 +++-- .../components/chat/ProviderStatusBanner.tsx | 12 +- .../src/components/chat/SkillInlineText.tsx | 17 +- .../src/components/chat/ThreadErrorBanner.tsx | 12 +- apps/web/src/components/composerInlineChip.ts | 12 +- .../settings/ConnectionsSettings.tsx | 85 ++- .../settings/KeybindingsSettings.tsx | 16 +- apps/web/src/components/ui/sidebar.tsx | 56 +- apps/web/src/components/ui/toast.tsx | 106 +-- apps/web/src/components/ui/tooltip.tsx | 2 +- apps/web/src/composer-editor-mentions.test.ts | 65 +- apps/web/src/composer-editor-mentions.ts | 33 +- apps/web/src/composer-logic.test.ts | 20 + apps/web/src/composer-logic.ts | 5 +- apps/web/src/index.css | 283 +++++-- apps/web/src/markdown-clipboard.ts | 311 ++++++++ apps/web/src/vscode-icons.ts | 29 + packages/shared/src/composerTrigger.test.ts | 28 +- packages/shared/src/composerTrigger.ts | 23 + pnpm-lock.yaml | 43 ++ 36 files changed, 2934 insertions(+), 612 deletions(-) create mode 100644 apps/web/src/components/chat/FileTagChip.tsx create mode 100644 apps/web/src/markdown-clipboard.ts diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsx index e267ae9a07..aa7d033236 100644 --- a/apps/mobile/src/features/threads/ThreadComposer.tsx +++ b/apps/mobile/src/features/threads/ThreadComposer.tsx @@ -10,7 +10,7 @@ import type { import { detectComposerTrigger, replaceTextRange, - serializeComposerMentionPath, + serializeComposerFileLink, type ComposerTrigger, } from "@t3tools/shared/composerTrigger"; import { TextInputWrapper } from "expo-paste-input"; @@ -419,7 +419,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer let replacement = ""; if (item.type === "path") { - replacement = `@${serializeComposerMentionPath(item.path)} `; + replacement = `${serializeComposerFileLink(item.path)} `; } else if (item.type === "skill") { replacement = `$${item.skill.name} `; } else if (item.type === "slash-command") { diff --git a/apps/web/package.json b/apps/web/package.json index 3af8e8aad7..cbf554a667 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -43,6 +43,9 @@ "react": "19.2.6", "react-dom": "19.2.6", "react-markdown": "^10.1.0", + "rehype-raw": "^7.0.0", + "rehype-sanitize": "^6.0.0", + "remark-breaks": "^4.0.0", "remark-gfm": "^4.0.1", "tailwind-merge": "^3.4.0", "zustand": "^5.0.11" diff --git a/apps/web/src/components/ChatMarkdown.browser.tsx b/apps/web/src/components/ChatMarkdown.browser.tsx index b2b2989e92..e047392c12 100644 --- a/apps/web/src/components/ChatMarkdown.browser.tsx +++ b/apps/web/src/components/ChatMarkdown.browser.tsx @@ -24,6 +24,7 @@ vi.mock("../localApi", () => ({ })); import ChatMarkdown from "./ChatMarkdown"; +import { serializeTableElementToCsv, serializeTableElementToMarkdown } from "../markdown-clipboard"; describe("ChatMarkdown", () => { afterEach(() => { @@ -134,8 +135,550 @@ describe("ChatMarkdown", () => { await expect.element(link).toBeInTheDocument(); await expect.element(link).toHaveAttribute("href", "https://openai.com/docs"); await expect.element(link).toHaveAttribute("target", "_blank"); + const favicon = link.element().querySelector(".chat-markdown-link-favicon"); + const leading = link.element().querySelector(".chat-markdown-link-leading"); + expect(favicon).not.toBeNull(); + expect(leading).not.toBeNull(); + expect(leading?.contains(favicon)).toBe(true); + expect(getComputedStyle(leading!).display).toBe("inline"); + expect(getComputedStyle(leading!).whiteSpace).toBe("nowrap"); + expect(getComputedStyle(favicon!).verticalAlign).not.toBe("baseline"); + expect(leading?.textContent).toBe("O"); + expect(link.element().textContent).toBe("OpenAI"); + expect(getComputedStyle(link.element()).textDecorationLine).toBe("none"); + expect(link.element().querySelector("img, svg")?.getBoundingClientRect().width).toBe(14); + await link.hover(); + expect(getComputedStyle(link.element()).backgroundImage).not.toBe("none"); + await expect.element(page.getByText("https://openai.com/docs")).toBeVisible(); } finally { await screen.unmount(); } }); + + it("keeps a favicon with the leading segment of a wrapping URL", async () => { + const url = "https://github.com/pingdotgg/t3code/pull/3017/changes"; + const screen = await render( +
+ +
, + ); + + try { + const link = page.getByRole("link", { name: url }); + const leading = link.element().querySelector(".chat-markdown-link-leading"); + const favicon = link.element().querySelector(".chat-markdown-link-favicon"); + expect(leading).not.toBeNull(); + expect(favicon).not.toBeNull(); + expect(leading?.contains(favicon)).toBe(true); + expect(leading?.textContent).toBe("https://"); + expect(getComputedStyle(leading!).display).toBe("inline"); + expect(getComputedStyle(leading!).whiteSpace).toBe("nowrap"); + expect(getComputedStyle(favicon!).verticalAlign).not.toBe("baseline"); + expect(link.element().textContent).toBe(url); + expect(link.element().querySelectorAll("wbr").length).toBeGreaterThan(0); + const markdownRoot = link.element().closest(".chat-markdown"); + expect(markdownRoot).not.toBeNull(); + expect(markdownRoot!.scrollWidth).toBeLessThanOrEqual(markdownRoot!.clientWidth); + } finally { + await screen.unmount(); + } + }); + + it("renders file links with the shared file tag chip treatment", async () => { + const screen = await render( + , + ); + + try { + const link = page.getByRole("link", { name: "package.json" }); + await expect.element(link).toHaveClass(/chat-markdown-file-link/); + const element = document.querySelector(".chat-markdown-file-link"); + expect(element?.querySelector("img, svg")).not.toBeNull(); + expect(getComputedStyle(element!).display).toBe("inline-flex"); + expect(getComputedStyle(element!).textDecorationLine).toBe("none"); + expect(getComputedStyle(element!).borderStyle).toBe("solid"); + expect(getComputedStyle(element!).userSelect).not.toBe("none"); + } finally { + await screen.unmount(); + } + }); + + it("renders sanitized details with the design-system collapsible", async () => { + const source = [ + "
", + "Expandable details section", + "", + "This content includes **formatted text**.", + "", + 'Safe inline HTML', + "", + "
", + ].join("\n"); + const screen = await render(); + + try { + const details = document.querySelector("[data-markdown-details]"); + const trigger = page.getByRole("button", { name: "Expandable details section" }); + expect(details).not.toBeNull(); + expect(details?.tagName).toBe("DIV"); + await expect.element(trigger).toHaveAttribute("aria-expanded", "true"); + expect(details?.querySelector("strong")?.textContent).toBe("formatted text"); + expect(details?.querySelector("script")).toBeNull(); + expect(details?.querySelector("[title]")).toBeNull(); + + await trigger.click(); + await expect.element(trigger).toHaveAttribute("aria-expanded", "false"); + await trigger.click(); + await expect.element(trigger).toHaveAttribute("aria-expanded", "true"); + } finally { + await screen.unmount(); + } + }); + + it("renders footnotes as same-document references", async () => { + const source = [ + "A claim with supporting context.[^context]", + "", + "[^context]: Supporting **footnote text**.", + ].join("\n"); + const screen = await render(); + + try { + const reference = document.querySelector( + '.chat-markdown a[data-footnote-ref=""]', + ); + const footnotes = document.querySelector( + ".chat-markdown section[data-footnotes]", + ); + expect(reference).not.toBeNull(); + expect(reference?.getAttribute("href")).toMatch(/^#user-content-fn-/); + expect(reference?.hasAttribute("target")).toBe(false); + expect(footnotes).not.toBeNull(); + expect(footnotes?.querySelector("strong")?.textContent).toBe("footnote text"); + expect(footnotes?.querySelector("a[data-footnote-backref]")?.target).toBe( + "", + ); + } finally { + await screen.unmount(); + } + }); + + it("navigates hash links within the clicked markdown message", async () => { + const source = [ + "A claim with supporting context.[^context]", + "", + "[^context]: Supporting footnote text.", + ].join("\n"); + const originalUrl = window.location.href; + const scrollIntoView = vi + .spyOn(HTMLElement.prototype, "scrollIntoView") + .mockImplementation(() => undefined); + const screen = await render( +
+ + +
, + ); + + try { + const markdownRoots = document.querySelectorAll(".chat-markdown"); + const secondRoot = markdownRoots[1]; + const secondReference = + secondRoot?.querySelector('a[data-footnote-ref=""]'); + const secondFootnote = secondRoot?.querySelector( + "section[data-footnotes] li[id]", + ); + expect(secondReference).not.toBeNull(); + expect(secondFootnote).not.toBeNull(); + + secondReference?.click(); + + expect(scrollIntoView).toHaveBeenCalledTimes(1); + expect(scrollIntoView.mock.instances[0]).toBe(secondFootnote); + expect(window.location.hash).toBe(secondReference?.hash); + + const secondBackref = secondRoot?.querySelector( + "a[data-footnote-backref]", + ); + expect(secondBackref).not.toBeNull(); + secondBackref?.click(); + + const secondReferenceTarget = secondReference?.closest("[id]"); + expect(scrollIntoView).toHaveBeenCalledTimes(2); + expect(scrollIntoView.mock.instances[1]).toBe(secondReferenceTarget); + } finally { + scrollIntoView.mockRestore(); + window.history.replaceState(window.history.state, "", originalUrl); + await screen.unmount(); + } + }); + + describe("code block chrome", () => { + it("shows icon-only language titles, text fallbacks, and filename overrides", async () => { + const source = [ + "```ts", + "const a = 1;", + "```", + "", + '```ts title="src/main.ts"', + "const b = 2;", + "```", + "", + "```text", + "plain", + "```", + ].join("\n"); + const screen = await render(); + + try { + const titles = [...document.querySelectorAll(".chat-markdown-codeblock-title")]; + expect(titles).toHaveLength(3); + + // Language with a known icon: icon XOR text — never the redundant pair. + const languageOnly = titles[0]!; + const hasIcon = languageOnly.querySelector("img") != null; + const hasText = (languageOnly.textContent ?? "").includes("ts"); + expect(hasIcon || hasText).toBe(true); + expect(hasIcon && hasText).toBe(false); + if (hasIcon) { + const languageTrigger = page.getByLabelText("Language: ts").first(); + await languageTrigger.hover(); + await vi.waitFor(() => { + const tooltip = document.querySelector('[data-slot="tooltip-popup"]'); + expect(tooltip?.textContent).toContain("ts"); + }); + } + + // Explicit filename: text always shown. + expect(titles[1]!.textContent).toBe("src/main.ts"); + + // Unknown language: no icon attempt, text label. + expect(titles[2]!.querySelector("img")).toBeNull(); + expect(titles[2]!.textContent).toBe("text"); + } finally { + await screen.unmount(); + } + }); + + it("toggles line wrapping per block", async () => { + const screen = await render( + , + ); + + try { + const block = document.querySelector(".chat-markdown-codeblock"); + expect(block?.getAttribute("data-wrap")).toBe("false"); + + const toggle = page.getByRole("button", { name: "Wrap lines" }); + await expect.element(toggle).not.toHaveAttribute("title"); + await toggle.hover(); + await vi.waitFor(() => { + const tooltip = document.querySelector('[data-slot="tooltip-popup"]'); + expect(tooltip?.textContent).toContain("Wrap lines"); + }); + await toggle.click(); + expect(block?.getAttribute("data-wrap")).toBe("true"); + + await page.getByRole("button", { name: "Disable line wrap" }).click(); + expect(block?.getAttribute("data-wrap")).toBe("false"); + } finally { + await screen.unmount(); + } + }); + }); + + it("scrolls wide tables horizontally instead of letter-wrapping cells", async () => { + const header = `| ${Array.from({ length: 8 }, (_, i) => `ColumnHeading${i}`).join(" | ")} |`; + const separator = `| ${Array.from({ length: 8 }, () => "---").join(" | ")} |`; + const row = `| ${Array.from({ length: 8 }, () => "averylongunbrokencellvalue@example-domain.com").join(" | ")} |`; + const screen = await render( + , + ); + + try { + const viewport = document.querySelector( + '.chat-markdown-table-container [data-slot="scroll-area-viewport"]', + ); + expect(viewport).not.toBeNull(); + expect(viewport!.querySelector("table")).not.toBeNull(); + // Content exceeds the container — the scroll-fade viewport scrolls + // horizontally rather than squishing columns. + expect(viewport!.scrollWidth).toBeGreaterThan(viewport!.clientWidth); + // And cells keep their longest word intact instead of breaking mid-word. + const cell = viewport!.querySelector("td"); + expect(cell!.getBoundingClientRect().width).toBeGreaterThan(100); + } finally { + await screen.unmount(); + } + }); + + describe("table chrome", () => { + const longCell = + "This service has been experiencing intermittent latency spikes during peak traffic hours and the on-call team is investigating."; + + it("truncates cells by default and expands them from the footer toggle", async () => { + const source = ["| Name | Notes |", "| --- | --- |", `| api | ${longCell} |`].join("\n"); + const screen = await render(); + + try { + const container = document.querySelector(".chat-markdown-table-container"); + expect(container?.getAttribute("data-expanded")).toBe("false"); + + const noteCell = [...document.querySelectorAll(".chat-markdown td")].at(-1)!; + expect(getComputedStyle(noteCell).whiteSpace).toBe("nowrap"); + expect(noteCell.scrollWidth).toBeGreaterThan(noteCell.clientWidth); + + const expandButton = page.getByRole("button", { name: "Expand table cells" }); + await expect.element(expandButton).not.toHaveAttribute("title"); + await expandButton.hover(); + await vi.waitFor(() => { + const tooltip = document.querySelector('[data-slot="tooltip-popup"]'); + expect(tooltip?.textContent).toContain("Expand table cells"); + }); + await expandButton.click(); + expect(container?.getAttribute("data-expanded")).toBe("true"); + expect(getComputedStyle(noteCell).whiteSpace).not.toBe("nowrap"); + + await page.getByRole("button", { name: "Collapse table cells" }).click(); + expect(container?.getAttribute("data-expanded")).toBe("false"); + + const copyButton = page.getByRole("button", { name: "Copy table" }); + await expect.element(copyButton).not.toHaveAttribute("title"); + await copyButton.hover(); + await vi.waitFor(() => { + const tooltip = document.querySelector('[data-slot="tooltip-popup"]'); + expect(tooltip?.textContent).toContain("Copy table"); + }); + expect(document.querySelector(".chat-markdown [title]")).toBeNull(); + } finally { + await screen.unmount(); + } + }); + + it("retains column widths when cells expand", async () => { + const source = [ + "| ID | Owner | Status | Priority | Region | Summary | Long Description | Metrics | Payload | Notes |", + "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |", + '| 1001 | Ada Lovelace | Active | High | us-west-2 | Payment workflow migration | This cell has enough text to wrap across several lines when expanded without shrinking its column. | Requests: 128,440; Error rate: 0.04%; P95: 212ms | `{ "feature": "billing", "version": 3 }` | Needs post-release monitoring for 24 hours. |', + ].join("\n"); + const screen = await render(); + + try { + const viewport = document.querySelector( + '.chat-markdown-table-container [data-slot="scroll-area-viewport"]', + )!; + const table = viewport.querySelector("table")!; + const collapsedWidths = [...table.querySelectorAll("thead th")].map( + (cell) => cell.getBoundingClientRect().width, + ); + expect(viewport.scrollWidth).toBeGreaterThan(viewport.clientWidth); + + await page.getByRole("button", { name: "Expand table cells" }).click(); + + const expandedWidths = [...table.querySelectorAll("thead th")].map( + (cell) => cell.getBoundingClientRect().width, + ); + expect(expandedWidths).toHaveLength(collapsedWidths.length); + expandedWidths.forEach((width, index) => { + expect(width).toBeGreaterThanOrEqual(collapsedWidths[index]! - 1); + }); + expect(viewport.scrollWidth).toBeGreaterThan(viewport.clientWidth); + } finally { + await screen.unmount(); + } + }); + + it("exports tables as markdown and csv", async () => { + const source = [ + "| Name | Count |", + "| --- | ---: |", + '| widget, "deluxe" | 2 |', + "| plain | 1 |", + ].join("\n"); + const screen = await render(); + + try { + const table = document.querySelector(".chat-markdown table")!; + expect(serializeTableElementToMarkdown(table)).toBe( + ["| Name | Count |", "| --- | ---: |", '| widget, "deluxe" | 2 |', "| plain | 1 |"].join( + "\n", + ), + ); + expect(serializeTableElementToCsv(table)).toBe( + ["Name,Count", '"widget, ""deluxe""",2', "plain,1"].join("\n"), + ); + } finally { + await screen.unmount(); + } + }); + }); + + describe("copying rendered markdown", () => { + function copySelectedMarkdown(): { text: string; html: string } { + const root = document.querySelector(".chat-markdown"); + if (!root) throw new Error("chat-markdown root not rendered"); + const selection = window.getSelection(); + if (!selection) throw new Error("selection unavailable"); + selection.removeAllRanges(); + const range = document.createRange(); + range.selectNodeContents(root); + selection.addRange(range); + + const clipboardData = new DataTransfer(); + root.dispatchEvent( + new ClipboardEvent("copy", { clipboardData, bubbles: true, cancelable: true }), + ); + selection.removeAllRanges(); + return { + text: clipboardData.getData("text/plain"), + html: clipboardData.getData("text/html"), + }; + } + + it("round-trips links, emphasis, and inline code", async () => { + const screen = await render( + , + ); + + try { + const { text, html } = copySelectedMarkdown(); + expect(text).toBe( + "Check out [Anthropic](https://anthropic.com), **bold**, *italic*, and `code`.", + ); + expect(html).toContain('href="https://anthropic.com"'); + } finally { + await screen.unmount(); + } + }); + + it("round-trips block structure: headings, lists, quotes, and fences", async () => { + const source = [ + "## Heading", + "", + "- first", + "- second", + " - nested", + "", + "1. one", + "2. two", + "", + "- [x] done", + "- [ ] todo", + "", + "> quoted", + "", + "```ts", + "const x = 1;", + "", + "const y = 2;", + "```", + ].join("\n"); + const screen = await render(); + + try { + const { text } = copySelectedMarkdown(); + expect(text).toBe(source); + } finally { + await screen.unmount(); + } + }); + + it("round-trips tables with alignment", async () => { + const source = ["| Name | Count |", "| --- | ---: |", "| a | 1 |", "| b | 2 |"].join("\n"); + const screen = await render(); + + try { + const { text } = copySelectedMarkdown(); + expect(text).toBe(source); + } finally { + await screen.unmount(); + } + }); + + it("round-trips details rendered through the collapsible", async () => { + const source = [ + "
", + "Expandable details section", + "", + "This content includes **formatted text**.", + "
", + ].join("\n"); + const screen = await render(); + + try { + const { text } = copySelectedMarkdown(); + expect(text).toBe(source); + } finally { + await screen.unmount(); + } + }); + + it("excludes the code block header chrome from copied markdown", async () => { + const source = ["```ts", "const x = 1;", "```"].join("\n"); + const screen = await render(); + + try { + const { text } = copySelectedMarkdown(); + expect(text).toBe(source); + } finally { + await screen.unmount(); + } + }); + + it("copies file links as markdown and skips UI affordances", async () => { + const filePath = "/Users/yashsingh/p/t3code/src/utils/permissions/PermissionRule.ts"; + const screen = await render( + , + ); + + try { + const { text, html } = copySelectedMarkdown(); + expect(text).toBe( + `See [PermissionRule.ts](/Users/yashsingh/p/t3code/src/utils/permissions/PermissionRule.ts) for details.`, + ); + expect(html).toContain("PermissionRule.ts"); + expect(html).not.toContain(" { + const source = + "Use $agent-browser with [package.json](path/to/package.json) before continuing."; + const screen = await render( + , + ); + + try { + const root = document.querySelector(".chat-markdown")!; + const selection = window.getSelection()!; + selection.removeAllRanges(); + const range = document.createRange(); + range.selectNodeContents(root); + selection.addRange(range); + expect(selection.toString()).toContain("Agent Browser"); + expect(selection.toString()).toContain("package.json"); + selection.removeAllRanges(); + + const { text, html } = copySelectedMarkdown(); + expect(text).toBe(source); + expect(html).toContain("Agent Browser"); + expect(html).toContain("package.json"); + expect(html).not.toContain(">; + className?: string; + /** Treat single newlines as hard breaks — chat-style user input. */ + lineBreaks?: boolean; } const EMPTY_MARKDOWN_SKILLS: ReadonlyArray> = []; @@ -74,6 +104,18 @@ const highlightedCodeCache = new LRUCache( MAX_HIGHLIGHT_CACHE_MEMORY_BYTES, ); const highlighterPromiseCache = new Map>(); +const CHAT_MARKDOWN_SANITIZE_SCHEMA = { + ...defaultSchema, + attributes: { + ...defaultSchema.attributes, + "*": (defaultSchema.attributes?.["*"] ?? []).filter((attribute) => attribute !== "title"), + code: [...(defaultSchema.attributes?.code ?? []), "dataCodeMeta"], + }, + protocols: { + ...defaultSchema.protocols, + href: [...(defaultSchema.protocols?.href ?? []), "file"], + }, +} satisfies Parameters[0]; function extractFenceLanguage(className: string | undefined): string { const match = className?.match(CODE_FENCE_LANGUAGE_REGEX); @@ -82,6 +124,64 @@ function extractFenceLanguage(className: string | undefined): string { return raw === "gitignore" ? "ini" : raw; } +const FENCE_TITLE_ATTR_REGEX = /(?:^|\s)(?:title|file(?:name)?)=(?:"([^"]+)"|'([^']+)'|(\S+))/i; +const FENCE_FILENAME_TOKEN_REGEX = /^[\w@][\w@./-]*\.[A-Za-z0-9]+$/; + +/** Pulls a filename out of fence meta: ```ts title="x.ts" / ```ts src/main.ts */ +function extractFenceTitle(meta: string | undefined): string | null { + if (!meta) return null; + const attrMatch = FENCE_TITLE_ATTR_REGEX.exec(meta); + const attrTitle = attrMatch?.[1] ?? attrMatch?.[2] ?? attrMatch?.[3]; + if (attrTitle) return attrTitle; + return meta.split(/\s+/).find((candidate) => FENCE_FILENAME_TOKEN_REGEX.test(candidate)) ?? null; +} + +function extractPreCodeMeta(node: unknown): string | undefined { + const children = ( + node as + | { + children?: Array<{ + type?: string; + tagName?: string; + data?: { meta?: unknown }; + properties?: { dataCodeMeta?: unknown }; + }>; + } + | undefined + )?.children; + const codeNode = children?.find((child) => child?.type === "element" && child.tagName === "code"); + const meta = codeNode?.properties?.dataCodeMeta ?? codeNode?.data?.meta; + return typeof meta === "string" && meta.trim().length > 0 ? meta.trim() : undefined; +} + +type MarkdownAstNode = { + type?: string; + meta?: unknown; + data?: { + hProperties?: Record; + }; + children?: MarkdownAstNode[]; +}; + +function remarkPreserveCodeMeta() { + return (tree: MarkdownAstNode) => { + const visit = (node: MarkdownAstNode) => { + if (node.type === "code" && typeof node.meta === "string" && node.meta.trim().length > 0) { + node.data = { + ...node.data, + hProperties: { + ...node.data?.hProperties, + dataCodeMeta: node.meta.trim(), + }, + }; + } + node.children?.forEach(visit); + }; + + visit(tree); + }; +} + function nodeToPlainText(node: ReactNode): string { if (typeof node === "string" || typeof node === "number") { return String(node); @@ -146,9 +246,254 @@ function getHighlighterPromise(language: string): Promise { return promise; } -function MarkdownCodeBlock({ code, children }: { code: string; children: ReactNode }) { +function MarkdownTable({ children, ...props }: React.ComponentProps<"table">) { + const containerRef = useRef(null); + const tableRef = useRef(null); + const [expanded, setExpanded] = useState(false); const [copied, setCopied] = useState(false); const copiedTimerRef = useRef | null>(null); + const expandLabel = expanded ? "Collapse table cells" : "Expand table cells"; + const copyLabel = copied ? "Copied" : "Copy table"; + + function toggleExpanded() { + const table = tableRef.current; + if (!table) return; + + if (!expanded) { + const rows = [...table.rows]; + const columnWidths = rows.reduce((widths, row) => { + [...row.cells].forEach((cell, columnIndex) => { + widths[columnIndex] = Math.max( + widths[columnIndex] ?? 0, + cell.getBoundingClientRect().width, + ); + }); + return widths; + }, []); + + [...(table.tHead?.rows[0]?.cells ?? [])].forEach((cell, columnIndex) => { + cell.style.minWidth = `${columnWidths[columnIndex] ?? cell.getBoundingClientRect().width}px`; + }); + } + + setExpanded((value) => !value); + } + + const handleCopy = useCallback((format: "markdown" | "csv") => { + const table = containerRef.current?.querySelector("table"); + if (!table || typeof navigator === "undefined" || navigator.clipboard == null) { + return; + } + const text = + format === "markdown" + ? serializeTableElementToMarkdown(table) + : serializeTableElementToCsv(table); + void navigator.clipboard + .writeText(text) + .then(() => { + if (copiedTimerRef.current != null) { + clearTimeout(copiedTimerRef.current); + } + setCopied(true); + copiedTimerRef.current = setTimeout(() => { + setCopied(false); + copiedTimerRef.current = null; + }, 1200); + }) + .catch(() => undefined); + }, []); + + useEffect( + () => () => { + if (copiedTimerRef.current != null) { + clearTimeout(copiedTimerRef.current); + copiedTimerRef.current = null; + } + }, + [], + ); + + return ( +
+ + + {children} +
+
+
+ + + } + > + {expanded ? : } + + {expandLabel} + + + + + } + /> + } + > + {copied ? : } + + {copyLabel} + + + handleCopy("markdown")}>Copy as Markdown + handleCopy("csv")}>Copy as CSV + + +
+
+ ); +} + +function MarkdownDetails({ + children, + open = false, +}: Pick, "children" | "open">) { + const [isOpen, setIsOpen] = useState(open); + const childNodes = Children.toArray(children); + const summaryIndex = childNodes.findIndex( + (child) => isValidElement(child) && child.type === "summary", + ); + const summaryNode = summaryIndex >= 0 ? childNodes[summaryIndex] : null; + const summary = + isValidElement<{ children?: ReactNode }>(summaryNode) && summaryNode.props.children + ? summaryNode.props.children + : "Details"; + const content = childNodes.filter((_, index) => index !== summaryIndex); + + return ( + + + + {summary} + + +
+ {content} +
+
+
+ ); +} + +/** + * Filename titles render icon + text; language-only titles render just the + * icon (redundant next to its own name) and fall back to the language text + * when no specific icon exists or it fails to load. + */ +function MarkdownCodeBlockTitleContent({ + fenceTitle, + language, + theme, +}: { + fenceTitle: string | null; + language: string; + theme: "light" | "dark"; +}) { + const [failedIconUrl, setFailedIconUrl] = useState(null); + + if (fenceTitle) { + return ( + <> + + {fenceTitle} + + ); + } + + const fileName = syntheticFileNameForLanguageId(language); + const iconUrl = hasSpecificVscodeIconForFileName(fileName, theme) + ? getVscodeIconUrlForEntry(fileName, "file", theme) + : null; + if (!iconUrl || failedIconUrl === iconUrl) { + return {language}; + } + return ( + + + } + > + setFailedIconUrl(iconUrl)} + /> + + {language} + + ); +} + +function MarkdownCodeBlock({ + code, + language, + fenceTitle, + theme, + children, +}: { + code: string; + language: string; + fenceTitle: string | null; + theme: "light" | "dark"; + children: ReactNode; +}) { + const [copied, setCopied] = useState(false); + const [wrapped, setWrapped] = useState(false); + const copiedTimerRef = useRef | null>(null); + const wrapLabel = wrapped ? "Disable line wrap" : "Wrap lines"; + const copyLabel = copied ? "Copied" : "Copy code"; const handleCopy = useCallback(() => { if (typeof navigator === "undefined" || navigator.clipboard == null) { return; @@ -179,16 +524,57 @@ function MarkdownCodeBlock({ code, children }: { code: string; children: ReactNo ); return ( -
- +
+
+ + + + + + setWrapped((value) => !value)} + aria-label={wrapLabel} + /> + } + > + + + {wrapLabel} + + + + } + > + {copied ? : } + + {copyLabel} + + +
{children}
); @@ -280,17 +666,15 @@ interface MarkdownFileLinkProps { href: string; targetPath: string; displayPath: string; - filePath: string; label: string; + copyMarkdown: string; theme: "light" | "dark"; className?: string | undefined; } const MARKDOWN_LINK_HREF_PATTERN = /\[[^\]]*]\(([^)\s]+)(?:\s+["'][^"']*["'])?\)/g; const MARKDOWN_FILE_LINK_CLASS_NAME = - "chat-markdown-file-link relative top-[2px] max-w-full no-underline"; -const MARKDOWN_FILE_LINK_ICON_CLASS_NAME = "chat-markdown-file-link-icon size-3.5 shrink-0"; -const MARKDOWN_FILE_LINK_LABEL_CLASS_NAME = "chat-markdown-file-link-label truncate"; + "chat-markdown-file-link cursor-pointer transition-colors hover:bg-accent/70"; function pathParentSegments(path: string): string[] { const normalized = path.replaceAll("\\", "/"); @@ -367,12 +751,196 @@ function normalizeMarkdownLinkHrefKey(href: string): string { return rewriteMarkdownFileUriHref(normalizedHref) ?? normalizedHref; } +const MARKDOWN_LINK_FAVICON_CLASS_NAME = "block size-full shrink-0 select-none"; + +/** Hosts whose favicon request already failed this session — skip straight to the globe. */ +const failedFaviconHosts = new Set(); + +function resolveExternalLinkHost(href: string | undefined): string | null { + if (!href) return null; + try { + const url = new URL(href); + if (url.protocol !== "http:" && url.protocol !== "https:") return null; + return url.hostname || null; + } catch { + return null; + } +} + +const MarkdownLinkFavicon = memo(function MarkdownLinkFavicon({ host }: { host: string }) { + const [failedHost, setFailedHost] = useState(null); + return ( + + {failedHost === host || failedFaviconHosts.has(host) ? ( + + ) : ( + { + failedFaviconHosts.add(host); + setFailedHost(host); + }} + /> + )} + + ); +}); + +function leadingExternalLinkTextLength(text: string): number { + const protocol = /^(?:https?:\/\/)/i.exec(text)?.[0]; + if (protocol) return protocol.length; + return Math.min(text.length, 1); +} + +function breakableExternalLinkText(text: string): ReactNode[] { + return Array.from(text, (character, index) => ( + + {character} + + + )); +} + +function plainHastText(node: unknown): string | null { + if (!node || typeof node !== "object" || !("children" in node) || !Array.isArray(node.children)) { + return null; + } + const parts = node.children.map((child) => { + if ( + child && + typeof child === "object" && + "type" in child && + child.type === "text" && + "value" in child && + typeof child.value === "string" + ) { + return child.value; + } + return null; + }); + return parts.every((part) => part !== null) ? parts.join("") : null; +} + +const SANITIZED_FRAGMENT_PREFIX = "user-content-"; + +function decodeMarkdownFragmentId(href: string): string { + const encodedId = href.slice(1); + try { + return decodeURIComponent(encodedId); + } catch { + return encodedId; + } +} + +function normalizeSanitizedFragmentId(id: string): string { + let normalizedId = id; + while (normalizedId.startsWith(SANITIZED_FRAGMENT_PREFIX)) { + normalizedId = normalizedId.slice(SANITIZED_FRAGMENT_PREFIX.length); + } + return normalizedId; +} + +function findMarkdownFragmentTarget(anchor: HTMLAnchorElement, href: string): HTMLElement | null { + const decodedId = decodeMarkdownFragmentId(href); + const normalizedId = normalizeSanitizedFragmentId(decodedId); + const matchesFragment = (element: HTMLElement) => + element.id === decodedId || normalizeSanitizedFragmentId(element.id) === normalizedId; + const markdownRoot = anchor.closest(".chat-markdown"); + if (markdownRoot) { + const localTargets = Array.from(markdownRoot.querySelectorAll("[id]")); + const localTarget = localTargets.find(matchesFragment); + if (localTarget) return localTarget; + } + + return ( + document.getElementById(decodedId) ?? + Array.from(document.querySelectorAll("[id]")).find(matchesFragment) ?? + null + ); +} + +function handleMarkdownFragmentClick(event: ReactMouseEvent, href: string) { + if ( + event.defaultPrevented || + event.button !== 0 || + event.metaKey || + event.ctrlKey || + event.shiftKey || + event.altKey + ) { + return; + } + + const target = findMarkdownFragmentTarget(event.currentTarget, href); + if (!target) return; + + event.preventDefault(); + const nextUrl = new URL(window.location.href); + nextUrl.hash = href.slice(1); + window.history.pushState(window.history.state, "", nextUrl); + target.scrollIntoView({ block: "nearest" }); +} + +function MarkdownExternalLinkContent({ + host, + plainText, + children, +}: { + host: string; + plainText: string | null; + children: ReactNode; +}) { + if (plainText) { + const leadingLength = leadingExternalLinkTextLength(plainText); + return ( + <> + + + {plainText.slice(0, leadingLength)} + + {breakableExternalLinkText(plainText.slice(leadingLength))} + + ); + } + + const childNodes = Children.toArray(children); + const firstChild = childNodes[0]; + + if (typeof firstChild === "string" && firstChild.length > 0) { + const leadingLength = leadingExternalLinkTextLength(firstChild); + return ( + <> + + + {firstChild.slice(0, leadingLength)} + + {breakableExternalLinkText(firstChild.slice(leadingLength))} + {childNodes.slice(1)} + + ); + } + + return ( + <> + + + {firstChild} + + {childNodes.slice(1)} + + ); +} + const MarkdownFileLink = memo(function MarkdownFileLink({ href, targetPath, displayPath, - filePath, label, + copyMarkdown, theme, className, }: MarkdownFileLinkProps) { @@ -467,7 +1035,8 @@ const MarkdownFileLink = memo(function MarkdownFileLink({ render={ { event.preventDefault(); event.stopPropagation(); @@ -475,13 +1044,7 @@ const MarkdownFileLink = memo(function MarkdownFileLink({ }} onContextMenu={handleContextMenu} > - - {label} + } /> @@ -505,8 +1068,8 @@ function areMarkdownFileLinkPropsEqual( previous.href === next.href && previous.targetPath === next.targetPath && previous.displayPath === next.displayPath && - previous.filePath === next.filePath && previous.label === next.label && + previous.copyMarkdown === next.copyMarkdown && previous.theme === next.theme && previous.className === next.className ); @@ -517,6 +1080,8 @@ function ChatMarkdown({ cwd, isStreaming = false, skills = EMPTY_MARKDOWN_SKILLS, + className, + lineBreaks = false, }: ChatMarkdownProps) { const { resolvedTheme } = useTheme(); const diffThemeName = resolveDiffThemeName(resolvedTheme); @@ -542,6 +1107,17 @@ function ChatMarkdown({ const markdownUrlTransform = useCallback((href: string) => { return rewriteMarkdownFileUriHref(href) ?? defaultUrlTransform(href); }, []); + // Re-emit highlighted content as markdown so copying out of the rendered + // view keeps links, emphasis, lists, and code fences intact. + const handleCopy = useCallback((event: ReactClipboardEvent) => { + const selection = window.getSelection(); + if (!selection || selection.isCollapsed || !event.clipboardData) return; + const payload = chatMarkdownClipboardPayload(selection); + if (!payload) return; + event.preventDefault(); + event.clipboardData.setData("text/plain", payload.text); + event.clipboardData.setData("text/html", payload.html); + }, []); const markdownComponents = useMemo( () => ({ p({ node: _node, children, ...props }) { @@ -550,11 +1126,49 @@ function ChatMarkdown({ li({ node: _node, children, ...props }) { return
  • {renderSkillInlineMarkdownChildren(children, skills)}
  • ; }, - a({ node: _node, href, ...props }) { + a({ node, href, children, ...props }) { const normalizedHref = href ? normalizeMarkdownLinkHrefKey(href) : ""; const fileLinkMeta = normalizedHref ? markdownFileLinkMetaByHref.get(normalizedHref) : null; if (!fileLinkMeta) { - return ; + const faviconHost = resolveExternalLinkHost(href); + const isSameDocumentLink = href?.startsWith("#") ?? false; + const onClick = props.onClick; + const link = ( + { + onClick?.(event); + if (isSameDocumentLink && href) { + handleMarkdownFragmentClick(event, href); + } + }} + > + {faviconHost ? ( + + {children} + + ) : ( + children + )} + + ); + if (!faviconHost || !href) { + return link; + } + return ( + + + + {href} + + + ); } const parentSuffix = fileLinkParentSuffixByPath.get(fileLinkMeta.filePath); @@ -573,21 +1187,34 @@ function ChatMarkdown({ href={fileLinkMeta.targetPath} targetPath={fileLinkMeta.targetPath} displayPath={fileLinkMeta.displayPath} - filePath={fileLinkMeta.filePath} label={labelParts.join(" · ")} + copyMarkdown={`[${fileLinkMeta.basename}](${normalizedHref})`} theme={resolvedTheme} className={props.className} /> ); }, - pre({ node: _node, children, ...props }) { + table({ node: _node, ...props }) { + return ; + }, + details({ node: _node, children, open: detailsOpen }) { + return {children}; + }, + pre({ node, children, ...props }) { const codeBlock = extractCodeBlock(children); if (!codeBlock) { return
    {children}
    ; } + const language = extractFenceLanguage(codeBlock.className); + const fenceTitle = extractFenceTitle(extractPreCodeMeta(node)); return ( - + {children}}> {children}}> +
    diff --git a/apps/web/src/components/ChatView.browser.tsx b/apps/web/src/components/ChatView.browser.tsx index 69e0e51406..2cf91a92f2 100644 --- a/apps/web/src/components/ChatView.browser.tsx +++ b/apps/web/src/components/ChatView.browser.tsx @@ -2341,7 +2341,7 @@ describe("ChatView timeline estimator parity (full app)", () => { const runButton = await waitForElement( () => Array.from(document.querySelectorAll("button")).find( - (button) => button.title === "Run Lint", + (button) => button.getAttribute("aria-label") === "Run Lint", ) as HTMLButtonElement | null, "Unable to find Run Lint button.", ); @@ -2420,7 +2420,7 @@ describe("ChatView timeline estimator parity (full app)", () => { const runButton = await waitForElement( () => Array.from(document.querySelectorAll("button")).find( - (button) => button.title === "Run Test", + (button) => button.getAttribute("aria-label") === "Run Test", ) as HTMLButtonElement | null, "Unable to find Run Test button.", ); @@ -3160,7 +3160,8 @@ describe("ChatView timeline estimator parity (full app)", () => { try { const initialModeButton = await waitForInteractionModeButton("Build"); - expect(initialModeButton.title).toContain("enter plan mode"); + expect(initialModeButton.getAttribute("aria-label")).toContain("enter plan mode"); + expect(initialModeButton.hasAttribute("title")).toBe(false); window.dispatchEvent( new KeyboardEvent("keydown", { @@ -3172,7 +3173,9 @@ describe("ChatView timeline estimator parity (full app)", () => { ); await waitForLayout(); - expect((await waitForInteractionModeButton("Build")).title).toContain("enter plan mode"); + expect((await waitForInteractionModeButton("Build")).getAttribute("aria-label")).toContain( + "enter plan mode", + ); const composerEditor = await waitForComposerEditor(); composerEditor.focus(); @@ -3187,7 +3190,7 @@ describe("ChatView timeline estimator parity (full app)", () => { await vi.waitFor( async () => { - expect((await waitForInteractionModeButton("Plan")).title).toContain( + expect((await waitForInteractionModeButton("Plan")).getAttribute("aria-label")).toContain( "return to normal build mode", ); }, @@ -3205,7 +3208,9 @@ describe("ChatView timeline estimator parity (full app)", () => { await vi.waitFor( async () => { - expect((await waitForInteractionModeButton("Build")).title).toContain("enter plan mode"); + expect( + (await waitForInteractionModeButton("Build")).getAttribute("aria-label"), + ).toContain("enter plan mode"); }, { timeout: 8_000, interval: 16 }, ); @@ -3587,13 +3592,13 @@ describe("ChatView timeline estimator parity (full app)", () => { }, { timeout: 8_000, interval: 16 }, ); - await waitForComposerText("hi @package.json there"); + await waitForComposerText("hi [package.json](package.json) there"); await setComposerSelectionByTextOffsets({ start: "hi package.json ".length, end: "hi package.json there".length, }); await pressComposerKey("("); - await waitForComposerText("hi @package.json (there)"); + await waitForComposerText("hi [package.json](package.json) (there)"); } finally { await mounted.cleanup(); } @@ -3625,6 +3630,47 @@ describe("ChatView timeline estimator parity (full app)", () => { } }); + it("stores selected file tags as markdown links while keeping the composer chip", async () => { + useComposerDraftStore.getState().setPrompt(THREAD_REF, "@pack"); + + const mounted = await mountChatView({ + viewport: DEFAULT_VIEWPORT, + snapshot: createSnapshotForTargetUser({ + targetMessageId: "msg-user-file-tag-encoding" as MessageId, + targetText: "file tag encoding", + }), + resolveRpc: (body) => { + if (body._tag !== WS_METHODS.projectsSearchEntries) { + return undefined; + } + return { + entries: [ + { + path: "path/to/package.json", + kind: "file", + parentPath: "path/to", + }, + ], + truncated: false, + }; + }, + }); + + try { + const item = await waitForComposerMenuItem("path:file:path/to/package.json"); + item.click(); + + await waitForComposerText("[package.json](path/to/package.json) "); + const chip = await waitForElement( + () => document.querySelector('[data-composer-mention-chip="true"]'), + "Unable to find rendered composer file chip.", + ); + expect(chip.textContent).toContain("package.json"); + } finally { + await mounted.cleanup(); + } + }); + it("shows runtime mode descriptions in the desktop composer access select", async () => { setDraftThreadWithoutWorktree(); diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index 3dc5a3acb7..0cb889ff1c 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -1570,61 +1570,78 @@ function OpenCommandPaletteDialog() { onKeyDown={handleKeyDown} /> {addProjectCloneFlow?.step === "repository" ? ( - + + { + event.preventDefault(); + }} + onClick={() => { + void submitAddProjectCloneFlow(); + }} + /> + } + > + {isRemoteProjectPending ? "Working" : remoteProjectButtonLabel} + + Enter + + + + {remoteProjectButtonLabel ?? "Continue"} (Enter) + + ) : isBrowsing ? ( - + > + + {isCloneDestinationStep && isRemoteProjectPending ? "Cloning" : submitActionLabel} + + + {hasHighlightedBrowseItem ? `${submitModifierLabel} Enter` : "Enter"} + + + + {submitActionLabel} ({addShortcutLabel}) + + ) : null}
    diff --git a/apps/web/src/components/ComposerPromptEditor.tsx b/apps/web/src/components/ComposerPromptEditor.tsx index ab8e597ea6..4df5502394 100644 --- a/apps/web/src/components/ComposerPromptEditor.tsx +++ b/apps/web/src/components/ComposerPromptEditor.tsx @@ -6,7 +6,7 @@ import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin"; import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin"; import { PlainTextPlugin } from "@lexical/react/LexicalPlainTextPlugin"; import { type ServerProviderSkill } from "@t3tools/contracts"; -import { serializeComposerMentionPath } from "@t3tools/shared/composerTrigger"; +import { serializeComposerFileLink } from "@t3tools/shared/composerTrigger"; import { $applyNodeReplacement, $createRangeSelection, @@ -64,14 +64,14 @@ import { type TerminalContextDraft, } from "~/lib/terminalContext"; import { cn } from "~/lib/utils"; -import { basenameOfPath, getVscodeIconUrlForEntry, inferEntryKindFromPath } from "~/vscode-icons"; +import { basenameOfPath } from "~/vscode-icons"; import { - COMPOSER_INLINE_CHIP_CLASS_NAME, COMPOSER_INLINE_CHIP_ICON_CLASS_NAME, COMPOSER_INLINE_CHIP_LABEL_CLASS_NAME, COMPOSER_INLINE_SKILL_CHIP_CLASS_NAME, SKILL_CHIP_ICON_SVG, } from "./composerInlineChip"; +import { FILE_TAG_CHIP_CLASS_NAME, FileTagChipContent } from "./chat/FileTagChip"; import { ComposerPendingTerminalContextChip } from "./chat/ComposerPendingTerminalContexts"; import { formatProviderSkillDisplayName } from "~/providerSkillPresentation"; import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip"; @@ -132,19 +132,12 @@ function ComposerMentionDecorator(props: { path: string }) { const theme = resolvedThemeFromDocument(); const chip = ( - - {basenameOfPath(props.path)} + ); @@ -175,8 +168,7 @@ class ComposerMentionNode extends DecoratorNode { constructor(path: string, key?: NodeKey) { super(key); - const normalizedPath = path.startsWith("@") ? path.slice(1) : path; - this.__path = normalizedPath; + this.__path = path; } override exportJSON(): SerializedComposerMentionNode { @@ -199,7 +191,7 @@ class ComposerMentionNode extends DecoratorNode { } override getTextContent(): string { - return `@${serializeComposerMentionPath(this.__path)}`; + return serializeComposerFileLink(this.__path); } override isInline(): true { diff --git a/apps/web/src/components/DiffPanel.tsx b/apps/web/src/components/DiffPanel.tsx index dfc25cad9c..287f739c14 100644 --- a/apps/web/src/components/DiffPanel.tsx +++ b/apps/web/src/components/DiffPanel.tsx @@ -42,6 +42,7 @@ import { useSettings } from "../hooks/useSettings"; import { formatShortTimestamp } from "../timestampFormat"; import { DiffPanelLoadingState, DiffPanelShell, type DiffPanelMode } from "./DiffPanelShell"; import { ToggleGroup, Toggle } from "./ui/toggle-group"; +import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip"; type DiffRenderMode = "stacked" | "split"; type DiffThemeType = "light" | "dark"; @@ -460,35 +461,41 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
    {orderedTurnDiffSummaries.map((summary) => ( - + + {summary.turnId} + ))}
    @@ -512,30 +519,50 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) { - { - setDiffWordWrap(Boolean(pressed)); - }} - > - - - { - setDiffIgnoreWhitespace(Boolean(pressed)); - }} - > - - + + { + setDiffWordWrap(Boolean(pressed)); + }} + /> + } + > + + + + {diffWordWrap ? "Disable line wrapping" : "Enable line wrapping"} + + + + { + setDiffIgnoreWhitespace(Boolean(pressed)); + }} + /> + } + > + + + + {diffIgnoreWhitespace ? "Show whitespace changes" : "Hide whitespace changes"} + +
    ); @@ -609,26 +636,36 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) { ( - + + { + event.stopPropagation(); + toggleDiffFileCollapsed(fileKey); + }} + /> + } + > + {collapsed ? ( + + ) : ( + + )} + + + {collapsed ? "Expand diff" : "Collapse diff"} + + )} options={{ collapsed, diff --git a/apps/web/src/components/ProjectScriptsControl.tsx b/apps/web/src/components/ProjectScriptsControl.tsx index 4a9cda19d6..4588ac51bd 100644 --- a/apps/web/src/components/ProjectScriptsControl.tsx +++ b/apps/web/src/components/ProjectScriptsControl.tsx @@ -53,6 +53,7 @@ import { Menu, MenuItem, MenuPopup, MenuShortcut, MenuTrigger } from "./ui/menu" import { Popover, PopoverPopup, PopoverTrigger } from "./ui/popover"; import { Switch } from "./ui/switch"; import { Textarea } from "./ui/textarea"; +import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip"; const SCRIPT_ICONS: Array<{ id: ProjectScriptIcon; label: string }> = [ { id: "play", label: "Play" }, @@ -219,17 +220,24 @@ export default function ProjectScriptsControl({ <> {primaryScript ? ( - + + onRunScript(primaryScript)} + /> + } + > + + + {primaryScript.name} + + + Run {primaryScript.name} + ) : ( - + + + } + > + + + Add action + + + Add action + )}
    {terminalStatus && ( - - - + + + } + > + + + {terminalStatus.label} + )}
    )} {jumpLabel ? ( - - {jumpLabel} - + + + } + > + {jumpLabel} + + {jumpLabel} + ) : ( {!projectExpanded && projectStatus ? ( -