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
3 changes: 0 additions & 3 deletions apps/coder-gateway/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,13 @@ import {
type CoderInvocation,
} from "@t3tools/coder-cli/command";
import {
CoderHelperConnectionError,
CoderHelperInstallRequiredError,
connectCoderHelper,
type CoderHelperConnection,
type CoderHelperExit,
} from "@t3tools/coder-cli/helperConnection";
import {
connectCoderPortForward,
type CoderPortForwardConnection,
type CoderPortForwardExit,
} from "@t3tools/coder-cli/portForward";
import {
hashCoderHelperBundle,
Expand Down
1 change: 0 additions & 1 deletion apps/server/src/git/GitManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
import * as Context from "effect/Context";
import * as Deferred from "effect/Deferred";
import * as Exit from "effect/Exit";
import * as Fiber from "effect/Fiber";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
Expand Down
78 changes: 0 additions & 78 deletions apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @effect-diagnostics nodeBuiltinImport:off -- workflow fixtures use files and the fake Claude CLI uses Node streams
import { OrchestrationV2UserInputQuestion } from "@t3tools/contracts";
import * as NodeFS from "node:fs";
import * as NodePath from "node:path";

Expand Down Expand Up @@ -32,7 +31,6 @@ import {
type OrchestrationV2ProviderThread,
ProjectId,
ProviderInstanceId,
type ProviderInstanceEnvironment,
ProviderDriverKind,
type ProviderReplayTranscript,
type ProviderApprovalDecision,
Expand Down Expand Up @@ -65,7 +63,6 @@ import { getModelSelectionStringOptionValue } from "@t3tools/shared/model";

import { attachmentRelativePath } from "../../attachmentStore.ts";
import { WorkflowAgentTranscriptReadObserver } from "../workflowAgentTranscript.ts";
import * as ServerConfig from "../../config.ts";
import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderSessions";
import * as ProviderEventLoggers from "@t3tools/provider-core/server/ProviderEventLoggers";
Expand All @@ -86,12 +83,6 @@ import {
projectionFor,
} from "../testkit/fixtures/shared.ts";

// Coder: the Agent SDK is type-only, so the adapter reads Claude's settings files itself and
// these tests write those files instead of mocking the SDK's `resolveSettings`.
const decodeUserInputQuestions = Schema.decodeUnknownSync(
Schema.Array(OrchestrationV2UserInputQuestion),
);

const DEFAULT_CLAUDE_SETTINGS = Schema.decodeSync(ClaudeSettings)({});
const AUTO_COMPACT_CLAUDE_SETTINGS = Schema.decodeSync(ClaudeSettings)({
autoCompactWindow: "300000",
Expand Down Expand Up @@ -900,75 +891,6 @@ describe("ClaudeAdapterV2 approval cancellation", () => {
);
});

const captureSdkExecutablePaths = Effect.fn("captureSdkExecutablePaths")(function* (
binaryPath: string,
environment: ProviderInstanceEnvironment = [],
) {
const executablePaths: Array<string | undefined> = [];
const taskToolEnvironment: Array<string | undefined> = [];
const adapter = yield* ClaudeAdapterV2.createClaudeAdapterV2(
{
instanceId: ClaudeAdapterV2.CLAUDE_DEFAULT_INSTANCE_ID,
displayName: undefined,
environment,
enabled: true,
config: { ...DEFAULT_CLAUDE_SETTINGS, binaryPath },
},
{},
).pipe(
Effect.provide(
ServerConfig.layerTest(process.cwd(), {
prefix: "t3-claude-binary-path-",
}),
),
Effect.provideService(ClaudeAdapterV2.ClaudeAgentSdkQueryRunner, {
allocateSessionId: Effect.succeed("native-thread-claude-binary-path"),
open: (input) =>
Effect.sync(() => {
executablePaths.push(input.options.pathToClaudeCodeExecutable);
taskToolEnvironment.push(input.options.env?.CLAUDE_CODE_ENABLE_TODO_TOOLS);
return {
messages: Stream.never,
offer: () => Effect.void,
setModel: () => Effect.void,
applyFlagSettings: () => Effect.void,
setPermissionMode: () => Effect.void,
backgroundTasks: () => Effect.succeed(false),
stopTask: () => Effect.void,
interrupt: Effect.void,
close: Effect.void,
};
}),
forkSession: () => Effect.die("unused"),
subagentLaunchToolUseId: () => Effect.succeed(null),
assertComplete: Effect.void,
}),
);
const threadId = ThreadId.make("thread-claude-binary-path");
const runtime = yield* adapter.openSession({
threadId,
providerSessionId: ProviderSessionId.make("provider-session-claude-binary-path"),
modelSelection: CLAUDE_TEST_MODEL_SELECTION,
runtimePolicy: CLAUDE_TEST_RUNTIME_POLICY,
});
const providerThread = yield* runtime.ensureThread({
threadId,
modelSelection: CLAUDE_TEST_MODEL_SELECTION,
runtimePolicy: CLAUDE_TEST_RUNTIME_POLICY,
});
yield* runtime.startTurn(
makeClaudeTestTurnInput({
threadId,
providerThread,
now: yield* DateTime.now,
attemptId: RunAttemptId.make("attempt-claude-binary-path"),
text: "hello",
attachments: [],
}),
);
return { executablePaths, taskToolEnvironment };
});

describe("ClaudeAdapterV2 resumeThread", () => {
it.effect("fails for a transcript without messages so a fresh session replaces it", () =>
Effect.scoped(
Expand Down
59 changes: 0 additions & 59 deletions apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ import * as Ref from "effect/Ref";
import * as Schema from "effect/Schema";
import * as Semaphore from "effect/Semaphore";
import * as Stream from "effect/Stream";
import * as ChildProcess from "effect/process/ChildProcess";
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";

import {
Expand All @@ -130,7 +129,6 @@ import {
} from "../../claudeModelOptions.ts";
import * as ServerConfig from "../../config.ts";
import { expandHomePath } from "@t3tools/provider-core/server/pathExpansion";
import { spawnAndCollect } from "@t3tools/provider-core/server/snapshotProbe";
import { signalProcessGroup } from "@t3tools/provider-core/server/processGroup";
import {
claudeSignedOutMessage,
Expand Down Expand Up @@ -809,61 +807,6 @@ function makeClaudeAgentSdkProtocolLogger(input: {
};
}

const encodeClaudeHistoryOptions = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
const decodeClaudeHistoryFork = Schema.decodeUnknownEffect(
Schema.fromJsonString(
Schema.Struct({ sessionId: Schema.String, headMessageId: Schema.optionalKey(Schema.String) }),
),
);

const claudeConfigDirOf = (
path: Path.Path,
environment: NodeJS.ProcessEnv,
homeDirectory: string,
) => path.resolve(environment.CLAUDE_CONFIG_DIR ?? path.join(homeDirectory, ".claude"));

// The SDK reads CLAUDE_CONFIG_DIR from process.env. Isolate custom homes in a
// worker so concurrent providers keep the server's environment.
const forkClaudeSessionInWorker = Effect.fn("forkClaudeSessionInWorker")(function* (
input: ClaudeAgentSdkSessionForkInput,
) {
const path = yield* Path.Path;
const fromSource = import.meta.url.endsWith(".ts");
// A single executable hosts the worker itself; it has no sibling script.
const workerArguments = (yield* HostProcess.IsExecutable)
? ["__claude-history"]
: [
...(fromSource ? ["--experimental-strip-types"] : []),
yield* path.fromFileUrl(
new URL(
fromSource ? "../../claude-history-worker.ts" : "./claude-history-worker.mjs",
import.meta.url,
),
),
];
const executablePath = yield* HostProcess.ExecutablePath;
const result = yield* spawnAndCollect(
executablePath,
ChildProcess.make(
executablePath,
[
...workerArguments,
"forkSession",
input.sessionId,
encodeClaudeHistoryOptions(input.options),
],
{ env: { ...input.environment, ELECTRON_RUN_AS_NODE: "1" } },
),
).pipe(Effect.timeout("30 seconds"));
if (result.code !== 0) {
return yield* new ClaudeAgentSdkQueryRunnerError({
method: "forkSession",
cause: result.stderr.trim() || `Claude history worker exited with code ${result.code}.`,
});
}
return yield* decodeClaudeHistoryFork(result.stdout);
});

export const layerQueryRunner: Layer.Layer<
ClaudeAgentSdkQueryRunner,
never,
Expand All @@ -875,8 +818,6 @@ export const layerQueryRunner: Layer.Layer<
ClaudeAgentSdkQueryRunner,
Effect.gen(function* () {
const crypto = yield* Crypto.Crypto;
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
const path = yield* Path.Path;
const { native: nativeEventLogger } = yield* ProviderEventLoggers.ProviderEventLoggers;
const agentScope = yield* AgentScope;
const platform = yield* HostProcess.Platform;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
import {
ProviderDriverKind,
Expand Down
25 changes: 0 additions & 25 deletions apps/server/src/orchestration-v2/RunExecutionService.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
import {
CheckpointScopeId,
Expand Down Expand Up @@ -26,7 +25,6 @@ import {
ServerSettingsError,
ThreadId,
TurnItemId,
EnvironmentId,
} from "@t3tools/contracts";
import * as Cause from "effect/Cause";
import * as Exit from "effect/Exit";
Expand All @@ -38,10 +36,6 @@ import * as Option from "effect/Option";
import * as Ref from "effect/Ref";
import * as Stream from "effect/Stream";

import * as CoderEnvironment from "../coderEnvironment.ts";
import * as T3ToolDispatch from "../mcp/bridge/T3ToolDispatch.ts";

import * as McpSessionRegistry from "../mcp/McpSessionRegistry.ts";
import * as ServerSettings from "../serverSettings.ts";
import * as CheckpointService from "./CheckpointService.ts";
import type { PendingOrchestrationEffectV2 } from "./EffectOutbox.ts";
Expand Down Expand Up @@ -1095,25 +1089,6 @@ it.effect(
}).pipe(Effect.provide(layerRunExecutionTest)),
);

const layerMcpSessionRegistryTest = McpSessionRegistry.layer.pipe(
Layer.provide(
Layer.mergeAll(
NodeServices.layer,
// Coder: the registry reads the Coder environment and the T3 tool dispatch, not an HTTP
// server and upstream's ServerEnvironment.
Layer.succeed(
CoderEnvironment.CoderEnvironment,
CoderEnvironment.CoderEnvironment.of({
descriptor: {
environmentId: EnvironmentId.make("environment:mcp-liveness"),
} as CoderEnvironment.CoderEnvironment["Service"]["descriptor"],
}),
),
T3ToolDispatch.layer,
),
),
);

it.effect("starts the provider when checkpoint baseline capture fails", () =>
Effect.gen(function* () {
const threadId = ThreadId.make("thread:run-execution-baseline-failure");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import {
runOrchestratorV2ProviderReplayScenario,
} from "./ProviderReplayHarness.ts";
import { checkpointWorkspace } from "@t3tools/provider-testing/replayWorkspace";
import { materializeReplayTranscriptRuntimeInstructions } from "./ReplayRuntimeInstructions.ts";
import {
materializeReplayTranscriptWorkspace,
readProviderReplayTranscript,
Expand Down
4 changes: 0 additions & 4 deletions apps/server/src/provider/AcpRegistryProbe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import * as TestClock from "effect/testing/TestClock";
import * as Fiber from "effect/Fiber";
import * as Deferred from "effect/Deferred";
import * as NodePath from "node:path";
import * as NodeURL from "node:url";

import * as NodeServices from "@effect/platform-node/NodeServices";
import { ProviderInstanceId } from "@t3tools/contracts";
Expand All @@ -24,8 +22,6 @@ import {
import * as AcpRegistrySupport from "@t3tools/provider-acp-registry/server/AcpRegistrySupport";

const instanceId = ProviderInstanceId.make("acpRegistry_codex");
const __dirname = NodePath.dirname(NodeURL.fileURLToPath(import.meta.url));
const mockAgentPath = NodePath.join(__dirname, "../../scripts/acp-mock-agent.ts");
const decodeSettings = Schema.decodeSync(AcpRegistrySettings);

describe("ACP Registry probe", () => {
Expand Down
4 changes: 0 additions & 4 deletions apps/server/src/provider/CodexRuntimeModes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ export const CODEX_RUNTIME_MODE_CONFIG = {
},
} as const satisfies Readonly<Record<RuntimeMode, CodexRuntimeModeConfig>>;

function getCodexRuntimeModeConfig(runtimeMode: RuntimeMode): CodexRuntimeModeConfig {
return CODEX_RUNTIME_MODE_CONFIG[runtimeMode];
}

export function resolveCodexSupportedRuntimeModes(
response: CodexRuntimeRequirementsResponse | undefined,
): ReadonlyArray<RuntimeMode> {
Expand Down
4 changes: 0 additions & 4 deletions apps/server/src/provider/ProviderAuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ import {
type ProviderAuthStartInput,
type ProviderAuthState,
type ProviderInstanceId,
type ProviderSessionId,
} from "@t3tools/contracts";
import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as Function from "effect/Function";
import * as Layer from "effect/Layer";
import * as Stream from "effect/Stream";

import type { ProviderAuthController } from "@t3tools/provider-core/server/auth";

export type { ProviderAuthController } from "@t3tools/provider-core/server/auth";

interface ProviderAuthTarget {
Expand Down
3 changes: 0 additions & 3 deletions apps/server/src/provider/ProviderInstanceRegistry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import * as ProviderLatestVersions from "@t3tools/provider-core/server/ProviderLatestVersions";
import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderSessions";
import * as HostProcess from "@t3tools/shared/HostProcess";
import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
Expand Down Expand Up @@ -45,8 +44,6 @@ const layerTestHttpClient = Layer.succeed(
// The mock CLIs from makeTildeProviderFixtures are scripts Windows cannot execute.
const windowsHost = HostProcess.Platform.defaultValue() === "win32";

const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");

const layerBackgroundPolicyAlwaysRun = Layer.mock(BackgroundPolicy.BackgroundPolicy)({
shouldRunScopeWork: () => Effect.succeed(true),
});
Expand Down
2 changes: 0 additions & 2 deletions apps/server/src/provider/ProviderRegistry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { vi } from "vite-plus/test";
import * as ServerSecretStore from "../auth/ServerSecretStore.ts";
import * as NodeServices from "@effect/platform-node/NodeServices";
import { describe, it, assert, expect } from "@effect/vitest";
import * as DateTime from "effect/DateTime";
import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
import * as Exit from "effect/Exit";
Expand Down Expand Up @@ -84,7 +83,6 @@ const defaultCodexSettings: CodexSettings = Schema.decodeSync(CodexSettings)({})
process.env.T3CODE_CURSOR_ENABLED = "1";

const encoder = new TextEncoder();
const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
const withBundledCompatibility = (snapshot: ServerProvider) =>
applyProviderCompatibility(
snapshot,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SourceControlProviderKind } from "@t3tools/contracts";
import { PullRequestFilesViewedRepository } from "../persistence/PullRequestFilesViewed.ts";
import * as PullRequestReadCache from "./PullRequestReadCache.ts";
import { assert, expect, it, vi } from "@effect/vitest";
import { expect, it, vi } from "@effect/vitest";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
import * as Layer from "effect/Layer";
Expand Down
1 change: 0 additions & 1 deletion apps/server/src/pullRequest/PullRequestService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import type {
PullRequestReviewCapabilities,
PullRequestReviewerCapabilities,
} from "@t3tools/contracts";
import { PullRequestOperationError } from "@t3tools/contracts";

import * as ProjectService from "../project/ProjectService.ts";
import * as RepositoryIdentityResolver from "../project/RepositoryIdentityResolver.ts";
Expand Down
2 changes: 0 additions & 2 deletions apps/server/src/scheduledTasks/ScheduledTaskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import * as Data from "effect/Data";
import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
import * as Exit from "effect/Exit";
import * as Duration from "effect/Duration";
import * as Metric from "effect/Metric";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as PubSub from "effect/PubSub";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import { ChildProcessSpawner } from "effect/process";

import * as ServerSettings from "../serverSettings.ts";
import * as ServerConfig from "../config.ts";
import * as VcsProcess from "../vcs/VcsProcess.ts";
import * as SourceControlDiscovery from "./SourceControlDiscovery.ts";
Expand Down
Loading