The best way to control Claude Code, Codex and more from any computer or phone
refactor(provider-acp): move the shared ACP adapter into its own package (#17354)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 8, 2026 at 18:30 UTC
664bd5e524bb58b23ecab0f2e413fc2ecb4caf55
70 files changed
+673
-553
apps/server/package.json
+1
@@ -38,6 +38,7 @@
38
"@napi-rs/keyring": "^1.3.0",
39
"@noble/hashes": "catalog:",
40
"@opencode-ai/sdk": "^1.3.15",
41
+ "@t3tools/provider-acp": "workspace:*",
42
"@t3tools/provider-core": "workspace:*",
43
"@t3tools/provider-cursor": "workspace:*",
44
"@t3tools/provider-muse": "workspace:*",
apps/server/scripts/record-grok-acp-replay-fixture.ts
+5
-8
@@ -24,14 +24,15 @@ import * as Schema from "effect/Schema";
24
import { ChildProcessSpawner } from "effect/process";
25
import type * as EffectAcpProtocol from "effect-acp/protocol";
26
27
-import * as ServerConfig from "../src/config.ts";
27
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
28
+import { layerTestProviderHost } from "@t3tools/provider-testing/host";
29
import {
30
GROK_DEFAULT_INSTANCE_ID,
31
GROK_PROVIDER,
32
grokLaunchRuntimeMode,
33
makeGrokAdapterV2,
34
} from "../src/orchestration-v2/Adapters/GrokAdapterV2.ts";
34
-import { ACP_PROTOCOL } from "../src/orchestration-v2/Adapters/AcpAdapterV2.ts";
35
+import { ACP_PROTOCOL } from "@t3tools/provider-acp/server/adapter";
36
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
37
import type { ProviderAdapterV2SessionRuntime } from "@t3tools/provider-core/server/ProviderAdapter";
38
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
@@ -40,7 +41,6 @@ import { provideDeterministicTestRuntime } from "../src/orchestration-v2/testkit
41
import { ORCHESTRATOR_REPLAY_FIXTURES } from "../src/orchestration-v2/testkit/fixtures/index.ts";
42
import { materializeFixtureInput } from "../src/orchestration-v2/testkit/fixtures/shared.ts";
43
import { runOrchestratorV2Scenario } from "../src/orchestration-v2/testkit/OrchestratorScenario.ts";
43
-import { makeReplayServerConfig } from "../src/orchestration-v2/testkit/ProviderReplayHarness.ts";
44
import * as ProviderReplayHarness from "../src/orchestration-v2/testkit/ProviderReplayHarness.ts";
45
import { checkpointWorkspace } from "@t3tools/provider-testing/replayWorkspace";
46
import { makeGrokAcpRuntime } from "../src/provider/acp/GrokAcpSupport.ts";
@@ -455,7 +455,7 @@ const recordScenario = Effect.fn("recordGrokScenario")(function* (fixtureName: s
455
crypto: yield* Crypto.Crypto,
456
fileSystem: yield* FileSystem.FileSystem,
457
idAllocator: yield* IdAllocator.IdAllocatorV2,
458
- serverConfig: yield* ServerConfig.ServerConfig,
458
+ host: yield* ProviderHost.ProviderHost,
459
selfInvocation: yield* resolveSelfInvocation(),
460
continuationRequests: yield* ProviderContinuationRequests.ProviderContinuationRequests,
461
// Production's runtime factory, with the protocol logger teeing raw lines.
@@ -496,10 +496,7 @@ const recordScenario = Effect.fn("recordGrokScenario")(function* (fixtureName: s
496
).pipe(
497
Layer.provide(
498
Layer.mergeAll(
499
- Layer.effect(
500
- ServerConfig.ServerConfig,
501
- makeReplayServerConfig(`grok-record-${fixtureName}`),
502
- ).pipe(Layer.provide(NodeServices.layer)),
499
+ layerTestProviderHost().pipe(Layer.provide(NodeServices.layer)),
500
NodeServices.layer,
501
IdAllocator.layer,
502
),
apps/server/src/mcp/AcpMcpStdioBridge.ts
+3
-54
@@ -7,6 +7,7 @@ import * as Cause from "effect/Cause";
7
import * as Effect from "effect/Effect";
8
import * as Fiber from "effect/Fiber";
9
import * as Stream from "effect/Stream";
10
+import { discardResponseBody, responsePayloads } from "@t3tools/shared/mcpResponsePayloads";
11
12
/**
13
* Stdio-to-HTTP bridge for T3's MCP endpoint.
@@ -63,58 +64,6 @@ function protocolVersionOf(entry: unknown): string | null {
64
return typeof version === "string" && version.length > 0 ? version : null;
65
}
66
66
-async function* sseDataLines(response: Response): AsyncGenerator<string> {
67
- if (response.body === null) return;
68
- const decoder = new TextDecoder();
69
- let buffered = "";
70
- for await (const chunk of response.body) {
71
- buffered += decoder.decode(chunk as Uint8Array, { stream: true });
72
- let separatorIndex = buffered.search(/\n\n|\r\n\r\n/u);
73
- while (separatorIndex !== -1) {
74
- const rawEvent = buffered.slice(0, separatorIndex);
75
- buffered = buffered.slice(separatorIndex).replace(/^(?:\r?\n){2}/u, "");
76
- const data = rawEvent
77
- .split(/\r?\n/u)
78
- .filter((line) => line.startsWith("data:"))
79
- .map((line) => line.slice("data:".length).trimStart())
80
- .join("\n");
81
- if (data.length > 0) yield data;
82
- separatorIndex = buffered.search(/\n\n|\r\n\r\n/u);
83
- }
84
- }
85
-}
86
-
87
-const discardResponseBody = (response: Response): Effect.Effect<void> =>
88
- Effect.promise(() => response.body?.cancel().catch(() => undefined) ?? Promise.resolve());
89
-
90
-/**
91
- * Every JSON-RPC payload carried by a response, in arrival order: nothing for
92
- * notification acknowledgements, each SSE `data:` event as it streams in, or
93
- * the single JSON body.
94
- */
95
-export function responsePayloads(response: Response): Stream.Stream<unknown, AcpMcpBridgeError> {
96
- if (response.status === 202 || response.status === 204) {
97
- return Stream.unwrap(discardResponseBody(response).pipe(Effect.as(Stream.empty)));
98
- }
99
- const contentType = response.headers.get("content-type") ?? "";
100
- if (contentType.includes("text/event-stream")) {
101
- return Stream.fromAsyncIterable(sseDataLines(response), bridgeError).pipe(
102
- Stream.mapEffect((data) => Effect.try({ try: () => JSON.parse(data), catch: bridgeError })),
103
- );
104
- }
105
- return Stream.unwrap(
106
- Effect.tryPromise({ try: () => response.text(), catch: bridgeError }).pipe(
107
- Effect.flatMap((text) =>
108
- text.trim().length === 0
109
- ? Effect.succeed(Stream.empty)
110
- : Effect.try({ try: () => JSON.parse(text) as unknown, catch: bridgeError }).pipe(
111
- Effect.map((payload) => Stream.fromIterable([payload])),
112
- ),
113
- ),
114
- ),
115
- );
116
-}
117
-
67
export interface AcpMcpToolCallOptions {
68
readonly endpoint: string;
69
readonly authorization: string;
@@ -164,7 +113,7 @@ export function callAcpMcpTool(
113
new AcpMcpBridgeError(`T3 Code MCP endpoint responded with HTTP ${response.status}.`),
114
);
115
}
167
- const payloads = yield* Stream.runCollect(responsePayloads(response));
116
+ const payloads = yield* Stream.runCollect(responsePayloads(response, bridgeError));
117
for (const payload of payloads) {
118
protocolVersion = protocolVersionOf(payload) ?? protocolVersion;
119
}
@@ -271,7 +220,7 @@ export function runAcpMcpStdioBridge(options: AcpMcpStdioBridgeOptions): Effect.
220
}
221
return yield* discardResponseBody(response);
222
}
274
- yield* Stream.runForEach(responsePayloads(response), handleServerPayload);
223
+ yield* Stream.runForEach(responsePayloads(response, bridgeError), handleServerPayload);
224
}).pipe(
225
Effect.catchCause((cause) => {
226
if (envelope.id === undefined) return Effect.void;
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+175
-176
@@ -54,9 +54,10 @@ import * as EffectAcpErrors from "effect-acp/errors";
54
import type * as EffectAcpProtocol from "effect-acp/protocol";
55
import type * as EffectAcpSchema from "effect-acp/compat";
56
57
-import * as ServerConfig from "../../config.ts";
57
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
58
+import { layerTestProviderHost } from "@t3tools/provider-testing/host";
59
import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
59
-import * as AcpSessionRuntime from "../../provider/acp/AcpSessionRuntime.ts";
60
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
61
import {
62
extractXAiAcpSubagentEndNotice,
63
extractXAiAcpSubagentUpdate,
@@ -90,7 +91,7 @@ import {
91
type AcpAdapterV2Flavor,
92
type AcpAdapterV2RuntimeInput,
93
type AcpAdapterV2SubagentUpdate,
93
-} from "./AcpAdapterV2.ts";
94
+} from "@t3tools/provider-acp/server/adapter";
95
96
import { makeGrokAdapterV2 } from "./GrokAdapterV2.ts";
97
import {
@@ -100,11 +101,9 @@ import {
101
102
const DEFAULT_GROK_SETTINGS = Schema.decodeSync(GrokSettings)({});
103
103
-const layerServerConfig = ServerConfig.layerTest(process.cwd(), {
104
- prefix: "t3-acp-v2-adapter-",
105
-}).pipe(Layer.provide(NodeServices.layer));
104
+const layerHost = layerTestProviderHost().pipe(Layer.provide(NodeServices.layer));
105
107
-const layerTest = Layer.mergeAll(NodeServices.layer, IdAllocator.layer, layerServerConfig);
106
+const layerTest = Layer.mergeAll(NodeServices.layer, IdAllocator.layer, layerHost);
107
const ACP_TEST_DRIVER = ProviderDriverKind.make("acp-test");
108
const decodeUnknownJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
109
@@ -616,7 +615,7 @@ describe("AcpAdapterV2", () => {
615
instanceId,
616
fileSystem: yield* FileSystem.FileSystem,
617
idAllocator: yield* IdAllocator.IdAllocatorV2,
619
- serverConfig: yield* ServerConfig.ServerConfig,
618
+ host: yield* ProviderHost.ProviderHost,
619
selfInvocation: yield* resolveSelfInvocation(),
620
flavor: {
621
driver: ProviderDriverKind.make("acpRegistry"),
@@ -713,7 +712,7 @@ describe("AcpAdapterV2", () => {
712
const fileSystem = yield* FileSystem.FileSystem;
713
const idAllocator = yield* IdAllocator.IdAllocatorV2;
714
const path = yield* Path.Path;
716
- const serverConfig = yield* ServerConfig.ServerConfig;
715
+ const host = yield* ProviderHost.ProviderHost;
716
const selfInvocation = yield* resolveSelfInvocation().pipe(
717
Effect.provideService(HostProcessIsExecutable, true),
718
);
@@ -753,7 +752,7 @@ describe("AcpAdapterV2", () => {
752
},
753
fileSystem,
754
idAllocator,
756
- serverConfig,
755
+ host,
756
selfInvocation,
757
});
758
const runtimePolicy = ProviderAdapterV2RuntimePolicy.make({
@@ -786,7 +785,7 @@ describe("AcpAdapterV2", () => {
785
const fileSystem = yield* FileSystem.FileSystem;
786
const idAllocator = yield* IdAllocator.IdAllocatorV2;
787
const path = yield* Path.Path;
789
- const serverConfig = yield* ServerConfig.ServerConfig;
788
+ const host = yield* ProviderHost.ProviderHost;
789
const selfInvocation = yield* resolveSelfInvocation();
790
const mockAgentPath = yield* path.fromFileUrl(
791
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -816,7 +815,7 @@ describe("AcpAdapterV2", () => {
815
},
816
fileSystem,
817
idAllocator,
819
- serverConfig,
818
+ host,
819
selfInvocation,
820
});
821
const policy = (interactionMode: "default" | "plan") =>
@@ -913,7 +912,7 @@ describe("AcpAdapterV2", () => {
912
const fileSystem = yield* FileSystem.FileSystem;
913
const idAllocator = yield* IdAllocator.IdAllocatorV2;
914
const path = yield* Path.Path;
916
- const serverConfig = yield* ServerConfig.ServerConfig;
915
+ const host = yield* ProviderHost.ProviderHost;
916
const selfInvocation = yield* resolveSelfInvocation();
917
const mockAgentPath = yield* path.fromFileUrl(
918
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -941,7 +940,7 @@ describe("AcpAdapterV2", () => {
940
},
941
fileSystem,
942
idAllocator,
944
- serverConfig,
943
+ host,
944
selfInvocation,
945
});
946
const threadId = ThreadId.make("thread-acp-v2-plan-replay-boundary");
@@ -1049,7 +1048,7 @@ describe("AcpAdapterV2", () => {
1048
crypto: yield* Crypto.Crypto,
1049
fileSystem: yield* FileSystem.FileSystem,
1050
idAllocator: yield* IdAllocator.IdAllocatorV2,
1052
- serverConfig: yield* ServerConfig.ServerConfig,
1051
+ host: yield* ProviderHost.ProviderHost,
1052
selfInvocation: yield* resolveSelfInvocation(),
1053
flavor: {
1054
driver: ACP_TEST_DRIVER,
@@ -1195,7 +1194,7 @@ describe("AcpAdapterV2", () => {
1194
crypto: yield* Crypto.Crypto,
1195
fileSystem: yield* FileSystem.FileSystem,
1196
idAllocator,
1198
- serverConfig: yield* ServerConfig.ServerConfig,
1197
+ host: yield* ProviderHost.ProviderHost,
1198
selfInvocation: yield* resolveSelfInvocation(),
1199
flavor: {
1200
driver: ACP_TEST_DRIVER,
@@ -1515,7 +1514,7 @@ describe("AcpAdapterV2", () => {
1514
const fileSystem = yield* FileSystem.FileSystem;
1515
const idAllocator = yield* IdAllocator.IdAllocatorV2;
1516
const path = yield* Path.Path;
1518
- const serverConfig = yield* ServerConfig.ServerConfig;
1517
+ const host = yield* ProviderHost.ProviderHost;
1518
const selfInvocation = yield* resolveSelfInvocation();
1519
const mockAgentPath = yield* path.fromFileUrl(
1520
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -1544,7 +1543,7 @@ describe("AcpAdapterV2", () => {
1543
},
1544
fileSystem,
1545
idAllocator,
1547
- serverConfig,
1546
+ host,
1547
selfInvocation,
1548
});
1549
const threadId = ThreadId.make("thread-acp-v2-fidelity");
@@ -1709,7 +1708,7 @@ describe("AcpAdapterV2", () => {
1708
const fileSystem = yield* FileSystem.FileSystem;
1709
const idAllocator = yield* IdAllocator.IdAllocatorV2;
1710
const path = yield* Path.Path;
1712
- const serverConfig = yield* ServerConfig.ServerConfig;
1711
+ const host = yield* ProviderHost.ProviderHost;
1712
const selfInvocation = yield* resolveSelfInvocation();
1713
const mockAgentPath = yield* path.fromFileUrl(
1714
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -1730,7 +1729,7 @@ describe("AcpAdapterV2", () => {
1729
},
1730
fileSystem,
1731
idAllocator,
1733
- serverConfig,
1732
+ host,
1733
selfInvocation,
1734
});
1735
const threadId = ThreadId.make("thread-acp-eager-resume");
@@ -1794,7 +1793,7 @@ describe("AcpAdapterV2", () => {
1793
const fileSystem = yield* FileSystem.FileSystem;
1794
const idAllocator = yield* IdAllocator.IdAllocatorV2;
1795
const path = yield* Path.Path;
1797
- const serverConfig = yield* ServerConfig.ServerConfig;
1796
+ const host = yield* ProviderHost.ProviderHost;
1797
const selfInvocation = yield* resolveSelfInvocation();
1798
const mockAgentPath = yield* path.fromFileUrl(
1799
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -1817,7 +1816,7 @@ describe("AcpAdapterV2", () => {
1816
},
1817
fileSystem,
1818
idAllocator,
1820
- serverConfig,
1819
+ host,
1820
selfInvocation,
1821
});
1822
const threadId = ThreadId.make("thread-acp-stale-eager-resume");
@@ -1940,7 +1939,7 @@ describe("AcpAdapterV2", () => {
1939
const fileSystem = yield* FileSystem.FileSystem;
1940
const idAllocator = yield* IdAllocator.IdAllocatorV2;
1941
const path = yield* Path.Path;
1943
- const serverConfig = yield* ServerConfig.ServerConfig;
1942
+ const host = yield* ProviderHost.ProviderHost;
1943
const selfInvocation = yield* resolveSelfInvocation();
1944
const mockAgentPath = yield* path.fromFileUrl(
1945
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -1969,7 +1968,7 @@ describe("AcpAdapterV2", () => {
1968
},
1969
fileSystem,
1970
idAllocator,
1972
- serverConfig,
1971
+ host,
1972
selfInvocation,
1973
});
1974
const threadId = ThreadId.make("thread-acp-unexpected-termination");
@@ -2023,7 +2022,7 @@ describe("AcpAdapterV2", () => {
2022
const fileSystem = yield* FileSystem.FileSystem;
2023
const idAllocator = yield* IdAllocator.IdAllocatorV2;
2024
const path = yield* Path.Path;
2026
- const serverConfig = yield* ServerConfig.ServerConfig;
2025
+ const host = yield* ProviderHost.ProviderHost;
2026
const selfInvocation = yield* resolveSelfInvocation();
2027
const mockAgentPath = yield* path.fromFileUrl(
2028
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -2058,7 +2057,7 @@ describe("AcpAdapterV2", () => {
2057
},
2058
fileSystem,
2059
idAllocator,
2061
- serverConfig,
2060
+ host,
2061
selfInvocation,
2062
});
2063
const threadId = ThreadId.make("thread-acp-provider-exit-running-command");
@@ -2108,7 +2107,7 @@ describe("AcpAdapterV2", () => {
2107
const fileSystem = yield* FileSystem.FileSystem;
2108
const idAllocator = yield* IdAllocator.IdAllocatorV2;
2109
const path = yield* Path.Path;
2111
- const serverConfig = yield* ServerConfig.ServerConfig;
2110
+ const host = yield* ProviderHost.ProviderHost;
2111
const selfInvocation = yield* resolveSelfInvocation();
2112
const mockAgentPath = yield* path.fromFileUrl(
2113
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -2137,7 +2136,7 @@ describe("AcpAdapterV2", () => {
2136
},
2137
fileSystem,
2138
idAllocator,
2140
- serverConfig,
2139
+ host,
2140
selfInvocation,
2141
});
2142
const threadId = ThreadId.make("thread-acp-cgroup-unavailable");
@@ -2164,7 +2163,7 @@ describe("AcpAdapterV2", () => {
2163
const fileSystem = yield* FileSystem.FileSystem;
2164
const idAllocator = yield* IdAllocator.IdAllocatorV2;
2165
const path = yield* Path.Path;
2167
- const serverConfig = yield* ServerConfig.ServerConfig;
2166
+ const host = yield* ProviderHost.ProviderHost;
2167
const selfInvocation = yield* resolveSelfInvocation();
2168
const mockAgentPath = yield* path.fromFileUrl(
2169
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -2209,7 +2208,7 @@ describe("AcpAdapterV2", () => {
2208
},
2209
fileSystem,
2210
idAllocator,
2212
- serverConfig,
2211
+ host,
2212
selfInvocation,
2213
});
2214
const threadId = ThreadId.make("thread-acp-cgroup-join-failure");
@@ -2242,7 +2241,7 @@ describe("AcpAdapterV2", () => {
2241
const fileSystem = yield* FileSystem.FileSystem;
2242
const idAllocator = yield* IdAllocator.IdAllocatorV2;
2243
const path = yield* Path.Path;
2245
- const serverConfig = yield* ServerConfig.ServerConfig;
2244
+ const host = yield* ProviderHost.ProviderHost;
2245
const selfInvocation = yield* resolveSelfInvocation();
2246
const mockAgentPath = yield* path.fromFileUrl(
2247
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -2286,7 +2285,7 @@ describe("AcpAdapterV2", () => {
2285
},
2286
fileSystem,
2287
idAllocator,
2289
- serverConfig,
2288
+ host,
2289
selfInvocation,
2290
clientTerminals: { childProcessSpawner },
2291
});
@@ -2454,7 +2453,7 @@ describe("AcpAdapterV2", () => {
2453
const fileSystem = yield* FileSystem.FileSystem;
2454
const idAllocator = yield* IdAllocator.IdAllocatorV2;
2455
const path = yield* Path.Path;
2457
- const serverConfig = yield* ServerConfig.ServerConfig;
2456
+ const host = yield* ProviderHost.ProviderHost;
2457
const selfInvocation = yield* resolveSelfInvocation();
2458
const mockAgentPath = yield* path.fromFileUrl(
2459
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -2484,7 +2483,7 @@ describe("AcpAdapterV2", () => {
2483
},
2484
fileSystem,
2485
idAllocator,
2487
- serverConfig,
2486
+ host,
2487
selfInvocation,
2488
});
2489
const threadId = ThreadId.make("thread-acp-no-client-fs");
@@ -2551,7 +2550,7 @@ describe("AcpAdapterV2", () => {
2550
const fileSystem = yield* FileSystem.FileSystem;
2551
const idAllocator = yield* IdAllocator.IdAllocatorV2;
2552
const path = yield* Path.Path;
2554
- const serverConfig = yield* ServerConfig.ServerConfig;
2553
+ const host = yield* ProviderHost.ProviderHost;
2554
const selfInvocation = yield* resolveSelfInvocation();
2555
const mockAgentPath = yield* path.fromFileUrl(
2556
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -2591,7 +2590,7 @@ describe("AcpAdapterV2", () => {
2590
},
2591
fileSystem,
2592
idAllocator,
2594
- serverConfig,
2593
+ host,
2594
selfInvocation,
2595
clientTerminals: { childProcessSpawner },
2596
});
@@ -2688,7 +2687,7 @@ describe("AcpAdapterV2", () => {
2687
const fileSystem = yield* FileSystem.FileSystem;
2688
const idAllocator = yield* IdAllocator.IdAllocatorV2;
2689
const path = yield* Path.Path;
2691
- const serverConfig = yield* ServerConfig.ServerConfig;
2690
+ const host = yield* ProviderHost.ProviderHost;
2691
const selfInvocation = yield* resolveSelfInvocation();
2692
const mockAgentPath = yield* path.fromFileUrl(
2693
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -2704,7 +2703,7 @@ describe("AcpAdapterV2", () => {
2703
},
2704
fileSystem,
2705
idAllocator,
2707
- serverConfig,
2706
+ host,
2707
selfInvocation,
2708
});
2709
const threadId = ThreadId.make("thread-acp-missing-native-thread");
@@ -2750,7 +2749,7 @@ describe("AcpAdapterV2", () => {
2749
const fileSystem = yield* FileSystem.FileSystem;
2750
const idAllocator = yield* IdAllocator.IdAllocatorV2;
2751
const path = yield* Path.Path;
2753
- const serverConfig = yield* ServerConfig.ServerConfig;
2752
+ const host = yield* ProviderHost.ProviderHost;
2753
const selfInvocation = yield* resolveSelfInvocation();
2754
const mockAgentPath = yield* path.fromFileUrl(
2755
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -2788,7 +2787,7 @@ describe("AcpAdapterV2", () => {
2787
},
2788
fileSystem,
2789
idAllocator,
2791
- serverConfig,
2790
+ host,
2791
selfInvocation,
2792
});
2793
const threadId = ThreadId.make("thread-acp-rollback-session");
@@ -2917,7 +2916,7 @@ describe("AcpAdapterV2", () => {
2916
const fileSystem = yield* FileSystem.FileSystem;
2917
const idAllocator = yield* IdAllocator.IdAllocatorV2;
2918
const path = yield* Path.Path;
2920
- const serverConfig = yield* ServerConfig.ServerConfig;
2919
+ const host = yield* ProviderHost.ProviderHost;
2920
const selfInvocation = yield* resolveSelfInvocation();
2921
const mockAgentPath = yield* path.fromFileUrl(
2922
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3001,7 +3000,7 @@ describe("AcpAdapterV2", () => {
3000
},
3001
fileSystem,
3002
idAllocator,
3004
- serverConfig,
3003
+ host,
3004
selfInvocation,
3005
continuationRequests: { offer: () => Effect.void },
3006
});
@@ -3078,7 +3077,7 @@ describe("AcpAdapterV2", () => {
3077
const fileSystem = yield* FileSystem.FileSystem;
3078
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3079
const path = yield* Path.Path;
3081
- const serverConfig = yield* ServerConfig.ServerConfig;
3080
+ const host = yield* ProviderHost.ProviderHost;
3081
const selfInvocation = yield* resolveSelfInvocation();
3082
const mockAgentPath = yield* path.fromFileUrl(
3083
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3120,7 +3119,7 @@ describe("AcpAdapterV2", () => {
3119
},
3120
fileSystem,
3121
idAllocator,
3123
- serverConfig,
3122
+ host,
3123
selfInvocation,
3124
});
3125
const threadId = ThreadId.make("thread-acp-rollback-failure-compensation");
@@ -3194,7 +3193,7 @@ describe("AcpAdapterV2", () => {
3193
const fileSystem = yield* FileSystem.FileSystem;
3194
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3195
const path = yield* Path.Path;
3197
- const serverConfig = yield* ServerConfig.ServerConfig;
3196
+ const host = yield* ProviderHost.ProviderHost;
3197
const selfInvocation = yield* resolveSelfInvocation();
3198
const mockAgentPath = yield* path.fromFileUrl(
3199
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3211,7 +3210,7 @@ describe("AcpAdapterV2", () => {
3210
},
3211
fileSystem,
3212
idAllocator,
3214
- serverConfig,
3213
+ host,
3214
selfInvocation,
3215
});
3216
const threadId = ThreadId.make("thread-acp-idle-finalizer");
@@ -3245,7 +3244,7 @@ describe("AcpAdapterV2", () => {
3244
const fileSystem = yield* FileSystem.FileSystem;
3245
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3246
const path = yield* Path.Path;
3248
- const serverConfig = yield* ServerConfig.ServerConfig;
3247
+ const host = yield* ProviderHost.ProviderHost;
3248
const selfInvocation = yield* resolveSelfInvocation();
3249
const mockAgentPath = yield* path.fromFileUrl(
3250
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3261,7 +3260,7 @@ describe("AcpAdapterV2", () => {
3260
crypto: yield* Crypto.Crypto,
3261
fileSystem,
3262
idAllocator,
3264
- serverConfig,
3263
+ host,
3264
selfInvocation: yield* resolveSelfInvocation(),
3265
// Production Grok runtimes are wrapped by the x.ai prompt runtime.
3266
makeRuntime: (input) =>
@@ -3300,7 +3299,7 @@ describe("AcpAdapterV2", () => {
3299
const fileSystem = yield* FileSystem.FileSystem;
3300
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3301
const path = yield* Path.Path;
3303
- const serverConfig = yield* ServerConfig.ServerConfig;
3302
+ const host = yield* ProviderHost.ProviderHost;
3303
const selfInvocation = yield* resolveSelfInvocation();
3304
const mockAgentPath = yield* path.fromFileUrl(
3305
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3316,7 +3315,7 @@ describe("AcpAdapterV2", () => {
3315
crypto: yield* Crypto.Crypto,
3316
fileSystem,
3317
idAllocator,
3319
- serverConfig,
3318
+ host,
3319
selfInvocation: yield* resolveSelfInvocation(),
3320
// Production Grok runtimes are wrapped by the x.ai prompt runtime.
3321
makeRuntime: (input) =>
@@ -3381,7 +3380,7 @@ describe("AcpAdapterV2", () => {
3380
const fileSystem = yield* FileSystem.FileSystem;
3381
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3382
const path = yield* Path.Path;
3384
- const serverConfig = yield* ServerConfig.ServerConfig;
3383
+ const host = yield* ProviderHost.ProviderHost;
3384
const selfInvocation = yield* resolveSelfInvocation();
3385
const mockAgentPath = yield* path.fromFileUrl(
3386
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3397,7 +3396,7 @@ describe("AcpAdapterV2", () => {
3396
},
3397
fileSystem,
3398
idAllocator,
3400
- serverConfig,
3399
+ host,
3400
selfInvocation,
3401
});
3402
const threadId = ThreadId.make("thread-acp-unsupported-option");
@@ -3430,7 +3429,7 @@ describe("AcpAdapterV2", () => {
3429
const fileSystem = yield* FileSystem.FileSystem;
3430
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3431
const path = yield* Path.Path;
3433
- const serverConfig = yield* ServerConfig.ServerConfig;
3432
+ const host = yield* ProviderHost.ProviderHost;
3433
const selfInvocation = yield* resolveSelfInvocation();
3434
const mockAgentPath = yield* path.fromFileUrl(
3435
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3447,7 +3446,7 @@ describe("AcpAdapterV2", () => {
3446
},
3447
fileSystem,
3448
idAllocator,
3450
- serverConfig,
3449
+ host,
3450
selfInvocation,
3451
});
3452
const firstThreadId = ThreadId.make("thread-acp-active-setup:first");
@@ -3541,7 +3540,7 @@ describe("AcpAdapterV2", () => {
3540
const fileSystem = yield* FileSystem.FileSystem;
3541
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3542
const path = yield* Path.Path;
3544
- const serverConfig = yield* ServerConfig.ServerConfig;
3543
+ const host = yield* ProviderHost.ProviderHost;
3544
const selfInvocation = yield* resolveSelfInvocation();
3545
const mockAgentPath = yield* path.fromFileUrl(
3546
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3568,7 +3567,7 @@ describe("AcpAdapterV2", () => {
3567
},
3568
fileSystem,
3569
idAllocator,
3571
- serverConfig,
3570
+ host,
3571
selfInvocation,
3572
});
3573
const threadId = ThreadId.make("thread-acp-empty-successful-bash");
@@ -3688,7 +3687,7 @@ describe("AcpAdapterV2", () => {
3687
const fileSystem = yield* FileSystem.FileSystem;
3688
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3689
const path = yield* Path.Path;
3691
- const serverConfig = yield* ServerConfig.ServerConfig;
3690
+ const host = yield* ProviderHost.ProviderHost;
3691
const selfInvocation = yield* resolveSelfInvocation();
3692
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
3693
const native: { current?: AcpSessionRuntime.AcpSessionRuntime["Service"] } = {};
@@ -3715,7 +3714,7 @@ describe("AcpAdapterV2", () => {
3714
},
3715
fileSystem,
3716
idAllocator,
3718
- serverConfig,
3717
+ host,
3718
selfInvocation,
3719
});
3720
const threadId = ThreadId.make("thread-acp-native-cancel");
@@ -3802,7 +3801,7 @@ describe("AcpAdapterV2", () => {
3801
const fileSystem = yield* FileSystem.FileSystem;
3802
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3803
const path = yield* Path.Path;
3805
- const serverConfig = yield* ServerConfig.ServerConfig;
3804
+ const host = yield* ProviderHost.ProviderHost;
3805
const selfInvocation = yield* resolveSelfInvocation();
3806
const mockAgentPath = yield* path.fromFileUrl(
3807
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3824,7 +3823,7 @@ describe("AcpAdapterV2", () => {
3823
},
3824
fileSystem,
3825
idAllocator,
3827
- serverConfig,
3826
+ host,
3827
selfInvocation,
3828
});
3829
const threadId = ThreadId.make("thread-acp-cancel-permission");
@@ -3903,7 +3902,7 @@ describe("AcpAdapterV2", () => {
3902
const fileSystem = yield* FileSystem.FileSystem;
3903
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3904
const path = yield* Path.Path;
3906
- const serverConfig = yield* ServerConfig.ServerConfig;
3905
+ const host = yield* ProviderHost.ProviderHost;
3906
const selfInvocation = yield* resolveSelfInvocation();
3907
const mockAgentPath = yield* path.fromFileUrl(
3908
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -3930,7 +3929,7 @@ describe("AcpAdapterV2", () => {
3929
},
3930
fileSystem,
3931
idAllocator,
3933
- serverConfig,
3932
+ host,
3933
selfInvocation,
3934
});
3935
const threadId = ThreadId.make("thread-acp-response-wins-permission");
@@ -4002,7 +4001,7 @@ describe("AcpAdapterV2", () => {
4001
const fileSystem = yield* FileSystem.FileSystem;
4002
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4003
const path = yield* Path.Path;
4005
- const serverConfig = yield* ServerConfig.ServerConfig;
4004
+ const host = yield* ProviderHost.ProviderHost;
4005
const selfInvocation = yield* resolveSelfInvocation();
4006
const mockAgentPath = yield* path.fromFileUrl(
4007
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4029,7 +4028,7 @@ describe("AcpAdapterV2", () => {
4028
},
4029
fileSystem,
4030
idAllocator,
4032
- serverConfig,
4031
+ host,
4032
selfInvocation,
4033
});
4034
const threadId = ThreadId.make("thread-acp-reordered-elicitation");
@@ -4091,7 +4090,7 @@ describe("AcpAdapterV2", () => {
4090
const fileSystem = yield* FileSystem.FileSystem;
4091
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4092
const path = yield* Path.Path;
4094
- const serverConfig = yield* ServerConfig.ServerConfig;
4093
+ const host = yield* ProviderHost.ProviderHost;
4094
const selfInvocation = yield* resolveSelfInvocation();
4095
const mockAgentPath = yield* path.fromFileUrl(
4096
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4111,7 +4110,7 @@ describe("AcpAdapterV2", () => {
4110
},
4111
fileSystem,
4112
idAllocator,
4114
- serverConfig,
4113
+ host,
4114
selfInvocation,
4115
});
4116
const threadId = ThreadId.make("thread-acp-mcp-approval-elicitation");
@@ -4159,7 +4158,7 @@ describe("AcpAdapterV2", () => {
4158
const fileSystem = yield* FileSystem.FileSystem;
4159
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4160
const path = yield* Path.Path;
4162
- const serverConfig = yield* ServerConfig.ServerConfig;
4161
+ const host = yield* ProviderHost.ProviderHost;
4162
const selfInvocation = yield* resolveSelfInvocation();
4163
const mockAgentPath = yield* path.fromFileUrl(
4164
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4187,7 +4186,7 @@ describe("AcpAdapterV2", () => {
4186
},
4187
fileSystem,
4188
idAllocator,
4190
- serverConfig,
4189
+ host,
4190
selfInvocation,
4191
testHooks: {
4192
onNativeResponseLifecycle: (event) =>
@@ -4267,7 +4266,7 @@ describe("AcpAdapterV2", () => {
4266
const fileSystem = yield* FileSystem.FileSystem;
4267
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4268
const path = yield* Path.Path;
4270
- const serverConfig = yield* ServerConfig.ServerConfig;
4269
+ const host = yield* ProviderHost.ProviderHost;
4270
const selfInvocation = yield* resolveSelfInvocation();
4271
const mockAgentPath = yield* path.fromFileUrl(
4272
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4292,7 +4291,7 @@ describe("AcpAdapterV2", () => {
4291
},
4292
fileSystem,
4293
idAllocator,
4295
- serverConfig,
4294
+ host,
4295
selfInvocation,
4296
testHooks: {
4297
afterNativeResponseTransportClosed: () =>
@@ -4381,7 +4380,7 @@ describe("AcpAdapterV2", () => {
4380
const fileSystem = yield* FileSystem.FileSystem;
4381
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4382
const path = yield* Path.Path;
4384
- const serverConfig = yield* ServerConfig.ServerConfig;
4383
+ const host = yield* ProviderHost.ProviderHost;
4384
const selfInvocation = yield* resolveSelfInvocation();
4385
const mockAgentPath = yield* path.fromFileUrl(
4386
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4426,7 +4425,7 @@ describe("AcpAdapterV2", () => {
4425
},
4426
fileSystem,
4427
idAllocator,
4429
- serverConfig,
4428
+ host,
4429
selfInvocation,
4430
testHooks: {
4431
onNativeResponseLifecycle: (event) =>
@@ -4522,7 +4521,7 @@ describe("AcpAdapterV2", () => {
4521
const fileSystem = yield* FileSystem.FileSystem;
4522
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4523
const path = yield* Path.Path;
4525
- const serverConfig = yield* ServerConfig.ServerConfig;
4524
+ const host = yield* ProviderHost.ProviderHost;
4525
const selfInvocation = yield* resolveSelfInvocation();
4526
const mockAgentPath = yield* path.fromFileUrl(
4527
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4564,7 +4563,7 @@ describe("AcpAdapterV2", () => {
4563
},
4564
fileSystem,
4565
idAllocator,
4567
- serverConfig,
4566
+ host,
4567
selfInvocation,
4568
});
4569
const threadId = ThreadId.make("thread-acp-pending-response-cancel");
@@ -4638,7 +4637,7 @@ describe("AcpAdapterV2", () => {
4637
const fileSystem = yield* FileSystem.FileSystem;
4638
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4639
const path = yield* Path.Path;
4641
- const serverConfig = yield* ServerConfig.ServerConfig;
4640
+ const host = yield* ProviderHost.ProviderHost;
4641
const selfInvocation = yield* resolveSelfInvocation();
4642
const mockAgentPath = yield* path.fromFileUrl(
4643
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4679,7 +4678,7 @@ describe("AcpAdapterV2", () => {
4678
},
4679
fileSystem,
4680
idAllocator,
4682
- serverConfig,
4681
+ host,
4682
selfInvocation,
4683
});
4684
const threadId = ThreadId.make(`thread-acp-immediate-permission-${name}`);
@@ -4743,7 +4742,7 @@ describe("AcpAdapterV2", () => {
4742
const fileSystem = yield* FileSystem.FileSystem;
4743
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4744
const path = yield* Path.Path;
4746
- const serverConfig = yield* ServerConfig.ServerConfig;
4745
+ const host = yield* ProviderHost.ProviderHost;
4746
const selfInvocation = yield* resolveSelfInvocation();
4747
const mockAgentPath = yield* path.fromFileUrl(
4748
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4778,7 +4777,7 @@ describe("AcpAdapterV2", () => {
4777
},
4778
fileSystem,
4779
idAllocator,
4781
- serverConfig,
4780
+ host,
4781
selfInvocation,
4782
});
4783
const threadId = ThreadId.make("thread-acp-immediate-url-elicitation");
@@ -4836,7 +4835,7 @@ describe("AcpAdapterV2", () => {
4835
const fileSystem = yield* FileSystem.FileSystem;
4836
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4837
const path = yield* Path.Path;
4839
- const serverConfig = yield* ServerConfig.ServerConfig;
4838
+ const host = yield* ProviderHost.ProviderHost;
4839
const selfInvocation = yield* resolveSelfInvocation();
4840
const mockAgentPath = yield* path.fromFileUrl(
4841
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4875,7 +4874,7 @@ describe("AcpAdapterV2", () => {
4874
},
4875
fileSystem,
4876
idAllocator,
4878
- serverConfig,
4877
+ host,
4878
selfInvocation,
4879
});
4880
const threadId = ThreadId.make("thread-acp-missing-response-ack");
@@ -4929,7 +4928,7 @@ describe("AcpAdapterV2", () => {
4928
const fileSystem = yield* FileSystem.FileSystem;
4929
const idAllocator = yield* IdAllocator.IdAllocatorV2;
4930
const path = yield* Path.Path;
4932
- const serverConfig = yield* ServerConfig.ServerConfig;
4931
+ const host = yield* ProviderHost.ProviderHost;
4932
const selfInvocation = yield* resolveSelfInvocation();
4933
const mockAgentPath = yield* path.fromFileUrl(
4934
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -4964,7 +4963,7 @@ describe("AcpAdapterV2", () => {
4963
},
4964
fileSystem,
4965
idAllocator,
4967
- serverConfig,
4966
+ host,
4967
selfInvocation,
4968
});
4969
const threadId = ThreadId.make("thread-acp-teardown-wins-elicitation");
@@ -5042,7 +5041,7 @@ describe("AcpAdapterV2", () => {
5041
const fileSystem = yield* FileSystem.FileSystem;
5042
const idAllocator = yield* IdAllocator.IdAllocatorV2;
5043
const path = yield* Path.Path;
5045
- const serverConfig = yield* ServerConfig.ServerConfig;
5044
+ const host = yield* ProviderHost.ProviderHost;
5045
const selfInvocation = yield* resolveSelfInvocation();
5046
const mockAgentPath = yield* path.fromFileUrl(
5047
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -5064,7 +5063,7 @@ describe("AcpAdapterV2", () => {
5063
},
5064
fileSystem,
5065
idAllocator,
5067
- serverConfig,
5066
+ host,
5067
selfInvocation,
5068
});
5069
const threadId = ThreadId.make("thread-acp-cancel-timeout");
@@ -5145,7 +5144,7 @@ describe("AcpAdapterV2", () => {
5144
const fileSystem = yield* FileSystem.FileSystem;
5145
const idAllocator = yield* IdAllocator.IdAllocatorV2;
5146
const path = yield* Path.Path;
5148
- const serverConfig = yield* ServerConfig.ServerConfig;
5147
+ const host = yield* ProviderHost.ProviderHost;
5148
const selfInvocation = yield* resolveSelfInvocation();
5149
const mockAgentPath = yield* path.fromFileUrl(
5150
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -5171,7 +5170,7 @@ describe("AcpAdapterV2", () => {
5170
},
5171
fileSystem,
5172
idAllocator,
5174
- serverConfig,
5173
+ host,
5174
selfInvocation,
5175
});
5176
const threadId = ThreadId.make("thread-acp-double-stop");
@@ -5243,7 +5242,7 @@ describe("AcpAdapterV2", () => {
5242
const fileSystem = yield* FileSystem.FileSystem;
5243
const idAllocator = yield* IdAllocator.IdAllocatorV2;
5244
const path = yield* Path.Path;
5246
- const serverConfig = yield* ServerConfig.ServerConfig;
5245
+ const host = yield* ProviderHost.ProviderHost;
5246
const selfInvocation = yield* resolveSelfInvocation();
5247
const mockAgentPath = yield* path.fromFileUrl(
5248
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -5281,7 +5280,7 @@ describe("AcpAdapterV2", () => {
5280
},
5281
fileSystem,
5282
idAllocator,
5284
- serverConfig,
5283
+ host,
5284
selfInvocation,
5285
});
5286
const threadId = ThreadId.make("thread-acp-interrupt-background-hold");
@@ -5339,7 +5338,7 @@ describe("AcpAdapterV2", () => {
5338
const fileSystem = yield* FileSystem.FileSystem;
5339
const idAllocator = yield* IdAllocator.IdAllocatorV2;
5340
const path = yield* Path.Path;
5342
- const serverConfig = yield* ServerConfig.ServerConfig;
5341
+ const host = yield* ProviderHost.ProviderHost;
5342
const selfInvocation = yield* resolveSelfInvocation();
5343
const mockAgentPath = yield* path.fromFileUrl(
5344
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -5391,7 +5390,7 @@ describe("AcpAdapterV2", () => {
5390
},
5391
fileSystem,
5392
idAllocator,
5394
- serverConfig,
5393
+ host,
5394
selfInvocation,
5395
});
5396
const threadId = ThreadId.make("thread-acp-subagent-carryover");
@@ -5487,7 +5486,7 @@ describe("AcpAdapterV2", () => {
5486
const fileSystem = yield* FileSystem.FileSystem;
5487
const idAllocator = yield* IdAllocator.IdAllocatorV2;
5488
const path = yield* Path.Path;
5490
- const serverConfig = yield* ServerConfig.ServerConfig;
5489
+ const host = yield* ProviderHost.ProviderHost;
5490
const selfInvocation = yield* resolveSelfInvocation();
5491
const mockAgentPath = yield* path.fromFileUrl(
5492
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -5537,7 +5536,7 @@ describe("AcpAdapterV2", () => {
5536
},
5537
fileSystem,
5538
idAllocator,
5540
- serverConfig,
5539
+ host,
5540
selfInvocation,
5541
continuationRequests: { offer: () => Effect.void },
5542
});
@@ -5634,7 +5633,7 @@ describe("AcpAdapterV2", () => {
5633
const fileSystem = yield* FileSystem.FileSystem;
5634
const idAllocator = yield* IdAllocator.IdAllocatorV2;
5635
const path = yield* Path.Path;
5637
- const serverConfig = yield* ServerConfig.ServerConfig;
5636
+ const host = yield* ProviderHost.ProviderHost;
5637
const selfInvocation = yield* resolveSelfInvocation();
5638
const mockAgentPath = yield* path.fromFileUrl(
5639
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -5707,7 +5706,7 @@ describe("AcpAdapterV2", () => {
5706
},
5707
fileSystem,
5708
idAllocator,
5710
- serverConfig,
5709
+ host,
5710
selfInvocation,
5711
continuationRequests: { offer: () => Effect.void },
5712
});
@@ -5871,7 +5870,7 @@ describe("AcpAdapterV2", () => {
5870
const fileSystem = yield* FileSystem.FileSystem;
5871
const idAllocator = yield* IdAllocator.IdAllocatorV2;
5872
const path = yield* Path.Path;
5874
- const serverConfig = yield* ServerConfig.ServerConfig;
5873
+ const host = yield* ProviderHost.ProviderHost;
5874
const selfInvocation = yield* resolveSelfInvocation();
5875
const mockAgentPath = yield* path.fromFileUrl(
5876
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -5958,7 +5957,7 @@ describe("AcpAdapterV2", () => {
5957
},
5958
fileSystem,
5959
idAllocator,
5961
- serverConfig,
5960
+ host,
5961
selfInvocation,
5962
continuationRequests: { offer: () => Effect.void },
5963
});
@@ -6094,7 +6093,7 @@ describe("AcpAdapterV2", () => {
6093
const fileSystem = yield* FileSystem.FileSystem;
6094
const idAllocator = yield* IdAllocator.IdAllocatorV2;
6095
const path = yield* Path.Path;
6097
- const serverConfig = yield* ServerConfig.ServerConfig;
6096
+ const host = yield* ProviderHost.ProviderHost;
6097
const selfInvocation = yield* resolveSelfInvocation();
6098
const mockAgentPath = yield* path.fromFileUrl(
6099
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -6157,7 +6156,7 @@ describe("AcpAdapterV2", () => {
6156
},
6157
fileSystem,
6158
idAllocator,
6160
- serverConfig,
6159
+ host,
6160
selfInvocation,
6161
continuationRequests: {
6162
offer: (request) =>
@@ -6313,7 +6312,7 @@ describe("AcpAdapterV2", () => {
6312
const fileSystem = yield* FileSystem.FileSystem;
6313
const idAllocator = yield* IdAllocator.IdAllocatorV2;
6314
const path = yield* Path.Path;
6316
- const serverConfig = yield* ServerConfig.ServerConfig;
6315
+ const host = yield* ProviderHost.ProviderHost;
6316
const selfInvocation = yield* resolveSelfInvocation();
6317
const mockAgentPath = yield* path.fromFileUrl(
6318
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -6355,7 +6354,7 @@ describe("AcpAdapterV2", () => {
6354
},
6355
fileSystem,
6356
idAllocator,
6358
- serverConfig,
6357
+ host,
6358
selfInvocation,
6359
continuationRequests: { offer: () => Effect.void },
6360
});
@@ -6461,7 +6460,7 @@ describe("AcpAdapterV2", () => {
6460
const fileSystem = yield* FileSystem.FileSystem;
6461
const idAllocator = yield* IdAllocator.IdAllocatorV2;
6462
const path = yield* Path.Path;
6464
- const serverConfig = yield* ServerConfig.ServerConfig;
6463
+ const host = yield* ProviderHost.ProviderHost;
6464
const selfInvocation = yield* resolveSelfInvocation();
6465
const mockAgentPath = yield* path.fromFileUrl(
6466
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -6520,7 +6519,7 @@ describe("AcpAdapterV2", () => {
6519
},
6520
fileSystem,
6521
idAllocator,
6523
- serverConfig,
6522
+ host,
6523
selfInvocation,
6524
continuationRequests: {
6525
offer: (request) =>
@@ -6713,7 +6712,7 @@ describe("AcpAdapterV2", () => {
6712
const fileSystem = yield* FileSystem.FileSystem;
6713
const idAllocator = yield* IdAllocator.IdAllocatorV2;
6714
const path = yield* Path.Path;
6716
- const serverConfig = yield* ServerConfig.ServerConfig;
6715
+ const host = yield* ProviderHost.ProviderHost;
6716
const selfInvocation = yield* resolveSelfInvocation();
6717
const mockAgentPath = yield* path.fromFileUrl(
6718
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -6774,7 +6773,7 @@ describe("AcpAdapterV2", () => {
6773
},
6774
fileSystem,
6775
idAllocator,
6777
- serverConfig,
6776
+ host,
6777
selfInvocation,
6778
continuationRequests: {
6779
offer: (request) =>
@@ -7001,7 +7000,7 @@ describe("AcpAdapterV2", () => {
7000
const fileSystem = yield* FileSystem.FileSystem;
7001
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7002
const path = yield* Path.Path;
7004
- const serverConfig = yield* ServerConfig.ServerConfig;
7003
+ const host = yield* ProviderHost.ProviderHost;
7004
const selfInvocation = yield* resolveSelfInvocation();
7005
const mockAgentPath = yield* path.fromFileUrl(
7006
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -7072,7 +7071,7 @@ describe("AcpAdapterV2", () => {
7071
},
7072
fileSystem,
7073
idAllocator,
7075
- serverConfig,
7074
+ host,
7075
selfInvocation,
7076
continuationRequests: {
7077
offer: (request) =>
@@ -7242,7 +7241,7 @@ describe("AcpAdapterV2", () => {
7241
const fileSystem = yield* FileSystem.FileSystem;
7242
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7243
const path = yield* Path.Path;
7245
- const serverConfig = yield* ServerConfig.ServerConfig;
7244
+ const host = yield* ProviderHost.ProviderHost;
7245
const selfInvocation = yield* resolveSelfInvocation();
7246
const mockAgentPath = yield* path.fromFileUrl(
7247
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -7316,7 +7315,7 @@ describe("AcpAdapterV2", () => {
7315
},
7316
fileSystem,
7317
idAllocator,
7319
- serverConfig,
7318
+ host,
7319
selfInvocation,
7320
continuationRequests: {
7321
offer: (request) =>
@@ -7471,7 +7470,7 @@ describe("AcpAdapterV2", () => {
7470
const fileSystem = yield* FileSystem.FileSystem;
7471
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7472
const path = yield* Path.Path;
7474
- const serverConfig = yield* ServerConfig.ServerConfig;
7473
+ const host = yield* ProviderHost.ProviderHost;
7474
const selfInvocation = yield* resolveSelfInvocation();
7475
const mockAgentPath = yield* path.fromFileUrl(
7476
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -7533,7 +7532,7 @@ describe("AcpAdapterV2", () => {
7532
},
7533
fileSystem,
7534
idAllocator,
7536
- serverConfig,
7535
+ host,
7536
selfInvocation,
7537
continuationRequests: {
7538
offer: (request) =>
@@ -7742,7 +7741,7 @@ describe("AcpAdapterV2", () => {
7741
const fileSystem = yield* FileSystem.FileSystem;
7742
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7743
const path = yield* Path.Path;
7745
- const serverConfig = yield* ServerConfig.ServerConfig;
7744
+ const host = yield* ProviderHost.ProviderHost;
7745
const selfInvocation = yield* resolveSelfInvocation();
7746
const mockAgentPath = yield* path.fromFileUrl(
7747
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -7803,7 +7802,7 @@ describe("AcpAdapterV2", () => {
7802
},
7803
fileSystem,
7804
idAllocator,
7806
- serverConfig,
7805
+ host,
7806
selfInvocation,
7807
continuationRequests: {
7808
offer: (request) =>
@@ -7984,7 +7983,7 @@ describe("AcpAdapterV2", () => {
7983
const fileSystem = yield* FileSystem.FileSystem;
7984
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7985
const path = yield* Path.Path;
7987
- const serverConfig = yield* ServerConfig.ServerConfig;
7986
+ const host = yield* ProviderHost.ProviderHost;
7987
const selfInvocation = yield* resolveSelfInvocation();
7988
const mockAgentPath = yield* path.fromFileUrl(
7989
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -8053,7 +8052,7 @@ describe("AcpAdapterV2", () => {
8052
},
8053
fileSystem,
8054
idAllocator,
8056
- serverConfig,
8055
+ host,
8056
selfInvocation,
8057
});
8058
const threadId = ThreadId.make("thread-acp-settled-soft-steer");
@@ -8160,7 +8159,7 @@ describe("AcpAdapterV2", () => {
8159
const fileSystem = yield* FileSystem.FileSystem;
8160
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8161
const path = yield* Path.Path;
8163
- const serverConfig = yield* ServerConfig.ServerConfig;
8162
+ const host = yield* ProviderHost.ProviderHost;
8163
const selfInvocation = yield* resolveSelfInvocation();
8164
const mockAgentPath = yield* path.fromFileUrl(
8165
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -8192,7 +8191,7 @@ describe("AcpAdapterV2", () => {
8191
},
8192
fileSystem,
8193
idAllocator,
8195
- serverConfig,
8194
+ host,
8195
selfInvocation,
8196
});
8197
const threadId = ThreadId.make("thread-acp-unsettled-steer-stays-hard");
@@ -8250,7 +8249,7 @@ describe("AcpAdapterV2", () => {
8249
const fileSystem = yield* FileSystem.FileSystem;
8250
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8251
const path = yield* Path.Path;
8253
- const serverConfig = yield* ServerConfig.ServerConfig;
8252
+ const host = yield* ProviderHost.ProviderHost;
8253
const selfInvocation = yield* resolveSelfInvocation();
8254
const mockAgentPath = yield* path.fromFileUrl(
8255
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -8298,7 +8297,7 @@ describe("AcpAdapterV2", () => {
8297
},
8298
fileSystem,
8299
idAllocator,
8301
- serverConfig,
8300
+ host,
8301
selfInvocation,
8302
continuationRequests: {
8303
offer: (request) =>
@@ -8444,7 +8443,7 @@ describe("AcpAdapterV2", () => {
8443
const fileSystem = yield* FileSystem.FileSystem;
8444
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8445
const path = yield* Path.Path;
8447
- const serverConfig = yield* ServerConfig.ServerConfig;
8446
+ const host = yield* ProviderHost.ProviderHost;
8447
const selfInvocation = yield* resolveSelfInvocation();
8448
const mockAgentPath = yield* path.fromFileUrl(
8449
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -8484,7 +8483,7 @@ describe("AcpAdapterV2", () => {
8483
},
8484
fileSystem,
8485
idAllocator,
8487
- serverConfig,
8486
+ host,
8487
selfInvocation,
8488
continuationRequests: { offer: () => Effect.void },
8489
});
@@ -8591,7 +8590,7 @@ describe("AcpAdapterV2", () => {
8590
const fileSystem = yield* FileSystem.FileSystem;
8591
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8592
const path = yield* Path.Path;
8594
- const serverConfig = yield* ServerConfig.ServerConfig;
8593
+ const host = yield* ProviderHost.ProviderHost;
8594
const selfInvocation = yield* resolveSelfInvocation();
8595
const mockAgentPath = yield* path.fromFileUrl(
8596
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -8630,7 +8629,7 @@ describe("AcpAdapterV2", () => {
8629
},
8630
fileSystem,
8631
idAllocator,
8633
- serverConfig,
8632
+ host,
8633
selfInvocation,
8634
continuationRequests: { offer: () => Effect.void },
8635
});
@@ -8722,7 +8721,7 @@ describe("AcpAdapterV2", () => {
8721
const fileSystem = yield* FileSystem.FileSystem;
8722
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8723
const path = yield* Path.Path;
8725
- const serverConfig = yield* ServerConfig.ServerConfig;
8724
+ const host = yield* ProviderHost.ProviderHost;
8725
const selfInvocation = yield* resolveSelfInvocation();
8726
const mockAgentPath = yield* path.fromFileUrl(
8727
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -8799,7 +8798,7 @@ describe("AcpAdapterV2", () => {
8798
},
8799
fileSystem,
8800
idAllocator,
8802
- serverConfig,
8801
+ host,
8802
selfInvocation,
8803
});
8804
const threadId = ThreadId.make("thread-acp-stop-after-soft-steer-orphan");
@@ -9026,7 +9025,7 @@ describe("AcpAdapterV2", () => {
9025
const fileSystem = yield* FileSystem.FileSystem;
9026
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9027
const path = yield* Path.Path;
9029
- const serverConfig = yield* ServerConfig.ServerConfig;
9028
+ const host = yield* ProviderHost.ProviderHost;
9029
const selfInvocation = yield* resolveSelfInvocation();
9030
const mockAgentPath = yield* path.fromFileUrl(
9031
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -9087,7 +9086,7 @@ describe("AcpAdapterV2", () => {
9086
},
9087
fileSystem,
9088
idAllocator,
9090
- serverConfig,
9089
+ host,
9090
selfInvocation,
9091
continuationRequests: { offer: () => Effect.void },
9092
});
@@ -9223,7 +9222,7 @@ describe("AcpAdapterV2", () => {
9222
const fileSystem = yield* FileSystem.FileSystem;
9223
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9224
const path = yield* Path.Path;
9226
- const serverConfig = yield* ServerConfig.ServerConfig;
9225
+ const host = yield* ProviderHost.ProviderHost;
9226
const selfInvocation = yield* resolveSelfInvocation();
9227
const mockAgentPath = yield* path.fromFileUrl(
9228
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -9298,7 +9297,7 @@ describe("AcpAdapterV2", () => {
9297
},
9298
fileSystem,
9299
idAllocator,
9301
- serverConfig,
9300
+ host,
9301
selfInvocation,
9302
});
9303
const threadId = ThreadId.make("thread-acp-settled-soft-admission-race");
@@ -9393,7 +9392,7 @@ describe("AcpAdapterV2", () => {
9392
const fileSystem = yield* FileSystem.FileSystem;
9393
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9394
const path = yield* Path.Path;
9396
- const serverConfig = yield* ServerConfig.ServerConfig;
9395
+ const host = yield* ProviderHost.ProviderHost;
9396
const selfInvocation = yield* resolveSelfInvocation();
9397
const mockAgentPath = yield* path.fromFileUrl(
9398
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -9431,7 +9430,7 @@ describe("AcpAdapterV2", () => {
9430
},
9431
fileSystem,
9432
idAllocator,
9434
- serverConfig,
9433
+ host,
9434
selfInvocation,
9435
continuationRequests: {
9436
offer: (request) =>
@@ -9524,7 +9523,7 @@ describe("AcpAdapterV2", () => {
9523
const fileSystem = yield* FileSystem.FileSystem;
9524
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9525
const path = yield* Path.Path;
9527
- const serverConfig = yield* ServerConfig.ServerConfig;
9526
+ const host = yield* ProviderHost.ProviderHost;
9527
const selfInvocation = yield* resolveSelfInvocation();
9528
const mockAgentPath = yield* path.fromFileUrl(
9529
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -9554,7 +9553,7 @@ describe("AcpAdapterV2", () => {
9553
},
9554
fileSystem,
9555
idAllocator,
9557
- serverConfig,
9556
+ host,
9557
selfInvocation,
9558
continuationRequests: {
9559
offer: (request) =>
@@ -9644,7 +9643,7 @@ describe("AcpAdapterV2", () => {
9643
const fileSystem = yield* FileSystem.FileSystem;
9644
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9645
const path = yield* Path.Path;
9647
- const serverConfig = yield* ServerConfig.ServerConfig;
9646
+ const host = yield* ProviderHost.ProviderHost;
9647
const selfInvocation = yield* resolveSelfInvocation();
9648
const mockAgentPath = yield* path.fromFileUrl(
9649
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -9690,7 +9689,7 @@ describe("AcpAdapterV2", () => {
9689
},
9690
fileSystem,
9691
idAllocator,
9693
- serverConfig,
9692
+ host,
9693
selfInvocation,
9694
continuationRequests: {
9695
offer: (request) =>
@@ -9853,7 +9852,7 @@ describe("AcpAdapterV2", () => {
9852
const fileSystem = yield* FileSystem.FileSystem;
9853
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9854
const path = yield* Path.Path;
9856
- const serverConfig = yield* ServerConfig.ServerConfig;
9855
+ const host = yield* ProviderHost.ProviderHost;
9856
const selfInvocation = yield* resolveSelfInvocation();
9857
const mockAgentPath = yield* path.fromFileUrl(
9858
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -9897,7 +9896,7 @@ describe("AcpAdapterV2", () => {
9896
},
9897
fileSystem,
9898
idAllocator,
9900
- serverConfig,
9899
+ host,
9900
selfInvocation,
9901
});
9902
const threadId = ThreadId.make("thread-acp-injected-report-hold");
@@ -10019,7 +10018,7 @@ describe("AcpAdapterV2", () => {
10018
const fileSystem = yield* FileSystem.FileSystem;
10019
const idAllocator = yield* IdAllocator.IdAllocatorV2;
10020
const path = yield* Path.Path;
10022
- const serverConfig = yield* ServerConfig.ServerConfig;
10021
+ const host = yield* ProviderHost.ProviderHost;
10022
const selfInvocation = yield* resolveSelfInvocation();
10023
const mockAgentPath = yield* path.fromFileUrl(
10024
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -10078,7 +10077,7 @@ describe("AcpAdapterV2", () => {
10077
},
10078
fileSystem,
10079
idAllocator,
10081
- serverConfig,
10080
+ host,
10081
selfInvocation,
10082
continuationRequests: {
10083
offer: (request) =>
@@ -10221,7 +10220,7 @@ describe("AcpAdapterV2", () => {
10220
const fileSystem = yield* FileSystem.FileSystem;
10221
const idAllocator = yield* IdAllocator.IdAllocatorV2;
10222
const path = yield* Path.Path;
10224
- const serverConfig = yield* ServerConfig.ServerConfig;
10223
+ const host = yield* ProviderHost.ProviderHost;
10224
const selfInvocation = yield* resolveSelfInvocation();
10225
const mockAgentPath = yield* path.fromFileUrl(
10226
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -10276,7 +10275,7 @@ describe("AcpAdapterV2", () => {
10275
},
10276
fileSystem,
10277
idAllocator,
10279
- serverConfig,
10278
+ host,
10279
selfInvocation,
10280
continuationRequests: {
10281
offer: (request) =>
@@ -10461,7 +10460,7 @@ describe("AcpAdapterV2", () => {
10460
const fileSystem = yield* FileSystem.FileSystem;
10461
const idAllocator = yield* IdAllocator.IdAllocatorV2;
10462
const path = yield* Path.Path;
10464
- const serverConfig = yield* ServerConfig.ServerConfig;
10463
+ const host = yield* ProviderHost.ProviderHost;
10464
const selfInvocation = yield* resolveSelfInvocation();
10465
const mockAgentPath = yield* path.fromFileUrl(
10466
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -10523,7 +10522,7 @@ describe("AcpAdapterV2", () => {
10522
},
10523
fileSystem,
10524
idAllocator,
10526
- serverConfig,
10525
+ host,
10526
selfInvocation,
10527
continuationRequests: {
10528
offer: (request) =>
@@ -10680,7 +10679,7 @@ describe("AcpAdapterV2", () => {
10679
const fileSystem = yield* FileSystem.FileSystem;
10680
const idAllocator = yield* IdAllocator.IdAllocatorV2;
10681
const path = yield* Path.Path;
10683
- const serverConfig = yield* ServerConfig.ServerConfig;
10682
+ const host = yield* ProviderHost.ProviderHost;
10683
const selfInvocation = yield* resolveSelfInvocation();
10684
const mockAgentPath = yield* path.fromFileUrl(
10685
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -10746,7 +10745,7 @@ describe("AcpAdapterV2", () => {
10745
},
10746
fileSystem,
10747
idAllocator,
10749
- serverConfig,
10748
+ host,
10749
selfInvocation,
10750
continuationRequests: {
10751
offer: (request) =>
@@ -10895,7 +10894,7 @@ describe("AcpAdapterV2", () => {
10894
const fileSystem = yield* FileSystem.FileSystem;
10895
const idAllocator = yield* IdAllocator.IdAllocatorV2;
10896
const path = yield* Path.Path;
10898
- const serverConfig = yield* ServerConfig.ServerConfig;
10897
+ const host = yield* ProviderHost.ProviderHost;
10898
const selfInvocation = yield* resolveSelfInvocation();
10899
const mockAgentPath = yield* path.fromFileUrl(
10900
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -10983,7 +10982,7 @@ describe("AcpAdapterV2", () => {
10982
},
10983
fileSystem,
10984
idAllocator,
10986
- serverConfig,
10985
+ host,
10986
selfInvocation,
10987
continuationRequests: {
10988
offer: (request) =>
@@ -11267,7 +11266,7 @@ describe("AcpAdapterV2", () => {
11266
const fileSystem = yield* FileSystem.FileSystem;
11267
const idAllocator = yield* IdAllocator.IdAllocatorV2;
11268
const path = yield* Path.Path;
11270
- const serverConfig = yield* ServerConfig.ServerConfig;
11269
+ const host = yield* ProviderHost.ProviderHost;
11270
const selfInvocation = yield* resolveSelfInvocation();
11271
const mockAgentPath = yield* path.fromFileUrl(
11272
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -11306,7 +11305,7 @@ describe("AcpAdapterV2", () => {
11305
},
11306
fileSystem,
11307
idAllocator,
11309
- serverConfig,
11308
+ host,
11309
selfInvocation,
11310
continuationRequests: {
11311
offer: (request) =>
@@ -11421,7 +11420,7 @@ describe("AcpAdapterV2", () => {
11420
const fileSystem = yield* FileSystem.FileSystem;
11421
const idAllocator = yield* IdAllocator.IdAllocatorV2;
11422
const path = yield* Path.Path;
11424
- const serverConfig = yield* ServerConfig.ServerConfig;
11423
+ const host = yield* ProviderHost.ProviderHost;
11424
const selfInvocation = yield* resolveSelfInvocation();
11425
const mockAgentPath = yield* path.fromFileUrl(
11426
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -11490,7 +11489,7 @@ describe("AcpAdapterV2", () => {
11489
},
11490
fileSystem,
11491
idAllocator,
11493
- serverConfig,
11492
+ host,
11493
selfInvocation,
11494
continuationRequests: {
11495
offer: (request) =>
@@ -11752,7 +11751,7 @@ describe("AcpAdapterV2", () => {
11751
const fileSystem = yield* FileSystem.FileSystem;
11752
const idAllocator = yield* IdAllocator.IdAllocatorV2;
11753
const path = yield* Path.Path;
11755
- const serverConfig = yield* ServerConfig.ServerConfig;
11754
+ const host = yield* ProviderHost.ProviderHost;
11755
const selfInvocation = yield* resolveSelfInvocation();
11756
const mockAgentPath = yield* path.fromFileUrl(
11757
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -11802,7 +11801,7 @@ describe("AcpAdapterV2", () => {
11801
},
11802
fileSystem,
11803
idAllocator,
11805
- serverConfig,
11804
+ host,
11805
selfInvocation,
11806
continuationRequests: {
11807
offer: (request) =>
@@ -11939,7 +11938,7 @@ describe("AcpAdapterV2", () => {
11938
const fileSystem = yield* FileSystem.FileSystem;
11939
const idAllocator = yield* IdAllocator.IdAllocatorV2;
11940
const path = yield* Path.Path;
11942
- const serverConfig = yield* ServerConfig.ServerConfig;
11941
+ const host = yield* ProviderHost.ProviderHost;
11942
const selfInvocation = yield* resolveSelfInvocation();
11943
const mockAgentPath = yield* path.fromFileUrl(
11944
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -11993,7 +11992,7 @@ describe("AcpAdapterV2", () => {
11992
},
11993
fileSystem,
11994
idAllocator,
11996
- serverConfig,
11995
+ host,
11996
selfInvocation,
11997
continuationRequests: {
11998
offer: (request) =>
@@ -12183,7 +12182,7 @@ describe("AcpAdapterV2", () => {
12182
const fileSystem = yield* FileSystem.FileSystem;
12183
const idAllocator = yield* IdAllocator.IdAllocatorV2;
12184
const path = yield* Path.Path;
12186
- const serverConfig = yield* ServerConfig.ServerConfig;
12185
+ const host = yield* ProviderHost.ProviderHost;
12186
const selfInvocation = yield* resolveSelfInvocation();
12187
const mockAgentPath = yield* path.fromFileUrl(
12188
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -12235,7 +12234,7 @@ describe("AcpAdapterV2", () => {
12234
},
12235
fileSystem,
12236
idAllocator,
12238
- serverConfig,
12237
+ host,
12238
selfInvocation,
12239
continuationRequests: {
12240
offer: (request) =>
@@ -12373,7 +12372,7 @@ describe("AcpAdapterV2", () => {
12372
const fileSystem = yield* FileSystem.FileSystem;
12373
const idAllocator = yield* IdAllocator.IdAllocatorV2;
12374
const path = yield* Path.Path;
12376
- const serverConfig = yield* ServerConfig.ServerConfig;
12375
+ const host = yield* ProviderHost.ProviderHost;
12376
const selfInvocation = yield* resolveSelfInvocation();
12377
const mockAgentPath = yield* path.fromFileUrl(
12378
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -12395,7 +12394,7 @@ describe("AcpAdapterV2", () => {
12394
},
12395
fileSystem,
12396
idAllocator,
12398
- serverConfig,
12397
+ host,
12398
selfInvocation,
12399
});
12400
const threadId = ThreadId.make("thread-acp-restart-after-interrupt");
@@ -12619,7 +12618,7 @@ describe("AcpAdapterV2", () => {
12618
const fileSystem = yield* FileSystem.FileSystem;
12619
const idAllocator = yield* IdAllocator.IdAllocatorV2;
12620
const path = yield* Path.Path;
12622
- const serverConfig = yield* ServerConfig.ServerConfig;
12621
+ const host = yield* ProviderHost.ProviderHost;
12622
const selfInvocation = yield* resolveSelfInvocation();
12623
const mockAgentPath = yield* path.fromFileUrl(
12624
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -12668,7 +12667,7 @@ describe("AcpAdapterV2", () => {
12667
},
12668
fileSystem,
12669
idAllocator,
12671
- serverConfig,
12670
+ host,
12671
selfInvocation,
12672
continuationRequests: {
12673
offer: (request) =>
@@ -12837,7 +12836,7 @@ describe("AcpAdapterV2", () => {
12836
const fileSystem = yield* FileSystem.FileSystem;
12837
const idAllocator = yield* IdAllocator.IdAllocatorV2;
12838
const path = yield* Path.Path;
12840
- const serverConfig = yield* ServerConfig.ServerConfig;
12839
+ const host = yield* ProviderHost.ProviderHost;
12840
const selfInvocation = yield* resolveSelfInvocation();
12841
const mockAgentPath = yield* path.fromFileUrl(
12842
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -12861,7 +12860,7 @@ describe("AcpAdapterV2", () => {
12860
},
12861
fileSystem,
12862
idAllocator,
12864
- serverConfig,
12863
+ host,
12864
selfInvocation,
12865
});
12866
const threadId = ThreadId.make("thread-acp-missing-hard-teardown");
@@ -12926,7 +12925,7 @@ describe("AcpAdapterV2", () => {
12925
const fileSystem = yield* FileSystem.FileSystem;
12926
const idAllocator = yield* IdAllocator.IdAllocatorV2;
12927
const path = yield* Path.Path;
12929
- const serverConfig = yield* ServerConfig.ServerConfig;
12928
+ const host = yield* ProviderHost.ProviderHost;
12929
const selfInvocation = yield* resolveSelfInvocation();
12930
const mockAgentPath = yield* path.fromFileUrl(
12931
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -12963,7 +12962,7 @@ describe("AcpAdapterV2", () => {
12962
},
12963
fileSystem,
12964
idAllocator,
12966
- serverConfig,
12965
+ host,
12966
selfInvocation,
12967
});
12968
const threadId = ThreadId.make("thread-acp-concurrent-hard-teardown");
@@ -13039,7 +13038,7 @@ describe("AcpAdapterV2", () => {
13038
const fileSystem = yield* FileSystem.FileSystem;
13039
const idAllocator = yield* IdAllocator.IdAllocatorV2;
13040
const path = yield* Path.Path;
13042
- const serverConfig = yield* ServerConfig.ServerConfig;
13041
+ const host = yield* ProviderHost.ProviderHost;
13042
const selfInvocation = yield* resolveSelfInvocation();
13043
const mockAgentPath = yield* path.fromFileUrl(
13044
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -13122,7 +13121,7 @@ describe("AcpAdapterV2", () => {
13121
},
13122
fileSystem,
13123
idAllocator,
13125
- serverConfig,
13124
+ host,
13125
selfInvocation,
13126
testHooks: {
13127
afterHardTeardownTransportDrained: () =>
@@ -13401,7 +13400,7 @@ describe("AcpAdapterV2", () => {
13400
const fileSystem = yield* FileSystem.FileSystem;
13401
const idAllocator = yield* IdAllocator.IdAllocatorV2;
13402
const path = yield* Path.Path;
13404
- const serverConfig = yield* ServerConfig.ServerConfig;
13403
+ const host = yield* ProviderHost.ProviderHost;
13404
const selfInvocation = yield* resolveSelfInvocation();
13405
const mockAgentPath = yield* path.fromFileUrl(
13406
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -13428,7 +13427,7 @@ describe("AcpAdapterV2", () => {
13427
},
13428
fileSystem,
13429
idAllocator,
13431
- serverConfig,
13430
+ host,
13431
selfInvocation,
13432
});
13433
const threadId = ThreadId.make("thread-acp-stale-deferred-cleanup");
@@ -13526,7 +13525,7 @@ describe("AcpAdapterV2", () => {
13525
const fileSystem = yield* FileSystem.FileSystem;
13526
const idAllocator = yield* IdAllocator.IdAllocatorV2;
13527
const path = yield* Path.Path;
13529
- const serverConfig = yield* ServerConfig.ServerConfig;
13528
+ const host = yield* ProviderHost.ProviderHost;
13529
const selfInvocation = yield* resolveSelfInvocation();
13530
const mockAgentPath = yield* path.fromFileUrl(
13531
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -13563,7 +13562,7 @@ describe("AcpAdapterV2", () => {
13562
},
13563
fileSystem,
13564
idAllocator,
13566
- serverConfig,
13565
+ host,
13566
selfInvocation,
13567
});
13568
const threadId = ThreadId.make("thread-acp-concurrent-resume-teardown");
@@ -13660,7 +13659,7 @@ describe("AcpAdapterV2", () => {
13659
const fileSystem = yield* FileSystem.FileSystem;
13660
const idAllocator = yield* IdAllocator.IdAllocatorV2;
13661
const path = yield* Path.Path;
13663
- const serverConfig = yield* ServerConfig.ServerConfig;
13662
+ const host = yield* ProviderHost.ProviderHost;
13663
const selfInvocation = yield* resolveSelfInvocation();
13664
const mockAgentPath = yield* path.fromFileUrl(
13665
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -13714,7 +13713,7 @@ describe("AcpAdapterV2", () => {
13713
},
13714
fileSystem,
13715
idAllocator,
13717
- serverConfig,
13716
+ host,
13717
selfInvocation,
13718
continuationRequests: { offer: () => Effect.void },
13719
});
@@ -13937,7 +13936,7 @@ describe("AcpAdapterV2", () => {
13936
const fileSystem = yield* FileSystem.FileSystem;
13937
const idAllocator = yield* IdAllocator.IdAllocatorV2;
13938
const path = yield* Path.Path;
13940
- const serverConfig = yield* ServerConfig.ServerConfig;
13939
+ const host = yield* ProviderHost.ProviderHost;
13940
const selfInvocation = yield* resolveSelfInvocation();
13941
const mockAgentPath = yield* path.fromFileUrl(
13942
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -13987,7 +13986,7 @@ describe("AcpAdapterV2", () => {
13986
},
13987
fileSystem,
13988
idAllocator,
13990
- serverConfig,
13989
+ host,
13990
selfInvocation,
13991
});
13992
const threadId = ThreadId.make("thread-acp-direct-stop-subagent-hold");
@@ -14091,7 +14090,7 @@ describe("AcpAdapterV2", () => {
14090
const fileSystem = yield* FileSystem.FileSystem;
14091
const idAllocator = yield* IdAllocator.IdAllocatorV2;
14092
const path = yield* Path.Path;
14094
- const serverConfig = yield* ServerConfig.ServerConfig;
14093
+ const host = yield* ProviderHost.ProviderHost;
14094
const selfInvocation = yield* resolveSelfInvocation();
14095
const mockAgentPath = yield* path.fromFileUrl(
14096
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -14136,7 +14135,7 @@ describe("AcpAdapterV2", () => {
14135
},
14136
fileSystem,
14137
idAllocator,
14139
- serverConfig,
14138
+ host,
14139
selfInvocation,
14140
});
14141
const threadId = ThreadId.make("thread-acp-restart-active-in-process");
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.testkit.ts
+2
-2
@@ -13,9 +13,9 @@ import * as Stream from "effect/Stream";
13
import { ChildProcessSpawner } from "effect/process";
14
import * as EffectAcpErrors from "effect-acp/errors";
15
16
-import * as AcpSessionRuntime from "../../provider/acp/AcpSessionRuntime.ts";
16
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
17
import type { ProviderReplayGate } from "@t3tools/provider-testing/replayGate";
18
-import { ACP_PROTOCOL, type AcpAdapterV2RuntimeInput } from "./AcpAdapterV2.ts";
18
+import { ACP_PROTOCOL, type AcpAdapterV2RuntimeInput } from "@t3tools/provider-acp/server/adapter";
19
20
export const AcpReplayTranscript = Schema.Struct({
21
provider: ProviderDriverKind,
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts
+13
-14
@@ -14,15 +14,16 @@ import { HttpClient, HttpClientResponse } from "effect/http";
14
import { ChildProcessSpawner } from "effect/process";
15
import * as EffectAcpErrors from "effect-acp/errors";
16
17
-import * as ServerConfig from "../../config.ts";
17
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
18
+import { layerTestProviderHost } from "@t3tools/provider-testing/host";
19
import * as ServerSettings from "../../serverSettings.ts";
20
import type {
21
AcpRegistryAvailableCommands,
22
AcpRegistryLiveConfiguration,
23
} from "../../provider/acp/AcpRegistryProbe.ts";
24
import * as AcpRegistrySupport from "../../provider/acp/AcpRegistrySupport.ts";
24
-import { ACP_SESSION_MODE_OPTION_ID } from "../../provider/acp/AcpSessionConfig.ts";
25
-import * as AcpSessionRuntime from "../../provider/acp/AcpSessionRuntime.ts";
25
+import { ACP_SESSION_MODE_OPTION_ID } from "@t3tools/provider-acp/server/sessionConfig";
26
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
27
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
28
import {
29
decodeAcpReplayTranscript,
@@ -43,9 +44,7 @@ const decodeAcpRegistryAdapterSettings = Schema.decodeUnknownEffect(
44
AcpRegistryAdapterV2Driver.configSchema,
45
);
46
46
-const layerServerConfig = ServerConfig.layerTest(process.cwd(), {
47
- prefix: "t3-acp-registry-v2-adapter-",
48
-}).pipe(Layer.provide(NodeServices.layer));
47
+const layerHost = layerTestProviderHost().pipe(Layer.provide(NodeServices.layer));
48
49
const layerRegistry = Layer.succeed(
50
HttpClient.HttpClient,
@@ -86,7 +85,7 @@ const layerRegistry = Layer.succeed(
85
const layerTest = Layer.mergeAll(
86
NodeServices.layer,
87
IdAllocator.layer,
89
- layerServerConfig,
88
+ layerHost,
89
layerRegistry,
90
ServerSettings.layerTest(),
91
);
@@ -202,7 +201,7 @@ describe("AcpRegistryAdapterV2", () => {
201
fileSystem,
202
idAllocator: yield* IdAllocator.IdAllocatorV2,
203
resolver: { resolve: () => Effect.die("the runtime is injected") },
205
- serverConfig: yield* ServerConfig.ServerConfig,
204
+ host: yield* ProviderHost.ProviderHost,
205
makeRuntime: makeAcpReplayRuntime({
206
transcript,
207
statusPath,
@@ -272,7 +271,7 @@ describe("AcpRegistryAdapterV2", () => {
271
const fileSystem = yield* FileSystem.FileSystem;
272
const idAllocator = yield* IdAllocator.IdAllocatorV2;
273
const path = yield* Path.Path;
275
- const serverConfig = yield* ServerConfig.ServerConfig;
274
+ const host = yield* ProviderHost.ProviderHost;
275
const mockAgentPath = yield* path.fromFileUrl(
276
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
277
);
@@ -291,7 +290,7 @@ describe("AcpRegistryAdapterV2", () => {
290
fileSystem,
291
idAllocator,
292
resolver: { resolve: () => Effect.die("the runtime is injected") },
294
- serverConfig,
293
+ host,
294
makeRuntime: (input) =>
295
Effect.gen(function* () {
296
clientCapabilities = input.clientCapabilities;
@@ -348,13 +347,13 @@ describe("AcpRegistryAdapterV2", () => {
347
const fileSystem = yield* FileSystem.FileSystem;
348
const idAllocator = yield* IdAllocator.IdAllocatorV2;
349
const path = yield* Path.Path;
351
- const serverConfig = yield* ServerConfig.ServerConfig;
350
+ const host = yield* ProviderHost.ProviderHost;
351
const mockAgentPath = yield* path.fromFileUrl(
352
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
353
);
354
const resolver = yield* AcpRegistrySupport.makeAcpRegistryCatalog({
356
- cacheDir: serverConfig.providerStatusCacheDir,
357
- toolsDir: serverConfig.baseDir + "/tools",
355
+ cacheDir: host.paths.providerStatusCacheDir,
356
+ toolsDir: host.paths.baseDir + "/tools",
357
registryUrl,
358
});
359
const settings = yield* decodeAcpRegistryAdapterSettings({
@@ -429,7 +428,7 @@ describe("AcpRegistryAdapterV2", () => {
428
})),
429
),
430
},
432
- serverConfig,
431
+ host,
432
});
433
const threadId = ThreadId.make("thread-acp-registry-fixture");
434
const runtimePolicy = ProviderAdapterV2RuntimePolicy.make({
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.testkit.ts
+6
-9
@@ -9,12 +9,12 @@ import * as Path from "effect/Path";
9
import * as Schema from "effect/Schema";
10
import { ChildProcessSpawner } from "effect/process";
11
12
-import * as ServerConfig from "../../config.ts";
12
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
13
+import { layerTestProviderHost } from "@t3tools/provider-testing/host";
14
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
15
import * as ProviderAdapterRegistry from "../ProviderAdapterRegistry.ts";
16
import type { ProviderReplayGate } from "@t3tools/provider-testing/replayGate";
17
import type { OrchestratorV2ProviderReplayHarness } from "../testkit/ProviderReplayHarness.ts";
17
-import { makeReplayServerConfig } from "../testkit/ProviderReplayHarness.ts";
18
import {
19
type AcpReplayTranscript,
20
AcpReplayTranscriptDecodeError,
@@ -37,10 +37,7 @@ function layerAcpRegistryProviderAdapterRegistryReplay(
37
transcript: AcpReplayTranscript,
38
options: { readonly replayGate?: ProviderReplayGate } = {},
39
) {
40
- const layerServerConfig = Layer.effect(
41
- ServerConfig.ServerConfig,
42
- makeReplayServerConfig(`acp-registry-${transcript.scenario}`).pipe(Effect.orDie),
43
- ).pipe(Layer.provide(NodeServices.layer));
40
+ const layerHost = layerTestProviderHost().pipe(Layer.provide(NodeServices.layer));
41
42
return ProviderAdapterRegistry.layerFromAdaptersEffect(
43
Effect.gen(function* () {
@@ -49,7 +46,7 @@ function layerAcpRegistryProviderAdapterRegistryReplay(
46
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
47
const crypto = yield* Crypto.Crypto;
48
const idAllocator = yield* IdAllocator.IdAllocatorV2;
52
- const serverConfig = yield* ServerConfig.ServerConfig;
49
+ const host = yield* ProviderHost.ProviderHost;
50
const replayGate = options.replayGate;
51
const replayDir = yield* fileSystem
52
.makeTempDirectory({
@@ -71,7 +68,7 @@ function layerAcpRegistryProviderAdapterRegistryReplay(
68
resolver: {
69
resolve: () => Effect.die("ACP registry resolver must not run during replay"),
70
},
74
- serverConfig,
71
+ host,
72
selfInvocation: yield* resolveSelfInvocation(),
73
makeRuntime: makeAcpReplayRuntime({
74
transcript,
@@ -86,7 +83,7 @@ function layerAcpRegistryProviderAdapterRegistryReplay(
83
return [adapter];
84
}),
85
).pipe(
89
- Layer.provide(Layer.mergeAll(layerServerConfig, NodeServices.layer, IdAllocator.layer)),
86
+ Layer.provide(Layer.mergeAll(layerHost, NodeServices.layer, IdAllocator.layer)),
87
// Held inbound lines must not outlive the scenario and wedge teardown.
88
Layer.merge(
89
Layer.effectDiscard(
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.ts
+9
-9
@@ -21,7 +21,7 @@ import type * as Scope from "effect/Scope";
21
import { ChildProcessSpawner } from "effect/process";
22
import * as EffectAcpErrors from "effect-acp/errors";
23
24
-import * as ServerConfig from "../../config.ts";
24
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
25
import {
26
normalizeAcpRegistryCommands,
27
normalizeAcpRegistryLiveConfiguration,
@@ -29,8 +29,8 @@ import {
29
} from "../../provider/acp/AcpRegistryProbe.ts";
30
import * as AcpRegistrySupport from "../../provider/acp/AcpRegistrySupport.ts";
31
import * as AcpRegistryRuntimeCoordinator from "../../provider/acp/AcpRegistryRuntimeCoordinator.ts";
32
-import * as AcpSessionRuntime from "../../provider/acp/AcpSessionRuntime.ts";
33
-import { makeAcpNativeLoggerFactory } from "../../provider/acp/AcpNativeLogging.ts";
32
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
33
+import { makeAcpNativeLoggerFactory } from "@t3tools/provider-acp/server/nativeLogging";
34
import * as ProviderEventLoggers from "../../provider/ProviderEventLoggers.ts";
35
import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/instanceEnvironment";
36
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
@@ -46,7 +46,7 @@ import {
46
type AcpAdapterV2ExtensionContext,
47
type AcpAdapterV2Flavor,
48
type AcpAdapterV2RuntimeInput,
49
-} from "./AcpAdapterV2.ts";
49
+} from "@t3tools/provider-acp/server/adapter";
50
51
export const ACP_REGISTRY_PROVIDER = ProviderDriverKind.make("acpRegistry");
52
export const ACP_REGISTRY_DEFAULT_INSTANCE_ID = defaultInstanceIdForDriver(ACP_REGISTRY_PROVIDER);
@@ -65,7 +65,7 @@ export interface AcpRegistryAdapterV2Options {
65
readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];
66
readonly resolver: Pick<AcpRegistrySupport.AcpRegistryCatalog["Service"], "resolve">;
67
readonly runtimeCoordinator?: AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator["Service"];
68
- readonly serverConfig: ServerConfig.ServerConfig["Service"];
68
+ readonly host: ProviderHost.ProviderHostShape;
69
readonly nativeLogging?: Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"];
70
readonly makeRuntime?: (
71
input: AcpAdapterV2RuntimeInput,
@@ -243,7 +243,7 @@ export function makeAcpRegistryAdapterV2(options: AcpRegistryAdapterV2Options) {
243
crypto: options.crypto,
244
fileSystem: options.fileSystem,
245
idAllocator: options.idAllocator,
246
- serverConfig: options.serverConfig,
246
+ host: options.host,
247
selfInvocation: options.selfInvocation,
248
// Per-agent exception (see the note above registerMistralVibeAcpExtensions):
249
// Devin runs commands through client terminals and has no ask mode over
@@ -269,7 +269,7 @@ export type AcpRegistryAdapterV2DriverEnv =
269
| IdAllocator.IdAllocatorV2
270
| Path.Path
271
| ProviderEventLoggers.ProviderEventLoggers
272
- | ServerConfig.ServerConfig;
272
+ | ProviderHost.ProviderHost;
273
274
export const AcpRegistryAdapterV2Driver: ProviderAdapterDriver<
275
AcpRegistrySettings,
@@ -287,7 +287,7 @@ export const AcpRegistryAdapterV2Driver: ProviderAdapterDriver<
287
const fileSystem = yield* FileSystem.FileSystem;
288
const idAllocator = yield* IdAllocator.IdAllocatorV2;
289
const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
290
- const serverConfig = yield* ServerConfig.ServerConfig;
290
+ const host = yield* ProviderHost.ProviderHost;
291
const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
292
const resolver = yield* AcpRegistrySupport.AcpRegistryCatalog;
293
const runtimeCoordinator = yield* Effect.serviceOption(
@@ -305,7 +305,7 @@ export const AcpRegistryAdapterV2Driver: ProviderAdapterDriver<
305
...(Option.isSome(runtimeCoordinator)
306
? { runtimeCoordinator: runtimeCoordinator.value }
307
: {}),
308
- serverConfig,
308
+ host,
309
selfInvocation,
310
nativeLogging: (threadId) =>
311
makeNativeLogger({
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts
+12
-13
@@ -22,8 +22,9 @@ import * as Stream from "effect/Stream";
22
import { ChildProcessSpawner } from "effect/process";
23
import type * as EffectAcpSchema from "effect-acp/compat";
24
25
-import * as ServerConfig from "../../config.ts";
26
-import type * as AcpSessionRuntime from "../../provider/acp/AcpSessionRuntime.ts";
25
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
26
+import { layerTestProviderHost } from "@t3tools/provider-testing/host";
27
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
28
import { makeAntigravityAcpRuntime } from "../../provider/acp/AntigravityAcpSupport.ts";
29
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
30
import { ProviderAdapterV2RuntimePolicy } from "@t3tools/provider-core/server/ProviderAdapter";
@@ -38,7 +39,7 @@ const flavor = makeAntigravityAcpAdapterFlavor({
39
fileSystem: undefined as never,
40
path: undefined as never,
41
idAllocator: undefined as never,
41
- serverConfig: undefined as never,
42
+ host: undefined as never,
43
selfInvocation: undefined as never,
44
makeRuntime: () => Effect.die("not spawned in this test"),
45
withProcess: (_stop, task) => task,
@@ -129,9 +130,7 @@ describe("AntigravityAdapterV2 flavor", () => {
130
const layerSession = Layer.mergeAll(
131
NodeServices.layer,
132
IdAllocator.layer,
132
- ServerConfig.layerTest(process.cwd(), { prefix: "t3-antigravity-v2-adapter-" }).pipe(
133
- Layer.provide(NodeServices.layer),
134
- ),
133
+ layerTestProviderHost().pipe(Layer.provide(NodeServices.layer)),
134
);
135
136
describe("AntigravityAdapterV2 client file system", () => {
@@ -140,7 +139,7 @@ describe("AntigravityAdapterV2 client file system", () => {
139
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
140
const fileSystem = yield* FileSystem.FileSystem;
141
const path = yield* Path.Path;
143
- const serverConfig = yield* ServerConfig.ServerConfig;
142
+ const host = yield* ProviderHost.ProviderHost;
143
const mockAgentPath = yield* path.fromFileUrl(
144
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
145
);
@@ -157,7 +156,7 @@ describe("AntigravityAdapterV2 client file system", () => {
156
fileSystem,
157
path,
158
idAllocator: yield* IdAllocator.IdAllocatorV2,
160
- serverConfig,
159
+ host,
160
makeRuntime: (input) =>
161
makeAntigravityAcpRuntime({
162
...input,
@@ -193,7 +192,7 @@ describe("AntigravityAdapterV2 client file system", () => {
192
});
193
const outsideFile = path.join(outside, "secret.txt");
194
yield* fileSystem.writeFileString(outsideFile, "secret");
196
- const attachment = path.join(serverConfig.attachmentsDir, "pasted.txt");
195
+ const attachment = path.join(host.paths.attachmentsDir, "pasted.txt");
196
yield* fileSystem.writeFileString(attachment, "pasted");
197
198
const threadId = ThreadId.make("thread-antigravity-containment");
@@ -294,7 +293,7 @@ describe("AntigravityAdapterV2 workspace changes", () => {
293
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
294
const fileSystem = yield* FileSystem.FileSystem;
295
const path = yield* Path.Path;
297
- const serverConfig = yield* ServerConfig.ServerConfig;
296
+ const host = yield* ProviderHost.ProviderHost;
297
const crypto = yield* Crypto.Crypto;
298
const mockAgentPath = yield* path.fromFileUrl(
299
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -309,7 +308,7 @@ describe("AntigravityAdapterV2 workspace changes", () => {
308
fileSystem,
309
path,
310
idAllocator: yield* IdAllocator.IdAllocatorV2,
312
- serverConfig,
311
+ host,
312
makeRuntime: (input) =>
313
makeAntigravityAcpRuntime({
314
...input,
@@ -431,7 +430,7 @@ describe("AntigravityAdapterV2 client file system under restrictive policies", (
430
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
431
const fileSystem = yield* FileSystem.FileSystem;
432
const path = yield* Path.Path;
434
- const serverConfig = yield* ServerConfig.ServerConfig;
433
+ const host = yield* ProviderHost.ProviderHost;
434
const crypto = yield* Crypto.Crypto;
435
const mockAgentPath = yield* path.fromFileUrl(
436
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
@@ -459,7 +458,7 @@ describe("AntigravityAdapterV2 client file system under restrictive policies", (
458
fileSystem,
459
path,
460
idAllocator: yield* IdAllocator.IdAllocatorV2,
462
- serverConfig,
461
+ host,
462
makeRuntime: (input) =>
463
makeAntigravityAcpRuntime({
464
...input,
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts
+7
-9
@@ -14,9 +14,9 @@ import * as Exit from "effect/Exit";
14
import * as Scope from "effect/Scope";
15
import * as EffectAcpErrors from "effect-acp/errors";
16
17
-import type { ServerConfig } from "../../config.ts";
17
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
18
import type { AntigravityAuth } from "../../provider/AntigravityAuth.ts";
19
-import type * as AcpSessionRuntime from "../../provider/acp/AcpSessionRuntime.ts";
19
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
20
import {
21
antigravityPermissionMode,
22
applyAntigravityAcpModelSelection,
@@ -40,7 +40,7 @@ import {
40
makeAcpAdapterV2,
41
type AcpAdapterV2Flavor,
42
type AcpAdapterV2RuntimeInput,
43
-} from "./AcpAdapterV2.ts";
43
+} from "@t3tools/provider-acp/server/adapter";
44
45
const ANTIGRAVITY_PROVIDER = ProviderDriverKind.make("antigravity");
46
@@ -68,7 +68,7 @@ export interface AntigravityAdapterV2Options {
68
readonly fileSystem: FileSystem.FileSystem;
69
readonly path: Path.Path;
70
readonly idAllocator: IdAllocatorV2["Service"];
71
- readonly serverConfig: ServerConfig["Service"];
71
+ readonly host: ProviderHost.ProviderHostShape;
72
/** Spawns the official agent with the instance's Google profile. */
73
readonly makeRuntime: (
74
input: Omit<AntigravityAcpRuntimeInput, "spawn" | "childProcessSpawner">,
@@ -125,9 +125,7 @@ export function makeAntigravityAcpAdapterFlavor(
125
// the turn text references. It is a leaf directory of uploads. A session
126
// without a workspace gets no workspace root rather than the server's cwd.
127
const antigravityClientFileRoots = (cwd: string | null) =>
128
- cwd === null
129
- ? [options.serverConfig.attachmentsDir]
130
- : [cwd, options.serverConfig.attachmentsDir];
128
+ cwd === null ? [options.host.paths.attachmentsDir] : [cwd, options.host.paths.attachmentsDir];
129
const makeRuntime = (input: AcpAdapterV2RuntimeInput) =>
130
Effect.gen(function* () {
131
// AcpAdapterV2 owns the runtime scope; sign-in and sign-out stop the
@@ -139,7 +137,7 @@ export function makeAntigravityAcpAdapterFlavor(
137
options.makeRuntime({
138
...input,
139
clientFileSystem: true,
142
- additionalDirectories: [options.serverConfig.attachmentsDir],
140
+ additionalDirectories: [options.host.paths.attachmentsDir],
141
}),
142
)
143
.pipe(Effect.provideService(Scope.Scope, scope));
@@ -233,7 +231,7 @@ export function makeAntigravityAdapterV2(options: AntigravityAdapterV2Options) {
231
crypto: options.crypto,
232
fileSystem: options.fileSystem,
233
idAllocator: options.idAllocator,
236
- serverConfig: options.serverConfig,
234
+ host: options.host,
235
selfInvocation: options.selfInvocation,
236
...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),
237
...(options.continuationRequests === undefined
apps/server/src/orchestration-v2/Adapters/DevinAcp.ts
+2
-2
@@ -1,6 +1,6 @@
1
import type * as AcpSchema from "effect-acp/compat";
2
-import type { AcpToolCallState } from "../../provider/acp/AcpRuntimeModel.ts";
3
-import type { AcpAdapterV2SubagentUpdate } from "./AcpAdapterV2.ts";
2
+import type { AcpToolCallState } from "@t3tools/provider-acp/server/runtimeModel";
3
+import type { AcpAdapterV2SubagentUpdate } from "@t3tools/provider-acp/server/adapter";
4
5
function record(value: unknown): Record<string, unknown> | undefined {
6
return typeof value === "object" && value !== null && !Array.isArray(value)
apps/server/src/orchestration-v2/Adapters/GrokAdapterV2.test.ts
+7
-8
@@ -22,7 +22,8 @@ import * as Schema from "effect/Schema";
22
import { ChildProcessSpawner } from "effect/process";
23
import type * as EffectAcpSchema from "effect-acp/compat";
24
25
-import * as ServerConfig from "../../config.ts";
25
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
26
+import { layerTestProviderHost } from "@t3tools/provider-testing/host";
27
import * as ProjectStore from "../ProjectStore.ts";
28
import { buildInitialGrokProviderSnapshot } from "../../provider/GrokProvider.ts";
29
import type { ProviderInstance } from "@t3tools/provider-core/server/driver";
@@ -30,13 +31,13 @@ import * as ProviderInstanceRegistry from "../../provider/ProviderInstanceRegist
31
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
32
import { ProviderAdapterV2RuntimePolicy } from "@t3tools/provider-core/server/ProviderAdapter";
33
import * as RuntimePolicy from "../RuntimePolicy.ts";
33
-import { acpPermissionDisposition } from "../../provider/acp/AcpClientPolicy.ts";
34
+import { acpPermissionDisposition } from "@t3tools/provider-acp/server/clientPolicy";
35
import {
36
AcpProviderCapabilitiesV2,
37
acpCompletedTurnShouldTerminalizeTool,
38
acpSubagentStatusBlocksTurnSettlement,
39
acpSupportsImagePrompts,
39
-} from "./AcpAdapterV2.ts";
40
+} from "@t3tools/provider-acp/server/adapter";
41
import {
42
makeGrokAcpAdapterFlavor,
43
makeGrokAdapterV2,
@@ -311,10 +312,8 @@ describe("Grok permission prompts", () => {
312
});
313
314
describe("Grok launch permission mode", () => {
314
- const layerServerConfig = ServerConfig.layerTest(process.cwd(), {
315
- prefix: "t3-grok-v2-launch-",
316
- }).pipe(Layer.provide(NodeServices.layer));
317
- const layerTest = Layer.mergeAll(NodeServices.layer, IdAllocator.layer, layerServerConfig);
315
+ const layerHost = layerTestProviderHost().pipe(Layer.provide(NodeServices.layer));
316
+ const layerTest = Layer.mergeAll(NodeServices.layer, IdAllocator.layer, layerHost);
317
318
// Opens a session through the adapter's own Grok runtime factory and returns
319
// the argv it tried to launch. The spawn fails after recording, so no
@@ -342,7 +341,7 @@ describe("Grok launch permission mode", () => {
341
crypto: yield* Crypto.Crypto,
342
fileSystem: yield* FileSystem.FileSystem,
343
idAllocator: yield* IdAllocator.IdAllocatorV2,
345
- serverConfig: yield* ServerConfig.ServerConfig,
344
+ host: yield* ProviderHost.ProviderHost,
345
selfInvocation: yield* resolveSelfInvocation(),
346
});
347
yield* adapter
apps/server/src/orchestration-v2/Adapters/GrokAdapterV2.testkit.ts
+6
-9
@@ -10,7 +10,8 @@ import { ChildProcessSpawner } from "effect/process";
10
import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
11
import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
12
13
-import * as ServerConfig from "../../config.ts";
13
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
14
+import { layerTestProviderHost } from "@t3tools/provider-testing/host";
15
import {
16
GROK_ACP_CANCEL_META,
17
GROK_ACP_INITIALIZE_META,
@@ -21,7 +22,6 @@ import * as ProviderContinuationRequests from "@t3tools/provider-core/server/con
22
import * as ProviderAdapterRegistry from "../ProviderAdapterRegistry.ts";
23
import type { ProviderReplayGate } from "@t3tools/provider-testing/replayGate";
24
import type { OrchestratorV2ProviderReplayHarness } from "../testkit/ProviderReplayHarness.ts";
24
-import { makeReplayServerConfig } from "../testkit/ProviderReplayHarness.ts";
25
import {
26
type AcpReplayTranscript,
27
AcpReplayTranscriptDecodeError,
@@ -37,10 +37,7 @@ function layerGrokProviderAdapterRegistryReplay(
37
transcript: AcpReplayTranscript,
38
options: { readonly replayGate?: ProviderReplayGate } = {},
39
) {
40
- const layerServerConfig = Layer.effect(
41
- ServerConfig.ServerConfig,
42
- makeReplayServerConfig(`grok-${transcript.scenario}`).pipe(Effect.orDie),
43
- ).pipe(Layer.provide(NodeServices.layer));
40
+ const layerHost = layerTestProviderHost().pipe(Layer.provide(NodeServices.layer));
41
42
return ProviderAdapterRegistry.layerFromAdaptersEffect(
43
Effect.gen(function* () {
@@ -50,7 +47,7 @@ function layerGrokProviderAdapterRegistryReplay(
47
const crypto = yield* Crypto.Crypto;
48
const hostPlatform = yield* HostProcessPlatform;
49
const idAllocator = yield* IdAllocator.IdAllocatorV2;
53
- const serverConfig = yield* ServerConfig.ServerConfig;
50
+ const host = yield* ProviderHost.ProviderHost;
51
// Same queue the continuation worker drains when the fixture runs it.
52
const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
53
const replayGate = options.replayGate;
@@ -72,7 +69,7 @@ function layerGrokProviderAdapterRegistryReplay(
69
crypto,
70
fileSystem,
71
idAllocator,
75
- serverConfig,
72
+ host,
73
selfInvocation: yield* resolveSelfInvocation(),
74
// Same wrapping as makeGrokAcpRuntime: client type and Ctrl+C cancel
75
// metadata and the x.ai prompt-completion race, so replay sends what
@@ -102,7 +99,7 @@ function layerGrokProviderAdapterRegistryReplay(
99
return [adapter];
100
}),
101
).pipe(
105
- Layer.provide(Layer.mergeAll(layerServerConfig, NodeServices.layer, IdAllocator.layer)),
102
+ Layer.provide(Layer.mergeAll(layerHost, NodeServices.layer, IdAllocator.layer)),
103
// Held inbound lines must not outlive the scenario and wedge teardown.
104
Layer.merge(
105
Layer.effectDiscard(
apps/server/src/orchestration-v2/Adapters/GrokAdapterV2.ts
+13
-13
@@ -23,8 +23,8 @@ import type * as Scope from "effect/Scope";
23
import { ChildProcessSpawner } from "effect/process";
24
import * as EffectAcpErrors from "effect-acp/errors";
25
26
-import * as ServerConfig from "../../config.ts";
27
-import { makeAcpNativeLoggerFactory } from "../../provider/acp/AcpNativeLogging.ts";
26
+import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
27
+import { makeAcpNativeLoggerFactory } from "@t3tools/provider-acp/server/nativeLogging";
28
import {
29
applyGrokAcpModelSelection,
30
currentGrokModelIdFromSessionSetup,
@@ -54,8 +54,8 @@ import {
54
XAiExitPlanModeRequest,
55
} from "../../provider/acp/XAiAcpExtension.ts";
56
import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/instanceEnvironment";
57
-import { acpPermissionDisposition } from "../../provider/acp/AcpClientPolicy.ts";
58
-import * as AcpSessionRuntime from "../../provider/acp/AcpSessionRuntime.ts";
57
+import { acpPermissionDisposition } from "@t3tools/provider-acp/server/clientPolicy";
58
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
59
import * as ProviderEventLoggers from "../../provider/ProviderEventLoggers.ts";
60
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
61
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
@@ -71,7 +71,7 @@ import {
71
type AcpAdapterV2ExtensionContext,
72
type AcpAdapterV2Flavor,
73
type AcpAdapterV2RuntimeInput,
74
-} from "./AcpAdapterV2.ts";
74
+} from "@t3tools/provider-acp/server/adapter";
75
76
export const GROK_PROVIDER = ProviderDriverKind.make("grok");
77
const GROK_DRIVER_KIND = GROK_PROVIDER;
@@ -117,7 +117,7 @@ export interface GrokAdapterV2Options {
117
readonly selfInvocation: SelfInvocation;
118
readonly fileSystem: FileSystem.FileSystem;
119
readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];
120
- readonly serverConfig: ServerConfig.ServerConfig["Service"];
120
+ readonly host: ProviderHost.ProviderHostShape;
121
readonly nativeLogging?: Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"];
122
readonly continuationRequests?: Parameters<typeof makeAcpAdapterV2>[0]["continuationRequests"];
123
readonly testHooks?: Parameters<typeof makeAcpAdapterV2>[0]["testHooks"];
@@ -337,7 +337,7 @@ export function makeGrokAdapterV2(options: GrokAdapterV2Options) {
337
crypto: options.crypto,
338
fileSystem: options.fileSystem,
339
idAllocator: options.idAllocator,
340
- serverConfig: options.serverConfig,
340
+ host: options.host,
341
selfInvocation: options.selfInvocation,
342
...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),
343
...(options.continuationRequests === undefined
@@ -354,7 +354,7 @@ export type GrokAdapterV2DriverEnv =
354
| IdAllocator.IdAllocatorV2
355
| Path.Path
356
| ProviderEventLoggers.ProviderEventLoggers
357
- | ServerConfig.ServerConfig;
357
+ | ProviderHost.ProviderHost;
358
359
export const GrokAdapterV2Driver: ProviderAdapterDriver<GrokSettings, GrokAdapterV2DriverEnv> = {
360
driverKind: GROK_DRIVER_KIND,
@@ -370,7 +370,7 @@ export const GrokAdapterV2Driver: ProviderAdapterDriver<GrokSettings, GrokAdapte
370
const fileSystem = yield* FileSystem.FileSystem;
371
const idAllocator = yield* IdAllocator.IdAllocatorV2;
372
const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
373
- const serverConfig = yield* ServerConfig.ServerConfig;
373
+ const host = yield* ProviderHost.ProviderHost;
374
const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
375
const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
376
return makeGrokAdapterV2({
@@ -382,7 +382,7 @@ export const GrokAdapterV2Driver: ProviderAdapterDriver<GrokSettings, GrokAdapte
382
crypto,
383
fileSystem,
384
idAllocator,
385
- serverConfig,
385
+ host,
386
selfInvocation,
387
continuationRequests,
388
nativeLogging: (threadId) =>
@@ -417,7 +417,7 @@ const layer: Layer.Layer<
417
| FileSystem.FileSystem
418
| IdAllocator.IdAllocatorV2
419
| ProviderEventLoggers.ProviderEventLoggers
420
- | ServerConfig.ServerConfig
420
+ | ProviderHost.ProviderHost
421
> = Layer.effect(
422
ProviderAdapter.ProviderAdapterV2,
423
Effect.gen(function* () {
@@ -429,7 +429,7 @@ const layer: Layer.Layer<
429
const fileSystem = yield* FileSystem.FileSystem;
430
const idAllocator = yield* IdAllocator.IdAllocatorV2;
431
const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
432
- const serverConfig = yield* ServerConfig.ServerConfig;
432
+ const host = yield* ProviderHost.ProviderHost;
433
const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
434
const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
435
return makeGrokAdapterV2({
@@ -441,7 +441,7 @@ const layer: Layer.Layer<
441
crypto,
442
fileSystem,
443
idAllocator,
444
- serverConfig,
444
+ host,
445
selfInvocation,
446
continuationRequests,
447
nativeLogging: (threadId) =>
apps/server/src/orchestration-v2/ProviderSelectionTransition.test.ts
+1
-1
@@ -6,7 +6,7 @@ import {
6
ProviderInstanceId,
7
} from "@t3tools/contracts";
8
9
-import { AcpProviderCapabilitiesV2 } from "./Adapters/AcpAdapterV2.ts";
9
+import { AcpProviderCapabilitiesV2 } from "@t3tools/provider-acp/server/adapter";
10
import { acpSelectionTransition } from "@t3tools/provider-core/server/selectionTransition";
11
12
const selection = (model: string, effort = "medium"): ModelSelection => ({
apps/server/src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts
+1
-1
@@ -42,7 +42,7 @@ import {
42
CodexProviderCapabilitiesV2,
43
canReuseCodexContextUsage,
44
} from "../Adapters/CodexAdapterV2.ts";
45
-import { AcpProviderCapabilitiesV2 } from "../Adapters/AcpAdapterV2.ts";
45
+import { AcpProviderCapabilitiesV2 } from "@t3tools/provider-acp/server/adapter";
46
import { CursorProviderCapabilitiesV2 } from "@t3tools/provider-cursor/testing";
47
import * as EventSink from "../EventSink.ts";
48
import * as EventStore from "../EventStore.ts";
apps/server/src/provider/AntigravityAuth.test.ts
+2
-2
@@ -17,7 +17,7 @@ import {
17
type AntigravityAuth,
18
type AntigravityAuthRuntime,
19
} from "./AntigravityAuth.ts";
20
-import type { AcpSessionRuntimeStartResult } from "./acp/AcpSessionRuntime.ts";
20
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
21
22
const instanceId = ProviderInstanceId.make("antigravity-auth-test");
23
const owner = "t3-auth-session-owner";
@@ -31,7 +31,7 @@ const initialized = {
31
authMethods: [{ id: "oauth-personal", name: "Log in with Google" }],
32
agentCapabilities: { auth: { logout: {} } },
33
} satisfies AcpSchema.InitializeResponse;
34
-const started: AcpSessionRuntimeStartResult = {
34
+const started: AcpSessionRuntime.AcpSessionRuntimeStartResult = {
35
sessionId: "native-session",
36
initializeResult: initialized,
37
sessionSetupResult: {
apps/server/src/provider/AntigravityAuth.ts
+4
-4
@@ -19,7 +19,7 @@ import * as Stream from "effect/Stream";
19
import * as SubscriptionRef from "effect/SubscriptionRef";
20
import * as AcpErrors from "effect-acp/errors";
21
22
-import type { AcpSessionRuntime, AcpSessionRuntimeStartResult } from "./acp/AcpSessionRuntime.ts";
22
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
23
import {
24
parseAntigravityAuthorizationUrl,
25
type AntigravityAuthorizationUrl,
@@ -66,19 +66,19 @@ export interface AntigravityAuth {
66
}
67
68
export type AntigravityAuthRuntime = Pick<
69
- AcpSessionRuntime["Service"],
69
+ AcpSessionRuntime.AcpSessionRuntime["Service"],
70
"initialize" | "start" | "request"
71
>;
72
73
export interface AntigravityAuthOptions<
74
- Runtime extends AntigravityAuthRuntime = AcpSessionRuntime["Service"],
74
+ Runtime extends AntigravityAuthRuntime = AcpSessionRuntime.AcpSessionRuntime["Service"],
75
> {
76
readonly instanceId: ProviderInstanceId;
77
readonly makeRuntime: (input: {
78
readonly onAuthorizationUrl?: (url: string) => Effect.Effect<void, AcpErrors.AcpError>;
79
}) => Effect.Effect<Runtime, AcpErrors.AcpError | ProviderSetupError, Scope.Scope>;
80
readonly onAuthenticated: (
81
- result: AcpSessionRuntimeStartResult,
81
+ result: AcpSessionRuntime.AcpSessionRuntimeStartResult,
82
runtime: Runtime,
83
) => Effect.Effect<void>;
84
readonly onSignedOut: Effect.Effect<void>;
apps/server/src/provider/AntigravityProvider.test.ts
+2
-2
@@ -23,7 +23,7 @@ import * as ServerConfig from "../config.ts";
23
import * as ServerSettings from "../serverSettings.ts";
24
import * as ProviderHostLive from "./ProviderHostLive.ts";
25
import * as ServerSecretStore from "../auth/ServerSecretStore.ts";
26
-import type { AcpSessionRuntimeStartResult } from "./acp/AcpSessionRuntime.ts";
26
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
27
import {
28
buildAntigravityModelsFromSession,
29
makeAntigravityProvider,
@@ -98,7 +98,7 @@ const started = {
98
initializeResult,
99
sessionSetupResult,
100
modelConfigId: "model",
101
-} satisfies AcpSessionRuntimeStartResult;
101
+} satisfies AcpSessionRuntime.AcpSessionRuntimeStartResult;
102
103
const commands = [
104
{ name: "plan", description: "Create a plan", input: { type: "text", hint: "What to plan" } },
apps/server/src/provider/AntigravityProvider.ts
+3
-3
@@ -18,7 +18,7 @@ import * as SubscriptionRef from "effect/SubscriptionRef";
18
import type * as EffectAcpErrors from "effect-acp/errors";
19
import type * as EffectAcpSchema from "effect-acp/compat";
20
21
-import type { AcpSessionRuntimeStartResult } from "./acp/AcpSessionRuntime.ts";
21
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
22
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
23
import {
24
makeManualOnlyProviderMaintenanceCapabilities,
@@ -38,7 +38,7 @@ const AUTH_UNCHECKED_MESSAGE =
38
"Antigravity is installed. Google account access is not checked yet.";
39
40
type SessionSetupResult = Pick<
41
- AcpSessionRuntimeStartResult["sessionSetupResult"],
41
+ AcpSessionRuntime.AcpSessionRuntimeStartResult["sessionSetupResult"],
42
"configOptions" | "models"
43
>;
44
@@ -256,7 +256,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
256
});
257
258
const onSessionStarted = Effect.fn("AntigravityProvider.onSessionStarted")(function* (
259
- started: AcpSessionRuntimeStartResult,
259
+ started: AcpSessionRuntime.AcpSessionRuntimeStartResult,
260
cwd?: string,
261
) {
262
const before = yield* SubscriptionRef.get(metadata);
apps/server/src/provider/Drivers/AcpRegistryDriver.ts
+3
-5
@@ -22,7 +22,6 @@ import * as Semaphore from "effect/Semaphore";
22
import { ChildProcessSpawner } from "effect/process";
23
24
import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost";
25
-import * as ServerConfig from "../../config.ts";
25
import {
26
AcpRegistryAdapterV2Driver,
27
type AcpRegistryAdapterV2DriverEnv,
@@ -489,7 +488,6 @@ export const AcpRegistryDriver: ProviderDriver<AcpRegistrySettings, AcpRegistryD
488
const crypto = yield* Crypto.Crypto;
489
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
490
const hostEnvironment = yield* HostProcessEnvironment;
492
- const serverConfig = yield* ServerConfig.ServerConfig;
491
const host = yield* ProviderHost;
492
const continuationIdentity = defaultProviderContinuationIdentity({
493
driverKind: DRIVER_KIND,
@@ -528,7 +526,7 @@ export const AcpRegistryDriver: ProviderDriver<AcpRegistrySettings, AcpRegistryD
526
};
527
const confirmedAuthentication =
528
yield* AcpRegistryAuthenticationState.makeAcpRegistryAuthenticationState({
531
- cacheDir: serverConfig.providerStatusCacheDir,
529
+ cacheDir: host.paths.providerStatusCacheDir,
530
instanceId,
531
settings: effectiveConfig,
532
environment,
@@ -573,7 +571,7 @@ export const AcpRegistryDriver: ProviderDriver<AcpRegistrySettings, AcpRegistryD
571
const enrichProvider = checkAcpRegistryProviderStatus(
572
{
573
...readinessInput,
576
- cwd: serverConfig.cwd,
574
+ cwd: host.paths.cwd,
575
},
576
probeAcpRegistryConfiguration,
577
).pipe(
@@ -768,7 +766,7 @@ export const AcpRegistryDriver: ProviderDriver<AcpRegistrySettings, AcpRegistryD
766
const controller = yield* AcpRegistryAuth.makeAcpRegistryAuth({
767
instanceId,
768
settings: effectiveConfig,
771
- cwd: serverConfig.cwd,
769
+ cwd: host.paths.cwd,
770
environment: processEnvironment,
771
onChanged: (authenticated) =>
772
confirmedAuthentication
apps/server/src/provider/Drivers/AntigravityDriver.ts
+9
-11
@@ -19,7 +19,6 @@ import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
19
import type { AcpError } from "effect-acp/errors";
20
21
import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost";
22
-import * as ServerConfig from "../../config.ts";
22
import {
23
isAntigravityTextGenerationAvailable,
24
makeAntigravityTextGeneration,
@@ -40,7 +39,7 @@ import {
39
makeAntigravityAcpRuntime,
40
type AntigravityAcpRuntimeInput,
41
} from "../acp/AntigravityAcpSupport.ts";
43
-import type { AcpSessionRuntime, AcpSessionRuntimeStartResult } from "../acp/AcpSessionRuntime.ts";
42
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
43
import type { ServerProviderDraft } from "@t3tools/provider-core/server/snapshotProbe";
44
import {
45
removeAntigravityRuntimeTempDirs,
@@ -49,7 +48,7 @@ import {
48
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
49
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
50
import { makeAntigravityAdapterV2 } from "../../orchestration-v2/Adapters/AntigravityAdapterV2.ts";
52
-import { makeAcpNativeLoggerFactory } from "../acp/AcpNativeLogging.ts";
51
+import { makeAcpNativeLoggerFactory } from "@t3tools/provider-acp/server/nativeLogging";
52
import { ProviderDriverError } from "../Errors.ts";
53
import { makeAntigravityProvider } from "../AntigravityProvider.ts";
54
import * as ProviderEventLoggers from "../ProviderEventLoggers.ts";
@@ -76,8 +75,7 @@ export type AntigravityDriverEnv =
75
| IdAllocator.IdAllocatorV2
76
| ModelManifest.ModelManifest
77
| Path.Path
79
- | ProviderEventLoggers.ProviderEventLoggers
80
- | ServerConfig.ServerConfig;
78
+ | ProviderEventLoggers.ProviderEventLoggers;
79
80
/** Each instance owns its Google profile. Executable releases are shared by the environment. */
81
export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityDriverEnv> = {
@@ -91,7 +89,7 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD
89
const fileSystem = yield* FileSystem.FileSystem;
90
const path = yield* Path.Path;
91
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
94
- const serverConfig = yield* ServerConfig.ServerConfig;
92
+ const host = yield* ProviderHost;
93
const selfInvocation = yield* resolveSelfInvocation();
94
const installation = yield* AntigravityInstallation.AntigravityInstallation;
95
const loggers = yield* ProviderEventLoggers.ProviderEventLoggers;
@@ -110,7 +108,7 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD
108
const processEnvironment = mergeProviderInstanceEnvironment(environment);
109
const userHome = resolveAntigravityUserHome(yield* HostProcessPlatform, processEnvironment);
110
const directories = yield* resolveAntigravityInstanceDirectories(
113
- serverConfig.stateDir,
111
+ host.paths.stateDir,
112
instanceId,
113
).pipe(
114
Effect.provideService(Crypto.Crypto, crypto),
@@ -158,7 +156,7 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD
156
const makeRuntime = Effect.fn("AntigravityDriver.makeRuntime")(function* (
157
input: Omit<AntigravityAcpRuntimeInput, "spawn" | "childProcessSpawner">,
158
): Effect.fn.Return<
161
- AcpSessionRuntime["Service"],
159
+ AcpSessionRuntime.AcpSessionRuntime["Service"],
160
AcpError | ProviderSetupError,
161
Scope.Scope
162
> {
@@ -303,8 +301,8 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD
301
});
302
303
const publishCatalog = (
306
- started: AcpSessionRuntimeStartResult,
307
- runtime: Pick<AcpSessionRuntime["Service"], "getEvents" | "drainEvents">,
304
+ started: AcpSessionRuntime.AcpSessionRuntimeStartResult,
305
+ runtime: Pick<AcpSessionRuntime.AcpSessionRuntime["Service"], "getEvents" | "drainEvents">,
306
): Effect.Effect<void> =>
307
Effect.gen(function* () {
308
yield* provider.onSessionStarted(started);
@@ -405,7 +403,7 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD
403
fileSystem,
404
path,
405
idAllocator,
408
- serverConfig,
406
+ host,
407
selfInvocation,
408
makeRuntime,
409
withProcess: authFlow.withProcess,
apps/server/src/provider/GrokProvider.ts
+1
-1
@@ -42,7 +42,7 @@ import {
42
makeGrokAcpRuntime,
43
resolveGrokAcpBaseModelId,
44
} from "./acp/GrokAcpSupport.ts";
45
-import { sessionModelStateFromInitialize } from "./acp/AcpRuntimeModel.ts";
45
+import { sessionModelStateFromInitialize } from "@t3tools/provider-acp/server/runtimeModel";
46
import { discoverGrokSkills } from "./Drivers/GrokSkills.ts";
47
48
const GROK_PRESENTATION = {
apps/server/src/provider/ProviderAuthService.test.ts
+1
-1
@@ -22,7 +22,7 @@ import * as SubscriptionRef from "effect/SubscriptionRef";
22
23
import * as ProjectionStore from "../orchestration-v2/ProjectionStore.ts";
24
import * as ProviderSessionManager from "../orchestration-v2/ProviderSessionManager.ts";
25
-import { AcpProviderCapabilitiesV2 } from "../orchestration-v2/Adapters/AcpAdapterV2.ts";
25
+import { AcpProviderCapabilitiesV2 } from "@t3tools/provider-acp/server/adapter";
26
import type { ProviderInstance } from "@t3tools/provider-core/server/driver";
27
import * as ProviderAuthService from "./ProviderAuthService.ts";
28
import * as ProviderInstanceRegistry from "./ProviderInstanceRegistry.ts";
apps/server/src/provider/ProviderHostLive.ts
+1
@@ -31,6 +31,7 @@ export const layer = Layer.effect(
31
baseDir: config.baseDir,
32
stateDir: config.stateDir,
33
providerStatusCacheDir: config.providerStatusCacheDir,
34
+ attachmentsDir: config.attachmentsDir,
35
},
36
settings: {
37
get: serverSettings.getSettings,
apps/server/src/provider/acp/AcpJsonRpcConnection.test.ts
+1
-1
@@ -17,7 +17,7 @@ import * as TestClock from "effect/testing/TestClock";
17
import * as Stream from "effect/Stream";
18
import { describe, expect } from "vite-plus/test";
19
20
-import * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
20
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
21
import type * as EffectAcpProtocol from "effect-acp/protocol";
22
import * as EffectAcpErrors from "effect-acp/errors";
23
apps/server/src/provider/acp/AcpRegistryAuth.test.ts
+2
-2
@@ -16,7 +16,7 @@ import { AcpRequestError } from "effect-acp/errors";
16
import * as PtyAdapter from "../../terminal/PtyAdapter.ts";
17
import { makeAcpRegistryAuth } from "./AcpRegistryAuth.ts";
18
import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
19
-import type { AcpSessionRuntime } from "./AcpSessionRuntime.ts";
19
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
20
21
const decodeSettings = Schema.decodeSync(AcpRegistrySettings);
22
const instanceId = ProviderInstanceId.make("acp-auth-test");
@@ -101,7 +101,7 @@ const makeHarness = (
101
authMethods: [{ ...method, name: `${method.name} ${version}` }],
102
};
103
let elicitation:
104
- | Parameters<AcpSessionRuntime["Service"]["handleElicitation"]>[0]
104
+ | Parameters<AcpSessionRuntime.AcpSessionRuntime["Service"]["handleElicitation"]>[0]
105
| undefined;
106
return {
107
initialize: () => Effect.succeed(initialized),
apps/server/src/provider/acp/AcpRegistryAuth.ts
+1
-1
@@ -20,7 +20,7 @@ import * as ProviderAuthFlow from "../ProviderAuthFlow.ts";
20
import { normalizeAcpRegistryAuthMethods, normalizeAcpRegistryWebUrl } from "./AcpRegistryProbe.ts";
21
import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
22
import * as AcpRegistryRuntimeCoordinator from "./AcpRegistryRuntimeCoordinator.ts";
23
-import * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
23
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
24
25
type Runtime = Pick<
26
AcpSessionRuntime.AcpSessionRuntime["Service"],
apps/server/src/provider/acp/AcpRegistryProbe.test.ts
+6
-6
@@ -12,7 +12,7 @@ import * as Schema from "effect/Schema";
12
import * as TestClock from "effect/testing/TestClock";
13
import * as EffectAcpErrors from "effect-acp/errors";
14
15
-import type { AcpSessionRuntimeStartResult } from "./AcpSessionRuntime.ts";
15
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
16
import {
17
acpRegistryProbeFailure,
18
acpRegistryProbeResult,
@@ -68,7 +68,7 @@ describe("ACP Registry probe", () => {
68
],
69
},
70
modelConfigId: "model",
71
- } satisfies AcpSessionRuntimeStartResult);
71
+ } satisfies AcpSessionRuntime.AcpSessionRuntimeStartResult);
72
73
expect(result).toEqual({
74
instanceId,
@@ -186,7 +186,7 @@ describe("ACP Registry probe", () => {
186
],
187
},
188
modelConfigId: "model",
189
- } satisfies AcpSessionRuntimeStartResult);
189
+ } satisfies AcpSessionRuntime.AcpSessionRuntimeStartResult);
190
191
expect(result.models).toEqual([
192
{ id: "sonnet", name: "Sonnet", description: "Balanced" },
@@ -216,7 +216,7 @@ describe("ACP Registry probe", () => {
216
],
217
},
218
modelConfigId: "model",
219
- } satisfies AcpSessionRuntimeStartResult);
219
+ } satisfies AcpSessionRuntime.AcpSessionRuntimeStartResult);
220
221
expect(result.models).toEqual([{ id: "valid", name: "Valid", description: null }]);
222
expect(result.currentModelId).toBeNull();
@@ -270,7 +270,7 @@ describe("ACP Registry probe", () => {
270
],
271
},
272
modelConfigId: "model",
273
- } satisfies AcpSessionRuntimeStartResult);
273
+ } satisfies AcpSessionRuntime.AcpSessionRuntimeStartResult);
274
275
expect(result.models).toEqual([
276
{ id: codexModel, name: "GPT-6.1 Sol", description: null },
@@ -312,7 +312,7 @@ describe("ACP Registry probe", () => {
312
],
313
},
314
modelConfigId: "model",
315
- } satisfies AcpSessionRuntimeStartResult);
315
+ } satisfies AcpSessionRuntime.AcpSessionRuntimeStartResult);
316
317
expect(result.models).toHaveLength(256);
318
expect(result.currentModelId).toBeNull();
apps/server/src/provider/acp/AcpRegistryProbe.ts
+3
-3
@@ -25,10 +25,10 @@ import type * as EffectAcpSchema from "effect-acp/compat";
25
26
import * as PtyAdapter from "../../terminal/PtyAdapter.ts";
27
import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
28
-import { parseSessionModeState } from "./AcpRuntimeModel.ts";
29
-import { acpProviderOptionDescriptors } from "./AcpSessionConfig.ts";
28
+import { parseSessionModeState } from "@t3tools/provider-acp/server/runtimeModel";
29
+import { acpProviderOptionDescriptors } from "@t3tools/provider-acp/server/sessionConfig";
30
import * as AcpRegistryRuntimeCoordinator from "./AcpRegistryRuntimeCoordinator.ts";
31
-import * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
31
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
32
33
const MAX_AUTH_METHODS = 32;
34
const MAX_MODELS = 256;
apps/server/src/provider/acp/AcpRegistrySupport.ts
+2
-2
@@ -43,7 +43,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/process";
43
44
import { collectUint8StreamText } from "@t3tools/provider-core/server/collectStreamText";
45
import * as ServerSettings from "../../serverSettings.ts";
46
-import type { AcpSpawnInput } from "./AcpSessionRuntime.ts";
46
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
47
48
const ACP_REGISTRY_URL = "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json";
49
@@ -444,7 +444,7 @@ export function resolveAcpRegistryDistribution(input: {
444
export interface ResolvedAcpRegistryAgent {
445
readonly agent?: AcpRegistryAgent;
446
readonly distribution: AcpRegistryDistributionKind | "local";
447
- readonly spawn: AcpSpawnInput;
447
+ readonly spawn: AcpSessionRuntime.AcpSpawnInput;
448
}
449
450
export type AcpRegistryInspection =
apps/server/src/provider/acp/AcpSessionRuntime.processTree.test.ts
+131
-126
@@ -11,29 +11,7 @@ import * as Effect from "effect/Effect";
11
import * as Exit from "effect/Exit";
12
import * as Scope from "effect/Scope";
13
14
-import {
15
- capturePosixOwnershipLedger,
16
- isSafeCgroupPath,
17
- makeLinuxCgroupController,
18
- makePosixProcessTreeController,
19
- observePosixOwnershipLedger,
20
- observePosixOwnershipLedgerContinuously,
21
- parseCgroup2Mount,
22
- parseCgroup2Mounts,
23
- parseUnifiedCgroupPath,
24
- posixProcessIsZombie,
25
- resolveLinuxCgroupTargetCommand,
26
- signalLinuxCgroupRootTerm,
27
- sweepStaleLinuxCgroupSiblings,
28
- terminateLinuxCgroupLease,
29
- terminatePosixOwnedProcessTree,
30
- wrapCommandForLinuxCgroup,
31
- type AcpOwnedPosixProcess,
32
- type AcpLinuxCgroupLease,
33
- type AcpPosixOwnershipRoot,
34
- type AcpPosixProcessIdentity,
35
- type AcpPosixProcessTreeController,
36
-} from "./AcpSessionRuntime.ts";
14
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
15
16
const threadSpawnHelperSource = NodeURL.fileURLToPath(
17
new URL("../../../scripts/acp-thread-spawn-helper.c", import.meta.url),
@@ -46,7 +24,7 @@ const identity = (
24
sid: number,
25
startTime = String(pid),
26
state = "S",
49
-): AcpPosixProcessIdentity => ({
27
+): AcpSessionRuntime.AcpPosixProcessIdentity => ({
28
executable: `/proc/${pid}/exe`,
29
pgid,
30
pid,
@@ -57,16 +35,16 @@ const identity = (
35
});
36
37
function makeController(input: {
60
- readonly processes: ReadonlyArray<AcpPosixProcessIdentity>;
38
+ readonly processes: ReadonlyArray<AcpSessionRuntime.AcpPosixProcessIdentity>;
39
readonly onProcess?: (
62
- processes: Map<number, AcpPosixProcessIdentity>,
40
+ processes: Map<number, AcpSessionRuntime.AcpPosixProcessIdentity>,
41
pid: number,
42
signal: NodeJS.Signals,
43
) => void;
44
}) {
45
const processes = new Map(input.processes.map((process) => [process.pid, process]));
46
const signals: Array<string> = [];
69
- const controller: AcpPosixProcessTreeController = {
47
+ const controller: AcpSessionRuntime.AcpPosixProcessTreeController = {
48
childPidsOf: (pid) =>
49
[...processes.values()]
50
.filter((process) => process.ppid === pid)
@@ -96,19 +74,23 @@ function processExists(pid: number): boolean {
74
75
describe("terminatePosixOwnedProcessTree", () => {
76
it("parses unified cgroup paths and escaped cgroup2 mountinfo", () => {
99
- expect(parseUnifiedCgroupPath("0::/user.slice/app.scope\n")).toBe("/user.slice/app.scope");
100
- expect(parseUnifiedCgroupPath("0::/one\n0::/two\n")).toBeUndefined();
101
- expect(isSafeCgroupPath("/user.slice/app.scope")).toBe(true);
102
- expect(isSafeCgroupPath("/user.slice/../escape")).toBe(false);
103
- expect(isSafeCgroupPath("/user.slice/app.scope (deleted)")).toBe(false);
77
+ expect(AcpSessionRuntime.parseUnifiedCgroupPath("0::/user.slice/app.scope\n")).toBe(
78
+ "/user.slice/app.scope",
79
+ );
80
+ expect(AcpSessionRuntime.parseUnifiedCgroupPath("0::/one\n0::/two\n")).toBeUndefined();
81
+ expect(AcpSessionRuntime.isSafeCgroupPath("/user.slice/app.scope")).toBe(true);
82
+ expect(AcpSessionRuntime.isSafeCgroupPath("/user.slice/../escape")).toBe(false);
83
+ expect(AcpSessionRuntime.isSafeCgroupPath("/user.slice/app.scope (deleted)")).toBe(false);
84
expect(
105
- parseCgroup2Mount(
85
+ AcpSessionRuntime.parseCgroup2Mount(
86
"42 31 0:37 /user.slice /sys/fs/cgroup/user\\040mount rw - cgroup2 cgroup2 rw\n",
87
),
88
).toEqual({ mountPoint: "/sys/fs/cgroup/user mount", root: "/user.slice" });
109
- expect(parseCgroup2Mount("42 31 0:37 / /sys/fs/cgroup rw - tmpfs tmpfs rw\n")).toBeUndefined();
89
expect(
111
- parseCgroup2Mounts(
90
+ AcpSessionRuntime.parseCgroup2Mount("42 31 0:37 / /sys/fs/cgroup rw - tmpfs tmpfs rw\n"),
91
+ ).toBeUndefined();
92
+ expect(
93
+ AcpSessionRuntime.parseCgroup2Mounts(
94
"41 31 0:36 /other /sys/fs/cgroup/other rw - cgroup2 cgroup2 rw\n" +
95
"42 31 0:37 /user.slice /sys/fs/cgroup/user rw - cgroup2 cgroup2 rw\n",
96
),
@@ -140,7 +122,7 @@ describe("terminatePosixOwnedProcessTree", () => {
122
const unrelated = writeSibling("other-lease", "0");
123
const isProcessAlive = (pid: number) => pid === process.pid || pid === liveForeignPid;
124
try {
143
- sweepStaleLinuxCgroupSiblings(parent, {
125
+ AcpSessionRuntime.sweepStaleLinuxCgroupSiblings(parent, {
126
isProcessAlive,
127
readPopulated: (path) => populatedByPath.get(path),
128
remove: (path) => {
@@ -155,7 +137,7 @@ describe("terminatePosixOwnedProcessTree", () => {
137
expect(NodeFS.existsSync(unrelated)).toBe(true);
138
// Missing populated state must not remove a sibling.
139
writeSibling(`t3-acp-${deadPid}-eeee`, null);
158
- sweepStaleLinuxCgroupSiblings(parent, {
140
+ AcpSessionRuntime.sweepStaleLinuxCgroupSiblings(parent, {
141
isProcessAlive,
142
readPopulated: (path) => populatedByPath.get(path),
143
remove: (path) => {
@@ -174,7 +156,7 @@ describe("terminatePosixOwnedProcessTree", () => {
156
it.live("preserves exact argv and strips wrapper-only environment before exec", () =>
157
Effect.gen(function* () {
158
if ((yield* HostProcessPlatform) !== "linux") return;
177
- const lease = makeLinuxCgroupController().create();
159
+ const lease = AcpSessionRuntime.makeLinuxCgroupController().create();
160
if (lease === undefined) return;
161
const scratchRoot = NodePath.join(process.cwd(), "tmp");
162
NodeFS.mkdirSync(scratchRoot, { recursive: true });
@@ -192,17 +174,27 @@ describe("terminatePosixOwnedProcessTree", () => {
174
NodeFS.symlinkSync(process.execPath, bareGrok);
175
NodeFS.symlinkSync(process.execPath, NodePath.join(relativeBin, "grok"));
176
NodeFS.symlinkSync(process.execPath, NodePath.join(validBin, "grok"));
195
- expect(resolveLinuxCgroupTargetCommand("grok", scratch, { PATH: scratch })).toBe(bareGrok);
196
- expect(resolveLinuxCgroupTargetCommand("grok", scratch, { PATH: "" })).toBe(bareGrok);
177
+ expect(
178
+ AcpSessionRuntime.resolveLinuxCgroupTargetCommand("grok", scratch, { PATH: scratch }),
179
+ ).toBe(bareGrok);
180
+ expect(AcpSessionRuntime.resolveLinuxCgroupTargetCommand("grok", scratch, { PATH: "" })).toBe(
181
+ bareGrok,
182
+ );
183
// Undefined PATH uses Node's default search path (/usr/bin:/bin), not cwd alone
184
// (bareGrok lives only in cwd / PATH=scratch).
199
- expect(resolveLinuxCgroupTargetCommand("grok", scratch, { PATH: undefined })).toBeUndefined();
200
- expect(resolveLinuxCgroupTargetCommand("node", scratch, { PATH: undefined })).toBeDefined();
201
- expect(resolveLinuxCgroupTargetCommand("grok", scratch, { PATH: "relative-bin" })).toBe(
202
- NodePath.join(relativeBin, "grok"),
203
- );
185
expect(
205
- resolveLinuxCgroupTargetCommand("grok", scratch, {
186
+ AcpSessionRuntime.resolveLinuxCgroupTargetCommand("grok", scratch, { PATH: undefined }),
187
+ ).toBeUndefined();
188
+ expect(
189
+ AcpSessionRuntime.resolveLinuxCgroupTargetCommand("node", scratch, { PATH: undefined }),
190
+ ).toBeDefined();
191
+ expect(
192
+ AcpSessionRuntime.resolveLinuxCgroupTargetCommand("grok", scratch, {
193
+ PATH: "relative-bin",
194
+ }),
195
+ ).toBe(NodePath.join(relativeBin, "grok"));
196
+ expect(
197
+ AcpSessionRuntime.resolveLinuxCgroupTargetCommand("grok", scratch, {
198
PATH: `directory-bin${NodePath.delimiter}valid-bin`,
199
}),
200
).toBe(NodePath.join(validBin, "grok"));
@@ -214,7 +206,7 @@ describe("terminatePosixOwnedProcessTree", () => {
206
" wrapper: process.env.T3_ACP_CGROUP_WRAPPER,",
207
"}));",
208
].join("\n");
217
- const wrapped = wrapCommandForLinuxCgroup(lease, linkedNode, [
209
+ const wrapped = AcpSessionRuntime.wrapCommandForLinuxCgroup(lease, linkedNode, [
210
"-e",
211
target,
212
outputPath,
@@ -236,7 +228,7 @@ describe("terminatePosixOwnedProcessTree", () => {
228
'{"args":["space value","single\'quote","double\\"quote"]}',
229
);
230
} finally {
239
- yield* terminateLinuxCgroupLease(lease).pipe(Effect.ignore);
231
+ yield* AcpSessionRuntime.terminateLinuxCgroupLease(lease).pipe(Effect.ignore);
232
NodeFS.rmSync(scratch, { recursive: true, force: true });
233
}
234
}),
@@ -251,9 +243,11 @@ describe("terminatePosixOwnedProcessTree", () => {
243
const outputPath = NodePath.join(scratch, "argv output");
244
NodeFS.mkdirSync(leasePath);
245
NodeFS.writeFileSync(NodePath.join(leasePath, "cgroup.procs"), "");
254
- const relativePath = parseUnifiedCgroupPath(NodeFS.readFileSync("/proc/self/cgroup", "utf8"));
246
+ const relativePath = AcpSessionRuntime.parseUnifiedCgroupPath(
247
+ NodeFS.readFileSync("/proc/self/cgroup", "utf8"),
248
+ );
249
expect(relativePath).toBeDefined();
256
- const lease: AcpLinuxCgroupLease = {
250
+ const lease: AcpSessionRuntime.AcpLinuxCgroupLease = {
251
contains: () => false,
252
exists: () => true,
253
path: leasePath,
@@ -264,7 +258,7 @@ describe("terminatePosixOwnedProcessTree", () => {
258
};
259
const packagedExecPath = vi.spyOn(process, "execPath", "get").mockReturnValue("/bin/sh");
260
try {
267
- const wrapped = wrapCommandForLinuxCgroup(lease, "/bin/sh", [
261
+ const wrapped = AcpSessionRuntime.wrapCommandForLinuxCgroup(lease, "/bin/sh", [
262
"-c",
263
'printf "%s\\n" "$0" "$1" "$2" "$3" "${ELECTRON_RUN_AS_NODE-}" "${T3_ACP_CGROUP_WRAPPER-}" > "$4"',
264
"packaged-target",
@@ -289,7 +283,7 @@ describe("terminatePosixOwnedProcessTree", () => {
283
/^\d+\n$/,
284
);
285
292
- const mismatch = wrapCommandForLinuxCgroup(
286
+ const mismatch = AcpSessionRuntime.wrapCommandForLinuxCgroup(
287
{ ...lease, relativePath: "/not-the-current-cgroup" },
288
"/bin/sh",
289
["-c", 'printf executed > "$0"', outputPath],
@@ -301,7 +295,11 @@ describe("terminatePosixOwnedProcessTree", () => {
295
expect(mismatchResult.status, mismatchResult.stderr).toBe(126);
296
expect(NodeFS.existsSync(outputPath)).toBe(false);
297
304
- const missingTarget = wrapCommandForLinuxCgroup(lease, "/nonexistent-t3-probe", []);
298
+ const missingTarget = AcpSessionRuntime.wrapCommandForLinuxCgroup(
299
+ lease,
300
+ "/nonexistent-t3-probe",
301
+ [],
302
+ );
303
const missingTargetResult = NodeChildProcess.spawnSync(
304
missingTarget.command,
305
missingTarget.args,
@@ -319,12 +317,12 @@ describe("terminatePosixOwnedProcessTree", () => {
317
it.live("kills a post-TERM detached double fork without touching an unrelated sentinel", () =>
318
Effect.gen(function* () {
319
if ((yield* HostProcessPlatform) !== "linux") return;
322
- const controller = makeLinuxCgroupController();
320
+ const controller = AcpSessionRuntime.makeLinuxCgroupController();
321
const lease = controller.create();
322
if (lease === undefined) return;
325
- expect(parseUnifiedCgroupPath(NodeFS.readFileSync("/proc/self/cgroup", "utf8"))).not.toBe(
326
- lease.relativePath,
327
- );
323
+ expect(
324
+ AcpSessionRuntime.parseUnifiedCgroupPath(NodeFS.readFileSync("/proc/self/cgroup", "utf8")),
325
+ ).not.toBe(lease.relativePath);
326
const scratchRoot = NodePath.join(process.cwd(), "tmp");
327
NodeFS.mkdirSync(scratchRoot, { recursive: true });
328
const scratch = NodeFS.mkdtempSync(NodePath.join(scratchRoot, "acp-cgroup-kill-"));
@@ -349,7 +347,7 @@ describe("terminatePosixOwnedProcessTree", () => {
347
"});",
348
"setInterval(() => {}, 1000);",
349
].join("\n");
352
- const wrapped = wrapCommandForLinuxCgroup(lease, process.execPath, [
350
+ const wrapped = AcpSessionRuntime.wrapCommandForLinuxCgroup(lease, process.execPath, [
351
"-e",
352
providerProgram,
353
readyPath,
@@ -386,7 +384,7 @@ describe("terminatePosixOwnedProcessTree", () => {
384
}
385
}).pipe(Effect.timeout("2 seconds"));
386
expect(processExists(detachedChildPid)).toBe(true);
389
- yield* terminateLinuxCgroupLease(lease);
387
+ yield* AcpSessionRuntime.terminateLinuxCgroupLease(lease);
388
expect(processExists(sentinel.pid!)).toBe(true);
389
yield* Effect.gen(function* () {
390
while (processExists(detachedChildPid!)) yield* Effect.sleep("10 millis");
@@ -397,11 +395,11 @@ describe("terminatePosixOwnedProcessTree", () => {
395
expect(replacement?.path).not.toBe(lease.path);
396
if (replacement !== undefined) {
397
NodeFS.mkdirSync(NodePath.join(replacement.path, "nested"));
400
- yield* terminateLinuxCgroupLease(replacement);
398
+ yield* AcpSessionRuntime.terminateLinuxCgroupLease(replacement);
399
expect(NodeFS.existsSync(replacement.path)).toBe(false);
400
}
401
} finally {
404
- yield* terminateLinuxCgroupLease(lease).pipe(Effect.ignore);
402
+ yield* AcpSessionRuntime.terminateLinuxCgroupLease(lease).pipe(Effect.ignore);
403
try {
404
process.kill(-provider.pid!, "SIGKILL");
405
} catch {
@@ -430,7 +428,7 @@ describe("terminatePosixOwnedProcessTree", () => {
428
let killCalls = 0;
429
let populated = false;
430
let removeCalls = 0;
433
- const lease: AcpLinuxCgroupLease = {
431
+ const lease: AcpSessionRuntime.AcpLinuxCgroupLease = {
432
contains: () => false,
433
exists: () => exists,
434
path: "/test/t3-acp-repopulation",
@@ -457,11 +455,11 @@ describe("terminatePosixOwnedProcessTree", () => {
455
},
456
};
457
460
- yield* terminateLinuxCgroupLease(lease);
458
+ yield* AcpSessionRuntime.terminateLinuxCgroupLease(lease);
459
expect(killCalls).toBeGreaterThanOrEqual(3);
460
expect(removeCalls).toBe(3);
461
expect(exists).toBe(false);
464
- yield* terminateLinuxCgroupLease(lease);
462
+ yield* AcpSessionRuntime.terminateLinuxCgroupLease(lease);
463
expect(removeCalls).toBe(3);
464
}),
465
);
@@ -471,7 +469,7 @@ describe("terminatePosixOwnedProcessTree", () => {
469
const removeError = Object.assign(new Error("cgroup remains busy"), {
470
code: "EBUSY",
471
});
474
- const lease: AcpLinuxCgroupLease = {
472
+ const lease: AcpSessionRuntime.AcpLinuxCgroupLease = {
473
contains: () => false,
474
exists: () => true,
475
path: "/test/t3-acp-busy",
@@ -483,7 +481,7 @@ describe("terminatePosixOwnedProcessTree", () => {
481
},
482
};
483
486
- const error = yield* Effect.flip(terminateLinuxCgroupLease(lease));
484
+ const error = yield* Effect.flip(AcpSessionRuntime.terminateLinuxCgroupLease(lease));
485
expect(error.detail).toBe("Failed to remove ACP cgroup /test/t3-acp-busy");
486
expect(error.cause).toBe(removeError);
487
}),
@@ -493,13 +491,16 @@ describe("terminatePosixOwnedProcessTree", () => {
491
const fixture = makeController({
492
processes: [server(), identity(100, process.pid, 100, 100, "owned")],
493
});
496
- const ownedRoot: AcpOwnedPosixProcess = {
494
+ const ownedRoot: AcpSessionRuntime.AcpOwnedPosixProcess = {
495
...identity(100, process.pid, 100, 100, "owned"),
496
parentExecutable: server().executable,
497
parentStartTime: server().startTime,
498
};
501
- const root: AcpPosixOwnershipRoot = { captureAttempted: true, value: ownedRoot };
502
- const lease: AcpLinuxCgroupLease = {
499
+ const root: AcpSessionRuntime.AcpPosixOwnershipRoot = {
500
+ captureAttempted: true,
501
+ value: ownedRoot,
502
+ };
503
+ const lease: AcpSessionRuntime.AcpLinuxCgroupLease = {
504
contains: () => true,
505
exists: () => true,
506
path: "/test/t3-acp-root",
@@ -508,19 +509,19 @@ describe("terminatePosixOwnedProcessTree", () => {
509
populated: () => true,
510
remove: () => undefined,
511
};
511
- signalLinuxCgroupRootTerm({ controller: fixture.controller, lease, root });
512
+ AcpSessionRuntime.signalLinuxCgroupRootTerm({ controller: fixture.controller, lease, root });
513
expect(fixture.signals).toEqual(["process:100:SIGTERM"]);
514
515
const reused = makeController({
516
processes: [server(), identity(100, process.pid, 100, 100, "reused")],
517
});
517
- signalLinuxCgroupRootTerm({ controller: reused.controller, lease, root });
518
+ AcpSessionRuntime.signalLinuxCgroupRootTerm({ controller: reused.controller, lease, root });
519
expect(reused.signals).toEqual([]);
520
521
const migrated = makeController({
522
processes: [server(), identity(100, process.pid, 100, 100, "owned")],
523
});
523
- signalLinuxCgroupRootTerm({
524
+ AcpSessionRuntime.signalLinuxCgroupRootTerm({
525
controller: migrated.controller,
526
lease: { ...lease, contains: () => false },
527
root,
@@ -565,9 +566,9 @@ describe("terminatePosixOwnedProcessTree", () => {
566
}).pipe(Effect.timeout("2 seconds"));
567
const [workerTid, childPid] = published;
568
expect(workerTid).not.toBe(helper.pid);
568
- expect(makePosixProcessTreeController("linux").childrenOf(helper.pid!)).toContainEqual(
569
- expect.objectContaining({ pid: childPid, ppid: helper.pid }),
570
- );
569
+ expect(
570
+ AcpSessionRuntime.makePosixProcessTreeController("linux").childrenOf(helper.pid!),
571
+ ).toContainEqual(expect.objectContaining({ pid: childPid, ppid: helper.pid }));
572
} finally {
573
try {
574
process.kill(-helper.pid!, "SIGKILL");
@@ -585,11 +586,11 @@ describe("terminatePosixOwnedProcessTree", () => {
586
const fixture = makeController({
587
processes: [server(), identity(100, process.pid, 100, 100), beforeExec],
588
});
588
- const frontier = new Map<number, AcpOwnedPosixProcess>();
589
+ const frontier = new Map<number, AcpSessionRuntime.AcpOwnedPosixProcess>();
590
const childQueues = new Map<number, Array<number>>();
590
- const ledger = new Map<string, AcpOwnedPosixProcess>();
591
- const root: AcpPosixOwnershipRoot = { value: undefined };
592
- observePosixOwnershipLedger({
591
+ const ledger = new Map<string, AcpSessionRuntime.AcpOwnedPosixProcess>();
592
+ const root: AcpSessionRuntime.AcpPosixOwnershipRoot = { value: undefined };
593
+ AcpSessionRuntime.observePosixOwnershipLedger({
594
childQueues,
595
controller: fixture.controller,
596
frontier,
@@ -598,7 +599,7 @@ describe("terminatePosixOwnedProcessTree", () => {
599
rootPid: 100,
600
});
601
fixture.processes.set(110, { ...beforeExec, executable: "/usr/bin/bash" });
601
- observePosixOwnershipLedger({
602
+ AcpSessionRuntime.observePosixOwnershipLedger({
603
childQueues,
604
controller: fixture.controller,
605
frontier,
@@ -610,7 +611,7 @@ describe("terminatePosixOwnedProcessTree", () => {
611
expect([...ledger.values()].find((process) => process.pid === 110)?.executable).toBe(
612
"/usr/bin/bash",
613
);
613
- yield* terminatePosixOwnedProcessTree({
614
+ yield* AcpSessionRuntime.terminatePosixOwnedProcessTree({
615
controller: fixture.controller,
616
grace: 0,
617
ledger,
@@ -623,13 +624,13 @@ describe("terminatePosixOwnedProcessTree", () => {
624
625
it("never adopts a replacement PID after initial root capture failed", () => {
626
const fixture = makeController({ processes: [server()] });
626
- const frontier = new Map<number, AcpOwnedPosixProcess>();
627
+ const frontier = new Map<number, AcpSessionRuntime.AcpOwnedPosixProcess>();
628
const childQueues = new Map<number, Array<number>>();
628
- const ledger = new Map<string, AcpOwnedPosixProcess>();
629
- const root: AcpPosixOwnershipRoot = { value: undefined };
629
+ const ledger = new Map<string, AcpSessionRuntime.AcpOwnedPosixProcess>();
630
+ const root: AcpSessionRuntime.AcpPosixOwnershipRoot = { value: undefined };
631
const capture = () => {
632
try {
632
- observePosixOwnershipLedger({
633
+ AcpSessionRuntime.observePosixOwnershipLedger({
634
childQueues,
635
controller: fixture.controller,
636
frontier,
@@ -663,7 +664,7 @@ describe("terminatePosixOwnedProcessTree", () => {
664
const fixture = makeController({
665
processes: [server(), identity(100, process.pid, 100, 100)],
666
});
666
- const controller: AcpPosixProcessTreeController = {
667
+ const controller: AcpSessionRuntime.AcpPosixProcessTreeController = {
668
...fixture.controller,
669
childPidsOf: (pid) => {
670
childListReads += 1;
@@ -678,10 +679,10 @@ describe("terminatePosixOwnedProcessTree", () => {
679
return fixture.controller.snapshot();
680
},
681
};
681
- const frontier = new Map<number, AcpOwnedPosixProcess>();
682
+ const frontier = new Map<number, AcpSessionRuntime.AcpOwnedPosixProcess>();
683
const childQueues = new Map<number, Array<number>>();
683
- const ledger = new Map<string, AcpOwnedPosixProcess>();
684
- const root: AcpPosixOwnershipRoot = { value: undefined };
684
+ const ledger = new Map<string, AcpSessionRuntime.AcpOwnedPosixProcess>();
685
+ const root: AcpSessionRuntime.AcpPosixOwnershipRoot = { value: undefined };
686
for (let index = 0; index < 5_000; index += 1) {
687
const tombstone = identity(100_000 + index, 1, 100_000 + index, 100_000 + index);
688
ledger.set(`${tombstone.pid}:${tombstone.startTime}`, {
@@ -690,7 +691,7 @@ describe("terminatePosixOwnedProcessTree", () => {
691
parentStartTime: "",
692
});
693
}
693
- observePosixOwnershipLedger({
694
+ AcpSessionRuntime.observePosixOwnershipLedger({
695
childQueues,
696
controller,
697
frontier,
@@ -714,7 +715,7 @@ describe("terminatePosixOwnedProcessTree", () => {
715
) {
716
childListReads = 0;
717
identityCalls = 0;
717
- observePosixOwnershipLedger({
718
+ AcpSessionRuntime.observePosixOwnershipLedger({
719
childQueues,
720
controller,
721
frontier,
@@ -732,7 +733,7 @@ describe("terminatePosixOwnedProcessTree", () => {
733
);
734
expect(missing, `missing after ${passes} passes`).toEqual([]);
735
expect(passes).toBeGreaterThan(2);
735
- yield* terminatePosixOwnedProcessTree({
736
+ yield* AcpSessionRuntime.terminatePosixOwnedProcessTree({
737
controller,
738
grace: 0,
739
ledger,
@@ -751,7 +752,7 @@ describe("terminatePosixOwnedProcessTree", () => {
752
const fixture = makeController({
753
processes: [server(), identity(100, process.pid, 100, 100), identity(110, 100, 110, 110)],
754
});
754
- const controller: AcpPosixProcessTreeController = {
755
+ const controller: AcpSessionRuntime.AcpPosixProcessTreeController = {
756
...fixture.controller,
757
childPidsOf: (pid) => {
758
childrenCalls += 1;
@@ -767,16 +768,16 @@ describe("terminatePosixOwnedProcessTree", () => {
768
},
769
};
770
const scope = yield* Scope.make();
770
- const frontier = new Map<number, AcpOwnedPosixProcess>();
771
+ const frontier = new Map<number, AcpSessionRuntime.AcpOwnedPosixProcess>();
772
const childQueues = new Map<number, Array<number>>();
773
let ledgerValuesCalls = 0;
773
- const ledger = new (class extends Map<string, AcpOwnedPosixProcess> {
774
- override values(): MapIterator<AcpOwnedPosixProcess> {
774
+ const ledger = new (class extends Map<string, AcpSessionRuntime.AcpOwnedPosixProcess> {
775
+ override values(): MapIterator<AcpSessionRuntime.AcpOwnedPosixProcess> {
776
ledgerValuesCalls += 1;
777
return super.values();
778
}
779
})();
779
- const root: AcpPosixOwnershipRoot = { value: undefined };
780
+ const root: AcpSessionRuntime.AcpPosixOwnershipRoot = { value: undefined };
781
for (let index = 0; index < 5_000; index += 1) {
782
const tombstone = identity(10_000 + index, 1, 10_000 + index, 10_000 + index);
783
ledger.set(`${tombstone.pid}:${tombstone.startTime}`, {
@@ -785,7 +786,7 @@ describe("terminatePosixOwnedProcessTree", () => {
786
parentStartTime: "",
787
});
788
}
788
- yield* observePosixOwnershipLedgerContinuously({
789
+ yield* AcpSessionRuntime.observePosixOwnershipLedgerContinuously({
790
childQueues,
791
controller,
792
frontier,
@@ -831,7 +832,7 @@ describe("terminatePosixOwnedProcessTree", () => {
832
},
833
});
834
834
- yield* terminatePosixOwnedProcessTree({
835
+ yield* AcpSessionRuntime.terminatePosixOwnedProcessTree({
836
controller: fixture.controller,
837
grace: 0,
838
rootPid: 100,
@@ -865,7 +866,7 @@ describe("terminatePosixOwnedProcessTree", () => {
866
},
867
});
868
868
- yield* terminatePosixOwnedProcessTree({
869
+ yield* AcpSessionRuntime.terminatePosixOwnedProcessTree({
870
controller: fixture.controller,
871
grace: 0,
872
rootPid: 100,
@@ -893,7 +894,7 @@ describe("terminatePosixOwnedProcessTree", () => {
894
});
895
896
const result = yield* Effect.exit(
896
- terminatePosixOwnedProcessTree({
897
+ AcpSessionRuntime.terminatePosixOwnedProcessTree({
898
controller: fixture.controller,
899
grace: 0,
900
rootPid: 100,
@@ -913,9 +914,13 @@ describe("terminatePosixOwnedProcessTree", () => {
914
915
it.live("does not treat zombie residual entries as teardown survivors", () =>
916
Effect.gen(function* () {
916
- expect(posixProcessIsZombie({ ...identity(1, 0, 1, 1), state: "Z" })).toBe(true);
917
- expect(posixProcessIsZombie({ ...identity(1, 0, 1, 1), state: "S" })).toBe(false);
918
- const withoutState: AcpPosixProcessIdentity = {
917
+ expect(AcpSessionRuntime.posixProcessIsZombie({ ...identity(1, 0, 1, 1), state: "Z" })).toBe(
918
+ true,
919
+ );
920
+ expect(AcpSessionRuntime.posixProcessIsZombie({ ...identity(1, 0, 1, 1), state: "S" })).toBe(
921
+ false,
922
+ );
923
+ const withoutState: AcpSessionRuntime.AcpPosixProcessIdentity = {
924
executable: "/proc/1/exe",
925
pgid: 1,
926
pid: 1,
@@ -923,7 +928,7 @@ describe("terminatePosixOwnedProcessTree", () => {
928
sid: 1,
929
startTime: "1",
930
};
926
- expect(posixProcessIsZombie(withoutState)).toBe(false);
931
+ expect(AcpSessionRuntime.posixProcessIsZombie(withoutState)).toBe(false);
932
933
const root = identity(100, process.pid, 100, 100);
934
const zombieChild = identity(110, 100, 110, 110, "110", "Z");
@@ -936,7 +941,7 @@ describe("terminatePosixOwnedProcessTree", () => {
941
processes.set(pid, { ...current, state: "Z" });
942
},
943
});
939
- yield* terminatePosixOwnedProcessTree({
944
+ yield* AcpSessionRuntime.terminatePosixOwnedProcessTree({
945
controller: fixture.controller,
946
grace: 0,
947
rootPid: 100,
@@ -948,19 +953,19 @@ describe("terminatePosixOwnedProcessTree", () => {
953
);
954
955
it("admits a live child after a free PID was previously reserved by a dead entry", () => {
951
- const staleChild: AcpOwnedPosixProcess = {
956
+ const staleChild: AcpSessionRuntime.AcpOwnedPosixProcess = {
957
...identity(200, 100, 200, 200, "stale-child"),
958
parentExecutable: `/proc/100/exe`,
959
parentStartTime: "100",
960
};
961
const liveChild = identity(200, 100, 200, 200, "live-child");
962
const root = identity(100, process.pid, 100, 100);
958
- const ownedRoot: AcpOwnedPosixProcess = {
963
+ const ownedRoot: AcpSessionRuntime.AcpOwnedPosixProcess = {
964
...root,
965
parentExecutable: `/proc/${process.pid}/exe`,
966
parentStartTime: "server",
967
};
963
- const ledger = new Map<string, AcpOwnedPosixProcess>([
968
+ const ledger = new Map<string, AcpSessionRuntime.AcpOwnedPosixProcess>([
969
[`100:${root.startTime}`, ownedRoot],
970
[`200:${staleChild.startTime}`, staleChild],
971
]);
@@ -969,7 +974,7 @@ describe("terminatePosixOwnedProcessTree", () => {
974
}).controller;
975
976
// First capture: PID 200 is free, so the dead reservation is dropped.
972
- capturePosixOwnershipLedger({
977
+ AcpSessionRuntime.capturePosixOwnershipLedger({
978
controller,
979
ledger,
980
rootPid: 100,
@@ -978,7 +983,7 @@ describe("terminatePosixOwnedProcessTree", () => {
983
expect([...ledger.values()].some((entry) => entry.pid === 200)).toBe(false);
984
985
// Second capture: a new process reuses PID 200 under the owned parent.
981
- capturePosixOwnershipLedger({
986
+ AcpSessionRuntime.capturePosixOwnershipLedger({
987
controller: makeController({ processes: [server(), root, liveChild] }).controller,
988
ledger,
989
rootPid: 100,
@@ -990,24 +995,24 @@ describe("terminatePosixOwnedProcessTree", () => {
995
});
996
997
it("admits a live child when a stale ledger entry still occupies the reused PID", () => {
993
- const staleChild: AcpOwnedPosixProcess = {
998
+ const staleChild: AcpSessionRuntime.AcpOwnedPosixProcess = {
999
...identity(200, 100, 200, 200, "stale-child"),
1000
parentExecutable: `/proc/100/exe`,
1001
parentStartTime: "100",
1002
};
1003
const liveChild = identity(200, 100, 200, 200, "live-child");
1004
const root = identity(100, process.pid, 100, 100);
1000
- const ownedRoot: AcpOwnedPosixProcess = {
1005
+ const ownedRoot: AcpSessionRuntime.AcpOwnedPosixProcess = {
1006
...root,
1007
parentExecutable: `/proc/${process.pid}/exe`,
1008
parentStartTime: "server",
1009
};
1005
- const ledger = new Map<string, AcpOwnedPosixProcess>([
1010
+ const ledger = new Map<string, AcpSessionRuntime.AcpOwnedPosixProcess>([
1011
[`100:${root.startTime}`, ownedRoot],
1012
[`200:${staleChild.startTime}`, staleChild],
1013
]);
1014
1010
- capturePosixOwnershipLedger({
1015
+ AcpSessionRuntime.capturePosixOwnershipLedger({
1016
controller: makeController({ processes: [server(), root, liveChild] }).controller,
1017
ledger,
1018
rootPid: 100,
@@ -1040,7 +1045,7 @@ describe("terminatePosixOwnedProcessTree", () => {
1045
},
1046
});
1047
1043
- yield* terminatePosixOwnedProcessTree({
1048
+ yield* AcpSessionRuntime.terminatePosixOwnedProcessTree({
1049
controller: fixture.controller,
1050
grace: 0,
1051
rootPid: 100,
@@ -1064,7 +1069,7 @@ describe("terminatePosixOwnedProcessTree", () => {
1069
},
1070
});
1071
let snapshotCalls = 0;
1067
- const controller: AcpPosixProcessTreeController = {
1072
+ const controller: AcpSessionRuntime.AcpPosixProcessTreeController = {
1073
...fixture.controller,
1074
snapshot: () => {
1075
snapshotCalls += 1;
@@ -1076,7 +1081,7 @@ describe("terminatePosixOwnedProcessTree", () => {
1081
};
1082
1083
const error = yield* Effect.flip(
1079
- terminatePosixOwnedProcessTree({
1084
+ AcpSessionRuntime.terminatePosixOwnedProcessTree({
1085
controller,
1086
discoveryPasses: 2,
1087
grace: 0,
@@ -1092,10 +1097,10 @@ describe("terminatePosixOwnedProcessTree", () => {
1097
it.live("retains the ledger across root exit and an explicit failure for finalizer retry", () =>
1098
Effect.gen(function* () {
1099
let ignoreSignals = true;
1095
- const ledger = new Map<string, AcpOwnedPosixProcess>();
1096
- const frontier = new Map<number, AcpOwnedPosixProcess>();
1100
+ const ledger = new Map<string, AcpSessionRuntime.AcpOwnedPosixProcess>();
1101
+ const frontier = new Map<number, AcpSessionRuntime.AcpOwnedPosixProcess>();
1102
const childQueues = new Map<number, Array<number>>();
1098
- const root: AcpPosixOwnershipRoot = { value: undefined };
1103
+ const root: AcpSessionRuntime.AcpPosixOwnershipRoot = { value: undefined };
1104
const fixture = makeController({
1105
processes: [
1106
server(),
@@ -1108,7 +1113,7 @@ describe("terminatePosixOwnedProcessTree", () => {
1113
if (!ignoreSignals) processes.delete(pid);
1114
},
1115
});
1111
- observePosixOwnershipLedger({
1116
+ AcpSessionRuntime.observePosixOwnershipLedger({
1117
childQueues,
1118
controller: fixture.controller,
1119
frontier,
@@ -1118,7 +1123,7 @@ describe("terminatePosixOwnedProcessTree", () => {
1123
});
1124
1125
const explicit = yield* Effect.exit(
1121
- terminatePosixOwnedProcessTree({
1126
+ AcpSessionRuntime.terminatePosixOwnedProcessTree({
1127
controller: fixture.controller,
1128
grace: 0,
1129
ledger,
@@ -1130,7 +1135,7 @@ describe("terminatePosixOwnedProcessTree", () => {
1135
expect(fixture.processes.has(111)).toBe(true);
1136
1137
fixture.processes.set(112, identity(112, 110, 112, 112));
1133
- observePosixOwnershipLedger({
1138
+ AcpSessionRuntime.observePosixOwnershipLedger({
1139
childQueues,
1140
controller: fixture.controller,
1141
frontier,
@@ -1139,7 +1144,7 @@ describe("terminatePosixOwnedProcessTree", () => {
1144
rootPid: 100,
1145
});
1146
ignoreSignals = false;
1142
- yield* terminatePosixOwnedProcessTree({
1147
+ yield* AcpSessionRuntime.terminatePosixOwnedProcessTree({
1148
controller: fixture.controller,
1149
grace: 0,
1150
ledger,
@@ -1153,7 +1158,7 @@ describe("terminatePosixOwnedProcessTree", () => {
1158
1159
it("fails closed where a stable POSIX identity provider is unavailable", () => {
1160
try {
1156
- makePosixProcessTreeController("darwin");
1161
+ AcpSessionRuntime.makePosixProcessTreeController("darwin");
1162
throw new Error("Expected Darwin process ownership to fail closed");
1163
} catch (error) {
1164
expect(error).toMatchObject({
apps/server/src/provider/acp/AntigravityAcpSupport.ts
+1
-1
@@ -22,7 +22,7 @@ import {
22
makeAntigravityStderrHandler,
23
makeAntigravityStdoutTransform,
24
} from "../antigravityAuthSupport.ts";
25
-import * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
25
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
26
import { normalizeAntigravitySessionUpdate } from "./AntigravityProtocol.ts";
27
28
export interface AntigravityAcpRuntimeInput extends Omit<
apps/server/src/provider/acp/AntigravityProtocol.test.ts
+4
-1
@@ -17,7 +17,10 @@ import {
17
sanitizeAntigravityToolPayload,
18
selectAntigravityPermissionOptionId,
19
} from "./AntigravityProtocol.ts";
20
-import { mergeToolCallState, parseSessionUpdateEvent } from "./AcpRuntimeModel.ts";
20
+import {
21
+ mergeToolCallState,
22
+ parseSessionUpdateEvent,
23
+} from "@t3tools/provider-acp/server/runtimeModel";
24
25
const isSessionNotification = Schema.is(AcpWireSchema.SessionNotification);
26
apps/server/src/provider/acp/AntigravityProtocol.ts
+1
-1
@@ -11,7 +11,7 @@ import * as Schema from "effect/Schema";
11
import type * as EffectAcpSchema from "effect-acp/compat";
12
import * as AcpWireSchema from "effect-acp/schema-v1";
13
14
-import type { AcpToolCallState } from "./AcpRuntimeModel.ts";
14
+import type { AcpToolCallState } from "@t3tools/provider-acp/server/runtimeModel";
15
16
const TOOL_TEXT_LIMIT = 8_000;
17
const TOOL_TEXT_TRUNCATED = "[Earlier output truncated]\n\n";
apps/server/src/provider/acp/GrokAcpSupport.ts
+1
-1
@@ -15,7 +15,7 @@ import * as EffectAcpErrors from "effect-acp/errors";
15
import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
16
import { normalizeModelSlug } from "@t3tools/shared/model";
17
18
-import * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
18
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
19
import { makeXAiPromptCompletionRuntime } from "./XAiAcpExtension.ts";
20
21
const GROK_API_KEY_ENV = "XAI_API_KEY";
apps/server/src/provider/acp/XAiAcpExtension.test.ts
+2
-2
@@ -34,12 +34,12 @@ import {
34
xAiSubagentFinishedNotice,
35
XAiAskUserQuestionRequest,
36
} from "./XAiAcpExtension.ts";
37
-import * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
37
+import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
38
import {
39
type AcpToolCallState,
40
mergeToolCallState,
41
parseSessionUpdateEvent,
42
-} from "./AcpRuntimeModel.ts";
42
+} from "@t3tools/provider-acp/server/runtimeModel";
43
44
const decodeXAiAskUserQuestionRequest = Schema.decodeUnknownSync(XAiAskUserQuestionRequest);
45
apps/server/src/provider/acp/XAiAcpExtension.ts
+2
-2
@@ -11,8 +11,8 @@ import * as Schema from "effect/Schema";
11
import * as EffectAcpErrors from "effect-acp/errors";
12
import type * as EffectAcpSchema from "effect-acp/compat";
13
14
-import type * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
15
-import type { AcpToolCallState } from "./AcpRuntimeModel.ts";
14
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
15
+import type { AcpToolCallState } from "@t3tools/provider-acp/server/runtimeModel";
16
17
const xAiStopReasonMissingMetaKey = "xAiStopReasonMissing";
18
export const xAiRateLimitedErrorCode = -32003;
apps/server/src/provider/antigravityAuthSupport.ts
+2
-2
@@ -17,7 +17,7 @@ import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
17
import * as AcpErrors from "effect-acp/errors";
18
19
import { collectUint8StreamText } from "@t3tools/provider-core/server/collectStreamText";
20
-import type { AcpSpawnInput } from "./acp/AcpSessionRuntime.ts";
20
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
21
import {
22
antigravityUserSkillDirectories,
23
resolveAntigravityUserHome,
@@ -440,7 +440,7 @@ export function buildAntigravityAcpSpawnInput(input: {
440
readonly auth?: AntigravityAuthConfig;
441
/** Per-process temp directory. Defaults to the profile's shared temp directory. */
442
readonly runtimeTempDirectory?: string;
443
-}): AcpSpawnInput {
443
+}): AcpSessionRuntime.AcpSpawnInput {
444
return {
445
command: input.installation.executablePath,
446
args: input.profile.platform === "linux" ? ["--uid="] : [],
apps/server/src/textGeneration/AntigravityTextGeneration.test.ts
+2
-2
@@ -20,7 +20,7 @@ import { type AcpError, AcpRequestError } from "effect-acp/errors";
20
import type * as AcpSchema from "effect-acp/compat";
21
import { expect } from "vite-plus/test";
22
23
-import type { AcpSessionRuntimeEvent } from "../provider/acp/AcpSessionRuntime.ts";
23
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
24
import { removeAntigravitySessionFiles } from "../provider/acp/AntigravitySessionFiles.ts";
25
26
import {
@@ -121,7 +121,7 @@ const makeFixture = Effect.fn("makeAntigravityTextGenerationFixture")(function*
121
122
const makeRuntime: AntigravityTextGenerationOptions["makeRuntime"] = (cwd) =>
123
Effect.gen(function* () {
124
- const events = yield* Queue.unbounded<AcpSessionRuntimeEvent>();
124
+ const events = yield* Queue.unbounded<AcpSessionRuntime.AcpSessionRuntimeEvent>();
125
state.workspaces.push(cwd);
126
expect(yield* fs.readDirectory(cwd).pipe(Effect.orDie)).toEqual([]);
127
yield* Effect.addFinalizer(() =>
apps/server/src/textGeneration/AntigravityTextGeneration.ts
+2
-2
@@ -13,7 +13,7 @@ import { type AcpError, AcpRequestError } from "effect-acp/errors";
13
14
import { applyAntigravityAcpModelSelection } from "../provider/acp/AntigravityAcpSupport.ts";
15
import { removeAntigravitySessionFiles } from "../provider/acp/AntigravitySessionFiles.ts";
16
-import type { AcpSessionRuntime } from "../provider/acp/AcpSessionRuntime.ts";
16
+import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
17
import * as TextGenerationOperations from "@t3tools/provider-core/server/textGenerationOperations";
18
19
const ANTIGRAVITY_TIMEOUT_MS = 180_000;
@@ -25,7 +25,7 @@ const decodeConfiguration = Schema.decodeEffect(Schema.fromJsonString(Configurat
25
const decodeConfigurationObject = Schema.decodeUnknownEffect(Configuration);
26
27
type AntigravityTextRuntime = Pick<
28
- AcpSessionRuntime["Service"],
28
+ AcpSessionRuntime.AcpSessionRuntime["Service"],
29
| "start"
30
| "setMode"
31
| "getConfigOptions"
docs/internals/adding-a-provider.md
+1
-1
@@ -10,7 +10,7 @@ whether a turn runs. This page lists the decisions and evidence a new driver nee
10
- **ACP agents** start as [ACP Registry](../user/providers-acp.md) entries, which follow the ACP
11
spec with no per-agent handling. An agent gets a dedicated driver only when it needs behavior the
12
spec does not cover, and then it is a small flavor over the
13
- [shared ACP adapter](../../apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.ts), like Grok
13
+ [shared ACP adapter](../../packages/provider-acp/src/server/adapter.ts), like Grok
14
and Antigravity. Never add agent-id checks to the generic registry adapter.
15
- **Other protocols** get a native adapter that implements
16
[`ProviderAdapterV2`](../../packages/provider-core/src/server/ProviderAdapter.ts), like Codex,
package.json
+1
-1
@@ -28,7 +28,7 @@
28
"tc": "vp run -r --concurrency-limit 2 typecheck",
29
"lint": "vp lint --report-unused-disable-directives",
30
"knip": "knip --preprocessor ./scripts/knip-schemas.ts",
31
- "knip:check": "knip --include files,dependencies --no-config-hints && knip --workspace apps/server --workspace apps/desktop --workspace apps/web --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --workspace packages/provider-core --workspace packages/provider-testing --workspace packages/provider-pi --workspace packages/provider-muse --workspace packages/provider-opencode --workspace packages/provider-cursor --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints",
31
+ "knip:check": "knip --include files,dependencies --no-config-hints && knip --workspace apps/server --workspace apps/desktop --workspace apps/web --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --workspace packages/provider-core --workspace packages/provider-acp --workspace packages/provider-testing --workspace packages/provider-pi --workspace packages/provider-muse --workspace packages/provider-opencode --workspace packages/provider-cursor --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints",
32
"knip:production": "knip --production --preprocessor ./scripts/knip-schemas.ts",
33
"lint:mobile": "node scripts/mobile-native-static-check.ts",
34
"test": "vp run -r test",
packages/provider-acp/package.json
new
+65
@@ -0,0 +1,65 @@
1
+{
2
+ "name": "@t3tools/provider-acp",
3
+ "private": true,
4
+ "type": "module",
5
+ "exports": {
6
+ "./server/AcpSessionRuntime": {
7
+ "types": "./src/server/AcpSessionRuntime.ts",
8
+ "import": "./src/server/AcpSessionRuntime.ts"
9
+ },
10
+ "./server/adapter": {
11
+ "types": "./src/server/adapter.ts",
12
+ "import": "./src/server/adapter.ts"
13
+ },
14
+ "./server/clientPolicy": {
15
+ "types": "./src/server/clientPolicy.ts",
16
+ "import": "./src/server/clientPolicy.ts"
17
+ },
18
+ "./server/clientTerminals": {
19
+ "types": "./src/server/clientTerminals.ts",
20
+ "import": "./src/server/clientTerminals.ts"
21
+ },
22
+ "./server/coreRuntimeEvents": {
23
+ "types": "./src/server/coreRuntimeEvents.ts",
24
+ "import": "./src/server/coreRuntimeEvents.ts"
25
+ },
26
+ "./server/mcpOverAcpBridge": {
27
+ "types": "./src/server/mcpOverAcpBridge.ts",
28
+ "import": "./src/server/mcpOverAcpBridge.ts"
29
+ },
30
+ "./server/nativeLogging": {
31
+ "types": "./src/server/nativeLogging.ts",
32
+ "import": "./src/server/nativeLogging.ts"
33
+ },
34
+ "./server/runtimeModel": {
35
+ "types": "./src/server/runtimeModel.ts",
36
+ "import": "./src/server/runtimeModel.ts"
37
+ },
38
+ "./server/sessionConfig": {
39
+ "types": "./src/server/sessionConfig.ts",
40
+ "import": "./src/server/sessionConfig.ts"
41
+ },
42
+ "./server/stderr": {
43
+ "types": "./src/server/stderr.ts",
44
+ "import": "./src/server/stderr.ts"
45
+ }
46
+ },
47
+ "scripts": {
48
+ "typecheck": "tsc --noEmit",
49
+ "test": "vp test run --config ../../vite.config.ts --dir ."
50
+ },
51
+ "dependencies": {
52
+ "@t3tools/contracts": "workspace:*",
53
+ "@t3tools/provider-core": "workspace:*",
54
+ "@t3tools/shared": "workspace:*",
55
+ "diff": "8.0.3",
56
+ "effect": "catalog:"
57
+ },
58
+ "devDependencies": {
59
+ "@effect/platform-node": "catalog:",
60
+ "@effect/vitest": "catalog:",
61
+ "@types/node": "catalog:",
62
+ "effect-acp": "workspace:*",
63
+ "vite-plus": "catalog:"
64
+ }
65
+}
packages/provider-acp/src/server/AcpSessionRuntime.ts
renamed
+3
-3
@@ -30,7 +30,7 @@ import { resolveSpawnCommand } from "@t3tools/shared/shell";
30
import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
31
32
import { signalProcessGroup } from "@t3tools/provider-core/server/processGroup";
33
-import { appendAcpStderrTail, sanitizeAcpStderrExcerpt } from "./AcpStderr.ts";
33
+import { appendAcpStderrTail, sanitizeAcpStderrExcerpt } from "./stderr.ts";
34
import {
35
collectSessionConfigOptionValues,
36
decideToolCallUpdateEmission,
@@ -47,7 +47,7 @@ import {
47
type AcpParsedSessionEvent,
48
type AcpSessionModeState,
49
type AcpToolCallState,
50
-} from "./AcpRuntimeModel.ts";
50
+} from "./runtimeModel.ts";
51
52
const MAX_SHOWN_TOOL_CALL_IDS = 256;
53
@@ -1329,7 +1329,7 @@ export class AcpSessionRuntime extends Context.Service<
1329
payload: unknown,
1330
) => Effect.Effect<void, EffectAcpErrors.AcpError>;
1331
}
1332
->()("t3/provider/acp/AcpSessionRuntime") {
1332
+>()("@t3tools/provider-acp/server/AcpSessionRuntime") {
1333
static layer(
1334
options: AcpSessionRuntimeOptions,
1335
): Layer.Layer<
packages/provider-acp/src/server/adapter.ts
renamed
+11
-19
@@ -57,12 +57,8 @@ import type * as EffectAcpProtocol from "effect-acp/protocol";
57
import type * as EffectAcpSchema from "effect-acp/compat";
58
59
import { formatReadToolLabel, formatSearchToolLabel } from "@t3tools/shared/toolActivity";
60
-import { resolveAttachmentPath } from "../../attachmentStore.ts";
61
-import * as ServerConfig from "../../config.ts";
62
-import {
63
- makeAcpMcpOverAcpBridge,
64
- type AcpMcpOverAcpBridge,
65
-} from "../../mcp/AcpMcpOverAcpBridge.ts";
60
+import type * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
61
+import { makeAcpMcpOverAcpBridge, type AcpMcpOverAcpBridge } from "./mcpOverAcpBridge.ts";
62
import { mcpToolPresentation } from "@t3tools/provider-core/server/mcpToolPresentation";
63
import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
64
import {
@@ -78,7 +74,7 @@ import {
74
type AcpAgentTerminalState,
75
type AcpSessionModeState,
76
type AcpToolCallState,
81
-} from "../../provider/acp/AcpRuntimeModel.ts";
77
+} from "./runtimeModel.ts";
78
import {
79
acpClientExecuteDisposition,
80
acpMcpToolApprovalElicitationDisposition,
@@ -86,14 +82,14 @@ import {
82
type AcpPermissionDisposition,
83
makeAcpClientPolicyGrants,
84
unknownRecord,
89
-} from "../../provider/acp/AcpClientPolicy.ts";
85
+} from "./clientPolicy.ts";
86
import {
87
makeAcpClientTerminals,
88
resolveEmbeddedTerminalContent,
89
type AcpClientTerminals,
94
-} from "../../provider/acp/AcpClientTerminals.ts";
95
-import { ACP_SESSION_MODE_OPTION_ID } from "../../provider/acp/AcpSessionConfig.ts";
96
-import * as AcpSessionRuntime from "../../provider/acp/AcpSessionRuntime.ts";
90
+} from "./clientTerminals.ts";
91
+import { ACP_SESSION_MODE_OPTION_ID } from "./sessionConfig.ts";
92
+import * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
93
import {
94
t3AcpPromptWithInstructions,
95
type T3AcpInstructionState,
@@ -487,7 +483,7 @@ export interface AcpAdapterV2Options {
483
readonly crypto: Crypto.Crypto;
484
readonly fileSystem: FileSystem.FileSystem;
485
readonly idAllocator: IdAllocator.IdAllocatorV2Shape;
490
- readonly serverConfig: ServerConfig.ServerConfig["Service"];
486
+ readonly host: ProviderHost.ProviderHostShape;
487
/** How agents spawn this install's `acp-mcp-bridge`; see `resolveSelfInvocation`. */
488
readonly selfInvocation: SelfInvocation;
489
/**
@@ -1497,7 +1493,7 @@ function shouldPersistToolUpdate(
1493
export function makeAcpAdapterV2(
1494
options: AcpAdapterV2Options,
1495
): ProviderAdapter.ProviderAdapterV2Shape {
1500
- const { flavor, fileSystem, idAllocator, serverConfig, selfInvocation: self } = options;
1496
+ const { flavor, fileSystem, idAllocator, host, selfInvocation: self } = options;
1497
const driver = flavor.driver;
1498
const continuationRequests = options.continuationRequests;
1499
const postSettleContinuationEnabled =
@@ -6781,8 +6777,7 @@ export function makeAcpAdapterV2(
6777
const messageText = providerMessageTextWithAttachmentPaths({
6778
text: turnInput.message.text,
6779
attachments: turnInput.message.attachments,
6784
- resolveAttachmentPath: (attachment) =>
6785
- resolveAttachmentPath({ attachmentsDir: serverConfig.attachmentsDir, attachment }),
6780
+ resolveAttachmentPath: host.resolveAttachmentPath,
6781
});
6782
const text = t3AcpPromptWithInstructions({
6783
prompt: messageText,
@@ -6804,10 +6799,7 @@ export function makeAcpAdapterV2(
6799
});
6800
}
6801
for (const attachment of imageAttachments) {
6807
- const path = resolveAttachmentPath({
6808
- attachmentsDir: serverConfig.attachmentsDir,
6809
- attachment: attachment as ChatAttachment,
6810
- });
6802
+ const path = host.resolveAttachmentPath(attachment as ChatAttachment);
6803
if (path === null) {
6804
return yield* new ProviderAdapter.ProviderAdapterProtocolError({
6805
driver,
packages/provider-acp/src/server/clientPolicy.test.ts
renamed
+1
-1
@@ -13,7 +13,7 @@ import {
13
acpPermissionDisposition,
14
makeAcpClientPolicyGrants,
15
type AcpRuntimePolicy,
16
-} from "./AcpClientPolicy.ts";
16
+} from "./clientPolicy.ts";
17
18
function permissionRequest(
19
kind: NonNullable<EffectAcpSchema.RequestPermissionRequest["toolCall"]["kind"]>,
packages/provider-acp/src/server/clientPolicy.ts
renamed
packages/provider-acp/src/server/clientTerminals.test.ts
renamed
+1
-1
@@ -8,7 +8,7 @@ import {
8
makeAcpClientTerminals,
9
resolveEmbeddedTerminalContent,
10
type AcpClientTerminals,
11
-} from "./AcpClientTerminals.ts";
11
+} from "./clientTerminals.ts";
12
13
const withTerminals = <A, E>(use: (terminals: AcpClientTerminals) => Effect.Effect<A, E>) =>
14
Effect.gen(function* () {
packages/provider-acp/src/server/clientTerminals.ts
renamed
packages/provider-acp/src/server/coreRuntimeEvents.test.ts
renamed
+1
-1
@@ -8,7 +8,7 @@ import {
8
makeAcpRequestOpenedEvent,
9
makeAcpRequestResolvedEvent,
10
makeAcpToolCallEvent,
11
-} from "./AcpCoreRuntimeEvents.ts";
11
+} from "./coreRuntimeEvents.ts";
12
13
describe("AcpCoreRuntimeEvents", () => {
14
it("maps ACP permission requests to canonical runtime events", () => {
packages/provider-acp/src/server/coreRuntimeEvents.ts
renamed
+1
-1
@@ -17,7 +17,7 @@ import {
17
type AcpPlanUpdate,
18
type AcpToolCallState,
19
canonicalItemTypeFromAcpToolKind,
20
-} from "./AcpRuntimeModel.ts";
20
+} from "./runtimeModel.ts";
21
22
type AcpAdapterRawSource = Extract<
23
RuntimeEventRawSource,
packages/provider-acp/src/server/mcpOverAcpBridge.test.ts
renamed
+1
-1
@@ -3,7 +3,7 @@ import { describe, expect, it } from "@effect/vitest";
3
import * as Effect from "effect/Effect";
4
import * as Fiber from "effect/Fiber";
5
6
-import { makeAcpMcpOverAcpBridge } from "./AcpMcpOverAcpBridge.ts";
6
+import { makeAcpMcpOverAcpBridge } from "./mcpOverAcpBridge.ts";
7
8
describe("AcpMcpOverAcpBridge", () => {
9
it.effect("forwards authenticated MCP requests and closes the negotiated session", () =>
packages/provider-acp/src/server/mcpOverAcpBridge.ts
renamed
+2
-2
@@ -5,7 +5,7 @@ import * as Semaphore from "effect/Semaphore";
5
import * as Stream from "effect/Stream";
6
import type * as AcpSchema from "effect-acp/compat";
7
8
-import { responsePayloads } from "./AcpMcpStdioBridge.ts";
8
+import { responsePayloads } from "@t3tools/shared/mcpResponsePayloads";
9
10
const MAX_CONNECTIONS = 16;
11
const MAX_MESSAGE_BYTES = 8 * 1024 * 1024;
@@ -133,7 +133,7 @@ export const makeAcpMcpOverAcpBridge = Effect.fn("AcpMcpOverAcpBridge.make")(fun
133
new AcpMcpOverAcpError(`T3 Code MCP endpoint responded with HTTP ${response.status}.`),
134
);
135
}
136
- const payloads = [...(yield* Stream.runCollect(responsePayloads(response)))];
136
+ const payloads = [...(yield* Stream.runCollect(responsePayloads(response, bridgeError)))];
137
for (const payload of payloads) {
138
connection.protocolVersion = protocolVersionOf(payload) ?? connection.protocolVersion;
139
}
packages/provider-acp/src/server/nativeLogging.test.ts
renamed
+3
-3
@@ -8,8 +8,8 @@ import * as Logger from "effect/Logger";
8
import * as Schema from "effect/Schema";
9
import * as AcpErrors from "effect-acp/errors";
10
11
-import type { EventNdjsonLogger } from "../EventNdjsonLogger.ts";
12
-import { makeAcpNativeLoggerFactory } from "./AcpNativeLogging.ts";
11
+import type * as ProviderEventLoggers from "@t3tools/provider-core/server/ProviderEventLoggers";
12
+import { makeAcpNativeLoggerFactory } from "./nativeLogging.ts";
13
14
const nodeServicesIt = it.layer(NodeServices.layer);
15
const encodeUnknownJson = Schema.encodeUnknownSync(Schema.fromJsonString(Schema.Unknown));
@@ -18,7 +18,7 @@ nodeServicesIt("ACP native logging", (it) => {
18
it.effect("records bounded request and protocol diagnostics without raw payloads", () =>
19
Effect.gen(function* () {
20
const records: Array<unknown> = [];
21
- const nativeEventLogger: EventNdjsonLogger = {
21
+ const nativeEventLogger: ProviderEventLoggers.EventNdjsonLogger = {
22
filePath: "/tmp/provider-native.ndjson",
23
write: (event) => Effect.sync(() => void records.push(event)),
24
close: () => Effect.void,
packages/provider-acp/src/server/nativeLogging.ts
renamed
+2
-2
@@ -6,7 +6,7 @@ import * as DateTime from "effect/DateTime";
6
import * as Effect from "effect/Effect";
7
import type * as EffectAcpProtocol from "effect-acp/protocol";
8
9
-import type { EventNdjsonLogger } from "../EventNdjsonLogger.ts";
9
+import type * as ProviderEventLoggers from "@t3tools/provider-core/server/ProviderEventLoggers";
10
import {
11
structuralProtocolMethod,
12
summarizeNativeProtocolPayload,
@@ -121,7 +121,7 @@ function filterTransientProtocolLog(
121
export const makeAcpNativeLoggerFactory = Effect.fn("makeAcpNativeLoggerFactory")(function* () {
122
const crypto = yield* Crypto.Crypto;
123
return (input: {
124
- readonly nativeEventLogger: EventNdjsonLogger | undefined;
124
+ readonly nativeEventLogger: ProviderEventLoggers.EventNdjsonLogger | undefined;
125
readonly provider: ProviderDriverKind;
126
readonly threadId: ThreadId;
127
readonly verboseProtocolLogging?: boolean;
packages/provider-acp/src/server/runtimeModel.test.ts
renamed
+1
-1
@@ -19,7 +19,7 @@ import {
19
syntheticLoadSessionResponseFromInitialize,
20
toolCallProgressLength,
21
type AcpToolCallState,
22
-} from "./AcpRuntimeModel.ts";
22
+} from "./runtimeModel.ts";
23
24
describe("AcpRuntimeModel", () => {
25
it("parses session mode state from typed ACP session setup responses", () => {
packages/provider-acp/src/server/runtimeModel.ts
renamed
packages/provider-acp/src/server/sessionConfig.test.ts
renamed
+1
-1
@@ -1,6 +1,6 @@
1
import { describe, expect, it } from "@effect/vitest";
2
3
-import { ACP_SESSION_MODE_OPTION_ID, acpProviderOptionDescriptors } from "./AcpSessionConfig.ts";
3
+import { ACP_SESSION_MODE_OPTION_ID, acpProviderOptionDescriptors } from "./sessionConfig.ts";
4
5
describe("acpProviderOptionDescriptors", () => {
6
it("maps non-model select options and excludes model and collaboration categories", () => {
packages/provider-acp/src/server/sessionConfig.ts
renamed
+1
-1
@@ -1,7 +1,7 @@
1
import type { ProviderOptionChoice, ProviderOptionDescriptor } from "@t3tools/contracts";
2
import type * as EffectAcpSchema from "effect-acp/compat";
3
4
-import type { AcpSessionModeState } from "./AcpRuntimeModel.ts";
4
+import type { AcpSessionModeState } from "./runtimeModel.ts";
5
6
/**
7
* Maps ACP session configuration and session modes onto T3's provider option
packages/provider-acp/src/server/stderr.test.ts
renamed
+1
-1
@@ -4,7 +4,7 @@ import {
4
ACP_STDERR_TAIL_MAX_CHARS,
5
appendAcpStderrTail,
6
sanitizeAcpStderrExcerpt,
7
-} from "./AcpStderr.ts";
7
+} from "./stderr.ts";
8
9
describe("AcpStderr", () => {
10
it("keeps a bounded tail of stderr chunks", () => {
packages/provider-acp/src/server/stderr.ts
renamed
packages/provider-acp/tsconfig.json
new
+7
@@ -0,0 +1,7 @@
1
+{
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": ["node"]
5
+ },
6
+ "include": ["src"]
7
+}
packages/provider-core/src/server/ProviderHost.ts
+2
@@ -32,6 +32,8 @@ export interface ProviderHostPaths {
32
readonly stateDir: string;
33
/** Scratch space for provider probes and generated helper files. */
34
readonly providerStatusCacheDir: string;
35
+ /** Where chat attachments are stored; agents that sandbox file reads must be granted it. */
36
+ readonly attachmentsDir: string;
37
}
38
39
/** One opaque credential blob in the server's secret store. Only the provider decodes it. */
packages/provider-core/src/server/managedProvider.test.ts
+1
@@ -109,6 +109,7 @@ function layerProviderHost(input: {
109
baseDir: "/t3",
110
stateDir: "/t3/userdata",
111
providerStatusCacheDir: "/t3/caches",
112
+ attachmentsDir: "/t3/userdata/attachments",
113
},
114
settings: input.settings ?? {
115
get: Effect.succeed(DEFAULT_SERVER_SETTINGS),
packages/provider-testing/src/host.ts
+7
-1
@@ -42,7 +42,13 @@ export const layerTestProviderHost = (
42
const settings = options.settings ?? DEFAULT_SERVER_SETTINGS;
43
const credentials = new Map<string, Uint8Array>();
44
return ProviderHost.ProviderHost.of({
45
- paths: { cwd: options.cwd ?? process.cwd(), baseDir, stateDir, providerStatusCacheDir },
45
+ paths: {
46
+ cwd: options.cwd ?? process.cwd(),
47
+ baseDir,
48
+ stateDir,
49
+ providerStatusCacheDir,
50
+ attachmentsDir,
51
+ },
52
settings: {
53
get: Effect.succeed(settings),
54
changes: Stream.empty,
packages/shared/package.json
+4
@@ -466,6 +466,10 @@
466
"./atomicWrite": {
467
"types": "./src/atomicWrite.ts",
468
"import": "./src/atomicWrite.ts"
469
+ },
470
+ "./mcpResponsePayloads": {
471
+ "types": "./src/mcpResponsePayloads.ts",
472
+ "import": "./src/mcpResponsePayloads.ts"
473
}
474
},
475
"scripts": {
packages/shared/src/mcpResponsePayloads.ts
new
+65
@@ -0,0 +1,65 @@
1
+// MCP responses carry opaque JSON-RPC that callers relay verbatim.
2
+// @effect-diagnostics preferSchemaOverJson:off
3
+/**
4
+ * Reads the JSON-RPC payloads of a response from an MCP streamable-HTTP
5
+ * endpoint. Used on the ACP bridge fast path, so it imports only effect core.
6
+ *
7
+ * @module mcpResponsePayloads
8
+ */
9
+import * as Effect from "effect/Effect";
10
+import * as Stream from "effect/Stream";
11
+
12
+async function* sseDataLines(response: Response): AsyncGenerator<string> {
13
+ if (response.body === null) return;
14
+ const decoder = new TextDecoder();
15
+ let buffered = "";
16
+ for await (const chunk of response.body) {
17
+ buffered += decoder.decode(chunk as Uint8Array, { stream: true });
18
+ let separatorIndex = buffered.search(/\n\n|\r\n\r\n/u);
19
+ while (separatorIndex !== -1) {
20
+ const rawEvent = buffered.slice(0, separatorIndex);
21
+ buffered = buffered.slice(separatorIndex).replace(/^(?:\r?\n){2}/u, "");
22
+ const data = rawEvent
23
+ .split(/\r?\n/u)
24
+ .filter((line) => line.startsWith("data:"))
25
+ .map((line) => line.slice("data:".length).trimStart())
26
+ .join("\n");
27
+ if (data.length > 0) yield data;
28
+ separatorIndex = buffered.search(/\n\n|\r\n\r\n/u);
29
+ }
30
+ }
31
+}
32
+
33
+export const discardResponseBody = (response: Response): Effect.Effect<void> =>
34
+ Effect.promise(() => response.body?.cancel().catch(() => undefined) ?? Promise.resolve());
35
+
36
+/**
37
+ * Every JSON-RPC payload carried by a response, in arrival order: nothing for
38
+ * notification acknowledgements, each SSE `data:` event as it streams in, or
39
+ * the single JSON body.
40
+ */
41
+export function responsePayloads<E>(
42
+ response: Response,
43
+ onError: (cause: unknown) => E,
44
+): Stream.Stream<unknown, E> {
45
+ if (response.status === 202 || response.status === 204) {
46
+ return Stream.unwrap(discardResponseBody(response).pipe(Effect.as(Stream.empty)));
47
+ }
48
+ const contentType = response.headers.get("content-type") ?? "";
49
+ if (contentType.includes("text/event-stream")) {
50
+ return Stream.fromAsyncIterable(sseDataLines(response), onError).pipe(
51
+ Stream.mapEffect((data) => Effect.try({ try: () => JSON.parse(data), catch: onError })),
52
+ );
53
+ }
54
+ return Stream.unwrap(
55
+ Effect.tryPromise({ try: () => response.text(), catch: onError }).pipe(
56
+ Effect.flatMap((text) =>
57
+ text.trim().length === 0
58
+ ? Effect.succeed(Stream.empty)
59
+ : Effect.try({ try: () => JSON.parse(text) as unknown, catch: onError }).pipe(
60
+ Effect.map((payload) => Stream.fromIterable([payload])),
61
+ ),
62
+ ),
63
+ ),
64
+ );
65
+}
pnpm-lock.yaml
+37
@@ -600,6 +600,9 @@ importers:
600
'@opencode-ai/sdk':
601
specifier: ^1.3.15
602
version: 1.15.13
603
+ '@t3tools/provider-acp':
604
+ specifier: workspace:*
605
+ version: link:../../packages/provider-acp
606
'@t3tools/provider-core':
607
specifier: workspace:*
608
version: link:../../packages/provider-core
@@ -1092,6 +1095,40 @@ importers:
1095
specifier: 1.0.0
1096
version: 1.0.0(@types/node@24.12.4)(@vitest/ui@5.0.1(vitest@5.0.1))(bufferutil@4.1.0)(esbuild@0.28.2)(jiti@2.7.0)(jsdom@30.1.0(@noble/hashes@1.8.0))(msw@2.12.11(@types/node@24.12.4)(typescript@7.0.2))(terser@5.48.0)(typescript@7.0.2)(unrun@0.2.39)(utf-8-validate@6.0.6)(yaml@2.9.0)
1097
1098
+ packages/provider-acp:
1099
+ dependencies:
1100
+ '@t3tools/contracts':
1101
+ specifier: workspace:*
1102
+ version: link:../contracts
1103
+ '@t3tools/provider-core':
1104
+ specifier: workspace:*
1105
+ version: link:../provider-core
1106
+ '@t3tools/shared':
1107
+ specifier: workspace:*
1108
+ version: link:../shared
1109
+ diff:
1110
+ specifier: 8.0.3
1111
+ version: 8.0.3
1112
+ effect:
1113
+ specifier: 4.0.1
1114
+ version: 4.0.1(patch_hash=a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f)
1115
+ devDependencies:
1116
+ '@effect/platform-node':
1117
+ specifier: 4.0.1
1118
+ version: 4.0.1(bufferutil@4.1.0)(effect@4.0.1(patch_hash=a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f))(redis@6.2.1)(utf-8-validate@6.0.6)
1119
+ '@effect/vitest':
1120
+ specifier: 4.0.1
1121
+ version: 4.0.1(patch_hash=359f6fb2f7b3ec145bb72208edb9034f02489791aa2491a55cdbd69bd56ee0d2)(@types/node@24.12.4)(@vitest/ui@5.0.1)(bufferutil@4.1.0)(effect@4.0.1(patch_hash=a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f))(esbuild@0.28.2)(jiti@2.7.0)(jsdom@30.1.0(@noble/hashes@1.8.0))(msw@2.12.11(@types/node@24.12.4)(typescript@7.0.2))(terser@5.48.0)(typescript@7.0.2)(unrun@0.2.39)(utf-8-validate@6.0.6)(yaml@2.9.0)
1122
+ '@types/node':
1123
+ specifier: 24.12.4
1124
+ version: 24.12.4
1125
+ effect-acp:
1126
+ specifier: workspace:*
1127
+ version: link:../effect-acp
1128
+ vite-plus:
1129
+ specifier: 1.0.0
1130
+ version: 1.0.0(@types/node@24.12.4)(@vitest/ui@5.0.1(vitest@5.0.1))(bufferutil@4.1.0)(esbuild@0.28.2)(jiti@2.7.0)(jsdom@30.1.0(@noble/hashes@1.8.0))(msw@2.12.11(@types/node@24.12.4)(typescript@7.0.2))(terser@5.48.0)(typescript@7.0.2)(unrun@0.2.39)(utf-8-validate@6.0.6)(yaml@2.9.0)
1131
+
1132
packages/provider-core:
1133
dependencies:
1134
'@t3tools/contracts':
scripts/release-smoke.ts
+1
@@ -31,6 +31,7 @@ const workspaceFiles = [
31
"packages/provider-core/package.json",
32
"packages/provider-testing/package.json",
33
"packages/provider-pi/package.json",
34
+ "packages/provider-acp/package.json",
35
"packages/provider-cursor/package.json",
36
"packages/provider-muse/package.json",
37
"packages/provider-opencode/package.json",