Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/server/src/provider/ClaudeModelCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function scopeClaudeModelCatalog(
return { models: [...builtInModels, ...customCatalogModels] };
}

export function resolveClaudeCatalogModel(
function resolveClaudeCatalogModel(
catalog: ClaudeModelCatalog,
slugOrAlias: string | null | undefined,
): ClaudeCatalogModel | undefined {
Expand Down Expand Up @@ -215,7 +215,7 @@ export function isClaudeCatalogUltracodeEffort(effort: string | null | undefined
return effort === "ultracode";
}

export function resolveClaudeCatalogContextWindow(
function resolveClaudeCatalogContextWindow(
catalog: ClaudeModelCatalog,
modelSelection: ModelSelection | undefined,
): string | undefined {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/provider/Drivers/ClaudeSkills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function parseSkillFrontmatter(contents: string): SkillFrontmatter {
* user and project one. Absent on almost every machine, which is why a missing
* file is the normal case rather than an error.
*/
export function claudeManagedSettingsPath(
function claudeManagedSettingsPath(
path: Path.Path,
platform: NodeJS.Platform,
environment: NodeJS.ProcessEnv,
Expand Down
7 changes: 0 additions & 7 deletions apps/server/src/provider/Layers/ProviderAdapterRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ export const ProviderAdapterRegistryLive = Layer.effect(
makeProviderAdapterRegistry(),
);

// Exposed for tests that want to build a facade over a pre-assembled
// `ProviderInstanceRegistry` without pulling in the whole boot graph.
export { makeProviderAdapterRegistry };

// Re-export for consumers that need the accessor shape. The service tag
// itself lives in `Services/ProviderAdapterRegistry.ts`.
export { ProviderAdapterRegistry } from "../Services/ProviderAdapterRegistry.ts";
// Re-export for consumers (including tests) that construct a
// `ProviderInstanceId` before calling `getByInstance`.
export { ProviderInstanceId };
2 changes: 2 additions & 0 deletions apps/server/src/provider/Layers/ProviderEventLoggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export const NoOpProviderEventLoggers: ProviderEventLoggers["Service"] = {
/**
* Builds both stream views over one shared store. Setup failures are logged
* and downgraded to the no-op service so diagnostics never block startup.
*
* @public Service construction is part of the canonical Effect module API.
*/
export const make = Effect.gen(function* () {
const { providerEventLogPath } = yield* ServerConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
* @module provider/Layers/ProviderInstanceRegistryLive
*/
import {
defaultInstanceIdForDriver,
providerInstanceConfigEnabledFlag,
ProviderInstanceId,
type ProviderInstanceConfig,
Expand Down Expand Up @@ -430,5 +429,3 @@ export const ProviderInstanceRegistryMutableLayer = <R>(input: {
),
),
) as Layer.Layer<ProviderInstanceRegistry | ProviderInstanceRegistryMutator, never, R>;

export { defaultInstanceIdForDriver };
5 changes: 2 additions & 3 deletions apps/server/src/provider/Layers/codexLaunchArgs.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { tokenizeCliArgs } from "@t3tools/shared/cliArgs";

export const T3CODE_CODEX_LAUNCH_ARGS_ENV = "T3CODE_CODEX_LAUNCH_ARGS";
const T3CODE_CODEX_LAUNCH_ARGS_ENV = "T3CODE_CODEX_LAUNCH_ARGS";

export const resolveCodexLaunchArgs = (
launchArgs?: string,
environment: NodeJS.ProcessEnv = process.env,
) => environment[T3CODE_CODEX_LAUNCH_ARGS_ENV]?.trim() || launchArgs?.trim() || "";

export const codexLaunchArgv = (launchArgs?: string): ReadonlyArray<string> =>
tokenizeCliArgs(launchArgs);
const codexLaunchArgv = (launchArgs?: string): ReadonlyArray<string> => tokenizeCliArgs(launchArgs);

export const codexAppServerArgs = (launchArgs?: string) => [
"app-server",
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/provider/Layers/codexResetCredit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class CodexResetCreditCoordinator extends Context.Service<
}
>()("t3/provider/Layers/codexResetCredit/CodexResetCreditCoordinator") {}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const crypto = yield* Crypto.Crypto;
const statesRef = yield* Ref.make<ReadonlyMap<string, AccountRedemptionState>>(new Map());
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/provider/Layers/codexUsageLimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function labelForKind(kind: ServerProviderUsageWindow["kind"]): string {
* `windowDurationMins`; when it does not, paid plans expose the 5-hour and
* weekly pair and Free/Go expose one monthly allowance.
*/
export function codexRateLimitsToWindows(
function codexRateLimitsToWindows(
snapshot: CodexRateLimitSnapshot,
): ReadonlyArray<ServerProviderUsageWindow> {
// Show the main allowance only. Model-specific notifications (such as Spark)
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/provider/ModelManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export const encodeManifestCache = Schema.encodeEffect(
);

/** True when the manifest classifies `slug` as legacy for `driverKind`. */
export function isLegacyModel(
function isLegacyModel(
manifest: ModelManifestData,
driverKind: ProviderDriverKind,
slug: string,
Expand Down Expand Up @@ -310,8 +310,8 @@ export class ModelManifest extends Context.Service<
}
>()("t3/provider/ModelManifest") {}

/** Constant service for tests and callers that only need the bundled data. */
export const BundledOnlyModelManifest: ModelManifest["Service"] = {
/** Constant service backing the bundled-data test layer. */
const BundledOnlyModelManifest: ModelManifest["Service"] = {
current: Effect.succeed(BUNDLED_MODEL_MANIFEST),
refresh: Effect.succeed(BUNDLED_MODEL_MANIFEST),
refreshInBackground: Effect.void,
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/provider/OpenCodeServerOwner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as Semaphore from "effect/Semaphore";

import * as OpenCodeRuntime from "./opencodeRuntime.ts";

export const OPENCODE_SERVER_IDLE_TTL = "30 seconds";
const OPENCODE_SERVER_IDLE_TTL = "30 seconds";

interface OpenCodeServerOwnerState {
server: OpenCodeRuntime.OpenCodeServerProcess | null;
Expand Down Expand Up @@ -176,6 +176,7 @@ export const make = Effect.fn("OpenCodeServerOwner.make")(function* (input: {
});
});

/** @public Service construction is part of the canonical Effect module API. */
export const layer = (input: {
readonly binaryPath: string;
readonly directory: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/provider/acp/AntigravityAcpSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const AUDIO_MIME_TYPES = new Set([
"audio/x-wav",
"audio/webm",
]);
export const ANTIGRAVITY_MAX_AUDIO_ATTACHMENT_BYTES = 20 * 1024 * 1024;
const ANTIGRAVITY_MAX_AUDIO_ATTACHMENT_BYTES = 20 * 1024 * 1024;
const TEXT_MIME_TYPES = new Set([
"application/json",
"application/ld+json",
Expand Down
4 changes: 1 addition & 3 deletions apps/server/src/provider/acp/AntigravityProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ const decodeSecurityWarning = Schema.decodeUnknownOption(
* The agent marks "Allow Always" on shell and web tools with a prompt injection
* warning in `_meta`. Surface it as option text so both clients can show it.
*/
export function antigravitySecurityWarning(
option: EffectAcpSchema.PermissionOption,
): string | undefined {
function antigravitySecurityWarning(option: EffectAcpSchema.PermissionOption): string | undefined {
const meta = option._meta;
if (!Predicate.isObject(meta)) return undefined;
const warning = Option.getOrUndefined(decodeSecurityWarning(meta[SECURITY_WARNING_META_KEY]));
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/provider/antigravityRelease.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const ANTIGRAVITY_RELEASE_VERSION = "agy_acp_server_1.1.1";
const ANTIGRAVITY_RELEASE_VERSION = "agy_acp_server_1.1.1";

export interface AntigravityReleaseAsset {
readonly version: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/provider/opencodeRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,9 @@ export function openCodeQuestionId(
* puts in the prompt.
*/
const OPENCODE_NATIVE_IMAGE_MIMES = new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]);
export const OPENCODE_NATIVE_FILE_PART_MAX_BYTES = 20 * 1024 * 1024;
const OPENCODE_NATIVE_FILE_PART_MAX_BYTES = 20 * 1024 * 1024;

export function isOpenCodeNativeFilePart(input: {
function isOpenCodeNativeFilePart(input: {
readonly mimeType: string;
readonly sizeBytes: number;
}): boolean {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/provider/providerMaintenance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const PROVIDER_UPDATE_ACTION_TOAST_MESSAGE = "Install the update now or review p
* move on their own, so this mostly bounds how stale a Homebrew "latest" can
* get; the npm registry check keeps its own cache.
*/
export const MAINTENANCE_CAPABILITIES_CACHE_TTL = Duration.hours(1);
const MAINTENANCE_CAPABILITIES_CACHE_TTL = Duration.hours(1);

const compactEnv = (input: Record<string, Option.Option<string>>): NodeJS.ProcessEnv =>
Object.fromEntries(
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/provider/providerMaintenanceRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ function makeUpdateState(input: {
};
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.fn("ProviderMaintenanceRunner.make")(function* () {
const providerRegistry = yield* ProviderRegistry;
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
Expand Down
36 changes: 0 additions & 36 deletions apps/server/src/provider/providerSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,42 +105,6 @@ export const spawnAndCollect = (binaryPath: string, command: ChildProcess.Comman
return result;
}).pipe(Effect.scoped);

export function detailFromResult(
result: CommandResult & { readonly timedOut?: boolean },
): string | undefined {
if (result.timedOut) return "Timed out while running command.";
const stderr = nonEmptyTrimmed(result.stderr);
if (stderr) return stderr;
const stdout = nonEmptyTrimmed(result.stdout);
if (stdout) return stdout;
if (result.code !== 0) {
return `Command exited with code ${result.code}.`;
}
return undefined;
}

export function extractAuthBoolean(value: unknown): boolean | undefined {
if (globalThis.Array.isArray(value)) {
for (const entry of value) {
const nested = extractAuthBoolean(entry);
if (nested !== undefined) return nested;
}
return undefined;
}

if (!value || typeof value !== "object") return undefined;

const record = value as Record<string, unknown>;
for (const key of ["authenticated", "isAuthenticated", "loggedIn", "isLoggedIn"] as const) {
if (typeof record[key] === "boolean") return record[key];
}
for (const key of ["auth", "status", "session", "account"] as const) {
const nested = extractAuthBoolean(record[key]);
if (nested !== undefined) return nested;
}
return undefined;
}

export function parseGenericCliVersion(output: string): string | null {
const match = output.match(/\b(\d+\.\d+\.\d+)\b/);
return match?.[1] ?? null;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/provider/providerUpdateSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ProviderSnapshotSettings<Settings> {
readonly enableProviderUpdateChecks: boolean;
}

export function makeProviderSnapshotSettings<Settings>(
function makeProviderSnapshotSettings<Settings>(
provider: Settings,
settings: ServerSettings,
): ProviderSnapshotSettings<Settings> {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/provider/testUtils/providerRegistryMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as Layer from "effect/Layer";
import * as Stream from "effect/Stream";
import { makeManualOnlyProviderMaintenanceCapabilities } from "../providerMaintenance.ts";

export const makeProviderRegistryMock = (
const makeProviderRegistryMock = (
providers: ReadonlyArray<ServerProvider> = [],
): ProviderRegistryShape => ({
getProviders: Effect.succeed(providers),
Expand Down
Loading