authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 15:54:59-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 15:54:59-07:00
logdbfd5173131deb1a7ad2a9438b8941ade43f9a89
treee501586ffcb81d3859d13c8c07b586e7947baa26
parent0671e34279d42faf69fccfd46ceae305ccfa7c6d
signature Signed by PGP key B5690EEEBB952194

refactor(client-runtime): remove unused runtime exports and helpers (#10167)


40 files changed, 42 insertions(+), 208 deletions(-)

apps/web/src/components/Sidebar.logic.ts+1-5
...@@ -600,11 +600,7 @@ export function sortThreadsForSidebar<...@@ -600,11 +600,7 @@ export function sortThreadsForSidebar<
600600
601// Pinned-reorder key math and the keyed sort live in client-runtime601// Pinned-reorder key math and the keyed sort live in client-runtime
602// (state/thread-sort) so web and mobile compute identical pinned orders.602// (state/thread-sort) so web and mobile compute identical pinned orders.
603export {603export { pinOrderKeyBetween, planPinnedReorder } from "@t3tools/client-runtime/state/thread-sort";
604 generateSpreadPinOrderKeys,
605 pinOrderKeyBetween,
606 planPinnedReorder,
607} from "@t3tools/client-runtime/state/thread-sort";
608export { sortPinnedThreadsByOrderKey as sortPinnedThreadsForSidebar } from "@t3tools/client-runtime/state/thread-sort";604export { sortPinnedThreadsByOrderKey as sortPinnedThreadsForSidebar } from "@t3tools/client-runtime/state/thread-sort";
609605
610/**606/**
apps/web/src/components/chat/MessagesTimeline.logic.ts-1
...@@ -16,7 +16,6 @@ export {...@@ -16,7 +16,6 @@ export {
16 normalizeCompactToolLabel,16 normalizeCompactToolLabel,
17 summarizeToolGroup,17 summarizeToolGroup,
18 toolGroupAction,18 toolGroupAction,
19 workLogEntryIsLocalCodeSearch,
20} from "@t3tools/client-runtime/work-log/presentation";19} from "@t3tools/client-runtime/work-log/presentation";
21import {20import {
22 formatDuration,21 formatDuration,
apps/web/src/logicalProject.ts-1
...@@ -1,7 +1,6 @@...@@ -1,7 +1,6 @@
1export {1export {
2 buildProjectGroups,2 buildProjectGroups,
3 deriveLogicalProjectKey,3 deriveLogicalProjectKey,
4 deriveLogicalProjectKeyFromRef,
5 deriveLogicalProjectKeyFromSettings,4 deriveLogicalProjectKeyFromSettings,
6 derivePhysicalProjectKey,5 derivePhysicalProjectKey,
7 derivePhysicalProjectKeyFromPath,6 derivePhysicalProjectKeyFromPath,
packages/client-runtime/src/authorization/index.ts-1
...@@ -2,6 +2,5 @@ export * from "./remote.ts";...@@ -2,6 +2,5 @@ export * from "./remote.ts";
2export {2export {
3 type AuthorizedRemoteEnvironment,3 type AuthorizedRemoteEnvironment,
4 type AuthorizedRemoteHttpEnvironment,4 type AuthorizedRemoteHttpEnvironment,
5 RemoteEnvironmentAuthorization,
6} from "./service.ts";5} from "./service.ts";
7export * as TokenStore from "./tokenStore.ts";6export * as TokenStore from "./tokenStore.ts";
packages/client-runtime/src/authorization/remote.ts-1
...@@ -16,7 +16,6 @@ import {...@@ -16,7 +16,6 @@ import {
16} from "../rpc/http.ts";16} from "../rpc/http.ts";
1717
18export {18export {
19 RemoteEnvironmentAuthFetchError,
20 RemoteEnvironmentAuthInvalidJsonError,19 RemoteEnvironmentAuthInvalidJsonError,
21 RemoteEnvironmentAuthTimeoutError,20 RemoteEnvironmentAuthTimeoutError,
22 RemoteEnvironmentAuthUndeclaredStatusError,21 RemoteEnvironmentAuthUndeclaredStatusError,
packages/client-runtime/src/codexArtifactTemplates.ts+3-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1export const CODEX_ARTIFACT_TEMPLATE_KINDS = [1const CODEX_ARTIFACT_TEMPLATE_KINDS = [
2 "document",2 "document",
3 "presentation",3 "presentation",
4 "spreadsheet",4 "spreadsheet",
...@@ -13,7 +13,7 @@ export const CODEX_ARTIFACT_TEMPLATE_KINDS = [...@@ -13,7 +13,7 @@ export const CODEX_ARTIFACT_TEMPLATE_KINDS = [
1313
14export type CodexArtifactTemplateKind = (typeof CODEX_ARTIFACT_TEMPLATE_KINDS)[number];14export type CodexArtifactTemplateKind = (typeof CODEX_ARTIFACT_TEMPLATE_KINDS)[number];
1515
16export const CODEX_ARTIFACT_TEMPLATE_GALLERY_KINDS = ["imagegen", "product-design"] as const;16const CODEX_ARTIFACT_TEMPLATE_GALLERY_KINDS = ["imagegen", "product-design"] as const;
1717
18export type CodexArtifactTemplateGalleryKind =18export type CodexArtifactTemplateGalleryKind =
19 (typeof CODEX_ARTIFACT_TEMPLATE_GALLERY_KINDS)[number];19 (typeof CODEX_ARTIFACT_TEMPLATE_GALLERY_KINDS)[number];
...@@ -26,7 +26,7 @@ export interface CodexArtifactTemplate {...@@ -26,7 +26,7 @@ export interface CodexArtifactTemplate {
26 readonly skillName: string;26 readonly skillName: string;
27}27}
2828
29export const CODEX_ARTIFACT_TEMPLATE_LABEL_BY_KIND = {29const CODEX_ARTIFACT_TEMPLATE_LABEL_BY_KIND = {
30 document: "Document template",30 document: "Document template",
31 presentation: "Presentation template",31 presentation: "Presentation template",
32 spreadsheet: "Spreadsheet template",32 spreadsheet: "Spreadsheet template",
packages/client-runtime/src/connection/connectivity.ts+1-1
...@@ -13,7 +13,7 @@ export class Connectivity extends Context.Service<...@@ -13,7 +13,7 @@ export class Connectivity extends Context.Service<
13 }13 }
14>()("@t3tools/client-runtime/connection/connectivity") {}14>()("@t3tools/client-runtime/connection/connectivity") {}
1515
16export const make = (service: Connectivity["Service"]) => Connectivity.of(service);16const make = (service: Connectivity["Service"]) => Connectivity.of(service);
1717
18export const layer = (service: Connectivity["Service"]) =>18export const layer = (service: Connectivity["Service"]) =>
19 Layer.succeed(Connectivity, make(service));19 Layer.succeed(Connectivity, make(service));
packages/client-runtime/src/connection/credentialStore.ts-4
...@@ -1,6 +1,5 @@...@@ -1,6 +1,5 @@
1import * as Context from "effect/Context";1import * as Context from "effect/Context";
2import type * as Effect from "effect/Effect";2import type * as Effect from "effect/Effect";
3import * as Layer from "effect/Layer";
4import type * as Option from "effect/Option";3import type * as Option from "effect/Option";
54
6import type { ConnectionCredential } from "./catalog.ts";5import type { ConnectionCredential } from "./catalog.ts";
...@@ -22,6 +21,3 @@ export class ConnectionCredentialStore extends Context.Service<...@@ -22,6 +21,3 @@ export class ConnectionCredentialStore extends Context.Service<
2221
23export const make = (service: ConnectionCredentialStore["Service"]) =>22export const make = (service: ConnectionCredentialStore["Service"]) =>
24 ConnectionCredentialStore.of(service);23 ConnectionCredentialStore.of(service);
25
26export const layer = (service: ConnectionCredentialStore["Service"]) =>
27 Layer.succeed(ConnectionCredentialStore, make(service));
packages/client-runtime/src/connection/driver.ts+1
...@@ -36,6 +36,7 @@ export class ConnectionDriver extends Context.Service<...@@ -36,6 +36,7 @@ export class ConnectionDriver extends Context.Service<
36 }36 }
37>()("@t3tools/client-runtime/connection/driver/ConnectionDriver") {}37>()("@t3tools/client-runtime/connection/driver/ConnectionDriver") {}
3838
39/** @public Service construction is part of the canonical Effect module API. */
39export const make = Effect.gen(function* () {40export const make = Effect.gen(function* () {
40 const resolver = yield* ConnectionResolver.ConnectionResolver;41 const resolver = yield* ConnectionResolver.ConnectionResolver;
41 const sessions = yield* RpcSession.RpcSessionFactory;42 const sessions = yield* RpcSession.RpcSessionFactory;
packages/client-runtime/src/connection/index.ts+1-12
...@@ -1,11 +1,7 @@...@@ -1,11 +1,7 @@
1export * from "./catalog.ts";1export * from "./catalog.ts";
2export * as Connectivity from "./connectivity.ts";2export * as Connectivity from "./connectivity.ts";
3export * as CredentialStore from "./credentialStore.ts";3export * as CredentialStore from "./credentialStore.ts";
4export {4export { type ConnectionDriverProgress, type EnvironmentConnectionLease } from "./driver.ts";
5 ConnectionDriver,
6 type ConnectionDriverProgress,
7 type EnvironmentConnectionLease,
8} from "./driver.ts";
9export * from "./errors.ts";5export * from "./errors.ts";
10export * as Connection from "./layer.ts";6export * as Connection from "./layer.ts";
11export * from "./model.ts";7export * from "./model.ts";
...@@ -14,12 +10,6 @@ export {...@@ -14,12 +10,6 @@ export {
14 ConnectionOnboarding,10 ConnectionOnboarding,
15 type PairingConnectionInput,11 type PairingConnectionInput,
16 type SshConnectionInput,12 type SshConnectionInput,
17 prepareBearerConnectionUpdate,
18 preparePairingRegistration,
19 prepareSshRegistration,
20 registerPairingConnection,
21 registerSshConnection,
22 updateBearerConnection,
23} from "./onboarding.ts";13} from "./onboarding.ts";
24export * from "./presentation.ts";14export * from "./presentation.ts";
25export * as ProfileStore from "./profileStore.ts";15export * as ProfileStore from "./profileStore.ts";
...@@ -28,6 +18,5 @@ export {...@@ -28,6 +18,5 @@ export {
28 EnvironmentRegistry,18 EnvironmentRegistry,
29 PlatformEnvironmentRemovalError,19 PlatformEnvironmentRemovalError,
30} from "./registry.ts";20} from "./registry.ts";
31export { ConnectionResolver } from "./resolver.ts";
32export { EnvironmentSupervisor, type EnvironmentSupervisorOptions } from "./supervisor.ts";21export { EnvironmentSupervisor, type EnvironmentSupervisorOptions } from "./supervisor.ts";
33export * as Wakeups from "./wakeups.ts";22export * as Wakeups from "./wakeups.ts";
packages/client-runtime/src/connection/onboarding.ts+4-3
...@@ -118,7 +118,7 @@ export const preparePairingRegistration = Effect.fn(...@@ -118,7 +118,7 @@ export const preparePairingRegistration = Effect.fn(
118 });118 });
119});119});
120120
121export const registerPairingConnection = Effect.fn(121const registerPairingConnection = Effect.fn(
122 "clientRuntime.connection.onboarding.registerPairingConnection",122 "clientRuntime.connection.onboarding.registerPairingConnection",
123)(function* (input: PairingConnectionInput) {123)(function* (input: PairingConnectionInput) {
124 const registration = yield* preparePairingRegistration(input);124 const registration = yield* preparePairingRegistration(input);
...@@ -130,7 +130,7 @@ export const registerPairingConnection = Effect.fn(...@@ -130,7 +130,7 @@ export const registerPairingConnection = Effect.fn(
130const isBearerCredential = Schema.is(BearerConnectionCredential);130const isBearerCredential = Schema.is(BearerConnectionCredential);
131const isBearerProfile = Schema.is(BearerConnectionProfile);131const isBearerProfile = Schema.is(BearerConnectionProfile);
132132
133export const updateBearerConnection = Effect.fn(133const updateBearerConnection = Effect.fn(
134 "clientRuntime.connection.onboarding.updateBearerConnection",134 "clientRuntime.connection.onboarding.updateBearerConnection",
135)(function* (input: BearerConnectionUpdateInput) {135)(function* (input: BearerConnectionUpdateInput) {
136 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;136 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;
...@@ -233,7 +233,7 @@ export const prepareSshRegistration = Effect.fn(...@@ -233,7 +233,7 @@ export const prepareSshRegistration = Effect.fn(
233 });233 });
234});234});
235235
236export const registerSshConnection = Effect.fn(236const registerSshConnection = Effect.fn(
237 "clientRuntime.connection.onboarding.registerSshConnection",237 "clientRuntime.connection.onboarding.registerSshConnection",
238)(function* (input: SshConnectionInput) {238)(function* (input: SshConnectionInput) {
239 const registration = yield* prepareSshRegistration(input);239 const registration = yield* prepareSshRegistration(input);
...@@ -242,6 +242,7 @@ export const registerSshConnection = Effect.fn(...@@ -242,6 +242,7 @@ export const registerSshConnection = Effect.fn(
242 return registration.target.environmentId;242 return registration.target.environmentId;
243});243});
244244
245/** @public Service construction is part of the canonical Effect module API. */
245export const make = Effect.gen(function* () {246export const make = Effect.gen(function* () {
246 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;247 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;
247 const presentation = yield* ClientCapabilities.ClientPresentation;248 const presentation = yield* ClientCapabilities.ClientPresentation;
packages/client-runtime/src/connection/profileStore.ts-4
...@@ -1,6 +1,5 @@...@@ -1,6 +1,5 @@
1import * as Context from "effect/Context";1import * as Context from "effect/Context";
2import type * as Effect from "effect/Effect";2import type * as Effect from "effect/Effect";
3import * as Layer from "effect/Layer";
4import type * as Option from "effect/Option";3import type * as Option from "effect/Option";
54
6import type { ConnectionProfile } from "./catalog.ts";5import type { ConnectionProfile } from "./catalog.ts";
...@@ -19,6 +18,3 @@ export class ConnectionProfileStore extends Context.Service<...@@ -19,6 +18,3 @@ export class ConnectionProfileStore extends Context.Service<
1918
20export const make = (service: ConnectionProfileStore["Service"]) =>19export const make = (service: ConnectionProfileStore["Service"]) =>
21 ConnectionProfileStore.of(service);20 ConnectionProfileStore.of(service);
22
23export const layer = (service: ConnectionProfileStore["Service"]) =>
24 Layer.succeed(ConnectionProfileStore, make(service));
packages/client-runtime/src/connection/registry.ts+1
...@@ -125,6 +125,7 @@ interface EnvironmentServiceScope {...@@ -125,6 +125,7 @@ interface EnvironmentServiceScope {
125 readonly scope: Scope.Closeable;125 readonly scope: Scope.Closeable;
126}126}
127127
128/** @public Service construction is part of the canonical Effect module API. */
128export const make = Effect.gen(function* () {129export const make = Effect.gen(function* () {
129 const registryScope = yield* Scope.Scope;130 const registryScope = yield* Scope.Scope;
130 const storage = yield* Persistence.ConnectionTargetStore;131 const storage = yield* Persistence.ConnectionTargetStore;
packages/client-runtime/src/connection/resolver.ts+1
...@@ -218,6 +218,7 @@ const makeSshBroker = Effect.fn("clientRuntime.connection.broker.makeSsh")(funct...@@ -218,6 +218,7 @@ const makeSshBroker = Effect.fn("clientRuntime.connection.broker.makeSsh")(funct
218 });218 });
219});219});
220220
221/** @public Service construction is part of the canonical Effect module API. */
221export const make = Effect.gen(function* () {222export const make = Effect.gen(function* () {
222 const primary = yield* makePrimaryBroker();223 const primary = yield* makePrimaryBroker();
223 const bearer = yield* makeBearerBroker();224 const bearer = yield* makeBearerBroker();
packages/client-runtime/src/connection/supervisor.ts-12
...@@ -5,7 +5,6 @@ import * as Context from "effect/Context";...@@ -5,7 +5,6 @@ import * as Context from "effect/Context";
5import * as Effect from "effect/Effect";5import * as Effect from "effect/Effect";
6import * as Exit from "effect/Exit";6import * as Exit from "effect/Exit";
7import * as Fiber from "effect/Fiber";7import * as Fiber from "effect/Fiber";
8import * as Layer from "effect/Layer";
9import * as Option from "effect/Option";8import * as Option from "effect/Option";
10import * as Queue from "effect/Queue";9import * as Queue from "effect/Queue";
11import * as Ref from "effect/Ref";10import * as Ref from "effect/Ref";
...@@ -798,14 +797,3 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* (...@@ -798,14 +797,3 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* (
798 retryNow,797 retryNow,
799 });798 });
800});799});
801
802export const layer = (
803 entry: ConnectionCatalogEntry,
804 options?: EnvironmentSupervisorOptions,
805): Layer.Layer<
806 EnvironmentSupervisor,
807 never,
808 | Connectivity.Connectivity
809 | ConnectionDriver.ConnectionDriver
810 | ConnectionWakeups.ConnectionWakeups
811> => Layer.effect(EnvironmentSupervisor, make(entry, options));
packages/client-runtime/src/connection/wakeups.ts+1-1
...@@ -27,7 +27,7 @@ export class ConnectionWakeups extends Context.Service<...@@ -27,7 +27,7 @@ export class ConnectionWakeups extends Context.Service<
27 }27 }
28>()("@t3tools/client-runtime/connection/wakeups/ConnectionWakeups") {}28>()("@t3tools/client-runtime/connection/wakeups/ConnectionWakeups") {}
2929
30export const make = (service: ConnectionWakeups["Service"]) => ConnectionWakeups.of(service);30const make = (service: ConnectionWakeups["Service"]) => ConnectionWakeups.of(service);
3131
32export const layer = (service: ConnectionWakeups["Service"]) =>32export const layer = (service: ConnectionWakeups["Service"]) =>
33 Layer.succeed(ConnectionWakeups, make(service));33 Layer.succeed(ConnectionWakeups, make(service));
packages/client-runtime/src/relay/discovery.ts+1
...@@ -102,6 +102,7 @@ function relayAccountId(clerkToken: string): Option.Option<string> {...@@ -102,6 +102,7 @@ function relayAccountId(clerkToken: string): Option.Option<string> {
102 }102 }
103}103}
104104
105/** @public Service construction is part of the canonical Effect module API. */
105export const make = Effect.fn("RelayEnvironmentDiscovery.make")(function* () {106export const make = Effect.fn("RelayEnvironmentDiscovery.make")(function* () {
106 const relay = yield* ManagedRelay.ManagedRelayClient;107 const relay = yield* ManagedRelay.ManagedRelayClient;
107 const session = yield* ClientCapabilities.CloudSession;108 const session = yield* ClientCapabilities.CloudSession;
packages/client-runtime/src/relay/errorPresentation.ts+1-1
...@@ -11,7 +11,7 @@ export const DPOP_UNKNOWN_HINT =...@@ -11,7 +11,7 @@ export const DPOP_UNKNOWN_HINT =
1111
12export const DPOP_RETRY_HINT = "Hint: Try again. If the problem continues, copy the trace ID.";12export const DPOP_RETRY_HINT = "Hint: Try again. If the problem continues, copy the trace ID.";
1313
14export function dpopFailureHint(reason: DpopFailureReason | undefined): string {14function dpopFailureHint(reason: DpopFailureReason | undefined): string {
15 if (reason === "time_window") return DPOP_CLOCK_HINT;15 if (reason === "time_window") return DPOP_CLOCK_HINT;
16 if (reason === undefined) return DPOP_UNKNOWN_HINT;16 if (reason === undefined) return DPOP_UNKNOWN_HINT;
17 return DPOP_RETRY_HINT;17 return DPOP_RETRY_HINT;
packages/client-runtime/src/relay/managedRelay.ts+1
...@@ -429,6 +429,7 @@ function disabledManagedRelayClient(relayUrl: string): ManagedRelayClient["Servi...@@ -429,6 +429,7 @@ function disabledManagedRelayClient(relayUrl: string): ManagedRelayClient["Servi
429 });429 });
430}430}
431431
432/** @public Service construction is part of the canonical Effect module API. */
432export const make = Effect.fn("ManagedRelayClient.make")(function* (433export const make = Effect.fn("ManagedRelayClient.make")(function* (
433 options: ManagedRelayClientLayerOptions,434 options: ManagedRelayClientLayerOptions,
434) {435) {
packages/client-runtime/src/rpc/client.ts-5
...@@ -325,8 +325,3 @@ export function subscribe<TTag extends EnvironmentSubscriptionRpcTag>(...@@ -325,8 +325,3 @@ export function subscribe<TTag extends EnvironmentSubscriptionRpcTag>(
325> {325> {
326 return subscribeDynamic(tag, () => Effect.succeed(input), options);326 return subscribeDynamic(tag, () => Effect.succeed(input), options);
327}327}
328
329export const config = Effect.gen(function* () {
330 const session = yield* currentSession();
331 return yield* session.initialConfig;
332}).pipe(Effect.withSpan("EnvironmentRpc.config"));
packages/client-runtime/src/rpc/index.ts+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1export * from "./client.ts";1export * from "./client.ts";
2export * from "./http.ts";2export * from "./http.ts";
3export * from "./protocol.ts";3export * from "./protocol.ts";
4export { type RpcSession, RpcSessionFactory } from "./session.ts";4export { type RpcSession } from "./session.ts";
packages/client-runtime/src/rpc/session.ts+1-2
...@@ -145,6 +145,7 @@ function mapSessionRpcError(...@@ -145,6 +145,7 @@ function mapSessionRpcError(
145 }145 }
146}146}
147147
148/** @public Service construction is part of the canonical Effect module API. */
148export const make = Effect.fn("RpcSessionFactory.make")(function* (149export const make = Effect.fn("RpcSessionFactory.make")(function* (
149 options: RpcSessionOptions = {},150 options: RpcSessionOptions = {},
150) {151) {
...@@ -369,5 +370,3 @@ export const make = Effect.fn("RpcSessionFactory.make")(function* (...@@ -369,5 +370,3 @@ export const make = Effect.fn("RpcSessionFactory.make")(function* (
369370
370export const layerWithOptions = (options: RpcSessionOptions) =>371export const layerWithOptions = (options: RpcSessionOptions) =>
371 Layer.effect(RpcSessionFactory, make(options));372 Layer.effect(RpcSessionFactory, make(options));
372
373export const layer = layerWithOptions({});
packages/client-runtime/src/state/auth.ts+1-1
...@@ -61,7 +61,7 @@ export function applyAuthAccessStreamEvent(...@@ -61,7 +61,7 @@ export function applyAuthAccessStreamEvent(
61 }61 }
62}62}
6363
64export function projectAuthAccessSnapshot(64function projectAuthAccessSnapshot(
65 current: AuthAccessSnapshot,65 current: AuthAccessSnapshot,
66 event: AuthAccessStreamEvent,66 event: AuthAccessStreamEvent,
67): readonly [AuthAccessSnapshot, ReadonlyArray<AuthAccessStreamEvent>] {67): readonly [AuthAccessSnapshot, ReadonlyArray<AuthAccessStreamEvent>] {
packages/client-runtime/src/state/connections.ts+1-1
...@@ -20,7 +20,7 @@ export interface EnvironmentCatalogState {...@@ -20,7 +20,7 @@ export interface EnvironmentCatalogState {
20 readonly entries: ReadonlyMap<EnvironmentIdType, ConnectionCatalogEntry>;20 readonly entries: ReadonlyMap<EnvironmentIdType, ConnectionCatalogEntry>;
21}21}
2222
23export const EMPTY_ENVIRONMENT_CATALOG_STATE: EnvironmentCatalogState = Object.freeze({23const EMPTY_ENVIRONMENT_CATALOG_STATE: EnvironmentCatalogState = Object.freeze({
24 isReady: false,24 isReady: false,
25 entries: new Map(),25 entries: new Map(),
26});26});
packages/client-runtime/src/state/environmentHttpAuth.ts+2-2
...@@ -27,7 +27,7 @@ export interface EnvironmentHttpAuthHeaders {...@@ -27,7 +27,7 @@ export interface EnvironmentHttpAuthHeaders {
27 * per-request via `FetchHttpClient.RequestInit`, which the fetch client reads27 * per-request via `FetchHttpClient.RequestInit`, which the fetch client reads
28 * from the fiber context at request time.28 * from the fiber context at request time.
29 */29 */
30export const withEnvironmentCredentials = <A, E, R>(30const withEnvironmentCredentials = <A, E, R>(
31 authorization: PreparedHttpAuthorization | null,31 authorization: PreparedHttpAuthorization | null,
32 request: Effect.Effect<A, E, R>,32 request: Effect.Effect<A, E, R>,
33): Effect.Effect<A, E, R> =>33): Effect.Effect<A, E, R> =>
...@@ -46,7 +46,7 @@ export const withEnvironmentCredentials = <A, E, R>(...@@ -46,7 +46,7 @@ export const withEnvironmentCredentials = <A, E, R>(
46 * for relay/DPoP connections, so bearer/primary connections work even when no46 * for relay/DPoP connections, so bearer/primary connections work even when no
47 * signer is available.47 * signer is available.
48 */48 */
49export const buildEnvironmentAuthHeaders = (49const buildEnvironmentAuthHeaders = (
50 authorization: PreparedHttpAuthorization | null,50 authorization: PreparedHttpAuthorization | null,
51 method: HttpMethod.HttpMethod,51 method: HttpMethod.HttpMethod,
52 url: string,52 url: string,
packages/client-runtime/src/state/gitActions.ts-82
...@@ -1,10 +1,8 @@...@@ -1,10 +1,8 @@
1import type {1import type {
2 GitRunStackedActionInput,2 GitRunStackedActionInput,
3 GitRunStackedActionResult,
4 GitStackedAction,3 GitStackedAction,
5 VcsStatusResult,4 VcsStatusResult,
6} from "@t3tools/contracts";5} from "@t3tools/contracts";
7import { isTemporaryWorktreeBranch } from "@t3tools/shared/git";
86
9export type GitActionIconName = "commit" | "push" | "pr";7export type GitActionIconName = "commit" | "push" | "pr";
108
...@@ -44,44 +42,6 @@ export type GitActionRequestInput = Pick<...@@ -44,44 +42,6 @@ export type GitActionRequestInput = Pick<
44 "action" | "commitMessage" | "featureBranch" | "filePaths"42 "action" | "commitMessage" | "featureBranch" | "filePaths"
45>;43>;
4644
47export function buildGitActionProgressStages(input: {
48 action: GitStackedAction;
49 hasCustomCommitMessage: boolean;
50 hasWorkingTreeChanges: boolean;
51 pushTarget?: string;
52 featureBranch?: boolean;
53 shouldPushBeforePr?: boolean;
54}): string[] {
55 const branchStages = input.featureBranch ? ["Preparing feature branch..."] : [];
56 const pushStage = input.pushTarget ? `Pushing to ${input.pushTarget}...` : "Pushing...";
57 const prStages = [
58 "Preparing PR...",
59 "Generating PR content...",
60 "Creating GitHub pull request...",
61 ];
62
63 if (input.action === "push") {
64 return [pushStage];
65 }
66 if (input.action === "create_pr") {
67 return input.shouldPushBeforePr ? [pushStage, ...prStages] : prStages;
68 }
69
70 const shouldIncludeCommitStages = input.action === "commit" || input.hasWorkingTreeChanges;
71 const commitStages = !shouldIncludeCommitStages
72 ? []
73 : input.hasCustomCommitMessage
74 ? ["Committing..."]
75 : ["Generating commit message...", "Committing..."];
76 if (input.action === "commit") {
77 return [...branchStages, ...commitStages];
78 }
79 if (input.action === "commit_push") {
80 return [...branchStages, ...commitStages, pushStage];
81 }
82 return [...branchStages, ...commitStages, pushStage, ...prStages];
83}
84
85export function buildMenuItems(45export function buildMenuItems(
86 gitStatus: VcsStatusResult | null,46 gitStatus: VcsStatusResult | null,
87 isBusy: boolean,47 isBusy: boolean,
...@@ -396,45 +356,3 @@ export function resolveDefaultBranchActionDialogCopy(input: {...@@ -396,45 +356,3 @@ export function resolveDefaultBranchActionDialogCopy(input: {
396 continueLabel: "Push & create PR",356 continueLabel: "Push & create PR",
397 };357 };
398}358}
399
400export function resolveThreadBranchUpdate(
401 result: GitRunStackedActionResult,
402): { branch: string } | null {
403 if (result.branch.status !== "created" || !result.branch.name) {
404 return null;
405 }
406
407 return {
408 branch: result.branch.name,
409 };
410}
411
412export function resolveLiveThreadBranchUpdate(input: {
413 threadBranch: string | null;
414 gitStatus: VcsStatusResult | null;
415}): { branch: string | null } | null {
416 if (!input.gitStatus) {
417 return null;
418 }
419
420 if (input.gitStatus.refName === null && input.threadBranch !== null) {
421 return null;
422 }
423
424 if (input.threadBranch === input.gitStatus.refName) {
425 return null;
426 }
427
428 if (
429 input.threadBranch !== null &&
430 input.gitStatus.refName !== null &&
431 !isTemporaryWorktreeBranch(input.threadBranch) &&
432 isTemporaryWorktreeBranch(input.gitStatus.refName)
433 ) {
434 return null;
435 }
436
437 return {
438 branch: input.gitStatus.refName,
439 };
440}
packages/client-runtime/src/state/projectGrouping.ts-13
...@@ -152,19 +152,6 @@ export function deriveLogicalProjectKeyFromSettings(...@@ -152,19 +152,6 @@ export function deriveLogicalProjectKeyFromSettings(
152 });152 });
153}153}
154154
155export function deriveLogicalProjectKeyFromRef(
156 projectRef: ScopedProjectRef,
157 project:
158 | Pick<EnvironmentProject, "environmentId" | "id" | "workspaceRoot" | "repositoryIdentity">
159 | null
160 | undefined,
161 options?: {
162 readonly groupingMode?: SidebarProjectGroupingMode;
163 },
164): string {
165 return project ? deriveLogicalProjectKey(project, options) : scopedProjectKey(projectRef);
166}
167
168export function deriveProjectGroupLabel(input: {155export function deriveProjectGroupLabel(input: {
169 readonly representative: Pick<EnvironmentProject, "title" | "repositoryIdentity">;156 readonly representative: Pick<EnvironmentProject, "title" | "repositoryIdentity">;
170 readonly members: ReadonlyArray<Pick<EnvironmentProject, "title" | "repositoryIdentity">>;157 readonly members: ReadonlyArray<Pick<EnvironmentProject, "title" | "repositoryIdentity">>;
packages/client-runtime/src/state/pullRequests.ts+2-1
...@@ -29,11 +29,12 @@ export {...@@ -29,11 +29,12 @@ export {
29 pullRequestDiffLoaderLayer,29 pullRequestDiffLoaderLayer,
30} from "./pullRequestDiffHttp.ts";30} from "./pullRequestDiffHttp.ts";
3131
32/** @public Required to name the error in consumers' inferred pull request results. */
32export class EnvironmentHttpConnectionNotReadyError extends Data.TaggedError(33export class EnvironmentHttpConnectionNotReadyError extends Data.TaggedError(
33 "EnvironmentHttpConnectionNotReadyError",34 "EnvironmentHttpConnectionNotReadyError",
34)<{ readonly message: string }> {}35)<{ readonly message: string }> {}
3536
36export const LINKED_PULL_REQUEST_IDLE_TTL_MS = 5_000;37const LINKED_PULL_REQUEST_IDLE_TTL_MS = 5_000;
3738
38function createPullRequestRefreshAtomFamily<R, E>(39function createPullRequestRefreshAtomFamily<R, E>(
39 runtime: Atom.AtomRuntime<EnvironmentRegistry | R, E>,40 runtime: Atom.AtomRuntime<EnvironmentRegistry | R, E>,
packages/client-runtime/src/state/runtime.ts+1-26
...@@ -390,31 +390,6 @@ export function createRuntimeCommand<R, ER, W, A, E>(...@@ -390,31 +390,6 @@ export function createRuntimeCommand<R, ER, W, A, E>(
390 };390 };
391}391}
392392
393export function createRuntimeStreamCommand<R, ER, W, A, E>(
394 runtime: Atom.AtomRuntime<R, ER>,
395 options: {
396 readonly label: string;
397 readonly execute: (input: W, registry: AtomRegistry.AtomRegistry) => Stream.Stream<A, E, R>;
398 readonly scheduler?: AtomCommandScheduler;
399 readonly concurrency?: AtomCommandConcurrency<W>;
400 },
401): AtomCommand<W, A, E | ER | Cause.NoSuchElementError> {
402 const scheduler = options.scheduler ?? createAtomCommandScheduler();
403 const concurrency = options.concurrency ?? { mode: "parallel" as const };
404 return {
405 label: options.label,
406 run: (registry, input) =>
407 settleAtomCommandResult(() =>
408 scheduler.schedule(registry, concurrency, input, () => {
409 const atom = runtime
410 .atom(options.execute(input, registry))
411 .pipe(Atom.withLabel(options.label));
412 return executeAtomQuery(registry, atom, { reportDefect: false, reportFailure: false });
413 }),
414 ),
415 };
416}
417
418export function reportAtomCommandResult(393export function reportAtomCommandResult(
419 result: AtomCommandResult<unknown, unknown>,394 result: AtomCommandResult<unknown, unknown>,
420 options: AtomCommandOptions = {},395 options: AtomCommandOptions = {},
...@@ -462,7 +437,7 @@ function parseEnvironmentRpcKey<Input>(key: string): {...@@ -462,7 +437,7 @@ function parseEnvironmentRpcKey<Input>(key: string): {
462 };437 };
463}438}
464439
465export function runInEnvironment<A, E, R>(440function runInEnvironment<A, E, R>(
466 environmentId: EnvironmentIdType,441 environmentId: EnvironmentIdType,
467 effect: Effect.Effect<A, E, R>,442 effect: Effect.Effect<A, E, R>,
468): Effect.Effect<443): Effect.Effect<
packages/client-runtime/src/state/server.ts+2-2
...@@ -455,7 +455,7 @@ export const makeEnvironmentServerConfigState = Effect.fn("EnvironmentServerConf...@@ -455,7 +455,7 @@ export const makeEnvironmentServerConfigState = Effect.fn("EnvironmentServerConf
455 },455 },
456);456);
457457
458export function serverConfigStateChanges(458function serverConfigStateChanges(
459 environmentId: EnvironmentId,459 environmentId: EnvironmentId,
460 subscription: ServerConfigSubscriptionOptions,460 subscription: ServerConfigSubscriptionOptions,
461) {461) {
...@@ -580,7 +580,7 @@ export const makeEnvironmentServerWelcomeState = Effect.fn("EnvironmentServerWel...@@ -580,7 +580,7 @@ export const makeEnvironmentServerWelcomeState = Effect.fn("EnvironmentServerWel
580 },580 },
581);581);
582582
583export function serverWelcomeStateChanges(environmentId: EnvironmentId) {583function serverWelcomeStateChanges(environmentId: EnvironmentId) {
584 return followStreamInEnvironment(584 return followStreamInEnvironment(
585 environmentId,585 environmentId,
586 Stream.unwrap(586 Stream.unwrap(
packages/client-runtime/src/state/sharedSettings.ts+1-1
...@@ -20,7 +20,7 @@ import * as Struct from "effect/Struct";...@@ -20,7 +20,7 @@ import * as Struct from "effect/Struct";
20import type { EnvironmentConnectionPhase } from "../connection/presentation.ts";20import type { EnvironmentConnectionPhase } from "../connection/presentation.ts";
2121
22/** Server keys that hold a user preference rather than machine config. */22/** Server keys that hold a user preference rather than machine config. */
23export const SHARED_SERVER_SETTING_KEYS = [23const SHARED_SERVER_SETTING_KEYS = [
24 "continueThreadsAfterServerUpdate",24 "continueThreadsAfterServerUpdate",
25 "sidebarAutoSettleAfterDays",25 "sidebarAutoSettleAfterDays",
26 "sidebarAutoSettleOnMerge",26 "sidebarAutoSettleOnMerge",
packages/client-runtime/src/state/shell.ts+1-1
...@@ -269,7 +269,7 @@ export const makeEnvironmentShellState = Effect.fn("EnvironmentShellState.make")...@@ -269,7 +269,7 @@ export const makeEnvironmentShellState = Effect.fn("EnvironmentShellState.make")
269 return state;269 return state;
270});270});
271271
272export function shellStateChanges(environmentId: EnvironmentId) {272function shellStateChanges(environmentId: EnvironmentId) {
273 return followStreamInEnvironment(273 return followStreamInEnvironment(
274 environmentId,274 environmentId,
275 Stream.unwrap(makeEnvironmentShellState().pipe(Effect.map(SubscriptionRef.changes))),275 Stream.unwrap(makeEnvironmentShellState().pipe(Effect.map(SubscriptionRef.changes))),
packages/client-runtime/src/state/terminalSession.ts+1-1
...@@ -96,7 +96,7 @@ export function nextTerminalAttachSeedState(): TerminalBufferState {...@@ -96,7 +96,7 @@ export function nextTerminalAttachSeedState(): TerminalBufferState {
96 };96 };
97}97}
9898
99export function terminalBufferStateFromSnapshot(99function terminalBufferStateFromSnapshot(
100 snapshot: TerminalSessionSnapshot,100 snapshot: TerminalSessionSnapshot,
101 maxBufferBytes: number,101 maxBufferBytes: number,
102 current: TerminalBufferState = EMPTY_TERMINAL_BUFFER_STATE,102 current: TerminalBufferState = EMPTY_TERMINAL_BUFFER_STATE,
packages/client-runtime/src/state/threadSort.ts+1-1
...@@ -209,7 +209,7 @@ export function pinOrderKeyBetween(before: string | null, after: string | null):...@@ -209,7 +209,7 @@ export function pinOrderKeyBetween(before: string | null, after: string | null):
209 drop lands next to keyless threads, so single-key insertion has nothing209 drop lands next to keyless threads, so single-key insertion has nothing
210 to anchor on). Two base-26 digits give 675 slots — far beyond any real210 to anchor on). Two base-26 digits give 675 slots — far beyond any real
211 pinned section — with monotonicity enforced as a belt-and-braces. */211 pinned section — with monotonicity enforced as a belt-and-braces. */
212export function generateSpreadPinOrderKeys(count: number): string[] {212function generateSpreadPinOrderKeys(count: number): string[] {
213 const space = PIN_ORDER_DIGITS.length * PIN_ORDER_DIGITS.length;213 const space = PIN_ORDER_DIGITS.length * PIN_ORDER_DIGITS.length;
214 const step = space / (count + 1);214 const step = space / (count + 1);
215 const keys: string[] = [];215 const keys: string[] = [];
packages/client-runtime/src/state/threads.ts+3-3
...@@ -47,7 +47,7 @@ function statusWithoutLiveData(data: Option.Option<OrchestrationThread>): Enviro...@@ -47,7 +47,7 @@ function statusWithoutLiveData(data: Option.Option<OrchestrationThread>): Enviro
47 * observed threads stays around 100K gzipped while median threads load fully.47 * observed threads stays around 100K gzipped while median threads load fully.
48 */48 */
49export const INITIAL_THREAD_USER_TURN_LIMIT = 10;49export const INITIAL_THREAD_USER_TURN_LIMIT = 10;
50export const OLDER_THREAD_PAGE_USER_TURN_LIMIT = 20;50const OLDER_THREAD_PAGE_USER_TURN_LIMIT = 20;
5151
52function pageStateFromSnapshot(52function pageStateFromSnapshot(
53 page: OrchestrationThreadDetailPage | undefined,53 page: OrchestrationThreadDetailPage | undefined,
...@@ -101,7 +101,7 @@ const defaultOlderTurnRequestRegistry = makeThreadOlderTurnRequestRegistry();...@@ -101,7 +101,7 @@ const defaultOlderTurnRequestRegistry = makeThreadOlderTurnRequestRegistry();
101 * instance is shared with the sync `requestOlderThreadTurns` entry point so101 * instance is shared with the sync `requestOlderThreadTurns` entry point so
102 * the apps get working wiring without providing anything.102 * the apps get working wiring without providing anything.
103 */103 */
104export class ThreadOlderTurnRequests extends Context.Reference<ThreadOlderTurnRequestRegistry>(104class ThreadOlderTurnRequests extends Context.Reference<ThreadOlderTurnRequestRegistry>(
105 "@t3tools/client-runtime/state/threads/ThreadOlderTurnRequests",105 "@t3tools/client-runtime/state/threads/ThreadOlderTurnRequests",
106 { defaultValue: () => defaultOlderTurnRequestRegistry },106 { defaultValue: () => defaultOlderTurnRequestRegistry },
107) {}107) {}
...@@ -812,7 +812,7 @@ export const makeEnvironmentThreadState = Effect.fn("EnvironmentThreadState.make...@@ -812,7 +812,7 @@ export const makeEnvironmentThreadState = Effect.fn("EnvironmentThreadState.make
812 return state;812 return state;
813});813});
814814
815export function threadStateChanges(815function threadStateChanges(
816 environmentId: EnvironmentIdType,816 environmentId: EnvironmentIdType,
817 threadId: ThreadIdType,817 threadId: ThreadIdType,
818 resumeCache?: ThreadResumeCache,818 resumeCache?: ThreadResumeCache,
packages/client-runtime/src/state/vcs.ts+2-3
...@@ -33,7 +33,7 @@ const OFFLINE_BRANCH_LIST_LIMIT = 100;...@@ -33,7 +33,7 @@ const OFFLINE_BRANCH_LIST_LIMIT = 100;
33const VCS_REFS_IDLE_TTL_MS = 30_000;33const VCS_REFS_IDLE_TTL_MS = 30_000;
34// Rows keep the last status they rendered, so the live stream only needs a34// Rows keep the last status they rendered, so the live stream only needs a
35// short grace period when virtualization or scrolling releases its consumer.35// short grace period when virtualization or scrolling releases its consumer.
36export const VCS_STATUS_IDLE_TTL_MS = 10_000;36const VCS_STATUS_IDLE_TTL_MS = 10_000;
37const VCS_REFS_RETRY_SCHEDULE = Schedule.exponential("1 second").pipe(37const VCS_REFS_RETRY_SCHEDULE = Schedule.exponential("1 second").pipe(
38 Schedule.modifyDelay(({ duration }) =>38 Schedule.modifyDelay(({ duration }) =>
39 Effect.succeed(Duration.min(duration, Duration.seconds(30))),39 Effect.succeed(Duration.min(duration, Duration.seconds(30))),
...@@ -214,7 +214,7 @@ export const makeCachedVcsRefsChanges = Effect.fn("CachedVcsRefsState.makeChange...@@ -214,7 +214,7 @@ export const makeCachedVcsRefsChanges = Effect.fn("CachedVcsRefsState.makeChange
214 return Stream.concat(cachedRefs, refreshedRefs);214 return Stream.concat(cachedRefs, refreshedRefs);
215});215});
216216
217export function cachedVcsRefsChanges(217function cachedVcsRefsChanges(
218 environmentId: EnvironmentId,218 environmentId: EnvironmentId,
219 input: VcsListRefsInput,219 input: VcsListRefsInput,
220 expectedRevision: number,220 expectedRevision: number,
...@@ -345,4 +345,3 @@ export function createVcsEnvironmentAtoms<R, E>(...@@ -345,4 +345,3 @@ export function createVcsEnvironmentAtoms<R, E>(
345export * from "./gitActions.ts";345export * from "./gitActions.ts";
346export * from "./vcsAction.ts";346export * from "./vcsAction.ts";
347export * from "./vcsRef.ts";347export * from "./vcsRef.ts";
348export * from "./vcsStatus.ts";
packages/client-runtime/src/state/vcsAction.ts+4-4
...@@ -163,14 +163,14 @@ const decodeVcsActionTargetKey = Schema.decodeUnknownSync(...@@ -163,14 +163,14 @@ const decodeVcsActionTargetKey = Schema.decodeUnknownSync(
163 Schema.Tuple([EnvironmentId, Schema.String]),163 Schema.Tuple([EnvironmentId, Schema.String]),
164);164);
165165
166export const vcsActionStateAtom = Atom.family((key: string) => {166const vcsActionStateAtom = Atom.family((key: string) => {
167 return Atom.make(EMPTY_VCS_ACTION_STATE).pipe(167 return Atom.make(EMPTY_VCS_ACTION_STATE).pipe(
168 Atom.keepAlive,168 Atom.keepAlive,
169 Atom.withLabel(`vcs-action:${key}`),169 Atom.withLabel(`vcs-action:${key}`),
170 );170 );
171});171});
172172
173export const EMPTY_VCS_ACTION_ATOM = Atom.make(EMPTY_VCS_ACTION_STATE).pipe(173const EMPTY_VCS_ACTION_ATOM = Atom.make(EMPTY_VCS_ACTION_STATE).pipe(
174 Atom.keepAlive,174 Atom.keepAlive,
175 Atom.withLabel("vcs-action:null"),175 Atom.withLabel("vcs-action:null"),
176);176);
...@@ -191,7 +191,7 @@ export function parseVcsActionTargetKey(key: string): ResolvedVcsActionTarget {...@@ -191,7 +191,7 @@ export function parseVcsActionTargetKey(key: string): ResolvedVcsActionTarget {
191 }191 }
192}192}
193193
194export function getVcsActionStateAtom(target: VcsActionTarget) {194function getVcsActionStateAtom(target: VcsActionTarget) {
195 const key = getVcsActionTargetKey(target);195 const key = getVcsActionTargetKey(target);
196 return key === null ? EMPTY_VCS_ACTION_ATOM : vcsActionStateAtom(key);196 return key === null ? EMPTY_VCS_ACTION_ATOM : vcsActionStateAtom(key);
197}197}
...@@ -217,7 +217,7 @@ export function beginVcsActionState(...@@ -217,7 +217,7 @@ export function beginVcsActionState(
217 };217 };
218}218}
219219
220export function failVcsActionState(220function failVcsActionState(
221 operation: VcsActionOperation,221 operation: VcsActionOperation,
222 actionId: string,222 actionId: string,
223 error: unknown,223 error: unknown,
packages/client-runtime/src/state/vcsStatus.ts deleted-6
...@@ -1,6 +0,0 @@
1import type { EnvironmentId } from "@t3tools/contracts";
2
3export interface VcsStatusTarget {
4 readonly environmentId: EnvironmentId | null;
5 readonly cwd: string | null;
6}
packages/client-runtime/src/voice-input/index.ts-1
...@@ -1,7 +1,6 @@...@@ -1,7 +1,6 @@
1export {1export {
2 VoiceInputController,2 VoiceInputController,
3 VOICE_RECORDING_LIMIT_SECONDS,3 VOICE_RECORDING_LIMIT_SECONDS,
4 resolveTranscriptCommit,
5 voiceInputBlocksSubmission,4 voiceInputBlocksSubmission,
6 voiceInputFreezesEditor,5 voiceInputFreezesEditor,
7 type VoiceDraftSnapshot,6 type VoiceDraftSnapshot,
packages/client-runtime/src/work-log/presentation.ts+1-1
...@@ -305,7 +305,7 @@ function workLogEntryIsToolLike(entry: WorkLogPresentationEntry): boolean {...@@ -305,7 +305,7 @@ function workLogEntryIsToolLike(entry: WorkLogPresentationEntry): boolean {
305 return entry.itemType !== undefined && isToolLifecycleItemType(entry.itemType);305 return entry.itemType !== undefined && isToolLifecycleItemType(entry.itemType);
306}306}
307307
308export function workLogEntryIsLocalCodeSearch(entry: WorkLogPresentationEntry): boolean {308function workLogEntryIsLocalCodeSearch(entry: WorkLogPresentationEntry): boolean {
309 return (309 return (
310 entry.itemType === "web_search" &&310 entry.itemType === "web_search" &&
311 /\bgrep\b/i.test(normalizeCompactToolLabel(entry.toolTitle ?? entry.label))311 /\bgrep\b/i.test(normalizeCompactToolLabel(entry.toolTitle ?? entry.label))