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
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function rawDataBytes(data: NodeSocket.NodeWS.RawData): number {
return data.byteLength;
}

export function makeWebSocketTransferRecorder(): WebSocketTransferRecorder {
function makeWebSocketTransferRecorder(): WebSocketTransferRecorder {
let socket: NodeWebSocketWithTransport | null = null;
// Held separately from the WebSocket so wire totals survive a close, which
// is when a reconnect measurement reads them.
Expand Down Expand Up @@ -176,7 +176,7 @@ export function transferDelta(
};
}

export function countingWsRpcProtocolLayer(input: {
function countingWsRpcProtocolLayer(input: {
readonly url: string;
readonly cookie: string;
readonly recorder: WebSocketTransferRecorder;
Expand All @@ -194,7 +194,7 @@ export function countingWsRpcProtocolLayer(input: {
);
}

export const makeCountingWsRpcClient = RpcClient.make(WsRpcGroup);
const makeCountingWsRpcClient = RpcClient.make(WsRpcGroup);
export type CountingWsRpcClient = Effect.Success<typeof makeCountingWsRpcClient>;

export interface MeasuredWsClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const TRANSFER_BUDGET = {
measuredTurnWebSocketMessages: 21,
} satisfies ProviderTransferBudget;

export const TRANSFER_BUDGETS: Readonly<Record<string, ProviderTransferBudget>> = {
const TRANSFER_BUDGETS: Readonly<Record<string, ProviderTransferBudget>> = {
codex: TRANSFER_BUDGET,
claudeAgent: TRANSFER_BUDGET,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
TRANSFER_HISTORY_TURN_COUNT,
} from "./fixtures/transferBudget.ts";

export const TRANSFER_PROJECT_ID = ProjectId.make("transfer-budget-project");
const TRANSFER_PROJECT_ID = ProjectId.make("transfer-budget-project");
export const TRANSFER_THREAD_ID = ThreadId.make("transfer-budget-thread");
export const TRANSFER_MEASURED_TURN_INDEX = TRANSFER_HISTORY_TURN_COUNT;

Expand Down
1 change: 1 addition & 0 deletions apps/server/src/diagnostics/ProcessDiagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function canSignalCategory(category: ResourceTelemetryProcessCategory): boolean
);
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.fn("makeProcessDiagnostics")(function* () {
const telemetry = yield* ResourceTelemetry.ResourceTelemetry;
const refreshedTelemetry = telemetry.refresh.pipe(Effect.catch(() => telemetry.latest));
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/diagnostics/ProcessResourceMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function isLegacyBackendCategory(category: ResourceTelemetryProcessCategory): bo
);
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.fn("makeProcessResourceMonitor")(function* () {
const telemetry = yield* ResourceTelemetry.ResourceTelemetry;
const readHistory: ProcessResourceMonitor["Service"]["readHistory"] = (input) =>
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/diagnostics/TraceDiagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ function readTraceFile(
);
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ export function requireDesktopTelemetryWriteProgress(
: Effect.fail(new DesktopTelemetryControlStalled({ fd, remainingBytes }));
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.fn("resourceTelemetry.desktopTelemetryReceiver.make")(function* () {
const config = yield* ServerConfig;
const serverSettings = yield* ServerSettingsService;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/resourceTelemetry/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export interface MergeProcessesResult {
readonly deltas: ReadonlyArray<ProcessDelta>;
}

export const emptyGroupCounters = (): GroupCounters => ({
const emptyGroupCounters = (): GroupCounters => ({
cpuTimeMs: 0,
ioReadBytes: 0,
ioWriteBytes: 0,
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/resourceTelemetry/NativeTelemetryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export function canCommandNativeTelemetrySidecar(
return hasHandle && (status === "healthy" || status === "degraded");
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.fn("resourceTelemetry.nativeTelemetryClient.make")(function* () {
const binary = yield* ResourceMonitorBinary.ResourceMonitorBinary;
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/resourceTelemetry/ResourceMonitorBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const ResourceMonitorHostLinuxLibc = Context.Reference<ResourceMonitorLin
},
);

export function resourceMonitorPlatformKey(
function resourceMonitorPlatformKey(
platform: NodeJS.Platform,
architecture: NodeJS.Architecture,
): string | undefined {
Expand All @@ -103,7 +103,7 @@ export function resourceMonitorPlatformKey(
return `${platform}-${architecture}`;
}

export function resourceMonitorRustTarget(
function resourceMonitorRustTarget(
platform: NodeJS.Platform,
architecture: NodeJS.Architecture,
linuxLibc?: ResourceMonitorLinuxLibc,
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/resourceTelemetry/ResourceTelemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function buildHealth(input: {
};
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.fn("resourceTelemetry.resourceTelemetry.make")(function* () {
const nativeClient = yield* NativeTelemetryClient.NativeTelemetryClient;
const desktopReceiver = yield* DesktopTelemetryReceiver.DesktopTelemetryReceiver;
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/telemetry/AnalyticsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class AnalyticsService extends Context.Service<
);
}

export function serverOsFromNodePlatform(platform: string): ClientOs {
function serverOsFromNodePlatform(platform: string): ClientOs {
switch (platform) {
case "darwin":
return "macOS";
Expand All @@ -82,6 +82,7 @@ export function serverOsFromNodePlatform(platform: string): ClientOs {
}
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const telemetryConfig = yield* TelemetryEnvConfig;
const httpClient = yield* HttpClient.HttpClient;
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/usage/UsageLimitSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function sourceLabel(id: string, config: UsageLimitSourceConfig): string {
}
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const api = yield* makeCliproxyApi;
const settingsService = yield* ServerSettingsService;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/usage/usageAggregation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { cacheSavingsUsd, priceUsage, type RateTable } from "./usagePricing.ts";
* `en-CA` yields ISO-ordered parts, which is why it is used here rather than
* assembling the day from `Date` getters (those are host-local only).
*/
export function makeDayFormatter(timeZone: string): (timestampMs: number) => string {
function makeDayFormatter(timeZone: string): (timestampMs: number) => string {
let format: Intl.DateTimeFormat;
try {
format = new Intl.DateTimeFormat("en-CA", {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/usage/usageScanCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type { CodexScanState, UsageRecord } from "./usageTranscripts.ts";
// entries would keep serving double-counted records forever.
// v3: entries carry the parse position and reducer state so a grown file
// re-parses only its appended bytes instead of starting over.
export const USAGE_SCAN_CACHE_VERSION = 3 as const;
const USAGE_SCAN_CACHE_VERSION = 3 as const;

export interface CachedFile {
readonly size: number;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/usage/usageTranscripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function mightCarryUsage(line: string, provider: UsageProviderKind): bool
*/
export const GROK_COST_USD_TICKS_PER_DOLLAR = 10_000_000_000;

export function grokCostTicksToUsd(ticks: unknown): number | null {
function grokCostTicksToUsd(ticks: unknown): number | null {
if (typeof ticks !== "number" || !Number.isFinite(ticks) || ticks < 0) return null;
return ticks / GROK_COST_USD_TICKS_PER_DOLLAR;
}
Expand Down
Loading