authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-08 01:11:08-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-08 01:11:08-07:00
log6f4cd07b900299629b9f2f9a9336f5c090556a51
tree2481fd6b1962b83c27cf209f7a74e1059aa18426
parent11601da846e7d82db63a6f4773e3a02421619b60
signature Signed by PGP key B5690EEEBB952194

refactor(server): classify runtime exports (#10274)


32 files changed, 40 insertions(+), 28 deletions(-)

apps/server/scripts/t3-sqlite-state.ts+1-1
...@@ -245,7 +245,7 @@ export const runSqliteState = Effect.fn("runSqliteState")(function* (...@@ -245,7 +245,7 @@ export const runSqliteState = Effect.fn("runSqliteState")(function* (
245 );245 );
246});246});
247247
248export const t3SqliteStateCommand = Command.make(248const t3SqliteStateCommand = Command.make(
249 "t3-sqlite-state",249 "t3-sqlite-state",
250 {250 {
251 operation: Argument.choice("operation", SqliteStateOperation.literals).pipe(251 operation: Argument.choice("operation", SqliteStateOperation.literals).pipe(
apps/server/src/attachmentStore.ts+1-1
...@@ -22,7 +22,7 @@ const ATTACHMENT_ID_PATTERN = new RegExp(...@@ -22,7 +22,7 @@ const ATTACHMENT_ID_PATTERN = new RegExp(
22);22);
2323
24export const PENDING_ATTACHMENT_THREAD_SEGMENT = "pending";24export const PENDING_ATTACHMENT_THREAD_SEGMENT = "pending";
25export const PENDING_ATTACHMENT_MAX_AGE_MS = 24 * 60 * 60 * 1000;25const PENDING_ATTACHMENT_MAX_AGE_MS = 24 * 60 * 60 * 1000;
26const PARTIAL_UPLOAD_MAX_AGE_MS = 60 * 60 * 1000;26const PARTIAL_UPLOAD_MAX_AGE_MS = 60 * 60 * 1000;
2727
28export function toSafeThreadAttachmentSegment(threadId: string): string | null {28export function toSafeThreadAttachmentSegment(threadId: string): string | null {
apps/server/src/auth/EnvironmentAuth.ts+3-2
...@@ -38,7 +38,7 @@ import * as SessionStore from "./SessionStore.ts";...@@ -38,7 +38,7 @@ import * as SessionStore from "./SessionStore.ts";
38import { verifyRequestDpopProof } from "./dpop.ts";38import { verifyRequestDpopProof } from "./dpop.ts";
39import { layerConfig as SqlitePersistenceLayer } from "../persistence/Layers/Sqlite.ts";39import { layerConfig as SqlitePersistenceLayer } from "../persistence/Layers/Sqlite.ts";
4040
41export const DEFAULT_SESSION_SUBJECT = "cli-issued-session";41const DEFAULT_SESSION_SUBJECT = "cli-issued-session";
42export const INTERNAL_ADMINISTRATIVE_BOOTSTRAP_SUBJECT = "administrative-bootstrap";42export const INTERNAL_ADMINISTRATIVE_BOOTSTRAP_SUBJECT = "administrative-bootstrap";
4343
44export interface IssuedPairingLink {44export interface IssuedPairingLink {
...@@ -591,6 +591,7 @@ export function selectRequestCredential(...@@ -591,6 +591,7 @@ export function selectRequestCredential(
591 return undefined;591 return undefined;
592}592}
593593
594/** @public Service construction is part of the canonical Effect module API. */
594export const make = Effect.gen(function* () {595export const make = Effect.gen(function* () {
595 const policy = yield* EnvironmentAuthPolicy.EnvironmentAuthPolicy;596 const policy = yield* EnvironmentAuthPolicy.EnvironmentAuthPolicy;
596 const bootstrapCredentials = yield* PairingGrantStore.PairingGrantStore;597 const bootstrapCredentials = yield* PairingGrantStore.PairingGrantStore;
...@@ -1033,7 +1034,7 @@ export const layer = Layer.effect(EnvironmentAuth, make).pipe(...@@ -1033,7 +1034,7 @@ export const layer = Layer.effect(EnvironmentAuth, make).pipe(
1033 Layer.provideMerge(EnvironmentAuthPolicy.layer),1034 Layer.provideMerge(EnvironmentAuthPolicy.layer),
1034);1035);
10351036
1036export const storageLayer = Layer.mergeAll(ServerSecretStore.layer, SqlitePersistenceLayer);1037const storageLayer = Layer.mergeAll(ServerSecretStore.layer, SqlitePersistenceLayer);
10371038
1038export const runtimeLayer = layer.pipe(1039export const runtimeLayer = layer.pipe(
1039 Layer.provideMerge(storageLayer),1040 Layer.provideMerge(storageLayer),
apps/server/src/auth/EnvironmentAuthPolicy.ts+1
...@@ -14,6 +14,7 @@ export class EnvironmentAuthPolicy extends Context.Service<...@@ -14,6 +14,7 @@ export class EnvironmentAuthPolicy extends Context.Service<
14 }14 }
15>()("t3/auth/EnvironmentAuthPolicy") {}15>()("t3/auth/EnvironmentAuthPolicy") {}
1616
17/** @public Service construction is part of the canonical Effect module API. */
17export const make = Effect.gen(function* () {18export const make = Effect.gen(function* () {
18 const config = yield* ServerConfig.ServerConfig;19 const config = yield* ServerConfig.ServerConfig;
19 const serverEnvironment = yield* ServerEnvironment.ServerEnvironmentIdentity;20 const serverEnvironment = yield* ServerEnvironment.ServerEnvironmentIdentity;
apps/server/src/auth/PairingGrantStore.ts-2
...@@ -72,7 +72,6 @@ export const BootstrapCredentialInvalidError = Schema.Union([...@@ -72,7 +72,6 @@ export const BootstrapCredentialInvalidError = Schema.Union([
72 UnavailableBootstrapCredentialError,72 UnavailableBootstrapCredentialError,
73]);73]);
74export type BootstrapCredentialInvalidError = typeof BootstrapCredentialInvalidError.Type;74export type BootstrapCredentialInvalidError = typeof BootstrapCredentialInvalidError.Type;
75export const isBootstrapCredentialInvalidError = Schema.is(BootstrapCredentialInvalidError);
7675
77export class ActivePairingLinksLoadError extends Schema.TaggedError<ActivePairingLinksLoadError>()(76export class ActivePairingLinksLoadError extends Schema.TaggedError<ActivePairingLinksLoadError>()(
78 "ActivePairingLinksLoadError",77 "ActivePairingLinksLoadError",
...@@ -173,7 +172,6 @@ export const BootstrapCredentialError = Schema.Union([...@@ -173,7 +172,6 @@ export const BootstrapCredentialError = Schema.Union([
173 BootstrapCredentialInternalError,172 BootstrapCredentialInternalError,
174]);173]);
175export type BootstrapCredentialError = typeof BootstrapCredentialError.Type;174export type BootstrapCredentialError = typeof BootstrapCredentialError.Type;
176export const isBootstrapCredentialError = Schema.is(BootstrapCredentialError);
177175
178export interface IssuedBootstrapCredential {176export interface IssuedBootstrapCredential {
179 readonly id: string;177 readonly id: string;
apps/server/src/auth/ServerSecretStore.ts+1
...@@ -149,6 +149,7 @@ export class ServerSecretStore extends Context.Service<...@@ -149,6 +149,7 @@ export class ServerSecretStore extends Context.Service<
149 }149 }
150>()("t3/auth/ServerSecretStore") {}150>()("t3/auth/ServerSecretStore") {}
151151
152/** @public Service construction is part of the canonical Effect module API. */
152export const make = Effect.gen(function* () {153export const make = Effect.gen(function* () {
153 const crypto = yield* Crypto.Crypto;154 const crypto = yield* Crypto.Crypto;
154 const fileSystem = yield* FileSystem.FileSystem;155 const fileSystem = yield* FileSystem.FileSystem;
apps/server/src/auth/SessionStore.ts-2
...@@ -349,14 +349,12 @@ export const SessionCredentialInternalError = Schema.Union([...@@ -349,14 +349,12 @@ export const SessionCredentialInternalError = Schema.Union([
349 OtherSessionsRevocationError,349 OtherSessionsRevocationError,
350]);350]);
351export type SessionCredentialInternalError = typeof SessionCredentialInternalError.Type;351export type SessionCredentialInternalError = typeof SessionCredentialInternalError.Type;
352export const isSessionCredentialInternalError = Schema.is(SessionCredentialInternalError);
353352
354export const SessionCredentialError = Schema.Union([353export const SessionCredentialError = Schema.Union([
355 SessionCredentialInvalidError,354 SessionCredentialInvalidError,
356 SessionCredentialInternalError,355 SessionCredentialInternalError,
357]);356]);
358export type SessionCredentialError = typeof SessionCredentialError.Type;357export type SessionCredentialError = typeof SessionCredentialError.Type;
359export const isSessionCredentialError = Schema.is(SessionCredentialError);
360358
361export class SessionStore extends Context.Service<359export class SessionStore extends Context.Service<
362 SessionStore,360 SessionStore,
apps/server/src/auth/http.ts+1-1
...@@ -65,7 +65,7 @@ const appendDpopChallengeOnUnauthorized = (error: EnvironmentAuthInvalidError) =...@@ -65,7 +65,7 @@ const appendDpopChallengeOnUnauthorized = (error: EnvironmentAuthInvalidError) =
65 return yield* error;65 return yield* error;
66 });66 });
6767
68export const currentEnvironmentTraceId = Effect.currentParentSpan.pipe(68const currentEnvironmentTraceId = Effect.currentParentSpan.pipe(
69 Effect.map((span) => span.traceId),69 Effect.map((span) => span.traceId),
70 Effect.orElseSucceed(() => "unavailable"),70 Effect.orElseSucceed(() => "unavailable"),
71);71);
apps/server/src/background/BackgroundPolicy.ts+2-1
...@@ -82,7 +82,7 @@ function leaseKey(lease: Pick<ClientActivityLease, "sessionId" | "rpcClientId" |...@@ -82,7 +82,7 @@ function leaseKey(lease: Pick<ClientActivityLease, "sessionId" | "rpcClientId" |
82 return JSON.stringify([lease.sessionId, lease.rpcClientId, lease.clientId]);82 return JSON.stringify([lease.sessionId, lease.rpcClientId, lease.clientId]);
83}83}
8484
85export function upsertClientActivityLease(85function upsertClientActivityLease(
86 leases: ReadonlyMap<string, ClientActivityLease>,86 leases: ReadonlyMap<string, ClientActivityLease>,
87 lease: ClientActivityLease,87 lease: ClientActivityLease,
88 now: DateTime.Utc,88 now: DateTime.Utc,
...@@ -208,6 +208,7 @@ function computeSnapshot(input: {...@@ -208,6 +208,7 @@ function computeSnapshot(input: {
208 };208 };
209}209}
210210
211/** @public Service construction is part of the canonical Effect module API. */
211export const make = Effect.fn("background.policy.make")(function* () {212export const make = Effect.fn("background.policy.make")(function* () {
212 const hostPowerMonitor = yield* HostPowerMonitor.HostPowerMonitor;213 const hostPowerMonitor = yield* HostPowerMonitor.HostPowerMonitor;
213 const serverSettings = yield* ServerSettingsService;214 const serverSettings = yield* ServerSettingsService;
apps/server/src/background/HostPowerMonitor.ts+1-1
...@@ -19,7 +19,7 @@ export class HostPowerMonitor extends Context.Service<...@@ -19,7 +19,7 @@ export class HostPowerMonitor extends Context.Service<
19 }19 }
20>()("t3/background/HostPowerMonitor") {}20>()("t3/background/HostPowerMonitor") {}
2121
22export const makeUnknownSnapshot = (22const makeUnknownSnapshot = (
23 source: HostPowerSnapshot["source"],23 source: HostPowerSnapshot["source"],
24 updatedAt: HostPowerSnapshot["updatedAt"],24 updatedAt: HostPowerSnapshot["updatedAt"],
25): HostPowerSnapshot => ({25): HostPowerSnapshot => ({
apps/server/src/checkpointing/CheckpointDiffQuery.ts+1
...@@ -75,6 +75,7 @@ function buildTurnDiffResult(...@@ -75,6 +75,7 @@ function buildTurnDiffResult(
75 };75 };
76}76}
7777
78/** @public Service construction is part of the canonical Effect module API. */
78export const make = Effect.gen(function* () {79export const make = Effect.gen(function* () {
79 const projectionSnapshotQuery = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;80 const projectionSnapshotQuery = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;
80 const checkpointStore = yield* CheckpointStore.CheckpointStore;81 const checkpointStore = yield* CheckpointStore.CheckpointStore;
apps/server/src/checkpointing/CheckpointStore.ts+1
...@@ -98,6 +98,7 @@ export class CheckpointStore extends Context.Service<...@@ -98,6 +98,7 @@ export class CheckpointStore extends Context.Service<
98 }98 }
99>()("t3/checkpointing/CheckpointStore") {}99>()("t3/checkpointing/CheckpointStore") {}
100100
101/** @public Service construction is part of the canonical Effect module API. */
101export const make = Effect.gen(function* () {102export const make = Effect.gen(function* () {
102 const vcsRegistry = yield* VcsDriverRegistry.VcsDriverRegistry;103 const vcsRegistry = yield* VcsDriverRegistry.VcsDriverRegistry;
103104
apps/server/src/checkpointing/Utils.ts+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1import * as Encoding from "effect/Encoding";1import * as Encoding from "effect/Encoding";
2import { CheckpointRef, ProjectId, type ThreadId } from "@t3tools/contracts";2import { CheckpointRef, ProjectId, type ThreadId } from "@t3tools/contracts";
33
4export const CHECKPOINT_REFS_PREFIX = "refs/t3/checkpoints";4const CHECKPOINT_REFS_PREFIX = "refs/t3/checkpoints";
55
6export function checkpointRefForThreadTurn(threadId: ThreadId, turnCount: number): CheckpointRef {6export function checkpointRefForThreadTurn(threadId: ThreadId, turnCount: number): CheckpointRef {
7 return CheckpointRef.make(7 return CheckpointRef.make(
apps/server/src/cli/app.ts+1-1
...@@ -81,7 +81,7 @@ function isDesktopPlatform(platform: NodeJS.Platform): platform is DesktopAppAct...@@ -81,7 +81,7 @@ function isDesktopPlatform(platform: NodeJS.Platform): platform is DesktopAppAct
81 return platform === "darwin" || platform === "linux" || platform === "win32";81 return platform === "darwin" || platform === "linux" || platform === "win32";
82}82}
8383
84export function sendDesktopAppActivationRequest(input: {84function sendDesktopAppActivationRequest(input: {
85 readonly address: string;85 readonly address: string;
86 readonly fallbackAddress?: string;86 readonly fallbackAddress?: string;
87 readonly request: DesktopAppActivationRequest;87 readonly request: DesktopAppActivationRequest;
apps/server/src/cli/config.ts+2-2
...@@ -17,7 +17,7 @@ import { readBootstrapEnvelope } from "../bootstrap.ts";...@@ -17,7 +17,7 @@ import { readBootstrapEnvelope } from "../bootstrap.ts";
17import * as ServerConfig from "../config.ts";17import * as ServerConfig from "../config.ts";
18import { expandHomePath, resolveBaseDir } from "../os-jank.ts";18import { expandHomePath, resolveBaseDir } from "../os-jank.ts";
1919
20export const modeFlag = Flag.choice("mode", ServerConfig.RuntimeMode.literals).pipe(20const modeFlag = Flag.choice("mode", ServerConfig.RuntimeMode.literals).pipe(
21 Flag.withDescription("Runtime mode. `desktop` keeps loopback defaults unless overridden."),21 Flag.withDescription("Runtime mode. `desktop` keeps loopback defaults unless overridden."),
22 Flag.optional,22 Flag.optional,
23);23);
...@@ -69,7 +69,7 @@ const tailscaleServeFlag = Flag.boolean("tailscale-serve").pipe(...@@ -69,7 +69,7 @@ const tailscaleServeFlag = Flag.boolean("tailscale-serve").pipe(
69 ),69 ),
70 Flag.optional,70 Flag.optional,
71);71);
72export const tailscaleServePortFlag = Flag.integer("tailscale-serve-port").pipe(72const tailscaleServePortFlag = Flag.integer("tailscale-serve-port").pipe(
73 Flag.withSchema(PortSchema),73 Flag.withSchema(PortSchema),
74 Flag.withDescription("HTTPS port for Tailscale Serve when --tailscale-serve is enabled."),74 Flag.withDescription("HTTPS port for Tailscale Serve when --tailscale-serve is enabled."),
75 Flag.optional,75 Flag.optional,
apps/server/src/cli/pair.ts+1-1
...@@ -173,7 +173,7 @@ export const resolveTailscaleLocalTarget = (...@@ -173,7 +173,7 @@ export const resolveTailscaleLocalTarget = (
173 return { localPort: state.port };173 return { localPort: state.port };
174};174};
175175
176export const formatPairOutput = (input: {176const formatPairOutput = (input: {
177 readonly serverLabel: string;177 readonly serverLabel: string;
178 readonly origin: string;178 readonly origin: string;
179 readonly pairingUrl: string;179 readonly pairingUrl: string;
apps/server/src/cloud/CliTokenManager.ts+1
...@@ -324,6 +324,7 @@ export const outOfBandOAuthLogin = Effect.fn("cloud.cli_token.out_of_band_oauth_...@@ -324,6 +324,7 @@ export const outOfBandOAuthLogin = Effect.fn("cloud.cli_token.out_of_band_oauth_
324 });324 });
325});325});
326326
327/** @public Service construction is part of the canonical Effect module API. */
327export const make = Effect.gen(function* () {328export const make = Effect.gen(function* () {
328 // Capture exactly the services the login/refresh flows need at build time329 // Capture exactly the services the login/refresh flows need at build time
329 // (matching the behavior before the out-of-band flow captured the instances), not330 // (matching the behavior before the out-of-band flow captured the instances), not
apps/server/src/cloud/ManagedEndpointRuntime.ts+1
...@@ -111,6 +111,7 @@ const stopConnector = (connector: ActiveConnector | null) =>...@@ -111,6 +111,7 @@ const stopConnector = (connector: ActiveConnector | null) =>
111 )111 )
112 : Effect.void;112 : Effect.void;
113113
114/** @public Service construction is part of the canonical Effect module API. */
114export const make = Effect.gen(function* () {115export const make = Effect.gen(function* () {
115 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;116 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
116 const relayClient = yield* RelayClient.RelayClient;117 const relayClient = yield* RelayClient.RelayClient;
apps/server/src/cloud/publicConfig.ts+4-4
...@@ -49,21 +49,21 @@ function normalizeSecureUrl(value: string): string | null {...@@ -49,21 +49,21 @@ function normalizeSecureUrl(value: string): string | null {
49 }49 }
50}50}
5151
52export const buildTimeRelayUrl =52const buildTimeRelayUrl =
53 typeof __T3CODE_BUILD_RELAY_URL__ === "undefined"53 typeof __T3CODE_BUILD_RELAY_URL__ === "undefined"
54 ? ""54 ? ""
55 : (normalizeSecureRelayUrl(__T3CODE_BUILD_RELAY_URL__) ?? "");55 : (normalizeSecureRelayUrl(__T3CODE_BUILD_RELAY_URL__) ?? "");
56export const buildTimeClerkPublishableKey = readBuildTimeValue(56const buildTimeClerkPublishableKey = readBuildTimeValue(
57 typeof __T3CODE_BUILD_CLERK_PUBLISHABLE_KEY__ === "undefined"57 typeof __T3CODE_BUILD_CLERK_PUBLISHABLE_KEY__ === "undefined"
58 ? undefined58 ? undefined
59 : __T3CODE_BUILD_CLERK_PUBLISHABLE_KEY__,59 : __T3CODE_BUILD_CLERK_PUBLISHABLE_KEY__,
60);60);
61export const buildTimeClerkCliOAuthClientId = readBuildTimeValue(61const buildTimeClerkCliOAuthClientId = readBuildTimeValue(
62 typeof __T3CODE_BUILD_CLERK_CLI_OAUTH_CLIENT_ID__ === "undefined"62 typeof __T3CODE_BUILD_CLERK_CLI_OAUTH_CLIENT_ID__ === "undefined"
63 ? undefined63 ? undefined
64 : __T3CODE_BUILD_CLERK_CLI_OAUTH_CLIENT_ID__,64 : __T3CODE_BUILD_CLERK_CLI_OAUTH_CLIENT_ID__,
65);65);
66export const buildTimeRelayClientTracing = {66const buildTimeRelayClientTracing = {
67 tracesUrl: readBuildTimeValue(67 tracesUrl: readBuildTimeValue(
68 typeof __T3CODE_BUILD_RELAY_CLIENT_OTLP_TRACES_URL__ === "undefined"68 typeof __T3CODE_BUILD_RELAY_CLIENT_OTLP_TRACES_URL__ === "undefined"
69 ? undefined69 ? undefined
apps/server/src/cloud/serviceProtocol.ts+1-1
...@@ -71,7 +71,7 @@ export const isExactServiceVersion = (version: string): boolean =>...@@ -71,7 +71,7 @@ export const isExactServiceVersion = (version: string): boolean =>
71const isRecord = (value: unknown): value is Record<string, unknown> =>71const isRecord = (value: unknown): value is Record<string, unknown> =>
72 typeof value === "object" && value !== null && !Array.isArray(value);72 typeof value === "object" && value !== null && !Array.isArray(value);
7373
74export function decodeServiceUpdate(value: unknown): ServiceUpdateRecord | undefined {74function decodeServiceUpdate(value: unknown): ServiceUpdateRecord | undefined {
75 if (!isRecord(value)) return undefined;75 if (!isRecord(value)) return undefined;
76 const { id, fromVersion, targetVersion, status } = value;76 const { id, fromVersion, targetVersion, status } = value;
77 if (77 if (
apps/server/src/environment/RemoteOpenTargets.ts+1
...@@ -26,6 +26,7 @@ export class RemoteOpenTargets extends Context.Service<...@@ -26,6 +26,7 @@ export class RemoteOpenTargets extends Context.Service<
26 }26 }
27>()("t3/environment/RemoteOpenTargets") {}27>()("t3/environment/RemoteOpenTargets") {}
2828
29/** @public Service construction is part of the canonical Effect module API. */
29export const make = Effect.gen(function* () {30export const make = Effect.gen(function* () {
30 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;31 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
31 const net = yield* NetService.NetService;32 const net = yield* NetService.NetService;
apps/server/src/environment/ServerEnvironment.ts+1
...@@ -179,6 +179,7 @@ const makeIdentity = Effect.gen(function* () {...@@ -179,6 +179,7 @@ const makeIdentity = Effect.gen(function* () {
179 });179 });
180});180});
181181
182/** @public Service construction is part of the canonical Effect module API. */
182export const make = Effect.gen(function* () {183export const make = Effect.gen(function* () {
183 const path = yield* Path.Path;184 const path = yield* Path.Path;
184 const serverConfig = yield* ServerConfig.ServerConfig;185 const serverConfig = yield* ServerConfig.ServerConfig;
apps/server/src/imageMime.ts+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1import Mime from "@effect/platform-node/Mime";1import Mime from "@effect/platform-node/Mime";
22
3export const IMAGE_EXTENSION_BY_MIME_TYPE: Record<string, string> = {3const IMAGE_EXTENSION_BY_MIME_TYPE: Record<string, string> = {
4 "image/avif": ".avif",4 "image/avif": ".avif",
5 "image/bmp": ".bmp",5 "image/bmp": ".bmp",
6 "image/gif": ".gif",6 "image/gif": ".gif",
apps/server/src/persistence/AuthPairingLinks.ts+1
...@@ -119,6 +119,7 @@ function toPersistenceSqlOrDecodeError(...@@ -119,6 +119,7 @@ function toPersistenceSqlOrDecodeError(
119 });119 });
120}120}
121121
122/** @public Service construction is part of the canonical Effect module API. */
122export const make = Effect.gen(function* () {123export const make = Effect.gen(function* () {
123 const sql = yield* SqlClient.SqlClient;124 const sql = yield* SqlClient.SqlClient;
124125
apps/server/src/persistence/AuthSessions.ts+1
...@@ -200,6 +200,7 @@ function toPersistenceSqlOrDecodeError(...@@ -200,6 +200,7 @@ function toPersistenceSqlOrDecodeError(
200 });200 });
201}201}
202202
203/** @public Service construction is part of the canonical Effect module API. */
203export const make = Effect.gen(function* () {204export const make = Effect.gen(function* () {
204 const sql = yield* SqlClient.SqlClient;205 const sql = yield* SqlClient.SqlClient;
205206
apps/server/src/persistence/Migrations.ts+2-2
...@@ -72,7 +72,7 @@ import Migration0049 from "./Migrations/049_ProjectionThreadsActiveOrderKey.ts";...@@ -72,7 +72,7 @@ import Migration0049 from "./Migrations/049_ProjectionThreadsActiveOrderKey.ts";
72 * Uses Migrator.fromRecord which parses the key format and72 * Uses Migrator.fromRecord which parses the key format and
73 * returns migrations sorted by ID.73 * returns migrations sorted by ID.
74 */74 */
75export const migrationEntries = [75const migrationEntries = [
76 [1, "OrchestrationEvents", Migration0001],76 [1, "OrchestrationEvents", Migration0001],
77 [2, "OrchestrationCommandReceipts", Migration0002],77 [2, "OrchestrationCommandReceipts", Migration0002],
78 [3, "CheckpointDiffBlobs", Migration0003],78 [3, "CheckpointDiffBlobs", Migration0003],
...@@ -126,7 +126,7 @@ export const migrationEntries = [...@@ -126,7 +126,7 @@ export const migrationEntries = [
126126
127export const migrationManifest = migrationEntries.map(([id, name]) => [id, name] as const);127export const migrationManifest = migrationEntries.map(([id, name]) => [id, name] as const);
128128
129export const makeMigrationLoader = (throughId?: number) =>129const makeMigrationLoader = (throughId?: number) =>
130 Migrator.fromRecord(130 Migrator.fromRecord(
131 Object.fromEntries(131 Object.fromEntries(
132 migrationEntries132 migrationEntries
apps/server/src/persistence/ProviderSessionRuntime.ts+1
...@@ -166,6 +166,7 @@ function toPersistenceSqlOrDecodeError(...@@ -166,6 +166,7 @@ function toPersistenceSqlOrDecodeError(
166 });166 });
167}167}
168168
169/** @public Service construction is part of the canonical Effect module API. */
169export const make = Effect.gen(function* () {170export const make = Effect.gen(function* () {
170 const sql = yield* SqlClient.SqlClient;171 const sql = yield* SqlClient.SqlClient;
171172
apps/server/src/process/externalLauncher.ts+1
...@@ -752,6 +752,7 @@ const launchEditorProcess = Effect.fn("externalLauncher.launchEditorProcess")(fu...@@ -752,6 +752,7 @@ const launchEditorProcess = Effect.fn("externalLauncher.launchEditorProcess")(fu
752 );752 );
753});753});
754754
755/** @public Service construction is part of the canonical Effect module API. */
755export const make = Effect.gen(function* () {756export const make = Effect.gen(function* () {
756 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;757 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
757 const fileSystem = yield* FileSystem.FileSystem;758 const fileSystem = yield* FileSystem.FileSystem;
apps/server/src/processRunner.ts+1
...@@ -399,6 +399,7 @@ const runProcessCore = Effect.fn("processRunner.runProcessCore")(function* (...@@ -399,6 +399,7 @@ const runProcessCore = Effect.fn("processRunner.runProcessCore")(function* (
399 } satisfies ProcessRunOutput;399 } satisfies ProcessRunOutput;
400});400});
401401
402/** @public Service construction is part of the canonical Effect module API. */
402export const make = Effect.fn("ProcessRunner.make")(function* () {403export const make = Effect.fn("ProcessRunner.make")(function* () {
403 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;404 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
404405
apps/server/src/server.ts+1-1
...@@ -564,7 +564,7 @@ export const makeRoutesLayer = Layer.mergeAll(...@@ -564,7 +564,7 @@ export const makeRoutesLayer = Layer.mergeAll(
564 Layer.provide(httpCompressionLayer),564 Layer.provide(httpCompressionLayer),
565);565);
566566
567export const makeServerLayer = Layer.unwrap(567const makeServerLayer = Layer.unwrap(
568 Effect.gen(function* () {568 Effect.gen(function* () {
569 const config = yield* ServerConfig.ServerConfig;569 const config = yield* ServerConfig.ServerConfig;
570 const activation = yield* Deferred.make<void>();570 const activation = yield* Deferred.make<void>();
apps/server/src/serverRuntimeStartup.ts+3-2
...@@ -147,7 +147,7 @@ export const makeCommandGate = Effect.gen(function* () {...@@ -147,7 +147,7 @@ export const makeCommandGate = Effect.gen(function* () {
147 } satisfies CommandGate;147 } satisfies CommandGate;
148});148});
149149
150export const recordStartupHeartbeat = Effect.gen(function* () {150const recordStartupHeartbeat = Effect.gen(function* () {
151 const analytics = yield* AnalyticsService.AnalyticsService;151 const analytics = yield* AnalyticsService.AnalyticsService;
152 const projectionSnapshotQuery = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;152 const projectionSnapshotQuery = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;
153153
...@@ -466,7 +466,7 @@ const clearContinuationMarkers = (...@@ -466,7 +466,7 @@ const clearContinuationMarkers = (
466 { concurrency: "unbounded", discard: true },466 { concurrency: "unbounded", discard: true },
467 );467 );
468468
469export const clearProviderSessionContinuationMarkers = (threadIds: ReadonlyArray<ThreadId>) =>469const clearProviderSessionContinuationMarkers = (threadIds: ReadonlyArray<ThreadId>) =>
470 Effect.gen(function* () {470 Effect.gen(function* () {
471 const directory = yield* ProviderSessionDirectory.ProviderSessionDirectory;471 const directory = yield* ProviderSessionDirectory.ProviderSessionDirectory;
472 yield* clearContinuationMarkers(directory, threadIds);472 yield* clearContinuationMarkers(directory, threadIds);
...@@ -803,6 +803,7 @@ export const autoPullProjects = Effect.fn("autoPullProjects")(function* (...@@ -803,6 +803,7 @@ export const autoPullProjects = Effect.fn("autoPullProjects")(function* (
803 );803 );
804});804});
805805
806/** @public Service construction is part of the canonical Effect module API. */
806export const make = (options?: StartupOptions) =>807export const make = (options?: StartupOptions) =>
807 Effect.gen(function* () {808 Effect.gen(function* () {
808 const serverConfig = yield* ServerConfig.ServerConfig;809 const serverConfig = yield* ServerConfig.ServerConfig;
apps/server/src/serverSettings.ts+1-1
...@@ -142,7 +142,7 @@ function providerEnvironmentSecretName(input: {...@@ -142,7 +142,7 @@ function providerEnvironmentSecretName(input: {
142 */142 */
143const USAGE_LIMIT_SOURCE_KEY_REDACTED = "\u2022\u2022\u2022\u2022\u2022\u2022";143const USAGE_LIMIT_SOURCE_KEY_REDACTED = "\u2022\u2022\u2022\u2022\u2022\u2022";
144144
145export function usageLimitSourceSecretName(sourceId: string): string {145function usageLimitSourceSecretName(sourceId: string): string {
146 return `usage-limit-source-${Buffer.from(sourceId, "utf8").toString("base64url")}`;146 return `usage-limit-source-${Buffer.from(sourceId, "utf8").toString("base64url")}`;
147}147}
148148