From 68aa7347265f96e83caeb994492786f180b843e8 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 16 Nov 2026 16:03:08 -0800 Subject: [PATCH 01/14] fix(connect): restrict relay configuration and token destinations --- .../SettingsNotificationsRouteScreen.tsx | 4 +-- .../src/cloud/CloudLink.lifecycle.test.ts | 22 ++++++++++++-- apps/server/src/cloud/CloudLink.ts | 20 ++++++++----- apps/server/src/cloud/http.test.ts | 20 +++++++++++++ apps/server/src/cloud/http.ts | 15 +++++++--- .../useCloudLinkController.browser.test.tsx | 5 +++- apps/web/src/cloud/useCloudLinkController.ts | 8 ++++- apps/web/src/cloud/useT3ConnectTurnOn.ts | 7 ++--- .../cloud/ConnectOnboardingDialog.tsx | 29 ++++++++----------- apps/web/src/state/session.ts | 15 ++++++++++ docs/user/remote-access.md | 5 ++-- 11 files changed, 110 insertions(+), 40 deletions(-) diff --git a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx index f5c25bf36b335..21243facc2156 100644 --- a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx @@ -2,7 +2,7 @@ import { errorDisplayMessage } from "@t3tools/client-runtime/errors"; import { useGT, useMessages } from "gt-react-native"; import * as Dialog from "../../components/ui/Dialog"; import { managedCapabilityDenial } from "@t3tools/client-runtime/contract-labels"; -import { AuthRelayWriteScope, type EnvironmentId } from "@t3tools/contracts"; +import { AuthStandardClientScopes, type EnvironmentId } from "@t3tools/contracts"; import { readEnvironmentScope } from "../../state/session"; import { appAtomRegistry } from "../../state/atom-registry"; import { serverEnvironment } from "../../state/server"; @@ -60,7 +60,7 @@ function canLinkEnvironmentToConnect(environmentId: EnvironmentId) { serverEnvironment.configValueAtom(environmentId), )?.managedPolicy; return ( - readEnvironmentScope(environmentId, AuthRelayWriteScope) && + AuthStandardClientScopes.every((scope) => readEnvironmentScope(environmentId, scope)) && managedCapabilityDenial(policy, "connect") === undefined ); } diff --git a/apps/server/src/cloud/CloudLink.lifecycle.test.ts b/apps/server/src/cloud/CloudLink.lifecycle.test.ts index cbbf4670d6f67..cf02ae72cdee0 100644 --- a/apps/server/src/cloud/CloudLink.lifecycle.test.ts +++ b/apps/server/src/cloud/CloudLink.lifecycle.test.ts @@ -1,6 +1,7 @@ import * as NodeCrypto from "@effect/platform-node/NodeCrypto"; import * as NodeServices from "@effect/platform-node/NodeServices"; import { describe, expect, it } from "@effect/vitest"; +import * as ConfigProvider from "effect/ConfigProvider"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Layer from "effect/Layer"; @@ -268,11 +269,14 @@ describe("releaseManagedTunnelOnShutdown", () => { ), ), - Effect.provide( + Effect.provide([ ServerConfigModule.layerTest("/", { prefix: "t3-http-release-test-" }).pipe( Layer.provideMerge(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)), ), - ), + ConfigProvider.layer( + ConfigProvider.fromEnv({ env: { T3CODE_RELAY_URL: "https://relay.example.test" } }), + ), + ]), Effect.scoped, ); @@ -400,6 +404,20 @@ describe("releaseManagedTunnelOnShutdown", () => { }).pipe(provideReleaseHarness({ store, applyConfigCalls, requests })); }); + it.effect("releases a tunnel only through the configured relay", () => { + const { store, values } = makeMemorySecretStore(managedLinkSecrets); + values.set(RELAY_URL_SECRET, new TextEncoder().encode("https://old-relay.example.test")); + const applyConfigCalls: Array = []; + const requests: Array = []; + + return Effect.gen(function* () { + const link = yield* CloudLink.CloudLink; + expect(yield* link.releaseManagedTunnelOnShutdown()).toBe(false); + expect(applyConfigCalls).toEqual([]); + expect(requests).toEqual([]); + }).pipe(provideReleaseHarness({ store, applyConfigCalls, requests })); + }); + it.effect("leaves the tunnel of a web/mobile-installed link untouched", () => { const { store, values } = makeMemorySecretStore([ [CLOUD_ENDPOINT_RUNTIME_CONFIG, "runtime-config"], diff --git a/apps/server/src/cloud/CloudLink.ts b/apps/server/src/cloud/CloudLink.ts index 0e31ca736aae3..c4fef440b9122 100644 --- a/apps/server/src/cloud/CloudLink.ts +++ b/apps/server/src/cloud/CloudLink.ts @@ -38,7 +38,7 @@ import { RELAY_MINT_RESPONSE_TYP, verifyRelayJwt, } from "@t3tools/shared/relayJwt"; -import { isSecureRelayUrl } from "@t3tools/shared/relayUrl"; +import { isSecureRelayUrl, normalizeSecureRelayUrl } from "@t3tools/shared/relayUrl"; import * as Context from "effect/Context"; import * as SecureRandom from "effect/crypto/SecureRandom"; import * as Signature from "effect/crypto/Signature"; @@ -46,6 +46,7 @@ import * as Jwk from "effect/jose/Jwk"; import * as DateTime from "effect/DateTime"; import * as Duration from "effect/Duration"; import * as Effect from "effect/Effect"; +import * as FetchHttpClient from "effect/http/FetchHttpClient"; import * as FileSystem from "effect/FileSystem"; import * as Layer from "effect/Layer"; import * as Option from "effect/Option"; @@ -1232,22 +1233,27 @@ const make = Effect.gen(function* () { yield* Effect.logInfo("Keeping the managed tunnel across the update restart"); return false; } - const token = yield* cliTokenManager.getExisting; - if (Option.isNone(token)) { + const relayUrl = yield* requireRelayUrl.pipe(Effect.option); + const installedRelayUrl = yield* secrets.get(RELAY_URL_SECRET); + if ( + Option.isNone(relayUrl) || + Option.isNone(installedRelayUrl) || + normalizeSecureRelayUrl(bytesToString(installedRelayUrl.value)) !== relayUrl.value + ) { return false; } - // Use the persisted relay URL; T3CODE_RELAY_URL may have changed since linking. - const relayUrl = yield* secrets.get(RELAY_URL_SECRET); - if (Option.isNone(relayUrl)) { + const token = yield* cliTokenManager.getExisting; + if (Option.isNone(token)) { return false; } const environmentId = yield* environment.getEnvironmentId; yield* endpointRuntime.applyConfig(null); const response = yield* HttpClientRequest.delete( - `${bytesToString(relayUrl.value)}/v1/client/environment-links/${encodeURIComponent(environmentId)}/tunnel`, + `${relayUrl.value}/v1/client/environment-links/${encodeURIComponent(environmentId)}/tunnel`, ).pipe( HttpClientRequest.bearerToken(token.value.accessToken), httpClient.execute, + Effect.provideService(FetchHttpClient.RequestInit, { redirect: "error" }), Effect.flatMap(filterRelayResponse), Effect.flatMap(HttpClientResponse.schemaBodyJson(RelayOkResponse)), withRelayClientTracing, diff --git a/apps/server/src/cloud/http.test.ts b/apps/server/src/cloud/http.test.ts index 35d9b346ee83e..92355be1eda5c 100644 --- a/apps/server/src/cloud/http.test.ts +++ b/apps/server/src/cloud/http.test.ts @@ -299,6 +299,26 @@ describe("link proof over a non-loopback desktop transport", () => { }), ); + it.effect("requires the scopes that relay configuration can delegate", () => + Effect.gen(function* () { + const { post, exchange } = yield* linkProofClient; + const token = yield* exchange(DESKTOP_BOOTSTRAP_TOKEN, "relay:write"); + const response = yield* post( + "/api/connect/relay-config", + { + relayUrl: "https://relay.example.test", + cloudUserId: "test-link-owner", + environmentCredential: "test-environment-credential", + cloudMintPublicKey: "test-public-key", + endpointRuntime: null, + }, + { authorization: `Bearer ${token}` }, + ); + expect(response.status).toBe(403); + expect(yield* responseJson(response)).toMatchObject({ code: "insufficient_scope" }); + }), + ); + it.effect("rejects unauthenticated requests", () => Effect.gen(function* () { const { post } = yield* linkProofClient; diff --git a/apps/server/src/cloud/http.ts b/apps/server/src/cloud/http.ts index c95fcf051bd60..af78e8d4cdb3f 100644 --- a/apps/server/src/cloud/http.ts +++ b/apps/server/src/cloud/http.ts @@ -1,5 +1,6 @@ import { AuthRelayReadScope, + AuthStandardClientScopes, AuthRelayWriteScope, EnvironmentCloudEndpointUnavailableError, EnvironmentHttpApi, @@ -14,7 +15,7 @@ import * as HttpEffect from "effect/http/HttpEffect"; import { HttpServerRequest, HttpServerResponse } from "effect/http"; import * as HttpApiBuilder from "effect/http-api/HttpApiBuilder"; -import { requireEnvironmentScope } from "../auth/http.ts"; +import { failEnvironmentScopeRequired, requireEnvironmentScope } from "../auth/http.ts"; import * as EnvironmentAuth from "../auth/EnvironmentAuth.ts"; import * as ManagedLimits from "../policy/managedLimits.ts"; import * as CloudLink from "./CloudLink.ts"; @@ -125,9 +126,15 @@ export const layer = HttpApiBuilder.group( }), ) .handle("relayConfig", ({ payload }) => - requireEnvironmentScope(AuthRelayWriteScope).pipe( - Effect.andThen(toHttpErrorOrUnavailable(cloudLink.applyRelayConfig(payload))), - ), + Effect.gen(function* () { + const principal = yield* requireEnvironmentScope(AuthRelayWriteScope); + for (const scope of AuthStandardClientScopes) { + if (!principal.scopes.has(scope)) { + return yield* failEnvironmentScopeRequired(scope); + } + } + return yield* toHttpErrorOrUnavailable(cloudLink.applyRelayConfig(payload)); + }), ) .handle("linkState", () => Effect.gen(function* () { diff --git a/apps/web/src/cloud/useCloudLinkController.browser.test.tsx b/apps/web/src/cloud/useCloudLinkController.browser.test.tsx index 20e1fc71d29ba..a3bc67d871651 100644 --- a/apps/web/src/cloud/useCloudLinkController.browser.test.tsx +++ b/apps/web/src/cloud/useCloudLinkController.browser.test.tsx @@ -1,6 +1,7 @@ import { AuthRelayReadScope, AuthRelayWriteScope, + AuthStandardClientScopes, EnvironmentId, type EnvironmentCloudLinkStateResult, } from "@t3tools/contracts"; @@ -66,6 +67,8 @@ vi.mock(import("../state/relay"), async (original) => { vi.mock(import("../state/session"), async (original) => ({ ...(await original()), readEnvironmentScope: (_environmentId, scope) => testState.scopes.has(scope), + readEnvironmentCanConfigureRelay: () => + AuthStandardClientScopes.every((scope) => testState.scopes.has(scope)), })); vi.mock(import("../state/use-atom-command"), async (original) => ({ ...(await original()), @@ -146,7 +149,7 @@ function expectNoMutations() { } function setup() { - testState.scopes = new Set([AuthRelayReadScope, AuthRelayWriteScope]); + testState.scopes = new Set(AuthStandardClientScopes); testState.snapshot = linkedState; testState.renderedSnapshot = linkedState; testState.relayProviderKind = null; diff --git a/apps/web/src/cloud/useCloudLinkController.ts b/apps/web/src/cloud/useCloudLinkController.ts index 1133293e87964..8a9cc698f54a9 100644 --- a/apps/web/src/cloud/useCloudLinkController.ts +++ b/apps/web/src/cloud/useCloudLinkController.ts @@ -17,7 +17,7 @@ import { m } from "../i18n/messages"; import { stackedThreadToast } from "../components/ui/toastHelpers"; import { relayFailureReason } from "./relayFailureReason"; import { relayEnvironmentDiscovery } from "../state/relay"; -import { readEnvironmentScope } from "../state/session"; +import { readEnvironmentCanConfigureRelay, readEnvironmentScope } from "../state/session"; import { useAtomCommand } from "../state/use-atom-command"; import { isCloudEnvironmentLinkError } from "./linkEnvironment"; import { refreshManagedTunnelUsage } from "./managedRelayState"; @@ -187,6 +187,12 @@ export function useCloudLinkController(environmentId: EnvironmentId | null) { currentLinkState.linkRevoked === true || currentManagedTunnel !== desired.managedTunnel ) { + if (!readEnvironmentCanConfigureRelay(environmentId)) { + reportUpdateFailure( + new Error("This connection needs full access to configure T3 Connect."), + ); + return false; + } const linkResult = await linkEnvironment({ target, clerkToken, diff --git a/apps/web/src/cloud/useT3ConnectTurnOn.ts b/apps/web/src/cloud/useT3ConnectTurnOn.ts index 5683c735b421b..18ec99df23f2d 100644 --- a/apps/web/src/cloud/useT3ConnectTurnOn.ts +++ b/apps/web/src/cloud/useT3ConnectTurnOn.ts @@ -1,13 +1,12 @@ import { AuthRelayReadScope, - AuthRelayWriteScope, type EnvironmentId, managedCapabilityDenial, } from "@t3tools/contracts"; import { isElectron } from "../env"; import { useManagedPolicy } from "../state/managedPolicy"; -import { useEnvironmentScope } from "../state/session"; +import { useEnvironmentCanConfigureRelay, useEnvironmentScope } from "../state/session"; import { useCloudLinkState } from "./cloudLinkState"; import { hasCloudPublicConfig } from "./publicConfig"; import { resolveT3ConnectTurnOn } from "./t3ConnectState"; @@ -15,7 +14,7 @@ import { resolveT3ConnectTurnOn } from "./t3ConnectState"; /** Whether this client can turn on T3 Connect for `environmentId`, and if not, why. */ export function useT3ConnectTurnOn(environmentId: EnvironmentId | null) { const canReadRelay = useEnvironmentScope(environmentId, AuthRelayReadScope); - const canWriteRelay = useEnvironmentScope(environmentId, AuthRelayWriteScope); + const canConfigureRelay = useEnvironmentCanConfigureRelay(environmentId); const connectDenial = managedCapabilityDenial(useManagedPolicy(environmentId), "connect"); const linkState = useCloudLinkState(environmentId).data; return resolveT3ConnectTurnOn({ @@ -24,7 +23,7 @@ export function useT3ConnectTurnOn(environmentId: EnvironmentId | null) { linkableHere: linkState?.linkableHere ?? true, cloudConfigured: hasCloudPublicConfig(), canReadRelay, - canWriteRelay, + canWriteRelay: canConfigureRelay, connectDenial, }); } diff --git a/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx b/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx index 69d19b6c8e5f8..8d5e9de815aa8 100644 --- a/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx +++ b/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx @@ -3,8 +3,6 @@ import { useAtomValue } from "@effect/atom-react"; import { managedCapabilityDenial } from "@t3tools/client-runtime/contract-labels"; import { AuthAccessWriteScope, - AuthRelayReadScope, - AuthRelayWriteScope, type AuthSessionState, } from "@t3tools/contracts"; import { AsyncResult, Atom } from "effect/reactivity"; @@ -28,7 +26,12 @@ import { usePrimaryEnvironmentId, } from "~/state/environments"; import { usePrimaryManagedPolicy } from "~/state/managedPolicy"; -import { environmentSession, readEnvironmentScope, useEnvironmentScope } from "~/state/session"; +import { + environmentSession, + readEnvironmentCanConfigureRelay, + useEnvironmentCanConfigureRelay, + useEnvironmentScope, +} from "~/state/session"; import { type T3ConnectAccountPageUrl, useT3ConnectAccountPage, @@ -73,12 +76,11 @@ function ConfiguredConnectOnboardingDialog() { ? EMPTY_SESSION_STATE_ATOM : environmentSession.sessionStateAtom(primaryEnvironmentId), ); - const canReadRelay = useEnvironmentScope(primaryEnvironmentId, AuthRelayReadScope); - const canWriteRelay = useEnvironmentScope(primaryEnvironmentId, AuthRelayWriteScope); + const canConfigureRelay = useEnvironmentCanConfigureRelay(primaryEnvironmentId); // A policy that turns Connect off leaves nothing to publish; reaching other devices still works. const connectAllowed = managedCapabilityDenial(usePrimaryManagedPolicy(), "connect") === undefined; - const canManageRelay = canReadRelay && canWriteRelay && connectAllowed; + const canManageRelay = canConfigureRelay && connectAllowed; const canRequireDeviceApproval = useEnvironmentScope(primaryEnvironmentId, AuthAccessWriteScope); const deviceApprovalRequired = usePrimaryEnvironment()?.serverConfig?.settings.requireConnectDeviceApproval === true; @@ -189,11 +191,7 @@ function ConfiguredConnectOnboardingDialog() { setIsApplying(false); if (!saved) return; } - if ( - primaryEnvironmentId === null || - !readEnvironmentScope(primaryEnvironmentId, AuthRelayReadScope) || - !readEnvironmentScope(primaryEnvironmentId, AuthRelayWriteScope) - ) { + if (primaryEnvironmentId === null || !readEnvironmentCanConfigureRelay(primaryEnvironmentId)) { setStep("devices"); return; } @@ -256,8 +254,7 @@ function ConfiguredConnectOnboardingDialog() { if ( next === "publish" && (primaryEnvironmentId === null || - !readEnvironmentScope(primaryEnvironmentId, AuthRelayReadScope) || - !readEnvironmentScope(primaryEnvironmentId, AuthRelayWriteScope)) + !readEnvironmentCanConfigureRelay(primaryEnvironmentId)) ) return; if (next) setStep(next); @@ -282,16 +279,14 @@ function ConfiguredConnectOnboardingDialog() { onExposeEnvironmentChange={(enabled) => { if ( primaryEnvironmentId !== null && - readEnvironmentScope(primaryEnvironmentId, AuthRelayReadScope) && - readEnvironmentScope(primaryEnvironmentId, AuthRelayWriteScope) + readEnvironmentCanConfigureRelay(primaryEnvironmentId) ) setExposeEnvironment(enabled); }} onPublishAgentActivityChange={(enabled) => { if ( primaryEnvironmentId !== null && - readEnvironmentScope(primaryEnvironmentId, AuthRelayReadScope) && - readEnvironmentScope(primaryEnvironmentId, AuthRelayWriteScope) + readEnvironmentCanConfigureRelay(primaryEnvironmentId) ) setPublishAgentActivity(enabled); }} diff --git a/apps/web/src/state/session.ts b/apps/web/src/state/session.ts index 2c2de0a107d36..5d122b082a814 100644 --- a/apps/web/src/state/session.ts +++ b/apps/web/src/state/session.ts @@ -3,6 +3,7 @@ import { createEnvironmentSessionAtoms } from "@t3tools/client-runtime/state/ses import { type AuthEnvironmentScope, type AuthSessionState, + AuthStandardClientScopes, type EnvironmentId, sessionGrantsScope, } from "@t3tools/contracts"; @@ -34,6 +35,20 @@ export function useEnvironmentScope( ); } +export function useEnvironmentCanConfigureRelay(environmentId: EnvironmentId | null): boolean { + return useAtomValue( + environmentId === null + ? EMPTY_SESSION_STATE_ATOM + : environmentSession.sessionStateAtom(environmentId), + (result) => AuthStandardClientScopes.every((scope) => sessionHasScope(result, scope)), + ); +} + +export function readEnvironmentCanConfigureRelay(environmentId: EnvironmentId): boolean { + const result = appAtomRegistry.get(environmentSession.sessionStateAtom(environmentId)); + return AuthStandardClientScopes.every((scope) => sessionHasScope(result, scope)); +} + export function sessionHasScope( result: AsyncResult.AsyncResult, scope: AuthEnvironmentScope, diff --git a/docs/user/remote-access.md b/docs/user/remote-access.md index eaebfdb811ace..76019b5f1505e 100644 --- a/docs/user/remote-access.md +++ b/docs/user/remote-access.md @@ -448,8 +448,9 @@ worktree still creates that branch and worktree with `orchestration:operate`, and the agent it runs can use Git however the environment allows. Settings changes, provider management, environment maintenance, access -management, and T3 Connect management can each be granted separately. New -pairings without `--scope` include all of them. Existing clients keep the +management, and T3 Connect preferences can each be granted separately. Setting +up or replacing a T3 Connect link requires a full-access session. New pairings +without `--scope` include every permission. Existing clients keep the permissions they paired with and can stay connected after an update, but newly separated features may require pairing again with the permissions they need. Older clients may show controls that the server denies. Create a fresh pairing From 804b6e85cb9382d789bd5acb0f71267c63e5fbd9 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 16 Nov 2026 16:18:26 -0800 Subject: [PATCH 02/14] fix(connect): require explicit relay configuration permission --- .../SettingsNotificationsRouteScreen.tsx | 4 ++-- apps/server/src/auth/EnvironmentAuth.test.ts | 13 +++++++++---- apps/server/src/auth/EnvironmentAuth.ts | 3 ++- apps/server/src/auth/PairingGrantStore.ts | 5 +++-- apps/server/src/auth/SessionStore.ts | 3 ++- apps/server/src/cloud/http.test.ts | 17 ++++++++++++++--- apps/server/src/cloud/http.ts | 11 +++-------- .../useCloudLinkController.browser.test.tsx | 8 ++++---- apps/web/src/cloud/useCloudLinkController.ts | 4 +++- apps/web/src/state/session.ts | 6 +++--- docs/user/remote-access.md | 5 +++-- packages/contracts/src/auth.ts | 12 +++++++++++- packages/shared/src/authScopeOptions.ts | 8 +++++++- 13 files changed, 66 insertions(+), 33 deletions(-) diff --git a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx index 21243facc2156..ecd32f7ccda32 100644 --- a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx @@ -2,7 +2,7 @@ import { errorDisplayMessage } from "@t3tools/client-runtime/errors"; import { useGT, useMessages } from "gt-react-native"; import * as Dialog from "../../components/ui/Dialog"; import { managedCapabilityDenial } from "@t3tools/client-runtime/contract-labels"; -import { AuthStandardClientScopes, type EnvironmentId } from "@t3tools/contracts"; +import { AuthRelayConfigureScope, type EnvironmentId } from "@t3tools/contracts"; import { readEnvironmentScope } from "../../state/session"; import { appAtomRegistry } from "../../state/atom-registry"; import { serverEnvironment } from "../../state/server"; @@ -60,7 +60,7 @@ function canLinkEnvironmentToConnect(environmentId: EnvironmentId) { serverEnvironment.configValueAtom(environmentId), )?.managedPolicy; return ( - AuthStandardClientScopes.every((scope) => readEnvironmentScope(environmentId, scope)) && + readEnvironmentScope(environmentId, AuthRelayConfigureScope) && managedCapabilityDenial(policy, "connect") === undefined ); } diff --git a/apps/server/src/auth/EnvironmentAuth.test.ts b/apps/server/src/auth/EnvironmentAuth.test.ts index 9a44e13633a14..cc8953762049f 100644 --- a/apps/server/src/auth/EnvironmentAuth.test.ts +++ b/apps/server/src/auth/EnvironmentAuth.test.ts @@ -2,7 +2,7 @@ import * as NodePlatformCrypto from "@effect/platform-node/NodeCrypto"; import * as NodeServices from "@effect/platform-node/NodeServices"; import { authScopeResponse, - AuthStandardClientScopes, + AuthAdministrativeClientScopes, connectDeviceVerificationCode, } from "@t3tools/contracts"; import { expect, it } from "@effect/vitest"; @@ -107,7 +107,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodePlatformCrypto.layer))( const authenticated = yield* serverAuth.authenticateHttpRequest(request); expect(devExchange.cookieName).toMatch(/^t3_dev_session_/); expect(devExchange.expireNormalCookie).toBe(true); - expect(devExchange.response).toMatchObject(authScopeResponse(AuthStandardClientScopes)); + expect(devExchange.response).toMatchObject( + authScopeResponse(AuthAdministrativeClientScopes), + ); expect(authenticated.scopes).toEqual(["orchestration:read"]); }).pipe( Effect.provide( @@ -265,7 +267,10 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodePlatformCrypto.layer))( expect((yield* Effect.flip(sessions.verify(token)))._tag).toBe("SessionTokenRevokedError"); expect( (yield* serverAuth.createBrowserSession(recovery.credential, requestMetadata)).response, - ).toMatchObject({ authenticated: true, ...authScopeResponse(AuthStandardClientScopes) }); + ).toMatchObject({ + authenticated: true, + ...authScopeResponse(AuthAdministrativeClientScopes), + }); }).pipe( Effect.provide( layerEnvironmentAuth({ @@ -754,7 +759,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodePlatformCrypto.layer))( makeCookieRequest(sessions.cookieName, exchanged.sessionToken), ); - expect(verified.scopes).toEqual(AuthStandardClientScopes); + expect(verified.scopes).toEqual(AuthAdministrativeClientScopes); expect(verified.subject).toBe("administrative-bootstrap"); }).pipe(Effect.provide(layerEnvironmentAuth())), ); diff --git a/apps/server/src/auth/EnvironmentAuth.ts b/apps/server/src/auth/EnvironmentAuth.ts index 254cd09f18efa..2fb221bba82bc 100644 --- a/apps/server/src/auth/EnvironmentAuth.ts +++ b/apps/server/src/auth/EnvironmentAuth.ts @@ -3,6 +3,7 @@ import { AuthAccessWriteScope, AuthMcpClientAccess, AuthOrchestrationOperateScope, + AuthAdministrativeClientScopes, AuthStandardClientScopes, type AuthAccessTokenResult, type AuthBrowserSessionResult, @@ -1398,7 +1399,7 @@ export const make = Effect.gen(function* () { () => { // Unguarded: startup already refused auth policies the managed policy leaves out. const fallback = issuePairingLink({ - scopes: AuthStandardClientScopes, + scopes: AuthAdministrativeClientScopes, subject: INTERNAL_ADMINISTRATIVE_BOOTSTRAP_SUBJECT, purpose: "startup", }).pipe(Effect.map(toPairingCredential)); diff --git a/apps/server/src/auth/PairingGrantStore.ts b/apps/server/src/auth/PairingGrantStore.ts index 6929cffc7eeb5..18172263f2da8 100644 --- a/apps/server/src/auth/PairingGrantStore.ts +++ b/apps/server/src/auth/PairingGrantStore.ts @@ -1,4 +1,5 @@ import { + AuthAdministrativeClientScopes, AuthStandardClientScopes, type AuthClientMetadata, type AuthConnectDevice, @@ -414,7 +415,7 @@ const make = Effect.gen(function* () { const now = yield* DateTime.now; yield* seedGrant(config.desktopBootstrapToken, { method: "desktop-bootstrap", - scopes: AuthStandardClientScopes, + scopes: AuthAdministrativeClientScopes, subject: "desktop-bootstrap", expiresAt: DateTime.add(now, { milliseconds: Duration.toMillis(DESKTOP_BOOTSTRAP_TTL_HOURS), @@ -535,7 +536,7 @@ const make = Effect.gen(function* () { if (yield* consumeRotatingDesktopToken(credential, now.epochMilliseconds)) { return { method: "desktop-bootstrap", - scopes: AuthStandardClientScopes, + scopes: AuthAdministrativeClientScopes, subject: "desktop-bootstrap", expiresAt: DateTime.add(now, { milliseconds: DESKTOP_BOOTSTRAP_TOKEN_WINDOW_MS, diff --git a/apps/server/src/auth/SessionStore.ts b/apps/server/src/auth/SessionStore.ts index e3af51958b806..5e117a4e698fb 100644 --- a/apps/server/src/auth/SessionStore.ts +++ b/apps/server/src/auth/SessionStore.ts @@ -1,5 +1,6 @@ import { AuthSessionId, + AuthAdministrativeClientScopes, AuthStandardClientScopes, AuthEnvironmentScopes, type AuthClientMetadata, @@ -575,7 +576,7 @@ const make = Effect.gen(function* () { .createIfAbsent({ sessionId: devAuth.sessionId, subject: "reusable-dev-token", - scopes: AuthStandardClientScopes, + scopes: AuthAdministrativeClientScopes, method: "browser-session-cookie", client: { label: "Reusable dev token", diff --git a/apps/server/src/cloud/http.test.ts b/apps/server/src/cloud/http.test.ts index 92355be1eda5c..1d5df89f2dad2 100644 --- a/apps/server/src/cloud/http.test.ts +++ b/apps/server/src/cloud/http.test.ts @@ -299,10 +299,18 @@ describe("link proof over a non-loopback desktop transport", () => { }), ); - it.effect("requires the scopes that relay configuration can delegate", () => + it.effect("requires explicit permission to configure the relay", () => Effect.gen(function* () { const { post, exchange } = yield* linkProofClient; - const token = yield* exchange(DESKTOP_BOOTSTRAP_TOKEN, "relay:write"); + const admin = yield* exchange(DESKTOP_BOOTSTRAP_TOKEN); + const paired = yield* post( + "/api/auth/pairing-token", + {}, + { authorization: `Bearer ${admin}` }, + ); + expect(paired.status).toBe(200); + const { credential } = (yield* responseJson(paired)) as { credential: string }; + const token = yield* exchange(credential); const response = yield* post( "/api/connect/relay-config", { @@ -315,7 +323,10 @@ describe("link proof over a non-loopback desktop transport", () => { { authorization: `Bearer ${token}` }, ); expect(response.status).toBe(403); - expect(yield* responseJson(response)).toMatchObject({ code: "insufficient_scope" }); + expect(yield* responseJson(response)).toMatchObject({ + code: "insufficient_scope", + requiredPermission: "relay:configure", + }); }), ); diff --git a/apps/server/src/cloud/http.ts b/apps/server/src/cloud/http.ts index af78e8d4cdb3f..16133065312a3 100644 --- a/apps/server/src/cloud/http.ts +++ b/apps/server/src/cloud/http.ts @@ -1,6 +1,6 @@ import { AuthRelayReadScope, - AuthStandardClientScopes, + AuthRelayConfigureScope, AuthRelayWriteScope, EnvironmentCloudEndpointUnavailableError, EnvironmentHttpApi, @@ -15,7 +15,7 @@ import * as HttpEffect from "effect/http/HttpEffect"; import { HttpServerRequest, HttpServerResponse } from "effect/http"; import * as HttpApiBuilder from "effect/http-api/HttpApiBuilder"; -import { failEnvironmentScopeRequired, requireEnvironmentScope } from "../auth/http.ts"; +import { requireEnvironmentScope } from "../auth/http.ts"; import * as EnvironmentAuth from "../auth/EnvironmentAuth.ts"; import * as ManagedLimits from "../policy/managedLimits.ts"; import * as CloudLink from "./CloudLink.ts"; @@ -127,12 +127,7 @@ export const layer = HttpApiBuilder.group( ) .handle("relayConfig", ({ payload }) => Effect.gen(function* () { - const principal = yield* requireEnvironmentScope(AuthRelayWriteScope); - for (const scope of AuthStandardClientScopes) { - if (!principal.scopes.has(scope)) { - return yield* failEnvironmentScopeRequired(scope); - } - } + yield* requireEnvironmentScope(AuthRelayConfigureScope); return yield* toHttpErrorOrUnavailable(cloudLink.applyRelayConfig(payload)); }), ) diff --git a/apps/web/src/cloud/useCloudLinkController.browser.test.tsx b/apps/web/src/cloud/useCloudLinkController.browser.test.tsx index a3bc67d871651..d9f5913208798 100644 --- a/apps/web/src/cloud/useCloudLinkController.browser.test.tsx +++ b/apps/web/src/cloud/useCloudLinkController.browser.test.tsx @@ -1,7 +1,8 @@ import { AuthRelayReadScope, AuthRelayWriteScope, - AuthStandardClientScopes, + AuthAdministrativeClientScopes, + AuthRelayConfigureScope, EnvironmentId, type EnvironmentCloudLinkStateResult, } from "@t3tools/contracts"; @@ -67,8 +68,7 @@ vi.mock(import("../state/relay"), async (original) => { vi.mock(import("../state/session"), async (original) => ({ ...(await original()), readEnvironmentScope: (_environmentId, scope) => testState.scopes.has(scope), - readEnvironmentCanConfigureRelay: () => - AuthStandardClientScopes.every((scope) => testState.scopes.has(scope)), + readEnvironmentCanConfigureRelay: () => testState.scopes.has(AuthRelayConfigureScope), })); vi.mock(import("../state/use-atom-command"), async (original) => ({ ...(await original()), @@ -149,7 +149,7 @@ function expectNoMutations() { } function setup() { - testState.scopes = new Set(AuthStandardClientScopes); + testState.scopes = new Set(AuthAdministrativeClientScopes); testState.snapshot = linkedState; testState.renderedSnapshot = linkedState; testState.relayProviderKind = null; diff --git a/apps/web/src/cloud/useCloudLinkController.ts b/apps/web/src/cloud/useCloudLinkController.ts index 8a9cc698f54a9..7f3a38e5cbb67 100644 --- a/apps/web/src/cloud/useCloudLinkController.ts +++ b/apps/web/src/cloud/useCloudLinkController.ts @@ -189,7 +189,9 @@ export function useCloudLinkController(environmentId: EnvironmentId | null) { ) { if (!readEnvironmentCanConfigureRelay(environmentId)) { reportUpdateFailure( - new Error("This connection needs full access to configure T3 Connect."), + new Error( + "This connection needs the relay configuration permission to configure T3 Connect.", + ), ); return false; } diff --git a/apps/web/src/state/session.ts b/apps/web/src/state/session.ts index 5d122b082a814..f53bb3dfa9684 100644 --- a/apps/web/src/state/session.ts +++ b/apps/web/src/state/session.ts @@ -3,7 +3,7 @@ import { createEnvironmentSessionAtoms } from "@t3tools/client-runtime/state/ses import { type AuthEnvironmentScope, type AuthSessionState, - AuthStandardClientScopes, + AuthRelayConfigureScope, type EnvironmentId, sessionGrantsScope, } from "@t3tools/contracts"; @@ -40,13 +40,13 @@ export function useEnvironmentCanConfigureRelay(environmentId: EnvironmentId | n environmentId === null ? EMPTY_SESSION_STATE_ATOM : environmentSession.sessionStateAtom(environmentId), - (result) => AuthStandardClientScopes.every((scope) => sessionHasScope(result, scope)), + (result) => sessionHasScope(result, AuthRelayConfigureScope), ); } export function readEnvironmentCanConfigureRelay(environmentId: EnvironmentId): boolean { const result = appAtomRegistry.get(environmentSession.sessionStateAtom(environmentId)); - return AuthStandardClientScopes.every((scope) => sessionHasScope(result, scope)); + return sessionHasScope(result, AuthRelayConfigureScope); } export function sessionHasScope( diff --git a/docs/user/remote-access.md b/docs/user/remote-access.md index 76019b5f1505e..d73583593fd3d 100644 --- a/docs/user/remote-access.md +++ b/docs/user/remote-access.md @@ -449,8 +449,9 @@ and the agent it runs can use Git however the environment allows. Settings changes, provider management, environment maintenance, access management, and T3 Connect preferences can each be granted separately. Setting -up or replacing a T3 Connect link requires a full-access session. New pairings -without `--scope` include every permission. Existing clients keep the +up or replacing a T3 Connect link requires the administrative +`relay:configure` permission. `relay:write` covers preferences and unlinking. +New pairings without `--scope` include the standard client permissions. Existing clients keep the permissions they paired with and can stay connected after an update, but newly separated features may require pairing again with the permissions they need. Older clients may show controls that the server denies. Create a fresh pairing diff --git a/packages/contracts/src/auth.ts b/packages/contracts/src/auth.ts index bb3d8b6530467..826ffeb6b258e 100644 --- a/packages/contracts/src/auth.ts +++ b/packages/contracts/src/auth.ts @@ -47,6 +47,7 @@ export const AuthAccessReadScope = "access:read" as const; export const AuthAccessWriteScope = "access:write" as const; export const AuthRelayReadScope = "relay:read" as const; export const AuthRelayWriteScope = "relay:write" as const; +export const AuthRelayConfigureScope = "relay:configure" as const; export const AuthEnvironmentScope = Schema.Literals([ AuthOrchestrationReadScope, AuthOrchestrationOperateScope, @@ -65,6 +66,7 @@ export const AuthEnvironmentScope = Schema.Literals([ AuthAccessWriteScope, AuthRelayReadScope, AuthRelayWriteScope, + AuthRelayConfigureScope, ]); export type AuthEnvironmentScope = typeof AuthEnvironmentScope.Type; export const AuthEnvironmentScopes = Schema.Array(AuthEnvironmentScope); @@ -113,7 +115,10 @@ const legacyParents: Partial> /** Keep permission denials decodable by clients with the original scope enum. */ export function authScopeRequiredResponse(requiredPermission: AuthEnvironmentScope) { return { - requiredScope: legacyParents[requiredPermission] ?? requiredPermission, + requiredScope: + requiredPermission === AuthRelayConfigureScope + ? AuthRelayWriteScope + : (legacyParents[requiredPermission] ?? requiredPermission), requiredPermission, }; } @@ -167,6 +172,11 @@ export const AuthStandardClientScopes = [ AuthRelayWriteScope, ] as const; +export const AuthAdministrativeClientScopes = [ + ...AuthStandardClientScopes, + AuthRelayConfigureScope, +] as const; + export const AuthTokenExchangeGrantType = "urn:ietf:params:oauth:grant-type:token-exchange" as const; export const AuthAccessTokenType = "urn:ietf:params:oauth:token-type:access_token" as const; diff --git a/packages/shared/src/authScopeOptions.ts b/packages/shared/src/authScopeOptions.ts index c6162c8c1c97a..299450563a2d2 100644 --- a/packages/shared/src/authScopeOptions.ts +++ b/packages/shared/src/authScopeOptions.ts @@ -11,6 +11,7 @@ import { AuthPreviewOperateScope, AuthProvidersManageScope, AuthRelayReadScope, + AuthRelayConfigureScope, AuthRelayWriteScope, AuthSettingsWriteScope, AuthSourceControlWriteScope, @@ -103,7 +104,12 @@ export const AUTH_SCOPE_OPTIONS: ReadonlyArray<{ { scope: AuthRelayWriteScope, title: msg("Manage relay"), - description: msg("Change managed tunnel connectivity."), + description: msg("Update relay preferences or unlink T3 Connect."), + }, + { + scope: AuthRelayConfigureScope, + title: msg("Configure relay (admin)"), + description: msg("Set up or replace T3 Connect, including its trusted pairing credential issuer."), }, ]; From 0f56b6a799567bf3450f3a46d0f3de4f43705a90 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 16 Nov 2026 16:20:42 -0800 Subject: [PATCH 03/14] docs(connect): explain powerful pairing permissions --- .../settings/AuthorizedClientsSettings.tsx | 15 +++++++++++++++ docs/user/remote-access.md | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/apps/web/src/components/settings/AuthorizedClientsSettings.tsx b/apps/web/src/components/settings/AuthorizedClientsSettings.tsx index ccadf09814de8..e92a2cfec600c 100644 --- a/apps/web/src/components/settings/AuthorizedClientsSettings.tsx +++ b/apps/web/src/components/settings/AuthorizedClientsSettings.tsx @@ -10,7 +10,9 @@ import { AuthDiagnosticsReadScope, AuthOrchestrationReadScope, AuthFilesystemReadScope, + AuthRelayConfigureScope, AuthStandardClientScopes, + AuthTerminalOperateScope, AuthTerminalReadScope, type AuthEnvironmentScope, type AuthGrantScope, @@ -617,6 +619,8 @@ export const AuthorizedClientsHeaderAction = memo(function AuthorizedClientsHead ...AuthStandardClientScopes, ]); const selectedScopes = pairingScopes.filter((scope) => delegatableScopes.includes(scope)); + const terminalSelected = selectedScopes.includes(AuthTerminalOperateScope); + const relayAdminSelected = selectedScopes.includes(AuthRelayConfigureScope); const [isCreatingPairingLink, setIsCreatingPairingLink] = useState(false); const handleCreatePairingLink = async () => { @@ -793,6 +797,17 @@ export const AuthorizedClientsHeaderAction = memo(function AuthorizedClientsHead {m(description)} + {terminalSelected && scope === AuthTerminalOperateScope ? ( + + Terminal commands can read or change files within the server account’s + permissions. + + ) : null} + {relayAdminSelected && scope === AuthRelayConfigureScope ? ( + + This client can change who can issue pairing credentials. + + ) : null} ), diff --git a/docs/user/remote-access.md b/docs/user/remote-access.md index d73583593fd3d..f91f119aaeb5b 100644 --- a/docs/user/remote-access.md +++ b/docs/user/remote-access.md @@ -461,6 +461,13 @@ link to change a client's permissions. local changes. Add `filesystem:write` to allow editing files or saving plans to the workspace. These scopes control direct file access from the client. +Some permissions also give a client indirect access. With `terminal:operate`, +a client can run commands that read or change any files the server’s OS account +can access, even when the pairing link omits file permissions. With +`relay:configure`, a client can replace the trusted issuer of pairing +credentials. Grant these permissions only to clients you trust with those +capabilities. + To remove an environment from T3 Connect, open your account menu's **T3 Connect** page, or **Settings → T3 Connect** on mobile, and choose **Deregister**. This revokes its cloud access and frees its host space even when the environment is From 69408cdf17c4ef4fe03fa5ceff3157fc01d1734c Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 16 Nov 2026 16:41:02 -0800 Subject: [PATCH 04/14] fix(connect): require relay configuration permission for link proofs --- apps/server/src/cloud/http.test.ts | 7 ++++--- apps/server/src/cloud/http.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/server/src/cloud/http.test.ts b/apps/server/src/cloud/http.test.ts index 1d5df89f2dad2..cbf75def981ba 100644 --- a/apps/server/src/cloud/http.test.ts +++ b/apps/server/src/cloud/http.test.ts @@ -213,7 +213,7 @@ describe("link proof over a non-loopback desktop transport", () => { const paired = yield* post( "/api/auth/pairing-token", { - scopes: ["relay:read", "relay:write"], + scopes: ["relay:read", "relay:configure"], label: "desktop-bootstrap", subject: "desktop-bootstrap", }, @@ -284,10 +284,10 @@ describe("link proof over a non-loopback desktop transport", () => { }), ); - it.effect("requires relay-write scope even for desktop bootstrap", () => + it.effect("requires relay configuration permission even for desktop bootstrap", () => Effect.gen(function* () { const { post, exchange } = yield* linkProofClient; - const token = yield* exchange(DESKTOP_BOOTSTRAP_TOKEN, "relay:read"); + const token = yield* exchange(DESKTOP_BOOTSTRAP_TOKEN, "relay:write"); const response = yield* post("/api/connect/link-proof", proofRequest, { authorization: `Bearer ${token}`, }); @@ -295,6 +295,7 @@ describe("link proof over a non-loopback desktop transport", () => { expect(yield* responseJson(response)).toMatchObject({ code: "insufficient_scope", requiredScope: "relay:write", + requiredPermission: "relay:configure", }); }), ); diff --git a/apps/server/src/cloud/http.ts b/apps/server/src/cloud/http.ts index 16133065312a3..5b1b3bcba5c6e 100644 --- a/apps/server/src/cloud/http.ts +++ b/apps/server/src/cloud/http.ts @@ -118,7 +118,7 @@ export const layer = HttpApiBuilder.group( return handlers .handle("linkProof", ({ payload }) => Effect.gen(function* () { - yield* requireEnvironmentScope(AuthRelayWriteScope); + yield* requireEnvironmentScope(AuthRelayConfigureScope); const request = yield* HttpServerRequest.HttpServerRequest; const proof = yield* toHttpError(cloudLink.linkProof(payload, request)); yield* appendCloudCredentialResponseHeaders; From 547dbbb471c9e16966627844b6f0174c11c96493 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 16 Nov 2026 17:24:46 -0800 Subject: [PATCH 05/14] fix(mobile): preserve Live Activity updates for relay writers --- .../liveActivityPreferences.test.ts | 32 ++++++++++----- .../liveActivityPreferences.ts | 19 +++++++-- .../src/features/cloud/linkEnvironment.ts | 35 ++++++++++++++++ .../SettingsNotificationsRouteScreen.tsx | 21 +++++----- apps/server/src/cloud/CloudLink.ts | 40 +++++++++++++++++++ apps/server/src/cloud/http.test.ts | 20 +++++++++- apps/server/src/cloud/http.ts | 7 ++++ .../AgentActivityPublisher.test.ts | 1 + .../src/agentActivity/FcmDeliveries.test.ts | 1 + .../agentActivity/MobileRegistrations.test.ts | 1 + .../environments/EnvironmentConnector.test.ts | 1 + .../environments/EnvironmentLinker.test.ts | 2 + .../src/environments/EnvironmentLinks.test.ts | 39 ++++++++++++++++++ .../src/environments/EnvironmentLinks.ts | 36 +++++++++++++++++ infra/relay/src/hooks/HeldHooks.test.ts | 1 + infra/relay/src/http/Api.test.ts | 2 + infra/relay/src/http/Api.ts | 15 +++++++ packages/contracts/src/environmentHttp.ts | 8 ++++ packages/contracts/src/relay.ts | 13 ++++++ 19 files changed, 269 insertions(+), 25 deletions(-) diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts index 3f1fe66908e93..dcb28fad75a4a 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts @@ -11,6 +11,7 @@ import * as MobileStorage from "../../persistence/mobile-storage"; import { CloudEnvironmentLinkError, linkEnvironmentToCloudWithPreference, + updateLinkedEnvironmentLiveActivityPreference, } from "../cloud/linkEnvironment"; import { setLiveActivityUpdatesEnabled } from "./liveActivityPreferences"; import { updateAgentAwarenessRegistrationPreferences } from "./remoteRegistration"; @@ -34,6 +35,7 @@ vi.mock("expo-device", () => ({})); vi.mock("../cloud/linkEnvironment", async (importOriginal) => ({ ...(await importOriginal()), linkEnvironmentToCloudWithPreference: vi.fn(() => Effect.void), + updateLinkedEnvironmentLiveActivityPreference: vi.fn(() => Effect.succeed(true)), })); vi.mock("./remoteRegistration", () => ({ @@ -76,7 +78,7 @@ describe("liveActivityPreferences", () => { }); it.effect("restores relay preferences when an environment update fails", () => { - vi.mocked(linkEnvironmentToCloudWithPreference).mockImplementationOnce(() => + vi.mocked(updateLinkedEnvironmentLiveActivityPreference).mockImplementationOnce(() => Effect.fail(new CloudEnvironmentLinkError({ message: "environment update failed" })), ); @@ -87,7 +89,8 @@ describe("liveActivityPreferences", () => { previousEnabled: true, clerkToken: "clerk-token", connections: [connection], - canConfigureEnvironment: () => true, + canConfigureEnvironment: () => false, + canUpdateEnvironment: () => true, }), ); @@ -98,20 +101,24 @@ describe("liveActivityPreferences", () => { expect(updateAgentAwarenessRegistrationPreferences).toHaveBeenNthCalledWith(2, { liveActivitiesEnabled: true, }); - expect(linkEnvironmentToCloudWithPreference).toHaveBeenNthCalledWith(1, { - clerkToken: "clerk-token", + expect(updateLinkedEnvironmentLiveActivityPreference).toHaveBeenNthCalledWith( + 1, connection, - liveActivitiesEnabled: false, - }); - expect(linkEnvironmentToCloudWithPreference).toHaveBeenNthCalledWith(2, { - clerkToken: "clerk-token", + false, + ); + expect(updateLinkedEnvironmentLiveActivityPreference).toHaveBeenNthCalledWith( + 2, connection, - liveActivitiesEnabled: true, - }); + true, + ); + expect(linkEnvironmentToCloudWithPreference).not.toHaveBeenCalled(); }).pipe(Effect.provide(layerTest)); }); - it.effect("only re-links environments with relay access when enabling updates", () => { + it.effect("only creates missing links when the session can configure Connect", () => { + vi.mocked(updateLinkedEnvironmentLiveActivityPreference).mockReturnValueOnce( + Effect.succeed(false), + ); const readOnlyConnection: SavedRemoteConnection = { ...connection, environmentId: "read-only" as EnvironmentId, @@ -123,6 +130,7 @@ describe("liveActivityPreferences", () => { previousEnabled: false, clerkToken: "clerk-token", connections: [readOnlyConnection, connection], + canUpdateEnvironment: (environmentId) => environmentId === connection.environmentId, canConfigureEnvironment: (environmentId) => environmentId === connection.environmentId, }); @@ -152,9 +160,11 @@ describe("liveActivityPreferences", () => { clerkToken: "clerk-token", connections: [connection], canConfigureEnvironment: () => canConfigureEnvironment, + canUpdateEnvironment: () => canConfigureEnvironment, }); expect(linkEnvironmentToCloudWithPreference).not.toHaveBeenCalled(); + expect(updateLinkedEnvironmentLiveActivityPreference).not.toHaveBeenCalled(); expect(updateAgentAwarenessRegistrationPreferences).toHaveBeenCalledTimes(1); }).pipe(Effect.provide(layerTest)); }); diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts index 826edaf839b91..aef244e221673 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts @@ -2,7 +2,10 @@ import * as Effect from "effect/Effect"; import type { EnvironmentId } from "@t3tools/contracts"; import type { SavedRemoteConnection } from "../../lib/connection"; -import { linkEnvironmentToCloudWithPreference } from "../cloud/linkEnvironment"; +import { + linkEnvironmentToCloudWithPreference, + updateLinkedEnvironmentLiveActivityPreference, +} from "../cloud/linkEnvironment"; import { updateAgentAwarenessRegistrationPreferences } from "./remoteRegistration"; export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEnabled")( @@ -11,6 +14,7 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn readonly previousEnabled: boolean; readonly clerkToken: string | null; readonly connections: ReadonlyArray; + readonly canUpdateEnvironment: (environmentId: EnvironmentId) => boolean; readonly canConfigureEnvironment: (environmentId: EnvironmentId) => boolean; }) { const linkedConnections = input.connections.filter( @@ -20,9 +24,16 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn const updateEnvironmentPreference = Effect.fn("updateEnvironmentPreference")(function* ( connection: SavedRemoteConnection, enabled: boolean, - clerkToken: string, + clerkToken: string | null, ) { - if (!input.canConfigureEnvironment(connection.environmentId)) return; + if ( + input.canUpdateEnvironment(connection.environmentId) && + (yield* updateLinkedEnvironmentLiveActivityPreference(connection, enabled)) + ) { + return; + } + if (!enabled || !clerkToken || !input.canConfigureEnvironment(connection.environmentId)) + return; yield* linkEnvironmentToCloudWithPreference({ clerkToken, @@ -61,7 +72,7 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn yield* Effect.forEach( linkedConnections, (connection) => - updateEnvironmentPreference(connection, input.previousEnabled, clerkToken).pipe( + updateEnvironmentPreference(connection, input.previousEnabled, null).pipe( Effect.catchCause((cause) => Effect.logWarning( `Could not restore Live Activity preference for environment ${connection.environmentId}.`, diff --git a/apps/mobile/src/features/cloud/linkEnvironment.ts b/apps/mobile/src/features/cloud/linkEnvironment.ts index a3c0bd5c966d9..cb08a02551331 100644 --- a/apps/mobile/src/features/cloud/linkEnvironment.ts +++ b/apps/mobile/src/features/cloud/linkEnvironment.ts @@ -10,6 +10,7 @@ import { EnvironmentHttpUnauthorizedError, } from "@t3tools/contracts"; import { + RelayOkResponse, type RelayEnvironmentLinkResponse as RelayEnvironmentLinkResponseType, type RelayManagedEndpointProviderKind, } from "@t3tools/contracts/relay"; @@ -162,6 +163,40 @@ type LinkEnvironmentToCloudRequirements = | ManagedRelay.ManagedRelayClient | MobileStorage.MobileStorage; +const decodeRelayOkResponse = Schema.decodeUnknownEffect(RelayOkResponse); + +export const updateLinkedEnvironmentLiveActivityPreference = Effect.fn( + "linkEnvironment.updateLinkedEnvironmentLiveActivityPreference", +)(function* (connection: SavedRemoteConnection, liveActivitiesEnabled: boolean) { + if (!connection.bearerToken) return false; + + const client = yield* makeEnvironmentHttpApiClient(connection.httpBaseUrl); + return yield* client.connect + .liveActivityPreference({ + headers: { authorization: `Bearer ${connection.bearerToken}` }, + payload: { liveActivitiesEnabled }, + responseMode: "response-only", + }) + .pipe( + Effect.flatMap((response) => + Effect.gen(function* () { + if (response.status === 404) return false; + if (response.status === 200) { + const json = yield* response.json; + const result = yield* decodeRelayOkResponse(json); + return result.ok; + } + return yield* new CloudEnvironmentLinkError({ + message: `Environment returned HTTP ${response.status}.`, + }); + }), + ), + Effect.mapError( + cloudEnvironmentLinkError("Could not update the environment's Live Activity preference."), + ), + ); +}); + export const linkEnvironmentToCloudWithPreference = Effect.fn( "linkEnvironment.linkEnvironmentToCloudWithPreference", )(function* ( diff --git a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx index ecd32f7ccda32..9105af80d1efa 100644 --- a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx @@ -2,7 +2,7 @@ import { errorDisplayMessage } from "@t3tools/client-runtime/errors"; import { useGT, useMessages } from "gt-react-native"; import * as Dialog from "../../components/ui/Dialog"; import { managedCapabilityDenial } from "@t3tools/client-runtime/contract-labels"; -import { AuthRelayConfigureScope, type EnvironmentId } from "@t3tools/contracts"; +import { AuthRelayConfigureScope, AuthRelayWriteScope, type EnvironmentId } from "@t3tools/contracts"; import { readEnvironmentScope } from "../../state/session"; import { appAtomRegistry } from "../../state/atom-registry"; import { serverEnvironment } from "../../state/server"; @@ -55,12 +55,15 @@ import { resolveAgentAwarenessPlatformPresentation } from "./SettingsRouteScreen * A policy that turns Connect off refuses relay links and preferences, which would fail the * whole batch, so those environments are skipped like ones this session cannot configure. */ -function canLinkEnvironmentToConnect(environmentId: EnvironmentId) { +function canManageConnect( + environmentId: EnvironmentId, + scope: typeof AuthRelayConfigureScope | typeof AuthRelayWriteScope, +) { const policy = appAtomRegistry.get( serverEnvironment.configValueAtom(environmentId), )?.managedPolicy; return ( - readEnvironmentScope(environmentId, AuthRelayConfigureScope) && + readEnvironmentScope(environmentId, scope) && managedCapabilityDenial(policy, "connect") === undefined ); } @@ -316,7 +319,8 @@ function ConfiguredSettingsNotificationsRouteScreen() { const updateResult = await settleAsyncResult(() => runtime.runPromiseExit( setLiveActivityUpdatesEnabled({ - canConfigureEnvironment: canLinkEnvironmentToConnect, + canConfigureEnvironment: (id) => canManageConnect(id, AuthRelayConfigureScope), + canUpdateEnvironment: (id) => canManageConnect(id, AuthRelayWriteScope), enabled: true, previousEnabled: liveActivitiesPreferenceEnabled, clerkToken: tokenResult.value, @@ -348,10 +352,8 @@ function ConfiguredSettingsNotificationsRouteScreen() { Dialog.alert( Platform.OS === "android" ? gt("Ongoing activity enabled") : gt("Live Activities enabled"), environmentCount > 0 - ? gt("Agent activity updates are enabled for environments this connection can configure.") - : gt( - "Agent activity updates are enabled. Add an environment to start receiving updates.", - ), + ? gt("Agent activity updates are enabled for eligible environments.") + : gt("Agent activity updates are enabled. Add an environment to start receiving updates."), ); } else { Dialog.alert( @@ -401,7 +403,8 @@ function ConfiguredSettingsNotificationsRouteScreen() { const updateResult = await settleAsyncResult(() => runtime.runPromiseExit( setLiveActivityUpdatesEnabled({ - canConfigureEnvironment: canLinkEnvironmentToConnect, + canConfigureEnvironment: (id) => canManageConnect(id, AuthRelayConfigureScope), + canUpdateEnvironment: (id) => canManageConnect(id, AuthRelayWriteScope), enabled: false, previousEnabled: liveActivitiesPreferenceEnabled, clerkToken: token, diff --git a/apps/server/src/cloud/CloudLink.ts b/apps/server/src/cloud/CloudLink.ts index c4fef440b9122..7793627cdd3d8 100644 --- a/apps/server/src/cloud/CloudLink.ts +++ b/apps/server/src/cloud/CloudLink.ts @@ -252,6 +252,7 @@ const INTERNAL_OPERATION_MESSAGES = { "persist-recovered-tunnel": "Could not persist the recovered managed tunnel configuration.", "read-relay-config": "Could not read environment relay configuration.", "remove-relay-config": "Could not remove environment relay configuration.", + "update-live-activity-preference": "Could not update T3 Connect Live Activity preferences.", "update-webhook-settings": "Could not update T3 Connect webhook settings.", "read-preferences": "Could not read environment cloud preferences.", "persist-preferences": "Could not persist environment cloud preferences.", @@ -456,6 +457,12 @@ export class CloudLink extends Context.Service< EnvironmentCloudLinkStateResult, CloudLinkNotLinkedError | CloudLinkInternalError | ManagedLimits.ManagedPolicyRefusedError >; + readonly updateLiveActivityPreference: ( + enabled: boolean, + ) => Effect.Effect< + RelayOkResponse, + CloudLinkInternalError | ManagedLimits.ManagedPolicyRefusedError + >; readonly answerHealthRequest: ( request: RelayCloudEnvironmentHealthRequest, ) => Effect.Effect< @@ -1431,6 +1438,37 @@ const make = Effect.gen(function* () { Effect.catchIf(ServerSecretStore.isSecretStoreError, internalError("read-preferences")), ); + const updateLiveActivityPreference = Effect.fn("environment.cloud.updateLiveActivityPreference")( + function* (liveActivitiesEnabled: boolean) { + return yield* endpointRuntime.withLinkStateLock( + Effect.gen(function* () { + const connection = yield* readRelayConnection.pipe(withSecrets); + const cloudUserId = yield* secrets.get(CLOUD_LINKED_USER_ID); + const revoked = yield* secrets.get(CLOUD_LINK_REVOKED); + if (connection === null || Option.isNone(cloudUserId) || Option.isSome(revoked)) { + return { ok: false }; + } + const environmentId = yield* environment.getEnvironmentId; + const client = yield* makeRelayEnvironmentClient(connection); + return yield* client.server + .updateLiveActivityPreference({ + params: { environmentId }, + payload: { cloudUserId: bytesToString(cloudUserId.value), liveActivitiesEnabled }, + }) + .pipe( + Effect.provideService(FetchHttpClient.RequestInit, { redirect: "error" }), + Effect.timeout("10 seconds"), + Effect.catch(internalError("update-live-activity-preference")), + ); + }), + ); + }, + Effect.catchIf( + ServerSecretStore.isSecretStoreError, + internalError("update-live-activity-preference"), + ), + ); + const answerHealthRequest = Effect.fn("environment.cloud.health")( function* (request: RelayCloudEnvironmentHealthRequest) { const cloudMintPublicKey = yield* secrets @@ -1660,6 +1698,7 @@ const make = Effect.gen(function* () { linkState, unlink, updatePreferences: refused, + updateLiveActivityPreference: refused, answerHealthRequest: refused, mintCredential: refused, reconcileDesiredLinkIfStillDesired: notDesired, @@ -1676,6 +1715,7 @@ const make = Effect.gen(function* () { linkState, unlink, updatePreferences, + updateLiveActivityPreference, answerHealthRequest, mintCredential, reconcileDesiredLinkIfStillDesired, diff --git a/apps/server/src/cloud/http.test.ts b/apps/server/src/cloud/http.test.ts index cbf75def981ba..6c549c95bdb0d 100644 --- a/apps/server/src/cloud/http.test.ts +++ b/apps/server/src/cloud/http.test.ts @@ -99,7 +99,9 @@ const layerLinkProofRoutes = HttpApiBuilder.layer(LinkProofTestApi).pipe( capabilities: { repositoryIdentity: false }, }), }), - Layer.mock(ManagedEndpointRuntime.CloudManagedEndpointRuntime)({}), + Layer.mock(ManagedEndpointRuntime.CloudManagedEndpointRuntime)({ + withLinkStateLock: (effect) => effect, + }), Layer.mock(CliTokenManager.CloudCliTokenManager)({}), Layer.mock(AgentAwarenessRelay.AgentAwarenessRelay)({}), Layer.mock(HttpServer.HttpServer)({ @@ -300,6 +302,22 @@ describe("link proof over a non-loopback desktop transport", () => { }), ); + it.effect("allows relay writers to set preferences without creating a link", () => + Effect.gen(function* () { + const { post, exchange } = yield* linkProofClient; + const path = "/api/connect/live-activity-preference"; + const payload = { liveActivitiesEnabled: true }; + const readToken = yield* exchange(DESKTOP_BOOTSTRAP_TOKEN, "relay:read"); + const denied = yield* post(path, payload, { authorization: `Bearer ${readToken}` }); + expect(denied.status).toBe(403); + + const writeToken = yield* exchange(DESKTOP_BOOTSTRAP_TOKEN, "relay:write"); + const unlinked = yield* post(path, payload, { authorization: `Bearer ${writeToken}` }); + expect(unlinked.status).toBe(200); + expect(yield* responseJson(unlinked)).toEqual({ ok: false }); + }), + ); + it.effect("requires explicit permission to configure the relay", () => Effect.gen(function* () { const { post, exchange } = yield* linkProofClient; diff --git a/apps/server/src/cloud/http.ts b/apps/server/src/cloud/http.ts index 5b1b3bcba5c6e..17e3956e4411c 100644 --- a/apps/server/src/cloud/http.ts +++ b/apps/server/src/cloud/http.ts @@ -152,6 +152,13 @@ export const layer = HttpApiBuilder.group( Effect.andThen(toHttpError(cloudLink.updatePreferences(payload))), ), ) + .handle("liveActivityPreference", ({ payload }) => + requireEnvironmentScope(AuthRelayWriteScope).pipe( + Effect.andThen( + toHttpError(cloudLink.updateLiveActivityPreference(payload.liveActivitiesEnabled)), + ), + ), + ) .handle("health", ({ payload }) => toHttpError(cloudLink.answerHealthRequest(payload)).pipe( Effect.tap(() => appendCloudCredentialResponseHeaders), diff --git a/infra/relay/src/agentActivity/AgentActivityPublisher.test.ts b/infra/relay/src/agentActivity/AgentActivityPublisher.test.ts index 244bd7ae69d12..e37d4621d20ed 100644 --- a/infra/relay/src/agentActivity/AgentActivityPublisher.test.ts +++ b/infra/relay/src/agentActivity/AgentActivityPublisher.test.ts @@ -106,6 +106,7 @@ function makeEnvironmentLinks( listForUser: () => Effect.succeed([]), getForUser: () => Effect.succeed(null), findActiveManagedForEnvironment: () => Effect.succeed([]), + updateLiveActivityPreference: () => Effect.die("unexpected Live Activity preference update"), setHoldWebhooksWhileOffline: () => Effect.void, revokeForUser: () => Effect.succeed(false), ...overrides, diff --git a/infra/relay/src/agentActivity/FcmDeliveries.test.ts b/infra/relay/src/agentActivity/FcmDeliveries.test.ts index f1ce50d5832b6..5f3ee33aeb1c1 100644 --- a/infra/relay/src/agentActivity/FcmDeliveries.test.ts +++ b/infra/relay/src/agentActivity/FcmDeliveries.test.ts @@ -171,6 +171,7 @@ function harness() { ), listForUser: () => Effect.succeed([]), findActiveManagedForEnvironment: () => Effect.succeed([]), + updateLiveActivityPreference: () => Effect.die("unexpected Live Activity preference update"), setHoldWebhooksWhileOffline: () => Effect.void, revokeForUser: () => Effect.succeed(false), getForUser: (input) => diff --git a/infra/relay/src/agentActivity/MobileRegistrations.test.ts b/infra/relay/src/agentActivity/MobileRegistrations.test.ts index 1865a633d5715..2d17f060703ce 100644 --- a/infra/relay/src/agentActivity/MobileRegistrations.test.ts +++ b/infra/relay/src/agentActivity/MobileRegistrations.test.ts @@ -117,6 +117,7 @@ function makeEnvironmentLinks( listForUser: () => Effect.succeed([]), getForUser: () => Effect.succeed(null), findActiveManagedForEnvironment: () => Effect.succeed([]), + updateLiveActivityPreference: () => Effect.die("unexpected Live Activity preference update"), setHoldWebhooksWhileOffline: () => Effect.void, revokeForUser: () => Effect.succeed(false), ...overrides, diff --git a/infra/relay/src/environments/EnvironmentConnector.test.ts b/infra/relay/src/environments/EnvironmentConnector.test.ts index b08a8b5e951fe..c023703ef3a12 100644 --- a/infra/relay/src/environments/EnvironmentConnector.test.ts +++ b/infra/relay/src/environments/EnvironmentConnector.test.ts @@ -229,6 +229,7 @@ function makeLinks( ...overrides, }), findActiveManagedForEnvironment: () => Effect.succeed([]), + updateLiveActivityPreference: () => Effect.die("unexpected Live Activity preference update"), setHoldWebhooksWhileOffline: () => Effect.void, revokeForUser: () => Effect.succeed(false), }; diff --git a/infra/relay/src/environments/EnvironmentLinker.test.ts b/infra/relay/src/environments/EnvironmentLinker.test.ts index 871764da0123c..40ba2220dbfaa 100644 --- a/infra/relay/src/environments/EnvironmentLinker.test.ts +++ b/infra/relay/src/environments/EnvironmentLinker.test.ts @@ -132,6 +132,8 @@ function layerTest(input?: { listForUser: () => Effect.succeed([]), getForUser: () => Effect.succeed(null), findActiveManagedForEnvironment: () => Effect.succeed([]), + updateLiveActivityPreference: () => + Effect.die("unexpected Live Activity preference update"), setHoldWebhooksWhileOffline: () => Effect.void, revokeForUser: () => Effect.succeed(false), }), diff --git a/infra/relay/src/environments/EnvironmentLinks.test.ts b/infra/relay/src/environments/EnvironmentLinks.test.ts index 52ceb63e87280..a3e982da03c09 100644 --- a/infra/relay/src/environments/EnvironmentLinks.test.ts +++ b/infra/relay/src/environments/EnvironmentLinks.test.ts @@ -64,6 +64,45 @@ describe("EnvironmentLinks", () => { ); }); + it.effect("updates Live Activities only on the matching active link", () => { + const fakeDb = { + update: (table: unknown) => { + expect(table).toBe(relayEnvironmentLinks); + return { + set: (values: Record) => { + expect(values).toEqual({ + liveActivitiesEnabled: false, + updatedAt: expect.any(String), + }); + return { + where: (condition: unknown) => { + const query = new PgDialect().sqlToQuery(condition as never); + expect(query.params).toEqual(["user-1", "env-1", "public-key-1"]); + expect(query.sql).toContain('"relay_environment_links"."revoked_at" is null'); + return { returning: () => Effect.succeed([]) }; + }, + }; + }, + }; + }, + } as unknown as RelayDb.RelayDb["Service"]; + + return Effect.gen(function* () { + const links = yield* EnvironmentLinks.EnvironmentLinks; + const updated = yield* links.updateLiveActivityPreference({ + userId: "user-1", + environmentId: "env-1", + environmentPublicKey: "public-key-1", + liveActivitiesEnabled: false, + }); + expect(updated).toBe(false); + }).pipe( + Effect.provide( + EnvironmentLinks.layer.pipe(Layer.provide(Layer.succeed(RelayDb.RelayDb, fakeDb))), + ), + ); + }); + it.effect("revokes only the active link owned by the requesting user", () => { const updateValues: Array> = []; const whereConditions: Array = []; diff --git a/infra/relay/src/environments/EnvironmentLinks.ts b/infra/relay/src/environments/EnvironmentLinks.ts index 46fcd717a217c..877e50f4f259a 100644 --- a/infra/relay/src/environments/EnvironmentLinks.ts +++ b/infra/relay/src/environments/EnvironmentLinks.ts @@ -145,6 +145,12 @@ export class EnvironmentLinks extends Context.Service< readonly environmentPublicKey: string; readonly holdWebhooksWhileOffline: boolean; }) => Effect.Effect; + readonly updateLiveActivityPreference: (input: { + readonly userId: string; + readonly environmentId: string; + readonly environmentPublicKey: string; + readonly liveActivitiesEnabled: boolean; + }) => Effect.Effect; readonly revokeForUser: (input: { readonly userId: string; readonly environmentId: string; @@ -465,6 +471,36 @@ const make = Effect.gen(function* () { ); }), + updateLiveActivityPreference: Effect.fn( + "relay.environment_links.update_live_activity_preference", + )(function* (input) { + const rows = yield* db + .update(relayEnvironmentLinks) + .set({ + liveActivitiesEnabled: input.liveActivitiesEnabled, + updatedAt: DateTime.formatIso(yield* DateTime.now), + }) + .where( + and( + eq(relayEnvironmentLinks.userId, input.userId), + eq(relayEnvironmentLinks.environmentId, input.environmentId), + eq(relayEnvironmentLinks.environmentPublicKey, input.environmentPublicKey), + isNull(relayEnvironmentLinks.revokedAt), + ), + ) + .returning({ environmentId: relayEnvironmentLinks.environmentId }) + .pipe( + Effect.mapError( + (cause) => + new EnvironmentLinkEnvironmentLookupPersistenceError({ + environmentId: input.environmentId, + cause, + }), + ), + ); + return rows.length > 0; + }), + revokeForUser: Effect.fn("relay.environment_links.revoke_for_user")(function* (input) { yield* Effect.annotateCurrentSpan({ "relay.environment_id": input.environmentId, diff --git a/infra/relay/src/hooks/HeldHooks.test.ts b/infra/relay/src/hooks/HeldHooks.test.ts index 00a4c6bbf382d..f07551b17207e 100644 --- a/infra/relay/src/hooks/HeldHooks.test.ts +++ b/infra/relay/src/hooks/HeldHooks.test.ts @@ -79,6 +79,7 @@ const withService = ( link.environmentPublicKey === input.environmentPublicKey), ), ), + updateLiveActivityPreference: () => Effect.die("unexpected Live Activity preference update"), setHoldWebhooksWhileOffline: () => Effect.void, }), Layer.mock(ManagedEndpointAllocations.ManagedEndpointAllocations, { diff --git a/infra/relay/src/http/Api.test.ts b/infra/relay/src/http/Api.test.ts index 3abb8b28f4d6a..d59df1e172e28 100644 --- a/infra/relay/src/http/Api.test.ts +++ b/infra/relay/src/http/Api.test.ts @@ -538,6 +538,8 @@ function layerRelayUnlinkTest(input?: { listForUser: () => Effect.die("unused listForUser"), getForUser: input?.getForUser ?? (() => Effect.succeed(null)), findActiveManagedForEnvironment: () => Effect.die("unused findActiveManagedForEnvironment"), + updateLiveActivityPreference: () => + Effect.die("unexpected Live Activity preference update"), setHoldWebhooksWhileOffline: () => Effect.die("unused setHoldWebhooksWhileOffline"), revokeForUser: input?.revokeForUser ?? (() => Effect.succeed(false)), }), diff --git a/infra/relay/src/http/Api.ts b/infra/relay/src/http/Api.ts index f06d441c12c48..74d2b5bbd7a6d 100644 --- a/infra/relay/src/http/Api.ts +++ b/infra/relay/src/http/Api.ts @@ -1426,6 +1426,21 @@ export const layerServerApi = HttpApiBuilder.group( return payload; }, mapRelayCommonApiErrors("not_authorized")), ) + .handle( + "updateLiveActivityPreference", + Effect.fn("relay.api.server.updateLiveActivityPreference")(function* ({ params, payload }) { + yield* requireOwnEnvironment(params.environmentId); + const principal = yield* RelayEnvironmentPrincipal; + const links = yield* EnvironmentLinks.EnvironmentLinks; + const ok = yield* links.updateLiveActivityPreference({ + userId: payload.cloudUserId, + environmentId: params.environmentId, + environmentPublicKey: principal.environmentPublicKey, + liveActivitiesEnabled: payload.liveActivitiesEnabled, + }); + return { ok }; + }, mapRelayCommonApiErrors("not_authorized")), + ) .handle( "wakeHeldHooks", Effect.fn("relay.api.server.wakeHeldHooks")(function* ({ params }) { diff --git a/packages/contracts/src/environmentHttp.ts b/packages/contracts/src/environmentHttp.ts index 8b8cc6b97e2c1..859bc701e4273 100644 --- a/packages/contracts/src/environmentHttp.ts +++ b/packages/contracts/src/environmentHttp.ts @@ -1028,6 +1028,14 @@ class EnvironmentConnectHttpApi extends HttpApiGroup.make("connect") error: EnvironmentHttpCloudErrors, }).middleware(EnvironmentAuthenticatedAuth), ) + .add( + HttpApiEndpoint.post("liveActivityPreference", "/api/connect/live-activity-preference", { + headers: OptionalBearerHeaders, + payload: Schema.Struct({ liveActivitiesEnabled: Schema.Boolean }), + success: Schema.Struct({ ok: Schema.Boolean }), + error: EnvironmentHttpCloudErrors, + }).middleware(EnvironmentAuthenticatedAuth), + ) .add( HttpApiEndpoint.post("health", "/api/t3-connect/health", { payload: RelayCloudEnvironmentHealthRequest, diff --git a/packages/contracts/src/relay.ts b/packages/contracts/src/relay.ts index 8ebc9df23a0bb..8dadf2437b8aa 100644 --- a/packages/contracts/src/relay.ts +++ b/packages/contracts/src/relay.ts @@ -1262,6 +1262,19 @@ const RelayServerGroup = HttpApiGroup.make("server") error: RelayAuthAndInternalErrors, }, ).annotate(OpenApi.Summary, "Update an environment's link preferences"), + HttpApiEndpoint.post( + "updateLiveActivityPreference", + "/v1/environments/:environmentId/live-activity-preference", + { + params: Schema.Struct({ environmentId: EnvironmentId }), + payload: Schema.Struct({ + cloudUserId: Schema.String, + liveActivitiesEnabled: Schema.Boolean, + }), + success: RelayOkResponse, + error: RelayAuthAndInternalErrors, + }, + ), HttpApiEndpoint.post("wakeHeldHooks", "/v1/environments/:environmentId/hooks/wake", { params: Schema.Struct({ environmentId: EnvironmentId }), success: RelayWakeHeldHooksResponse, From 1d04fdff41384c963bc92e2258f01cd78a10597c Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 16 Nov 2026 17:34:06 -0800 Subject: [PATCH 06/14] test(relay): verify live activity preference row isolation --- .../src/environments/EnvironmentLinks.test.ts | 124 ++++++++++++------ 1 file changed, 87 insertions(+), 37 deletions(-) diff --git a/infra/relay/src/environments/EnvironmentLinks.test.ts b/infra/relay/src/environments/EnvironmentLinks.test.ts index a3e982da03c09..46e26f4a76549 100644 --- a/infra/relay/src/environments/EnvironmentLinks.test.ts +++ b/infra/relay/src/environments/EnvironmentLinks.test.ts @@ -1,6 +1,12 @@ +import * as NodeServices from "@effect/platform-node/NodeServices"; +import { PGlite } from "@electric-sql/pglite"; +import { drizzle } from "drizzle-orm/pglite"; +import * as FileSystem from "effect/FileSystem"; +import * as Path from "effect/Path"; import { describe, expect, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; +import type { SQL } from "drizzle-orm"; import { PgDialect } from "drizzle-orm/pg-core"; import * as RelayDb from "../db.ts"; @@ -64,44 +70,88 @@ describe("EnvironmentLinks", () => { ); }); - it.effect("updates Live Activities only on the matching active link", () => { - const fakeDb = { - update: (table: unknown) => { - expect(table).toBe(relayEnvironmentLinks); - return { - set: (values: Record) => { - expect(values).toEqual({ - liveActivitiesEnabled: false, - updatedAt: expect.any(String), - }); - return { - where: (condition: unknown) => { - const query = new PgDialect().sqlToQuery(condition as never); - expect(query.params).toEqual(["user-1", "env-1", "public-key-1"]); - expect(query.sql).toContain('"relay_environment_links"."revoked_at" is null'); - return { returning: () => Effect.succeed([]) }; - }, - }; - }, - }; - }, - } as unknown as RelayDb.RelayDb["Service"]; + it.effect("updates Live Activities only on the matching active link", () => + Effect.gen(function* () { + const pg = yield* Effect.acquireRelease( + Effect.promise(() => PGlite.create()), + (client) => Effect.promise(() => client.close()), + ); + const fs = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + const migrationsDir = yield* path.fromFileUrl( + new URL("../../migrations/postgres/", import.meta.url), + ); + for (const name of (yield* fs.readDirectory(migrationsDir)).toSorted()) { + const migration = yield* fs.readFileString(`${migrationsDir}${name}/migration.sql`); + yield* Effect.promise(() => pg.exec(migration)); + } - return Effect.gen(function* () { - const links = yield* EnvironmentLinks.EnvironmentLinks; - const updated = yield* links.updateLiveActivityPreference({ - userId: "user-1", - environmentId: "env-1", - environmentPublicKey: "public-key-1", - liveActivitiesEnabled: false, - }); - expect(updated).toBe(false); - }).pipe( - Effect.provide( - EnvironmentLinks.layer.pipe(Layer.provide(Layer.succeed(RelayDb.RelayDb, fakeDb))), - ), - ); - }); + const db = drizzle({ client: pg }); + const matching = { userId: "user-1", environmentId: "env-1", environmentPublicKey: "key-1" }; + const revoked = { ...matching, environmentId: "revoked-env" }; + const timestamp = "2026-01-01T00:00:00.000Z"; + const rows = [ + matching, + { ...matching, userId: "user-2" }, + { ...matching, environmentId: "env-2" }, + { ...matching, userId: "user-3", environmentPublicKey: "key-2" }, + { ...revoked, revokedAt: timestamp }, + ]; + yield* Effect.promise(() => + db.insert(relayEnvironmentLinks).values( + rows.map((row) => ({ + ...row, + endpointHttpBaseUrl: "https://environment.test", + endpointWsBaseUrl: "wss://environment.test", + endpointProviderKind: "cloudflare_tunnel", + createdAt: timestamp, + updatedAt: timestamp, + })), + ), + ); + // PGlite returns promises where the production Drizzle driver returns Effects. + const effectDb = { + update: (table: typeof relayEnvironmentLinks) => ({ + set: (values: Partial) => ({ + where: (condition: SQL | undefined) => ({ + returning: (fields: { environmentId: typeof relayEnvironmentLinks.environmentId }) => + Effect.promise(() => + db.update(table).set(values).where(condition).returning(fields), + ), + }), + }), + }), + } as unknown as RelayDb.RelayDb["Service"]; + const links = yield* Effect.service(EnvironmentLinks.EnvironmentLinks).pipe( + Effect.provide( + EnvironmentLinks.layer.pipe(Layer.provide(Layer.succeed(RelayDb.RelayDb, effectDb))), + ), + ); + expect( + yield* links.updateLiveActivityPreference({ ...matching, liveActivitiesEnabled: false }), + ).toBe(true); + expect( + yield* links.updateLiveActivityPreference({ + ...matching, + environmentPublicKey: "key-2", + liveActivitiesEnabled: false, + }), + ).toBe(false); + expect( + yield* links.updateLiveActivityPreference({ ...revoked, liveActivitiesEnabled: false }), + ).toBe(false); + + const updated = yield* Effect.promise(() => db.select().from(relayEnvironmentLinks)); + expect( + updated + .filter((row) => !row.liveActivitiesEnabled) + .map(({ userId, environmentId }) => ({ + userId, + environmentId, + })), + ).toEqual([{ userId: matching.userId, environmentId: matching.environmentId }]); + }).pipe(Effect.provide(NodeServices.layer)), + ); it.effect("revokes only the active link owned by the requesting user", () => { const updateValues: Array> = []; From 107a1de9f2c192faa5287583a21370708a716b45 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 13:27:38 -0800 Subject: [PATCH 07/14] fix(connect): preserve translated permission copy after rebase --- apps/mobile/src/features/cloud/linkEnvironment.ts | 10 ++++++++-- .../settings/SettingsNotificationsRouteScreen.tsx | 10 ++++++++-- .../src/components/cloud/ConnectOnboardingDialog.tsx | 5 +---- .../components/settings/AuthorizedClientsSettings.tsx | 7 ++++--- packages/shared/src/authScopeOptions.ts | 4 +++- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/apps/mobile/src/features/cloud/linkEnvironment.ts b/apps/mobile/src/features/cloud/linkEnvironment.ts index cb08a02551331..639c9e1146dad 100644 --- a/apps/mobile/src/features/cloud/linkEnvironment.ts +++ b/apps/mobile/src/features/cloud/linkEnvironment.ts @@ -187,12 +187,18 @@ export const updateLinkedEnvironmentLiveActivityPreference = Effect.fn( return result.ok; } return yield* new CloudEnvironmentLinkError({ - message: `Environment returned HTTP ${response.status}.`, + message: m(msg("Environment returned HTTP {status}."), { status: response.status }), }); }), ), Effect.mapError( - cloudEnvironmentLinkError("Could not update the environment's Live Activity preference."), + cloudEnvironmentLinkError( + m(msg("Could not update the environment's Live Activity preference.")), + (detail) => + m(msg("Could not update the environment's Live Activity preference: {detail}"), { + detail, + }), + ), ), ); }); diff --git a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx index 9105af80d1efa..ef285c08a5940 100644 --- a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx @@ -2,7 +2,11 @@ import { errorDisplayMessage } from "@t3tools/client-runtime/errors"; import { useGT, useMessages } from "gt-react-native"; import * as Dialog from "../../components/ui/Dialog"; import { managedCapabilityDenial } from "@t3tools/client-runtime/contract-labels"; -import { AuthRelayConfigureScope, AuthRelayWriteScope, type EnvironmentId } from "@t3tools/contracts"; +import { + AuthRelayConfigureScope, + AuthRelayWriteScope, + type EnvironmentId, +} from "@t3tools/contracts"; import { readEnvironmentScope } from "../../state/session"; import { appAtomRegistry } from "../../state/atom-registry"; import { serverEnvironment } from "../../state/server"; @@ -353,7 +357,9 @@ function ConfiguredSettingsNotificationsRouteScreen() { Platform.OS === "android" ? gt("Ongoing activity enabled") : gt("Live Activities enabled"), environmentCount > 0 ? gt("Agent activity updates are enabled for eligible environments.") - : gt("Agent activity updates are enabled. Add an environment to start receiving updates."), + : gt( + "Agent activity updates are enabled. Add an environment to start receiving updates.", + ), ); } else { Dialog.alert( diff --git a/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx b/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx index 8d5e9de815aa8..f200c45f6e710 100644 --- a/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx +++ b/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx @@ -1,10 +1,7 @@ import { useAuth } from "@clerk/react"; import { useAtomValue } from "@effect/atom-react"; import { managedCapabilityDenial } from "@t3tools/client-runtime/contract-labels"; -import { - AuthAccessWriteScope, - type AuthSessionState, -} from "@t3tools/contracts"; +import { AuthAccessWriteScope, type AuthSessionState } from "@t3tools/contracts"; import { AsyncResult, Atom } from "effect/reactivity"; import { msg, T, useGT, useMessages } from "gt-react"; import { useState } from "react"; diff --git a/apps/web/src/components/settings/AuthorizedClientsSettings.tsx b/apps/web/src/components/settings/AuthorizedClientsSettings.tsx index e92a2cfec600c..f308532748c96 100644 --- a/apps/web/src/components/settings/AuthorizedClientsSettings.tsx +++ b/apps/web/src/components/settings/AuthorizedClientsSettings.tsx @@ -799,13 +799,14 @@ export const AuthorizedClientsHeaderAction = memo(function AuthorizedClientsHead {terminalSelected && scope === AuthTerminalOperateScope ? ( - Terminal commands can read or change files within the server account’s - permissions. + {gt( + "Terminal commands can read or change files within the server account’s permissions.", + )} ) : null} {relayAdminSelected && scope === AuthRelayConfigureScope ? ( - This client can change who can issue pairing credentials. + {gt("This client can change who can issue pairing credentials.")} ) : null} diff --git a/packages/shared/src/authScopeOptions.ts b/packages/shared/src/authScopeOptions.ts index 299450563a2d2..fd5ee5d7985e8 100644 --- a/packages/shared/src/authScopeOptions.ts +++ b/packages/shared/src/authScopeOptions.ts @@ -109,7 +109,9 @@ export const AUTH_SCOPE_OPTIONS: ReadonlyArray<{ { scope: AuthRelayConfigureScope, title: msg("Configure relay (admin)"), - description: msg("Set up or replace T3 Connect, including its trusted pairing credential issuer."), + description: msg( + "Set up or replace T3 Connect, including its trusted pairing credential issuer.", + ), }, ]; From 85dfb42dee6bd3afe041983910b122537ed8de2e Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 13:32:46 -0800 Subject: [PATCH 08/14] fix(mobile): report Live Activity updates skipped by older servers --- .../liveActivityPreferences.test.ts | 22 +++++++++++++++++-- .../liveActivityPreferences.ts | 21 +++++++++--------- .../src/features/cloud/linkEnvironment.ts | 6 ++--- .../SettingsNotificationsRouteScreen.tsx | 17 +++++++++++++- 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts index dcb28fad75a4a..a77f83efcd1e1 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts @@ -35,7 +35,7 @@ vi.mock("expo-device", () => ({})); vi.mock("../cloud/linkEnvironment", async (importOriginal) => ({ ...(await importOriginal()), linkEnvironmentToCloudWithPreference: vi.fn(() => Effect.void), - updateLinkedEnvironmentLiveActivityPreference: vi.fn(() => Effect.succeed(true)), + updateLinkedEnvironmentLiveActivityPreference: vi.fn(() => Effect.succeed("updated" as const)), })); vi.mock("./remoteRegistration", () => ({ @@ -117,7 +117,7 @@ describe("liveActivityPreferences", () => { it.effect("only creates missing links when the session can configure Connect", () => { vi.mocked(updateLinkedEnvironmentLiveActivityPreference).mockReturnValueOnce( - Effect.succeed(false), + Effect.succeed("unlinked" as const), ); const readOnlyConnection: SavedRemoteConnection = { ...connection, @@ -145,6 +145,24 @@ describe("liveActivityPreferences", () => { }).pipe(Effect.provide(layerTest)); }); + it.effect("reports older environments whose preferences could not be updated", () => + Effect.gen(function* () { + vi.mocked(updateLinkedEnvironmentLiveActivityPreference).mockReturnValueOnce( + Effect.succeed("unsupported"), + ); + const partial = yield* setLiveActivityUpdatesEnabled({ + enabled: false, + previousEnabled: true, + clerkToken: "clerk-token", + connections: [connection], + canConfigureEnvironment: () => false, + canUpdateEnvironment: () => true, + }); + expect(partial).toBe(true); + expect(linkEnvironmentToCloudWithPreference).not.toHaveBeenCalled(); + }).pipe(Effect.provide(layerTest)), + ); + it.effect("checks current relay access after updating the device registration", () => { let canConfigureEnvironment = true; vi.mocked(updateAgentAwarenessRegistrationPreferences).mockImplementationOnce(() => diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts index aef244e221673..679af851ba933 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts @@ -26,20 +26,20 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn enabled: boolean, clerkToken: string | null, ) { - if ( - input.canUpdateEnvironment(connection.environmentId) && - (yield* updateLinkedEnvironmentLiveActivityPreference(connection, enabled)) - ) { - return; + const result = input.canUpdateEnvironment(connection.environmentId) + ? yield* updateLinkedEnvironmentLiveActivityPreference(connection, enabled) + : "unlinked"; + if (result === "updated") return false; + if (!enabled || !clerkToken || !input.canConfigureEnvironment(connection.environmentId)) { + return result === "unsupported"; } - if (!enabled || !clerkToken || !input.canConfigureEnvironment(connection.environmentId)) - return; yield* linkEnvironmentToCloudWithPreference({ clerkToken, connection, liveActivitiesEnabled: enabled, }); + return false; }); const updateRelayPreference = Effect.fn("updateRelayPreference")(function* (enabled: boolean) { @@ -48,13 +48,14 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn }); const clerkToken = input.clerkToken; - if (!clerkToken) return; + if (!clerkToken) return false; - yield* Effect.forEach( + const results = yield* Effect.forEach( linkedConnections, (connection) => updateEnvironmentPreference(connection, enabled, clerkToken), { concurrency: "unbounded" }, ); + return results.some(Boolean); }); const restoreRelayPreference = Effect.fn("restoreRelayPreference")(function* () { @@ -84,7 +85,7 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn ); }); - yield* updateRelayPreference(input.enabled).pipe( + return yield* updateRelayPreference(input.enabled).pipe( Effect.onError(() => restoreRelayPreference()), ); }, diff --git a/apps/mobile/src/features/cloud/linkEnvironment.ts b/apps/mobile/src/features/cloud/linkEnvironment.ts index 639c9e1146dad..68a3ff4cba990 100644 --- a/apps/mobile/src/features/cloud/linkEnvironment.ts +++ b/apps/mobile/src/features/cloud/linkEnvironment.ts @@ -168,7 +168,7 @@ const decodeRelayOkResponse = Schema.decodeUnknownEffect(RelayOkResponse); export const updateLinkedEnvironmentLiveActivityPreference = Effect.fn( "linkEnvironment.updateLinkedEnvironmentLiveActivityPreference", )(function* (connection: SavedRemoteConnection, liveActivitiesEnabled: boolean) { - if (!connection.bearerToken) return false; + if (!connection.bearerToken) return "unlinked" as const; const client = yield* makeEnvironmentHttpApiClient(connection.httpBaseUrl); return yield* client.connect @@ -180,11 +180,11 @@ export const updateLinkedEnvironmentLiveActivityPreference = Effect.fn( .pipe( Effect.flatMap((response) => Effect.gen(function* () { - if (response.status === 404) return false; + if (response.status === 404) return "unsupported" as const; if (response.status === 200) { const json = yield* response.json; const result = yield* decodeRelayOkResponse(json); - return result.ok; + return result.ok ? ("updated" as const) : ("unlinked" as const); } return yield* new CloudEnvironmentLinkError({ message: m(msg("Environment returned HTTP {status}."), { status: response.status }), diff --git a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx index ef285c08a5940..92e7ca3714b6b 100644 --- a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx @@ -352,7 +352,14 @@ function ConfiguredSettingsNotificationsRouteScreen() { refreshManagedRelayEnvironments(); setLiveActivityStatus("enabled"); // Environment linking can precede device registration; only registered devices can receive Live Activities. - if (getAgentAwarenessRegistrationStatus() === "registered") { + if (updateResult.value) { + Dialog.alert( + gt("Some environments need an update"), + gt( + "The device preference was saved. Update older environment servers to apply the setting there.", + ), + ); + } else if (getAgentAwarenessRegistrationStatus() === "registered") { Dialog.alert( Platform.OS === "android" ? gt("Ongoing activity enabled") : gt("Live Activities enabled"), environmentCount > 0 @@ -428,6 +435,14 @@ function ConfiguredSettingsNotificationsRouteScreen() { savePreferences({ liveActivitiesEnabled: false }); refreshManagedRelayEnvironments(); setLiveActivityStatus("disabled"); + if (updateResult.value) { + Dialog.alert( + gt("Some environments need an update"), + gt( + "The device preference was saved. Update older environment servers to apply the setting there.", + ), + ); + } } // Both writers settle their own failures, so awaiting them never throws. From cb2fd31e05d401510ea3927c33ebe16c59acd7ca Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 13:40:31 -0800 Subject: [PATCH 09/14] fix(i18n): translate Connect permission and preference messages --- apps/mobile/src/i18n/translations/de.json | 11 +++++++++-- apps/mobile/src/i18n/translations/en.json | 11 +++++++++-- apps/mobile/src/i18n/translations/es.json | 11 +++++++++-- apps/mobile/src/i18n/translations/fr.json | 11 +++++++++-- apps/mobile/src/i18n/translations/ja.json | 11 +++++++++-- apps/mobile/src/i18n/translations/ko.json | 11 +++++++++-- apps/mobile/src/i18n/translations/pt-BR.json | 11 +++++++++-- apps/mobile/src/i18n/translations/ru.json | 11 +++++++++-- apps/mobile/src/i18n/translations/sv.json | 11 +++++++++-- apps/mobile/src/i18n/translations/zh.json | 11 +++++++++-- apps/web/src/i18n/translations/de.json | 6 +++++- apps/web/src/i18n/translations/en.json | 6 +++++- apps/web/src/i18n/translations/es.json | 6 +++++- apps/web/src/i18n/translations/fr.json | 6 +++++- apps/web/src/i18n/translations/ja.json | 6 +++++- apps/web/src/i18n/translations/ko.json | 6 +++++- apps/web/src/i18n/translations/pt-BR.json | 6 +++++- apps/web/src/i18n/translations/ru.json | 6 +++++- apps/web/src/i18n/translations/sv.json | 6 +++++- apps/web/src/i18n/translations/zh.json | 6 +++++- 20 files changed, 140 insertions(+), 30 deletions(-) diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index c9d43d96b3eb8..fb9d425cad1a4 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Relay ansehen", "566b6a4f83192c13": "Die Konnektivität des verwalteten Relays prüfen.", "725b0d37325acdff": "Relay verwalten", - "d89418e289b38f62": "Die Konnektivität des verwalteten Tunnels ändern.", + "61c9874c98415329": "Relay-Einstellungen ändern oder T3 Connect trennen.", + "3c85ec9cc2a6d25c": "Relay konfigurieren (Admin)", + "7f979acc0e1ee320": "T3 Connect einrichten oder ersetzen, einschließlich der vertrauenswürdigen Stelle, die Kopplungsdaten ausstellt.", "cea8105b6e4e1703": "Verbinde dich mit dieser Umgebung, um die Berechtigungen dieser Sitzung zu sehen.", "3e5da15fb9653bc6": "Diese Umgebung hat deine Sitzung nicht akzeptiert. Verbinde dich erneut, um es noch einmal zu versuchen.", "7f2181cbb5edc3f3": "Deine Berechtigungen konnten nicht überprüft werden. Wird automatisch erneut versucht.", @@ -1829,6 +1831,9 @@ "b27e256eea29c823": "Relay-URL ist nicht konfiguriert.", "bd2a0460b58f2ee0": "Das Relay hat Anmeldedaten für eine andere Umgebung zurückgegeben.", "df614296bc5e624f": "Das Relay hat Anmeldedaten für einen anderen Endpunktanbieter zurückgegeben.", + "c15d8570b0ac8ae5": "Die Umgebung meldete HTTP {status}.", + "b87f2217123b4cbf": "Die Live-Aktivitätseinstellung der Umgebung konnte nicht geändert werden.", + "2f18d65ea9f178da": "Die Live-Aktivitätseinstellung der Umgebung konnte nicht geändert werden: {detail}", "024b0e4154ca9170": "Nur eine lokal gekoppelte Bearer-Verbindung kann mit der Cloud verknüpft werden.", "52c4bcf188d1af36": "Die ID des Mobilgeräts konnte nicht geladen werden.", "473457b89661c874": "Die ID des Mobilgeräts konnte nicht geladen werden: {detail}", @@ -3268,9 +3273,11 @@ "c5e8c33c81298771": "Aktiviere Benachrichtigungen in den Systemeinstellungen, um laufende Agentenaktivität anzuzeigen.", "92eadafb24868a2b": "Live-Aktivitäten nicht verfügbar", "06fdc3a2762b7d11": "Updates zur Agentenaktivität konnten nicht aktiviert werden.", + "9ab5b1b388c83bd4": "Einige Umgebungen benötigen ein Update", + "e234f4ae749208cc": "Die Geräteeinstellung wurde gespeichert. Aktualisiere ältere Umgebungsserver, um die Einstellung auch dort anzuwenden.", "de02acb5424cf89b": "Laufende Aktivität aktiviert", "ada8c7c0bd1538d9": "Live-Aktivitäten aktiviert", - "15774de43601ae0a": "Updates zur Agentenaktivität sind für Umgebungen aktiviert, die diese Verbindung konfigurieren kann.", + "7641156da4b89c8e": "Agentenaktivitäten werden für geeignete Umgebungen angezeigt.", "f95faa78fdce049f": "Updates zur Agentenaktivität sind aktiviert. Füge eine Umgebung hinzu, um Updates zu erhalten.", "abec148ed1b71b11": "Aktivieren der Aktivitäts-Updates konnte nicht abgeschlossen werden", "0aecb0b05ccd394e": "Dieses Gerät konnte nicht bei {product} registriert werden, daher erscheinen noch keine Aktivitäts-Updates. Sie starten, sobald die Registrierung erfolgreich ist.", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index 7a89a1cf37c22..8e2cbfb62e73c 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "View relay", "566b6a4f83192c13": "Inspect managed relay connectivity.", "725b0d37325acdff": "Manage relay", - "d89418e289b38f62": "Change managed tunnel connectivity.", + "61c9874c98415329": "Update relay preferences or unlink T3 Connect.", + "3c85ec9cc2a6d25c": "Configure relay (admin)", + "7f979acc0e1ee320": "Set up or replace T3 Connect, including its trusted pairing credential issuer.", "cea8105b6e4e1703": "Connect to this environment to view this session’s permissions.", "3e5da15fb9653bc6": "This environment did not accept your session. Reconnect to try again.", "7f2181cbb5edc3f3": "Could not verify your permissions. Retrying automatically.", @@ -1829,6 +1831,9 @@ "b27e256eea29c823": "Relay URL is not configured.", "bd2a0460b58f2ee0": "Relay returned credentials for a different environment.", "df614296bc5e624f": "Relay returned credentials for a different endpoint provider.", + "c15d8570b0ac8ae5": "Environment returned HTTP {status}.", + "b87f2217123b4cbf": "Could not update the environment's Live Activity preference.", + "2f18d65ea9f178da": "Could not update the environment's Live Activity preference: {detail}", "024b0e4154ca9170": "Only a locally paired bearer connection can be linked to the cloud.", "52c4bcf188d1af36": "Could not load the mobile device id.", "473457b89661c874": "Could not load the mobile device id: {detail}", @@ -3269,9 +3274,11 @@ "c5e8c33c81298771": "Enable notifications in system Settings to show ongoing agent activity.", "92eadafb24868a2b": "Live Activities unavailable", "06fdc3a2762b7d11": "Could not enable agent activity updates.", + "9ab5b1b388c83bd4": "Some environments need an update", + "e234f4ae749208cc": "The device preference was saved. Update older environment servers to apply the setting there.", "de02acb5424cf89b": "Ongoing activity enabled", "ada8c7c0bd1538d9": "Live Activities enabled", - "15774de43601ae0a": "Agent activity updates are enabled for environments this connection can configure.", + "7641156da4b89c8e": "Agent activity updates are enabled for eligible environments.", "f95faa78fdce049f": "Agent activity updates are enabled. Add an environment to start receiving updates.", "abec148ed1b71b11": "Couldn't finish enabling activity updates", "0aecb0b05ccd394e": "This device could not be registered with {product}, so activity updates won't appear yet. They'll start once registration succeeds.", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 288dbfc7da2cf..ef28f0e1d11c7 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Ver relay", "566b6a4f83192c13": "Inspeccionar la conectividad del relay gestionado.", "725b0d37325acdff": "Gestionar relay", - "d89418e289b38f62": "Cambiar la conectividad del túnel gestionado.", + "61c9874c98415329": "Cambia las preferencias del relé o desvincula T3 Connect.", + "3c85ec9cc2a6d25c": "Configurar relé (administrador)", + "7f979acc0e1ee320": "Configura o reemplaza T3 Connect, incluido el emisor de confianza de credenciales de emparejamiento.", "cea8105b6e4e1703": "Conéctate a este entorno para ver los permisos de esta sesión.", "3e5da15fb9653bc6": "Este entorno no aceptó tu sesión. Vuelve a conectar para intentarlo de nuevo.", "7f2181cbb5edc3f3": "No se pudieron verificar tus permisos. Reintentando automáticamente.", @@ -1829,6 +1831,9 @@ "b27e256eea29c823": "La URL del relay no está configurada.", "bd2a0460b58f2ee0": "El relay devolvió credenciales de otro entorno.", "df614296bc5e624f": "El relay devolvió credenciales de otro proveedor de endpoint.", + "c15d8570b0ac8ae5": "El entorno devolvió HTTP {status}.", + "b87f2217123b4cbf": "No se pudo actualizar la preferencia de actividades en directo del entorno.", + "2f18d65ea9f178da": "No se pudo actualizar la preferencia de actividades en directo del entorno: {detail}", "024b0e4154ca9170": "Solo se puede vincular a la nube una conexión bearer emparejada localmente.", "52c4bcf188d1af36": "No se pudo cargar el ID del dispositivo móvil.", "473457b89661c874": "No se pudo cargar el ID del dispositivo móvil: {detail}", @@ -3263,9 +3268,11 @@ "c5e8c33c81298771": "Activa las notificaciones en los ajustes del sistema para mostrar la actividad de agentes en curso.", "92eadafb24868a2b": "Actividades en directo no disponibles", "06fdc3a2762b7d11": "No se pudieron activar las actualizaciones de actividad de agentes.", + "9ab5b1b388c83bd4": "Algunos entornos necesitan una actualización", + "e234f4ae749208cc": "Se guardó la preferencia del dispositivo. Actualiza los servidores de entornos antiguos para aplicarles la preferencia.", "de02acb5424cf89b": "Actividad en curso activada", "ada8c7c0bd1538d9": "Actividades en directo activadas", - "15774de43601ae0a": "Las actualizaciones de actividad de agentes están activadas para los entornos que esta conexión puede configurar.", + "7641156da4b89c8e": "Las actualizaciones de actividad de los agentes están habilitadas en los entornos compatibles.", "f95faa78fdce049f": "Las actualizaciones de actividad de agentes están activadas. Añade un entorno para empezar a recibirlas.", "abec148ed1b71b11": "No se pudo terminar de activar las actualizaciones de actividad", "0aecb0b05ccd394e": "No se pudo registrar este dispositivo en {product}, así que aún no aparecerán actualizaciones de actividad. Empezarán cuando el registro se complete.", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 28ec2284fca74..535af5a6a9ab9 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Voir le relais", "566b6a4f83192c13": "Inspecter la connectivité du relais géré.", "725b0d37325acdff": "Gérer le relais", - "d89418e289b38f62": "Modifier la connectivité du tunnel géré.", + "61c9874c98415329": "Modifier les préférences du relais ou dissocier T3 Connect.", + "3c85ec9cc2a6d25c": "Configurer le relais (admin)", + "7f979acc0e1ee320": "Configurer ou remplacer T3 Connect, y compris son émetteur de confiance d’identifiants d’appairage.", "cea8105b6e4e1703": "Connectez-vous à cet environnement pour voir les autorisations de cette session.", "3e5da15fb9653bc6": "Cet environnement n’a pas accepté votre session. Reconnectez-vous pour réessayer.", "7f2181cbb5edc3f3": "Impossible de vérifier vos autorisations. Nouvelle tentative automatique.", @@ -1829,6 +1831,9 @@ "b27e256eea29c823": "L’URL du relais n’est pas configurée.", "bd2a0460b58f2ee0": "Le relais a renvoyé des identifiants pour un autre environnement.", "df614296bc5e624f": "Le relais a renvoyé des identifiants pour un autre fournisseur de point de terminaison.", + "c15d8570b0ac8ae5": "L’environnement a renvoyé HTTP {status}.", + "b87f2217123b4cbf": "Impossible de mettre à jour la préférence d’activités en direct de l’environnement.", + "2f18d65ea9f178da": "Impossible de mettre à jour la préférence d’activités en direct de l’environnement : {detail}", "024b0e4154ca9170": "Seule une connexion bearer appairée localement peut être associée au cloud.", "52c4bcf188d1af36": "Impossible de charger l’ID de l’appareil mobile.", "473457b89661c874": "Impossible de charger l’ID de l’appareil mobile : {detail}", @@ -3263,9 +3268,11 @@ "c5e8c33c81298771": "Activez les notifications dans les Réglages du système pour afficher l’activité en cours des agents.", "92eadafb24868a2b": "Live Activities indisponibles", "06fdc3a2762b7d11": "Impossible d’activer les mises à jour de l’activité des agents.", + "9ab5b1b388c83bd4": "Certains environnements doivent être mis à jour", + "e234f4ae749208cc": "La préférence de l’appareil a été enregistrée. Mettez à jour les anciens serveurs d’environnement pour l’y appliquer.", "de02acb5424cf89b": "Activité en cours activée", "ada8c7c0bd1538d9": "Live Activities activées", - "15774de43601ae0a": "Les mises à jour de l’activité des agents sont activées pour les environnements que cette connexion peut configurer.", + "7641156da4b89c8e": "Les mises à jour d’activité des agents sont activées pour les environnements compatibles.", "f95faa78fdce049f": "Les mises à jour de l’activité des agents sont activées. Ajoutez un environnement pour commencer à les recevoir.", "abec148ed1b71b11": "Impossible de terminer l’activation des mises à jour d’activité", "0aecb0b05ccd394e": "Cet appareil n’a pas pu être inscrit auprès de {product}, les mises à jour d’activité n’apparaîtront donc pas encore. Elles commenceront dès que l’inscription aura réussi.", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index f6741fdb8b775..5be1c8cf5c4ed 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "リレーの表示", "566b6a4f83192c13": "マネージドリレーの接続状態を確認します。", "725b0d37325acdff": "リレーの管理", - "d89418e289b38f62": "マネージドトンネルの接続を変更します。", + "61c9874c98415329": "リレー設定を更新するか、T3 Connect のリンクを解除します。", + "3c85ec9cc2a6d25c": "リレーを設定(管理者)", + "7f979acc0e1ee320": "T3 Connect と、信頼できるペアリング認証情報の発行元を設定または変更します。", "cea8105b6e4e1703": "このセッションの権限を表示するには、この環境に接続してください。", "3e5da15fb9653bc6": "この環境はセッションを受け付けませんでした。再接続してもう一度お試しください。", "7f2181cbb5edc3f3": "権限を確認できませんでした。自動的に再試行しています。", @@ -1829,6 +1831,9 @@ "b27e256eea29c823": "リレー URL が設定されていません。", "bd2a0460b58f2ee0": "リレーが別の環境の資格情報を返しました。", "df614296bc5e624f": "リレーが別のエンドポイントプロバイダーの資格情報を返しました。", + "c15d8570b0ac8ae5": "環境から HTTP {status} が返されました。", + "b87f2217123b4cbf": "環境のライブアクティビティ設定を更新できませんでした。", + "2f18d65ea9f178da": "環境のライブアクティビティ設定を更新できませんでした: {detail}", "024b0e4154ca9170": "クラウドにリンクできるのは、ローカルでペアリングしたベアラー接続のみです。", "52c4bcf188d1af36": "モバイルデバイスの ID を読み込めませんでした。", "473457b89661c874": "モバイルデバイスの ID を読み込めませんでした: {detail}", @@ -3260,9 +3265,11 @@ "c5e8c33c81298771": "進行中のエージェントのアクティビティを表示するには、システムの設定で通知を有効にしてください。", "92eadafb24868a2b": "ライブアクティビティを利用できません", "06fdc3a2762b7d11": "エージェントのアクティビティの更新を有効にできませんでした。", + "9ab5b1b388c83bd4": "一部の環境は更新が必要です", + "e234f4ae749208cc": "デバイスの設定を保存しました。古い環境サーバーにも設定を適用するには、サーバーを更新してください。", "de02acb5424cf89b": "進行中のアクティビティを有効にしました", "ada8c7c0bd1538d9": "ライブアクティビティを有効にしました", - "15774de43601ae0a": "この接続で設定できる環境について、エージェントのアクティビティの更新が有効になりました。", + "7641156da4b89c8e": "対象の環境ではエージェントのアクティビティ更新が有効です。", "f95faa78fdce049f": "エージェントのアクティビティの更新が有効になりました。更新の受信を開始するには環境を追加してください。", "abec148ed1b71b11": "アクティビティの更新の有効化を完了できませんでした", "0aecb0b05ccd394e": "このデバイスを {product} に登録できなかったため、アクティビティの更新はまだ表示されません。登録が成功すると表示されるようになります。", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index b1ef20ba0f347..9ac58d1324875 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "릴레이 보기", "566b6a4f83192c13": "관리형 릴레이 연결 상태를 확인합니다.", "725b0d37325acdff": "릴레이 관리", - "d89418e289b38f62": "관리형 터널 연결을 변경합니다.", + "61c9874c98415329": "릴레이 환경설정을 변경하거나 T3 Connect 연결을 해제합니다.", + "3c85ec9cc2a6d25c": "릴레이 구성(관리자)", + "7f979acc0e1ee320": "T3 Connect와 신뢰할 수 있는 페어링 자격 증명 발급자를 설정하거나 교체합니다.", "cea8105b6e4e1703": "이 세션의 권한을 보려면 이 환경에 연결하세요.", "3e5da15fb9653bc6": "이 환경에서 세션을 수락하지 않았습니다. 다시 연결해 보세요.", "7f2181cbb5edc3f3": "권한을 확인할 수 없습니다. 자동으로 다시 시도합니다.", @@ -1830,6 +1832,9 @@ "b27e256eea29c823": "릴레이 URL이 구성되지 않았습니다.", "bd2a0460b58f2ee0": "릴레이가 다른 환경의 자격 증명을 반환했습니다.", "df614296bc5e624f": "릴레이가 다른 엔드포인트 제공자의 자격 증명을 반환했습니다.", + "c15d8570b0ac8ae5": "환경에서 HTTP {status}를 반환했습니다.", + "b87f2217123b4cbf": "환경의 실시간 현황 설정을 업데이트하지 못했습니다.", + "2f18d65ea9f178da": "환경의 실시간 현황 설정을 업데이트하지 못했습니다: {detail}", "024b0e4154ca9170": "로컬로 페어링된 bearer 연결만 클라우드에 연결할 수 있습니다.", "52c4bcf188d1af36": "모바일 기기 ID를 불러올 수 없습니다.", "473457b89661c874": "모바일 기기 ID를 불러올 수 없습니다: {detail}", @@ -3264,9 +3269,11 @@ "c5e8c33c81298771": "진행 중인 에이전트 활동을 표시하려면 시스템 설정에서 알림을 허용하세요.", "92eadafb24868a2b": "실시간 현황을 사용할 수 없음", "06fdc3a2762b7d11": "에이전트 활동 업데이트를 사용할 수 없습니다.", + "9ab5b1b388c83bd4": "일부 환경을 업데이트해야 합니다", + "e234f4ae749208cc": "기기 설정이 저장되었습니다. 이전 환경 서버에도 설정을 적용하려면 해당 서버를 업데이트하세요.", "de02acb5424cf89b": "진행 중인 활동 사용", "ada8c7c0bd1538d9": "실시간 현황 사용", - "15774de43601ae0a": "이 연결로 구성할 수 있는 환경에 대해 에이전트 활동 업데이트를 사용합니다.", + "7641156da4b89c8e": "지원되는 환경에서 에이전트 활동 업데이트가 활성화되어 있습니다.", "f95faa78fdce049f": "에이전트 활동 업데이트를 사용합니다. 업데이트를 받으려면 환경을 추가하세요.", "abec148ed1b71b11": "활동 업데이트 사용 설정을 완료할 수 없습니다", "0aecb0b05ccd394e": "이 기기를 {product}에 등록할 수 없어 아직 활동 업데이트가 표시되지 않습니다. 등록이 완료되면 시작됩니다.", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index b40494fca3885..d537147d41381 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Ver relay", "566b6a4f83192c13": "Inspecionar a conectividade do relay gerenciado.", "725b0d37325acdff": "Gerenciar relay", - "d89418e289b38f62": "Alterar a conectividade do túnel gerenciado.", + "61c9874c98415329": "Atualize as preferências do relay ou desvincule o T3 Connect.", + "3c85ec9cc2a6d25c": "Configurar relay (admin)", + "7f979acc0e1ee320": "Configure ou substitua o T3 Connect, incluindo o emissor confiável de credenciais de pareamento.", "cea8105b6e4e1703": "Conecte-se a este ambiente para ver as permissões desta sessão.", "3e5da15fb9653bc6": "Este ambiente não aceitou sua sessão. Reconecte para tentar novamente.", "7f2181cbb5edc3f3": "Não foi possível verificar suas permissões. Tentando novamente automaticamente.", @@ -1829,6 +1831,9 @@ "b27e256eea29c823": "A URL do relay não está configurada.", "bd2a0460b58f2ee0": "O relay retornou credenciais de outro ambiente.", "df614296bc5e624f": "O relay retornou credenciais de outro provedor de endpoint.", + "c15d8570b0ac8ae5": "O ambiente retornou HTTP {status}.", + "b87f2217123b4cbf": "Não foi possível atualizar a preferência de Atividades ao Vivo do ambiente.", + "2f18d65ea9f178da": "Não foi possível atualizar a preferência de Atividades ao Vivo do ambiente: {detail}", "024b0e4154ca9170": "Só uma conexão bearer pareada localmente pode ser vinculada à nuvem.", "52c4bcf188d1af36": "Não foi possível carregar o ID do dispositivo móvel.", "473457b89661c874": "Não foi possível carregar o ID do dispositivo móvel: {detail}", @@ -3263,9 +3268,11 @@ "c5e8c33c81298771": "Ative as notificações nos Ajustes do sistema para mostrar a atividade dos agentes em andamento.", "92eadafb24868a2b": "Live Activities indisponíveis", "06fdc3a2762b7d11": "Não foi possível ativar as atualizações de atividade dos agentes.", + "9ab5b1b388c83bd4": "Alguns ambientes precisam ser atualizados", + "e234f4ae749208cc": "A preferência do dispositivo foi salva. Atualize os servidores de ambientes antigos para aplicar a configuração neles.", "de02acb5424cf89b": "Atividade em andamento ativada", "ada8c7c0bd1538d9": "Live Activities ativadas", - "15774de43601ae0a": "As atualizações de atividade dos agentes estão ativadas para os ambientes que esta conexão pode configurar.", + "7641156da4b89c8e": "As atualizações de atividade dos agentes estão ativadas para os ambientes compatíveis.", "f95faa78fdce049f": "As atualizações de atividade dos agentes estão ativadas. Adicione um ambiente para começar a recebê-las.", "abec148ed1b71b11": "Não foi possível concluir a ativação das atualizações de atividade", "0aecb0b05ccd394e": "Este dispositivo não pôde ser registrado no {product}, então as atualizações de atividade ainda não vão aparecer. Elas começarão quando o registro for concluído.", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index cadf07e57eda9..88cb6f87c1c6f 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Просмотр relay", "566b6a4f83192c13": "Просмотр подключения через управляемый relay.", "725b0d37325acdff": "Управление relay", - "d89418e289b38f62": "Изменение подключения через управляемый туннель.", + "61c9874c98415329": "Изменение настроек ретранслятора или отключение T3 Connect.", + "3c85ec9cc2a6d25c": "Настройка ретранслятора (администратор)", + "7f979acc0e1ee320": "Настройка или замена T3 Connect и доверенного издателя учётных данных для сопряжения.", "cea8105b6e4e1703": "Подключитесь к этому окружению, чтобы увидеть разрешения этого сеанса.", "3e5da15fb9653bc6": "Окружение не приняло ваш сеанс. Переподключитесь, чтобы попробовать снова.", "7f2181cbb5edc3f3": "Не удалось проверить ваши разрешения. Повторная попытка выполняется автоматически.", @@ -1853,6 +1855,9 @@ "b27e256eea29c823": "URL relay не настроен.", "bd2a0460b58f2ee0": "Relay вернул учётные данные для другого окружения.", "df614296bc5e624f": "Relay вернул учётные данные для другого провайдера эндпоинтов.", + "c15d8570b0ac8ae5": "Среда вернула HTTP {status}.", + "b87f2217123b4cbf": "Не удалось обновить настройку «Эфир активности» для среды.", + "2f18d65ea9f178da": "Не удалось обновить настройку «Эфир активности» для среды: {detail}", "024b0e4154ca9170": "К облаку можно привязать только локально сопряжённое bearer-подключение.", "52c4bcf188d1af36": "Не удалось загрузить ID мобильного устройства.", "473457b89661c874": "Не удалось загрузить ID мобильного устройства: {detail}", @@ -3317,9 +3322,11 @@ "c5e8c33c81298771": "Включите уведомления в системных настройках, чтобы показывать текущую активность агентов.", "92eadafb24868a2b": "Live Activities недоступны", "06fdc3a2762b7d11": "Не удалось включить обновления активности агентов.", + "9ab5b1b388c83bd4": "Некоторые среды требуют обновления", + "e234f4ae749208cc": "Настройка устройства сохранена. Обновите серверы старых сред, чтобы применить настройку и там.", "de02acb5424cf89b": "Текущая активность включена", "ada8c7c0bd1538d9": "Live Activities включены", - "15774de43601ae0a": "Обновления активности агентов включены для окружений, которые может настраивать это подключение.", + "7641156da4b89c8e": "Обновления активности агентов включены для подходящих сред.", "f95faa78fdce049f": "Обновления активности агентов включены. Добавьте окружение, чтобы начать получать обновления.", "abec148ed1b71b11": "Не удалось завершить включение обновлений активности", "0aecb0b05ccd394e": "Это устройство не удалось зарегистрировать в {product}, поэтому обновления активности пока не появятся. Они начнут приходить после успешной регистрации.", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 3a0273aef36fd..5de253d72d583 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Visa relä", "566b6a4f83192c13": "Granska anslutningen för det hanterade reläet.", "725b0d37325acdff": "Hantera relä", - "d89418e289b38f62": "Ändra anslutningen för den hanterade tunneln.", + "61c9874c98415329": "Ändra reläinställningar eller koppla från T3 Connect.", + "3c85ec9cc2a6d25c": "Konfigurera relä (admin)", + "7f979acc0e1ee320": "Konfigurera eller ersätt T3 Connect, inklusive dess betrodda utfärdare av parkopplingsuppgifter.", "cea8105b6e4e1703": "Anslut till den här miljön för att se den här sessionens behörigheter.", "3e5da15fb9653bc6": "Den här miljön godtog inte din session. Anslut igen för att försöka på nytt.", "7f2181cbb5edc3f3": "Kunde inte verifiera dina behörigheter. Försöker igen automatiskt.", @@ -1829,6 +1831,9 @@ "b27e256eea29c823": "Reläets URL är inte konfigurerad.", "bd2a0460b58f2ee0": "Reläet returnerade autentiseringsuppgifter för en annan miljö.", "df614296bc5e624f": "Reläet returnerade autentiseringsuppgifter för en annan slutpunktsleverantör.", + "c15d8570b0ac8ae5": "Miljön returnerade HTTP {status}.", + "b87f2217123b4cbf": "Det gick inte att uppdatera miljöns inställning för liveaktiviteter.", + "2f18d65ea9f178da": "Det gick inte att uppdatera miljöns inställning för liveaktiviteter: {detail}", "024b0e4154ca9170": "Bara en lokalt parkopplad bearer-anslutning kan länkas till molnet.", "52c4bcf188d1af36": "Kunde inte läsa in den mobila enhetens id.", "473457b89661c874": "Kunde inte läsa in den mobila enhetens id: {detail}", @@ -3269,9 +3274,11 @@ "c5e8c33c81298771": "Aktivera aviseringar i systeminställningarna för att visa pågående agentaktivitet.", "92eadafb24868a2b": "Liveaktiviteter är inte tillgängliga", "06fdc3a2762b7d11": "Kunde inte aktivera uppdateringar av agentaktivitet.", + "9ab5b1b388c83bd4": "Vissa miljöer behöver uppdateras", + "e234f4ae749208cc": "Enhetsinställningen sparades. Uppdatera äldre miljöservrar för att tillämpa inställningen där.", "de02acb5424cf89b": "Pågående aktivitet aktiverad", "ada8c7c0bd1538d9": "Liveaktiviteter aktiverade", - "15774de43601ae0a": "Uppdateringar av agentaktivitet är aktiverade för miljöer som den här anslutningen kan konfigurera.", + "7641156da4b89c8e": "Uppdateringar om agentaktivitet är aktiverade för miljöer som stöder dem.", "f95faa78fdce049f": "Uppdateringar av agentaktivitet är aktiverade. Lägg till en miljö för att börja ta emot uppdateringar.", "abec148ed1b71b11": "Kunde inte slutföra aktiveringen av aktivitetsuppdateringar", "0aecb0b05ccd394e": "Enheten kunde inte registreras hos {product}, så aktivitetsuppdateringar visas inte än. De startar när registreringen lyckas.", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index f1c394c60c606..1d4b529847b88 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "查看中继", "566b6a4f83192c13": "查看托管中继的连接状态。", "725b0d37325acdff": "管理中继", - "d89418e289b38f62": "更改托管隧道的连接状态。", + "61c9874c98415329": "更新中继偏好设置或解除 T3 Connect 关联。", + "3c85ec9cc2a6d25c": "配置中继(管理员)", + "7f979acc0e1ee320": "设置或替换 T3 Connect,包括其受信任的配对凭据签发方。", "cea8105b6e4e1703": "连接此环境后即可查看当前连接的权限。", "3e5da15fb9653bc6": "此环境未接受你的连接。请重新连接后重试。", "7f2181cbb5edc3f3": "无法验证你的权限。正在自动重试。", @@ -1831,6 +1833,9 @@ "b27e256eea29c823": "未配置中继 URL。", "bd2a0460b58f2ee0": "中继返回的凭据属于另一个环境。", "df614296bc5e624f": "中继返回的凭据属于另一种端点提供方。", + "c15d8570b0ac8ae5": "环境返回了 HTTP {status}。", + "b87f2217123b4cbf": "无法更新该环境的实时活动偏好设置。", + "2f18d65ea9f178da": "无法更新该环境的实时活动偏好设置:{detail}", "024b0e4154ca9170": "只有本地配对的 Bearer 连接才能关联到云端。", "52c4bcf188d1af36": "无法加载移动设备 ID。", "473457b89661c874": "无法加载移动设备 ID:{detail}", @@ -3265,9 +3270,11 @@ "c5e8c33c81298771": "在系统设置中启用通知以显示进行中的智能体活动。", "92eadafb24868a2b": "实时活动不可用", "06fdc3a2762b7d11": "无法启用智能体活动更新。", + "9ab5b1b388c83bd4": "部分环境需要更新", + "e234f4ae749208cc": "设备偏好已保存。请更新旧版环境服务器,以在这些环境中应用此设置。", "de02acb5424cf89b": "进行中活动已启用", "ada8c7c0bd1538d9": "实时活动已启用", - "15774de43601ae0a": "已为此连接可配置的环境启用智能体活动更新。", + "7641156da4b89c8e": "符合条件的环境已启用代理活动更新。", "f95faa78fdce049f": "智能体活动更新已启用。添加一个环境以开始接收更新。", "abec148ed1b71b11": "无法完成启用活动更新", "0aecb0b05ccd394e": "此设备无法注册到 {product},因此暂时不会显示活动更新。注册成功后即会开始显示。", diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 5aca70101b1f3..9e0cdf1d2b0d9 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Relay ansehen", "566b6a4f83192c13": "Die Konnektivität des verwalteten Relays prüfen.", "725b0d37325acdff": "Relay verwalten", - "d89418e289b38f62": "Die Konnektivität des verwalteten Tunnels ändern.", + "61c9874c98415329": "Relay-Einstellungen ändern oder T3 Connect trennen.", + "3c85ec9cc2a6d25c": "Relay konfigurieren (Admin)", + "7f979acc0e1ee320": "T3 Connect einrichten oder ersetzen, einschließlich der vertrauenswürdigen Stelle, die Kopplungsdaten ausstellt.", "cea8105b6e4e1703": "Verbinde dich mit dieser Umgebung, um die Berechtigungen dieser Sitzung zu sehen.", "3e5da15fb9653bc6": "Diese Umgebung hat deine Sitzung nicht akzeptiert. Verbinde dich erneut, um es noch einmal zu versuchen.", "7f2181cbb5edc3f3": "Deine Berechtigungen konnten nicht überprüft werden. Wird automatisch erneut versucht.", @@ -7372,6 +7374,8 @@ "b76eda9aa9bec002": "Andere widerrufen", "04ab01b535a8e3a8": "z. B. iPad im Wohnzimmer", "274fac14d65ab9cc": "Standard", + "e0dde491debc2517": "Terminalbefehle können Dateien im Rahmen der Berechtigungen des Serverkontos lesen oder ändern.", + "7aa48417f0b79691": "Dieser Client kann ändern, wer Kopplungsdaten ausstellen darf.", "f8d29f698314bb6e": "Wird erstellt…", "647bd066558e1add": "Standard", "84dc0da709ddecd1": "Einrichten", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index 246e11939fd89..12123e9c628b5 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "View relay", "566b6a4f83192c13": "Inspect managed relay connectivity.", "725b0d37325acdff": "Manage relay", - "d89418e289b38f62": "Change managed tunnel connectivity.", + "61c9874c98415329": "Update relay preferences or unlink T3 Connect.", + "3c85ec9cc2a6d25c": "Configure relay (admin)", + "7f979acc0e1ee320": "Set up or replace T3 Connect, including its trusted pairing credential issuer.", "cea8105b6e4e1703": "Connect to this environment to view this session’s permissions.", "3e5da15fb9653bc6": "This environment did not accept your session. Reconnect to try again.", "7f2181cbb5edc3f3": "Could not verify your permissions. Retrying automatically.", @@ -7380,6 +7382,8 @@ "b76eda9aa9bec002": "Revoke others", "04ab01b535a8e3a8": "e.g. Living room iPad", "274fac14d65ab9cc": "Standard", + "e0dde491debc2517": "Terminal commands can read or change files within the server account’s permissions.", + "7aa48417f0b79691": "This client can change who can issue pairing credentials.", "f8d29f698314bb6e": "Creating…", "647bd066558e1add": "Default", "84dc0da709ddecd1": "Setup", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 38fe66011ed56..485b675171457 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Ver relay", "566b6a4f83192c13": "Inspeccionar la conectividad del relay gestionado.", "725b0d37325acdff": "Gestionar relay", - "d89418e289b38f62": "Cambiar la conectividad del túnel gestionado.", + "61c9874c98415329": "Cambia las preferencias del relé o desvincula T3 Connect.", + "3c85ec9cc2a6d25c": "Configurar relé (administrador)", + "7f979acc0e1ee320": "Configura o reemplaza T3 Connect, incluido el emisor de confianza de credenciales de emparejamiento.", "cea8105b6e4e1703": "Conéctate a este entorno para ver los permisos de esta sesión.", "3e5da15fb9653bc6": "Este entorno no aceptó tu sesión. Vuelve a conectar para intentarlo de nuevo.", "7f2181cbb5edc3f3": "No se pudieron verificar tus permisos. Reintentando automáticamente.", @@ -7373,6 +7375,8 @@ "b76eda9aa9bec002": "Revocar los demás", "04ab01b535a8e3a8": "p. ej., iPad del salón", "274fac14d65ab9cc": "Estándar", + "e0dde491debc2517": "Los comandos de terminal pueden leer o modificar archivos según los permisos de la cuenta del servidor.", + "7aa48417f0b79691": "Este cliente puede cambiar quién puede emitir credenciales de emparejamiento.", "f8d29f698314bb6e": "Creando…", "647bd066558e1add": "Predeterminado", "84dc0da709ddecd1": "Configurar", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 658857f98fc48..c629b0e6c3f44 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Voir le relais", "566b6a4f83192c13": "Inspecter la connectivité du relais géré.", "725b0d37325acdff": "Gérer le relais", - "d89418e289b38f62": "Modifier la connectivité du tunnel géré.", + "61c9874c98415329": "Modifier les préférences du relais ou dissocier T3 Connect.", + "3c85ec9cc2a6d25c": "Configurer le relais (admin)", + "7f979acc0e1ee320": "Configurer ou remplacer T3 Connect, y compris son émetteur de confiance d’identifiants d’appairage.", "cea8105b6e4e1703": "Connectez-vous à cet environnement pour voir les autorisations de cette session.", "3e5da15fb9653bc6": "Cet environnement n’a pas accepté votre session. Reconnectez-vous pour réessayer.", "7f2181cbb5edc3f3": "Impossible de vérifier vos autorisations. Nouvelle tentative automatique.", @@ -7374,6 +7376,8 @@ "b76eda9aa9bec002": "Révoquer les autres", "04ab01b535a8e3a8": "ex. iPad du salon", "274fac14d65ab9cc": "Standard", + "e0dde491debc2517": "Les commandes du terminal peuvent lire ou modifier des fichiers selon les autorisations du compte serveur.", + "7aa48417f0b79691": "Ce client peut modifier les personnes autorisées à émettre des identifiants d’appairage.", "f8d29f698314bb6e": "Création…", "647bd066558e1add": "Par défaut", "84dc0da709ddecd1": "Configurer", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index a405829ae1a06..f0bca169009c9 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "リレーの表示", "566b6a4f83192c13": "マネージドリレーの接続状態を確認します。", "725b0d37325acdff": "リレーの管理", - "d89418e289b38f62": "マネージドトンネルの接続を変更します。", + "61c9874c98415329": "リレー設定を更新するか、T3 Connect のリンクを解除します。", + "3c85ec9cc2a6d25c": "リレーを設定(管理者)", + "7f979acc0e1ee320": "T3 Connect と、信頼できるペアリング認証情報の発行元を設定または変更します。", "cea8105b6e4e1703": "このセッションの権限を表示するには、この環境に接続してください。", "3e5da15fb9653bc6": "この環境はセッションを受け付けませんでした。再接続してもう一度お試しください。", "7f2181cbb5edc3f3": "権限を確認できませんでした。自動的に再試行しています。", @@ -7339,6 +7341,8 @@ "b76eda9aa9bec002": "他をすべて取り消す", "04ab01b535a8e3a8": "例: リビングの iPad", "274fac14d65ab9cc": "標準", + "e0dde491debc2517": "ターミナルのコマンドは、サーバーアカウントの権限の範囲内でファイルを読み取り、変更できます。", + "7aa48417f0b79691": "このクライアントは、ペアリング認証情報を発行できるユーザーを変更できます。", "f8d29f698314bb6e": "作成しています…", "647bd066558e1add": "デフォルト", "84dc0da709ddecd1": "セットアップ", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index c5690cb564f42..5fb9ef603cdec 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "릴레이 보기", "566b6a4f83192c13": "관리형 릴레이 연결 상태를 확인합니다.", "725b0d37325acdff": "릴레이 관리", - "d89418e289b38f62": "관리형 터널 연결을 변경합니다.", + "61c9874c98415329": "릴레이 환경설정을 변경하거나 T3 Connect 연결을 해제합니다.", + "3c85ec9cc2a6d25c": "릴레이 구성(관리자)", + "7f979acc0e1ee320": "T3 Connect와 신뢰할 수 있는 페어링 자격 증명 발급자를 설정하거나 교체합니다.", "cea8105b6e4e1703": "이 세션의 권한을 보려면 이 환경에 연결하세요.", "3e5da15fb9653bc6": "이 환경에서 세션을 수락하지 않았습니다. 다시 연결해 보세요.", "7f2181cbb5edc3f3": "권한을 확인할 수 없습니다. 자동으로 다시 시도합니다.", @@ -7340,6 +7342,8 @@ "b76eda9aa9bec002": "다른 항목 취소", "04ab01b535a8e3a8": "예: 거실 iPad", "274fac14d65ab9cc": "표준", + "e0dde491debc2517": "터미널 명령은 서버 계정에 부여된 권한 범위에서 파일을 읽거나 변경할 수 있습니다.", + "7aa48417f0b79691": "이 클라이언트는 페어링 자격 증명을 발급할 수 있는 주체를 변경할 수 있습니다.", "f8d29f698314bb6e": "만드는 중…", "647bd066558e1add": "기본값", "84dc0da709ddecd1": "설정", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 9c4552aed155b..cab58ea26dfee 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Ver relay", "566b6a4f83192c13": "Inspecionar a conectividade do relay gerenciado.", "725b0d37325acdff": "Gerenciar relay", - "d89418e289b38f62": "Alterar a conectividade do túnel gerenciado.", + "61c9874c98415329": "Atualize as preferências do relay ou desvincule o T3 Connect.", + "3c85ec9cc2a6d25c": "Configurar relay (admin)", + "7f979acc0e1ee320": "Configure ou substitua o T3 Connect, incluindo o emissor confiável de credenciais de pareamento.", "cea8105b6e4e1703": "Conecte-se a este ambiente para ver as permissões desta sessão.", "3e5da15fb9653bc6": "Este ambiente não aceitou sua sessão. Reconecte para tentar novamente.", "7f2181cbb5edc3f3": "Não foi possível verificar suas permissões. Tentando novamente automaticamente.", @@ -7373,6 +7375,8 @@ "b76eda9aa9bec002": "Revogar os outros", "04ab01b535a8e3a8": "ex.: iPad da sala", "274fac14d65ab9cc": "Padrão", + "e0dde491debc2517": "Os comandos do terminal podem ler ou alterar arquivos conforme as permissões da conta do servidor.", + "7aa48417f0b79691": "Este cliente pode alterar quem pode emitir credenciais de pareamento.", "f8d29f698314bb6e": "Criando…", "647bd066558e1add": "Padrão", "84dc0da709ddecd1": "Configurar", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 7e36f4bd730a1..778242a2d3f63 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Просмотр relay", "566b6a4f83192c13": "Просмотр подключения через управляемый relay.", "725b0d37325acdff": "Управление relay", - "d89418e289b38f62": "Изменение подключения через управляемый туннель.", + "61c9874c98415329": "Изменение настроек ретранслятора или отключение T3 Connect.", + "3c85ec9cc2a6d25c": "Настройка ретранслятора (администратор)", + "7f979acc0e1ee320": "Настройка или замена T3 Connect и доверенного издателя учётных данных для сопряжения.", "cea8105b6e4e1703": "Подключитесь к этому окружению, чтобы увидеть разрешения этого сеанса.", "3e5da15fb9653bc6": "Окружение не приняло ваш сеанс. Переподключитесь, чтобы попробовать снова.", "7f2181cbb5edc3f3": "Не удалось проверить ваши разрешения. Повторная попытка выполняется автоматически.", @@ -7373,6 +7375,8 @@ "b76eda9aa9bec002": "Отозвать остальные", "04ab01b535a8e3a8": "например, iPad в гостиной", "274fac14d65ab9cc": "Стандартные", + "e0dde491debc2517": "Команды терминала могут читать и изменять файлы в пределах прав учётной записи сервера.", + "7aa48417f0b79691": "Этот клиент может изменять список тех, кто вправе выдавать учётные данные для сопряжения.", "f8d29f698314bb6e": "Создание…", "647bd066558e1add": "По умолчанию", "84dc0da709ddecd1": "Настроить", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index 95bcd0b80080a..da9a529095e41 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "Visa relä", "566b6a4f83192c13": "Granska anslutningen för det hanterade reläet.", "725b0d37325acdff": "Hantera relä", - "d89418e289b38f62": "Ändra anslutningen för den hanterade tunneln.", + "61c9874c98415329": "Ändra reläinställningar eller koppla från T3 Connect.", + "3c85ec9cc2a6d25c": "Konfigurera relä (admin)", + "7f979acc0e1ee320": "Konfigurera eller ersätt T3 Connect, inklusive dess betrodda utfärdare av parkopplingsuppgifter.", "cea8105b6e4e1703": "Anslut till den här miljön för att se den här sessionens behörigheter.", "3e5da15fb9653bc6": "Den här miljön godtog inte din session. Anslut igen för att försöka på nytt.", "7f2181cbb5edc3f3": "Kunde inte verifiera dina behörigheter. Försöker igen automatiskt.", @@ -7379,6 +7381,8 @@ "b76eda9aa9bec002": "Återkalla andra", "04ab01b535a8e3a8": "t.ex. iPad i vardagsrummet", "274fac14d65ab9cc": "Standard", + "e0dde491debc2517": "Terminalkommandon kan läsa eller ändra filer inom serverkontots behörigheter.", + "7aa48417f0b79691": "Den här klienten kan ändra vem som får utfärda parkopplingsuppgifter.", "f8d29f698314bb6e": "Skapar…", "647bd066558e1add": "Standard", "84dc0da709ddecd1": "Konfigurera", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 7f161ed108acf..0ee5d09251cc2 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -995,7 +995,9 @@ "45fdf7cb16c83b75": "查看中继", "566b6a4f83192c13": "查看托管中继的连接状态。", "725b0d37325acdff": "管理中继", - "d89418e289b38f62": "更改托管隧道的连接状态。", + "61c9874c98415329": "更新中继偏好设置或解除 T3 Connect 关联。", + "3c85ec9cc2a6d25c": "配置中继(管理员)", + "7f979acc0e1ee320": "设置或替换 T3 Connect,包括其受信任的配对凭据签发方。", "cea8105b6e4e1703": "连接此环境后即可查看当前连接的权限。", "3e5da15fb9653bc6": "此环境未接受你的连接。请重新连接后重试。", "7f2181cbb5edc3f3": "无法验证你的权限。正在自动重试。", @@ -7388,6 +7390,8 @@ "b76eda9aa9bec002": "撤销其他客户端的访问权限", "04ab01b535a8e3a8": "例如:客厅的 iPad", "274fac14d65ab9cc": "标准", + "e0dde491debc2517": "终端命令可以在服务器账户的权限范围内读取或修改文件。", + "7aa48417f0b79691": "此客户端可以更改谁有权签发配对凭据。", "f8d29f698314bb6e": "正在创建…", "647bd066558e1add": "默认", "84dc0da709ddecd1": "设置", From a371c3aac059ab4967be585c0728c387c82700b2 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 13:57:40 -0800 Subject: [PATCH 10/14] fix(connect): address relay permission and preference review --- .../liveActivityPreferences.test.ts | 45 +++++------ .../liveActivityPreferences.ts | 58 ++++++-------- .../src/features/cloud/linkEnvironment.ts | 78 +++++++++++-------- .../SettingsNotificationsRouteScreen.tsx | 37 ++++++++- apps/web/src/cloud/useCloudLinkController.ts | 6 +- .../cloud/ConnectOnboardingDialog.tsx | 43 +++++----- apps/web/src/i18n/translations/de.json | 1 + apps/web/src/i18n/translations/en.json | 1 + apps/web/src/i18n/translations/es.json | 1 + apps/web/src/i18n/translations/fr.json | 1 + apps/web/src/i18n/translations/ja.json | 1 + apps/web/src/i18n/translations/ko.json | 1 + apps/web/src/i18n/translations/pt-BR.json | 1 + apps/web/src/i18n/translations/ru.json | 1 + apps/web/src/i18n/translations/sv.json | 1 + apps/web/src/i18n/translations/zh.json | 1 + docs/user/remote-access.md | 3 +- 17 files changed, 166 insertions(+), 114 deletions(-) diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts index a77f83efcd1e1..3008b64b33a46 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts @@ -11,7 +11,6 @@ import * as MobileStorage from "../../persistence/mobile-storage"; import { CloudEnvironmentLinkError, linkEnvironmentToCloudWithPreference, - updateLinkedEnvironmentLiveActivityPreference, } from "../cloud/linkEnvironment"; import { setLiveActivityUpdatesEnabled } from "./liveActivityPreferences"; import { updateAgentAwarenessRegistrationPreferences } from "./remoteRegistration"; @@ -35,13 +34,19 @@ vi.mock("expo-device", () => ({})); vi.mock("../cloud/linkEnvironment", async (importOriginal) => ({ ...(await importOriginal()), linkEnvironmentToCloudWithPreference: vi.fn(() => Effect.void), - updateLinkedEnvironmentLiveActivityPreference: vi.fn(() => Effect.succeed("updated" as const)), })); vi.mock("./remoteRegistration", () => ({ updateAgentAwarenessRegistrationPreferences: vi.fn(() => Effect.void), })); +const updateEnvironment = vi.fn< + ( + id: EnvironmentId, + enabled: boolean, + ) => Effect.Effect<"updated" | "unlinked" | "unsupported", CloudEnvironmentLinkError> +>(() => Effect.succeed("updated")); + const connection: SavedRemoteConnection = { environmentId: "env-1" as EnvironmentId, environmentLabel: "Desktop", @@ -77,14 +82,15 @@ describe("liveActivityPreferences", () => { vi.clearAllMocks(); }); - it.effect("restores relay preferences when an environment update fails", () => { - vi.mocked(updateLinkedEnvironmentLiveActivityPreference).mockImplementationOnce(() => + it.effect("restores only the device preference when an environment update fails", () => { + updateEnvironment.mockImplementationOnce(() => Effect.fail(new CloudEnvironmentLinkError({ message: "environment update failed" })), ); return Effect.gen(function* () { const exit = yield* Effect.exit( setLiveActivityUpdatesEnabled({ + updateEnvironment, enabled: false, previousEnabled: true, clerkToken: "clerk-token", @@ -101,24 +107,13 @@ describe("liveActivityPreferences", () => { expect(updateAgentAwarenessRegistrationPreferences).toHaveBeenNthCalledWith(2, { liveActivitiesEnabled: true, }); - expect(updateLinkedEnvironmentLiveActivityPreference).toHaveBeenNthCalledWith( - 1, - connection, - false, - ); - expect(updateLinkedEnvironmentLiveActivityPreference).toHaveBeenNthCalledWith( - 2, - connection, - true, - ); + expect(updateEnvironment).toHaveBeenCalledExactlyOnceWith(connection.environmentId, false); expect(linkEnvironmentToCloudWithPreference).not.toHaveBeenCalled(); }).pipe(Effect.provide(layerTest)); }); it.effect("only creates missing links when the session can configure Connect", () => { - vi.mocked(updateLinkedEnvironmentLiveActivityPreference).mockReturnValueOnce( - Effect.succeed("unlinked" as const), - ); + updateEnvironment.mockReturnValueOnce(Effect.succeed("unlinked" as const)); const readOnlyConnection: SavedRemoteConnection = { ...connection, environmentId: "read-only" as EnvironmentId, @@ -126,6 +121,7 @@ describe("liveActivityPreferences", () => { return Effect.gen(function* () { yield* setLiveActivityUpdatesEnabled({ + updateEnvironment, enabled: true, previousEnabled: false, clerkToken: "clerk-token", @@ -147,14 +143,18 @@ describe("liveActivityPreferences", () => { it.effect("reports older environments whose preferences could not be updated", () => Effect.gen(function* () { - vi.mocked(updateLinkedEnvironmentLiveActivityPreference).mockReturnValueOnce( - Effect.succeed("unsupported"), - ); + const dpopConnection: SavedRemoteConnection = { + ...connection, + bearerToken: null, + authenticationMethod: "dpop", + }; + updateEnvironment.mockReturnValueOnce(Effect.succeed("unsupported")); const partial = yield* setLiveActivityUpdatesEnabled({ + updateEnvironment, enabled: false, previousEnabled: true, clerkToken: "clerk-token", - connections: [connection], + connections: [dpopConnection], canConfigureEnvironment: () => false, canUpdateEnvironment: () => true, }); @@ -173,6 +173,7 @@ describe("liveActivityPreferences", () => { return Effect.gen(function* () { yield* setLiveActivityUpdatesEnabled({ + updateEnvironment, enabled: false, previousEnabled: true, clerkToken: "clerk-token", @@ -182,7 +183,7 @@ describe("liveActivityPreferences", () => { }); expect(linkEnvironmentToCloudWithPreference).not.toHaveBeenCalled(); - expect(updateLinkedEnvironmentLiveActivityPreference).not.toHaveBeenCalled(); + expect(updateEnvironment).not.toHaveBeenCalled(); expect(updateAgentAwarenessRegistrationPreferences).toHaveBeenCalledTimes(1); }).pipe(Effect.provide(layerTest)); }); diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts index 679af851ba933..00ea5c8dc6a07 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts @@ -4,7 +4,7 @@ import type { EnvironmentId } from "@t3tools/contracts"; import type { SavedRemoteConnection } from "../../lib/connection"; import { linkEnvironmentToCloudWithPreference, - updateLinkedEnvironmentLiveActivityPreference, + type CloudEnvironmentLinkError, } from "../cloud/linkEnvironment"; import { updateAgentAwarenessRegistrationPreferences } from "./remoteRegistration"; @@ -14,23 +14,28 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn readonly previousEnabled: boolean; readonly clerkToken: string | null; readonly connections: ReadonlyArray; + readonly updateEnvironment: ( + environmentId: EnvironmentId, + enabled: boolean, + ) => Effect.Effect<"updated" | "unlinked" | "unsupported", CloudEnvironmentLinkError>; readonly canUpdateEnvironment: (environmentId: EnvironmentId) => boolean; readonly canConfigureEnvironment: (environmentId: EnvironmentId) => boolean; }) { - const linkedConnections = input.connections.filter( - (connection) => connection.bearerToken !== null, - ); - const updateEnvironmentPreference = Effect.fn("updateEnvironmentPreference")(function* ( connection: SavedRemoteConnection, enabled: boolean, clerkToken: string | null, ) { const result = input.canUpdateEnvironment(connection.environmentId) - ? yield* updateLinkedEnvironmentLiveActivityPreference(connection, enabled) + ? yield* input.updateEnvironment(connection.environmentId, enabled) : "unlinked"; if (result === "updated") return false; - if (!enabled || !clerkToken || !input.canConfigureEnvironment(connection.environmentId)) { + if ( + !enabled || + !clerkToken || + !connection.bearerToken || + !input.canConfigureEnvironment(connection.environmentId) + ) { return result === "unsupported"; } @@ -51,42 +56,23 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn if (!clerkToken) return false; const results = yield* Effect.forEach( - linkedConnections, + input.connections, (connection) => updateEnvironmentPreference(connection, enabled, clerkToken), { concurrency: "unbounded" }, ); return results.some(Boolean); }); - const restoreRelayPreference = Effect.fn("restoreRelayPreference")(function* () { - yield* updateAgentAwarenessRegistrationPreferences({ - liveActivitiesEnabled: input.previousEnabled, - }).pipe( - Effect.catchCause((cause) => - Effect.logWarning("Could not restore Live Activity device preference.", cause), - ), - ); - - const clerkToken = input.clerkToken; - if (!clerkToken) return; - - yield* Effect.forEach( - linkedConnections, - (connection) => - updateEnvironmentPreference(connection, input.previousEnabled, null).pipe( - Effect.catchCause((cause) => - Effect.logWarning( - `Could not restore Live Activity preference for environment ${connection.environmentId}.`, - cause, - ), - ), - ), - { concurrency: "unbounded" }, - ); - }); - return yield* updateRelayPreference(input.enabled).pipe( - Effect.onError(() => restoreRelayPreference()), + Effect.onError(() => + updateAgentAwarenessRegistrationPreferences({ + liveActivitiesEnabled: input.previousEnabled, + }).pipe( + Effect.catchCause((cause) => + Effect.logWarning("Could not restore Live Activity device preference.", cause), + ), + ), + ), ); }, ); diff --git a/apps/mobile/src/features/cloud/linkEnvironment.ts b/apps/mobile/src/features/cloud/linkEnvironment.ts index 68a3ff4cba990..fb40f028bdb17 100644 --- a/apps/mobile/src/features/cloud/linkEnvironment.ts +++ b/apps/mobile/src/features/cloud/linkEnvironment.ts @@ -1,6 +1,6 @@ import * as Effect from "effect/Effect"; import * as Schema from "effect/Schema"; -import { HttpClient } from "effect/http"; +import { HttpClient, type HttpClientResponse } from "effect/http"; import { EnvironmentCloudEndpointUnavailableError, EnvironmentHttpBadRequestError, @@ -18,6 +18,7 @@ import { findErrorTraceId } from "@t3tools/client-runtime/errors"; import { ManagedRelay, relayRequestFailureDetail } from "@t3tools/client-runtime/relay"; import { makeEnvironmentHttpApiClient } from "@t3tools/client-runtime/rpc"; +import { executeConnectedEnvironmentHttpRequest } from "@t3tools/client-runtime/state/environmentHttpAuth"; import { msg } from "gt-react-native"; import { m } from "../../i18n/messages"; @@ -167,40 +168,49 @@ const decodeRelayOkResponse = Schema.decodeUnknownEffect(RelayOkResponse); export const updateLinkedEnvironmentLiveActivityPreference = Effect.fn( "linkEnvironment.updateLinkedEnvironmentLiveActivityPreference", -)(function* (connection: SavedRemoteConnection, liveActivitiesEnabled: boolean) { - if (!connection.bearerToken) return "unlinked" as const; - - const client = yield* makeEnvironmentHttpApiClient(connection.httpBaseUrl); - return yield* client.connect - .liveActivityPreference({ - headers: { authorization: `Bearer ${connection.bearerToken}` }, - payload: { liveActivitiesEnabled }, - responseMode: "response-only", - }) - .pipe( - Effect.flatMap((response) => - Effect.gen(function* () { - if (response.status === 404) return "unsupported" as const; - if (response.status === 200) { - const json = yield* response.json; - const result = yield* decodeRelayOkResponse(json); - return result.ok ? ("updated" as const) : ("unlinked" as const); - } - return yield* new CloudEnvironmentLinkError({ - message: m(msg("Environment returned HTTP {status}."), { status: response.status }), - }); - }), - ), - Effect.mapError( - cloudEnvironmentLinkError( - m(msg("Could not update the environment's Live Activity preference.")), - (detail) => - m(msg("Could not update the environment's Live Activity preference: {detail}"), { - detail, - }), - ), +)(function* (liveActivitiesEnabled: boolean) { + return yield* executeConnectedEnvironmentHttpRequest< + "connect", + HttpClientResponse.HttpClientResponse, + unknown, + never + >({ + group: "connect", + method: "POST", + url: (urls) => urls.liveActivityPreference(), + timeoutMs: 8_000, + requestInit: { redirect: "error" }, + isUnauthorizedResponse: (response) => response.status === 401, + request: ({ client, headers }) => + client.liveActivityPreference({ + headers, + payload: { liveActivitiesEnabled }, + responseMode: "response-only", + }), + }).pipe( + Effect.flatMap((response) => + Effect.gen(function* () { + if (response.status === 404) return "unsupported" as const; + if (response.status === 200) { + const json = yield* response.json; + const result = yield* decodeRelayOkResponse(json); + return result.ok ? ("updated" as const) : ("unlinked" as const); + } + return yield* new CloudEnvironmentLinkError({ + message: m(msg("Environment returned HTTP {status}."), { status: response.status }), + }); + }), + ), + Effect.mapError( + cloudEnvironmentLinkError( + m(msg("Could not update the environment's Live Activity preference.")), + (detail) => + m(msg("Could not update the environment's Live Activity preference: {detail}"), { + detail, + }), ), - ); + ), + ); }); export const linkEnvironmentToCloudWithPreference = Effect.fn( diff --git a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx index 92e7ca3714b6b..fee30035f5ef0 100644 --- a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx @@ -1,5 +1,5 @@ import { errorDisplayMessage } from "@t3tools/client-runtime/errors"; -import { useGT, useMessages } from "gt-react-native"; +import { msg, useGT, useMessages } from "gt-react-native"; import * as Dialog from "../../components/ui/Dialog"; import { managedCapabilityDenial } from "@t3tools/client-runtime/contract-labels"; import { @@ -16,6 +16,7 @@ import { useAtomSet, useAtomValue } from "@effect/atom-react"; import * as Notifications from "expo-notifications"; import { useNavigation } from "@react-navigation/native"; import * as Effect from "effect/Effect"; +import * as Schema from "effect/Schema"; import { AsyncResult } from "effect/reactivity"; import { useRef, useState, useSyncExternalStore } from "react"; import { Linking, Platform } from "react-native"; @@ -24,6 +25,7 @@ import { m as resolveMessage } from "../../i18n/messages"; import { AppText as Text } from "../../components/ui/AppText"; import { + createEnvironmentCommand, isAtomCommandInterrupted, reportAtomCommandResult, settleAsyncResult, @@ -43,6 +45,11 @@ import { refreshAgentAwarenessRegistration, subscribeAgentAwarenessRegistrationStatus, } from "../agent-awareness/remoteRegistration"; +import { connectionAtomRuntime } from "../../connection/runtime"; +import { + CloudEnvironmentLinkError, + updateLinkedEnvironmentLiveActivityPreference, +} from "../cloud/linkEnvironment"; import { refreshManagedRelayEnvironments } from "../cloud/managedRelayState"; import { hasCloudPublicConfig, resolveRelayClerkTokenOptions } from "../cloud/publicConfig"; import { makePermissionStatusAtom } from "../../lib/permissionStatusAtom"; @@ -55,6 +62,32 @@ import { SettingsSwitchRow } from "./components/SettingsSwitchRow"; import { SettingsScreen } from "./components/SettingsScreen"; import { resolveAgentAwarenessPlatformPresentation } from "./SettingsRouteScreen.logic"; +const updateLiveActivityPreference = createEnvironmentCommand(connectionAtomRuntime, { + label: "updateLiveActivityPreference", + execute: updateLinkedEnvironmentLiveActivityPreference, +}); + +const isCloudEnvironmentLinkError = Schema.is(CloudEnvironmentLinkError); + +const updateEnvironmentPreference = Effect.fn("updateEnvironmentPreference")(function* ( + environmentId: EnvironmentId, + enabled: boolean, +) { + const result = yield* Effect.promise(() => + updateLiveActivityPreference.run(appAtomRegistry, { environmentId, input: enabled }), + ); + if (result._tag === "Success") return result.value; + const cause = squashAtomCommandFailure(result); + return yield* isCloudEnvironmentLinkError(cause) + ? cause + : new CloudEnvironmentLinkError({ + message: resolveMessage( + msg("Could not update the environment's Live Activity preference."), + ), + cause, + }); +}); + /** * A policy that turns Connect off refuses relay links and preferences, which would fail the * whole batch, so those environments are skipped like ones this session cannot configure. @@ -323,6 +356,7 @@ function ConfiguredSettingsNotificationsRouteScreen() { const updateResult = await settleAsyncResult(() => runtime.runPromiseExit( setLiveActivityUpdatesEnabled({ + updateEnvironment: updateEnvironmentPreference, canConfigureEnvironment: (id) => canManageConnect(id, AuthRelayConfigureScope), canUpdateEnvironment: (id) => canManageConnect(id, AuthRelayWriteScope), enabled: true, @@ -416,6 +450,7 @@ function ConfiguredSettingsNotificationsRouteScreen() { const updateResult = await settleAsyncResult(() => runtime.runPromiseExit( setLiveActivityUpdatesEnabled({ + updateEnvironment: updateEnvironmentPreference, canConfigureEnvironment: (id) => canManageConnect(id, AuthRelayConfigureScope), canUpdateEnvironment: (id) => canManageConnect(id, AuthRelayWriteScope), enabled: false, diff --git a/apps/web/src/cloud/useCloudLinkController.ts b/apps/web/src/cloud/useCloudLinkController.ts index 7f3a38e5cbb67..1c22aadfc4e9b 100644 --- a/apps/web/src/cloud/useCloudLinkController.ts +++ b/apps/web/src/cloud/useCloudLinkController.ts @@ -190,7 +190,11 @@ export function useCloudLinkController(environmentId: EnvironmentId | null) { if (!readEnvironmentCanConfigureRelay(environmentId)) { reportUpdateFailure( new Error( - "This connection needs the relay configuration permission to configure T3 Connect.", + m( + msg( + "This connection needs the relay configuration permission to configure T3 Connect.", + ), + ), ), ); return false; diff --git a/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx b/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx index f200c45f6e710..f85ba08172315 100644 --- a/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx +++ b/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx @@ -1,7 +1,13 @@ import { useAuth } from "@clerk/react"; import { useAtomValue } from "@effect/atom-react"; import { managedCapabilityDenial } from "@t3tools/client-runtime/contract-labels"; -import { AuthAccessWriteScope, type AuthSessionState } from "@t3tools/contracts"; +import { + AuthAccessWriteScope, + AuthRelayReadScope, + AuthRelayWriteScope, + type AuthSessionState, + type EnvironmentId, +} from "@t3tools/contracts"; import { AsyncResult, Atom } from "effect/reactivity"; import { msg, T, useGT, useMessages } from "gt-react"; import { useState } from "react"; @@ -26,6 +32,7 @@ import { usePrimaryManagedPolicy } from "~/state/managedPolicy"; import { environmentSession, readEnvironmentCanConfigureRelay, + readEnvironmentScope, useEnvironmentCanConfigureRelay, useEnvironmentScope, } from "~/state/session"; @@ -52,6 +59,15 @@ type OnboardingStep = "publish" | "devices"; const EMPTY_SESSION_STATE_ATOM = Atom.make(AsyncResult.initial()); +function canPublishOnEnvironment(id: EnvironmentId | null): boolean { + return ( + id !== null && + readEnvironmentScope(id, AuthRelayReadScope) && + readEnvironmentScope(id, AuthRelayWriteScope) && + readEnvironmentCanConfigureRelay(id) + ); +} + function ConfiguredConnectOnboardingDialog() { // Pending Clerk sessions must not look signed out or activation would look like a new sign-in. const { isLoaded, isSignedIn, userId } = useAuth({ treatPendingAsSignedOut: false }); @@ -77,7 +93,9 @@ function ConfiguredConnectOnboardingDialog() { // A policy that turns Connect off leaves nothing to publish; reaching other devices still works. const connectAllowed = managedCapabilityDenial(usePrimaryManagedPolicy(), "connect") === undefined; - const canManageRelay = canConfigureRelay && connectAllowed; + const canReadRelay = useEnvironmentScope(primaryEnvironmentId, AuthRelayReadScope); + const canWriteRelay = useEnvironmentScope(primaryEnvironmentId, AuthRelayWriteScope); + const canManageRelay = canReadRelay && canWriteRelay && canConfigureRelay && connectAllowed; const canRequireDeviceApproval = useEnvironmentScope(primaryEnvironmentId, AuthAccessWriteScope); const deviceApprovalRequired = usePrimaryEnvironment()?.serverConfig?.settings.requireConnectDeviceApproval === true; @@ -188,7 +206,7 @@ function ConfiguredConnectOnboardingDialog() { setIsApplying(false); if (!saved) return; } - if (primaryEnvironmentId === null || !readEnvironmentCanConfigureRelay(primaryEnvironmentId)) { + if (!canPublishOnEnvironment(primaryEnvironmentId)) { setStep("devices"); return; } @@ -248,12 +266,7 @@ function ConfiguredConnectOnboardingDialog() { isStepDisabled={() => isApplying} onStepChange={(index) => { const next = steps[index]; - if ( - next === "publish" && - (primaryEnvironmentId === null || - !readEnvironmentCanConfigureRelay(primaryEnvironmentId)) - ) - return; + if (next === "publish" && !canPublishOnEnvironment(primaryEnvironmentId)) return; if (next) setStep(next); }} /> @@ -274,18 +287,10 @@ function ConfiguredConnectOnboardingDialog() { tunnelLimit={controller.tunnelLimit} onOpenAccountPage={leaveForAccountPage} onExposeEnvironmentChange={(enabled) => { - if ( - primaryEnvironmentId !== null && - readEnvironmentCanConfigureRelay(primaryEnvironmentId) - ) - setExposeEnvironment(enabled); + if (canPublishOnEnvironment(primaryEnvironmentId)) setExposeEnvironment(enabled); }} onPublishAgentActivityChange={(enabled) => { - if ( - primaryEnvironmentId !== null && - readEnvironmentCanConfigureRelay(primaryEnvironmentId) - ) - setPublishAgentActivity(enabled); + if (canPublishOnEnvironment(primaryEnvironmentId)) setPublishAgentActivity(enabled); }} /> ) : ( diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 9e0cdf1d2b0d9..2fa714985b0a3 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "Warte, bis die aktuellen T3-Connect-Einstellungen gelesen werden können.", "a74f94bf4c3c6bfe": "Hier getrennt, aber T3 Connect führt sie noch. Entferne sie unter Konto.", "4ca203c6fe28afa6": "Melde dich bei T3 Connect an, bevor du dies aktivierst.", + "895d824b027d128e": "Diese Verbindung benötigt die Berechtigung zur Relay-Konfiguration, um T3 Connect einzurichten.", "e4f274ef6c9c9a6c": "Wähle einen Ordner auf dem anderen Rechner.", "5aa50c97d1573919": "Das Klonen konnte nicht gestartet werden.", "1a31b5a1f4fe467f": "Dieser Rechner", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index 12123e9c628b5..cb21a201348c7 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "Wait until the current T3 Connect settings can be read.", "a74f94bf4c3c6bfe": "Disconnected here, but T3 Connect still lists it. Remove it in Account.", "4ca203c6fe28afa6": "Sign in to T3 Connect before enabling this.", + "895d824b027d128e": "This connection needs the relay configuration permission to configure T3 Connect.", "e4f274ef6c9c9a6c": "Choose a folder on the other machine.", "5aa50c97d1573919": "Could not start the clone.", "1a31b5a1f4fe467f": "This machine", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 485b675171457..b7c38dea52f49 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "Espera hasta que se puedan leer los ajustes actuales de T3 Connect.", "a74f94bf4c3c6bfe": "Desconectado aquí, pero T3 Connect aún lo muestra. Quítalo en Cuenta.", "4ca203c6fe28afa6": "Inicia sesión en T3 Connect antes de activar esto.", + "895d824b027d128e": "Esta conexión necesita permiso para configurar el relé antes de configurar T3 Connect.", "e4f274ef6c9c9a6c": "Elige una carpeta en la otra máquina.", "5aa50c97d1573919": "No se pudo iniciar la clonación.", "1a31b5a1f4fe467f": "Esta máquina", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index c629b0e6c3f44..629d157a8e164 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "Attendez que les paramètres T3 Connect actuels puissent être lus.", "a74f94bf4c3c6bfe": "Déconnecté ici, mais T3 Connect le liste toujours. Supprimez-le dans Compte.", "4ca203c6fe28afa6": "Connectez-vous à T3 Connect avant d’activer cette option.", + "895d824b027d128e": "Cette connexion nécessite l’autorisation de configurer le relais pour configurer T3 Connect.", "e4f274ef6c9c9a6c": "Choisissez un dossier sur l’autre machine.", "5aa50c97d1573919": "Impossible de lancer le clonage.", "1a31b5a1f4fe467f": "Cette machine", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index f0bca169009c9..3da57418cff76 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "現在の T3 Connect 設定を読み取れるようになるまでお待ちください。", "a74f94bf4c3c6bfe": "ここでは切断しましたが、T3 Connect にはまだ表示されています。アカウントで削除してください。", "4ca203c6fe28afa6": "有効にする前に T3 Connect にサインインしてください。", + "895d824b027d128e": "この接続から T3 Connect を設定するには、リレーの設定権限が必要です。", "e4f274ef6c9c9a6c": "相手のマシン上のフォルダーを選択してください。", "5aa50c97d1573919": "クローンを開始できませんでした。", "1a31b5a1f4fe467f": "このマシン", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index 5fb9ef603cdec..015b0524b8057 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "현재 T3 Connect 설정을 읽을 수 있을 때까지 기다리세요.", "a74f94bf4c3c6bfe": "여기서는 연결이 해제되었지만 T3 Connect에는 아직 표시됩니다. 계정에서 제거하세요.", "4ca203c6fe28afa6": "이 기능을 켜기 전에 T3 Connect에 로그인하세요.", + "895d824b027d128e": "이 연결에서 T3 Connect를 설정하려면 릴레이 구성 권한이 필요합니다.", "e4f274ef6c9c9a6c": "다른 머신의 폴더를 선택하세요.", "5aa50c97d1573919": "복제를 시작할 수 없습니다.", "1a31b5a1f4fe467f": "이 머신", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index cab58ea26dfee..87f58c17b7af0 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "Aguarde até que as configurações atuais do T3 Connect possam ser lidas.", "a74f94bf4c3c6bfe": "Desconectado aqui, mas o T3 Connect ainda o lista. Remova-o em Conta.", "4ca203c6fe28afa6": "Entre no T3 Connect antes de ativar isto.", + "895d824b027d128e": "Esta conexão precisa da permissão para configurar o relay antes de configurar o T3 Connect.", "e4f274ef6c9c9a6c": "Escolha uma pasta na outra máquina.", "5aa50c97d1573919": "Não foi possível iniciar o clone.", "1a31b5a1f4fe467f": "Esta máquina", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 778242a2d3f63..1bbe31fb3330e 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "Дождитесь, пока текущие настройки T3 Connect можно будет прочитать.", "a74f94bf4c3c6bfe": "Отключено здесь, но T3 Connect всё ещё его показывает. Удалите его в разделе «Аккаунт».", "4ca203c6fe28afa6": "Войдите в T3 Connect, прежде чем включать это.", + "895d824b027d128e": "Для настройки T3 Connect этому подключению нужно разрешение на настройку ретранслятора.", "e4f274ef6c9c9a6c": "Выберите папку на другой машине.", "5aa50c97d1573919": "Не удалось начать клонирование.", "1a31b5a1f4fe467f": "Эта машина", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index da9a529095e41..06b73679984d5 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "Vänta tills de aktuella T3 Connect-inställningarna kan läsas.", "a74f94bf4c3c6bfe": "Frånkopplad här, men T3 Connect listar den fortfarande. Ta bort den under Konto.", "4ca203c6fe28afa6": "Logga in på T3 Connect innan du aktiverar det här.", + "895d824b027d128e": "Den här anslutningen behöver behörighet att konfigurera reläet för att konfigurera T3 Connect.", "e4f274ef6c9c9a6c": "Välj en mapp på den andra datorn.", "5aa50c97d1573919": "Kunde inte starta kloningen.", "1a31b5a1f4fe467f": "Den här datorn", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 0ee5d09251cc2..cd01138decd12 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -1487,6 +1487,7 @@ "64b5d9920f89189c": "请等待当前 T3 Connect 设置可以读取。", "a74f94bf4c3c6bfe": "已在此断开,但 T3 Connect 仍列出此环境。请到账户中移除。", "4ca203c6fe28afa6": "启用前请先登录 T3 Connect。", + "895d824b027d128e": "此连接需要中继配置权限才能设置 T3 Connect。", "e4f274ef6c9c9a6c": "请选择另一台机器上的文件夹。", "5aa50c97d1573919": "无法开始克隆。", "1a31b5a1f4fe467f": "本机", diff --git a/docs/user/remote-access.md b/docs/user/remote-access.md index f91f119aaeb5b..836be39cb0080 100644 --- a/docs/user/remote-access.md +++ b/docs/user/remote-access.md @@ -425,7 +425,8 @@ t3 pair --scope orchestration:read --scope relay:read The selected scopes replace the default permissions. The same option works with `t3 auth pairing create` and `t3 auth session issue`; each command's `--help` lists the available scopes. Without `--scope`, pairing tokens and issued -bearer sessions get every permission, including managing access and T3 Connect. +bearer sessions get the standard client permissions, including managing access. +Setting up or replacing a T3 Connect link requires the separate `relay:configure` permission. A terminal or a full-access agent on the host can reach those as well, so a client that should not manage access also needs to go without `terminal:operate` and `orchestration:operate`. From bec25bddd90f06f980a773c33381c3a9d79c2525 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 14:20:08 -0800 Subject: [PATCH 11/14] fix(mobile): report partial Live Activity preference updates --- .../liveActivityPreferences.test.ts | 15 +++++-- .../liveActivityPreferences.ts | 39 ++++++++++++++++--- .../SettingsNotificationsRouteScreen.tsx | 27 +++++++++++-- apps/mobile/src/i18n/translations/de.json | 2 + apps/mobile/src/i18n/translations/en.json | 2 + apps/mobile/src/i18n/translations/es.json | 2 + apps/mobile/src/i18n/translations/fr.json | 2 + apps/mobile/src/i18n/translations/ja.json | 2 + apps/mobile/src/i18n/translations/ko.json | 2 + apps/mobile/src/i18n/translations/pt-BR.json | 2 + apps/mobile/src/i18n/translations/ru.json | 2 + apps/mobile/src/i18n/translations/sv.json | 2 + apps/mobile/src/i18n/translations/zh.json | 2 + 13 files changed, 89 insertions(+), 12 deletions(-) diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts index 3008b64b33a46..b0e17b9966228 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts @@ -1,5 +1,7 @@ import { beforeEach, vi } from "vite-plus/test"; import { describe, expect, it } from "@effect/vitest"; +import * as Exit from "effect/Exit"; +import * as Option from "effect/Option"; import * as Effect from "effect/Effect"; import type { EnvironmentId } from "@t3tools/contracts"; import { ManagedRelay } from "@t3tools/client-runtime/relay"; @@ -83,6 +85,7 @@ describe("liveActivityPreferences", () => { }); it.effect("restores only the device preference when an environment update fails", () => { + const otherConnection = { ...connection, environmentId: "env-2" as EnvironmentId }; updateEnvironment.mockImplementationOnce(() => Effect.fail(new CloudEnvironmentLinkError({ message: "environment update failed" })), ); @@ -94,20 +97,26 @@ describe("liveActivityPreferences", () => { enabled: false, previousEnabled: true, clerkToken: "clerk-token", - connections: [connection], + connections: [connection, otherConnection], canConfigureEnvironment: () => false, canUpdateEnvironment: () => true, }), ); - expect(exit._tag).toBe("Failure"); + expect(Exit.findErrorOption(exit)).toEqual( + Option.some( + expect.objectContaining({ updatedEnvironments: [otherConnection.environmentLabel] }), + ), + ); expect(updateAgentAwarenessRegistrationPreferences).toHaveBeenNthCalledWith(1, { liveActivitiesEnabled: false, }); expect(updateAgentAwarenessRegistrationPreferences).toHaveBeenNthCalledWith(2, { liveActivitiesEnabled: true, }); - expect(updateEnvironment).toHaveBeenCalledExactlyOnceWith(connection.environmentId, false); + expect(updateEnvironment).toHaveBeenCalledTimes(2); + expect(updateEnvironment).toHaveBeenCalledWith(connection.environmentId, false); + expect(updateEnvironment).toHaveBeenCalledWith(otherConnection.environmentId, false); expect(linkEnvironmentToCloudWithPreference).not.toHaveBeenCalled(); }).pipe(Effect.provide(layerTest)); }); diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts index 00ea5c8dc6a07..4fc168ceb3770 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts @@ -1,4 +1,6 @@ import * as Effect from "effect/Effect"; +import * as Result from "effect/Result"; +import * as Schema from "effect/Schema"; import type { EnvironmentId } from "@t3tools/contracts"; import type { SavedRemoteConnection } from "../../lib/connection"; @@ -8,6 +10,14 @@ import { } from "../cloud/linkEnvironment"; import { updateAgentAwarenessRegistrationPreferences } from "./remoteRegistration"; +export class LiveActivityEnvironmentUpdateError extends Schema.TaggedError()( + "LiveActivityEnvironmentUpdateError", + { + updatedEnvironments: Schema.Array(Schema.String), + cause: Schema.Defect(), + }, +) {} + export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEnabled")( function* (input: { readonly enabled: boolean; @@ -29,14 +39,14 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn const result = input.canUpdateEnvironment(connection.environmentId) ? yield* input.updateEnvironment(connection.environmentId, enabled) : "unlinked"; - if (result === "updated") return false; + if (result === "updated") return "updated" as const; if ( !enabled || !clerkToken || !connection.bearerToken || !input.canConfigureEnvironment(connection.environmentId) ) { - return result === "unsupported"; + return result; } yield* linkEnvironmentToCloudWithPreference({ @@ -44,7 +54,7 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn connection, liveActivitiesEnabled: enabled, }); - return false; + return "updated" as const; }); const updateRelayPreference = Effect.fn("updateRelayPreference")(function* (enabled: boolean) { @@ -57,10 +67,29 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn const results = yield* Effect.forEach( input.connections, - (connection) => updateEnvironmentPreference(connection, enabled, clerkToken), + (connection) => + updateEnvironmentPreference(connection, enabled, clerkToken).pipe( + Effect.result, + Effect.map((result) => ({ connection, result })), + ), { concurrency: "unbounded" }, ); - return results.some(Boolean); + const failure = results.find(({ result }) => Result.isFailure(result)); + if (failure && Result.isFailure(failure.result)) { + const updatedEnvironments = results.flatMap(({ connection, result }) => + Result.isSuccess(result) && result.success === "updated" + ? [connection.environmentLabel] + : [], + ); + if (updatedEnvironments.length === 0) return yield* failure.result.failure; + return yield* new LiveActivityEnvironmentUpdateError({ + updatedEnvironments, + cause: failure.result.failure, + }); + } + return results.some( + ({ result }) => Result.isSuccess(result) && result.success === "unsupported", + ); }); return yield* updateRelayPreference(input.enabled).pipe( diff --git a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx index fee30035f5ef0..969ff8c55c8a2 100644 --- a/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx @@ -37,7 +37,10 @@ import { openAndroidLiveUpdateSettings, supportsAndroidLiveUpdateSettings, } from "../agent-awareness/androidNotifications"; -import { setLiveActivityUpdatesEnabled } from "../agent-awareness/liveActivityPreferences"; +import { + LiveActivityEnvironmentUpdateError, + setLiveActivityUpdatesEnabled, +} from "../agent-awareness/liveActivityPreferences"; import { requestAgentNotificationPermission } from "../agent-awareness/notificationPermissions"; import { agentAwarenessNotificationsReady, @@ -67,6 +70,7 @@ const updateLiveActivityPreference = createEnvironmentCommand(connectionAtomRunt execute: updateLinkedEnvironmentLiveActivityPreference, }); +const isLiveActivityEnvironmentUpdateError = Schema.is(LiveActivityEnvironmentUpdateError); const isCloudEnvironmentLinkError = Schema.is(CloudEnvironmentLinkError); const updateEnvironmentPreference = Effect.fn("updateEnvironmentPreference")(function* ( @@ -370,6 +374,7 @@ function ConfiguredSettingsNotificationsRouteScreen() { setLiveActivityStatus("disabled"); if (!isAtomCommandInterrupted(updateResult)) { const error = squashAtomCommandFailure(updateResult); + if (reportPartialEnvironmentUpdate(error)) return; Dialog.alert( Platform.OS === "android" ? gt("Ongoing activity unavailable") @@ -462,9 +467,11 @@ function ConfiguredSettingsNotificationsRouteScreen() { ); if (updateResult._tag === "Failure") { setLiveActivityStatus(isSignedIn ? "enabled" : "signed-out"); - reportAtomCommandResult(updateResult, { - label: "live activity disable", - }); + if (!reportPartialEnvironmentUpdate(squashAtomCommandFailure(updateResult))) { + reportAtomCommandResult(updateResult, { + label: "live activity disable", + }); + } return; } savePreferences({ liveActivitiesEnabled: false }); @@ -480,6 +487,18 @@ function ConfiguredSettingsNotificationsRouteScreen() { } } + function reportPartialEnvironmentUpdate(error: unknown): boolean { + if (!isLiveActivityEnvironmentUpdateError(error)) return false; + refreshManagedRelayEnvironments(); + Dialog.alert( + gt("Some environments were updated"), + gt("The device setting was not saved. The new setting was applied to: {environments}.", { + environments: error.updatedEnvironments.join(", "), + }), + ); + return true; + } + // Both writers settle their own failures, so awaiting them never throws. const handleLiveActivitiesChange = async (enabled: boolean) => { if (liveActivityWriteInFlight.current) return; diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index fb9d425cad1a4..7eca9a2b336ca 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -3283,6 +3283,8 @@ "0aecb0b05ccd394e": "Dieses Gerät konnte nicht bei {product} registriert werden, daher erscheinen noch keine Aktivitäts-Updates. Sie starten, sobald die Registrierung erfolgreich ist.", "79f07c54023a5bf7": "Benachrichtigungen deaktivieren", "ebf3eaee224a5372": "Öffne die Systemeinstellungen, um Benachrichtigungen für {product} zu deaktivieren.", + "990fb243dc6a5448": "Einige Umgebungen wurden aktualisiert", + "0a3f122ccb7757c8": "Die Geräteeinstellung wurde nicht gespeichert. Die neue Einstellung gilt für: {environments}.", "d65f9a3ee3f07eb8": "Agentenaktivität", "9ddc5a1e3ae7dc5d": "Gerätebenachrichtigungen", "3f5506ebb3736478": "Live-Updates der Agenten", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index 8e2cbfb62e73c..3c7927ae4b17d 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -3284,6 +3284,8 @@ "0aecb0b05ccd394e": "This device could not be registered with {product}, so activity updates won't appear yet. They'll start once registration succeeds.", "79f07c54023a5bf7": "Disable notifications", "ebf3eaee224a5372": "Open system Settings to disable notifications for {product}.", + "990fb243dc6a5448": "Some environments were updated", + "0a3f122ccb7757c8": "The device setting was not saved. The new setting was applied to: {environments}.", "d65f9a3ee3f07eb8": "Agent activity", "9ddc5a1e3ae7dc5d": "Device Notifications", "3f5506ebb3736478": "Agent Live Updates", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index ef28f0e1d11c7..fccd31613416b 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -3278,6 +3278,8 @@ "0aecb0b05ccd394e": "No se pudo registrar este dispositivo en {product}, así que aún no aparecerán actualizaciones de actividad. Empezarán cuando el registro se complete.", "79f07c54023a5bf7": "Desactivar notificaciones", "ebf3eaee224a5372": "Abre los ajustes del sistema para desactivar las notificaciones de {product}.", + "990fb243dc6a5448": "Se actualizaron algunos entornos", + "0a3f122ccb7757c8": "No se guardó la configuración del dispositivo. La nueva configuración se aplicó a: {environments}.", "d65f9a3ee3f07eb8": "Actividad de agentes", "9ddc5a1e3ae7dc5d": "Notificaciones del dispositivo", "3f5506ebb3736478": "Actualizaciones en directo de agentes", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 535af5a6a9ab9..0eb7de7ae13f6 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -3278,6 +3278,8 @@ "0aecb0b05ccd394e": "Cet appareil n’a pas pu être inscrit auprès de {product}, les mises à jour d’activité n’apparaîtront donc pas encore. Elles commenceront dès que l’inscription aura réussi.", "79f07c54023a5bf7": "Désactiver les notifications", "ebf3eaee224a5372": "Ouvrez les Réglages du système pour désactiver les notifications de {product}.", + "990fb243dc6a5448": "Certains environnements ont été mis à jour", + "0a3f122ccb7757c8": "Le réglage de l’appareil n’a pas été enregistré. Le nouveau réglage a été appliqué à : {environments}.", "d65f9a3ee3f07eb8": "Activité des agents", "9ddc5a1e3ae7dc5d": "Notifications de l’appareil", "3f5506ebb3736478": "Live Updates des agents", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index 5be1c8cf5c4ed..53c83811c86fc 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -3275,6 +3275,8 @@ "0aecb0b05ccd394e": "このデバイスを {product} に登録できなかったため、アクティビティの更新はまだ表示されません。登録が成功すると表示されるようになります。", "79f07c54023a5bf7": "通知を無効にする", "ebf3eaee224a5372": "{product} の通知を無効にするには、システムの設定を開いてください。", + "990fb243dc6a5448": "一部の環境が更新されました", + "0a3f122ccb7757c8": "デバイスの設定は保存されませんでした。新しい設定が適用された環境: {environments}。", "d65f9a3ee3f07eb8": "エージェントのアクティビティ", "9ddc5a1e3ae7dc5d": "デバイスの通知", "3f5506ebb3736478": "エージェントのライブアップデート", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index 9ac58d1324875..a5273b76597b9 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -3279,6 +3279,8 @@ "0aecb0b05ccd394e": "이 기기를 {product}에 등록할 수 없어 아직 활동 업데이트가 표시되지 않습니다. 등록이 완료되면 시작됩니다.", "79f07c54023a5bf7": "알림 끄기", "ebf3eaee224a5372": "{product} 알림을 끄려면 시스템 설정을 여세요.", + "990fb243dc6a5448": "일부 환경이 업데이트되었습니다", + "0a3f122ccb7757c8": "기기 설정이 저장되지 않았습니다. 새 설정이 적용된 환경: {environments}.", "d65f9a3ee3f07eb8": "에이전트 활동", "9ddc5a1e3ae7dc5d": "기기 알림", "3f5506ebb3736478": "에이전트 실시간 업데이트", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index d537147d41381..61568ed229ee5 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -3278,6 +3278,8 @@ "0aecb0b05ccd394e": "Este dispositivo não pôde ser registrado no {product}, então as atualizações de atividade ainda não vão aparecer. Elas começarão quando o registro for concluído.", "79f07c54023a5bf7": "Desativar notificações", "ebf3eaee224a5372": "Abra os Ajustes do sistema para desativar as notificações do {product}.", + "990fb243dc6a5448": "Alguns ambientes foram atualizados", + "0a3f122ccb7757c8": "A configuração do dispositivo não foi salva. A nova configuração foi aplicada a: {environments}.", "d65f9a3ee3f07eb8": "Atividade dos agentes", "9ddc5a1e3ae7dc5d": "Notificações do dispositivo", "3f5506ebb3736478": "Live Updates dos agentes", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index 88cb6f87c1c6f..88de82e87d863 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -3332,6 +3332,8 @@ "0aecb0b05ccd394e": "Это устройство не удалось зарегистрировать в {product}, поэтому обновления активности пока не появятся. Они начнут приходить после успешной регистрации.", "79f07c54023a5bf7": "Отключить уведомления", "ebf3eaee224a5372": "Откройте системные настройки, чтобы отключить уведомления для {product}.", + "990fb243dc6a5448": "Некоторые среды обновлены", + "0a3f122ccb7757c8": "Настройка устройства не сохранена. Новая настройка применена к следующим средам: {environments}.", "d65f9a3ee3f07eb8": "Активность агентов", "9ddc5a1e3ae7dc5d": "Уведомления устройства", "3f5506ebb3736478": "Live Updates агентов", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 5de253d72d583..7f545c9ddce40 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -3284,6 +3284,8 @@ "0aecb0b05ccd394e": "Enheten kunde inte registreras hos {product}, så aktivitetsuppdateringar visas inte än. De startar när registreringen lyckas.", "79f07c54023a5bf7": "Inaktivera aviseringar", "ebf3eaee224a5372": "Öppna systeminställningarna för att inaktivera aviseringar för {product}.", + "990fb243dc6a5448": "Vissa miljöer uppdaterades", + "0a3f122ccb7757c8": "Enhetsinställningen sparades inte. Den nya inställningen tillämpades på: {environments}.", "d65f9a3ee3f07eb8": "Agentaktivitet", "9ddc5a1e3ae7dc5d": "Enhetsaviseringar", "3f5506ebb3736478": "Liveuppdateringar från agenter", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index 1d4b529847b88..567d7ded9508c 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -3280,6 +3280,8 @@ "0aecb0b05ccd394e": "此设备无法注册到 {product},因此暂时不会显示活动更新。注册成功后即会开始显示。", "79f07c54023a5bf7": "关闭通知", "ebf3eaee224a5372": "打开系统设置以关闭 {product} 的通知。", + "990fb243dc6a5448": "部分环境已更新", + "0a3f122ccb7757c8": "设备设置未保存。新设置已应用于:{environments}。", "d65f9a3ee3f07eb8": "智能体活动", "9ddc5a1e3ae7dc5d": "设备通知", "3f5506ebb3736478": "智能体实时更新", From 9ad490415bbd62813e49495fe0436f5da49657db Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 14:34:06 -0800 Subject: [PATCH 12/14] fix(mobile): report relay preferences committed before config failure --- .../liveActivityPreferences.test.ts | 35 +++++++++++++++++++ .../liveActivityPreferences.ts | 11 +++--- .../src/features/cloud/linkEnvironment.ts | 9 ++++- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts index b0e17b9966228..a7cfb0ddc1cb6 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts @@ -121,6 +121,41 @@ describe("liveActivityPreferences", () => { }).pipe(Effect.provide(layerTest)); }); + it.effect("reports a relay preference committed before environment configuration fails", () => { + const failure = new CloudEnvironmentLinkError({ + message: "environment configuration failed", + relayLinkCommitted: true, + }); + updateEnvironment.mockReturnValueOnce(Effect.succeed("unlinked")); + vi.mocked(linkEnvironmentToCloudWithPreference).mockReturnValueOnce(Effect.fail(failure)); + + return Effect.gen(function* () { + const exit = yield* Effect.exit( + setLiveActivityUpdatesEnabled({ + updateEnvironment, + enabled: true, + previousEnabled: false, + clerkToken: "clerk-token", + connections: [connection], + canConfigureEnvironment: () => true, + canUpdateEnvironment: () => true, + }), + ); + + expect(Exit.findErrorOption(exit)).toEqual( + Option.some( + expect.objectContaining({ + updatedEnvironments: [connection.environmentLabel], + cause: failure, + }), + ), + ); + expect(updateAgentAwarenessRegistrationPreferences).toHaveBeenLastCalledWith({ + liveActivitiesEnabled: false, + }); + }).pipe(Effect.provide(layerTest)); + }); + it.effect("only creates missing links when the session can configure Connect", () => { updateEnvironment.mockReturnValueOnce(Effect.succeed("unlinked" as const)); const readOnlyConnection: SavedRemoteConnection = { diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts index 4fc168ceb3770..34f0e369d0a4d 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts @@ -76,11 +76,12 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn ); const failure = results.find(({ result }) => Result.isFailure(result)); if (failure && Result.isFailure(failure.result)) { - const updatedEnvironments = results.flatMap(({ connection, result }) => - Result.isSuccess(result) && result.success === "updated" - ? [connection.environmentLabel] - : [], - ); + const updatedEnvironments = results.flatMap(({ connection, result }) => { + const changed = Result.isSuccess(result) + ? result.success === "updated" + : result.failure.relayLinkCommitted === true; + return changed ? [connection.environmentLabel] : []; + }); if (updatedEnvironments.length === 0) return yield* failure.result.failure; return yield* new LiveActivityEnvironmentUpdateError({ updatedEnvironments, diff --git a/apps/mobile/src/features/cloud/linkEnvironment.ts b/apps/mobile/src/features/cloud/linkEnvironment.ts index fb40f028bdb17..6f1d93e4145a0 100644 --- a/apps/mobile/src/features/cloud/linkEnvironment.ts +++ b/apps/mobile/src/features/cloud/linkEnvironment.ts @@ -36,6 +36,7 @@ export class CloudEnvironmentLinkError extends Schema.TaggedError string) { +function cloudEnvironmentLinkError( + message: string, + withDetail: (detail: string) => string, + options?: { readonly relayLinkCommitted: true }, +) { return (cause: unknown) => { const environmentError = findEnvironmentCloudApiError(cause); const traceId = findErrorTraceId(cause); @@ -63,6 +68,7 @@ function cloudEnvironmentLinkError(message: string, withDetail: (detail: string) return new CloudEnvironmentLinkError({ message: detail, cause, + ...options, ...(traceId === null ? {} : { traceId }), }); }; @@ -308,6 +314,7 @@ export const linkEnvironmentToCloudWithPreference = Effect.fn( cloudEnvironmentLinkError( m(msg("Could not configure environment relay access.")), (detail) => m(msg("Could not configure environment relay access: {detail}", { detail })), + { relayLinkCommitted: true }, ), ), ); From ce011ad3228c3b3dc86f64e816a5381f729dd5e2 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 14:49:30 -0800 Subject: [PATCH 13/14] fix(mobile): skip disconnected Live Activity preference targets --- .../liveActivityPreferences.test.ts | 5 ++- .../liveActivityPreferences.ts | 7 +++- .../features/cloud/linkEnvironment.test.ts | 42 ++++++++++++++++++- .../src/features/cloud/linkEnvironment.ts | 8 ++++ 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts index a7cfb0ddc1cb6..6a6e08f082999 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts @@ -46,7 +46,10 @@ const updateEnvironment = vi.fn< ( id: EnvironmentId, enabled: boolean, - ) => Effect.Effect<"updated" | "unlinked" | "unsupported", CloudEnvironmentLinkError> + ) => Effect.Effect< + "updated" | "unlinked" | "unsupported" | "disconnected", + CloudEnvironmentLinkError + > >(() => Effect.succeed("updated")); const connection: SavedRemoteConnection = { diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts index 34f0e369d0a4d..ac403600a7c5e 100644 --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts @@ -27,7 +27,10 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn readonly updateEnvironment: ( environmentId: EnvironmentId, enabled: boolean, - ) => Effect.Effect<"updated" | "unlinked" | "unsupported", CloudEnvironmentLinkError>; + ) => Effect.Effect< + "updated" | "unlinked" | "unsupported" | "disconnected", + CloudEnvironmentLinkError + >; readonly canUpdateEnvironment: (environmentId: EnvironmentId) => boolean; readonly canConfigureEnvironment: (environmentId: EnvironmentId) => boolean; }) { @@ -39,7 +42,7 @@ export const setLiveActivityUpdatesEnabled = Effect.fn("setLiveActivityUpdatesEn const result = input.canUpdateEnvironment(connection.environmentId) ? yield* input.updateEnvironment(connection.environmentId, enabled) : "unlinked"; - if (result === "updated") return "updated" as const; + if (result === "updated" || result === "disconnected") return result; if ( !enabled || !clerkToken || diff --git a/apps/mobile/src/features/cloud/linkEnvironment.test.ts b/apps/mobile/src/features/cloud/linkEnvironment.test.ts index 2f9618e0953cd..9e8bac68cfce1 100644 --- a/apps/mobile/src/features/cloud/linkEnvironment.test.ts +++ b/apps/mobile/src/features/cloud/linkEnvironment.test.ts @@ -1,16 +1,27 @@ import { beforeEach, vi } from "vite-plus/test"; import { describe, expect, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; +import * as Option from "effect/Option"; +import * as SubscriptionRef from "effect/SubscriptionRef"; import * as Layer from "effect/Layer"; import { EnvironmentId } from "@t3tools/contracts"; import { RelayMobileClientId } from "@t3tools/contracts/relay"; +import { + EnvironmentSupervisor, + AVAILABLE_CONNECTION_STATE, + PrimaryConnectionTarget, + type PreparedConnection, +} from "@t3tools/client-runtime/connection"; import { ManagedRelay } from "@t3tools/client-runtime/relay"; -import { layerRemoteHttpClient } from "@t3tools/client-runtime/rpc"; +import { layerRemoteHttpClient, type RpcSession } from "@t3tools/client-runtime/rpc"; import { HttpClient } from "effect/http"; import * as MobileStorage from "../../persistence/mobile-storage"; -import { linkEnvironmentToCloudWithPreference } from "./linkEnvironment"; +import { + linkEnvironmentToCloudWithPreference, + updateLinkedEnvironmentLiveActivityPreference, +} from "./linkEnvironment"; vi.mock("expo-constants", () => ({ default: { @@ -146,6 +157,33 @@ describe("mobile cloud link environment client", () => { createProofMock.mockClear(); }); + it.effect("skips Live Activity updates when the environment has no prepared connection", () => + Effect.gen(function* () { + const supervisor = EnvironmentSupervisor.EnvironmentSupervisor.of({ + target: new PrimaryConnectionTarget({ + environmentId: savedConnection.environmentId, + label: savedConnection.environmentLabel, + httpBaseUrl: savedConnection.httpBaseUrl, + wsBaseUrl: savedConnection.wsBaseUrl, + }), + state: yield* SubscriptionRef.make(AVAILABLE_CONNECTION_STATE), + session: yield* SubscriptionRef.make(Option.none()), + prepared: yield* SubscriptionRef.make(Option.none()), + connect: Effect.void, + disconnect: Effect.void, + retryNow: Effect.void, + }); + const result = yield* updateLinkedEnvironmentLiveActivityPreference(true).pipe( + Effect.provideService(EnvironmentSupervisor.EnvironmentSupervisor, supervisor), + Effect.provideService( + HttpClient.HttpClient, + HttpClient.make(() => Effect.die("unexpected HTTP request")), + ), + ); + expect(result).toBe("disconnected"); + }), + ); + it.effect( "rejects relay link credentials for a different environment before persisting relay config", () => diff --git a/apps/mobile/src/features/cloud/linkEnvironment.ts b/apps/mobile/src/features/cloud/linkEnvironment.ts index 6f1d93e4145a0..18e1757b4a769 100644 --- a/apps/mobile/src/features/cloud/linkEnvironment.ts +++ b/apps/mobile/src/features/cloud/linkEnvironment.ts @@ -1,4 +1,6 @@ import * as Effect from "effect/Effect"; +import * as Option from "effect/Option"; +import * as SubscriptionRef from "effect/SubscriptionRef"; import * as Schema from "effect/Schema"; import { HttpClient, type HttpClientResponse } from "effect/http"; import { @@ -14,6 +16,7 @@ import { type RelayEnvironmentLinkResponse as RelayEnvironmentLinkResponseType, type RelayManagedEndpointProviderKind, } from "@t3tools/contracts/relay"; +import { EnvironmentSupervisor } from "@t3tools/client-runtime/connection"; import { findErrorTraceId } from "@t3tools/client-runtime/errors"; import { ManagedRelay, relayRequestFailureDetail } from "@t3tools/client-runtime/relay"; import { makeEnvironmentHttpApiClient } from "@t3tools/client-runtime/rpc"; @@ -175,6 +178,11 @@ const decodeRelayOkResponse = Schema.decodeUnknownEffect(RelayOkResponse); export const updateLinkedEnvironmentLiveActivityPreference = Effect.fn( "linkEnvironment.updateLinkedEnvironmentLiveActivityPreference", )(function* (liveActivitiesEnabled: boolean) { + const supervisor = yield* EnvironmentSupervisor.EnvironmentSupervisor; + if (Option.isNone(yield* SubscriptionRef.get(supervisor.prepared))) { + return "disconnected" as const; + } + return yield* executeConnectedEnvironmentHttpRequest< "connect", HttpClientResponse.HttpClientResponse, From 826a816ff2113347462e0ae4f29983eea814dfbe Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 17:30:26 -0800 Subject: [PATCH 14/14] fix(web): disable Connect switches that need relay configuration Settings rows checked only relay:write, so a standard pairing saw active link and tunnel switches that then failed with a permission toast. Share one predicate for changes that link or relink, and disable those switches with the reason when the session lacks relay:configure. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/cloud/t3ConnectState.test.ts | 78 +++++++++++++++++++ apps/web/src/cloud/t3ConnectState.ts | 17 ++++ apps/web/src/cloud/useCloudLinkController.ts | 21 +++-- .../settings/SavedEnvironmentRows.tsx | 20 ++++- 4 files changed, 124 insertions(+), 12 deletions(-) create mode 100644 apps/web/src/cloud/t3ConnectState.test.ts diff --git a/apps/web/src/cloud/t3ConnectState.test.ts b/apps/web/src/cloud/t3ConnectState.test.ts new file mode 100644 index 0000000000000..ef1de0a1e1eec --- /dev/null +++ b/apps/web/src/cloud/t3ConnectState.test.ts @@ -0,0 +1,78 @@ +import type { EnvironmentCloudLinkStateResult } from "@t3tools/contracts"; +import { describe, expect, it } from "vite-plus/test"; + +import { cloudChangeReplacesLink } from "./t3ConnectState"; + +function linkState(input: { + readonly linked: boolean; + readonly tunnel: boolean; + readonly revoked?: boolean; +}): EnvironmentCloudLinkStateResult { + return { + linked: input.linked, + cloudUserId: input.linked ? "user" : null, + relayUrl: input.linked ? "https://relay.example.test" : null, + relayIssuer: null, + managedTunnelActive: input.tunnel, + publishAgentActivity: input.linked, + linkRevoked: input.revoked ?? false, + }; +} + +describe("cloudChangeReplacesLink", () => { + it.each([ + { + name: "linking a tunnel", + state: { linked: false, tunnel: false }, + tunnel: true, + publish: false, + expected: true, + }, + { + name: "linking publish-only", + state: { linked: false, tunnel: false }, + tunnel: false, + publish: true, + expected: true, + }, + { + name: "repairing a revoked link", + state: { linked: true, tunnel: true, revoked: true }, + tunnel: true, + publish: true, + expected: true, + }, + { + name: "dropping the tunnel but keeping publish", + state: { linked: true, tunnel: true }, + tunnel: false, + publish: true, + expected: true, + }, + { + name: "adding a tunnel to a publish-only link", + state: { linked: true, tunnel: false }, + tunnel: true, + publish: true, + expected: true, + }, + { + name: "unlinking", + state: { linked: true, tunnel: true }, + tunnel: false, + publish: false, + expected: false, + }, + { + name: "toggling publish on a tunnel link", + state: { linked: true, tunnel: true }, + tunnel: true, + publish: false, + expected: false, + }, + ])("$name → $expected", ({ state, tunnel, publish, expected }) => { + expect( + cloudChangeReplacesLink(linkState(state), undefined, { managedTunnel: tunnel, publish }), + ).toBe(expected); + }); +}); diff --git a/apps/web/src/cloud/t3ConnectState.ts b/apps/web/src/cloud/t3ConnectState.ts index 67fef2eaee1a6..ae118214df471 100644 --- a/apps/web/src/cloud/t3ConnectState.ts +++ b/apps/web/src/cloud/t3ConnectState.ts @@ -18,6 +18,23 @@ export function isManagedTunnelActive( ); } +/** + * Whether reaching `desired` links or relinks the environment, which needs `relay:configure`. + * Unlinking and preference changes on the current link only need `relay:write`. + */ +export function cloudChangeReplacesLink( + linkState: EnvironmentCloudLinkStateResult, + relayProviderKind: RelayManagedEndpointProviderKind | undefined, + desired: { readonly managedTunnel: boolean; readonly publish: boolean }, +) { + return ( + (desired.managedTunnel || desired.publish) && + (!linkState.linked || + linkState.linkRevoked === true || + isManagedTunnelActive(linkState, relayProviderKind) !== desired.managedTunnel) + ); +} + // The URL ends up in commands people paste into a shell, so only plain DNS names pass. const TUNNEL_HOSTNAME = /^[a-z0-9-]+(\.[a-z0-9-]+)+$/i; diff --git a/apps/web/src/cloud/useCloudLinkController.ts b/apps/web/src/cloud/useCloudLinkController.ts index 1c22aadfc4e9b..bd394a20d8e0f 100644 --- a/apps/web/src/cloud/useCloudLinkController.ts +++ b/apps/web/src/cloud/useCloudLinkController.ts @@ -17,7 +17,11 @@ import { m } from "../i18n/messages"; import { stackedThreadToast } from "../components/ui/toastHelpers"; import { relayFailureReason } from "./relayFailureReason"; import { relayEnvironmentDiscovery } from "../state/relay"; -import { readEnvironmentCanConfigureRelay, readEnvironmentScope } from "../state/session"; +import { + readEnvironmentCanConfigureRelay, + readEnvironmentScope, + useEnvironmentCanConfigureRelay, +} from "../state/session"; import { useAtomCommand } from "../state/use-atom-command"; import { isCloudEnvironmentLinkError } from "./linkEnvironment"; import { refreshManagedTunnelUsage } from "./managedRelayState"; @@ -28,7 +32,7 @@ import { } from "./linkEnvironmentAtoms"; import { readCachedCloudLinkState, useCloudLinkState } from "./cloudLinkState"; import { resolveRelayClerkTokenOptions } from "./publicConfig"; -import { isManagedTunnelActive } from "./t3ConnectState"; +import { cloudChangeReplacesLink, isManagedTunnelActive } from "./t3ConnectState"; export interface CloudLinkDesiredState { readonly managedTunnel: boolean; @@ -105,6 +109,11 @@ export function useCloudLinkController(environmentId: EnvironmentId | null) { const publishAgentActivity = cloudLinkState.data?.publishAgentActivity ?? false; const holdWebhooksWhileOffline = cloudLinkState.data?.holdWebhooksWhileOffline ?? false; const linked = !linkRevoked && (cloudLinkState.data?.linked ?? false); + const canConfigureRelay = useEnvironmentCanConfigureRelay(environmentId); + const needsRelayConfiguration = (desired: CloudLinkDesiredState) => + !canConfigureRelay && + linkData !== null && + cloudChangeReplacesLink(linkData, relayProviderKind, desired); const reconcileCloudState = async (desired: CloudLinkDesiredState): Promise => { setOperationError(null); @@ -181,12 +190,7 @@ export function useCloudLinkController(environmentId: EnvironmentId | null) { reportUpdateFailure(new Error(m(msg("Sign in to T3 Connect before enabling this.")))); return false; } - const currentManagedTunnel = isManagedTunnelActive(currentLinkState, relayProviderKind); - if ( - !currentLinkState.linked || - currentLinkState.linkRevoked === true || - currentManagedTunnel !== desired.managedTunnel - ) { + if (cloudChangeReplacesLink(currentLinkState, relayProviderKind, desired)) { if (!readEnvironmentCanConfigureRelay(environmentId)) { reportUpdateFailure( new Error( @@ -258,6 +262,7 @@ export function useCloudLinkController(environmentId: EnvironmentId | null) { holdWebhooksWhileOffline, operationError, tunnelLimit, + needsRelayConfiguration, reconcileCloudState, }; } diff --git a/apps/web/src/components/settings/SavedEnvironmentRows.tsx b/apps/web/src/components/settings/SavedEnvironmentRows.tsx index dc6923a4c0656..3cd6a39e29516 100644 --- a/apps/web/src/components/settings/SavedEnvironmentRows.tsx +++ b/apps/web/src/components/settings/SavedEnvironmentRows.tsx @@ -582,6 +582,7 @@ function ConfiguredCloudLinkRow({ holdWebhooksWhileOffline, operationError, tunnelLimit, + needsRelayConfiguration, reconcileCloudState, } = useCloudLinkController(environmentId); const { openAuthPrompt } = useT3ConnectAuthPrompt(); @@ -608,6 +609,17 @@ function ConfiguredCloudLinkRow({ cloudLinkState.data === null || cloudLinkState.isPending || isBusy; + const configureReason = gt( + "This connection needs the relay configuration permission to configure T3 Connect.", + ); + const tunnelNeedsConfigure = needsRelayConfiguration({ + managedTunnel: !managedTunnelActive, + publish: publishAgentActivity, + }); + const publishNeedsConfigure = needsRelayConfiguration({ + managedTunnel: managedTunnelActive, + publish: !publishAgentActivity, + }); // `isSignedIn` is undefined until Clerk loads. Signed out, one row shows a // sign-in button instead of its switch; the onboarding dialog that opens after // a fresh sign-in offers both linking and publishing. @@ -744,8 +756,8 @@ function ConfiguredCloudLinkRow({ ) : ( void updateManagedTunnel(enabled)} /> ) @@ -784,8 +796,8 @@ function ConfiguredCloudLinkRow({ void updatePublishAgentActivity(enabled)} /> )