| author | |
| committer | |
| log | fdcc491e0b36245d4b4c74d1fd338d874f4ec84f |
| tree | 204f8807306e212bfaff5f3641c06c4daca6754a |
| parent | b2e15185aee22bfdee78806f2734b0a4de9c2c77 |
| signature | Signed by PGP key B5690EEEBB952194 |
21 files changed, 15 insertions(+), 187 deletions(-)
apps/web/src/assets/assetUrls.ts-8| ... | @@ -32,14 +32,6 @@ export function useAssetUrlState( | ... | @@ -32,14 +32,6 @@ export function useAssetUrlState( |
| 32 | ); | 32 | ); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | export function useAssetUrl( | ||
| 36 | environmentId: EnvironmentId | null, | ||
| 37 | resource: AssetResource | null, | ||
| 38 | ): string | null { | ||
| 39 | const result = useAssetUrlState(environmentId, resource); | ||
| 40 | return result._tag === "Success" ? result.url : null; | ||
| 41 | } | ||
| 42 | |||
| 43 | export function useAssetUrlRefresh( | 35 | export function useAssetUrlRefresh( |
| 44 | environmentId: EnvironmentId | null, | 36 | environmentId: EnvironmentId | null, |
| 45 | resource: AssetResource | null, | 37 | resource: AssetResource | null, |
apps/web/src/assets/projectFaviconCache.ts+1-1| ... | @@ -46,7 +46,7 @@ async function withStore<A>( | ... | @@ -46,7 +46,7 @@ async function withStore<A>( |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | /** Rasterizes a bitmap that is too large to inline, retrying at half size. */ | 48 | /** Rasterizes a bitmap that is too large to inline, retrying at half size. */ |
| 49 | export async function downscaleProjectFavicon( | 49 | async function downscaleProjectFavicon( |
| 50 | image: { readonly mimeType: string; readonly bytes: Uint8Array<ArrayBuffer> }, | 50 | image: { readonly mimeType: string; readonly bytes: Uint8Array<ArrayBuffer> }, |
| 51 | signal: AbortSignal, | 51 | signal: AbortSignal, |
| 52 | ) { | 52 | ) { |
apps/web/src/cloud/connectCliAuth.ts+1-1| ... | @@ -12,7 +12,7 @@ import { hasCloudPublicConfig, resolveCloudPublicConfig, trimNonEmpty } from "./ | ... | @@ -12,7 +12,7 @@ import { hasCloudPublicConfig, resolveCloudPublicConfig, trimNonEmpty } from "./ |
| 12 | 12 | ||
| 13 | const CONNECT_CLI_AUTH_STATE_STORAGE_KEY = "t3code-connect-cli-auth-state"; | 13 | const CONNECT_CLI_AUTH_STATE_STORAGE_KEY = "t3code-connect-cli-auth-state"; |
| 14 | 14 | ||
| 15 | export function resolveConnectCliOAuthClientId(): string | null { | 15 | function resolveConnectCliOAuthClientId(): string | null { |
| 16 | return trimNonEmpty(import.meta.env.VITE_CLERK_CLI_OAUTH_CLIENT_ID as string | undefined); | 16 | return trimNonEmpty(import.meta.env.VITE_CLERK_CLI_OAUTH_CLIENT_ID as string | undefined); |
| 17 | } | 17 | } |
| 18 | 18 |
apps/web/src/cloud/managedRelayLayer.ts+1-1| ... | @@ -13,7 +13,7 @@ import { | ... | @@ -13,7 +13,7 @@ import { |
| 13 | type BrowserDpopKey, | 13 | type BrowserDpopKey, |
| 14 | } from "./dpop"; | 14 | } from "./dpop"; |
| 15 | 15 | ||
| 16 | export const relayDpopSignerLayer = Layer.effect( | 16 | const relayDpopSignerLayer = Layer.effect( |
| 17 | ManagedRelay.ManagedRelayDpopSigner, | 17 | ManagedRelay.ManagedRelayDpopSigner, |
| 18 | Effect.gen(function* () { | 18 | Effect.gen(function* () { |
| 19 | const crypto = yield* Crypto.Crypto; | 19 | const crypto = yield* Crypto.Crypto; |
apps/web/src/cloud/managedRelayState.ts+1-8| ... | @@ -33,7 +33,7 @@ const managedRelayAtomRuntime = Atom.runtime( | ... | @@ -33,7 +33,7 @@ const managedRelayAtomRuntime = Atom.runtime( |
| 33 | ), | 33 | ), |
| 34 | ); | 34 | ); |
| 35 | 35 | ||
| 36 | export const managedRelayQueryManager = createManagedRelayQueryManager(managedRelayAtomRuntime); | 36 | const managedRelayQueryManager = createManagedRelayQueryManager(managedRelayAtomRuntime); |
| 37 | 37 | ||
| 38 | const managedRelayMutationScheduler = createAtomCommandScheduler(); | 38 | const managedRelayMutationScheduler = createAtomCommandScheduler(); |
| 39 | 39 | ||
| ... | @@ -114,10 +114,3 @@ export function useManagedRelayDevices() { | ... | @@ -114,10 +114,3 @@ export function useManagedRelayDevices() { |
| 114 | refresh, | 114 | refresh, |
| 115 | }; | 115 | }; |
| 116 | } | 116 | } |
| 117 | |||
| 118 | export function refreshManagedRelayEnvironments(): void { | ||
| 119 | const session = appAtomRegistry.get(managedRelaySessionAtom); | ||
| 120 | if (session) { | ||
| 121 | managedRelayQueryManager.refreshEnvironments(appAtomRegistry, session.accountId); | ||
| 122 | } | ||
| 123 | } |
apps/web/src/cloud/primaryCloudLinkState.ts+1-1| ... | @@ -42,7 +42,7 @@ function targetKey(target: CloudLinkTarget): string { | ... | @@ -42,7 +42,7 @@ function targetKey(target: CloudLinkTarget): string { |
| 42 | return JSON.stringify(target); | 42 | return JSON.stringify(target); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | export function refreshPrimaryCloudLinkState(target: CloudLinkTarget | null): void { | 45 | function refreshPrimaryCloudLinkState(target: CloudLinkTarget | null): void { |
| 46 | if (target) { | 46 | if (target) { |
| 47 | appAtomRegistry.refresh(primaryCloudLinkStateAtom(targetKey(target))); | 47 | appAtomRegistry.refresh(primaryCloudLinkStateAtom(targetKey(target))); |
| 48 | } | 48 | } |
apps/web/src/connection/desktopLocal.ts+1-1| ... | @@ -17,7 +17,7 @@ import { | ... | @@ -17,7 +17,7 @@ import { |
| 17 | * via {@link isDesktopLocalConnectionTarget}, so the convention can never drift | 17 | * via {@link isDesktopLocalConnectionTarget}, so the convention can never drift |
| 18 | * between the two. | 18 | * between the two. |
| 19 | */ | 19 | */ |
| 20 | export const DESKTOP_LOCAL_CONNECTION_ID_PREFIX = "local:"; | 20 | const DESKTOP_LOCAL_CONNECTION_ID_PREFIX = "local:"; |
| 21 | 21 | ||
| 22 | export function desktopLocalConnectionId(backendId: string): string { | 22 | export function desktopLocalConnectionId(backendId: string): string { |
| 23 | return `${DESKTOP_LOCAL_CONNECTION_ID_PREFIX}${backendId}`; | 23 | return `${DESKTOP_LOCAL_CONNECTION_ID_PREFIX}${backendId}`; |
apps/web/src/environments/primary/auth.ts+1-90| ... | @@ -9,7 +9,6 @@ import type { | ... | @@ -9,7 +9,6 @@ import type { |
| 9 | } from "@t3tools/contracts"; | 9 | } from "@t3tools/contracts"; |
| 10 | import { EnvironmentHttpCommonError, PRIMARY_LOCAL_ENVIRONMENT_ID } from "@t3tools/contracts"; | 10 | import { EnvironmentHttpCommonError, PRIMARY_LOCAL_ENVIRONMENT_ID } from "@t3tools/contracts"; |
| 11 | import type { EnvironmentHttpCommonError as EnvironmentHttpCommonErrorType } from "@t3tools/contracts"; | 11 | import type { EnvironmentHttpCommonError as EnvironmentHttpCommonErrorType } from "@t3tools/contracts"; |
| 12 | import * as DateTime from "effect/DateTime"; | ||
| 13 | import * as Effect from "effect/Effect"; | 12 | import * as Effect from "effect/Effect"; |
| 14 | import * as Schema from "effect/Schema"; | 13 | import * as Schema from "effect/Schema"; |
| 15 | import { HttpClientError } from "effect/unstable/http"; | 14 | import { HttpClientError } from "effect/unstable/http"; |
| ... | @@ -66,7 +65,7 @@ export class PrimaryEnvironmentRequestError extends Schema.TaggedErrorClass<Prim | ... | @@ -66,7 +65,7 @@ export class PrimaryEnvironmentRequestError extends Schema.TaggedErrorClass<Prim |
| 66 | } | 65 | } |
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | export const isPrimaryEnvironmentRequestError = Schema.is(PrimaryEnvironmentRequestError); | 68 | const isPrimaryEnvironmentRequestError = Schema.is(PrimaryEnvironmentRequestError); |
| 70 | 69 | ||
| 71 | export class PrimaryEnvironmentPairingCredentialRejectedError extends Schema.TaggedErrorClass<PrimaryEnvironmentPairingCredentialRejectedError>()( | 70 | export class PrimaryEnvironmentPairingCredentialRejectedError extends Schema.TaggedErrorClass<PrimaryEnvironmentPairingCredentialRejectedError>()( |
| 72 | "PrimaryEnvironmentPairingCredentialRejectedError", | 71 | "PrimaryEnvironmentPairingCredentialRejectedError", |
| ... | @@ -96,10 +95,6 @@ export class PrimaryEnvironmentAuthSessionTimeoutError extends Schema.TaggedErro | ... | @@ -96,10 +95,6 @@ export class PrimaryEnvironmentAuthSessionTimeoutError extends Schema.TaggedErro |
| 96 | } | 95 | } |
| 97 | } | 96 | } |
| 98 | 97 | ||
| 99 | export const isPrimaryEnvironmentAuthSessionTimeoutError = Schema.is( | ||
| 100 | PrimaryEnvironmentAuthSessionTimeoutError, | ||
| 101 | ); | ||
| 102 | |||
| 103 | export class PrimaryEnvironmentPairingCredentialRequiredError extends Schema.TaggedErrorClass<PrimaryEnvironmentPairingCredentialRequiredError>()( | 98 | export class PrimaryEnvironmentPairingCredentialRequiredError extends Schema.TaggedErrorClass<PrimaryEnvironmentPairingCredentialRequiredError>()( |
| 104 | "PrimaryEnvironmentPairingCredentialRequiredError", | 99 | "PrimaryEnvironmentPairingCredentialRequiredError", |
| 105 | { | 100 | { |
| ... | @@ -111,10 +106,6 @@ export class PrimaryEnvironmentPairingCredentialRequiredError extends Schema.Tag | ... | @@ -111,10 +106,6 @@ export class PrimaryEnvironmentPairingCredentialRequiredError extends Schema.Tag |
| 111 | } | 106 | } |
| 112 | } | 107 | } |
| 113 | 108 | ||
| 114 | export const isPrimaryEnvironmentPairingCredentialRequiredError = Schema.is( | ||
| 115 | PrimaryEnvironmentPairingCredentialRequiredError, | ||
| 116 | ); | ||
| 117 | |||
| 118 | const isEnvironmentHttpCommonError = Schema.is(EnvironmentHttpCommonError); | 109 | const isEnvironmentHttpCommonError = Schema.is(EnvironmentHttpCommonError); |
| 119 | 110 | ||
| 120 | export interface ServerPairingLinkRecord { | 111 | export interface ServerPairingLinkRecord { |
| ... | @@ -386,44 +377,6 @@ export async function createServerPairingCredential(input?: { | ... | @@ -386,44 +377,6 @@ export async function createServerPairingCredential(input?: { |
| 386 | } | 377 | } |
| 387 | } | 378 | } |
| 388 | 379 | ||
| 389 | export async function listServerPairingLinks(): Promise<ReadonlyArray<ServerPairingLinkRecord>> { | ||
| 390 | try { | ||
| 391 | const pairingLinks = await runPrimaryHttp( | ||
| 392 | PrimaryEnvironmentHttpClient.pipe( | ||
| 393 | Effect.flatMap((client) => client.auth.pairingLinks({ headers: {} })), | ||
| 394 | ), | ||
| 395 | ); | ||
| 396 | return pairingLinks.map((pairingLink) => { | ||
| 397 | const timestamps = { | ||
| 398 | createdAt: DateTime.formatIso(pairingLink.createdAt), | ||
| 399 | expiresAt: DateTime.formatIso(pairingLink.expiresAt), | ||
| 400 | }; | ||
| 401 | if (pairingLink.label === undefined) { | ||
| 402 | return { | ||
| 403 | id: pairingLink.id, | ||
| 404 | scopes: pairingLink.scopes, | ||
| 405 | subject: pairingLink.subject, | ||
| 406 | createdAt: timestamps.createdAt, | ||
| 407 | expiresAt: timestamps.expiresAt, | ||
| 408 | }; | ||
| 409 | } | ||
| 410 | return { | ||
| 411 | id: pairingLink.id, | ||
| 412 | scopes: pairingLink.scopes, | ||
| 413 | subject: pairingLink.subject, | ||
| 414 | label: pairingLink.label, | ||
| 415 | createdAt: timestamps.createdAt, | ||
| 416 | expiresAt: timestamps.expiresAt, | ||
| 417 | }; | ||
| 418 | }); | ||
| 419 | } catch (error) { | ||
| 420 | throw PrimaryEnvironmentRequestError.fromCause({ | ||
| 421 | operation: "list-pairing-links", | ||
| 422 | cause: error, | ||
| 423 | }); | ||
| 424 | } | ||
| 425 | } | ||
| 426 | |||
| 427 | export async function revokeServerPairingLink(id: string): Promise<void> { | 380 | export async function revokeServerPairingLink(id: string): Promise<void> { |
| 428 | try { | 381 | try { |
| 429 | await runPrimaryHttp( | 382 | await runPrimaryHttp( |
| ... | @@ -440,38 +393,6 @@ export async function revokeServerPairingLink(id: string): Promise<void> { | ... | @@ -440,38 +393,6 @@ export async function revokeServerPairingLink(id: string): Promise<void> { |
| 440 | } | 393 | } |
| 441 | } | 394 | } |
| 442 | 395 | ||
| 443 | export async function listServerClientSessions(): Promise< | ||
| 444 | ReadonlyArray<ServerClientSessionRecord> | ||
| 445 | > { | ||
| 446 | try { | ||
| 447 | const clientSessions = await runPrimaryHttp( | ||
| 448 | PrimaryEnvironmentHttpClient.pipe( | ||
| 449 | Effect.flatMap((client) => client.auth.clients({ headers: {} })), | ||
| 450 | ), | ||
| 451 | ); | ||
| 452 | return clientSessions.map((clientSession) => ({ | ||
| 453 | sessionId: clientSession.sessionId, | ||
| 454 | subject: clientSession.subject, | ||
| 455 | scopes: clientSession.scopes, | ||
| 456 | method: clientSession.method, | ||
| 457 | client: clientSession.client, | ||
| 458 | issuedAt: DateTime.formatIso(clientSession.issuedAt), | ||
| 459 | expiresAt: DateTime.formatIso(clientSession.expiresAt), | ||
| 460 | lastConnectedAt: | ||
| 461 | clientSession.lastConnectedAt === null | ||
| 462 | ? null | ||
| 463 | : DateTime.formatIso(clientSession.lastConnectedAt), | ||
| 464 | connected: clientSession.connected, | ||
| 465 | current: clientSession.current, | ||
| 466 | })); | ||
| 467 | } catch (error) { | ||
| 468 | throw PrimaryEnvironmentRequestError.fromCause({ | ||
| 469 | operation: "list-client-sessions", | ||
| 470 | cause: error, | ||
| 471 | }); | ||
| 472 | } | ||
| 473 | } | ||
| 474 | |||
| 475 | export async function revokeServerClientSession(sessionId: AuthSessionId): Promise<void> { | 396 | export async function revokeServerClientSession(sessionId: AuthSessionId): Promise<void> { |
| 476 | try { | 397 | try { |
| 477 | await runPrimaryHttp( | 398 | await runPrimaryHttp( |
| ... | @@ -531,16 +452,6 @@ export async function resolveInitialServerAuthGateState(): Promise<ServerAuthGat | ... | @@ -531,16 +452,6 @@ export async function resolveInitialServerAuthGateState(): Promise<ServerAuthGat |
| 531 | }); | 452 | }); |
| 532 | } | 453 | } |
| 533 | 454 | ||
| 534 | // Used by the WSL backend swap: invalidate the cached authenticated state | ||
| 535 | // (the new backend signs sessions with a different key) and re-bootstrap | ||
| 536 | // against the desktop bootstrap credential so the next WS reconnect doesn't | ||
| 537 | // hit 401 and start a reauth loop in the renderer. | ||
| 538 | export async function reauthenticatePrimaryEnvironment(): Promise<ServerAuthGateState> { | ||
| 539 | resolvedAuthenticatedGateState = null; | ||
| 540 | bootstrapPromise = null; | ||
| 541 | return resolveInitialServerAuthGateState(); | ||
| 542 | } | ||
| 543 | |||
| 544 | export function __resetServerAuthBootstrapForTests() { | 455 | export function __resetServerAuthBootstrapForTests() { |
| 545 | bootstrapPromise = null; | 456 | bootstrapPromise = null; |
| 546 | resolvedAuthenticatedGateState = null; | 457 | resolvedAuthenticatedGateState = null; |
apps/web/src/environments/primary/context.ts+1-1| ... | @@ -54,7 +54,7 @@ async function fetchPrimaryEnvironmentDescriptor(): Promise<ExecutionEnvironment | ... | @@ -54,7 +54,7 @@ async function fetchPrimaryEnvironmentDescriptor(): Promise<ExecutionEnvironment |
| 54 | }); | 54 | }); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | export function readPrimaryEnvironmentDescriptor(): ExecutionEnvironmentDescriptor | null { | 57 | function readPrimaryEnvironmentDescriptor(): ExecutionEnvironmentDescriptor | null { |
| 58 | return primaryEnvironmentDescriptor; | 58 | return primaryEnvironmentDescriptor; |
| 59 | } | 59 | } |
| 60 | 60 |
apps/web/src/environments/primary/index.ts+1-14| ... | @@ -1,27 +1,16 @@ | ... | @@ -1,27 +1,16 @@ |
| 1 | export { | 1 | export { |
| 2 | getPrimaryKnownEnvironment, | 2 | getPrimaryKnownEnvironment, |
| 3 | readPrimaryEnvironmentDescriptor, | ||
| 4 | resetPrimaryEnvironmentDescriptorForTests, | 3 | resetPrimaryEnvironmentDescriptorForTests, |
| 5 | resolveInitialPrimaryEnvironmentDescriptor, | 4 | resolveInitialPrimaryEnvironmentDescriptor, |
| 6 | writePrimaryEnvironmentDescriptor, | 5 | writePrimaryEnvironmentDescriptor, |
| 7 | } from "./context"; | 6 | } from "./context"; |
| 8 | 7 | ||
| 9 | export { | ||
| 10 | resolveInitialPrimaryEnvironmentDescriptor as ensurePrimaryEnvironmentReady, | ||
| 11 | writePrimaryEnvironmentDescriptor as updatePrimaryEnvironmentDescriptor, | ||
| 12 | } from "./context"; | ||
| 13 | |||
| 14 | export { | 8 | export { |
| 15 | createServerPairingCredential, | 9 | createServerPairingCredential, |
| 16 | fetchSessionState, | ||
| 17 | isPrimaryEnvironmentPairingCredentialRejectedError, | 10 | isPrimaryEnvironmentPairingCredentialRejectedError, |
| 18 | isPrimaryEnvironmentRequestError, | ||
| 19 | listServerClientSessions, | ||
| 20 | listServerPairingLinks, | ||
| 21 | peekPairingTokenFromUrl, | 11 | peekPairingTokenFromUrl, |
| 22 | PrimaryEnvironmentPairingCredentialRejectedError, | 12 | PrimaryEnvironmentPairingCredentialRejectedError, |
| 23 | PrimaryEnvironmentRequestError, | 13 | PrimaryEnvironmentRequestError, |
| 24 | reauthenticatePrimaryEnvironment, | ||
| 25 | resolveInitialServerAuthGateState, | 14 | resolveInitialServerAuthGateState, |
| 26 | revokeOtherServerClientSessions, | 15 | revokeOtherServerClientSessions, |
| 27 | revokeServerClientSession, | 16 | revokeServerClientSession, |
| ... | @@ -34,9 +23,7 @@ export { | ... | @@ -34,9 +23,7 @@ export { |
| 34 | __resetServerAuthBootstrapForTests, | 23 | __resetServerAuthBootstrapForTests, |
| 35 | } from "./auth"; | 24 | } from "./auth"; |
| 36 | 25 | ||
| 37 | export { refreshPrimarySessionState, usePrimarySessionState } from "./sessionState"; | 26 | export { usePrimarySessionState } from "./sessionState"; |
| 38 | |||
| 39 | export { PrimaryEnvironmentHttpClient } from "./httpClient"; | ||
| 40 | 27 | ||
| 41 | export { | 28 | export { |
| 42 | DesktopEnvironmentBootstrapIncompleteError, | 29 | DesktopEnvironmentBootstrapIncompleteError, |
apps/web/src/environments/primary/sessionState.ts+1-1| ... | @@ -14,7 +14,7 @@ const primarySessionStateAtom = Atom.make(Effect.promise(fetchSessionState)).pip | ... | @@ -14,7 +14,7 @@ const primarySessionStateAtom = Atom.make(Effect.promise(fetchSessionState)).pip |
| 14 | Atom.withLabel("primary-environment:session"), | 14 | Atom.withLabel("primary-environment:session"), |
| 15 | ); | 15 | ); |
| 16 | 16 | ||
| 17 | export function refreshPrimarySessionState(): void { | 17 | function refreshPrimarySessionState(): void { |
| 18 | appAtomRegistry.refresh(primarySessionStateAtom); | 18 | appAtomRegistry.refresh(primarySessionStateAtom); |
| 19 | } | 19 | } |
| 20 | 20 |
apps/web/src/lib/runtime.ts-2| ... | @@ -31,8 +31,6 @@ type RuntimeLayerSource = | ... | @@ -31,8 +31,6 @@ type RuntimeLayerSource = |
| 31 | | typeof relayTracingLayer | 31 | | typeof relayTracingLayer |
| 32 | | ReturnType<typeof managedRelayClientLayer>; | 32 | | ReturnType<typeof managedRelayClientLayer>; |
| 33 | 33 | ||
| 34 | export const remoteHttpRuntime = ManagedRuntime.make(httpClientLayer); | ||
| 35 | |||
| 36 | const primaryHttpRuntime = ManagedRuntime.make( | 34 | const primaryHttpRuntime = ManagedRuntime.make( |
| 37 | PrimaryEnvironmentHttpClient.layer.pipe(Layer.provide(primaryEnvironmentHttpLayer)), | 35 | PrimaryEnvironmentHttpClient.layer.pipe(Layer.provide(primaryEnvironmentHttpLayer)), |
| 38 | ); | 36 | ); |
apps/web/src/observability/clientTracing.ts-9| ... | @@ -41,15 +41,6 @@ export interface ClientTracingConfig { | ... | @@ -41,15 +41,6 @@ export interface ClientTracingConfig { |
| 41 | readonly exportIntervalMs?: number; | 41 | readonly exportIntervalMs?: number; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | export const ClientTracingLive = Layer.succeed( | ||
| 45 | Tracer.Tracer, | ||
| 46 | Tracer.make({ | ||
| 47 | span(options) { | ||
| 48 | return activeDelegate?.span(options) ?? new Tracer.NativeSpan(options); | ||
| 49 | }, | ||
| 50 | }), | ||
| 51 | ); | ||
| 52 | |||
| 53 | export function configureClientTracing(config: ClientTracingConfig = {}): Promise<void> { | 44 | export function configureClientTracing(config: ClientTracingConfig = {}): Promise<void> { |
| 54 | if (config.exportIntervalMs === undefined && activeConfigKey !== null) { | 45 | if (config.exportIntervalMs === undefined && activeConfigKey !== null) { |
| 55 | return pendingConfiguration; | 46 | return pendingConfiguration; |
apps/web/src/rpc/requestLatencyState.ts+1-1| ... | @@ -112,7 +112,7 @@ export function acknowledgeRpcRequest(requestId: string): void { | ... | @@ -112,7 +112,7 @@ export function acknowledgeRpcRequest(requestId: string): void { |
| 112 | setSlowRpcAckRequests(slowRequests.filter((request) => request.requestId !== requestId)); | 112 | setSlowRpcAckRequests(slowRequests.filter((request) => request.requestId !== requestId)); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | export function clearAllTrackedRpcRequests(): void { | 115 | function clearAllTrackedRpcRequests(): void { |
| 116 | for (const pending of pendingRpcAckRequests.values()) { | 116 | for (const pending of pendingRpcAckRequests.values()) { |
| 117 | clearTimeout(pending.timeoutId); | 117 | clearTimeout(pending.timeoutId); |
| 118 | } | 118 | } |
apps/web/src/rpc/transportError.ts+1-4| ... | @@ -1,4 +1 @@ | ... | @@ -1,4 +1 @@ |
| 1 | export { | 1 | export { sanitizeThreadErrorMessage } from "@t3tools/client-runtime/errors"; |
| 2 | isTransportConnectionErrorMessage, | ||
| 3 | sanitizeThreadErrorMessage, | ||
| 4 | } from "@t3tools/client-runtime/errors"; |
apps/web/src/state/entities.ts+1-1| ... | @@ -39,7 +39,7 @@ const EMPTY_THREAD_STATUS_ATOM = Atom.make<EnvironmentThreadStatus>("empty").pip | ... | @@ -39,7 +39,7 @@ const EMPTY_THREAD_STATUS_ATOM = Atom.make<EnvironmentThreadStatus>("empty").pip |
| 39 | Atom.withLabel("web-thread-status:empty"), | 39 | Atom.withLabel("web-thread-status:empty"), |
| 40 | ); | 40 | ); |
| 41 | 41 | ||
| 42 | export const activeEnvironmentIdAtom = Atom.make<EnvironmentId | null>(null).pipe( | 42 | const activeEnvironmentIdAtom = Atom.make<EnvironmentId | null>(null).pipe( |
| 43 | Atom.keepAlive, | 43 | Atom.keepAlive, |
| 44 | Atom.withLabel("web-active-environment-id"), | 44 | Atom.withLabel("web-active-environment-id"), |
| 45 | ); | 45 | ); |
apps/web/src/state/environments.ts-5| ... | @@ -11,7 +11,6 @@ import { useMemo } from "react"; | ... | @@ -11,7 +11,6 @@ import { useMemo } from "react"; |
| 11 | import { environmentCatalog } from "../connection/catalog"; | 11 | import { environmentCatalog } from "../connection/catalog"; |
| 12 | import { environmentPresentations, useEnvironmentPresentation } from "./presentation"; | 12 | import { environmentPresentations, useEnvironmentPresentation } from "./presentation"; |
| 13 | import { primaryEnvironmentIdAtom } from "./primaryEnvironment"; | 13 | import { primaryEnvironmentIdAtom } from "./primaryEnvironment"; |
| 14 | import { useEnvironmentQuery } from "./query"; | ||
| 15 | import { relayEnvironmentDiscovery } from "./relay"; | 14 | import { relayEnvironmentDiscovery } from "./relay"; |
| 16 | import { usePreparedConnection } from "./session"; | 15 | import { usePreparedConnection } from "./session"; |
| 17 | 16 | ||
| ... | @@ -85,7 +84,3 @@ export function useEnvironmentHttpBaseUrl(environmentId: EnvironmentId | null): | ... | @@ -85,7 +84,3 @@ export function useEnvironmentHttpBaseUrl(environmentId: EnvironmentId | null): |
| 85 | export function useRelayEnvironmentDiscovery(): Discovery.RelayEnvironmentDiscoveryState { | 84 | export function useRelayEnvironmentDiscovery(): Discovery.RelayEnvironmentDiscoveryState { |
| 86 | return useAtomValue(relayEnvironmentDiscovery.stateValueAtom); | 85 | return useAtomValue(relayEnvironmentDiscovery.stateValueAtom); |
| 87 | } | 86 | } |
| 88 | |||
| 89 | export function useEnvironmentConnectionState(environmentId: EnvironmentId) { | ||
| 90 | return useEnvironmentQuery(environmentCatalog.stateAtom(environmentId)); | ||
| 91 | } |
apps/web/src/state/queries.ts-31| ... | @@ -14,7 +14,6 @@ import type { | ... | @@ -14,7 +14,6 @@ import type { |
| 14 | OrchestrationThread, | 14 | OrchestrationThread, |
| 15 | ProjectContentMatch, | 15 | ProjectContentMatch, |
| 16 | ProjectEntryKind, | 16 | ProjectEntryKind, |
| 17 | ThreadId, | ||
| 18 | VcsListRefsResult, | 17 | VcsListRefsResult, |
| 19 | VcsRef, | 18 | VcsRef, |
| 20 | } from "@t3tools/contracts"; | 19 | } from "@t3tools/contracts"; |
| ... | @@ -28,7 +27,6 @@ import { orchestrationEnvironment } from "./orchestration"; | ... | @@ -28,7 +27,6 @@ import { orchestrationEnvironment } from "./orchestration"; |
| 28 | import { isPaginatedBranchesNextPagePending } from "./paginatedBranches"; | 27 | import { isPaginatedBranchesNextPagePending } from "./paginatedBranches"; |
| 29 | import { projectContentSearch, projectEnvironment } from "./projects"; | 28 | import { projectContentSearch, projectEnvironment } from "./projects"; |
| 30 | import { useEnvironmentQuery } from "./query"; | 29 | import { useEnvironmentQuery } from "./query"; |
| 31 | import { useEnvironmentThread } from "./threads"; | ||
| 32 | import { vcsEnvironment } from "./vcs"; | 30 | import { vcsEnvironment } from "./vcs"; |
| 33 | 31 | ||
| 34 | const PROJECT_PATH_SEARCH_DEBOUNCE_MS = 120; | 32 | const PROJECT_PATH_SEARCH_DEBOUNCE_MS = 120; |
| ... | @@ -103,35 +101,6 @@ export function useThreadSearch( | ... | @@ -103,35 +101,6 @@ export function useThreadSearch( |
| 103 | }; | 101 | }; |
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | export function useThreadDetail( | ||
| 107 | environmentId: EnvironmentId | null, | ||
| 108 | threadId: ThreadId | null, | ||
| 109 | ): ThreadDetailView { | ||
| 110 | const state = useEnvironmentThread(environmentId, threadId); | ||
| 111 | return { | ||
| 112 | data: Option.getOrNull(state.data), | ||
| 113 | error: Option.getOrNull(state.error), | ||
| 114 | isPending: state.status === "synchronizing", | ||
| 115 | isDeleted: state.status === "deleted", | ||
| 116 | }; | ||
| 117 | } | ||
| 118 | |||
| 119 | export function useBranches(target: VcsRefTarget) { | ||
| 120 | const query = target.query?.trim() ?? ""; | ||
| 121 | return useEnvironmentQuery( | ||
| 122 | target.environmentId !== null && target.cwd !== null | ||
| 123 | ? vcsEnvironment.listRefs({ | ||
| 124 | environmentId: target.environmentId, | ||
| 125 | input: { | ||
| 126 | cwd: target.cwd, | ||
| 127 | ...(query.length > 0 ? { query } : {}), | ||
| 128 | limit: VCS_REF_LIST_LIMIT, | ||
| 129 | }, | ||
| 130 | }) | ||
| 131 | : null, | ||
| 132 | ); | ||
| 133 | } | ||
| 134 | |||
| 135 | export function usePaginatedBranches(target: VcsRefTarget) { | 104 | export function usePaginatedBranches(target: VcsRefTarget) { |
| 136 | const query = target.query?.trim() ?? ""; | 105 | const query = target.query?.trim() ?? ""; |
| 137 | const targetKey = | 106 | const targetKey = |
apps/web/src/state/server.ts+1-1| ... | @@ -50,7 +50,7 @@ const EMPTY_PRIMARY_SERVER_STATE: PrimaryServerState = { | ... | @@ -50,7 +50,7 @@ const EMPTY_PRIMARY_SERVER_STATE: PrimaryServerState = { |
| 50 | welcome: null, | 50 | welcome: null, |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | export const primaryServerStateAtom = Atom.make((get): PrimaryServerState => { | 53 | const primaryServerStateAtom = Atom.make((get): PrimaryServerState => { |
| 54 | const environmentId = get(primaryEnvironmentIdAtom); | 54 | const environmentId = get(primaryEnvironmentIdAtom); |
| 55 | if (environmentId === null) { | 55 | if (environmentId === null) { |
| 56 | return EMPTY_PRIMARY_SERVER_STATE; | 56 | return EMPTY_PRIMARY_SERVER_STATE; |
apps/web/src/state/shell.ts-5| ... | @@ -4,7 +4,6 @@ import { | ... | @@ -4,7 +4,6 @@ import { |
| 4 | } from "@t3tools/client-runtime/connection"; | 4 | } from "@t3tools/client-runtime/connection"; |
| 5 | import { | 5 | import { |
| 6 | createEnvironmentShellAtoms, | 6 | createEnvironmentShellAtoms, |
| 7 | createEnvironmentShellSummaryAtom, | ||
| 8 | createEnvironmentSnapshotAtom, | 7 | createEnvironmentSnapshotAtom, |
| 9 | createShellEnvironmentAtoms, | 8 | createShellEnvironmentAtoms, |
| 10 | type EnvironmentShellState, | 9 | type EnvironmentShellState, |
| ... | @@ -21,10 +20,6 @@ import { isHostedStaticApp } from "../hostedPairing"; | ... | @@ -21,10 +20,6 @@ import { isHostedStaticApp } from "../hostedPairing"; |
| 21 | export const shellEnvironment = createShellEnvironmentAtoms(connectionAtomRuntime); | 20 | export const shellEnvironment = createShellEnvironmentAtoms(connectionAtomRuntime); |
| 22 | export const environmentShell = createEnvironmentShellAtoms(connectionAtomRuntime); | 21 | export const environmentShell = createEnvironmentShellAtoms(connectionAtomRuntime); |
| 23 | export const environmentSnapshotAtom = createEnvironmentSnapshotAtom(environmentShell.stateAtom); | 22 | export const environmentSnapshotAtom = createEnvironmentSnapshotAtom(environmentShell.stateAtom); |
| 24 | export const environmentShellSummaryAtom = createEnvironmentShellSummaryAtom({ | ||
| 25 | catalogValueAtom: environmentCatalog.catalogValueAtom, | ||
| 26 | shellStateValueAtom: environmentShell.stateValueAtom, | ||
| 27 | }); | ||
| 28 | 23 | ||
| 29 | export const allEnvironmentShellsBootstrappedAtom = Atom.make((get) => { | 24 | export const allEnvironmentShellsBootstrappedAtom = Atom.make((get) => { |
| 30 | const catalog = AsyncResult.value(get(environmentCatalog.catalogAtom)); | 25 | const catalog = AsyncResult.value(get(environmentCatalog.catalogAtom)); |
apps/web/src/state/threads.ts+1-1| ... | @@ -16,7 +16,7 @@ import { connectionAtomRuntime } from "../connection/runtime"; | ... | @@ -16,7 +16,7 @@ import { connectionAtomRuntime } from "../connection/runtime"; |
| 16 | import { environmentSnapshotAtom } from "./shell"; | 16 | import { environmentSnapshotAtom } from "./shell"; |
| 17 | 17 | ||
| 18 | export const threadEnvironment = createThreadEnvironmentAtoms(connectionAtomRuntime); | 18 | export const threadEnvironment = createThreadEnvironmentAtoms(connectionAtomRuntime); |
| 19 | export const environmentThreads = createEnvironmentThreadStateAtoms(connectionAtomRuntime); | 19 | const environmentThreads = createEnvironmentThreadStateAtoms(connectionAtomRuntime); |
| 20 | export const environmentThreadDetails = createEnvironmentThreadDetailAtoms( | 20 | export const environmentThreadDetails = createEnvironmentThreadDetailAtoms( |
| 21 | environmentThreads.stateAtom, | 21 | environmentThreads.stateAtom, |
| 22 | ); | 22 | ); |